Added Transactions page

This commit is contained in:
Pinga 2023-08-30 20:20:37 +03:00
parent 9669f78e4f
commit c9636114d8
5 changed files with 186 additions and 28 deletions

View file

@ -0,0 +1,15 @@
<?php
namespace App\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Container\ContainerInterface;
class FinancialsController extends Controller
{
public function transactions(Request $request, Response $response)
{
return view($response,'admin/financials/transactions.twig');
}
}

View file

@ -0,0 +1,84 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('Transactions') }}{% 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">
{{ __('Transactions') }}
</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 transactions">
</div>
</div>
</div>
</div>
<div class="table-responsive">
<div id="transactionTable"></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 &copy; 2023
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
</li>
</ul>
</div>
</div>
</div>
</footer>
</div>
{% endblock %}

View file

@ -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') %} {% if route_is('domains') or route_is('contacts') or route_is('hosts') or route_is('logs') or route_is('registrars') or route_is('transactions') %}
{% include 'partials/css-tables.twig' %} {% include 'partials/css-tables.twig' %}
{% else %} {% else %}
{% include 'partials/css.twig' %} {% include 'partials/css.twig' %}
@ -237,13 +237,13 @@
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="{{route('hosts')}}"> <a class="dropdown-item" href="{{route('hosts')}}">
List Hosts {{ __('List Hosts') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Check Host {{ __('Check Host') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Create Host {{ __('Create Host') }}
</a> </a>
</div> </div>
</li> </li>
@ -257,24 +257,24 @@
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="{{route('registrars')}}"> <a class="dropdown-item" href="{{route('registrars')}}">
List Registrars {{ __('List Registrars') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Create Registrar {{ __('Create Registrar') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Communication {{ __('Communication') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
List Applications {{ __('List Applications') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Compliance {{ __('Compliance') }}
</a> </a>
</div> </div>
</li> </li>
<li {{ is_current_url('hosts') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}> <li {{ is_current_url('transactions') ? '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"> <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="M7 9m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"></path><path d="M14 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M17 9v-2a2 2 0 0 0 -2 -2h-10a2 2 0 0 0 -2 2v6a2 2 0 0 0 2 2h2"></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="M7 9m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"></path><path d="M14 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M17 9v-2a2 2 0 0 0 -2 -2h-10a2 2 0 0 0 -2 2v6a2 2 0 0 0 2 2h2"></path></svg>
</span> </span>
@ -284,20 +284,20 @@
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="{{route('hosts')}}"> <a class="dropdown-item" href="{{route('hosts')}}">
Pricing {{ __('Pricing') }}
</a> </a>
<a class="dropdown-item" href="{{route('hosts')}}"> <a class="dropdown-item" href="{{route('hosts')}}">
Add Deposit {{ __('Add Deposit') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="{{route('transactions')}}">
Transactions {{ __('Transactions') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Account Overview {{ __('Account Overview') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Invoices {{ __('Invoices') }}
</a> </a>
</div> </div>
</li> </li>
@ -320,23 +320,20 @@
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="{{route('hosts')}}"> <a class="dropdown-item" href="{{route('hosts')}}">
Configuration {{ __('Configuration') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
User Management {{ __('User Management') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{route('logs')}}"> <a class="dropdown-item" href="{{route('logs')}}">
Reports {{ __('EPP Log') }}
</a> </a>
<a class="dropdown-item" href="{{route('logs')}}"> <a class="dropdown-item" href="{{route('logs')}}">
EPP Log {{ __('Audit Log') }}
</a> </a>
<a class="dropdown-item" href="{{route('logs')}}"> <a class="dropdown-item" href="{{route('logs')}}">
Audit Log {{ __('Backup') }}
</a>
<a class="dropdown-item" href="{{route('logs')}}">
Backup
</a> </a>
</div> </div>
</li> </li>
@ -350,17 +347,17 @@
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="{{route('hosts')}}"> <a class="dropdown-item" href="{{route('hosts')}}">
Support Tickets {{ __('Support Tickets') }}
</a> </a>
<a class="dropdown-item" href="#"> <a class="dropdown-item" href="#">
Create Ticket {{ __('Create Ticket') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{route('hosts')}}"> <a class="dropdown-item" href="{{route('hosts')}}">
Documentation {{ __('Documentation') }}
</a> </a>
<a class="dropdown-item" href="{{route('hosts')}}"> <a class="dropdown-item" href="{{route('hosts')}}">
Media Kit {{ __('Media Kit') }}
</a> </a>
</div> </div>
</li> </li>
@ -488,6 +485,8 @@
{% include 'partials/js-logs.twig' %} {% include 'partials/js-logs.twig' %}
{% elseif route_is('registrars') %} {% elseif route_is('registrars') %}
{% include 'partials/js-registrars.twig' %} {% include 'partials/js-registrars.twig' %}
{% elseif route_is('transactions') %}
{% include 'partials/js-transactions.twig' %}
{% else %} {% else %}
{% include 'partials/js.twig' %} {% include 'partials/js.twig' %}
{% endif %} {% endif %}

View 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("#transactionTable", {
ajaxURL:"/api/records/statement", // 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:"Registrar", field:"registrar_id", headerSort:true},
{title:"Date", field:"date", headerSort:true, responsive:0},
{title:"Command", field:"command", headerSort:true, responsive:0},
{title:"Domain", field:"domain_name", headerSort:false, download:false},
{title:"Length", field:"length_in_months", headerSort:true},
{title:"From", field:"from", headerSort:true, responsive:0},
{title:"To", field:"to", headerSort:true, responsive:0},
{title:"Amount", field:"amount", headerSort:false, download:false},
],
});
var searchInput = document.getElementById("search-input");
searchInput.addEventListener("input", function(){
table.setFilter("command", "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 Registrars"});
}
function downloadPDF() {
table.download("pdf", "data.pdf", {
orientation:"portrait",
title:"My Registrars",
jsPDF:{unit:"mm", format:"a4", orientation:"p"}
});
}
</script>

View file

@ -7,6 +7,7 @@ use App\Controllers\ContactsController;
use App\Controllers\HostsController; 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\ProfileController; use App\Controllers\ProfileController;
use App\Middleware\AuthMiddleware; use App\Middleware\AuthMiddleware;
use App\Middleware\GuestMiddleware; use App\Middleware\GuestMiddleware;
@ -41,6 +42,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('/transactions', FinancialsController::class .':transactions')->setName('transactions');
$route->get('/profile', ProfileController::class .':profile')->setName('profile'); $route->get('/profile', ProfileController::class .':profile')->setName('profile');
$route->get('/profile/notifications', ProfileController::class .':notifications')->setName('notifications'); $route->get('/profile/notifications', ProfileController::class .':notifications')->setName('notifications');
$route->get('/profile/security', ProfileController::class .':security')->setName('security'); $route->get('/profile/security', ProfileController::class .':security')->setName('security');