supervisro tabel wip
This commit is contained in:
1 parent
f63ad0bc57
commit
6cf075709e
4 files changed
+97
-84
No files matched your search
@@ -2,12 +2,14 @@
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Tables;
|
||||
|
||||
use App\Models\Sport;
|
||||
use App\Models\Supervisor;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\Layout\Split;
|
||||
use Filament\Tables\Columns\Layout\Stack;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
@@ -26,62 +28,71 @@ class SupervisorsTable
|
||||
->striped()
|
||||
->poll('10s')
|
||||
->columns([
|
||||
TextColumn::make('id')->badge()->alignCenter(),
|
||||
TextColumn::make('provider.name')->badge()
|
||||
->color(fn ($record): string => match ($record->provider_id) {
|
||||
1 => 'danger',
|
||||
2 => 'success',
|
||||
default => 'warning',
|
||||
}),
|
||||
SelectColumn::make('name')
|
||||
->options(function ($record) {
|
||||
switch ($record->provider_id) {
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
return [
|
||||
'Fixtures' => 'Fixtures',
|
||||
'Odds' => 'Odds',
|
||||
];
|
||||
case 2:
|
||||
return [
|
||||
'Fixtures' => 'Fixtures',
|
||||
'Odds' => 'Odds',
|
||||
'Willhill' => 'Willhill',
|
||||
'Bwin' => 'Bwin',
|
||||
'Bet365' => 'Bet365',
|
||||
'Betfair' => 'Betfair',
|
||||
];
|
||||
case 7:
|
||||
return [
|
||||
'Txodds Markets' => 'Txodds Markets',
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
Split::make([
|
||||
TextColumn::make('id')->badge()->alignCenter(),
|
||||
TextColumn::make('provider.name')
|
||||
->color(fn ($record): string => match ($record->provider_id) {
|
||||
1 => 'danger',
|
||||
2 => 'success',
|
||||
default => 'warning',
|
||||
}),
|
||||
Stack::make([
|
||||
SelectColumn::make('name')
|
||||
->disablePlaceholderSelection()
|
||||
->options(function ($record) {
|
||||
switch ($record->provider_id) {
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
return [
|
||||
'Fixtures' => 'Fixtures',
|
||||
'Odds' => 'Odds',
|
||||
];
|
||||
case 2:
|
||||
return [
|
||||
'Fixtures' => 'Fixtures',
|
||||
'Odds' => 'Odds',
|
||||
'Willhill' => 'Willhill',
|
||||
'Bwin' => 'Bwin',
|
||||
'Bet365' => 'Bet365',
|
||||
'Betfair' => 'Betfair',
|
||||
];
|
||||
case 7:
|
||||
return [
|
||||
'Txodds Markets' => 'Txodds Markets',
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
}),
|
||||
TextColumn::make('sport.name')->label('Sport'),
|
||||
TextColumn::make('days_from')->label('From'),
|
||||
TextColumn::make('days_to')->label('To'),
|
||||
TextInputColumn::make('sleep')->width('2rem'),
|
||||
TextColumn::make('runtime')->label('Run Time'),
|
||||
TextInputColumn::make('commandline_options')->width('2rem'),
|
||||
}),
|
||||
SelectColumn::make('sport_id')
|
||||
->options(fn () => Sport::where('is_active', 1)->pluck('name', 'id'))
|
||||
->placeholder('All'),
|
||||
])->space(3),
|
||||
|
||||
// TextColumn::make('maxsconds')->label('Max Time'),
|
||||
// IconColumn::make('is_supervisor')->boolean()->label('Cron')->falseColor('gray'),
|
||||
ToggleColumn::make('use_lastcall')->label('Lastcall'),
|
||||
ToggleColumn::make('is_supervisor')->label('Super')->tooltip('Create a supervisor process'),
|
||||
ToggleColumn::make('is_active')->label('Active'),
|
||||
Stack::make([
|
||||
TextInputColumn::make('days_from')->prefix('Days Fm'),
|
||||
TextInputColumn::make('days_to')->prefix('Days To'),
|
||||
])->space(3),
|
||||
Stack::make([
|
||||
TextInputColumn::make('sleep')->prefix('Seep'),
|
||||
TextInputColumn::make('commandline_options')->prefix('Bash'),
|
||||
])->space(3),
|
||||
ToggleColumn::make('use_lastcall')->label('Lastcall')->tooltip('Use last call parameter'),
|
||||
ToggleColumn::make('is_supervisor')->label('Super')->tooltip('Run as supervisor'),
|
||||
ToggleColumn::make('is_active')->label('Active')->tooltip(('On/Off'))->onColor('success'),
|
||||
TextColumn::make('runtime')->label('Run Time')->badge(),
|
||||
]),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('provider_id')
|
||||
->default(1)
|
||||
->relationship('provider', 'name')
|
||||
->label('Provider'),
|
||||
TernaryFilter::make('is_supervisor'),
|
||||
TernaryFilter::make('is_supervisor')->label('Run by supervisor'),
|
||||
TernaryFilter::make('is_active'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
|
||||
Reference in new issue
Block a user