This commit is contained in:
salam committed 2026-09-26 08:45:26 +02:00
1 parent d50df325ef
commit 267b5b9583
8 files changed
+237 -193

No files matched your search

+3 -3
View File
@@ -55,7 +55,7 @@ class PlayerProps extends Page implements HasForms
public ?array $filterData;
public array $lineUpOptinos;
public array $lineUpOptions;
public string $activeLineUp = '3313';
@@ -167,7 +167,7 @@ class PlayerProps extends Page implements HasForms
->prefixIconColor('info')
->prefixIcon('icon-soccerfield-fill')
->options(function () {
$res = $this->lineUpOptinos();
$res = $this->lineUpOptions();
$arr = [];
foreach ($res as $key => $value) {
if ($this->players && in_array($key, $this->clientLineUps)) {
@@ -219,7 +219,7 @@ class PlayerProps extends Page implements HasForms
return 5;
}
private function lineUpOptinos(): array
private function lineUpOptions(): array
{
return [
'3313' => '3313',
+53 -45
View File
@@ -19,15 +19,13 @@ use Filament\Forms\Components\Select;
use Filament\Forms\Components\Slider;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use Filament\Schemas\Components\Actions;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set;
// use Filament\Support\Enums\SlideOverPosition;
// use Filament\Support\Enums\Width;
use Filament\Schemas\Schema;
use Filament\Support\RawJs;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\View\View;
use Illuminate\Support\HtmlString;
class Statistic extends BaseDashboard
@@ -139,10 +137,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-fill')
->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'));
@@ -155,10 +153,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-fill')
->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);
@@ -169,8 +167,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-fill')
->options(function (Get $get) {
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
@@ -183,10 +181,10 @@ 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('gray')
->color('warning')
->keyBindings(['esc'])
->action('resetFilters'),
@@ -203,7 +201,7 @@ class Statistic extends BaseDashboard
}
})
->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) {
if ($get('match_id')) {
$res = StatisticFixtures::where('id', $get('match_id'))->first();
@@ -232,9 +230,9 @@ class Statistic extends BaseDashboard
Action::make('iconInfo')
->color('success')
->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')
->selectablePlaceholder(false)
->options([
@@ -289,20 +287,20 @@ class Statistic extends BaseDashboard
->live()
// ->columnSpan(2)
->hiddenLabel()
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
->columnSpan(fn(Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
->suffixAction(Action::make('reset')
->icon('phosphor-x-circle')
->action(fn (callable $set) => $set('similar_past_matches', 'none'))
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'info' : 'gray'))
->action(fn(callable $set) => $set('similar_past_matches', 'none'))
->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'info' : '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-fill')
// ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'primary')
->color('success')
->tooltip(fn () => $this->tooltip_similar_past_matches())
->tooltip(fn() => $this->tooltip_similar_past_matches())
)
->default('none')
->selectablePlaceholder(false)
@@ -322,7 +320,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)
@@ -342,13 +340,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%;',
])
@@ -356,7 +354,7 @@ class Statistic extends BaseDashboard
Action::make('iconInfo')
->icon('phosphor-question-fill')
->color('success')
->tooltip(fn () => $this->tooltip_player_info())
->tooltip(fn() => $this->tooltip_player_info())
)
->options(function (Get $get) {
$team_id = $get('team_id');
@@ -373,7 +371,7 @@ class Statistic extends BaseDashboard
->placeholder('Time on field')
->prefixIcon('phosphor-watch-fill')
->default('all')
->hidden(fn (Get $get) => ! $get('ss_player_id'))
->hidden(fn(Get $get) => ! $get('ss_player_id'))
->prefixIconColor('success')
->selectablePlaceholder(false)
->options([
@@ -394,7 +392,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')
@@ -413,8 +411,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-fill')
->options([
'2026' => '2026',
@@ -434,8 +432,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-fill')
->options([
'26/27' => '26/27',
@@ -451,39 +449,49 @@ 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-fill')
->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-fill')
->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))
),
Action::make('esc')
->hiddenLabel()
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
->tooltip('Clear all (esc)')
->icon('phosphor-x-circle')
->color('gray')
->keyBindings(['esc'])
->action('resetFilters'),
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') ? 'warning' : 'gray')
->keyBindings(['esc'])
->action('resetFilters'),
Action::make('copy')
->hiddenLabel()
->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')
->icon('phosphor-copy')
->action('resetFilters'),
])
]),
]);
}