mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-27 22:53:34 +02:00
More application UI fixes
This commit is contained in:
parent
e2d040cf29
commit
68d0df2a97
2 changed files with 50 additions and 160 deletions
|
@ -986,13 +986,22 @@ class ApplicationsController extends Controller
|
|||
return $response->withHeader('Location', '/applications')->withStatus(302);
|
||||
}
|
||||
|
||||
$domain = $db->selectRow('SELECT id, name FROM application WHERE name = ?',
|
||||
$domain = $db->selectRow('SELECT id, name, clid, registrant, authinfo FROM application WHERE name = ?',
|
||||
[ $args ]);
|
||||
|
||||
$domain_status = $db->selectRow("SELECT status FROM application_status WHERE domain_id = ? AND status IN ('rejected', 'invalid')",
|
||||
[ $domain['id'] ]);
|
||||
|
||||
if ($domain_status) {
|
||||
$this->container->get('flash')->addMessage('error', 'Application can not be modified, as it has been already processed.');
|
||||
return $response->withHeader('Location', '/applications')->withStatus(302);
|
||||
}
|
||||
|
||||
$domainName = $domain['name'];
|
||||
$domain_id = $domain['id'];
|
||||
$application_id = $domain['id'];
|
||||
$registrant_id = $domain['registrant'];
|
||||
$authinfo = $domain['authinfo'];
|
||||
$registrar_id_domain = $domain['clid'];
|
||||
|
||||
$parts = extractDomainAndTLD($domainName);
|
||||
$label = $parts['domain'];
|
||||
|
@ -1019,14 +1028,14 @@ class ApplicationsController extends Controller
|
|||
$registrar_balance = $result['accountBalance'];
|
||||
$creditLimit = $result['creditLimit'];
|
||||
|
||||
$date_add = 12;
|
||||
|
||||
$returnValue = getDomainPrice($db, $domainName, $tld_id, $date_add, 'create');
|
||||
$price = $returnValue['price'];
|
||||
|
||||
try {
|
||||
$db->beginTransaction();
|
||||
|
||||
$date_add = 12;
|
||||
|
||||
$currentDateTime = new \DateTime();
|
||||
$crdate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||
|
||||
|
@ -1097,163 +1106,38 @@ class ApplicationsController extends Controller
|
|||
]
|
||||
);
|
||||
|
||||
if (!empty($nameservers)) {
|
||||
foreach ($nameservers as $index => $nameserver) {
|
||||
|
||||
$internal_host = false;
|
||||
|
||||
$result = $db->select('SELECT tld FROM domain_tld');
|
||||
|
||||
foreach ($result as $row) {
|
||||
if ('.' . strtoupper($domain_extension) === strtoupper($row['tld'])) {
|
||||
$internal_host = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$hostName_already_exist = $db->selectValue(
|
||||
'SELECT id FROM host WHERE name = ? LIMIT 1',
|
||||
[$nameserver]
|
||||
$host_map_id = $db->select(
|
||||
'SELECT host_id FROM application_host_map WHERE domain_id = ?',
|
||||
[$application_id]
|
||||
);
|
||||
|
||||
if ($hostName_already_exist) {
|
||||
$domain_host_map_id = $db->selectValue(
|
||||
'SELECT domain_id FROM domain_host_map WHERE domain_id = ? AND host_id = ? LIMIT 1',
|
||||
[$domain_id, $hostName_already_exist]
|
||||
);
|
||||
|
||||
if (!$domain_host_map_id) {
|
||||
foreach ($host_map_id as $item) {
|
||||
// Insert into domain_host_map for each host_id
|
||||
$db->insert(
|
||||
'domain_host_map',
|
||||
[
|
||||
'domain_id' => $domain_id,
|
||||
'host_id' => $hostName_already_exist
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$currentDateTime = new \DateTime();
|
||||
$logdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||
$db->insert(
|
||||
'error_log',
|
||||
[
|
||||
'registrar_id' => $clid,
|
||||
'log' => "Domain : $domainName ; hostName : $nameserver - is duplicated",
|
||||
'date' => $logdate
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$currentDateTime = new \DateTime();
|
||||
$host_date = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||
|
||||
if ($internal_host) {
|
||||
$db->insert(
|
||||
'host',
|
||||
[
|
||||
'name' => $nameserver,
|
||||
'domain_id' => $domain_id,
|
||||
'clid' => $clid,
|
||||
'crid' => $clid,
|
||||
'crdate' => $host_date
|
||||
]
|
||||
);
|
||||
$host_id = $db->getlastInsertId();
|
||||
} else {
|
||||
$db->insert(
|
||||
'host',
|
||||
[
|
||||
'name' => $nameserver,
|
||||
'clid' => $clid,
|
||||
'crid' => $clid,
|
||||
'crdate' => $host_date
|
||||
]
|
||||
);
|
||||
$host_id = $db->getlastInsertId();
|
||||
}
|
||||
|
||||
$db->insert(
|
||||
'domain_host_map',
|
||||
[
|
||||
'domain_id' => $domain_id,
|
||||
'host_id' => $host_id
|
||||
]
|
||||
);
|
||||
|
||||
$db->insert(
|
||||
'host_status',
|
||||
[
|
||||
'status' => 'ok',
|
||||
'host_id' => $host_id
|
||||
]
|
||||
);
|
||||
|
||||
if ($internal_host) {
|
||||
if (empty($nameserver_ipv4[$index]) && empty($nameserver_ipv6[$index])) {
|
||||
return view($response, 'admin/domains/createDomain.twig', [
|
||||
'domainName' => $domainName,
|
||||
'error' => 'Error: No IPv4 or IPv6 addresses provided for internal host',
|
||||
'registrars' => $registrars,
|
||||
'registrar' => $registrar,
|
||||
]);
|
||||
}
|
||||
|
||||
if (isset($nameserver_ipv4[$index]) && !empty($nameserver_ipv4[$index])) {
|
||||
$ipv4 = normalize_v4_address($nameserver_ipv4[$index]);
|
||||
|
||||
$db->insert(
|
||||
'host_addr',
|
||||
[
|
||||
'host_id' => $host_id,
|
||||
'addr' => $ipv4,
|
||||
'ip' => 'v4'
|
||||
'host_id' => $item['host_id']
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($nameserver_ipv6[$index]) && !empty($nameserver_ipv6[$index])) {
|
||||
$ipv6 = normalize_v6_address($nameserver_ipv6[$index]);
|
||||
|
||||
$db->insert(
|
||||
'host_addr',
|
||||
[
|
||||
'host_id' => $host_id,
|
||||
'addr' => $ipv6,
|
||||
'ip' => 'v6'
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$contacts = [
|
||||
'admin' => $data['contactAdmin'] ?? null,
|
||||
'tech' => $data['contactTech'] ?? null,
|
||||
'billing' => $data['contactBilling'] ?? null
|
||||
];
|
||||
|
||||
foreach ($contacts as $type => $contact) {
|
||||
if ($contact !== null) {
|
||||
$contact_id = $db->selectValue(
|
||||
'SELECT id FROM contact WHERE identifier = ? LIMIT 1',
|
||||
[$contact]
|
||||
$contact_map_id = $db->select(
|
||||
'SELECT contact_id, type FROM application_contact_map WHERE domain_id = ?',
|
||||
[$application_id]
|
||||
);
|
||||
|
||||
// Check if $contact_id is not null before insertion
|
||||
if ($contact_id !== null) {
|
||||
foreach ($contact_map_id as $item) {
|
||||
// Insert into domain_contact_map for each contact_id
|
||||
$db->insert(
|
||||
'domain_contact_map',
|
||||
[
|
||||
'domain_id' => $domain_id,
|
||||
'contact_id' => $contact_id,
|
||||
'type' => $type
|
||||
'contact_id' => $item['contact_id'],
|
||||
'type' => $item['type']
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = $db->selectRow(
|
||||
'SELECT crdate,exdate FROM domain WHERE name = ? LIMIT 1',
|
||||
|
|
|
@ -16,10 +16,16 @@
|
|||
var rowData = cell.getRow().getData();
|
||||
var actionButtons = '';
|
||||
|
||||
// Common action button for all statuses
|
||||
var isRejected = rowData.application_status.some(statusObj => statusObj.status && statusObj.status.includes('rejected'));
|
||||
var isInvalid = rowData.application_status.some(statusObj => statusObj.status && statusObj.status.includes('invalid'));
|
||||
|
||||
if (!isRejected && !isInvalid) {
|
||||
actionButtons += `<a class="btn btn-green btn-icon" href="application/approve/${cell.getRow().getData().name}" title="Approve Application"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" /></svg></a> `;
|
||||
actionButtons += `<a class="btn btn-warning btn-icon" href="application/reject/${cell.getRow().getData().name}" title="Reject Application"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M5.7 5.7l12.6 12.6" /></svg></a> `;
|
||||
actionButtons += `<a class="btn btn-info btn-icon" href="application/update/${cell.getRow().getData().name}" title="Update Application"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path><path d="M16 5l3 3"></path></svg></a> `;
|
||||
}
|
||||
|
||||
// Common action button for all statuses
|
||||
actionButtons += `<a class="btn btn-danger btn-icon" href="application/delete/${cell.getRow().getData().name}" title="Delete Application"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></a>`;
|
||||
|
||||
return actionButtons;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue