mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-28 07:03:28 +02:00
Added contacts and hosts pages in panel
This commit is contained in:
parent
8858c72012
commit
fc864aefff
8 changed files with 315 additions and 2 deletions
19
cp/app/Controllers/ContactsController.php
Normal file
19
cp/app/Controllers/ContactsController.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class ContactsController extends Controller
|
||||
{
|
||||
public function view(Request $request, Response $response)
|
||||
{
|
||||
$userModel = new User($this->container->get('db'));
|
||||
$users = $userModel->getAllUsers();
|
||||
return view($response,'admin/contacts/index.twig', compact('users'));
|
||||
}
|
||||
|
||||
}
|
19
cp/app/Controllers/HostsController.php
Normal file
19
cp/app/Controllers/HostsController.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class HostsController extends Controller
|
||||
{
|
||||
public function view(Request $request, Response $response)
|
||||
{
|
||||
$userModel = new User($this->container->get('db'));
|
||||
$users = $userModel->getAllUsers();
|
||||
return view($response,'admin/hosts/index.twig', compact('users'));
|
||||
}
|
||||
|
||||
}
|
82
cp/resources/views/admin/contacts/index.twig
Normal file
82
cp/resources/views/admin/contacts/index.twig
Normal file
|
@ -0,0 +1,82 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}Contacts{% 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">
|
||||
Contacts
|
||||
</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="card">
|
||||
<div class="card-body">
|
||||
<div id="table-default" class="table-responsive">
|
||||
<table id="contactTable" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><button class="table-sort" data-sort="sort-id">ID</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-email">Email</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-crdate">Creation Date</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-registrar">Registrar</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-status">Status</button></th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-tbody">
|
||||
<!-- Rows will be added here dynamically -->
|
||||
</tbody>
|
||||
</table>
|
||||
</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 %}
|
81
cp/resources/views/admin/hosts/index.twig
Normal file
81
cp/resources/views/admin/hosts/index.twig
Normal file
|
@ -0,0 +1,81 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}Hosts{% 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">
|
||||
Hosts
|
||||
</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="card">
|
||||
<div class="card-body">
|
||||
<div id="table-default" class="table-responsive">
|
||||
<table id="hostTable" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><button class="table-sort" data-sort="sort-id">ID</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-name">Name</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-crdate">Creation Date</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-status">Status</button></th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-tbody">
|
||||
<!-- Rows will be added here dynamically -->
|
||||
</tbody>
|
||||
</table>
|
||||
</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 %}
|
|
@ -171,6 +171,24 @@
|
|||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {{ is_current_url('contacts') ? 'class="nav-item active"' : 'class="nav-item"' }}>
|
||||
<a class="nav-link" href="{{route('contacts')}}">
|
||||
<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="M20 6v12a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2z"></path><path d="M10 16h6"></path><path d="M13 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 8h3"></path><path d="M4 12h3"></path><path d="M4 16h3"></path></svg>
|
||||
</span>
|
||||
<span class="nav-link-title">
|
||||
Contacts
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {{ is_current_url('hosts') ? 'class="nav-item active"' : 'class="nav-item"' }}>
|
||||
<a class="nav-link" href="{{route('hosts')}}">
|
||||
<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 9m-6 0a6 6 0 1 0 12 0a6 6 0 1 0 -12 0"></path><path d="M12 3c1.333 .333 2 2.333 2 6s-.667 5.667 -2 6"></path><path d="M12 3c-1.333 .333 -2 2.333 -2 6s.667 5.667 2 6"></path><path d="M6 9h12"></path><path d="M3 19h7"></path><path d="M14 19h7"></path><path d="M12 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M12 15v2"></path></svg>
|
||||
</span>
|
||||
<span class="nav-link-title">
|
||||
Hosts
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -287,8 +305,12 @@
|
|||
{% include 'partials/js-dash.twig' %}
|
||||
{% elseif route_is('domains') %}
|
||||
{% include 'partials/js-domains.twig' %}
|
||||
{% elseif route_is('contacts') %}
|
||||
{% include 'partials/js-contacts.twig' %}
|
||||
{% elseif route_is('hosts') %}
|
||||
{% include 'partials/js-hosts.twig' %}
|
||||
{% else %}
|
||||
{% include 'partials/js.twig' %}
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
43
cp/resources/views/partials/js-contacts.twig
Normal file
43
cp/resources/views/partials/js-contacts.twig
Normal file
|
@ -0,0 +1,43 @@
|
|||
<script src="/assets/libs/list.js/dist/list.min.js" defer></script>
|
||||
<script src="/assets/js/tabler.min.js" defer></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const list = new List('table-default', {
|
||||
sortClass: 'table-sort',
|
||||
listClass: 'table-tbody',
|
||||
valueNames: [ 'sort-name', 'sort-type', 'sort-city', 'sort-score',
|
||||
{ attr: 'data-date', name: 'sort-date' },
|
||||
{ attr: 'data-progress', name: 'sort-progress' },
|
||||
'sort-quantity'
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
fetch('/api/records/contact')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.records) {
|
||||
populateTable(data.records);
|
||||
}
|
||||
});
|
||||
|
||||
function populateTable(records) {
|
||||
const tableBody = document.getElementById('contactTable').querySelector('tbody');
|
||||
records.forEach(contact => {
|
||||
const row = tableBody.insertRow();
|
||||
const cell1 = row.insertCell(0);
|
||||
const cell2 = row.insertCell(1);
|
||||
const cell3 = row.insertCell(2);
|
||||
const cell4 = row.insertCell(3);
|
||||
const cell5 = row.insertCell(4);
|
||||
cell1.textContent = contact.identifier;
|
||||
cell1.style.fontWeight = 'bold';
|
||||
cell2.textContent = contact.email;
|
||||
cell3.textContent = contact.crdate;
|
||||
cell4.textContent = contact.crid;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
43
cp/resources/views/partials/js-hosts.twig
Normal file
43
cp/resources/views/partials/js-hosts.twig
Normal file
|
@ -0,0 +1,43 @@
|
|||
<script src="/assets/libs/list.js/dist/list.min.js" defer></script>
|
||||
<script src="/assets/js/tabler.min.js" defer></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const list = new List('table-default', {
|
||||
sortClass: 'table-sort',
|
||||
listClass: 'table-tbody',
|
||||
valueNames: [ 'sort-name', 'sort-type', 'sort-city', 'sort-score',
|
||||
{ attr: 'data-date', name: 'sort-date' },
|
||||
{ attr: 'data-progress', name: 'sort-progress' },
|
||||
'sort-quantity'
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
fetch('/api/records/host')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.records) {
|
||||
populateTable(data.records);
|
||||
}
|
||||
});
|
||||
|
||||
function populateTable(records) {
|
||||
const tableBody = document.getElementById('hostTable').querySelector('tbody');
|
||||
records.forEach(host => {
|
||||
const row = tableBody.insertRow();
|
||||
const cell1 = row.insertCell(0);
|
||||
const cell2 = row.insertCell(1);
|
||||
const cell3 = row.insertCell(2);
|
||||
const cell4 = row.insertCell(3);
|
||||
const cell5 = row.insertCell(4);
|
||||
cell1.textContent = host.id;
|
||||
cell2.textContent = host.name;
|
||||
cell2.style.fontWeight = 'bold';
|
||||
cell3.textContent = host.crdate;
|
||||
cell4.textContent = host.status;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
@ -3,6 +3,8 @@ use App\Controllers\Auth\AuthController;
|
|||
use App\Controllers\Auth\PasswordController;
|
||||
use App\Controllers\HomeController;
|
||||
use App\Controllers\DomainsController;
|
||||
use App\Controllers\ContactsController;
|
||||
use App\Controllers\HostsController;
|
||||
use App\Controllers\ProfileController;
|
||||
use App\Middleware\AuthMiddleware;
|
||||
use App\Middleware\GuestMiddleware;
|
||||
|
@ -33,6 +35,8 @@ $app->group('', function ($route) {
|
|||
$app->group('', function ($route) {
|
||||
$route->get('/dashboard', HomeController::class .':dashboard')->setName('home');
|
||||
$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('/profile', ProfileController::class .':profile')->setName('profile');
|
||||
$route->get('/profile/notifications', ProfileController::class .':notifications')->setName('notifications');
|
||||
$route->get('/profile/security', ProfileController::class .':security')->setName('security');
|
||||
|
@ -71,4 +75,4 @@ $app->add(function (Psr\Http\Message\ServerRequestInterface $request, Psr\Http\S
|
|||
}
|
||||
});
|
||||
|
||||
$app->addErrorMiddleware(true, true, true);
|
||||
$app->addErrorMiddleware(true, true, true);
|
Loading…
Add table
Add a link
Reference in a new issue