mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-21 10:06:05 +02:00
Added reports page
This commit is contained in:
parent
3556f8c1fc
commit
512de0552a
5 changed files with 165 additions and 3 deletions
16
cp/app/Controllers/ReportsController.php
Normal file
16
cp/app/Controllers/ReportsController.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 ReportsController extends Controller
|
||||||
|
{
|
||||||
|
public function view(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/reports/index.twig');
|
||||||
|
}
|
||||||
|
}
|
84
cp/resources/views/admin/reports/index.twig
Normal file
84
cp/resources/views/admin/reports/index.twig
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
{% extends "layouts/app.twig" %}
|
||||||
|
|
||||||
|
{% block title %}{{ __('Reports') }}{% 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">
|
||||||
|
{{ __('Reports') }}
|
||||||
|
</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 reports">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<div id="reportTable"></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"/>
|
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
|
||||||
<title>{% block title %}{% endblock %} | Namingo</title>
|
<title>{% block title %}{% endblock %} | Namingo</title>
|
||||||
<!-- CSS files -->
|
<!-- CSS files -->
|
||||||
{% if route_is('domains') or route_is('contacts') or route_is('hosts') or route_is('logs') or route_is('registrars') or route_is('transactions') or route_is('overview') %}
|
{% if route_is('domains') or route_is('contacts') or route_is('hosts') or route_is('logs') or route_is('registrars') or route_is('transactions') or route_is('overview') or route_is('reports') %}
|
||||||
{% include 'partials/css-tables.twig' %}
|
{% include 'partials/css-tables.twig' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include 'partials/css.twig' %}
|
{% include 'partials/css.twig' %}
|
||||||
|
@ -299,8 +299,8 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li {{ is_current_url('logs') ? 'class="nav-item active"' : 'class="nav-item"' }}>
|
<li {{ is_current_url('reports') ? 'class="nav-item active"' : 'class="nav-item"' }}>
|
||||||
<a class="nav-link" href="{{route('logs')}}">
|
<a class="nav-link" href="{{route('reports')}}">
|
||||||
<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="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"></path><path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"></path><path d="M9 17v-5"></path><path d="M12 17v-1"></path><path d="M15 17v-3"></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="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"></path><path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"></path><path d="M9 17v-5"></path><path d="M12 17v-1"></path><path d="M15 17v-3"></path></svg>
|
||||||
</span>
|
</span>
|
||||||
<span class="nav-link-title">
|
<span class="nav-link-title">
|
||||||
|
@ -487,6 +487,8 @@
|
||||||
{% include 'partials/js-transactions.twig' %}
|
{% include 'partials/js-transactions.twig' %}
|
||||||
{% elseif route_is('overview') %}
|
{% elseif route_is('overview') %}
|
||||||
{% include 'partials/js-overview.twig' %}
|
{% include 'partials/js-overview.twig' %}
|
||||||
|
{% elseif route_is('reports') %}
|
||||||
|
{% include 'partials/js-reports.twig' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include 'partials/js.twig' %}
|
{% include 'partials/js.twig' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
58
cp/resources/views/partials/js-reports.twig
Normal file
58
cp/resources/views/partials/js-reports.twig
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<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.addEventListener("DOMContentLoaded", function(){
|
||||||
|
table = new Tabulator("#reportTable", {
|
||||||
|
ajaxURL:"/api/records/statistics", // 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",
|
||||||
|
initialSort:[
|
||||||
|
{column:"date", dir:"desc"},
|
||||||
|
],
|
||||||
|
columns:[
|
||||||
|
{title:"Date", field:"date", headerSort:true},
|
||||||
|
{title:"Total Domains", field:"total_domains", headerSort:true},
|
||||||
|
{title:"Created Domains", field:"created_domains", headerSort:true, responsive:0},
|
||||||
|
{title:"Renewed Domains", field:"renewed_domains", headerSort:true, responsive:0},
|
||||||
|
{title:"Transferred Domains", field:"transfered_domains", headerSort:true, responsive:0},
|
||||||
|
{title:"Deleted Domains", field:"deleted_domains", headerSort:true},
|
||||||
|
{title:"Restored Domains", field:"restored_domains", headerSort:true, responsive:0, download:false}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
var searchInput = document.getElementById("search-input");
|
||||||
|
searchInput.addEventListener("input", function(){
|
||||||
|
table.setFilter("date", "like", searchInput.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function downloadCSV() {
|
||||||
|
table.download("csv", "data.csv");
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadJSON() {
|
||||||
|
table.download("json", "data.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadXLSX() {
|
||||||
|
table.download("xlsx", "data.xlsx", {sheetName:"My Reports"});
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadPDF() {
|
||||||
|
table.download("pdf", "data.pdf", {
|
||||||
|
orientation:"portrait",
|
||||||
|
title:"My Reports",
|
||||||
|
jsPDF:{unit:"mm", format:"a4", orientation:"p"}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -8,6 +8,7 @@ use App\Controllers\HostsController;
|
||||||
use App\Controllers\LogsController;
|
use App\Controllers\LogsController;
|
||||||
use App\Controllers\RegistrarsController;
|
use App\Controllers\RegistrarsController;
|
||||||
use App\Controllers\FinancialsController;
|
use App\Controllers\FinancialsController;
|
||||||
|
use App\Controllers\ReportsController;
|
||||||
use App\Controllers\ProfileController;
|
use App\Controllers\ProfileController;
|
||||||
use App\Middleware\AuthMiddleware;
|
use App\Middleware\AuthMiddleware;
|
||||||
use App\Middleware\GuestMiddleware;
|
use App\Middleware\GuestMiddleware;
|
||||||
|
@ -42,6 +43,7 @@ $app->group('', function ($route) {
|
||||||
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
|
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
|
||||||
$route->get('/registrars', RegistrarsController::class .':view')->setName('registrars');
|
$route->get('/registrars', RegistrarsController::class .':view')->setName('registrars');
|
||||||
$route->get('/logs', LogsController::class .':view')->setName('logs');
|
$route->get('/logs', LogsController::class .':view')->setName('logs');
|
||||||
|
$route->get('/reports', ReportsController::class .':view')->setName('reports');
|
||||||
$route->get('/transactions', FinancialsController::class .':transactions')->setName('transactions');
|
$route->get('/transactions', FinancialsController::class .':transactions')->setName('transactions');
|
||||||
$route->get('/overview', FinancialsController::class .':overview')->setName('overview');
|
$route->get('/overview', FinancialsController::class .':overview')->setName('overview');
|
||||||
$route->get('/profile', ProfileController::class .':profile')->setName('profile');
|
$route->get('/profile', ProfileController::class .':profile')->setName('profile');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue