57 lines
2.1 KiB
PHP
57 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Clients\Tables;
|
|
|
|
use App\Actions\AlarmGenerator;
|
|
use App\Actions\MultilineGenerator;
|
|
use App\Models\Bookmaker;
|
|
use App\Models\Provider;
|
|
use App\Models\Sport;
|
|
use Filament\Actions\Action;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class ClientsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->striped()
|
|
->columns([
|
|
TextColumn::make('name'),
|
|
TextColumn::make('bookmaker')
|
|
->wrap()
|
|
->badge()
|
|
->formatStateUsing(fn (string $state): string => Bookmaker::where('id', $state)->pluck('name')->first()),
|
|
TextColumn::make('provider')
|
|
->badge()
|
|
->wrap()
|
|
->color('success')
|
|
->formatStateUsing(fn (string $state): string => Provider::where('id', $state)->pluck('name')->first()),
|
|
TextColumn::make('sport')
|
|
->badge()
|
|
->wrap()
|
|
->color('warning')
|
|
->formatStateUsing(fn (string $state): string => Sport::where('id', $state)->pluck('name')->first()),
|
|
TextColumn::make('created_at')->dateTime(),
|
|
TextColumn::make('updated_at')->dateTime(),
|
|
])
|
|
->recordActions([
|
|
Action::make('multiline')
|
|
->icon('phosphor-gear-fine')
|
|
->tooltip('Generates basic alarm configuration for client')
|
|
->action(function ($record) {
|
|
MultilineGenerator::run($record);
|
|
}),
|
|
Action::make('alarm')
|
|
->icon('phosphor-gear-fine')
|
|
->tooltip('Generates basic multiline configuration for client')
|
|
->action(function ($record) {
|
|
AlarmGenerator::run($record);
|
|
}),
|
|
EditAction::make(),
|
|
]);
|
|
}
|
|
}
|