improvements on admin dashboard and order history

This commit is contained in:
jouls 2024-04-26 13:01:28 +08:00
parent 0dfa648b19
commit e30cbcebd7
2 changed files with 21 additions and 7 deletions

View File

@ -114,7 +114,7 @@ $allSignups = array_merge($all_customers, $all_vendors);
</div>
</li>
<li>
<a href="user-profile.html">
<a href="#">
<i class="mdi mdi-account"></i> My Profile
</a>
</li>
@ -1060,6 +1060,8 @@ $allSignups = array_merge($all_customers, $all_vendors);
<tbody>
<?php
$iterationCount = 0;
$ordersDisplayed = false;
foreach (array_reverse($all_orders) as $x => $val) {
$paymentStatus = strtolower($val['payment']['status']);
$formattedOrderDate = date('m-d-Y', strtotime($val['order_date']));
@ -1085,6 +1087,8 @@ $allSignups = array_merge($all_customers, $all_vendors);
}
if ($formattedOrderDate == $currentDate) {
$ordersDisplayed = true;
$displayDate = date('m-d-Y, g:i A', strtotime($val['order_date']));
?>
<tr>
@ -1103,6 +1107,14 @@ $allSignups = array_merge($all_customers, $all_vendors);
}
}
}
if (!$ordersDisplayed) {
?>
<tr>
<td class="align-self-center">No Recent Orders Yet.</td>
</tr>
<?php
}
?>
</tbody>
</table>
@ -1181,7 +1193,7 @@ $allSignups = array_merge($all_customers, $all_vendors);
if (!$customersDisplayed) {
?>
<tr>
<td class="align-self-center">No new vendors in the past week</td>
<td class="align-self-center">No new customers in the past week</td>
</tr>
<?php
}
@ -1260,7 +1272,7 @@ $allSignups = array_merge($all_customers, $all_vendors);
if (!$vendorsDisplayed) {
?>
<tr>
<td class="align-self-center" colspan="2">No new vendors in the past week</td>
<td class="align-self-center">No new vendors in the past week</td>
</tr>
<?php
}

View File

@ -14,7 +14,7 @@ if ($_SESSION["user_type"] != "admin") {
header("location: login.php?alert=Only admins allowed here!");
}
$orders = getAllOrder();
$allorders = json_encode($orders, true);
// $allorders = json_encode($orders, true);
?>
<!DOCTYPE html>
@ -24,9 +24,9 @@ $allorders = json_encode($orders, true);
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Ekka - Admin Dashboard HTML Template.">
<meta name="description" content="oBanana B2B - Admin Dashboard">
<title>Ekka - Admin Dashboard HTML Template.</title>
<title>oBanana B2B - Admin Dashboard</title>
<!-- GOOGLE FONTS -->
<link rel="preconnect" href="https://fonts.googleapis.com">
@ -82,7 +82,8 @@ $allorders = json_encode($orders, true);
<table id="responsive-data-table" class="table" style="width:100%">
<thead>
<tr>
<th>Date</th>
<th>Updated Date</th>
<th>Order Date</th>
<th>Customer</th>
<th>Vendor</th>
<th>Product</th>
@ -102,6 +103,7 @@ $allorders = json_encode($orders, true);
?>
<tr>
<td><?php echo date('Y-m-d', strtotime($order['updatedAt'])) ?></td>
<td><?php echo date('Y-m-d', strtotime($order['order_date'])) ?></td>
<td><?php echo $order['customer'][0]['name'] ?></td>
<td><?php echo $order['items'][0]['vendor_name'] ?></td>
<td><?php echo $order['items'][0]['product']['name'] ?></td>