|
|
@ -24,9 +24,18 @@ class ListOrders extends ListRecords
|
|
|
|
public function getTabs(): array
|
|
|
|
public function getTabs(): array
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
null => Tab::make('All')
|
|
|
|
'active' => Tab::make()
|
|
|
|
->icon('lucide-layout-grid'),
|
|
|
|
->query(function ($query) {
|
|
|
|
|
|
|
|
return $query
|
|
|
|
|
|
|
|
->whereNot('status', OrderStatus::INVOICED)
|
|
|
|
|
|
|
|
->whereNot('status', ORderStatus::SHIPPED);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
->icon(OrderStatus::PRODUCTION->getIcon())
|
|
|
|
|
|
|
|
->badge(function () {
|
|
|
|
|
|
|
|
return Order::whereNot('status', OrderStatus::SHIPPED)
|
|
|
|
|
|
|
|
->whereNot('status', OrderStatus::INVOICED)
|
|
|
|
|
|
|
|
->count();
|
|
|
|
|
|
|
|
}),
|
|
|
|
'overdue' => Tab::make()
|
|
|
|
'overdue' => Tab::make()
|
|
|
|
->query(function ($query) {
|
|
|
|
->query(function ($query) {
|
|
|
|
return $query->whereDate('due_date', '<=', today())
|
|
|
|
return $query->whereDate('due_date', '<=', today())
|
|
|
@ -61,25 +70,28 @@ class ListOrders extends ListRecords
|
|
|
|
})
|
|
|
|
})
|
|
|
|
->badgeColor('warning'),
|
|
|
|
->badgeColor('warning'),
|
|
|
|
|
|
|
|
|
|
|
|
'draft' => Tab::make()
|
|
|
|
null => Tab::make('All')
|
|
|
|
->query(fn ($query) => $query->where('status', OrderStatus::DRAFT->value))
|
|
|
|
->icon('lucide-layout-grid'),
|
|
|
|
->icon(OrderStatus::DRAFT->getIcon()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'approved' => Tab::make()
|
|
|
|
|
|
|
|
->query(fn ($query) => $query->where('status', OrderStatus::APPROVED->value))
|
|
|
|
|
|
|
|
->icon(OrderStatus::APPROVED->getIcon()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'production' => Tab::make()
|
|
|
|
|
|
|
|
->query(fn ($query) => $query->where('status', OrderStatus::PRODUCTION->value))
|
|
|
|
|
|
|
|
->icon(OrderStatus::PRODUCTION->getIcon()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'shipped' => Tab::make()
|
|
|
|
|
|
|
|
->query(fn ($query) => $query->where('status', OrderStatus::SHIPPED->value))
|
|
|
|
|
|
|
|
->icon(OrderStatus::SHIPPED->getIcon()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'invoiced' => Tab::make()
|
|
|
|
// 'draft' => Tab::make()
|
|
|
|
->query(fn ($query) => $query->where('status', OrderStatus::INVOICED->value))
|
|
|
|
// ->query(fn ($query) => $query->where('status', OrderStatus::DRAFT->value))
|
|
|
|
->icon(OrderStatus::INVOICED->getIcon()),
|
|
|
|
// ->icon(OrderStatus::DRAFT->getIcon()),
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// 'approved' => Tab::make()
|
|
|
|
|
|
|
|
// ->query(fn ($query) => $query->where('status', OrderStatus::APPROVED->value))
|
|
|
|
|
|
|
|
// ->icon(OrderStatus::APPROVED->getIcon()),
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// 'production' => Tab::make()
|
|
|
|
|
|
|
|
// ->query(fn ($query) => $query->where('status', OrderStatus::PRODUCTION->value))
|
|
|
|
|
|
|
|
// ->icon(OrderStatus::PRODUCTION->getIcon()),
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// 'shipped' => Tab::make()
|
|
|
|
|
|
|
|
// ->query(fn ($query) => $query->where('status', OrderStatus::SHIPPED->value))
|
|
|
|
|
|
|
|
// ->icon(OrderStatus::SHIPPED->getIcon()),
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// 'invoiced' => Tab::make()
|
|
|
|
|
|
|
|
// ->query(fn ($query) => $query->where('status', OrderStatus::INVOICED->value))
|
|
|
|
|
|
|
|
// ->icon(OrderStatus::INVOICED->getIcon()),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|