count($products), 'organizations' => count($organizations), 'unconfirmed' => 0, 'open' => 0, 'partial' => 0, 'processed' => 0, 'cancelled' => 0, 'backorder' => $backorderCount, ]; foreach ($orders as $order) { if ($order['confirmation_status'] === 'pending') { $stats['unconfirmed']++; } elseif ($order['status'] === 'cancelled') { $stats['cancelled']++; } elseif ($order['status'] === 'processed') { $stats['processed']++; } elseif ($order['status'] === 'partial') { $stats['partial']++; } else { $stats['open']++; } } $recentOrders = $orders; usort($recentOrders, function ($left, $right) { return strcmp($right['created_at'], $left['created_at']); }); $recentOrders = array_slice($recentOrders, 0, 5); $outstandingItems = []; foreach ($orders as $order) { $label = getOrderStatusLabel($order); if ($label !== 'Offen' && $label !== 'Teilweise bearbeitet') { continue; } foreach ($order['items'] as $item) { if (!empty($item['is_processed'])) { continue; } $outstandingItems[] = [ 'order_id' => $order['id'], 'customer_name' => $order['customer_name'], 'organization_label' => $order['organization_label'], 'created_at' => $order['created_at'], 'product_name' => $item['product_name'], 'size' => $item['size'], 'availability_label' => $item['availability_label'], 'backorder_status' => $item['backorder_status'] ?? '', ]; } } usort($outstandingItems, function ($left, $right) { $cmp = strcmp($left['created_at'], $right['created_at']); if ($cmp !== 0) { return $cmp; } $cmp = strcmp($left['order_id'], $right['order_id']); if ($cmp !== 0) { return $cmp; } return strcmp($left['product_name'], $right['product_name']); }); $bodyClass = 'admin-page'; include __DIR__ . '/../includes/header.php'; ?>

Admin Dashboard

Bestellungen
Verwaltung

Produkte

Organisationen

Unbestätigt

Offen

Teilweise bearbeitet

Bearbeitet

Storniert

Nachbestellung

Letzte Bestellungen

Keine Bestellungen vorhanden.

Bestellnummer Name Organisation Erstellt Status Aktionen
Details

Offene Positionen

Keine offenen Positionen vorhanden.

Bestellnummer Name Organisation Artikel Größe Lieferhinweis Nachbestellung Erstellt Aktionen
- Details