Feature/improve domain
This commit is contained in:
@@ -27,6 +27,7 @@ class DomainController extends mfBaseController {
|
|||||||
|
|
||||||
protected function indexAction(): void {
|
protected function indexAction(): void {
|
||||||
$JSGlobals = ["BASE_URL" => self::getUrl("Domain"),
|
$JSGlobals = ["BASE_URL" => self::getUrl("Domain"),
|
||||||
|
"CONTRACT_URL" => self::getUrl("Contract"),
|
||||||
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
||||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||||
"PAGE_TITLE" => "Domains",
|
"PAGE_TITLE" => "Domains",
|
||||||
|
|||||||
@@ -106,7 +106,22 @@ class DomainModel {
|
|||||||
$rows[] = new DomainModel($row);
|
$rows[] = new DomainModel($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rows;
|
$newRows = [];
|
||||||
|
// convert domain contracts to array
|
||||||
|
$domainContracts = array_map(function ($contract) {
|
||||||
|
return $contract->toArray();
|
||||||
|
}, ContractModel::search(['product_id' => 170]));
|
||||||
|
|
||||||
|
// search for $domain->domain in $domainContracts['matchcode']
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$contract = array_filter($domainContracts, function ($contract) use ($row) {
|
||||||
|
return $contract['matchcode'] === $row->domain;
|
||||||
|
});
|
||||||
|
$row->contractId = count($contract) > 0 ? array_values($contract)[0]['id'] : null;
|
||||||
|
$newRows[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $newRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function countDomains($filters) {
|
public static function countDomains($filters) {
|
||||||
|
|||||||
@@ -33,13 +33,15 @@ Vue.component('Domain', {
|
|||||||
|
|
||||||
<!-- Slot to show DNS records button -->
|
<!-- Slot to show DNS records button -->
|
||||||
<template v-slot:inwxroid="{ row }">
|
<template v-slot:inwxroid="{ row }">
|
||||||
<button type="button" class="btn btn-primary" @click="showDnsRecordsModal(row.domain)"
|
<div style="display: flex; justify-content: space-around; align-items: center;min-width: 38px">
|
||||||
:class="dnsRecordsModalLoading === row.domain ? 'disabled' : ''">
|
<a style="cursor: pointer;" @click="showDnsRecordsModal(row.domain)">
|
||||||
<template v-if="dnsRecordsModalLoading === row.domain">
|
<i class="fas fa-eye text-primary" title="DNS"></i>
|
||||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
</a>
|
||||||
</template>
|
<a :style="row.contractId ? 'cursor:pointer' : 'pointer-events: none; cursor: not-allowed;'"
|
||||||
<span v-else>DNS</span>
|
@click="showContract(row.contractId)">
|
||||||
</button>
|
<i :class="row.contractId ? 'fas fa-file-contract text-primary' : 'fas fa-file-contract text-grey disabled'" title="Contract"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Registrant Admin Tech Billing from domainContacts -->
|
<!-- Registrant Admin Tech Billing from domainContacts -->
|
||||||
@@ -155,7 +157,7 @@ Vue.component('Domain', {
|
|||||||
key: "tech",
|
key: "tech",
|
||||||
sortable: false
|
sortable: false
|
||||||
}, {text: "Billing ID", key: "billing", sortable: false}, {text: "Name Servers", key: "ns"},
|
}, {text: "Billing ID", key: "billing", sortable: false}, {text: "Name Servers", key: "ns"},
|
||||||
{text: "DNS", key: "inwxRoId", filter: false, sortable: false, priority: 1}],
|
{text: "Actions", key: "inwxRoId", filter: false, sortable: false, priority: 1}],
|
||||||
tableHeader: 'Domains',
|
tableHeader: 'Domains',
|
||||||
key: 'Domain'
|
key: 'Domain'
|
||||||
}
|
}
|
||||||
@@ -178,6 +180,14 @@ Vue.component('Domain', {
|
|||||||
return base
|
return base
|
||||||
}
|
}
|
||||||
}, methods: {
|
}, methods: {
|
||||||
|
async showContract(contractId) {
|
||||||
|
if (!contractId) return
|
||||||
|
const contractUrl= window['TT_CONFIG']['CONTRACT_URL'] + '/view/?contract_id=' + contractId
|
||||||
|
//redirect to contractUrl in new tab
|
||||||
|
|
||||||
|
const win = window.open(contractUrl, '_blank')
|
||||||
|
win.focus()
|
||||||
|
},
|
||||||
async showDnsRecordsModal(domain) {
|
async showDnsRecordsModal(domain) {
|
||||||
this.dnsRecordsModalLoading = domain
|
this.dnsRecordsModalLoading = domain
|
||||||
this.dnsRecordsModal = {
|
this.dnsRecordsModal = {
|
||||||
|
|||||||
Reference in New Issue
Block a user