diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index 214f5699..4fbfd7dd 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -9,6 +9,7 @@ use App\Actions\Selections\LoadSeasons; use App\Models\Element; use App\Models\StatisticFixtures; use BackedEnum; +use BezhanSalleh\FilamentShield\Traits\HasPageShield; use Filament\Actions\Action; use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\Radio; @@ -26,7 +27,7 @@ use Illuminate\Support\HtmlString; class Statistic extends BaseDashboard { - use HasFiltersForm; + use HasFiltersForm, HasPageShield; protected static string|BackedEnum|null $navigationIcon = 'phosphor-chart-line-up'; @@ -106,7 +107,7 @@ class Statistic extends BaseDashboard ->options(function (Get $get) { if ($get('match_id')) { $res = StatisticFixtures::where('id', $get('match_id'))->first(); - + $arr = []; $arr[$res->home_id] = Element::query()->where('id', $res->home_id)->value('name'); $arr[$res->away_id] = Element::query()->where('id', $res->away_id)->value('name'); @@ -270,49 +271,48 @@ class Statistic extends BaseDashboard 'date' => 'Date', ]), ]), - Select::make('season') - ->live() - ->columns(2) - ->hiddenLabel() - ->multiple() - ->placeholder('Season') - ->prefixIconColor(fn(Get $get): string => $get('season') ? 'success' : 'danger') - ->hidden(fn(Get $get) => $get('season_or_date') == 'date') - ->prefixIcon('phosphor-calendar-star-fill') - ->preload() - ->options(function (Get $get) { - return LoadSeasons::load($get('league_id')); - }), - DatePicker::make('start_date') - ->live() - ->hiddenLabel() - ->hidden(fn(Get $get) => $get('season_or_date') == 'season') - ->native(false) - ->prefixIconColor('primary') - ->prefixIcon('phosphor-calendar') - ->prefix('Start') - ->suffixAction( - Action::make('clear_start') - ->icon('phosphor-x') - ->color('gray') - ->action(fn(Set $set) => $set('start_date', null)) - ), - DatePicker::make('end_date') - ->live() - ->hiddenLabel() - ->hidden(fn(Get $get) => $get('season_or_date') == 'season') - ->native(false) - ->prefixIconColor('primary') - ->prefixIcon('phosphor-calendar') - ->prefix('End') - ->suffixAction( - Action::make('clear_end') - ->icon('phosphor-x') - ->color('gray') - ->action(fn(Set $set) => $set('end_date', null)) - ), + Select::make('season') + ->live() + ->columns(2) + ->hiddenLabel() + ->multiple() + ->placeholder('Season') + ->prefixIconColor(fn(Get $get): string => $get('season') ? 'success' : 'danger') + ->hidden(fn(Get $get) => $get('season_or_date') == 'date') + ->prefixIcon('phosphor-calendar-star-fill') + ->preload() + ->options(function (Get $get) { + return LoadSeasons::load($get('league_id')); + }), + DatePicker::make('start_date') + ->live() + ->hiddenLabel() + ->hidden(fn(Get $get) => $get('season_or_date') == 'season') + ->native(false) + ->prefixIconColor('primary') + ->prefixIcon('phosphor-calendar') + ->prefix('Start') + ->suffixAction( + Action::make('clear_start') + ->icon('phosphor-x') + ->color('gray') + ->action(fn(Set $set) => $set('start_date', null)) + ), + DatePicker::make('end_date') + ->live() + ->hiddenLabel() + ->hidden(fn(Get $get) => $get('season_or_date') == 'season') + ->native(false) + ->prefixIconColor('primary') + ->prefixIcon('phosphor-calendar') + ->prefix('End') + ->suffixAction( + Action::make('clear_end') + ->icon('phosphor-x') + ->color('gray') + ->action(fn(Set $set) => $set('end_date', null)) + ), ]); - } protected function tooltip_similar_past_matches(): HtmlString