statistiko events
This commit is contained in:
1 parent
c1b5adb3a4
commit
3d9239737f
29 files changed
+466
-767
No files matched your search
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatistikoEvents extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatistikoEventsResource::class;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatistikoEvents extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatistikoEventsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
use App\Filament\Imports\StatistikoEventImporter;
|
||||
use App\Models\StatistikoEvent;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\ImportAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoEvents extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatistikoEventsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
->color('danger')
|
||||
->action(function () {
|
||||
StatistikoEvent::truncate();
|
||||
}),
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
ImportAction::make('importEvents')
|
||||
->maxRows(200000)
|
||||
->color('success')
|
||||
->chunkSize(250)
|
||||
->icon('phosphor-upload')
|
||||
->label('Import')
|
||||
->modalDescription('Max 20k rows per import, column separator: ";"')
|
||||
->importer(StatistikoEventImporter::class),
|
||||
];
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatistikoEventsForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
DateTimePicker::make('starttime'),
|
||||
TextInput::make('season'),
|
||||
TextInput::make('gls_h'),
|
||||
TextInput::make('gls_a'),
|
||||
TextInput::make('crn_h'),
|
||||
TextInput::make('fls_h'),
|
||||
TextInput::make('ofs_h'),
|
||||
TextInput::make('snt_h'),
|
||||
TextInput::make('tsh_h'),
|
||||
TextInput::make('crd_h'),
|
||||
TextInput::make('crn_a'),
|
||||
TextInput::make('fls_a'),
|
||||
TextInput::make('ofs_a'),
|
||||
TextInput::make('snt_a'),
|
||||
TextInput::make('tsh_a'),
|
||||
TextInput::make('crd_a'),
|
||||
TextInput::make('expgoalshome_value'),
|
||||
TextInput::make('expgoalsaway_value'),
|
||||
TextInput::make('exp_handicap'),
|
||||
TextInput::make('exp_total'),
|
||||
])->columns(4);
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages\ListStatistikoEvents;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Schemas\StatistikoEventsForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables\StatistikoEventsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\StatistikoEvent;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class StatistikoEventsResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatistikoEvent::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerball';
|
||||
|
||||
protected static ?string $navigationLabel = 'Event';
|
||||
|
||||
protected static ?string $modelLabel = 'Events';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return StatistikoEventsForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return StatistikoEventsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListStatistikoEvents::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
|
||||
public static function getNavigationBadgeColor(): ?string
|
||||
{
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class StatistikoEventsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport_id')
|
||||
->label('')
|
||||
->icon(fn (string $state): string => match ($state) {
|
||||
'1' => 'icon-soccerball',
|
||||
}),
|
||||
TextColumn::make('league.name')->searchable(),
|
||||
TextColumn::make('home.name')->searchable(),
|
||||
TextColumn::make('away.name')->searchable(),
|
||||
TextColumn::make('starttime')->dateTime('d. m. Y H:i'),
|
||||
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatistikoPlayer extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatistikoPlayerResource::class;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatistikoPlayers extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatistikoPlayerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||
use App\Filament\Imports\StatistikoPlayerImporter;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\ImportAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoPlayers extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatistikoPlayerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
->color('danger')
|
||||
->action(function () {
|
||||
StatistikoPlayer::truncate();
|
||||
}),
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
ImportAction::make('importPlayer')
|
||||
->maxRows(200000)
|
||||
->color('success')
|
||||
->chunkSize(250)
|
||||
->icon('phosphor-upload')
|
||||
->label('Import')
|
||||
->modalDescription('Max 20k rows per import, column separator ";"')
|
||||
->importer(StatistikoPlayerImporter::class),
|
||||
];
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Schemas;
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class UbPlayerForm
|
||||
class StatistikoPlayerForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
+10
-10
@@ -1,21 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers;
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages\ListUbPlayers;
|
||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\Schemas\UbPlayerForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\Tables\UbPlayersTable;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages\ListStatistikoPlayers;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas\StatistikoPlayerForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables\StatistikoPlayersTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\UbPlayer;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class UbPlayerResource extends Resource
|
||||
class StatistikoPlayerResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UbPlayer::class;
|
||||
protected static ?string $model = StatistikoPlayer::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerplayer';
|
||||
|
||||
@@ -33,18 +33,18 @@ class UbPlayerResource extends Resource
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return UbPlayerForm::configure($schema);
|
||||
return StatistikoPlayerForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return UbPlayersTable::configure($table);
|
||||
return StatistikoPlayersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListUbPlayers::route('/'),
|
||||
'index' => ListStatistikoPlayers::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Tables;
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
@@ -8,7 +8,7 @@ use Filament\Tables\Columns\Layout\Stack;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class UbPlayersTable
|
||||
class StatistikoPlayersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\UbEventResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateUbEvent extends CreateRecord
|
||||
{
|
||||
protected static string $resource = UbEventResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\UbEventResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditUbEvent extends EditRecord
|
||||
{
|
||||
protected static string $resource = UbEventResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\UbEventResource;
|
||||
use App\Filament\Imports\UbEventImporter;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ImportAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListUbEvents extends ListRecords
|
||||
{
|
||||
protected static string $resource = UbEventResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
ImportAction::make('importPlayer')
|
||||
->icon('phosphor-upload')
|
||||
->color('success')
|
||||
->label('Import')
|
||||
->modalIcon('phosphor-file-csv')
|
||||
->modalDescription('Separator ";"')
|
||||
->modalHeading('Import events with player')
|
||||
->importer(UbEventImporter::class)
|
||||
->csvDelimiter(';')
|
||||
->extraModalFooterActions([
|
||||
Action::make('copy')
|
||||
->tooltip('Copy header line')
|
||||
->color('success')
|
||||
->label('Copy')
|
||||
->action(function ($livewire) {
|
||||
$livewire->js('window.navigator.clipboard.writeText("league_id;home_id;away_id;starttime;player_id;home_away;home_ft;away_ft;home_ht;away_ht;Goals;assists;tackles;total_passes;passes_done;total_duels;duels_won;total_ground_duels;ground_duels_won;total_aerial_duels;aerial_duels_won;minutes_played;shots_on_target;shots_off_target;shots_blocked;total_dribble;dribble_done;position;rating;bcm;hw;pw;pm;possession_lost;fouls;was_fouled;offsides;date_acquisition");');
|
||||
|
||||
Notification::make()
|
||||
->title('Header copied successfully')
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class UbEventForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Player Team')
|
||||
->schema([
|
||||
Radio::make('home_away')
|
||||
->hiddenLabel()
|
||||
->options([
|
||||
'H' => 'Home',
|
||||
'A' => 'Away',
|
||||
]),
|
||||
TextInput::make('rating')
|
||||
->numeric()
|
||||
->inputMode('decimal'),
|
||||
])->columns(2),
|
||||
Grid::make([
|
||||
'default' => 2,
|
||||
'md' => 3,
|
||||
'xl' => 5,
|
||||
])
|
||||
->schema([
|
||||
TextInput::make('home_ft'),
|
||||
TextInput::make('away_ft'),
|
||||
TextInput::make('home_ht'),
|
||||
TextInput::make('away_ht'),
|
||||
TextInput::make('goals'),
|
||||
TextInput::make('assists'),
|
||||
TextInput::make('tackles'),
|
||||
TextInput::make('total_passes'),
|
||||
TextInput::make('passes_done'),
|
||||
TextInput::make('total_duels'),
|
||||
TextInput::make('duels_won'),
|
||||
TextInput::make('total_ground_duels'),
|
||||
TextInput::make('ground_duels_won'),
|
||||
TextInput::make('total_aerial_duels'),
|
||||
TextInput::make('aerial_duels_won'),
|
||||
TextInput::make('minutes_played'),
|
||||
TextInput::make('shots_on_target'),
|
||||
TextInput::make('shots_off_target'),
|
||||
TextInput::make('shots_blocked'),
|
||||
TextInput::make('total_dribble'),
|
||||
TextInput::make('dribble_done'),
|
||||
TextInput::make('position'),
|
||||
TextInput::make('bcm'),
|
||||
TextInput::make('hw'),
|
||||
TextInput::make('pw'),
|
||||
TextInput::make('pm'),
|
||||
TextInput::make('possession_lost'),
|
||||
TextInput::make('fouls'),
|
||||
TextInput::make('was_fouled'),
|
||||
TextInput::make('offsides'),
|
||||
]),
|
||||
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
// 'total_passes',
|
||||
// 'passes_done',
|
||||
// 'total_duels',
|
||||
// 'duels_won',
|
||||
// 'total_ground_duels',
|
||||
// 'ground_duels_won',
|
||||
// 'total_aerial_duels',
|
||||
// 'aerial_duels_won',
|
||||
// 'minutes_played',
|
||||
// 'shots_on_target',
|
||||
// 'shots_off_target',
|
||||
// 'shots_blocked',
|
||||
// 'total_dribble',
|
||||
// 'dribble_done',
|
||||
// 'position',
|
||||
// 'rating',
|
||||
// 'bcm',
|
||||
// 'hw',
|
||||
// 'pw',
|
||||
// 'pm',
|
||||
// 'possession_lost',
|
||||
// 'fouls',
|
||||
// 'was_fouled',
|
||||
// 'offsides',
|
||||
// 'date_acquisition',
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Support\Enums\IconPosition;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\Indicator;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class UbEventsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->poll('10sec')
|
||||
->striped()
|
||||
->columns([
|
||||
TextColumn::make('starttime')->dateTime('d. M. Y')->label('Date'),
|
||||
TextColumn::make('league.name')->searchable(),
|
||||
TextColumn::make('home.name')->searchable(),
|
||||
TextColumn::make('away.name')->searchable(),
|
||||
// TextColumn::make('player_id')->searchable(),
|
||||
TextColumn::make('player.name')
|
||||
->searchable()
|
||||
->copyable()
|
||||
->icon('phosphor-copy')
|
||||
->iconPosition(IconPosition::After),
|
||||
TextColumn::make('rating'),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('created_at')
|
||||
->columns(2)->columnSpanFull()
|
||||
->schema([
|
||||
DatePicker::make('from'),
|
||||
DatePicker::make('until'),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['from'],
|
||||
fn (Builder $query, $date): Builder => $query->whereDate('starttime', '>=', $date),
|
||||
)
|
||||
->when(
|
||||
$data['until'],
|
||||
fn (Builder $query, $date): Builder => $query->whereDate('starttime', '<=', $date),
|
||||
);
|
||||
})
|
||||
->indicateUsing(function (array $data): array {
|
||||
$indicators = [];
|
||||
|
||||
if ($data['from'] ?? null) {
|
||||
$indicators[] = Indicator::make('Starttime from '.Carbon::parse($data['from'])->toFormattedDateString())
|
||||
->removeField('from');
|
||||
}
|
||||
|
||||
if ($data['until'] ?? null) {
|
||||
$indicators[] = Indicator::make('Starttime until '.Carbon::parse($data['until'])->toFormattedDateString())
|
||||
->removeField('until');
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\Pages\ListUbEvents;
|
||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\Schemas\UbEventForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\Tables\UbEventsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\UbEvent;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use UnitEnum;
|
||||
|
||||
class UbEventResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UbEvent::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerball';
|
||||
|
||||
protected static ?string $navigationLabel = 'Event & Player';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $modelLabel = 'Events & Players';
|
||||
|
||||
// public static function getPluralModelLabel(): string
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// protected static ?string $recordTitleAttribute = 'league_id';
|
||||
|
||||
public static function getRecordTitle($record): string|null|Htmlable
|
||||
{
|
||||
return ': '.$record->starttime->format('d. M. Y').' - '.$record->league->name.' - '.$record->home->name.' vs '.$record->away->name.' - '.$record->player->name;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return UbEventForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return UbEventsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListUbEvents::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
|
||||
public static function getNavigationBadgeColor(): ?string
|
||||
{
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\UbPlayerResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateUbPlayer extends CreateRecord
|
||||
{
|
||||
protected static string $resource = UbPlayerResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\UbPlayerResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditUbPlayer extends EditRecord
|
||||
{
|
||||
protected static string $resource = UbPlayerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\UbPlayerResource;
|
||||
use App\Filament\Imports\UbPlayerImporter;
|
||||
use App\Models\UbPlayer;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\ImportAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListUbPlayers extends ListRecords
|
||||
{
|
||||
protected static string $resource = UbPlayerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
->color('danger')
|
||||
->action(function () {
|
||||
UbPlayer::truncate();
|
||||
}),
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
ImportAction::make('importPlayer')
|
||||
->maxRows(200000)
|
||||
->color('success')
|
||||
->chunkSize(250)
|
||||
->icon('phosphor-upload')
|
||||
->label('Import')
|
||||
->modalDescription('Max 20k rows per import, separator comma ","')
|
||||
->importer(UbPlayerImporter::class),
|
||||
// ->extraModalFooterActions([
|
||||
// Action::make('copy')
|
||||
// ->tooltip('Copy header line')
|
||||
// ->color('success')
|
||||
// ->label('Copy')
|
||||
// ->action(function ($livewire) {
|
||||
// $livewire->js('window.navigator.clipboard.writeText(\'"id giocatore", "giocatore", "data di nascita", "altezza", "nazionalita", "posizione", "sport radar id", "id squadra tm", "nome completo", "giocatore senza caratteri speciali", "rigorista", "national team id", "data aggiornamento", "league_code", "team_code", "team_name"\');');
|
||||
|
||||
// Notification::make()
|
||||
// ->title('Header copied successfully')
|
||||
// ->success()
|
||||
// ->send();
|
||||
// }),
|
||||
// ]),
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user