minor changes on recent orders table
This commit is contained in:
parent
f9e03219fa
commit
191d081c0f
|
@ -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');
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$totalOrders = count($all_orders);
|
||||
|
||||
// Slice the array to get the last 10 elements and reverse it to maintain order
|
||||
$latestOrders = array_slice($all_orders, max(0, $totalOrders - 10), 10);
|
||||
foreach (array_reverse($latestOrders) as $x => $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');
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
$iterationCount++;
|
||||
if ($iterationCount >= 15) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue