DomainUpdate CP almost ready

This commit is contained in:
Pinga 2023-12-04 14:25:37 +02:00
parent 4b7500c397
commit a7aa791fb5
13 changed files with 1130 additions and 115 deletions

View file

@ -25,11 +25,11 @@
{{ __('View Reports') }}
</a>
</span>
<a href="{{route('domaincreate')}}" class="btn btn-primary d-none d-sm-inline-block">
<a href="{{route('createDomain')}}" class="btn btn-primary d-none d-sm-inline-block">
<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"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
{{ __('Create new domain') }}
</a>
<a href="{{route('domaincreate')}}" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" aria-label="{{ __('Create new domain') }}">
<a href="{{route('createDomain')}}" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" aria-label="{{ __('Create new domain') }}">
<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"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
</a>
</div>
@ -45,7 +45,7 @@
<div class="row row-cards">
{% if registrars %}
<div class="col-sm-6 col-lg-3">
<a class="card card-link" href="{{route('domains')}}">
<a class="card card-link" href="{{route('listDomains')}}">
<div class="card-body">
<div class="row align-items-center">
<div class="col-auto">

View file

@ -0,0 +1,291 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('Editing Domain') }} {{ domain.name }}{% endblock %}
{% block content %}
<div class="page-wrapper">
<!-- Page header -->
<div class="page-header d-print-none">
<div class="container-xl">
<div class="row g-2 align-items-center">
<div class="col">
<!-- Page pre-title -->
<div class="page-pretitle">
Overview
</div>
<h2 class="page-title">
{{ __('Editing Domain') }} {{ domain.name }}
</h2>
</div>
</div>
</div>
</div>
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
<form id="domainCreateForm" action="/domain/update" method="post">
{{ csrf.field | raw }}
<div class="col-12">
{% if domainName is defined and crdate is defined %}
<div class="alert alert-important alert-success alert-dismissible" role="alert">
<div class="d-flex">
<div>
<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>
</div>
<div>
&nbsp;{{ __('Domain') }} <strong>{{ domainName }}</strong> {{ __('has been created successfully on') }} <strong>{{ crdate|date("Y-m-d H:i:s") }}!</strong>
</div>
</div>
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
</div>
{% elseif error is defined %}
<div class="alert alert-important alert-danger alert-dismissible" role="alert">
<div class="d-flex">
<div>
<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="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" /><path d="M12 8v4" /><path d="M12 16h.01" /></svg>
</div>
<div>
&nbsp;{{ __('Domain') }} <strong>{{ domainName }}</strong> {{ __('can not be created') }}: <strong>{{ error }}</strong>
</div>
</div>
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
</div>
{% endif %}
<div class="card mb-3">
<div class="card-header">
<h3 class="card-title">
Domain {{ domain.name }}&nbsp;
{% if domainStatus.status %}
<span class="status status-green" title="Status">{{ domainStatus.status }}</span>&nbsp;
{% endif %}
<span class="status status-info" title="Status">{{ domain.rgpstatus }}</span>
</h3>
</div>
<div class="card-body">
<div class="datagrid">
<div class="datagrid-item">
<div class="datagrid-title">Registered On</div>
<div class="datagrid-content">{{ domain.crdate }}</div>
</div>
<div class="datagrid-item">
<div class="datagrid-title">Last Updated</div>
<div class="datagrid-content">{{ domain.update }}</div>
</div>
<div class="datagrid-item">
<div class="datagrid-title">Expiration Date</div>
<div class="datagrid-content">{{ domain.exdate }}</div>
</div>
<div class="datagrid-item">
<div class="datagrid-title">Registrar</div>
<div class="datagrid-content">{{ registrar.name }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<!-- Fields for 4 contacts with roles -->
<div class="col">
<div class="mb-3">
<label for="contactRegistrant" class="form-label required">{{ __('Contacts') }}</label>
<input type="text" class="form-control mb-2" placeholder="{{ __('Registrant Contact') }}" name="contactRegistrant" id="contactRegistrant" value="{{ domainRegistrant.identifier }}" required="required">
{% set contactAdmin = '' %}
{% set contactTech = '' %}
{% set contactBilling = '' %}
{% for contact in domainContacts %}
{% if contact.type == 'admin' %}
{% set contactAdmin = contact.identifier %}
{% elseif contact.type == 'tech' %}
{% set contactTech = contact.identifier %}
{% elseif contact.type == 'billing' %}
{% set contactBilling = contact.identifier %}
{% endif %}
{% endfor %}
<input type="text" class="form-control mb-2" placeholder="{{ __('Admin Contact') }}" name="contactAdmin" value="{{ contactAdmin }}">
<input type="text" class="form-control mb-2" placeholder="{{ __('Tech Contact') }}" name="contactTech" value="{{ contactTech }}">
<input type="text" class="form-control mb-2" placeholder="{{ __('Billing Contact') }}" name="contactBilling" value="{{ contactBilling }}">
</div>
<!-- AuthInfo -->
<div class="mb-3">
<label for="authInfo" class="form-label">{{ __('Auth Info') }}</label>
<input type="text" class="form-control" id="authInfo" name="authInfo" value="{{ domainAuth.authinfo }}">
</div>
</div>
<!-- Fields for nameservers -->
<div class="col">
<div id="nameserverFields">
<label class="form-label">{{ __('Nameservers') }}</label>
{% for host in domainHosts %}
<div class="nameserver-group mb-1 row">
<!-- Nameserver -->
<div class="col-md-12">
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} {{ loop.index }}" name="nameserver[]" value="{{ host.name }}" required autocapitalize="none">
</div>
</div>
{% endfor %}
</div>
<button type="button" id="addNameserver" class="btn btn-success btn-sm mb-2">+</button>
<button type="button" id="removeNameserver" class="btn btn-danger btn-sm mb-2">-</button>
</div>
</div>
{% if domainSecdns|length > 0 %}
<!-- DNSSEC data is available, display the form directly -->
<div id="dnssecData" class="mb-3">
<label for="authInfo" class="form-label">{{ __('DNSSEC Data') }}</label>
<div class="table-responsive">
<table class="table table-vcenter card-table table-striped">
{% for row in domainSecdns %}
<tr>
{% for key, value in row %}
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
<th>{{ key }}</th>
{% endif %}
{% endfor %}
</tr>
<tr>
{% for key, value in row %}
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
<td>{{ value }}</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</table>
</div>
</div>
{% else %}
<!-- DNSSEC Data with checkbox -->
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="addDnssec" name="addDnssec">
<label class="form-check-label" for="addDnssec">{{ __('Add DNSSEC Data') }}</label>
</div>
<div id="dnssecData" style="display: none;">
<div class="mb-3">
<label for="dsKeyTag" class="form-label">{{ __('DS Record') }}</label>
<input type="text" class="form-control mb-2" placeholder="{{ __('Key Tag') }}" name="dsKeyTag" id="dsKeyTag">
<select class="form-control mb-2" name="dsAlg">
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
<option value="1">RSA/MD5 (deprecated)</option>
<option value="3">DSA/SHA1</option>
<option value="5">RSA/SHA-1</option>
<!-- Add other algorithms as required -->
</select>
<select class="form-control mb-2" name="dsDigestType">
<option value="" disabled selected>{{ __('Select Digest Type') }}</option>
<option value="1">SHA-1</option>
<option value="2">SHA-256</option>
<!-- Add other digest types as required -->
</select>
<input type="text" class="form-control mb-2" placeholder="{{ __('Digest') }}" name="dsDigest">
</div>
<div class="mb-3">
<label for="dnskeyFlags" class="form-label">{{ __('DNSKEY Record') }}</label>
<input type="number" class="form-control mb-2" placeholder="{{ __('Flags') }}" name="dnskeyFlags" id="dnskeyFlags">
<input type="number" class="form-control mb-2" placeholder="{{ __('Protocol') }}" name="dnskeyProtocol" value="3" readonly> <!-- Protocol is typically set to 3 -->
<select class="form-control mb-2" name="dnskeyAlg">
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
<option value="1">RSA/MD5 (deprecated)</option>
<option value="3">DSA/SHA1</option>
<option value="5">RSA/SHA-1</option>
<!-- Add other algorithms as required -->
</select>
<input type="text" class="form-control mb-2" placeholder="{{ __('Public Key') }}" name="dnskeyPubKey">
</div>
</div>
{% endif %}
</div>
<div class="card-footer">
<div class="row align-items-center">
<div class="col-auto">
<button type="submit" class="btn btn-primary">{{ __('Update Domain') }}</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<footer class="footer footer-transparent d-print-none">
<div class="container-xl">
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item">
Copyright &copy; 2023
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
</li>
</ul>
</div>
</div>
</div>
</footer>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const addNameserverBtn = document.getElementById('addNameserver');
const removeNameserverBtn = document.getElementById('removeNameserver');
const nameserverFields = document.getElementById('nameserverFields');
function createNameserverGroup(count) {
const group = document.createElement('div');
group.className = 'nameserver-group mb-1 row';
const nameserverCol = document.createElement('div');
nameserverCol.className = 'col-md-12';
const nameserverField = document.createElement('input');
nameserverField.type = 'text';
nameserverField.className = 'form-control mb-1';
nameserverField.placeholder = `{{ __('Nameserver') }} ${count}`;
nameserverField.name = `nameserver[]`;
nameserverCol.appendChild(nameserverField);
group.appendChild(nameserverCol);
return group;
}
// Add nameserver fields
let nameserverCount = {{ domainHosts|length }}; // Initialize count based on the number of domain hosts
addNameserverBtn.addEventListener('click', function() {
if (nameserverCount < 13) {
nameserverCount++;
const nameserverGroup = createNameserverGroup(nameserverCount);
nameserverFields.appendChild(nameserverGroup);
}
});
// Remove nameserver group
removeNameserverBtn.addEventListener('click', function() {
if (nameserverCount > 2) {
const lastGroup = nameserverFields.querySelector('.nameserver-group:last-child');
if (lastGroup) {
nameserverFields.removeChild(lastGroup);
nameserverCount--;
}
}
});
// Display DNSSEC data when the checkbox is ticked
document.getElementById('addDnssec').addEventListener('change', function() {
const dnssecData = document.getElementById('dnssecData');
if (this.checked) {
dnssecData.style.display = 'block';
} else {
dnssecData.style.display = 'none';
}
});
});
</script>
{% endblock %}

