when SPM != non $set('team_position', null);

This commit is contained in:
salam committed 2026-06-15 10:13:12 +02:00
1 parent f4f524646a
commit 0ebc3b3f4e
2 files changed
+16 -26

No files matched your search

+15 -15
View File
@@ -66,10 +66,10 @@ class Statistic extends BaseDashboard
->schema([
Select::make('league_id')
// ->prefixIconColor('primary')
->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 () => LoadStatisticFixturesLeaguesOptions::load(1))
->options(fn() => LoadStatisticFixturesLeaguesOptions::load(1))
->live()
->placeholder('League')
->afterStateUpdated(function (callable $set, $state) {
@@ -79,7 +79,7 @@ class Statistic extends BaseDashboard
}),
Select::make('match_id')
->hiddenLabel()
->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger')
->prefixIconColor(fn(Get $get): string => $get('match_id') ? 'success' : 'danger')
->prefixIcon('phosphor-calendar-check')
->options(function (Get $get) {
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
@@ -105,7 +105,7 @@ class Statistic extends BaseDashboard
// ->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')
->disabled(fn(Get $get) => $get('similar_past_matches') != 'none')
->options(function (Get $get) {
if ($get('match_id')) {
$res = StatisticFixtures::where('id', $get('match_id'))->get();
@@ -130,7 +130,7 @@ class Statistic extends BaseDashboard
->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')
->disabled(fn(Get $get) => $get('similar_past_matches') != 'none')
->default('all')
->selectablePlaceholder(false)
->options([
@@ -150,7 +150,7 @@ class Statistic extends BaseDashboard
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')
->hiddenLabel()
@@ -163,7 +163,7 @@ class Statistic extends BaseDashboard
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))
),
Select::make('statistic_type')
->hiddenLabel()
@@ -185,7 +185,7 @@ class Statistic extends BaseDashboard
->hiddenLabel()
->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>') : '')
->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,
@@ -193,7 +193,7 @@ class Statistic extends BaseDashboard
->prefixAction(
Action::make('iconInfo')
->icon('phosphor-question')
->tooltip(fn () => $this->tooltip_similar_past_matches())
->tooltip(fn() => $this->tooltip_similar_past_matches())
)
->default('none')
->live()
@@ -201,6 +201,7 @@ class Statistic extends BaseDashboard
->afterStateUpdated(function (callable $set) {
$set('team_id', null);
$set('tm_player_id', null);
$set('team_position', null);
})
->options([
'none' => 'Similar Past Matches: None',
@@ -210,7 +211,7 @@ class Statistic extends BaseDashboard
Slider::make('accuracy')
// ->label('Accuracy min: 0, max: 0.25, steps: 0.025')
->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)
@@ -230,8 +231,8 @@ class Statistic extends BaseDashboard
Select::make('tm_player_id')
->hiddenLabel()
->placeholder('Player')
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
->prefixIconColor(fn(Get $get): string => $get('similar_past_matches') == 'none' ? 'primary' : '')
->prefixIcon('icon-player')
->suffixAction(
Action::make('copyCostToPrice')
@@ -252,8 +253,8 @@ class Statistic extends BaseDashboard
->placeholder('Time on field')
->prefixIcon('phosphor-watch')
->default('all')
->hidden(fn (Get $get) => ! $get('tm_player_id') or $get('similar_past_matches') != 'none')
->prefixIconColor(fn (Get $get): string => ($get('tm_player_id') and $get('similar_past_matches') == 'none') ? 'primary' : '')
->hidden(fn(Get $get) => ! $get('tm_player_id') or $get('similar_past_matches') != 'none')
->prefixIconColor(fn(Get $get): string => ($get('tm_player_id') and $get('similar_past_matches') == 'none') ? 'primary' : '')
->selectablePlaceholder(false)
->options([
'all' => 'All',
@@ -277,6 +278,5 @@ class Statistic extends BaseDashboard
$str .= '</div>';
return new HtmlString($str);
}
}
+1 -11
View File
@@ -418,7 +418,7 @@ class LoadEvents
'away_team' => $away_team,
'similar_past_matches' => $similar_past_matches,
];
if ($dataset_exp_home) {
if ($statistic_type == 'gls') {
$data['datasets'][] = [
'label' => 'Goals ' . $label1,
'events' => $events,
@@ -430,11 +430,6 @@ class LoadEvents
'backgroundColor' => '#00c950',
'pointStyle' => $hasdots,
'hidden' => true,
'fill' => [
'target' => 1,
'above' => '#fb2c3680',
'below' => '#fdc70080',
],
];
$data['datasets'][] = [
'label' => 'Goals ' . $label2,
@@ -447,11 +442,6 @@ class LoadEvents
'backgroundColor' => '#2b7fff',
'pointStyle' => $hasdots,
'hidden' => true,
'fill' => [
'target' => 1,
'above' => '#fb2c3680',
'below' => '#fdc70080',
],
];
}