aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin.php25
-rw-r--r--manageorders.php4
2 files changed, 24 insertions, 5 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>
diff --git a/manageorders.php b/manageorders.php
index a1ff0a0..90e0efa 100644
--- a/manageorders.php
+++ b/manageorders.php
@@ -136,10 +136,6 @@ function getclientbyid($id) {
if (isset($_GET["edit"])) {
$order = getorderbyid($_GET["edit"]);
$client_options = $service_options = "";
- /*foreach ($clients as $client)
- $client_options .= "<option value=\"".$client["id"]."\" ".($client["id"] == $order["client"] ? "selected" : "").">".$client["username"]."</option>";
- foreach ($services as $service)
- $service_options .= "<option value=\"".$service["id"]."\" ".($service["id"] == $order["service"] ? "selected" : "").">".$service["name"]."</option>";*/
echo "<div class=\"form\"><h3>Edit order ".$order["id"]."</h3><form action=\"".$_SERVER['SCRIPT_NAME']."\" method=\"post\">\n"
."<label>Name</label><br><input type=\"text\" name=\"name\" value=\"".$order["name"]."\"><br>\n"
."<label>Billing</label><br><input type=\"text\" name=\"billing\" value=\"".$order["billing"]."\"><br>\n"