mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-04 00:31:50 +02:00
Big work on domain applications in panel
This commit is contained in:
parent
58c8f8f01a
commit
e9ed61cfa9
11 changed files with 2059 additions and 76 deletions
245
cp/resources/views/admin/domains/createApplication.twig
Normal file
245
cp/resources/views/admin/domains/createApplication.twig
Normal file
|
@ -0,0 +1,245 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}{{ __('Create Application') }}{% 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">
|
||||
{{ __('Create Application') }}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Page body -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<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>
|
||||
{{ __('Application') }} <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>
|
||||
{{ __('Application') }} <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">
|
||||
<div class="card-body">
|
||||
<form id="domainCreateForm" action="/application/create" method="post">
|
||||
{{ csrf.field | raw }}
|
||||
<div class="mb-3">
|
||||
<label for="domainName" class="form-label required">{{ __('Your Domain Name') }}</label>
|
||||
<input type="text" class="form-control mb-2" placeholder="example.com" name="domainName" id="domainName" required="required" autocapitalize="none">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="phaseType" class="form-label required">Phase Type</label>
|
||||
<select class="form-select" id="phaseType" name="phaseType" required>
|
||||
<option value="sunrise">Sunrise</option>
|
||||
<option value="landrush">Landrush</option>
|
||||
<option value="claims">Claims</option>
|
||||
<option value="open">Open</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="phaseName" class="form-label">Phase Name</label>
|
||||
<input type="text" class="form-control" id="phaseName" name="phaseName" placeholder="Enter phase name">
|
||||
<small class="form-hint">The "Phase name" field is required only if the "Type" is set to "Custom".</small>
|
||||
</div>
|
||||
|
||||
{% if registrars and not registrar %}
|
||||
<div class="form-group mb-3">
|
||||
<label for="registrarDropdown" class="form-label required">{{ __('Select Registrar') }}:</label>
|
||||
<select id="registrarDropdown" name="registrar" class="form-control">
|
||||
{% for registrar in registrars %}
|
||||
<option value="{{ registrar.id }}">{{ registrar.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Fields for 4 contacts with roles -->
|
||||
<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" required="required">
|
||||
<input type="text" class="form-control mb-2" placeholder="{{ __('Admin Contact') }}" name="contactAdmin">
|
||||
<input type="text" class="form-control mb-2" placeholder="{{ __('Tech Contact') }}" name="contactTech">
|
||||
<input type="text" class="form-control mb-2" placeholder="{{ __('Billing Contact') }}" name="contactBilling">
|
||||
</div>
|
||||
|
||||
<!-- Fields for nameservers -->
|
||||
<div id="nameserverFields">
|
||||
<label class="form-label">{{ __('Nameservers') }} <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></label>
|
||||
|
||||
<div class="nameserver-group mb-1 row">
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} 1" name="nameserver[]" autocapitalize="none">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} 1 - IPv4" name="nameserver_ipv4[]">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} 1 - IPv6" name="nameserver_ipv6[]" autocapitalize="none">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nameserver-group mb-1 row">
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} 2" name="nameserver[]" autocapitalize="none">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} 2 - IPv4" name="nameserver_ipv4[]">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} 2 - IPv6" name="nameserver_ipv6[]" autocapitalize="none">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- AuthInfo -->
|
||||
<div class="mb-3">
|
||||
<label for="authInfo" class="form-label required">{{ __('Auth Info') }}</label>
|
||||
<input type="text" class="form-control" id="authInfo" name="authInfo" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Signed Mark Information</label>
|
||||
<textarea class="form-control" data-bs-toggle="autosize" name="smd" placeholder="Paste SMD contents…"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto">
|
||||
<button type="submit" class="btn btn-primary">{{ __('Create Application') }}</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 © 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');
|
||||
const authInfoField = document.getElementById('authInfo');
|
||||
|
||||
function createNameserverGroup(count) {
|
||||
const group = document.createElement('div');
|
||||
group.className = 'nameserver-group mb-1 row';
|
||||
|
||||
const nameserverCol = document.createElement('div');
|
||||
nameserverCol.className = 'col-md-4';
|
||||
const nameserverField = document.createElement('input');
|
||||
nameserverField.type = 'text';
|
||||
nameserverField.className = 'form-control mb-1';
|
||||
nameserverField.placeholder = `{{ __('Nameserver') }} ${count}`;
|
||||
nameserverField.name = `nameserver[]`;
|
||||
nameserverCol.appendChild(nameserverField);
|
||||
|
||||
const ipv4Col = document.createElement('div');
|
||||
ipv4Col.className = 'col-md-4';
|
||||
const ipv4Field = document.createElement('input');
|
||||
ipv4Field.type = 'text';
|
||||
ipv4Field.className = 'form-control mb-1';
|
||||
ipv4Field.placeholder = `{{ __('Nameserver') }} ${count} - IPv4`;
|
||||
ipv4Field.name = `nameserver_ipv4[]`;
|
||||
ipv4Col.appendChild(ipv4Field);
|
||||
|
||||
const ipv6Col = document.createElement('div');
|
||||
ipv6Col.className = 'col-md-4';
|
||||
const ipv6Field = document.createElement('input');
|
||||
ipv6Field.type = 'text';
|
||||
ipv6Field.className = 'form-control mb-1';
|
||||
ipv6Field.placeholder = `{{ __('Nameserver') }} ${count} - IPv6`;
|
||||
ipv6Field.name = `nameserver_ipv6[]`;
|
||||
ipv6Col.appendChild(ipv6Field);
|
||||
|
||||
group.appendChild(nameserverCol);
|
||||
group.appendChild(ipv4Col);
|
||||
group.appendChild(ipv6Col);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
// Add nameserver fields
|
||||
let nameserverCount = 2;
|
||||
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--;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Generate random AuthInfo and set it to the field
|
||||
function generateAuthInfo() {
|
||||
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
let result = "";
|
||||
for (let i = 0; i < 16; i++) {
|
||||
result += charset.charAt(Math.floor(Math.random() * charset.length));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
authInfoField.value = generateAuthInfo();
|
||||
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue