wip
This commit is contained in:
1 parent
677f61a415
commit
aa59ad8d9e
1 file changed
+34
-32
@@ -46,26 +46,26 @@ class Statistic extends BaseDashboard
|
|||||||
public function resetFilters(): void
|
public function resetFilters(): void
|
||||||
{
|
{
|
||||||
$filters = array_keys($this->filters);
|
$filters = array_keys($this->filters);
|
||||||
foreach($filters as $filter){
|
foreach ($filters as $filter) {
|
||||||
switch($filter){
|
switch ($filter) {
|
||||||
case 'accuracy':
|
case 'accuracy':
|
||||||
$this->filters[$filter] = 0.125;
|
$this->filters[$filter] = 0.125;
|
||||||
break;
|
break;
|
||||||
case 'similar_past_matches':
|
case 'similar_past_matches':
|
||||||
$this->filters[$filter] = 'none';
|
$this->filters[$filter] = 'none';
|
||||||
break;
|
break;
|
||||||
case 'team_position':
|
case 'team_position':
|
||||||
$this->filters[$filter] = 'all';
|
$this->filters[$filter] = 'all';
|
||||||
break;
|
break;
|
||||||
case 'statistic_type':
|
case 'statistic_type':
|
||||||
$this->filters[$filter] = 'gls';
|
$this->filters[$filter] = 'gls';
|
||||||
break;
|
break;
|
||||||
case 'season_or_date':
|
case 'season_or_date':
|
||||||
$this->filters[$filter] = 'season';
|
$this->filters[$filter] = 'season';
|
||||||
break;
|
break;
|
||||||
default;
|
default;
|
||||||
$this->filters[$filter] = null;
|
$this->filters[$filter] = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ class Statistic extends BaseDashboard
|
|||||||
// '2' => 'icon-icehockey',
|
// '2' => 'icon-icehockey',
|
||||||
// '5' => 'icon-tennisball',
|
// '5' => 'icon-tennisball',
|
||||||
// ]),
|
// ]),
|
||||||
|
|
||||||
Grid::make([
|
Grid::make([
|
||||||
'default' => 1,
|
'default' => 1,
|
||||||
'sm' => 3,
|
'sm' => 3,
|
||||||
@@ -108,10 +108,10 @@ class Statistic extends BaseDashboard
|
|||||||
->live()
|
->live()
|
||||||
->preload()
|
->preload()
|
||||||
->searchable(false)
|
->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-fill')
|
->prefixIcon('phosphor-globe-fill')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->options(fn () => LoadSofaScoreCategory::load())
|
->options(fn() => LoadSofaScoreCategory::load())
|
||||||
->placeholder('Country')
|
->placeholder('Country')
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('league_id', null);
|
$set('league_id', null);
|
||||||
@@ -123,11 +123,11 @@ class Statistic extends BaseDashboard
|
|||||||
Select::make('league_id')
|
Select::make('league_id')
|
||||||
->live()
|
->live()
|
||||||
->preload()
|
->preload()
|
||||||
->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger')
|
->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger')
|
||||||
->prefixIcon('phosphor-trophy-fill')
|
->prefixIcon('phosphor-trophy-fill')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
// ->options(fn(Get $get) => SofaScoreTournament::with('sofascore_category')->where('sofa_score_category_id', $get('sofascore_category_id'))->pluck('name', 'tournament_id'))
|
// ->options(fn(Get $get) => SofaScoreTournament::with('sofascore_category')->where('sofa_score_category_id', $get('sofascore_category_id'))->pluck('name', 'tournament_id'))
|
||||||
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
||||||
->placeholder('League')
|
->placeholder('League')
|
||||||
->afterStateUpdated(function (callable $set, $state) {
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
$set('match_id', null);
|
$set('match_id', null);
|
||||||
@@ -138,7 +138,7 @@ class Statistic extends BaseDashboard
|
|||||||
Select::make('match_id')
|
Select::make('match_id')
|
||||||
->live()
|
->live()
|
||||||
->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-fill')
|
->prefixIcon('phosphor-calendar-check-fill')
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
|
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
|
||||||
@@ -162,7 +162,7 @@ class Statistic extends BaseDashboard
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
->prefixIcon('phosphor-users-three-fill')
|
->prefixIcon('phosphor-users-three-fill')
|
||||||
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
->hidden(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'))->first();
|
$res = StatisticFixtures::where('id', $get('match_id'))->first();
|
||||||
@@ -190,9 +190,9 @@ class Statistic extends BaseDashboard
|
|||||||
Action::make('iconInfo')
|
Action::make('iconInfo')
|
||||||
->color('success')
|
->color('success')
|
||||||
->icon('phosphor-question-fill')
|
->icon('phosphor-question-fill')
|
||||||
->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')
|
->default('all')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->options([
|
->options([
|
||||||
@@ -245,13 +245,13 @@ class Statistic extends BaseDashboard
|
|||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->prefix('SPM')
|
->prefix('SPM')
|
||||||
->placeholder('Similar Past Matches')
|
->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>') : '')
|
||||||
->prefixAction(
|
->prefixAction(
|
||||||
Action::make('iconInfo')
|
Action::make('iconInfo')
|
||||||
->icon('phosphor-question-fill')
|
->icon('phosphor-question-fill')
|
||||||
// ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'primary')
|
// ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'primary')
|
||||||
->color('success')
|
->color('success')
|
||||||
->tooltip(fn () => $this->tooltip_similar_past_matches())
|
->tooltip(fn() => $this->tooltip_similar_past_matches())
|
||||||
)
|
)
|
||||||
->default('none')
|
->default('none')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
@@ -271,7 +271,7 @@ class Statistic extends BaseDashboard
|
|||||||
Slider::make('accuracy')
|
Slider::make('accuracy')
|
||||||
->live()
|
->live()
|
||||||
->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)
|
||||||
@@ -290,17 +290,17 @@ class Statistic extends BaseDashboard
|
|||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->allowHtml()
|
->allowHtml()
|
||||||
->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' ? 'success' : '')
|
->prefixIconColor(fn(Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '')
|
||||||
->prefixIcon('icon-player')
|
->prefixIcon('icon-player')
|
||||||
->preload()
|
->preload()
|
||||||
->searchable()
|
->searchable()
|
||||||
->extraAttributes(fn () => ['id' => 'player_selector'])
|
->extraAttributes(fn() => ['id' => 'player_selector'])
|
||||||
->suffixAction(
|
->suffixAction(
|
||||||
Action::make('iconInfo')
|
Action::make('iconInfo')
|
||||||
->icon('phosphor-question-fill')
|
->icon('phosphor-question-fill')
|
||||||
->color('success')
|
->color('success')
|
||||||
->tooltip(fn () => $this->tooltip_player_info())
|
->tooltip(fn() => $this->tooltip_player_info())
|
||||||
)
|
)
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
return LoadPlayer::load($get);
|
return LoadPlayer::load($get);
|
||||||
@@ -311,7 +311,7 @@ class Statistic extends BaseDashboard
|
|||||||
->placeholder('Time on field')
|
->placeholder('Time on field')
|
||||||
->prefixIcon('phosphor-watch-fill')
|
->prefixIcon('phosphor-watch-fill')
|
||||||
->default('all')
|
->default('all')
|
||||||
->hidden(fn (Get $get) => ! $get('ss_player_id'))
|
->hidden(fn(Get $get) => ! $get('ss_player_id'))
|
||||||
->prefixIconColor('success')
|
->prefixIconColor('success')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->options([
|
->options([
|
||||||
@@ -331,6 +331,7 @@ class Statistic extends BaseDashboard
|
|||||||
->extraAttributes([
|
->extraAttributes([
|
||||||
'class' => 'radio-statistic-group',
|
'class' => 'radio-statistic-group',
|
||||||
])
|
])
|
||||||
|
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->columnSpan([
|
->columnSpan([
|
||||||
'default' => 4,
|
'default' => 4,
|
||||||
'sm' => 4,
|
'sm' => 4,
|
||||||
@@ -351,7 +352,7 @@ class Statistic extends BaseDashboard
|
|||||||
->placeholder('Current Season')
|
->placeholder('Current Season')
|
||||||
->prefixIconColor('success')
|
->prefixIconColor('success')
|
||||||
// ->prefixIconColor(fn(Get $get): string => $get('season') ? 'success' : 'primary')
|
// ->prefixIconColor(fn(Get $get): string => $get('season') ? 'success' : 'primary')
|
||||||
->hidden(fn (Get $get) => $get('season_or_date') == 'date')
|
->hidden(fn(Get $get) => $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
||||||
->prefixIcon('phosphor-calendar-star-fill')
|
->prefixIcon('phosphor-calendar-star-fill')
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
return LoadSeasons::load($get('sofascore_category_id'));
|
return LoadSeasons::load($get('sofascore_category_id'));
|
||||||
@@ -362,32 +363,33 @@ class Statistic extends BaseDashboard
|
|||||||
DatePicker::make('start_date')
|
DatePicker::make('start_date')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
|
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
|
||||||
->native(false)
|
->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-fill')
|
->prefixIcon('phosphor-calendar-fill')
|
||||||
->prefix('Start')
|
->prefix('Start')
|
||||||
->suffixAction(
|
->suffixAction(
|
||||||
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')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
|
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
|
||||||
->native(false)
|
->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-fill')
|
->prefixIcon('phosphor-calendar-fill')
|
||||||
->prefix('End')
|
->prefix('End')
|
||||||
->suffixAction(
|
->suffixAction(
|
||||||
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))
|
||||||
),
|
),
|
||||||
Action::make('esc')
|
Action::make('esc')
|
||||||
|
->label('Reset [esc]')
|
||||||
->icon('phosphor-x-circle')
|
->icon('phosphor-x-circle')
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->keyBindings(['esc'])
|
->keyBindings(['esc'])
|
||||||
|
|||||||
Reference in new issue
Block a user