aboutsummaryrefslogtreecommitdiff
path: root/admin.php
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2024-03-20 17:39:02 +0100
committerarf20 <aruizfernandez05@gmail.com>2024-03-20 17:39:02 +0100
commitec7700456c646b9089f63a272cf15ff4ea5895d6 (patch)
tree1f6c3b1a737a4fee588552028704a16554540782 /admin.php
parent795940c0f278b7e2ff4ff7b0e328dca480662a1c (diff)
downloadarfnet2-cstims-ec7700456c646b9089f63a272cf15ff4ea5895d6.tar.gz
arfnet2-cstims-ec7700456c646b9089f63a272cf15ff4ea5895d6.zip
Add tickets to admin page
Diffstat (limited to 'admin.php')
-rw-r--r--admin.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/admin.php b/admin.php
index 2aeebe1..f70ed7b 100644
--- a/admin.php
+++ b/admin.php
@@ -35,6 +35,13 @@ mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$orders = $result->fetch_all(MYSQLI_ASSOC);
+// Get tickets
+$sql = "SELECT id, `order`, subject FROM tickets";
+$stmt = mysqli_prepare($link, $sql);
+mysqli_stmt_execute($stmt);
+$result = mysqli_stmt_get_result($stmt);
+$tickets = $result->fetch_all(MYSQLI_ASSOC);
+
function getservicebyid($id) {
global $services;
foreach ($services as $service) {
@@ -53,6 +60,15 @@ function getclientbyid($id) {
}
}
+function getorderbyid($id) {
+ global $orders;
+ foreach ($orders as $order) {
+ if ($order["id"] == $id) {
+ return $order;
+ }
+ }
+}
+
?>
<!doctype html>
@@ -108,7 +124,14 @@ function getclientbyid($id) {
</div>
<div class="col2">
<h3>Tickets</h3>
- <!-- TODO PHP list of services -->
+ <table>
+ <tr><th>order</th><th>client</th><th>subject</th></tr>
+ <?php
+ foreach ($tickets as $ticket) {
+ echo "<tr><td>".getorderbyid($ticket["order"])["name"]."</td><td>".getclientbyid(getorderbyid($ticket["order"])["client"])["username"]."</td><td>".$ticket["subject"]."</tr>\n";
+ }
+ ?>
+ </table>
</div>
<div class="col2">
<h3>Invoices</h3>