Feature/improve domain
This commit is contained in:
@@ -27,6 +27,7 @@ class DomainController extends mfBaseController {
|
||||
|
||||
protected function indexAction(): void {
|
||||
$JSGlobals = ["BASE_URL" => self::getUrl("Domain"),
|
||||
"CONTRACT_URL" => self::getUrl("Contract"),
|
||||
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||
"PAGE_TITLE" => "Domains",
|
||||
|
||||
@@ -106,7 +106,22 @@ class DomainModel {
|
||||
$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) {
|
||||
|
||||
@@ -33,13 +33,15 @@ Vue.component('Domain', {
|
||||
|
||||
<!-- Slot to show DNS records button -->
|
||||
<template v-slot:inwxroid="{ row }">
|
||||
<button type="button" class="btn btn-primary" @click="showDnsRecordsModal(row.domain)"
|
||||
:class="dnsRecordsModalLoading === row.domain ? 'disabled' : ''">
|
||||
<template v-if="dnsRecordsModalLoading === row.domain">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</template>
|
||||
<span v-else>DNS</span>
|
||||
</button>
|
||||
<div style="display: flex; justify-content: space-around; align-items: center;min-width: 38px">
|
||||
<a style="cursor: pointer;" @click="showDnsRecordsModal(row.domain)">
|
||||
<i class="fas fa-eye text-primary" title="DNS"></i>
|
||||
</a>
|
||||
<a :style="row.contractId ? 'cursor:pointer' : 'pointer-events: none; cursor: not-allowed;'"
|
||||
@click="showContract(row.contractId)">
|
||||
<i :class="row.contractId ? 'fas fa-file-contract text-primary' : 'fas fa-file-contract text-grey disabled'" title="Contract"></i>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Registrant Admin Tech Billing from domainContacts -->
|
||||
@@ -155,7 +157,7 @@ Vue.component('Domain', {
|
||||
key: "tech",
|
||||
sortable: false
|
||||
}, {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',
|
||||
key: 'Domain'
|
||||
}
|
||||
@@ -178,6 +180,14 @@ Vue.component('Domain', {
|
||||
return base
|
||||
}
|
||||
}, 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) {
|
||||
this.dnsRecordsModalLoading = domain
|
||||
this.dnsRecordsModal = {
|
||||
|
||||
Reference in New Issue
Block a user