Added support system UI

This commit is contained in:
Pinga 2023-09-05 01:09:30 +03:00
parent f932c26f05
commit ab69657429
8 changed files with 373 additions and 7 deletions

View file

@ -0,0 +1,33 @@
<?php
namespace App\Controllers;
use App\Models\Tickets;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Container\ContainerInterface;
class SupportController extends Controller
{
public function view(Request $request, Response $response)
{
$ticketModel = new Tickets($this->container->get('db'));
$tickets = $ticketModel->getAllTickets();
return view($response,'admin/support/view.twig', compact('tickets'));
}
public function newticket(Request $request, Response $response)
{
return view($response,'admin/support/newticket.twig');
}
public function docs(Request $request, Response $response)
{
return view($response,'admin/support/docs.twig');
}
public function mediakit(Request $request, Response $response)
{
return view($response,'admin/support/mediakit.twig');
}
}

40
cp/app/Models/Tickets.php Normal file
View file

@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Pinga\Db\PdoDatabase;
class Tickets
{
private PdoDatabase $db;
public function __construct(PdoDatabase $db)
{
$this->db = $db;
}
public function getAllTickets()
{
return $this->db->select('SELECT * FROM support_tickets');
}
public function getTicketsById($id)
{
return $this->db->select('SELECT * FROM support_tickets WHERE id = ?', [$id])->fetch();
}
public function createTickets($id, $user_id, $category_id, $subject, $message, $status, $priority, $reported_domain, $nature_of_abuse, $evidence, $relevant_urls, $date_of_incident, $date_created, $last_updated)
{
$id = $this->db->quote($id); $user_id = $this->db->quote($user_id); $category_id = $this->db->quote($category_id); $subject = $this->db->quote($subject); $message = $this->db->quote($message); $status = $this->db->quote($status); $priority = $this->db->quote($priority); $reported_domain = $this->db->quote($reported_domain); $nature_of_abuse = $this->db->quote($nature_of_abuse); $evidence = $this->db->quote($evidence); $relevant_urls = $this->db->quote($relevant_urls); $date_of_incident = $this->db->quote($date_of_incident); $date_created = $this->db->quote($date_created); $last_updated = $this->db->quote($last_updated);
$this->db->insert('INSERT INTO support_tickets (id, user_id, category_id, subject, message, status, priority, reported_domain, nature_of_abuse, evidence, relevant_urls, date_of_incident, date_created, last_updated) VALUES ($id, $user_id, $category_id, $subject, $message, $status, $priority, $reported_domain, $nature_of_abuse, $evidence, $relevant_urls, $date_of_incident, $date_created, $last_updated)');
return $this->db->lastInsertId();
}
public function deleteTickets($id)
{
$this->db->delete('DELETE FROM support_tickets WHERE id = ?', [$id]);
return true;
}
}

View file

