changes Ubaldo before Logomatic
This commit is contained in:
1 parent
498660e9cc
commit
f9e8b17d58
11 files changed
+607
-843
No files matched your search
+389
-377
@@ -26,7 +26,7 @@ use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\Size;
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use Filament\Support\RawJs;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Support\HtmlString;
|
||||
@@ -37,6 +37,8 @@ class Statistic extends BaseDashboard
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-chart-line-up';
|
||||
|
||||
protected ?Alignment $headerActionsAlignment = Alignment::End;
|
||||
|
||||
protected string $view = 'filament.pages.statistic';
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
@@ -82,34 +84,11 @@ class Statistic extends BaseDashboard
|
||||
return '';
|
||||
}
|
||||
|
||||
// protected function getHeaderActions(): array
|
||||
// {
|
||||
// return [
|
||||
// Action::make('esc')
|
||||
// ->label('Reset')
|
||||
// ->icon('phosphor-x-circle')
|
||||
// ->color('gray')
|
||||
// ->keyBindings(['esc'])
|
||||
// ->action('resetFilters'),
|
||||
// Action::make('openDispatcherBoard')
|
||||
// ->modalHeading('')
|
||||
// ->label('Calculate')
|
||||
// ->icon('icon-player')
|
||||
// ->color(fn (): string => $this->filters['team_id'] ? 'primary' : 'gray')
|
||||
// ->disabled(fn (): string => $this->filters['team_id'] ? false : true)
|
||||
// ->slideOver()
|
||||
// ->slideOverPosition(SlideOverPosition::Start)
|
||||
// ->modalWidth(Width::Screen)
|
||||
// ->modalSubmitAction(false)
|
||||
// ->modalCancelAction(false)
|
||||
// ->modalContent(fn (): View => view('livewire.board-dispatcher-modal-wrapper', ['filters' => $this->filters])),
|
||||
// ];
|
||||
// }
|
||||
|
||||
public function filtersForm(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
// change sport TODO
|
||||
// ToggleButtons::make('status')
|
||||
// ->columnSpanFull()
|
||||
// ->hiddenLabel()
|
||||
@@ -136,365 +115,21 @@ class Statistic extends BaseDashboard
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Hidden::make('seasonmode'),
|
||||
Select::make('sofascore_category_id')
|
||||
->live()
|
||||
->preload()
|
||||
->searchable(false)
|
||||
->prefixIconColor(fn (Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-globe')
|
||||
->hiddenLabel()
|
||||
->options(fn () => LoadSofaScoreCategory::load())
|
||||
->placeholder('Select Country')
|
||||
->afterStateUpdated(function (callable $set, $state) {
|
||||
$set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode'));
|
||||
$set('league_id', null);
|
||||
$set('match_id', null);
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$set('season', null);
|
||||
}),
|
||||
Select::make('league_id')
|
||||
->live()
|
||||
->preload()
|
||||
->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-trophy')
|
||||
->hiddenLabel()
|
||||
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
||||
->placeholder('Select League')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('match_id', null);
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$this->dispatch('reset-tab');
|
||||
}),
|
||||
Select::make('match_id')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||
->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-calendar-check')
|
||||
->options(function (Get $get) {
|
||||
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->placeholder('Select Event'),
|
||||
Action::make('esc')
|
||||
->hiddenLabel()
|
||||
->visible(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->tooltip('Clear All (esc)')
|
||||
->icon('phosphor-x-circle')
|
||||
->color('danger')
|
||||
->keyBindings(['esc'])
|
||||
->size(Size::Medium)
|
||||
->outlined()
|
||||
->action('resetFilters'),
|
||||
$this->selectSofascoreCategoryId(),
|
||||
$this->selectLeagueId(),
|
||||
$this->selectMatchId(),
|
||||
$this->selectTeamId(),
|
||||
$this->selectTeamPosition(),
|
||||
|
||||
Select::make('team_id')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->prefixIconColor(function (Get $get): string {
|
||||
if ($get('team_id')) {
|
||||
return 'success';
|
||||
} elseif ($get('similar_past_matches') != 'none') {
|
||||
return 'gray';
|
||||
} else {
|
||||
return 'danger';
|
||||
}
|
||||
})
|
||||
->prefixIcon('phosphor-users')
|
||||
->suffixAction(Action::make('reset')
|
||||
->icon('phosphor-x-circle')
|
||||
->tooltip('Clear Team')
|
||||
->action(fn (callable $set) => $set('team_id', null))
|
||||
->color(fn (Get $get): string => $get('team_id') != 0 ? 'danger' : 'gray'))
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->options(function (Get $get) {
|
||||
if ($get('match_id')) {
|
||||
$res = StatisticFixtures::where('id', $get('match_id'))->first();
|
||||
|
||||
$arr = [];
|
||||
if ($res) {
|
||||
$arr[$res->home_id] = SofaScoreRosa::query()->where('ss_team_id', $res->home_id)->value('ss_team_name');
|
||||
$arr[$res->away_id] = SofaScoreRosa::query()->where('ss_team_id', $res->away_id)->value('ss_team_name');
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
$set('team_position', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->placeholder('Select Team'),
|
||||
Select::make('team_position')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->placeholder('Select Team Position')
|
||||
->prefix('TP')
|
||||
->prefixAction(
|
||||
Action::make('iconInfo')
|
||||
->color('success')
|
||||
->icon('phosphor-question')
|
||||
->tooltip(fn () => 'Team Position')
|
||||
)
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->default('all')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'all' => 'All',
|
||||
'home' => 'Home',
|
||||
'away' => 'Away',
|
||||
])->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
}),
|
||||
]),
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 3,
|
||||
'md' => 4,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Select::make('statistic_type')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->allowHtml()
|
||||
->placeholder('Statistic Type')
|
||||
->prefixIconColor('success')
|
||||
->prefixIcon(function (Get $get) {
|
||||
return match ($get('statistic_type')) {
|
||||
'gls' => 'phosphor-soccer-ball',
|
||||
'crn' => 'phosphor-angle',
|
||||
'fls' => 'phosphor-first-aid-kit',
|
||||
'ofs' => 'phosphor-arrow-fat-lines-right',
|
||||
'crd' => 'phosphor-cards',
|
||||
'snt' => 'phosphor-target',
|
||||
'tsh' => 'phosphor-chart-polar',
|
||||
default => 'phosphor-soccer-ball',
|
||||
};
|
||||
})
|
||||
->default('gls')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'gls' => 'Goals',
|
||||
'crn' => 'Corner',
|
||||
'fls' => 'Fouls Commited',
|
||||
'ofs' => 'Offside',
|
||||
'crd' => 'Cards',
|
||||
'snt' => 'Shots On Target',
|
||||
'tsh' => 'Total Shots',
|
||||
]),
|
||||
|
||||
/************************
|
||||
* SMP
|
||||
************************/
|
||||
Select::make('similar_past_matches')
|
||||
->live()
|
||||
// ->columnSpan(2)
|
||||
->hiddenLabel()
|
||||
->hidden(fn (Get $get) => $get('team_id') != null)
|
||||
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||
->suffixAction(Action::make('reset')
|
||||
->icon('phosphor-x-circle')
|
||||
->tooltip('Clear SMP')
|
||||
->action(fn (callable $set) => $set('similar_past_matches', 'none'))
|
||||
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'danger' : 'gray'))
|
||||
->placeholder('Similar Past Matches')
|
||||
->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>') : '')
|
||||
->prefix('SPM')
|
||||
->prefixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question')
|
||||
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'danger')
|
||||
->tooltip(fn () => $this->tooltip_similar_past_matches())
|
||||
)
|
||||
->default('none')
|
||||
->selectablePlaceholder(false)
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
$set('team_position', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->options([
|
||||
'none' => 'None',
|
||||
'league' => 'League',
|
||||
'all' => 'All Database',
|
||||
]),
|
||||
/************************
|
||||
* SLIDER
|
||||
************************/
|
||||
Slider::make('accuracy')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
|
||||
->fillTrack()
|
||||
->minValue(0)
|
||||
->maxValue(0.25)
|
||||
->default(0.125)
|
||||
->step(0.025)
|
||||
->decimalPlaces(3)
|
||||
->pips()
|
||||
->pipsFormatter(RawJs::make(<<<'JS'
|
||||
`${$value.toFixed(2)}`
|
||||
JS)),
|
||||
/************************
|
||||
* PLAYER
|
||||
************************/
|
||||
Select::make('ss_player_id')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->allowHtml()
|
||||
->columnSpan(2)
|
||||
->placeholder('Player')
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '')
|
||||
->prefixIcon('icon-player')
|
||||
->preload()
|
||||
->searchable()
|
||||
->extraAttributes(fn () => [
|
||||
'id' => 'player_selector',
|
||||
'style' => 'width: 100%;',
|
||||
])
|
||||
->suffixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question')
|
||||
->color('success')
|
||||
->tooltip(fn () => $this->tooltip_player_info())
|
||||
)
|
||||
->options(function (Get $get) {
|
||||
$team_id = $get('team_id');
|
||||
$team_position = $get('team_position');
|
||||
$sofascore_category_id = $get('sofascore_category_id');
|
||||
$season = $get('season');
|
||||
$seasonmode = $get('seasonmode');
|
||||
|
||||
return LoadPlayerSelection::load($team_id, $team_position, $sofascore_category_id, $season, $seasonmode);
|
||||
}),
|
||||
Select::make('player_on_field')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->placeholder('Time on field')
|
||||
->prefixIcon('phosphor-watch')
|
||||
->default('all')
|
||||
->hidden(fn (Get $get) => ! $get('ss_player_id'))
|
||||
->prefixIconColor('success')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'all' => 'All',
|
||||
'lineup' => 'Lineup',
|
||||
'substituted' => 'Substituted',
|
||||
'notplayed' => 'Not Played',
|
||||
]),
|
||||
]),
|
||||
Grid::make([
|
||||
'default' => 7,
|
||||
'sm' => 7,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Radio::make('season_or_date')
|
||||
->live()
|
||||
->extraAttributes([
|
||||
'class' => 'radio-statistic-group',
|
||||
])
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->columnSpan(2)
|
||||
->inline()
|
||||
->default('season')
|
||||
->hiddenLabel()
|
||||
->options([
|
||||
'season' => 'Season',
|
||||
'date' => 'Date',
|
||||
]),
|
||||
/************************
|
||||
* SEASON full time
|
||||
************************/
|
||||
Select::make('season')
|
||||
->live()
|
||||
->columnSpan(2)
|
||||
->hiddenLabel()
|
||||
->multiple()
|
||||
->placeholder('Current Season')
|
||||
->prefixIconColor('success')
|
||||
->visible(fn (Get $get) => $get('seasonmode'))
|
||||
->hidden(fn (Get $get) => $get('seasonmode') == 'halfyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
||||
->prefixIcon('phosphor-calendar-star')
|
||||
->options([
|
||||
'2026' => '2026',
|
||||
'2025' => '2025',
|
||||
'2024' => '2024',
|
||||
])
|
||||
->afterStateUpdated(function (callable $set, Get $get) {
|
||||
$set('ss_player_id', null);
|
||||
}),
|
||||
/************************
|
||||
* SEASON half time
|
||||
************************/
|
||||
Select::make('season')
|
||||
->live()
|
||||
->columnSpan(2)
|
||||
->hiddenLabel()
|
||||
->multiple()
|
||||
->placeholder('Current Season')
|
||||
->prefixIconColor('success')
|
||||
->visible(fn (Get $get) => $get('seasonmode'))
|
||||
->hidden(fn (Get $get) => $get('seasonmode') == 'fullyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
||||
->prefixIcon('phosphor-calendar-star')
|
||||
->options([
|
||||
'26/27' => '26/27',
|
||||
'25/26' => '25/26',
|
||||
'24/25' => '24/25',
|
||||
])
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
}),
|
||||
/************************
|
||||
* DATE PICKER
|
||||
************************/
|
||||
DatePicker::make('start_date')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
|
||||
->native(false)
|
||||
->prefixIconColor(fn (Get $get): string => $get('start_date') ? 'success' : '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(fn (Get $get): string => $get('end_date') ? 'success' : 'primary')
|
||||
->prefixIcon('phosphor-calendar')
|
||||
->prefix('End')
|
||||
->suffixAction(
|
||||
Action::make('clear_end')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->action(fn (Set $set) => $set('end_date', null))
|
||||
),
|
||||
Actions::make([
|
||||
Action::make('esc')
|
||||
->hiddenLabel()
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->tooltip('Clear All (esc)')
|
||||
->icon('phosphor-x-circle')
|
||||
->color(fn (Get $get) => $get('sofascore_category_id') ? 'danger' : 'gray')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->keyBindings(['esc'])
|
||||
->outlined()
|
||||
->size(Size::Medium)
|
||||
->action('resetFilters'),
|
||||
Action::make('copy')
|
||||
->hiddenLabel()
|
||||
@@ -502,7 +137,6 @@ class Statistic extends BaseDashboard
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->tooltip('Copy data for pasting into spreadsheet')
|
||||
->color('success')
|
||||
->size(Size::Medium)
|
||||
->outlined()
|
||||
->icon('phosphor-copy')
|
||||
->action(function ($livewire) {
|
||||
@@ -519,6 +153,30 @@ class Statistic extends BaseDashboard
|
||||
}),
|
||||
]),
|
||||
]),
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 3,
|
||||
'md' => 4,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
$this->selectStatisticType(),
|
||||
$this->selectSimilarPastMatches(),
|
||||
$this->sliderAccuracy(),
|
||||
$this->selectPlayerId(),
|
||||
$this->selectPlayerOnField(),
|
||||
]),
|
||||
Grid::make([
|
||||
'default' => 8,
|
||||
'sm' => 8,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
$this->radioSeasonOrDate(),
|
||||
$this->selectSeason(),
|
||||
$this->datePickerStartDate(),
|
||||
$this->datePickerEndDate(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -640,4 +298,358 @@ class Statistic extends BaseDashboard
|
||||
|
||||
return new HtmlString($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* FROM HERE ONLY FORM FILTERS
|
||||
* Komplexe Filter in eigene Methoden auslagern (faster)
|
||||
*/
|
||||
private function selectSofascoreCategoryId(): Select
|
||||
{
|
||||
return Select::make('sofascore_category_id')
|
||||
->live()
|
||||
->preload()
|
||||
->searchable(false)
|
||||
->prefixIconColor(fn (Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-globe')
|
||||
->hiddenLabel()
|
||||
->options(fn () => LoadSofaScoreCategory::load())
|
||||
->placeholder('Select Country')
|
||||
->afterStateUpdated(function (callable $set, $state) {
|
||||
$set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode'));
|
||||
$set('league_id', null);
|
||||
$set('match_id', null);
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$set('season', null);
|
||||
});
|
||||
}
|
||||
|
||||
private function selectLeagueId(): Select
|
||||
{
|
||||
return Select::make('league_id')
|
||||
->live()
|
||||
->preload()
|
||||
->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-trophy')
|
||||
->hiddenLabel()
|
||||
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
||||
->placeholder('Select League')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
$set('match_id', null);
|
||||
$set('team_id', null);
|
||||
$this->dispatch('reset-tab');
|
||||
});
|
||||
}
|
||||
|
||||
private function selectMatchId(): Select
|
||||
{
|
||||
return Select::make('match_id')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||
->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-calendar-check')
|
||||
->options(function (Get $get) {
|
||||
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->placeholder('Select Event');
|
||||
}
|
||||
|
||||
private function selectTeamId(): Select
|
||||
{
|
||||
return Select::make('team_id')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->prefixIconColor(function (Get $get): string {
|
||||
if ($get('team_id')) {
|
||||
return 'success';
|
||||
} elseif ($get('similar_past_matches') != 'none') {
|
||||
return 'gray';
|
||||
} else {
|
||||
return 'danger';
|
||||
}
|
||||
})
|
||||
->prefixIcon('phosphor-users')
|
||||
->suffixAction(Action::make('reset')
|
||||
->icon('phosphor-x')
|
||||
->tooltip('Clear Team')
|
||||
->action(fn (callable $set) => $set('team_id', 0).$set('ss_player_id', null))
|
||||
->color('gray'))
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->options(function (Get $get) {
|
||||
if ($get('match_id')) {
|
||||
$res = StatisticFixtures::where('id', $get('match_id'))->first();
|
||||
|
||||
$arr = [];
|
||||
if ($res) {
|
||||
$arr[$res->home_id] = SofaScoreRosa::query()->where('ss_team_id', $res->home_id)->value('ss_team_name');
|
||||
$arr[$res->away_id] = SofaScoreRosa::query()->where('ss_team_id', $res->away_id)->value('ss_team_name');
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
$set('team_position', 'all');
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->placeholder('Select Team');
|
||||
}
|
||||
|
||||
private function selectTeamPosition(): Select
|
||||
{
|
||||
return Select::make('team_position')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->placeholder('Select Team Position')
|
||||
->prefix('TP')
|
||||
->prefixAction(
|
||||
Action::make('iconInfo')
|
||||
->color('success')
|
||||
->icon('phosphor-question')
|
||||
->tooltip(fn () => 'Team Position')
|
||||
)
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->default('all')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'all' => 'All',
|
||||
'home' => 'Home',
|
||||
'away' => 'Away',
|
||||
])->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
});
|
||||
}
|
||||
|
||||
private function selectStatisticType(): Select
|
||||
{
|
||||
return Select::make('statistic_type')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->allowHtml()
|
||||
->placeholder('Statistic Type')
|
||||
->prefixIconColor('success')
|
||||
->prefixIcon(function (Get $get) {
|
||||
return match ($get('statistic_type')) {
|
||||
'gls' => 'phosphor-soccer-ball',
|
||||
'crn' => 'phosphor-angle',
|
||||
'fls' => 'phosphor-first-aid-kit',
|
||||
'ofs' => 'phosphor-arrow-fat-lines-right',
|
||||
'crd' => 'phosphor-cards',
|
||||
'snt' => 'phosphor-target',
|
||||
'tsh' => 'phosphor-chart-polar',
|
||||
default => 'phosphor-soccer-ball',
|
||||
};
|
||||
})
|
||||
->default('gls')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'gls' => 'Goals',
|
||||
'crn' => 'Corner',
|
||||
'fls' => 'Fouls Commited',
|
||||
'ofs' => 'Offside',
|
||||
'crd' => 'Cards',
|
||||
'snt' => 'Shots On Target',
|
||||
'tsh' => 'Total Shots',
|
||||
]);
|
||||
}
|
||||
|
||||
private function selectSimilarPastMatches(): Select
|
||||
{
|
||||
return Select::make('similar_past_matches')
|
||||
->live()
|
||||
// ->columnSpan(2)
|
||||
->hiddenLabel()
|
||||
->hidden(fn (Get $get) => $get('team_id') != null)
|
||||
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||
->suffixAction(Action::make('reset')
|
||||
->icon('phosphor-x')
|
||||
->tooltip('Clear SMP')
|
||||
->action(fn (callable $set) => $set('similar_past_matches', 'none'))
|
||||
->color('gray'))
|
||||
->placeholder('Similar Past Matches')
|
||||
->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>') : '')
|
||||
->prefix('SPM')
|
||||
->prefixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question')
|
||||
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'danger')
|
||||
->tooltip(fn () => $this->tooltip_similar_past_matches())
|
||||
)
|
||||
->default('none')
|
||||
->selectablePlaceholder(false)
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
$set('team_position', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->options([
|
||||
'none' => 'None',
|
||||
'league' => 'League',
|
||||
'all' => 'All Database',
|
||||
]);
|
||||
}
|
||||
|
||||
private function sliderAccuracy(): Slider
|
||||
{
|
||||
return Slider::make('accuracy')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
|
||||
->fillTrack()
|
||||
->minValue(0)
|
||||
->maxValue(0.25)
|
||||
->default(0.125)
|
||||
->step(0.025)
|
||||
->decimalPlaces(3)
|
||||
->pips()
|
||||
->pipsFormatter(RawJs::make(<<<'JS'
|
||||
`${$value.toFixed(2)}`
|
||||
JS));
|
||||
}
|
||||
|
||||
private function selectPlayerId(): Select
|
||||
{
|
||||
return Select::make('ss_player_id')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->allowHtml()
|
||||
->columnSpan(2)
|
||||
->placeholder('Player')
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '')
|
||||
->prefixIcon('icon-player')
|
||||
->preload()
|
||||
->searchable()
|
||||
->extraAttributes(fn () => [
|
||||
'id' => 'player_selector',
|
||||
'style' => 'width: 100%;',
|
||||
])
|
||||
->suffixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question')
|
||||
->color('success')
|
||||
->tooltip(fn () => $this->tooltip_player_info())
|
||||
)
|
||||
->options(function (Get $get) {
|
||||
$team_id = $get('team_id');
|
||||
$team_position = $get('team_position');
|
||||
$sofascore_category_id = $get('sofascore_category_id');
|
||||
$season = $get('season');
|
||||
$seasonmode = $get('seasonmode');
|
||||
|
||||
return LoadPlayerSelection::load($team_id, $team_position, $sofascore_category_id, $season, $seasonmode);
|
||||
});
|
||||
}
|
||||
|
||||
private function selectPlayerOnField(): Select
|
||||
{
|
||||
return Select::make('player_on_field')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->placeholder('Time on field')
|
||||
->prefixIcon('phosphor-watch')
|
||||
->default('all')
|
||||
->visible(fn (Get $get) => $get('ss_player_id'))
|
||||
->prefixIconColor('success')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'all' => 'All',
|
||||
'lineup' => 'Lineup',
|
||||
'substituted' => 'Substituted',
|
||||
'notplayed' => 'Not Played',
|
||||
]);
|
||||
}
|
||||
|
||||
private function radioSeasonOrDate(): Radio
|
||||
{
|
||||
return Radio::make('season_or_date')
|
||||
->live()
|
||||
->extraAttributes([
|
||||
'class' => 'radio-statistic-group',
|
||||
])
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||
->columnSpan(2)
|
||||
->inline()
|
||||
->default('season')
|
||||
->hiddenLabel()
|
||||
->options([
|
||||
'season' => 'Season',
|
||||
'date' => 'Date',
|
||||
]);
|
||||
}
|
||||
|
||||
private function selectSeason(): Select
|
||||
{
|
||||
return Select::make('season')
|
||||
->live()
|
||||
->columnSpan(2)
|
||||
->hiddenLabel()
|
||||
->multiple()
|
||||
->placeholder('Current Season')
|
||||
->prefixIconColor('success')
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->hidden(fn (Get $get) => $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
||||
->prefixIcon('phosphor-calendar-star')
|
||||
->options(function (Get $get) {
|
||||
if ($get('seasonmode') == 'halfyear') {
|
||||
return ['26/27' => '26/27', '25/26' => '25/26', '24/25' => '24/25'];
|
||||
} else {
|
||||
return ['2026' => '2026', '2025' => '2025', '2024' => '2024'];
|
||||
}
|
||||
})
|
||||
->afterStateUpdated(function (callable $set, Get $get) {
|
||||
$set('ss_player_id', null);
|
||||
});
|
||||
}
|
||||
|
||||
private function datePickerStartDate(): DatePicker
|
||||
{
|
||||
return DatePicker::make('start_date')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->columnSpan(2)
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
|
||||
->native(false)
|
||||
->prefixIconColor(fn (Get $get): string => $get('start_date') ? 'success' : 'primary')
|
||||
->prefixIcon('phosphor-calendar')
|
||||
->prefix('Start')
|
||||
->suffixAction(
|
||||
Action::make('clear_start')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->action(fn (Set $set) => $set('start_date', null))
|
||||
);
|
||||
}
|
||||
|
||||
private function datePickerEndDate(): DatePicker
|
||||
{
|
||||
return DatePicker::make('end_date')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->columnSpan(2)
|
||||
->visible(fn (Get $get) => $get('team_id'))
|
||||
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
|
||||
->native(false)
|
||||
->prefixIconColor(fn (Get $get): string => $get('end_date') ? 'success' : 'primary')
|
||||
->prefixIcon('phosphor-calendar')
|
||||
->prefix('End')
|
||||
->suffixAction(
|
||||
Action::make('clear_end')
|
||||
->icon('phosphor-x')
|
||||
->color('gray')
|
||||
->action(fn (Set $set) => $set('end_date', null))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user