Warenwirtschaft: Review-Fix — Abwicklungs-Board (Copyreader-Links, 500er-Cap, Details)

Bestellnummern-Links auf admin_sales_detail (admin >= 7) waren für
Versand-Mitarbeiter tote Links (stiller Redirect) — jetzt rollenabhängig.
Kachel-Zähler und pick/ready-Filter rechnen über alle offenen
Bestellungen statt über die neuesten 500; gekappt wird nur die Anzeige,
der Hinweis-Banner zeigt 'neueste n von total' korrekt. whereDate durch
indexfähiges whereBetween ersetzt; Packlisten-Toggle über data-order-id;
Gewicht über formatNumber().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-20 12:40:03 +00:00
parent f28f4b4b68
commit 80d0687f95
5 changed files with 61 additions and 17 deletions

View file

@ -31,34 +31,46 @@ class OrderFulfillmentController extends Controller
$withRelations = ['shopping_user', 'shopping_payment_last', 'shipping_country.country', 'shopping_order_items.product.setItems'];
// Offene Abwicklung (Status offen/in Bearbeitung) — Basis für Liste und Kachel-Zähler
// Offene Abwicklung (Status offen/in Bearbeitung) — Basis für Liste und Kachel-Zähler.
// Bewusst OHNE Limit (Review 20.07.2026): das Cap galt vorher schon für die Zähler
// und Filter-Listen, wodurch bei > 500 offenen Bestellungen ausgerechnet die
// ältesten versandfertigen unsichtbar wurden — und der Hinweis-Banner verglich
// den Post-Filter-Count, erschien also nie. Gekappt wird jetzt nur die Anzeige.
$open = ShoppingOrder::query()
->with($withRelations)
->whereIn('shipped', [0, 1])
->orderByDesc('id')
->when($limit !== null, fn ($query) => $query->limit($limit))
->get();
$pick = $open->where('shipped', 0)->filter->isReadyToShip()->values();
$ready = $open->where('shipped', 1)->filter->isReadyToShip()->values();
$counts = [
'today' => ShoppingOrder::query()->whereDate('created_at', today())->count(),
'pick' => $open->where('shipped', 0)->filter->isReadyToShip()->count(),
'ready' => $open->where('shipped', 1)->filter->isReadyToShip()->count(),
'shipped_today' => ShoppingOrder::query()->whereDate('shipped_at', today())->count(),
'today' => ShoppingOrder::query()->whereBetween('created_at', [today(), today()->endOfDay()])->count(),
'pick' => $pick->count(),
'ready' => $ready->count(),
'shipped_today' => ShoppingOrder::query()->whereBetween('shipped_at', [today(), today()->endOfDay()])->count(),
];
$orders = match ($filter) {
'today' => ShoppingOrder::query()->with($withRelations)->whereDate('created_at', today())->orderByDesc('id')->get(),
'pick' => $open->where('shipped', 0)->filter->isReadyToShip()->values(),
'ready' => $open->where('shipped', 1)->filter->isReadyToShip()->values(),
'shipped_today' => ShoppingOrder::query()->with($withRelations)->whereDate('shipped_at', today())->orderByDesc('id')->get(),
'today' => ShoppingOrder::query()->with($withRelations)->whereBetween('created_at', [today(), today()->endOfDay()])->orderByDesc('id')->get(),
'pick' => $pick,
'ready' => $ready,
'shipped_today' => ShoppingOrder::query()->with($withRelations)->whereBetween('shipped_at', [today(), today()->endOfDay()])->orderByDesc('id')->get(),
default => $open,
};
$listTotal = $orders->count();
if ($limit !== null) {
$orders = $orders->take($limit)->values();
}
return view('admin.inventory.orders.index', [
'orders' => $orders,
'counts' => $counts,
'filter' => $filter,
'listLimit' => $limit,
'listTotal' => $listTotal,
]);
}