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