grapper wip

This commit is contained in:
salam committed 2025-08-25 12:57:17 +02:00
1 parent 944aa736b2
commit adb15e701b
9 files changed
+95 -68

No files matched your search

@@ -6,6 +6,9 @@ use App\Models\Bookmaker;
use App\Models\Sport;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
class SupervisorForm
@@ -16,7 +19,14 @@ class SupervisorForm
->components([
TextInput::make('name')
->required()
->default(null),
->columnSpan(2),
Select::make('type')
->options([
'Grapper' => 'Grapper',
'Comparatore' => 'Comparatore',
])
->default('grapper')
->selectablePlaceholder(false),
Select::make('provider_id')
->relationship('provider', 'name')
->required()
@@ -26,15 +36,16 @@ class SupervisorForm
->nullable(),
Select::make('bookmaker_id')
->options(Bookmaker::query()->where('is_active', 1)->pluck('name', 'id'))
->nullable(),
TextInput::make('sleep')
->required()
->numeric()
->default(30),
TextInput::make('limit')
->required()
->numeric()
->default(0),
->selectablePlaceholder(true),
Fieldset::make('Supervisor or Cron Toggle')
->schema([
Toggle::make('is_cron')->live(),
TextInput::make('sleep')
->label('Sleep between loops')
->hidden(fn (Get $get): bool => $get('is_cron'))
->numeric()
->default(30),
])->columnSpan(2),
]);
}
}
@@ -2,9 +2,11 @@
namespace App\Filament\Resources\Supervisors\Tables;
use App\Models\Bookmaker;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
@@ -18,6 +20,7 @@ class SupervisorsTable
TextColumn::make('id')->badge(),
TextColumn::make('name')
->searchable(),
TextColumn::make('type')->badge(),
TextColumn::make('provider.name')
->badge()->color(fn (string $state): string => match ($state) {
'txodds' => 'danger',
@@ -25,15 +28,19 @@ class SupervisorsTable
'direct' => 'primary',
default => 'warning',
}),
TextColumn::make('sport_id')->label('Sport'),
TextColumn::make('bookmaker_id')->label('Book'),
TextColumn::make('sport.name')->label('Sport'),
IconColumn::make('bookmaker_id')
->label('Book')
->icon(function ($state): string {
if ($state) {
return 'bkm-'.Bookmaker::where('id', $state)->pluck('icon')->first();
}
}),
TextColumn::make('sleep')->numeric(),
TextColumn::make('limit')->numeric(),
TextColumn::make('runtime')->label('Duration'),
TextColumn::make('events')->numeric(),
TextColumn::make('runtime'),
TextColumn::make('lastcall'),
ToggleColumn::make('is_cron')->label('Cron'),
ToggleColumn::make('is_active')->label('Status'),
IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
ToggleColumn::make('is_active')->label('On/Off'),
TextColumn::make('created_at')
->dateTime()
->sortable()