77 lines
2.7 KiB
PHP
77 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Bonuses\Tables;
|
|
|
|
use App\Enums\BonusType;
|
|
use App\Filament\Support\ExportExcelAction;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Actions\ForceDeleteBulkAction;
|
|
use Filament\Actions\RestoreBulkAction;
|
|
use Filament\Actions\ViewAction;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Filters\TrashedFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class BonusesTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('employee.full_name')
|
|
->label('Employee')
|
|
->searchable()
|
|
->sortable(),
|
|
TextColumn::make('bonus_date')
|
|
->date()
|
|
->sortable(),
|
|
TextColumn::make('bonus_type')
|
|
->label('Type')
|
|
->badge()
|
|
->color(fn (BonusType $state): string => $state->color())
|
|
->formatStateUsing(fn (BonusType $state): string => $state->label())
|
|
->searchable()
|
|
->sortable(),
|
|
TextColumn::make('amount')
|
|
->money('TMT')
|
|
->sortable(),
|
|
TextColumn::make('reason')
|
|
->limit(40)
|
|
->toggleable(),
|
|
TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
TextColumn::make('updated_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
TextColumn::make('deleted_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->filters([
|
|
SelectFilter::make('bonus_type')
|
|
->label('Type')
|
|
->options(BonusType::class),
|
|
TrashedFilter::make(),
|
|
])
|
|
->recordActions([
|
|
ViewAction::make(),
|
|
EditAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
ExportExcelAction::bulk('exportSelected', \App\Exports\BonusesExport::class, 'bonuses.xlsx'),
|
|
DeleteBulkAction::make(),
|
|
ForceDeleteBulkAction::make(),
|
|
RestoreBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|