mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-14 16:46:59 +02:00
Creating new support tickets now works
This commit is contained in:
parent
840a04f701
commit
b3e37bb5a5
6 changed files with 252 additions and 51 deletions
|
@ -11,14 +11,90 @@ class SupportController extends Controller
|
||||||
{
|
{
|
||||||
public function view(Request $request, Response $response)
|
public function view(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
$ticketModel = new Tickets($this->container->get('db'));
|
return view($response,'admin/support/view.twig');
|
||||||
$tickets = $ticketModel->getAllTickets();
|
|
||||||
return view($response,'admin/support/view.twig', compact('tickets'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newticket(Request $request, Response $response)
|
public function newticket(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
return view($response,'admin/support/newticket.twig');
|
if ($request->getMethod() === 'POST') {
|
||||||
|
// Retrieve POST data
|
||||||
|
$data = $request->getParsedBody();
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
$categories = $db->select("SELECT * FROM ticket_categories");
|
||||||
|
|
||||||
|
$category = $data['category'] ?? null;
|
||||||
|
$subject = $data['subject'] ?? null;
|
||||||
|
$message = $data['message'] ?? null;
|
||||||
|
|
||||||
|
if (!$subject) {
|
||||||
|
return view($response, 'admin/support/newticket.twig', [
|
||||||
|
'error' => 'Please enter a subject',
|
||||||
|
'categories' => $categories,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$message) {
|
||||||
|
return view($response, 'admin/support/newticket.twig', [
|
||||||
|
'error' => 'Please enter a message',
|
||||||
|
'categories' => $categories,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
|
$crdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
|
$db->insert(
|
||||||
|
'support_tickets',
|
||||||
|
[
|
||||||
|
'user_id' => $_SESSION['auth_user_id'],
|
||||||
|
'category_id' => $category,
|
||||||
|
'subject' => $subject,
|
||||||
|
'message' => $message,
|
||||||
|
'status' => 'Open',
|
||||||
|
'priority' => 'Medium',
|
||||||
|
'reported_domain' => null,
|
||||||
|
'nature_of_abuse' => null,
|
||||||
|
'evidence' => null,
|
||||||
|
'relevant_urls' => null,
|
||||||
|
'date_of_incident' => null,
|
||||||
|
'date_created' => $crdate,
|
||||||
|
'last_updated' => null,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$ticket_id = $db->getLastInsertId();
|
||||||
|
|
||||||
|
$db->insert(
|
||||||
|
'ticket_responses',
|
||||||
|
[
|
||||||
|
'ticket_id' => $ticket_id,
|
||||||
|
'responder_id' => $_SESSION['auth_user_id'],
|
||||||
|
'response' => $message,
|
||||||
|
'date_created' => $crdate,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$db->rollBack();
|
||||||
|
return view($response, 'admin/support/newticket.twig', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'categories' => $categories
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view($response, 'admin/support/view.twig', [
|
||||||
|
'categories' => $categories,
|
||||||
|
'subject' => $subject,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
$categories = $db->select("SELECT * FROM ticket_categories");
|
||||||
|
|
||||||
|
// Default view for GET requests or if POST data is not set
|
||||||
|
return view($response,'admin/support/newticket.twig', [
|
||||||
|
'categories' => $categories,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function docs(Request $request, Response $response)
|
public function docs(Request $request, Response $response)
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<!-- Page pre-title -->
|
<!-- Page pre-title -->
|
||||||
<div class="page-pretitle">
|
<div class="page-pretitle">
|
||||||
Overview
|
{{ __('Overview') }}
|
||||||
</div>
|
</div>
|
||||||
<h2 class="page-title">
|
<h2 class="page-title">
|
||||||
{{ __('New Support Ticket') }}
|
{{ __('New Support Ticket') }}
|
||||||
|
@ -24,16 +24,30 @@
|
||||||
<div class="page-body">
|
<div class="page-body">
|
||||||
<div class="container-xl">
|
<div class="container-xl">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
{% if error is defined %}
|
||||||
|
<div class="alert alert-important alert-danger alert-dismissible" role="alert">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div>
|
||||||
|
<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 d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" /><path d="M12 8v4" /><path d="M12 16h.01" /></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ __('Support ticket can not be created') }}: <strong>{{ error }}</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body border-bottom py-3">
|
<div class="card-body border-bottom py-3">
|
||||||
<form action="/path_to_your_server_processing_script" method="post">
|
<form action="/support/new" method="post">
|
||||||
|
{{ csrf.field | raw }}
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="category" class="form-label">Category</label>
|
<label for="category" class="form-label">Category</label>
|
||||||
<select class="form-select" name="category" id="category" required>
|
<select class="form-select" name="category" id="category" required>
|
||||||
<option selected disabled value="">Select a category...</option>
|
<option selected disabled value="">Select a category...</option>
|
||||||
<!-- These options should be dynamically generated -->
|
{% for category in categories %}
|
||||||
<option value="1">Domain Transfer</option>
|
<option value="{{ category.id }}">{{ category.name }}</option>
|
||||||
<!-- ... other categories ... -->
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
@ -45,7 +59,7 @@
|
||||||
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
|
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<button type="submit" class="btn btn-primary">Submit Ticket</button>
|
<button type="submit" class="btn btn-primary">Create Ticket</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,12 +11,32 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<!-- Page pre-title -->
|
<!-- Page pre-title -->
|
||||||
<div class="page-pretitle">
|
<div class="page-pretitle">
|
||||||
Overview
|
{{ __('Overview') }}
|
||||||
</div>
|
</div>
|
||||||
<h2 class="page-title">
|
<h2 class="page-title">
|
||||||
{{ __('Support Tickets') }}
|
{{ __('Support Tickets') }}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</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="{{route('mediakit')}}" class="btn btn-secondary">
|
||||||
|
{{ __('Media Kit') }}
|
||||||
|
</a>
|
||||||
|
<a href="{{route('docs')}}" class="btn btn-secondary">
|
||||||
|
{{ __('Documentation') }}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<a href="{{route('newticket')}}" class="btn btn-primary d-none d-sm-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"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||||
|
{{ __('Create New Ticket') }}
|
||||||
|
</a>
|
||||||
|
<a href="{{route('newticket')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create New Ticket') }}">
|
||||||
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,47 +44,38 @@
|
||||||
<div class="page-body">
|
<div class="page-body">
|
||||||
<div class="container-xl">
|
<div class="container-xl">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
{% if subject is defined %}
|
||||||
|
<div class="alert alert-important alert-success alert-dismissible" role="alert">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div>
|
||||||
|
<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 d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" /><path d="M12 8v4" /><path d="M12 16h.01" /></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ __('Support ticket') }} <strong>{{ subject }}</strong> {{ __('was created!') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body border-bottom py-3">
|
<div class="card-body border-bottom py-3">
|
||||||
<div class="table-responsive">
|
<div class="d-flex">
|
||||||
<table class="table card-table table-vcenter text-nowrap datatable">
|
<div class="text-secondary">
|
||||||
<thead>
|
<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>
|
||||||
<tr>
|
<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>
|
||||||
<th class="w-1"><input class="form-check-input m-0 align-middle" type="checkbox" aria-label="Select all invoices"></th>
|
<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>
|
||||||
<th class="w-1">ID <!-- Download SVG icon from http://tabler-icons.io/i/chevron-up -->
|
<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>
|
||||||
<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>
|
</div>
|
||||||
</th>
|
<div class="ms-auto text-secondary">
|
||||||
<th>Subject</th>
|
Search:
|
||||||
<th>Status</th>
|
<div class="ms-2 d-inline-block">
|
||||||
<th>Priority</th>
|
<input id="search-input" type="text" class="form-control" aria-label="Search tickets">
|
||||||
<th></th>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
</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 class="table-responsive mt-3">
|
||||||
|
<div id="supportTable"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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('epphistory') or route_is('registrars') or route_is('transactions') or route_is('overview') or route_is('reports') or route_is('transfers') or route_is('users') %}
|
{% if route_is('domains') or route_is('contacts') or route_is('hosts') or route_is('epphistory') or route_is('registrars') or route_is('transactions') or route_is('overview') or route_is('reports') or route_is('transfers') or route_is('users') or route_is('support') %}
|
||||||
{% include 'partials/css-tables.twig' %}
|
{% include 'partials/css-tables.twig' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include 'partials/css.twig' %}
|
{% include 'partials/css.twig' %}
|
||||||
|
@ -413,6 +413,8 @@
|
||||||
{% include 'partials/js-transfers.twig' %}
|
{% include 'partials/js-transfers.twig' %}
|
||||||
{% elseif route_is('users') %}
|
{% elseif route_is('users') %}
|
||||||
{% include 'partials/js-users.twig' %}
|
{% include 'partials/js-users.twig' %}
|
||||||
|
{% elseif route_is('support') %}
|
||||||
|
{% include 'partials/js-support.twig' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include 'partials/js.twig' %}
|
{% include 'partials/js.twig' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
98
cp/resources/views/partials/js-support.twig
Normal file
98
cp/resources/views/partials/js-support.twig
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
<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("#supportTable").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 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>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
table = new Tabulator("#supportTable", {
|
||||||
|
ajaxURL:"/api/records/support_tickets", // Set the URL for your JSON data
|
||||||
|
ajaxConfig:"GET",
|
||||||
|
pagination:"local",
|
||||||
|
paginationSize:10,
|
||||||
|
ajaxResponse:function(url, params, response){
|
||||||
|
return response.records;
|
||||||
|
},
|
||||||
|
layout:"fitDataFill",
|
||||||
|
responsiveLayout: "collapse",
|
||||||
|
responsiveLayoutCollapseStartOpen:false,
|
||||||
|
resizableColumns:false,
|
||||||
|
columns:[
|
||||||
|
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
|
||||||
|
{title:"Subject", field:"subject", headerSort:true, responsive:0},
|
||||||
|
{title:"Status", field:"status", headerSort:true, responsive:2},
|
||||||
|
{title:"Priority", field:"priority", headerSort:true, responsive:2},
|
||||||
|
{title:"Category", field:"category_id", headerSort:false, download:false, responsive:2},
|
||||||
|
{title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }},
|
||||||
|
],
|
||||||
|
placeholder:function(){
|
||||||
|
return this.getHeaderFilters().length ? "No Matching Data" : "No Data"; //set placeholder based on if there are currently any header filters
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var searchInput = document.getElementById("search-input");
|
||||||
|
searchInput.addEventListener("input", function () {
|
||||||
|
var term = searchInput.value.toLowerCase();
|
||||||
|
|
||||||
|
if (term) { // Only apply the filter when there's a term to search for
|
||||||
|
table.setFilter(function (data) {
|
||||||
|
// Check if any of the fields contain the search term
|
||||||
|
return (
|
||||||
|
String(data.subject).toLowerCase().includes(term) ||
|
||||||
|
String(data.status).toLowerCase().includes(term) ||
|
||||||
|
String(data.priority).toLowerCase().includes(term) ||
|
||||||
|
String(data.category_id).toLowerCase().includes(term)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
table.clearFilter(); // Clear the filter when the search box is emptied
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
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 Support Tickets"});
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadPDF() {
|
||||||
|
table.download("pdf", "data.pdf", {
|
||||||
|
orientation:"portrait",
|
||||||
|
title:"My Support Tickets",
|
||||||
|
jsPDF:{unit:"mm", format:"a4", orientation:"p"}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -69,7 +69,7 @@ $app->group('', function ($route) {
|
||||||
$route->get('/settings', SystemController::class .':settings')->setName('settings');
|
$route->get('/settings', SystemController::class .':settings')->setName('settings');
|
||||||
|
|
||||||
$route->get('/support', SupportController::class .':view')->setName('ticketview');
|
$route->get('/support', SupportController::class .':view')->setName('ticketview');
|
||||||
$route->get('/support/new', SupportController::class .':newticket')->setName('newticket');
|
$route->map(['GET', 'POST'], '/support/new', SupportController::class .':newticket')->setName('newticket');
|
||||||
$route->get('/support/docs', SupportController::class .':docs')->setName('docs');
|
$route->get('/support/docs', SupportController::class .':docs')->setName('docs');
|
||||||
$route->get('/support/media', SupportController::class .':mediakit')->setName('mediakit');
|
$route->get('/support/media', SupportController::class .':mediakit')->setName('mediakit');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue