From 21bfa6ecc37bb059e7c652aff981be86d9c85b06 Mon Sep 17 00:00:00 2001 From: salam Date: Tue, 28 Apr 2026 18:11:25 +0200 Subject: [PATCH] add paese, add ora, add personal details --- .../LoadStatisticFixturesLeaguesOptions.php | 26 ++++++++++++++ .../Tables/StatisticFixturesTable.php | 13 ++----- .../Schemas/StatistikoImportForm.php | 4 +-- .../Tables/StatistikoImportsTable.php | 9 ++--- .../StatistikoPlayerResource.php | 4 +-- app/Filament/Pages/Statistic.php | 9 ++--- app/Filament/Widgets/StatisticFilters.php | 36 +++++++++++++++++++ app/Models/CompetitionGroup.php | 5 --- .../widgets/statistic-filters.blade.php | 4 +++ 9 files changed, 80 insertions(+), 30 deletions(-) create mode 100644 app/Actions/LoadStatisticFixturesLeaguesOptions.php create mode 100644 app/Filament/Widgets/StatisticFilters.php create mode 100644 resources/views/filament/widgets/statistic-filters.blade.php diff --git a/app/Actions/LoadStatisticFixturesLeaguesOptions.php b/app/Actions/LoadStatisticFixturesLeaguesOptions.php new file mode 100644 index 00000000..6ca58aba --- /dev/null +++ b/app/Actions/LoadStatisticFixturesLeaguesOptions.php @@ -0,0 +1,26 @@ +groupBy('league_id') + ->pluck('league_id')->toArray(); + + $cnt = CompetitionGroup::with('country')->whereIn('id', $res)->get(); + $arr = []; + foreach ($cnt as $val) { + $arr[$val->id] = $val->country->name.' '.$val->name; + } + + asort($arr); + + return $arr; + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php b/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php index d021905f..456357c7 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php @@ -2,8 +2,7 @@ namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Tables; -use App\Models\CompetitionGroup; -use App\Models\StatisticFixtures; +use App\Actions\LoadStatisticFixturesLeaguesOptions; use Filament\Actions\BulkActionGroup; use Filament\Actions\DeleteAction; use Filament\Actions\DeleteBulkAction; @@ -34,7 +33,7 @@ class StatisticFixturesTable ->wrap() ->hidden(fn () => auth()->user()->sport_id == 5) ->description(fn ($record) => ucwords($record->league?->country->name)), - TextColumn::make('starttime')->dateTime('M j, Y')->label('Date'), + TextColumn::make('starttime')->dateTime('M j, Y h:i')->label('Date'), TextColumn::make('home.name')->color('primary')->searchable(), TextColumn::make('away.name')->color('success')->searchable(), // TextColumn::make('exp_home')->alignCenter()->numeric(), @@ -43,13 +42,7 @@ class StatisticFixturesTable ]) ->filters([ SelectFilter::make('league_id') - ->options(function () { - $res = StatisticFixtures::where('sport_id', 1) - ->groupBy('league_id') - ->pluck('league_id')->toArray(); - - return CompetitionGroup::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id'); - }) + ->options(fn () => LoadStatisticFixturesLeaguesOptions::load(1)) ->preload() ->searchable() ->columnSpan(2) diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php index a01ad695..e3a9c29f 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php @@ -22,10 +22,10 @@ class StatistikoImportForm ->required() ->allowHtml() ->options([ - 'player' => 'Player', + 'player' => 'Personal petail player', 'events' => 'Events', 'fixtures' => 'Fixtures', - 'events_player' => 'Events & Player', + 'events_player' => 'Player', ]), FileUpload::make('file_name') diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php index 75f48f16..55ad1a4a 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php @@ -32,10 +32,10 @@ class StatistikoImportsTable ->width('2rem') ->allowOptionsHtml() ->options([ - 'player' => 'Player', + 'player' => 'Personal detail', 'events' => 'Events', 'fixtures' => 'Fixtures', - 'events_player' => 'Events & Player', + 'events_player' => 'Player', ]), TextColumn::make('file_name_original') ->searchable() @@ -51,9 +51,10 @@ class StatistikoImportsTable ->filters([ SelectFilter::make('data_type') ->options([ - 'player' => 'Player', + 'player' => 'Personal detail', 'events' => 'Events', - 'events_player' => 'Events & Player', + 'fixtures' => 'fixtures', + 'events_player' => 'Player', ]), ]) ->deferFilters(false) diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php index 4aa43324..dc989416 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php @@ -16,9 +16,9 @@ class StatistikoPlayerResource extends Resource { protected static ?string $model = StatistikoPlayer::class; - protected static ?string $navigationLabel = 'Player'; + protected static ?string $navigationLabel = 'Personal Detail'; - protected static ?string $modelLabel = 'Players'; + protected static ?string $modelLabel = 'Personal Detail'; protected static string|UnitEnum|null $navigationGroup = 'Statistiko'; diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index 053f5382..d203afdc 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -2,6 +2,7 @@ namespace App\Filament\Pages; +use App\Actions\LoadStatisticFixturesLeaguesOptions; use App\Models\CompetitionGroup; use App\Models\Element; use App\Models\StatisticFixtures; @@ -33,13 +34,7 @@ class Statistic extends BaseDashboard ->schema([ Select::make('league_id') ->prefixIcon('phosphor-trophy') - ->options(function () { - $res = StatisticFixtures::where('sport_id', 1) - ->groupBy('league_id') - ->pluck('league_id')->toArray(); - - return CompetitionGroup::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id'); - }) + ->options(fn () => LoadStatisticFixturesLeaguesOptions::load(1)) ->preload() ->searchable() ->live() diff --git a/app/Filament/Widgets/StatisticFilters.php b/app/Filament/Widgets/StatisticFilters.php new file mode 100644 index 00000000..248ec25b --- /dev/null +++ b/app/Filament/Widgets/StatisticFilters.php @@ -0,0 +1,36 @@ +statePath('data') + ->schema([ + Grid::make() + ->schema([ + DatePicker::make('from'), + DatePicker::make('to'), + ]), + ]); + } +} diff --git a/app/Models/CompetitionGroup.php b/app/Models/CompetitionGroup.php index 553764d2..133a6f70 100644 --- a/app/Models/CompetitionGroup.php +++ b/app/Models/CompetitionGroup.php @@ -24,11 +24,6 @@ class CompetitionGroup extends Model return $this->belongsTo(Event::class, 'id', 'competition_group_id'); } - public function getFullNameAttribute() - { - return $this->country->name.' '.$this->name; - } - public function sport() { return $this->belongsTo(Sport::class); diff --git a/resources/views/filament/widgets/statistic-filters.blade.php b/resources/views/filament/widgets/statistic-filters.blade.php new file mode 100644 index 00000000..cf8cd367 --- /dev/null +++ b/resources/views/filament/widgets/statistic-filters.blade.php @@ -0,0 +1,4 @@ + + + +