mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-22 18:45:59 +02:00
Added registrars page
This commit is contained in:
parent
eaac8131cd
commit
9669f78e4f
5 changed files with 197 additions and 3 deletions
16
cp/app/Controllers/RegistrarsController.php
Normal file
16
cp/app/Controllers/RegistrarsController.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\RegistryTransaction;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class RegistrarsController extends Controller
|
||||
{
|
||||
public function view(Request $request, Response $response)
|
||||
{
|
||||
return view($response,'admin/registrars/index.twig');
|
||||
}
|
||||
}
|
84
cp/resources/views/admin/registrars/index.twig
Normal file
84
cp/resources/views/admin/registrars/index.twig
Normal file
|
@ -0,0 +1,84 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}{{ __('Registrars') }}{% 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">
|
||||
{{ __('Registrars') }}
|
||||
</h2>
|
||||
</div>
|
||||
<!-- Page title actions -->
|
||||
<div class="col-auto ms-auto d-print-none">
|
||||
<div class="btn-list">
|
||||
<span class="d-none d-sm-inline">
|
||||
<a href="#" class="btn">
|
||||
New view
|
||||
</a>
|
||||
</span>
|
||||
<a href="#" class="btn btn-primary d-none d-sm-inline-block" data-bs-toggle="modal" data-bs-target="#modal-report">
|
||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
||||
<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 report
|
||||
</a>
|
||||
<a href="#" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" data-bs-target="#modal-report" aria-label="Create new report">
|
||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Page body -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body border-bottom py-3">
|
||||
<div class="d-flex">
|
||||
<div class="text-secondary">
|
||||
<button class="btn btn-info btn-icon" onclick="downloadCSV()"><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="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path><path d="M17 8l2 8l2 -8"></path><path d="M7 10a2 2 0 1 0 -4 0v4a2 2 0 1 0 4 0"></path></svg></button>
|
||||
<button class="btn btn-info btn-icon" onclick="downloadJSON()"><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 16v-8l3 8v-8"></path><path d="M15 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path><path d="M1 8h3v6.5a1.5 1.5 0 0 1 -3 0v-.5"></path><path d="M7 15a1 1 0 0 0 1 1h1a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h1a1 1 0 0 1 1 1"></path></svg></button>
|
||||
<button class="btn btn-green btn-icon" onclick="downloadXLSX()"><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="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"></path><path d="M4 15l4 6"></path><path d="M4 21l4 -6"></path><path d="M17 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"></path><path d="M11 15v6h3"></path></svg></button>
|
||||
<button class="btn btn-red btn-icon" onclick="downloadPDF()"><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="M10 8v8h2a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2h-2z"></path><path d="M3 12h2a2 2 0 1 0 0 -4h-2v8"></path><path d="M17 12h3"></path><path d="M21 8h-4v8"></path></svg></button>
|
||||
</div>
|
||||
<div class="ms-auto text-secondary">
|
||||
Search:
|
||||
<div class="ms-2 d-inline-block">
|
||||
<input id="search-input" type="text" class="form-control" aria-label="Search registrars">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<div id="registrarTable"></div>
|
||||
</div>
|
||||
</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>
|
||||
{% endblock %}
|
|
@ -6,7 +6,7 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
|
||||
<title>{% block title %}{% endblock %} | Namingo</title>
|
||||
<!-- CSS files -->
|
||||
{% if route_is('domains') or route_is('contacts') or route_is('hosts') or route_is('logs') %}
|
||||
{% if route_is('domains') or route_is('contacts') or route_is('hosts') or route_is('logs') or route_is('registrars') %}
|
||||
{% include 'partials/css-tables.twig' %}
|
||||
{% else %}
|
||||
{% include 'partials/css.twig' %}
|
||||
|
@ -247,7 +247,7 @@
|
|||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li {{ is_current_url('hosts') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
||||
<li {{ is_current_url('registrars') ? '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="M12 13a3 3 0 1 0 0 -6a3 3 0 0 0 0 6z"></path><path d="M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"></path><path d="M6 20.05v-.05a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v.05"></path></svg>
|
||||
</span>
|
||||
|
@ -256,7 +256,7 @@
|
|||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="{{route('hosts')}}">
|
||||
<a class="dropdown-item" href="{{route('registrars')}}">
|
||||
List Registrars
|
||||
</a>
|
||||
<a class="dropdown-item" href="#">
|
||||
|
@ -486,6 +486,8 @@
|
|||
{% include 'partials/js-hosts.twig' %}
|
||||
{% elseif route_is('logs') %}
|
||||
{% include 'partials/js-logs.twig' %}
|
||||
{% elseif route_is('registrars') %}
|
||||
{% include 'partials/js-registrars.twig' %}
|
||||
{% else %}
|
||||
{% include 'partials/js.twig' %}
|
||||
{% endif %}
|
||||
|
|
90
cp/resources/views/partials/js-registrars.twig
Normal file
90
cp/resources/views/partials/js-registrars.twig
Normal file
|
@ -0,0 +1,90 @@
|
|||
<script src="/assets/js/tabulator.min.js" defer></script>
|
||||
<script src="/assets/js/tabler.min.js" defer></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.6.0/jspdf.plugin.autotable.min.js"></script>
|
||||
<script>
|
||||
var table;
|
||||
document.querySelector("#registrarTable").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')) {
|
||||
let id = e.target.getAttribute('data-id');
|
||||
deleteRecord(id);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
function registrarLinkFormatter(cell){
|
||||
var value = cell.getValue();
|
||||
return `<a href="/registrar/${value}" style="font-weight:bold;">${value}</a>`;
|
||||
}
|
||||
|
||||
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-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(', ');
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
table = new Tabulator("#registrarTable", {
|
||||
ajaxURL:"/api/records/registrar", // Set the URL for your JSON data
|
||||
ajaxConfig:"GET",
|
||||
pagination:"local",
|
||||
paginationSize:10,
|
||||
ajaxResponse:function(url, params, response){
|
||||
return response.records;
|
||||
},
|
||||
layout:"fitColumns",
|
||||
responsiveLayout: "hide",
|
||||
columns:[
|
||||
{title:"Name", field:"name", headerSort:true, formatter: registrarLinkFormatter},
|
||||
{title:"IANA ID", field:"iana_id", headerSort:true, responsive:0},
|
||||
{title:"Email", field:"email", headerSort:true, responsive:0},
|
||||
{title:"Balance", field:"accountBalance", headerSort:false, download:false},
|
||||
{title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", cellClick:function(e, cell){ e.stopPropagation(); }},
|
||||
],
|
||||
});
|
||||
var searchInput = document.getElementById("search-input");
|
||||
searchInput.addEventListener("input", function(){
|
||||
table.setFilter("name", "like", searchInput.value);
|
||||
});
|
||||
});
|
||||
|
||||
function updateRecord(id) {
|
||||
console.log("Updating record with ID: " + id);
|
||||
}
|
||||
|
||||
function deleteRecord(id) {
|
||||
console.log("Deleting record with ID: " + id);
|
||||
}
|
||||
|
||||
function downloadCSV() {
|
||||
table.download("csv", "data.csv");
|
||||
}
|
||||
|
||||
function downloadJSON() {
|
||||
table.download("json", "data.json");
|
||||
}
|
||||
|
||||
function downloadXLSX() {
|
||||
table.download("xlsx", "data.xlsx", {sheetName:"My Registrars"});
|
||||
}
|
||||
|
||||
function downloadPDF() {
|
||||
table.download("pdf", "data.pdf", {
|
||||
orientation:"portrait",
|
||||
title:"My Registrars",
|
||||
jsPDF:{unit:"mm", format:"a4", orientation:"p"}
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -6,6 +6,7 @@ use App\Controllers\DomainsController;
|
|||
use App\Controllers\ContactsController;
|
||||
use App\Controllers\HostsController;
|
||||
use App\Controllers\LogsController;
|
||||
use App\Controllers\RegistrarsController;
|
||||
use App\Controllers\ProfileController;
|
||||
use App\Middleware\AuthMiddleware;
|
||||
use App\Middleware\GuestMiddleware;
|
||||
|
@ -38,6 +39,7 @@ $app->group('', function ($route) {
|
|||
$route->get('/domains', DomainsController::class .':view')->setName('domains');
|
||||
$route->get('/contacts', ContactsController::class .':view')->setName('contacts');
|
||||
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
|
||||
$route->get('/registrars', RegistrarsController::class .':view')->setName('registrars');
|
||||
$route->get('/logs', LogsController::class .':view')->setName('logs');
|
||||
$route->get('/profile', ProfileController::class .':profile')->setName('profile');
|
||||
$route->get('/profile/notifications', ProfileController::class .':notifications')->setName('notifications');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue