wip
This commit is contained in:
1 parent
3376eb6d2e
commit
ec60adb074
9 files changed
+194
-195
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Actions\LoadSeasons;
|
||||
use App\Actions\LoadStatisticFixturesLeaguesOptions;
|
||||
use App\Actions\LoadStatisticFixturesMatchOptions;
|
||||
use App\Models\Element;
|
||||
@@ -10,6 +11,7 @@ use App\Models\StatistikoDetail;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Slider;
|
||||
use Filament\Pages\Dashboard as BaseDashboard;
|
||||
@@ -21,7 +23,6 @@ use Filament\Schemas\Schema;
|
||||
use Filament\Support\RawJs;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use PhpOption\None;
|
||||
|
||||
class Statistic extends BaseDashboard
|
||||
{
|
||||
@@ -56,8 +57,8 @@ class Statistic extends BaseDashboard
|
||||
->components([
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 2,
|
||||
'md' => 4,
|
||||
'sm' => 3,
|
||||
'md' => 5,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->extraAttributes([
|
||||
@@ -102,8 +103,6 @@ class Statistic extends BaseDashboard
|
||||
return 'danger';
|
||||
}
|
||||
})
|
||||
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
|
||||
// ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->prefixIcon('phosphor-users-three')
|
||||
->disabled(fn(Get $get) => $get('similar_past_matches') != 'none')
|
||||
->options(function (Get $get) {
|
||||
@@ -128,7 +127,6 @@ class Statistic extends BaseDashboard
|
||||
->hiddenLabel()
|
||||
->placeholder('Team Position')
|
||||
->prefix('Team Position')
|
||||
// ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
|
||||
->prefixIcon('phosphor-map-pin')
|
||||
->disabled(fn(Get $get) => $get('similar_past_matches') != 'none')
|
||||
->default('all')
|
||||
@@ -138,33 +136,20 @@ class Statistic extends BaseDashboard
|
||||
'home' => 'Home',
|
||||
'away' => 'Away',
|
||||
]),
|
||||
|
||||
DatePicker::make('start_date')
|
||||
Select::make('season')
|
||||
->hiddenLabel()
|
||||
->native(false)
|
||||
->placeholder('Season')
|
||||
->hidden(fn(Get $get) => $get('season_or_date') == 'date')
|
||||
->prefixIcon('phosphor-calendar-star')
|
||||
->prefixIconColor('primary')
|
||||
->prefixIcon('phosphor-calendar')
|
||||
->live()
|
||||
->prefix('Start')
|
||||
->suffixAction(
|
||||
Action::make('clear_start')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->action(fn(Set $set) => $set('start_date', null))
|
||||
),
|
||||
DatePicker::make('end_date')
|
||||
->hiddenLabel()
|
||||
->native(false)
|
||||
->prefixIconColor('primary')
|
||||
->prefixIcon('phosphor-calendar')
|
||||
->live()
|
||||
->prefix('End')
|
||||
->suffixAction(
|
||||
Action::make('clear_end')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->action(fn(Set $set) => $set('end_date', null))
|
||||
),
|
||||
->options(function (Get $get) {
|
||||
return LoadSeasons::load($get('league_id'));
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('team_id', null);
|
||||
$set('tm_player_id', null);
|
||||
})
|
||||
->live(),
|
||||
Select::make('statistic_type')
|
||||
->hiddenLabel()
|
||||
->placeholder('Statistic Type')
|
||||
@@ -186,10 +171,10 @@ class Statistic extends BaseDashboard
|
||||
->placeholder('Similar Past Matches')
|
||||
->prefixIconColor('primary')
|
||||
->suffix(fn(Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">± ' . $get('accuracy') . '</div>') : '')
|
||||
->columnSpan([
|
||||
'default' => 1,
|
||||
'xl' => 2,
|
||||
])
|
||||
// ->columnSpan([
|
||||
// 'default' => 1,
|
||||
// 'xl' => 2,
|
||||
// ])
|
||||
->prefixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question')
|
||||
@@ -204,9 +189,9 @@ class Statistic extends BaseDashboard
|
||||
$set('team_position', null);
|
||||
})
|
||||
->options([
|
||||
'none' => 'Similar Past Matches: None',
|
||||
'league' => 'Similar Past Matches: League',
|
||||
'all' => 'Similar Past Matches: All Database',
|
||||
'none' => 'SPM: None',
|
||||
'league' => 'SPM: League',
|
||||
'all' => 'SPM: All Database',
|
||||
]),
|
||||
Slider::make('accuracy')
|
||||
// ->label('Accuracy min: 0, max: 0.25, steps: 0.025')
|
||||
@@ -262,6 +247,44 @@ class Statistic extends BaseDashboard
|
||||
'substituted' => 'Substituted',
|
||||
])
|
||||
->live(),
|
||||
DatePicker::make('start_date')
|
||||
->hiddenLabel()
|
||||
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
|
||||
->native(false)
|
||||
->prefixIconColor('primary')
|
||||
->prefixIcon('phosphor-calendar')
|
||||
->live()
|
||||
->prefix('Start')
|
||||
->suffixAction(
|
||||
Action::make('clear_start')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->action(fn(Set $set) => $set('start_date', null))
|
||||
),
|
||||
DatePicker::make('end_date')
|
||||
->hiddenLabel()
|
||||
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
|
||||
->native(false)
|
||||
->prefixIconColor('primary')
|
||||
->prefixIcon('phosphor-calendar')
|
||||
->live()
|
||||
->prefix('End')
|
||||
->suffixAction(
|
||||
Action::make('clear_end')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->action(fn(Set $set) => $set('end_date', null))
|
||||
),
|
||||
Radio::make('season_or_date')
|
||||
->columnSpan(2)
|
||||
->inline()
|
||||
->live()
|
||||
->default('season')
|
||||
->hiddenLabel()
|
||||
->options([
|
||||
'season' => 'Season',
|
||||
'date' => 'Date Picker',
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -269,6 +292,7 @@ class Statistic extends BaseDashboard
|
||||
protected function tooltip_similar_past_matches(): HtmlString
|
||||
{
|
||||
$str = '<div class="m-3 grid grid-cols-4 gap-2 max-w-lg">';
|
||||
$str .= '<div class="col-span-4 font-bold">Similar Past Matches (SMP)</div>';
|
||||
$str .= '<div class="font-bold">None</div>';
|
||||
$str .= '<div class="col-span-3"><u>Team</u> within selected league</div>';
|
||||
$str .= '<div class="font-bold">League</div>';
|
||||
|
||||
Reference in new issue
Block a user