From f5de71de09feb03e442d22dc8050d60eea199483 Mon Sep 17 00:00:00 2001 From: salam Date: Wed, 27 May 2026 11:01:08 +0200 Subject: [PATCH] wip --- app/Filament/Pages/Statistic.php | 155 ++++++++++++++----------------- 1 file changed, 71 insertions(+), 84 deletions(-) diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index 590f512f..70c896ae 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -19,7 +19,7 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\Slider; use Filament\Pages\Dashboard as BaseDashboard; use Filament\Pages\Dashboard\Concerns\HasFiltersForm; -use Filament\Schemas\Components\Fieldset; +use Filament\Schemas\Components\Grid; use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Set; use Filament\Schemas\Schema; @@ -50,14 +50,14 @@ class Statistic extends BaseDashboard { return $schema ->components([ - Fieldset::make('Events') - ->dense() - ->columns([ - 'default' => 2, - 'sm' => 2, - 'md' => 3, - 'lg' => 4, - ])->extraAttributes([ + Grid::make([ + 'default' => 2, + 'sm' => 2, + 'md' => 3, + 'lg' => 4, + ]) + ->columnSpanFull() + ->extraAttributes([ 'class' => 'bg-gray-100 dark:bg-blue-950 rounded-lg p-5 border border-gray-400 dark:border-blue-800', ]) ->schema([ @@ -110,78 +110,11 @@ class Statistic extends BaseDashboard 'away' => 'Away', ]), - Select::make('similar_past_matches') - ->prefixIcon('phosphor-align-center-horizontal') - ->suffixAction( - Action::make('iconInfo') - ->color('gray') - ->icon('phosphor-question') - ->tooltip(fn () => $this->tooltip_similar_past_matches()) - ) - ->default('none') - ->live() - ->selectablePlaceholder(false) - ->options([ - 'none' => 'None', - 'league' => 'League', - 'all' => 'All Database', - ]), - Slider::make('accuracy') - ->hiddenLabel() - ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none') - ->fillTrack() - ->default(5) - ->step(0.1) - ->decimalPlaces(1) - ->tooltips() - ->range(minValue: 0, maxValue: 1) - ->pips() - ->live(), - ])->columns(6) - ->columnSpanFull(), - Fieldset::make('Player') - ->dense() - ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') - ->columns([ - 'default' => 2, - 'sm' => 2, - 'md' => 3, - 'lg' => 4, - ])->extraAttributes([ - 'class' => 'bg-gray-100 dark:bg-blue-950 rounded-lg p-5 border border-gray-400 dark:border-blue-800', - ]) - ->schema([ - Select::make('tm_player_id') - ->label('Player') - ->prefixIcon('icon-player') - ->suffixAction( - Action::make('copyCostToPrice') - ->action(function (callable $set) { - $set('tm_player_id', null); - $set('player_on_field', null); - }) - ->color('gray') - ->icon('phosphor-x'), - ) - ->preload() - // ->searchable() - ->options(function (Get $get) { - return StatistikoDetail::where('txodds_id', $get('team_id'))->pluck('name', 'tm_player_id'); - }) - ->live(), - Select::make('player_on_field') - ->label('Time on field') - ->prefixIcon('phosphor-watch') - ->default('all') - ->disabled(fn (Get $get) => ! $get('tm_player_id')) - ->selectablePlaceholder(false) - ->options([ - 'all' => 'All', - 'lineup' => 'Lineup', - 'substituted' => 'Substituted', - ]) - ->live(), Select::make('statistic_type') + ->columnSpan([ + 'default' => 1, + 'xl' => 2, + ]) ->prefixIcon('phosphor-cell-signal-full') ->default('none') ->selectablePlaceholder(false) @@ -194,7 +127,6 @@ class Statistic extends BaseDashboard 'snt' => 'Shot on target', 'tsh' => 'Total shots', ]), - DatePicker::make('start_date') ->native(false) ->prefixIcon('phosphor-calendar') @@ -215,9 +147,64 @@ class Statistic extends BaseDashboard ->color('gray') ->action(fn (Set $set) => $set('end_date', null)) ), - ])->columns(5) - ->columnSpanFull(), - + Select::make('similar_past_matches') + ->prefixIcon('phosphor-align-center-horizontal') + ->suffixAction( + Action::make('iconInfo') + ->color('gray') + ->icon('phosphor-question') + ->tooltip(fn () => $this->tooltip_similar_past_matches()) + ) + ->default('none') + ->live() + ->selectablePlaceholder(false) + ->options([ + 'none' => 'None', + 'league' => 'League', + 'all' => 'All Database', + ]), + Slider::make('accuracy') + ->hiddenLabel() + ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none') + // ->fillTrack() + ->default(5) + ->step(0.1) + ->decimalPlaces(1) + ->tooltips() + ->range(minValue: 0, maxValue: 1) + ->pips() + ->live(), + Select::make('tm_player_id') + ->label('Player') + ->prefixIcon('icon-player') + ->suffixAction( + Action::make('copyCostToPrice') + ->action(function (callable $set) { + $set('tm_player_id', null); + $set('player_on_field', null); + }) + ->color('gray') + ->icon('phosphor-x'), + ) + ->preload() + // ->searchable() + ->options(function (Get $get) { + return StatistikoDetail::where('txodds_id', $get('team_id'))->pluck('name', 'tm_player_id'); + }) + ->live(), + Select::make('player_on_field') + ->label('Time on field') + ->prefixIcon('phosphor-watch') + ->default('all') + ->disabled(fn (Get $get) => ! $get('tm_player_id')) + ->selectablePlaceholder(false) + ->options([ + 'all' => 'All', + 'lineup' => 'Lineup', + 'substituted' => 'Substituted', + ]) + ->live(), + ]), ]); }