View file

@ -21,15 +21,15 @@
<div class="col-auto ms-auto d-print-none">
<div class="btn-list">
<span class="d-none d-sm-inline">
<a href="{{route('domaincheck')}}" class="btn">
<a href="{{route('checkDomain')}}" class="btn">
{{ __('Check Domain') }}
</a>
</span>
<a href="{{route('domaincreate')}}" class="btn btn-primary d-none d-sm-inline-block">
<a href="{{route('createDomain')}}" class="btn btn-primary d-none d-sm-inline-block">
<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"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
{{ __('Create Domain') }}
</a>
<a href="{{route('domaincreate')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create Domain') }}">
<a href="{{route('createDomain')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create Domain') }}">
<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"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
</a>
</div>

View file

@ -0,0 +1,267 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('Updating Domain') }} {{ domain.name }}{% endblock %}
{% block content %}
<div class="page-wrapper">
<!-- Page header -->
<div class="page-header d-print-none">
<div class="container-xl">
<div class="row g-2 align-items-center">
<div class="col">
<!-- Page pre-title -->
<div class="page-pretitle">
Overview
</div>
<h2 class="page-title">
{{ __('Updating Domain') }} {{ domain.name }}
</h2>
</div>
</div>
</div>
</div>
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
<form id="domainCreateForm" action="/domain/update" method="post">
{{ csrf.field | raw }}
<div class="col-12">
{% include 'partials/flash.twig' %}
<div class="card mb-3">
<div class="card-header">
<h3 class="card-title">
Domain {{ domain.name }}&nbsp;<input type="hidden" name="domainName" value="{{ domain.name }}">
{% if domainStatus.status %}
<span class="status status-green" title="Status">{{ domainStatus.status }}</span>&nbsp;
{% endif %}
<span class="status status-info" title="Status">{{ domain.rgpstatus }}</span>
</h3>
</div>
<div class="card-body">
<div class="datagrid">
<div class="datagrid-item">
<div class="datagrid-title">Registered On</div>
<div class="datagrid-content">{{ domain.crdate }}</div>
</div>
<div class="datagrid-item">
<div class="datagrid-title">Last Updated</div>
<div class="datagrid-content">{{ domain.update }}</div>
</div>
<div class="datagrid-item">
<div class="datagrid-title">Expiration Date</div>
<div class="datagrid-content">{{ domain.exdate }}</div>
</div>
<div class="datagrid-item">
<div class="datagrid-title">Registrar</div>
<div class="datagrid-content">{{ registrar.name }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<!-- Fields for 4 contacts with roles -->
<div class="col">
<div class="mb-3">
<label for="contactRegistrant" class="form-label required">{{ __('Contacts') }}</label>
<input type="text" class="form-control mb-2" placeholder="{{ __('Registrant Contact') }}" name="contactRegistrant" id="contactRegistrant" value="{{ domainRegistrant.identifier }}" required="required">
{% set contactAdmin = '' %}
{% set contactTech = '' %}
{% set contactBilling = '' %}
{% for contact in domainContacts %}
{% if contact.type == 'admin' %}
{% set contactAdmin = contact.identifier %}
{% elseif contact.type == 'tech' %}
{% set contactTech = contact.identifier %}
{% elseif contact.type == 'billing' %}
{% set contactBilling = contact.identifier %}
{% endif %}
{% endfor %}
<input type="text" class="form-control mb-2" placeholder="{{ __('Admin Contact') }}" name="contactAdmin" value="{{ contactAdmin }}">
<input type="text" class="form-control mb-2" placeholder="{{ __('Tech Contact') }}" name="contactTech" value="{{ contactTech }}">
<input type="text" class="form-control mb-2" placeholder="{{ __('Billing Contact') }}" name="contactBilling" value="{{ contactBilling }}">
</div>
<!-- AuthInfo -->
<div class="mb-3">
<label for="authInfo" class="form-label">{{ __('Auth Info') }}</label>
<input type="text" class="form-control" id="authInfo" name="authInfo" value="{{ domainAuth.authinfo }}">
</div>
</div>
<!-- Fields for nameservers -->
<div class="col">
<div id="nameserverFields">
<label class="form-label">{{ __('Nameservers') }}</label>
{% for host in domainHosts %}
<div class="nameserver-group mb-1 row">
<!-- Nameserver -->
<div class="col-md-12">
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} {{ loop.index }}" name="nameserver[]" value="{{ host.name }}" autocapitalize="none">
</div>
</div>
{% endfor %}
</div>
<button type="button" id="addNameserver" class="btn btn-success btn-sm mb-2">+</button>
<button type="button" id="removeNameserver" class="btn btn-danger btn-sm mb-2">-</button>
</div>
</div>
{% if domainSecdns|length > 0 %}
<!-- DNSSEC data is available, display the form directly -->
<div id="dnssecData" class="mb-3">
<label for="authInfo" class="form-label">{{ __('DNSSEC Data') }}</label>
<div class="table-responsive">
<table class="table table-vcenter card-table table-striped">
{% for row in domainSecdns %}
<tr>
{% for key, value in row %}
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
<th>{{ key }}</th>
{% endif %}
{% endfor %}
</tr>
<tr>
{% for key, value in row %}
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
<td>{{ value }}</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</table>
</div>
</div>
{% else %}
<!-- DNSSEC Data with checkbox -->
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="addDnssec" name="addDnssec">
<label class="form-check-label" for="addDnssec">{{ __('Add DNSSEC Data') }}</label>
</div>
<div id="dnssecData" style="display: none;">
<div class="mb-3">
<label for="dsKeyTag" class="form-label">{{ __('DS Record') }}</label>
<input type="text" class="form-control mb-2" placeholder="{{ __('Key Tag') }}" name="dsKeyTag" id="dsKeyTag">
<select class="form-control mb-2" name="dsAlg">
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
<option value="1">RSA/MD5 (deprecated)</option>
<option value="3">DSA/SHA1</option>
<option value="5">RSA/SHA-1</option>
<!-- Add other algorithms as required -->
</select>
<select class="form-control mb-2" name="dsDigestType">
<option value="" disabled selected>{{ __('Select Digest Type') }}</option>
<option value="1">SHA-1</option>
<option value="2">SHA-256</option>
<!-- Add other digest types as required -->
</select>
<input type="text" class="form-control mb-2" placeholder="{{ __('Digest') }}" name="dsDigest">
</div>
<div class="mb-3">
<label for="dnskeyFlags" class="form-label">{{ __('DNSKEY Record') }}</label>
<input type="number" class="form-control mb-2" placeholder="{{ __('Flags') }}" name="dnskeyFlags" id="dnskeyFlags">
<input type="number" class="form-control mb-2" placeholder="{{ __('Protocol') }}" name="dnskeyProtocol" value="3" readonly> <!-- Protocol is typically set to 3 -->
<select class="form-control mb-2" name="dnskeyAlg">
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
<option value="1">RSA/MD5 (deprecated)</option>
<option value="3">DSA/SHA1</option>
<option value="5">RSA/SHA-1</option>
<!-- Add other algorithms as required -->
</select>
<input type="text" class="form-control mb-2" placeholder="{{ __('Public Key') }}" name="dnskeyPubKey">
</div>
</div>
{% endif %}
</div>
<div class="card-footer">
<div class="row align-items-center">
<div class="col-auto">
<button type="submit" class="btn btn-primary">{{ __('Update Domain') }}</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<footer class="footer footer-transparent d-print-none">
<div class="container-xl">
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item">
Copyright &copy; 2023
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
</li>
</ul>
</div>
</div>
</div>
</footer>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const addNameserverBtn = document.getElementById('addNameserver');
const removeNameserverBtn = document.getElementById('removeNameserver');
const nameserverFields = document.getElementById('nameserverFields');
function createNameserverGroup(count) {
const group = document.createElement('div');
group.className = 'nameserver-group mb-1 row';
const nameserverCol = document.createElement('div');
nameserverCol.className = 'col-md-12';
const nameserverField = document.createElement('input');
nameserverField.type = 'text';
nameserverField.className = 'form-control mb-1';
nameserverField.placeholder = `{{ __('Nameserver') }} ${count}`;
nameserverField.name = `nameserver[]`;
nameserverCol.appendChild(nameserverField);
group.appendChild(nameserverCol);
return group;
}
// Add nameserver fields
let nameserverCount = {{ domainHosts|length }}; // Initialize count based on the number of domain hosts
addNameserverBtn.addEventListener('click', function() {
if (nameserverCount < 13) {
nameserverCount++;
const nameserverGroup = createNameserverGroup(nameserverCount);
nameserverFields.appendChild(nameserverGroup);
}
});
// Remove nameserver group
removeNameserverBtn.addEventListener('click', function() {
if (nameserverCount > 2) {
const lastGroup = nameserverFields.querySelector('.nameserver-group:last-child');
if (lastGroup) {
nameserverFields.removeChild(lastGroup);
nameserverCount--;
}
}
});
// Display DNSSEC data when the checkbox is ticked
document.getElementById('addDnssec').addEventListener('change', function() {
const dnssecData = document.getElementById('dnssecData');
if (this.checked) {
dnssecData.style.display = 'block';
} else {
dnssecData.style.display = 'none';
}
});
});
</script>
{% endblock %}

