Procházet zdrojové kódy

admin dashboard changes

Medowar před 6 dny
rodič
revize
f3c716a039
1 změnil soubory, kde provedl 21 přidání a 3 odebrání
  1. 21 3
      admin/index.php

+ 21 - 3
admin/index.php

@@ -40,7 +40,22 @@ foreach ($orders as $order) {
     }
 }
 
-$recentOrders = $orders;
+$recentOrders = array_values(array_filter($orders, function ($order) {
+    $label = getOrderStatusLabel($order);
+    if ($label !== 'Offen' && $label !== 'Teilweise bearbeitet') {
+        return false;
+    }
+    foreach ($order['items'] as $item) {
+        if (!empty($item['is_processed'])) {
+            continue;
+        }
+        if (trim((string) ($item['backorder_status'] ?? '')) !== '') {
+            continue;
+        }
+        return true;
+    }
+    return false;
+}));
 usort($recentOrders, function ($left, $right) {
     return strcmp($right['created_at'], $left['created_at']);
 });
@@ -56,6 +71,9 @@ foreach ($orders as $order) {
         if (!empty($item['is_processed'])) {
             continue;
         }
+        if (trim((string) ($item['backorder_status'] ?? '')) !== '') {
+            continue;
+        }
         $outstandingItems[] = [
             'order_id' => $order['id'],
             'customer_name' => $order['customer_name'],
@@ -130,10 +148,10 @@ include __DIR__ . '/../includes/header.php';
     </div>
 </div>
 
-<h3 class="section-title mt-4">Letzte Bestellungen</h3>
+<h3 class="section-title mt-4">Letzte offene Bestellungen</h3>
 
 <?php if (empty($recentOrders)): ?>
-    <p>Keine Bestellungen vorhanden.</p>
+    <p>Keine offenen Bestellungen vorhanden.</p>
 <?php else: ?>
     <div class="table-responsive">
         <table class="responsive-table">