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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user