aboutsummaryrefslogtreecommitdiff
path: root/client.php
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2024-03-20 20:00:31 +0100
committerarf20 <aruizfernandez05@gmail.com>2024-03-20 20:00:31 +0100
commita8f2bace985ee0419492a09e1d5a3879f2f5b96b (patch)
treeacbcf11cb4ba4652a07077dffd46792e454bf8bc /client.php
parentec7700456c646b9089f63a272cf15ff4ea5895d6 (diff)
downloadarfnet2-cstims-a8f2bace985ee0419492a09e1d5a3879f2f5b96b.tar.gz
arfnet2-cstims-a8f2bace985ee0419492a09e1d5a3879f2f5b96b.zip
Ticketing system
Diffstat (limited to 'client.php')
-rw-r--r--client.php31
1 files changed, 28 insertions, 3 deletions
diff --git a/client.php b/client.php
index dbab9e8..2a9721d 100644
--- a/client.php
+++ b/client.php
@@ -29,6 +29,15 @@ mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$services = $result->fetch_all(MYSQLI_ASSOC);
+// Get tickets
+$sql = "SELECT id, `order`, subject, body, date, status, asignee FROM tickets WHERE `order` IN (SELECT id FROM orders WHERE client = ?)";
+$stmt = mysqli_prepare($link, $sql);
+mysqli_stmt_bind_param($stmt, "s", $param_client);
+$param_client = $clientid;
+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) {
@@ -38,6 +47,15 @@ function getservicebyid($id) {
}
}
+function getorderbyid($id) {
+ global $orders;
+ foreach ($orders as $order) {
+ if ($order["id"] == $id) {
+ return $order;
+ }
+ }
+}
+
?>
<!doctype html>
@@ -61,17 +79,24 @@ function getservicebyid($id) {
<div class="col5">
<h3>Orders</h3>
<table>
- <tr><th>service</th><th>instance</th><th>billing</th><th>comments</th><th>status</th></tr>
+ <tr><th>instance</th><th>service</th><th>billing</th><th>comments</th><th>status</th></tr>
<?php
foreach ($orders as $order) {
- echo "<tr><td>".getservicebyid($order["service"])["name"]."</td><td>".$order["name"]."</td><td>".$order["billing"]."</td><td><pre>".$order["comments"]."</pre></td><td>".$order["status"]."</tr>\n";
+ echo "<tr><td>".$order["name"]."</td><td>".getservicebyid($order["service"])["name"]."</td><td>".$order["billing"]."</td><td><details><summary></summary><pre>".$order["comments"]."</pre></details></td><td>".$order["status"]."</td></tr>\n";
}
?>
</table>
</div>
<div class="col5">
<h3>Tickets</h3>
- <!-- TODO PHP list of services -->
+ <table>
+ <tr><th>order</th><th>subject</th><th>body</th><th>date</th><th>status</th></tr>
+ <?php
+ foreach ($tickets as $ticket) {
+ echo "<tr><td>".getorderbyid($ticket["order"])["name"]."</td><td>".$ticket["subject"]."</td><td><details><summary></summary><pre>".$ticket["body"]."</pre></details></td><td>".$ticket["date"]."</td><td>".$ticket["status"]."</td></tr>\n";
+ }
+ ?>
+ </table>
</div>
</div>
</div>