wip
This commit is contained in:
@@ -70,7 +70,10 @@ class CardOrdersTable
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('status')
|
||||
->label(__('Status'))
|
||||
->formatStateUsing(fn (string $state) => OrderStatusRepository::statusFormatted($state))
|
||||
->badge()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('updated_at')
|
||||
|
||||
@@ -55,7 +55,10 @@ class CardPinOrdersTable
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('status')
|
||||
->label(__('Status'))
|
||||
->formatStateUsing(fn (string $state) => OrderStatusRepository::statusFormatted($state))
|
||||
->sortable()
|
||||
->badge()
|
||||
->searchable(),
|
||||
])
|
||||
->filters([
|
||||
|
||||
@@ -53,11 +53,6 @@ class LoanOrderResource extends Resource
|
||||
return LoanOrderForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return LoanOrderInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return LoanOrdersTable::configure($table);
|
||||
@@ -75,7 +70,6 @@ class LoanOrderResource extends Resource
|
||||
return [
|
||||
'index' => ListLoanOrders::route('/'),
|
||||
'create' => CreateLoanOrder::route('/create'),
|
||||
'view' => ViewLoanOrder::route('/{record}'),
|
||||
'edit' => EditLoanOrder::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ class EditLoanOrder extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
ViewAction::make(),
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Tables;
|
||||
|
||||
use App\Modules\DefaultQueryForResourceIndex\Repositories\DefaultQueryForResourceIndexRepository;
|
||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||
use App\Modules\Region\Repositories\RegionRepository;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
@@ -37,7 +39,8 @@ class LoanOrdersTable
|
||||
TextColumn::make('region')
|
||||
->label(__('Region'))
|
||||
->sortable()
|
||||
->searchable(),
|
||||
->searchable()
|
||||
->formatStateUsing(fn (string $state) => RegionRepository::label($state)),
|
||||
|
||||
TextColumn::make('branch.name')
|
||||
->label(__('Branch'))
|
||||
@@ -60,9 +63,15 @@ class LoanOrdersTable
|
||||
|
||||
TextColumn::make('status')
|
||||
->label(__('Status'))
|
||||
->formatStateUsing(fn (string $state) => OrderStatusRepository::statusFormatted($state))
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('status')
|
||||
->badge()
|
||||
->color(OrderStatusRepository::statusColorMatching())
|
||||
->formatStateUsing(fn (string $state) => OrderStatusRepository::statusFormatted($state)),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->label(__('Created At'))
|
||||
->dateTime()
|
||||
@@ -85,7 +94,6 @@ class LoanOrdersTable
|
||||
TrashedFilter::make(),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make(),
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Tables;
|
||||
|
||||
use App\Modules\DefaultQueryForResourceIndex\Repositories\DefaultQueryForResourceIndexRepository;
|
||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||
use App\Modules\Region\Repositories\RegionRepository;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
@@ -24,7 +26,8 @@ class LoanPaidOffLettersTable
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('region')
|
||||
->label(__('Region')),
|
||||
->label(__('Region'))
|
||||
->formatStateUsing(fn (string $state) => RegionRepository::label($state)),
|
||||
|
||||
TextColumn::make('branch.name')
|
||||
->label(__('Branch')),
|
||||
@@ -38,9 +41,14 @@ class LoanPaidOffLettersTable
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('phone')
|
||||
->label(__('Phone'))
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('status')
|
||||
->label(__('Status'))
|
||||
->formatStateUsing(fn (string $state) => OrderStatusRepository::statusFormatted($state))
|
||||
->sortable()
|
||||
->badge()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Modules\OrderStatus\Repositories;
|
||||
|
||||
use Closure;
|
||||
|
||||
class OrderStatusRepository
|
||||
{
|
||||
/**
|
||||
@@ -94,20 +96,17 @@ class OrderStatusRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* HEX Colors
|
||||
*
|
||||
* @return array<string, string>
|
||||
* Status color matching
|
||||
*/
|
||||
public static function statusColors(): array
|
||||
public static function statusColorMatching(): Closure
|
||||
{
|
||||
return [
|
||||
null => '-',
|
||||
self::PENDING => '#F5573B',
|
||||
self::REGISTER => '#F2CB22',
|
||||
self::PROCESSING => '#8FC15D',
|
||||
self::COMPLETED => '#098F56',
|
||||
self::CANCELLED => '#d70206',
|
||||
];
|
||||
return fn (string $state): string => match ($state) {
|
||||
self::PENDING => 'warning',
|
||||
self::REGISTER => 'info',
|
||||
self::PROCESSING => 'primary',
|
||||
self::COMPLETED => 'success',
|
||||
self::CANCELLED => 'danger',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user