Reworked Client Domains, added mail host and dns host, made all the host columns sortable by reworking the logic and optimized the code further

This commit is contained in:
johnnyq
2024-04-10 13:21:45 -04:00
parent 7ca4163552
commit 88a96e3044
8 changed files with 159 additions and 28 deletions

View File

@@ -70,6 +70,47 @@ function populateDomainEditModal(client_id, domain_id) {
}
});
// DNS Host dropdown
var dnshostDropdown = document.getElementById("editDomainDNShostId");
// Clear registrar dropdown
var i, L = dnshostDropdown.options.length -1;
for(i = L; i >= 0; i--) {
dnshostDropdown.remove(i);
}
dnshostDropdown[dnshostDropdown.length] = new Option('- Vendor -', '0');
// Populate dropdown
vendors.forEach(vendor => {
if (parseInt(vendor.vendor_id) == parseInt(domain.domain_dnshost)) {
// Selected domain
dnshostDropdown[dnshostDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id, true, true);
}
else{
dnshostDropdown[dnshostDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id);
}
});
// Mail Host dropdown
var mailhostDropdown = document.getElementById("editDomainMailhostId");
// Clear mailhost dropdown
var i, L = mailhostDropdown.options.length -1;
for(i = L; i >= 0; i--) {
mailhostDropdown.remove(i);
}
mailhostDropdown[mailhostDropdown.length] = new Option('- Vendor -', '0');
// Populate dropdown
vendors.forEach(vendor => {
if (parseInt(vendor.vendor_id) == parseInt(domain.domain_mailhost)) {
// Selected domain
mailhostDropdown[mailhostDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id, true, true);
}
else{
mailhostDropdown[mailhostDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id);
}
});
}
);