Add basic ticket search - would need further work to search by a ticket ID with a prefix. Possibly encourage a default prefix so we can filter that out?

This commit is contained in:
Marcus Hill
2022-01-14 17:42:24 +00:00
parent 6c673571d2
commit 227cf0591a
+43
View File
@@ -10,6 +10,7 @@ if(isset($_GET['query'])){
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY vendor_id DESC LIMIT 5"); $sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY vendor_id DESC LIMIT 5");
$sql_products = mysqli_query($mysqli,"SELECT * FROM products WHERE product_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY product_id DESC LIMIT 5"); $sql_products = mysqli_query($mysqli,"SELECT * FROM products WHERE product_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY product_id DESC LIMIT 5");
$sql_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY login_id DESC LIMIT 5"); $sql_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY login_id DESC LIMIT 5");
$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients on tickets.ticket_client_id = clients.client_id WHERE (ticket_subject LIKE '%$query%' OR ticket_number = '$query') AND tickets.company_id = $session_company_id ORDER BY ticket_id DESC LIMIT 5");
$q = htmlentities($_GET['query']); $q = htmlentities($_GET['query']);
?> ?>
@@ -182,6 +183,48 @@ if(isset($_GET['query'])){
</div> </div>
</div> </div>
<!-- Tickets -->
<div class="col-6">
<div class="card mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fa fa-tags"></i> Tickets</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
<thead>
<tr>
<th>Description</th>
<th>Client</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql_tickets)){
$ticket_id = $row['ticket_id'];
$ticket_subject = $row['ticket_subject'];
$ticket_client = $row['client_name'];
$ticket_status = $row['ticket_status'];
?>
<tr>
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id ?>"><?php echo $ticket_subject; ?></a></td>
<td><?php echo $ticket_client; ?></td>
<td><?php echo $ticket_status; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div> </div>