From 191d081c0f001fb9f8062782bc94f385a8a9f95a Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 19 Apr 2024 15:51:07 +0800 Subject: [PATCH] minor changes on recent orders table --- admin/index.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/admin/index.php b/admin/index.php index 56701ab..0ee3ffe 100644 --- a/admin/index.php +++ b/admin/index.php @@ -15,9 +15,6 @@ if($_SESSION["user_type"]!="admin"){ } $all_orders = getAllOrder(); - -$num_orders = count($all_orders); - date_default_timezone_set('Asia/Manila'); @@ -1040,11 +1037,8 @@ date_default_timezone_set('Asia/Manila'); $val) { + $iterationCount = 0; + foreach (array_reverse($all_orders) as $x => $val) { $paymentStatus = strtolower($val['payment']['status']); $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); $orderId = $val['_id']; @@ -1054,17 +1048,17 @@ date_default_timezone_set('Asia/Manila'); $orderStatus = strtoupper($val['status']); $statusClass = ''; - if ($orderStatus === 'UNPAID') { + if ($orderStatus === 'UNPAID' || $orderStatus === 'RETURNED') { $statusClass = '#cb3747'; } elseif ($orderStatus === 'TO PAY') { - $statusClass = '#4a90e2'; + $statusClass = '#50d7ab'; } elseif ($orderStatus === 'TO SHIP') { - $statusClass = '#ffcc66'; + $statusClass = '#9586cd'; } elseif ($orderStatus === 'TO RECEIVE') { $statusClass = '#ffc319'; } elseif ($orderStatus === 'COMPLETED') { - $statusClass = '#56ba5a'; + $statusClass = '#88aaf3'; } if ($formattedOrderDate == $currentDate) { @@ -1080,6 +1074,10 @@ date_default_timezone_set('Asia/Manila'); = 15) { + break; + } } } ?>