74 lines
2.5 KiB
PHP
74 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\InviteLayouts\Tables;
|
|
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteAction;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\BadgeColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class InviteLayoutsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('name')
|
|
->label('Name')
|
|
->searchable()
|
|
->sortable(),
|
|
TextColumn::make('slug')
|
|
->label('Slug')
|
|
->copyable()
|
|
->searchable()
|
|
->sortable(),
|
|
TextColumn::make('paper')
|
|
->label('Papier')
|
|
->sortable(),
|
|
TextColumn::make('orientation')
|
|
->label('Ausrichtung')
|
|
->sortable(),
|
|
BadgeColumn::make('is_active')
|
|
->label('Status')
|
|
->colors([
|
|
'success' => fn ($state) => $state === true,
|
|
'gray' => fn ($state) => $state === false,
|
|
])
|
|
->getStateUsing(fn ($record) => $record->is_active)
|
|
->formatStateUsing(fn ($state) => $state ? 'Aktiv' : 'Inaktiv'),
|
|
TextColumn::make('updated_at')
|
|
->label('Aktualisiert')
|
|
->dateTime('d.m.Y H:i')
|
|
->sortable(),
|
|
])
|
|
->filters([
|
|
SelectFilter::make('is_active')
|
|
->label('Status')
|
|
->options([
|
|
'1' => 'Aktiv',
|
|
'0' => 'Inaktiv',
|
|
])
|
|
->query(function ($query, $state) {
|
|
if ($state === '1') {
|
|
$query->where('is_active', true);
|
|
} elseif ($state === '0') {
|
|
$query->where('is_active', false);
|
|
}
|
|
}),
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
DeleteAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|