add paese, add ora, add personal details
This commit is contained in:
1 parent
422681df01
commit
21bfa6ecc3
9 files changed
+80
-30
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\StatisticFixtures;
|
||||
|
||||
class LoadStatisticFixturesLeaguesOptions
|
||||
{
|
||||
public static function load($sport_id)
|
||||
{
|
||||
$res = StatisticFixtures::where('sport_id', $sport_id)
|
||||
->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;
|
||||
}
|
||||
}
|
||||
+3
-10
@@ -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)
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ class StatistikoImportForm
|
||||
->required()
|
||||
->allowHtml()
|
||||
->options([
|
||||
'player' => '<span class="text-blue-500">Player</span>',
|
||||
'player' => '<span class="text-blue-500">Personal petail player</span>',
|
||||
'events' => '<span class="text-green-500">Events</span>',
|
||||
'fixtures' => '<span class="text-orange-500">Fixtures</span>',
|
||||
'events_player' => '<span class="text-pink-600">Events & Player</span>',
|
||||
'events_player' => '<span class="text-pink-600">Player</span>',
|
||||
]),
|
||||
|
||||
FileUpload::make('file_name')
|
||||
|
||||
+5
-4
@@ -32,10 +32,10 @@ class StatistikoImportsTable
|
||||
->width('2rem')
|
||||
->allowOptionsHtml()
|
||||
->options([
|
||||
'player' => '<span class="text-blue-500">Player</span>',
|
||||
'player' => '<span class="text-blue-500">Personal detail</span>',
|
||||
'events' => '<span class="text-green-500">Events</span>',
|
||||
'fixtures' => '<span class="text-orange-500">Fixtures</span>',
|
||||
'events_player' => '<span class="text-amber-500">Events & Player</span>',
|
||||
'events_player' => '<span class="text-amber-500">Player</span>',
|
||||
]),
|
||||
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)
|
||||
|
||||
+2
-2
@@ -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';
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Grid;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Widgets\Widget;
|
||||
|
||||
class StatisticFilters extends Widget implements HasForms
|
||||
{
|
||||
use InteractsWithForms;
|
||||
|
||||
protected string $view = 'filament.widgets.statistic-filters';
|
||||
|
||||
protected int|string|array $columnSpan = 'full';
|
||||
|
||||
protected static ?int $sort = 1;
|
||||
|
||||
public ?array $data = [];
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('data')
|
||||
->schema([
|
||||
Grid::make()
|
||||
->schema([
|
||||
DatePicker::make('from'),
|
||||
DatePicker::make('to'),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<x-filament-widgets::widget>
|
||||
<x-filament::section>
|
||||
</x-filament::section>
|
||||
</x-filament-widgets::widget>
|
||||
Reference in new issue
Block a user