aboutsummaryrefslogtreecommitdiff
path: root/client.php
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2024-03-18 19:47:44 +0100
committerarf20 <aruizfernandez05@gmail.com>2024-03-18 19:47:44 +0100
commit0cb2a90f5422ca5c2f04ecf986a555c758afae61 (patch)
treecfd6b0ba24e1791991cd4c438fe7509caa7517bb /client.php
parent4c4b8df824dcd2fd3ac4b8d486181ec87a0f13cd (diff)
downloadarfnet2-cstims-0cb2a90f5422ca5c2f04ecf986a555c758afae61.tar.gz
arfnet2-cstims-0cb2a90f5422ca5c2f04ecf986a555c758afae61.zip
Client sees orders, order status
Diffstat (limited to 'client.php')
-rw-r--r--client.php35
1 files changed, 34 insertions, 1 deletions
diff --git a/client.php b/client.php
index 615aac3..5d33ba2 100644
--- a/client.php
+++ b/client.php
@@ -7,11 +7,37 @@ if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
exit;
}
+$clientid = $_SESSION["id"];
$username = $_SESSION["username"];
$type = $_SESSION["type"];
require_once "config.php";
+// Get orders
+$sql = "SELECT id, service, name, billing 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);
+$orders = $result->fetch_all(MYSQLI_ASSOC);
+
+// Get services
+$sql = "SELECT id, name, type, billing FROM services";
+$stmt = mysqli_prepare($link, $sql);
+mysqli_stmt_execute($stmt);
+$result = mysqli_stmt_get_result($stmt);
+$services = $result->fetch_all(MYSQLI_ASSOC);
+
+function getservicebyid($id) {
+ global $services;
+ foreach ($services as $service) {
+ if ($service["id"] == $id) {
+ return $service;
+ }
+ }
+}
+
?>
<!doctype html>
@@ -34,7 +60,14 @@ require_once "config.php";
<div class="row">
<div class="col5">
<h3>Active services</h3>
- <!-- TODO PHP list of services -->
+ <table>
+ <tr><th>service</th><th>instance</th><th>billing</th></tr>
+ <?php
+ foreach ($orders as $order) {
+ echo "<tr><td>".getservicebyid($order["service"])["name"]."</td><td>".$order["name"]."</td><td>".$order["billing"]."</tr>\n";
+ }
+ ?>
+ </table>
</div>
<div class="col5">
<h3>Tickets</h3>