implement admin panel
This commit is contained in:
92 files changed
+5426
-9
No files matched your search
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Loans\Tables;
|
||||
|
||||
use App\Domain\Loan\Enums\LoanStatus;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LoansTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('public_id')
|
||||
->label('Loan ID')
|
||||
->copyable()
|
||||
->weight('semibold')
|
||||
->searchable(),
|
||||
TextColumn::make('customer_id')
|
||||
->label('Customer')
|
||||
->description(fn ($record): string => $record->phone)
|
||||
->searchable(['customer_id', 'phone']),
|
||||
TextColumn::make('loanType.name')
|
||||
->label('Product')
|
||||
->badge()
|
||||
->color('gray')
|
||||
->sortable(),
|
||||
TextColumn::make('amount')
|
||||
->numeric()
|
||||
->suffix(' IRR')
|
||||
->sortable()
|
||||
->alignEnd(),
|
||||
TextColumn::make('credit_score')
|
||||
->label('Credit')
|
||||
->numeric()
|
||||
->suffix(' / 1000')
|
||||
->sortable()
|
||||
->alignEnd(),
|
||||
TextColumn::make('status')
|
||||
->badge()
|
||||
->formatStateUsing(fn (LoanStatus $state): string => str($state->value)->headline()->toString())
|
||||
->color(fn (LoanStatus $state): string => match ($state) {
|
||||
LoanStatus::Submitted => 'gray',
|
||||
LoanStatus::InProgress => 'info',
|
||||
LoanStatus::ManualReview => 'warning',
|
||||
LoanStatus::Approved => 'success',
|
||||
LoanStatus::Rejected => 'danger',
|
||||
}),
|
||||
TextColumn::make('currentStep.stageDefinition.name')
|
||||
->label('Current stage')
|
||||
->placeholder('Complete')
|
||||
->toggleable(),
|
||||
TextColumn::make('created_at')
|
||||
->label('Submitted')
|
||||
->since()
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('loan_type_id')
|
||||
->label('Loan type')
|
||||
->relationship('loanType', 'name')
|
||||
->preload(),
|
||||
SelectFilter::make('status')
|
||||
->multiple()
|
||||
->options(collect(LoanStatus::cases())
|
||||
->mapWithKeys(fn (LoanStatus $status): array => [$status->value => str($status->value)->headline()->toString()])
|
||||
->all()),
|
||||
SelectFilter::make('workflow_configuration_id')
|
||||
->label('Workflow version')
|
||||
->relationship('workflowConfiguration', 'name')
|
||||
->searchable()
|
||||
->preload(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->recordActions([
|
||||
ViewAction::make(),
|
||||
])
|
||||
->emptyStateHeading('No loan applications')
|
||||
->emptyStateDescription('Applications submitted through the API will appear here.')
|
||||
->emptyStateIcon('heroicon-o-document-text');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user