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) {
|
||||
|
||||
Reference in New Issue
Block a user