@ -0,0 +1,62 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('Documentation') }}{% 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">
{{ __('Documentation') }}
</h2>
</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">
<h2>Documentation</h2>
<p>{{ documentation_intro|default('Replace this section with a brief introduction about your documentation.') }}</p>
<h3>Getting Started</h3>
<p>{{ getting_started_text|default('Provide users with the basics to get started with your TLD registry management system here.') }}</p>
<h3>Registration Process</h3>
<p>{{ registration_process_text|default('Describe the process for domain registration in detail here.') }}</p>
<!-- ... Add more sections as needed ... -->
<footer>
<p class="text-muted">Replace or remove this footer as necessary. Add any relevant information or links here.</p>
</footer>
</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

@ -0,0 +1,67 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('Media Kit') }}{% 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">
{{ __('Media Kit') }}
</h2>
</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">
<h2>Media Kit</h2>
<p>{{ media_kit_intro|default('Replace this section with an introduction about the media kit contents and its intended audience.') }}</p>
<h3>Logos</h3>
<p>{{ logos_intro|default('Provide guidelines on how to use your registry logos correctly.') }}</p>
<!-- Placeholder for logos. You can use a loop in Twig to iterate through and display multiple logos. -->
<img src="{{ logo_image_path|default('/static/logo.svg') }}" alt="Registry Logo" class="img-fluid mb-3">
<h3>Branding Guidelines</h3>
<p>{{ branding_guidelines|default('Detail any color schemes, typography, or design patterns related to your TLD registry brand here.') }}</p>
<h3>Press Releases</h3>
<p>{{ press_releases_text|default('List recent press releases or provide links to them for registrars and the media.') }}</p>
<!-- ... Add more sections as needed ... -->
<footer>
<p class="text-muted">Replace or remove this footer as necessary. Add any relevant information or links here.</p>
</footer>
</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

@ -0,0 +1,70 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('New Support Ticket') }}{% 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">
{{ __('New Support Ticket') }}
</h2>
</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">
<form action="/path_to_your_server_processing_script" method="post">
<div class="mb-3">
<label for="category" class="form-label">Category</label>
<select class="form-select" name="category" id="category" required>
<option selected disabled value="">Select a category...</option>
<!-- These options should be dynamically generated -->
<option value="1">Domain Transfer</option>
<!-- ... other categories ... -->
</select>
</div>
<div class="mb-3">
<label for="subject" class="form-label">Subject</label>
<input type="text" class="form-control" id="subject" name="subject" required>
</div>
<div class="mb-3">
<label for="message" class="form-label">Message</label>
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
</div>
<div class="mb-3">
<button type="submit" class="btn btn-primary">Submit Ticket</button>
</div>
</form>
</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

@ -0,0 +1,87 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('Support Tickets') }}{% 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">
{{ __('Support Tickets') }}
</h2>
</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="table-responsive">
<table class="table card-table table-vcenter text-nowrap datatable">
<thead>
<tr>
<th class="w-1"><input class="form-check-input m-0 align-middle" type="checkbox" aria-label="Select all invoices"></th>
<th class="w-1">ID <!-- Download SVG icon from http://tabler-icons.io/i/chevron-up -->
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-sm icon-thick" 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"/><polyline points="6 15 12 9 18 15" /></svg>
</th>
<th>Subject</th>
<th>Status</th>
<th>Priority</th>
<th></th>
</tr>
</thead>
<tbody>
{% for ticket in tickets %}
<tr>
<td><input class="form-check-input m-0 align-middle" type="checkbox" aria-label="Select user"></td>
<td>{{ ticket.subject }}</td>
<td>{{ ticket.status }}</td>
<td>{{ ticket.priority }}</td>
<td class="text-end">
<span class="dropdown">
<button class="btn dropdown-toggle align-text-top" data-bs-boundary="viewport" data-bs-toggle="dropdown">Actions</button>
<div class="dropdown-menu dropdown-menu-end">
<a class="dropdown-item" href="#">
Action
</a>
<a class="dropdown-item" href="#">
Another action
</a>
</div>
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</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

@ -326,7 +326,7 @@
</a>
</div>
</li>
<li {{ is_current_url('hosts') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
<li {{ is_current_url('ticketview') or is_current_url('newticket') or is_current_url('docs') or is_current_url('mediakit') ? '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 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"></path><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path><path d="M15 15l3.35 3.35"></path><path d="M9 15l-3.35 3.35"></path><path d="M5.65 5.65l3.35 3.35"></path><path d="M18.35 5.65l-3.35 3.35"></path></svg>
</span>
@ -335,17 +335,17 @@
</span>
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="{{route('hosts')}}">
<a class="dropdown-item" href="{{route('ticketview')}}">
{{ __('Support Tickets') }}
</a>
<a class="dropdown-item" href="#">
<a class="dropdown-item" href="{{route('newticket')}}">
{{ __('Create Ticket') }}
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{route('hosts')}}">
<a class="dropdown-item" href="{{route('docs')}}">
{{ __('Documentation') }}
</a>
<a class="dropdown-item" href="{{route('hosts')}}">
<a class="dropdown-item" href="{{route('mediakit')}}">
{{ __('Media Kit') }}
</a>
</div>

View file

@ -10,6 +10,7 @@ use App\Controllers\RegistrarsController;
use App\Controllers\FinancialsController;
use App\Controllers\ReportsController;
use App\Controllers\ProfileController;
use App\Controllers\SupportController;
use App\Middleware\AuthMiddleware;
use App\Middleware\GuestMiddleware;
use Slim\Exception\HttpNotFoundException;
@ -46,15 +47,21 @@ $app->group('', function ($route) {
$route->get('/contacts', ContactsController::class .':view')->setName('contacts');
$route->map(['GET', 'POST'], '/contact/create', ContactsController::class . ':create')->setName('contactcreate');
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
$route->map(['GET', 'POST'], '/host/create', HostsController::class . ':create')->setName('hostcreate');
$route->get('/registrars', RegistrarsController::class .':view')->setName('registrars');
$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('/overview', FinancialsController::class .':overview')->setName('overview');
$route->get('/support', SupportController::class .':view')->setName('ticketview');
$route->get('/support/new', SupportController::class .':newticket')->setName('newticket');
$route->get('/support/docs', SupportController::class .':docs')->setName('docs');
$route->get('/support/media', SupportController::class .':mediakit')->setName('mediakit');
$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');