View file

@ -83,28 +83,31 @@
</span>
</a>
</li>
<li {{ is_current_url('domains') or is_current_url('domaincheck') or is_current_url('domaincreate') or is_current_url('transfers') or 'domain' in currentUri ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
<li {{ is_current_url('listDomains') or is_current_url('checkDomain') or is_current_url('createDomain') or is_current_url('listTransfers') or is_current_url('requestTransfer') or 'domain' in currentUri ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
<span class="nav-link-icon d-md-none d-lg-inline-block"><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="M19.5 7a9 9 0 0 0 -7.5 -4a8.991 8.991 0 0 0 -7.484 4"></path><path d="M11.5 3a16.989 16.989 0 0 0 -1.826 4"></path><path d="M12.5 3a16.989 16.989 0 0 1 1.828 4"></path><path d="M19.5 17a9 9 0 0 1 -7.5 4a8.991 8.991 0 0 1 -7.484 -4"></path><path d="M11.5 21a16.989 16.989 0 0 1 -1.826 -4"></path><path d="M12.5 21a16.989 16.989 0 0 0 1.828 -4"></path><path d="M2 10l1 4l1.5 -4l1.5 4l1 -4"></path> <path d="M17 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M9.5 10l1 4l1.5 -4l1.5 4l1 -4"></path></svg>
<span class="nav-link-icon d-md-none d-lg-inline-block"><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="M19.5 7a9 9 0 0 0 -7.5 -4a8.991 8.991 0 0 0 -7.484 4"></path><path d="M11.5 3a16.989 16.989 0 0 0 -1.826 4"></path><path d="M12.5 3a16.989 16.989 0 0 1 1.828 4"></path><path d="M19.5 17a9 9 0 0 1 -7.5 4a8.991 8.991 0 0 1 -7.484 -4"></path><path d="M11.5 21a16.989 16.989 0 0 1 -1.826 -4"></path><path d="M12.5 21a16.989 16.989 0 0 0 1.828 -4"></path><path d="M2 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M17 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M9.5 10l1 4l1.5 -4l1.5 4l1 -4"></path></svg>
</span>
<span class="nav-link-title">
{{ __('Domains') }}
</span>
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="{{route('domains')}}">
<a class="dropdown-item" href="{{route('listDomains')}}">
{{ __('List Domains') }}
</a>
<a class="dropdown-item" href="{{route('domaincheck')}}">
<a class="dropdown-item" href="{{route('checkDomain')}}">
{{ __('Check Domain') }}
</a>
<a class="dropdown-item" href="{{route('domaincreate')}}">
<a class="dropdown-item" href="{{route('createDomain')}}">
{{ __('Create Domain') }}
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{route('transfers')}}">
<a class="dropdown-item" href="{{route('listTransfers')}}">
{{ __('Transfers') }}
</a>
<a class="dropdown-item" href="{{route('requestTransfer')}}">
{{ __('Request Transfer') }}
</a>
</div>
</li>
<li {{ is_current_url('contacts') or is_current_url('contactcreate') or 'contact' in currentUri ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>

View file

@ -1,24 +1,16 @@
<!doctype html>
<!--
* Tabler - Premium and Open Source dashboard template with responsive and high quality UI.
* @version 1.0.0-beta16
* @link https://tabler.io
* Copyright 2018-2022 The Tabler Authors
* Copyright 2018-2022 codecalm.net Paweł Kuna
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
-->
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>{% block title %}{% endblock %} | Pinga Framework</title>
<title>{% block title %}{% endblock %} | Namingo</title>
<!-- CSS files -->
{% include 'partials/css.twig' %}
<style>
@import url('https://rsms.me/inter/inter.css');
:root {
--tblr-font-sans-serif: Inter, -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
--tblr-font-sans-serif: Inter, -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
}
</style>
</head>

View file

@ -1,5 +1,5 @@
{% if flash.getMessage('info') %}
<div class="alert alert-important alert-info alert-dismissible mt-4" role="alert">
<div class="alert alert-important alert-info alert-dismissible" role="alert">
<div class="d-flex">
<div>
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-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="M12 8l.01 0" /><path d="M11 12l1 0l0 4l1 0" /></svg>
@ -13,7 +13,7 @@
{% endif %}
{% if flash.getMessage('error') %}
<div class="alert alert-important alert-danger alert-dismissible mt-4" role="alert">
<div class="alert alert-important alert-danger alert-dismissible" role="alert">
<div class="d-flex">
<div>
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-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="M12 8l0 4" /><path d="M12 16l.01 0" /></svg>
@ -27,7 +27,7 @@
{% endif %}
{% if flash.getMessage('success') %}
<div class="alert alert-important alert-success alert-dismissible mt-4" role="alert">
<div class="alert alert-important alert-success alert-dismissible" role="alert">
<div class="d-flex">
<div>
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-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>

View file

@ -6,15 +6,9 @@
<script>
var table;
document.querySelector("#domainTable").addEventListener('click', function(e) {
if (e.target.matches('.update-btn')) {
let id = e.target.getAttribute('data-id');
updateRecord(id);
} else if (e.target.matches('.delete-btn')) {
if (e.target.matches('.delete-btn')) {
let id = e.target.getAttribute('data-id');
deleteRecord(id);
} else if (e.target.matches('.renew-btn')) {
let id = e.target.getAttribute('data-id');
renewDomain(id);
}
});
@ -26,18 +20,28 @@
function actionsFormatter(cell, formatterParams, onRendered) {
return `
<button class="btn btn-primary btn-icon update-btn" data-id="${cell.getRow().getData().id}"><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></button>
<button class="btn btn-secondary btn-icon renew-btn" data-id="${cell.getRow().getData().id}"><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="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path></svg></button>
<a class="btn btn-primary btn-icon update-btn" href="domain/update/${cell.getRow().getData().name}"><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>
<a class="btn btn-secondary btn-icon renew-btn" href="domain/renew/${cell.getRow().getData().name}"><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="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path></svg></a>
<button class="btn btn-danger btn-icon delete-btn" data-id="${cell.getRow().getData().id}"><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></button>
`;
}
function statusFormatter(cell) {
var statusArray = cell.getValue();
if (statusArray && Array.isArray(statusArray)) {
return statusArray.map(item => item.status).join(', ');
var rowData = cell.getRow().getData(); // Get the entire row data
// Function to create a badge
function createBadge(text, badgeClass) {
return `<span class="badge bg-${badgeClass}-lt">${text}</span>`;
}
// Check if statusArray is empty or not
if (statusArray && Array.isArray(statusArray) && statusArray.length > 0) {
return statusArray.map(item => createBadge(item.status, 'azure')).join(' ');
} else {
// Fallback to rgpstatus column if statusArray is empty
return rowData.rgpstatus ? createBadge(rowData.rgpstatus, 'lime') : "";
}
return "";
}
var searchTerm = ""; // global variable to hold the search term
@ -66,14 +70,7 @@
queryParts.push("filter3=exdate,cs," + encodeURIComponent(searchTerm));
}
// Handle sorting
if (params.sorters && params.sorters.length) {
params.sorters.forEach(function(sorter) {
queryParts.push("order=" + sorter.field + "," + sorter.dir);
});
} else {
queryParts.push("order=id"); // default sorting
}
queryParts.push("order=id");
// Include pagination parameters
if (params.page) {
@ -97,32 +94,16 @@
dataReceiveParams: {
"last_page": "results", // Mapping 'results' to 'last_page'
},
sortMode: "remote",
columnSorted:function(column, dir, sorters){
table.setData();
},
headerSortElement: function(column, dir){
switch(dir){
case "asc":
return '<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="M6 15l6 -6l6 6" /></svg>';
break;
case "desc":
return '<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="M6 9l6 6l6 -6" /></svg>';
break;
default:
return '<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="M3 9l4 -4l4 4m-4 -4v14" /><path d="M21 15l-4 4l-4 -4m4 4v-14" /></svg>';
}
},
layout:"fitDataFill",
responsiveLayout: "collapse",
responsiveLayoutCollapseStartOpen:false,
resizableColumns:false,
columns:[
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
{title:"Name", field:"name", width:150, headerSort:true, formatter: domainLinkFormatter, responsive:0},
{title:"Registrant", width:200, field:"registrant.identifier", headerSort:true, responsive:2},
{title:"Creation Date", width:250, field:"crdate", headerSort:true, responsive:2},
{title:"Expiration Date", width:250, field:"exdate", headerSort:true, responsive:2},
{title:"Name", field:"name", width:200, headerSort:false, formatter: domainLinkFormatter, responsive:0},
{title:"Registrant", width:200, field:"registrant.identifier", headerSort:false, responsive:2},
{title:"Creation Date", width:200, field:"crdate", headerSort:false, responsive:2},
{title:"Expiration Date", width:250, field:"exdate", headerSort:false, responsive:2},
{title:"Status", width:200, field:"domain_status", formatter: statusFormatter, headerSort:false, download:false, responsive:2},
{title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }},
],