This commit is contained in:
salam committed 2026-10-05 19:39:34 +02:00
1 parent 74ff567cce
commit 916fb91895
9 files changed
+503 -346

No files matched your search

+51 -48
View File
@@ -140,10 +140,10 @@ class Statistic extends BaseDashboard
->live()
->preload()
->searchable(false)
->prefixIconColor(fn(Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
->prefixIconColor(fn (Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
->prefixIcon('phosphor-globe')
->hiddenLabel()
->options(fn() => LoadSofaScoreCategory::load())
->options(fn () => LoadSofaScoreCategory::load())
->placeholder('Select Country')
->afterStateUpdated(function (callable $set, $state) {
$set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode'));
@@ -156,10 +156,10 @@ class Statistic extends BaseDashboard
Select::make('league_id')
->live()
->preload()
->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger')
->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger')
->prefixIcon('phosphor-trophy')
->hiddenLabel()
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
->placeholder('Select League')
->afterStateUpdated(function (callable $set) {
$set('match_id', null);
@@ -170,8 +170,8 @@ class Statistic extends BaseDashboard
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')
->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'));
@@ -184,7 +184,7 @@ class Statistic extends BaseDashboard
->placeholder('Select Event'),
Action::make('esc')
->hiddenLabel()
->visible(fn(Get $get) => $get('similar_past_matches') != 'none')
->visible(fn (Get $get) => $get('similar_past_matches') != 'none')
->tooltip('Clear All (esc)')
->icon('phosphor-x-circle')
->color('danger')
@@ -209,9 +209,9 @@ class Statistic extends BaseDashboard
->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')
->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();
@@ -247,9 +247,9 @@ class Statistic extends BaseDashboard
Action::make('iconInfo')
->color('success')
->icon('phosphor-question')
->tooltip(fn() => 'Team Position')
->tooltip(fn () => 'Team Position')
)
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
->default('all')
->selectablePlaceholder(false)
->options([
@@ -296,21 +296,21 @@ class Statistic extends BaseDashboard
->live()
// ->columnSpan(2)
->hiddenLabel()
->hidden(fn(Get $get) => $get('team_id') != null)
->columnSpan(fn(Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
->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'))
->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>') : '')
->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())
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'danger')
->tooltip(fn () => $this->tooltip_similar_past_matches())
)
->default('none')
->selectablePlaceholder(false)
@@ -330,7 +330,7 @@ class Statistic extends BaseDashboard
Slider::make('accuracy')
->live()
->hiddenLabel()
->hidden(fn(Get $get) => $get('similar_past_matches') == 'none')
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
->fillTrack()
->minValue(0)
->maxValue(0.25)
@@ -350,13 +350,13 @@ class Statistic extends BaseDashboard
->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' : '')
->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() => [
->extraAttributes(fn () => [
'id' => 'player_selector',
'style' => 'width: 100%;',
])
@@ -364,7 +364,7 @@ class Statistic extends BaseDashboard
Action::make('iconInfo')
->icon('phosphor-question')
->color('success')
->tooltip(fn() => $this->tooltip_player_info())
->tooltip(fn () => $this->tooltip_player_info())
)
->options(function (Get $get) {
$team_id = $get('team_id');
@@ -381,7 +381,7 @@ class Statistic extends BaseDashboard
->placeholder('Time on field')
->prefixIcon('phosphor-watch')
->default('all')
->hidden(fn(Get $get) => ! $get('ss_player_id'))
->hidden(fn (Get $get) => ! $get('ss_player_id'))
->prefixIconColor('success')
->selectablePlaceholder(false)
->options([
@@ -402,7 +402,7 @@ class Statistic extends BaseDashboard
->extraAttributes([
'class' => 'radio-statistic-group',
])
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
->columnSpan(2)
->inline()
->default('season')
@@ -421,8 +421,8 @@ class Statistic extends BaseDashboard
->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')
->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',
@@ -442,8 +442,8 @@ class Statistic extends BaseDashboard
->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')
->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',
@@ -459,46 +459,46 @@ class Statistic extends BaseDashboard
DatePicker::make('start_date')
->live()
->hiddenLabel()
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
->native(false)
->prefixIconColor(fn(Get $get): string => $get('start_date') ? 'success' : 'primary')
->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))
->action(fn (Set $set) => $set('start_date', null))
),
DatePicker::make('end_date')
->live()
->hiddenLabel()
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
->native(false)
->prefixIconColor(fn(Get $get): string => $get('end_date') ? 'success' : 'primary')
->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))
->action(fn (Set $set) => $set('end_date', null))
),
Actions::make([
Action::make('esc')
->hiddenLabel()
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->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')
->color(fn (Get $get) => $get('sofascore_category_id') ? 'danger' : 'gray')
->keyBindings(['esc'])
->outlined()
->size(Size::Medium)
->action('resetFilters'),
Action::make('copy')
->hiddenLabel()
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->visible(fn(Get $get) => $get('team_id'))
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
->visible(fn (Get $get) => $get('team_id'))
->tooltip('Copy data for pasting into spreadsheet')
->color('success')
->size(Size::Medium)
@@ -521,12 +521,15 @@ class Statistic extends BaseDashboard
]);
}
/**
* Summary of generateDynamicPayload
*/
public function generateDynamicPayload(): string
{
$data = LoadEventsBoxes::load($this->filters, false);
$header = ['Team', 'Event', 'Odd 1', 'Odd X', 'Odd 2', 'Category', 'EXP H', 'EXP A', 'AGV+', 'AGV-', 'AGV Team Season H', 'AGV Team Season A', 'AGV League H', 'AGV League A'];
$copystring = implode(';', $header) . "\n";
$copystring = implode(';', $header)."\n";
$row = [];
$row[] = $data['active_team'];
$row[] = $data['count_events'];
@@ -542,7 +545,7 @@ class Statistic extends BaseDashboard
$row[] = $data['gls_team_season']['away'];
$row[] = $data['gls_liga_season']['home'];
$row[] = $data['gls_liga_season']['away'];
$copystring .= implode(';', $row) . "\n";
$copystring .= implode(';', $row)."\n";
$row = [];
$row = array_fill(0, 5, '');
$row[] = 'Fouls';
@@ -554,7 +557,7 @@ class Statistic extends BaseDashboard
$row[] = $data['fls_team_season']['away'];
$row[] = $data['fls_liga_season']['home'];
$row[] = $data['fls_liga_season']['away'];
$copystring .= implode(';', $row) . "\n";
$copystring .= implode(';', $row)."\n";
$row = [];
$row = array_fill(0, 5, '');
$row[] = 'Offside';
@@ -566,7 +569,7 @@ class Statistic extends BaseDashboard
$row[] = $data['ofs_team_season']['away'];
$row[] = $data['ofs_liga_season']['home'];
$row[] = $data['ofs_liga_season']['away'];
$copystring .= implode(';', $row) . "\n";
$copystring .= implode(';', $row)."\n";
$row = [];
$row = array_fill(0, 5, '');
$row[] = 'Cards';
@@ -578,7 +581,7 @@ class Statistic extends BaseDashboard
$row[] = $data['crd_team_season']['away'];
$row[] = $data['crd_liga_season']['home'];
$row[] = $data['crd_liga_season']['away'];
$copystring .= implode(';', $row) . "\n";
$copystring .= implode(';', $row)."\n";
$row = [];
$row = array_fill(0, 5, '');
$row[] = 'Shots on traget';
@@ -590,7 +593,7 @@ class Statistic extends BaseDashboard
$row[] = $data['snt_team_season']['away'];
$row[] = $data['snt_liga_season']['home'];
$row[] = $data['snt_liga_season']['away'];
$copystring .= implode(';', $row) . "\n";
$copystring .= implode(';', $row)."\n";
$row = [];
$row = array_fill(0, 5, '');
$row[] = 'Total Shots';
@@ -602,7 +605,7 @@ class Statistic extends BaseDashboard
$row[] = $data['tsh_team_season']['away'];
$row[] = $data['tsh_liga_season']['home'];
$row[] = $data['tsh_liga_season']['away'];
$copystring .= implode(';', $row) . "\n";
$copystring .= implode(';', $row)."\n";
return $copystring;
}