- Added getTabs method to ListCardPinOrders, ListLoanOrders, and ListLoanOrderMobiles pages to display order statuses for system users. - Implemented default sorting by 'created_at' in LoanOrdersTable and LoanOrderMobilesTable for improved data organization. - Updated ManageCards page to ensure proper type declaration for getTitle method.
41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Clusters\Loans\LoanOrders\Pages;
|
|
|
|
use App\Filament\Clusters\Loans\LoanOrders\LoanOrderResource;
|
|
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
|
use Filament\Actions\CreateAction;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
use Filament\Schemas\Components\Tabs\Tab;
|
|
|
|
class ListLoanOrders extends ListRecords
|
|
{
|
|
protected static string $resource = LoanOrderResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
CreateAction::make(),
|
|
];
|
|
}
|
|
|
|
public function getTabs(): array
|
|
{
|
|
if (! user()->isSystemUser()) {
|
|
return [];
|
|
}
|
|
|
|
$data = [];
|
|
|
|
foreach (array_keys(OrderStatusRepository::statusClasses()) as $status) {
|
|
if ($status === '') {
|
|
$data[null] = Tab::make(__('All'));
|
|
} else {
|
|
$data[$status] = Tab::make(OrderStatusRepository::statusFormatted($status))->query(fn ($query) => $query->where('status', $status));
|
|
}
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|