Skip to content

Commit

Permalink
add account column
Browse files Browse the repository at this point in the history
  • Loading branch information
megoxv committed Dec 5, 2024
1 parent 4d596a3 commit 838b493
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/Filament/Resources/WithdrawalRequestResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Support\Number;
use TomatoPHP\FilamentAccounts\Components\AccountColumn;

class WithdrawalRequestResource extends Resource
{
Expand Down Expand Up @@ -129,13 +130,13 @@ public static function infolist(Infolist $infolist): Infolist
->label(trans('filament-withdrawals::messages.forms.requests.columns.date')),
TextEntry::make('amount')
->label(trans('filament-withdrawals::messages.forms.requests.columns.amount'))
->money('USD'),
->money(setting('site_currency')),
TextEntry::make('currency')
->label(trans('filament-withdrawals::messages.forms.requests.columns.currency'))
->money('USD'),
->money(setting('site_currency')),
TextEntry::make('rate')
->label(trans('filament-withdrawals::messages.forms.requests.columns.rate'))
->money('USD'),
->money(setting('site_currency')),
TextEntry::make('amount')
->label(trans('filament-withdrawals::messages.forms.requests.columns.final_amount'))
->formatStateUsing(function (WithdrawalRequest $record) {
Expand Down Expand Up @@ -165,24 +166,37 @@ public static function table(Table $table): Table
{
return $table
->columns([
AccountColumn::make('model.id')
->label(trans('filament-accounts::messages.accounts.coulmns.id')),
Tables\Columns\TextColumn::make('model.name')
->label(trans('filament-accounts::messages.accounts.coulmns.name'))
->toggleable(isToggledHiddenByDefault: true)
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('model.teams.name')
->badge()
->icon('heroicon-o-user-group')
->label(trans('filament-accounts::messages.accounts.coulmns.teams'))
->toggleable()
->searchable(),
Tables\Columns\TextColumn::make('status')
->label(trans('filament-withdrawals::messages.forms.requests.columns.status'))
->badge()
->state(fn ($record) => match ($record->status) {
->state(fn($record) => match ($record->status) {
"pending" => trans('filament-withdrawals::messages.forms.requests.columns.pending'),
"processing" => trans('filament-withdrawals::messages.forms.requests.columns.processing'),
"completed" => trans('filament-withdrawals::messages.forms.requests.columns.completed'),
"cancelled" => trans('filament-withdrawals::messages.forms.requests.columns.cancelled'),
default => $record->status,
})
->icon(fn ($record) => match ($record->status) {
->icon(fn($record) => match ($record->status) {
'pending' => 'heroicon-s-rectangle-stack',
'processing' => 'heroicon-s-arrow-path',
'completed' => 'heroicon-s-check-circle',
'cancelled' => 'heroicon-s-x-circle',
default => 'heroicon-s-x-circle',
})
->color(fn ($record) => match ($record->status) {
->color(fn($record) => match ($record->status) {
'pending' => 'info',
'processing' => 'warning',
'completed' => 'success',
Expand Down

0 comments on commit 838b493

Please sign in to comment.