wip del err

This commit is contained in:
salam committed 2026-10-04 15:22:39 +02:00
1 parent 812736ca9a
commit 9bcd4432c6
1210 files changed
-220941

No files matched your search

@@ -1,11 +0,0 @@
<?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;
}
@@ -1,19 +0,0 @@
<?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 EditStatistikoPlayer extends EditRecord
{
protected static string $resource = StatistikoPlayerResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -1,99 +0,0 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
use App\Filament\Exports\PlayerHistoryExporter;
use App\Models\StatistikoPlayer;
use DateTime;
use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Actions\ExportAction;
use Filament\Actions\Exports\Models\Export;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\ListRecords;
class ListStatistikoPlayers extends ListRecords
{
protected static string $resource = StatistikoPlayerResource::class;
protected function getHeaderActions(): array
{
return [
ExportAction::make('download_players')
->columnMapping(false)
->chunkSize(1000)
->exporter(PlayerHistoryExporter::class)
->label('Download')
->fileName(fn(Export $export): string => 'player-history-' . date('d.m.Y-H.i') . "-{$export->getKey()}")
->icon('phosphor-download'),
Action::make('count')
->color('gray')
->tooltip('Count values from selected column')
->icon('phosphor-calculator')
->schema([
Select::make('field')
->options([
'minutes_played' => 'minutes_played',
'card_yellow' => 'card_yellow',
'card_yellowred' => 'card_yellowred',
'card_red' => 'card_red',
])
])
->action(function (array $data): void {
$players = StatistikoPlayer::where('ss_player_id', 1087079)->get();
$res = 0;
foreach ($players as $key => $value) {
$res += $value->card_yellow + $value->card_yellowred;
}
dd($res);
}),
Action::make('starttime')
->color('gray')
->tooltip('Find events with wrong starttime')
->icon('phosphor-magnifying-glass')
->modalSubmitAction(false)
->modalContent(function () {
$players = StatistikoPlayer::where('starttime', '<', new DateTime('-10 years'))->get();
return view('filament.pages.list-player-starttime', ['players' => $players]);
}),
Action::make('missing')
->color('gray')
->modalSubmitAction(false)
->modalHeading('Missing Player')
->tooltip('Element in player but missing in details')
->icon('phosphor-magnifying-glass')
->modalContent(function () {
$players = StatistikoPlayer::doesntHave('details')->groupBy('ss_player_id')->get();
return view('filament.pages.list-missing-player', ['players' => $players]);
}),
Action::make('double')
->modalSubmitAction(false)
->icon('phosphor-magnifying-glass')
->color('gray')
->modalContent(function () {
$arr = [];
$doubles = [];
$events = StatistikoPlayer::query()->select('match_id', 'ss_player_id')->get()->toArray();
foreach ($events as $value) {
$match_id = $value['match_id'];
$player_id = $value['ss_player_id'];
if (isset($arr[$match_id]) && in_array($player_id, $arr[$match_id])) {
$doubles[] = ['match_id' => $match_id, 'player_id' => $player_id];
}
$arr[$match_id][] = $player_id;
}
return view('filament.pages.list-doubles-player', ['doubles' => $doubles]);
}),
Action::make('truncate')
->icon('phosphor-trash')
->requiresConfirmation()
->color('danger')
->action(function () {
StatistikoPlayer::truncate();
}),
CreateAction::make(),
];
}
}
@@ -1,82 +0,0 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Schema;
class StatistikoPlayerForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Grid::make([
'default' => 2,
'xl' => 5,
])->schema([
TextInput::make('sport_id'),
TextInput::make('match_id'),
TextInput::make('ss_player_id'),
TextInput::make('activeteam_id'),
TextInput::make('playersubstitute_id'),
TextInput::make('goals'),
TextInput::make('assists'),
TextInput::make('own_goals'),
TextInput::make('shots_on_target'),
TextInput::make('shots_off_target'),
TextInput::make('shots_blocked'),
TextInput::make('fouls'),
TextInput::make('was_fouled'),
TextInput::make('offsides'),
TextInput::make('possessions_lost'),
TextInput::make('total_tackles'),
TextInput::make('touches'),
TextInput::make('total_cross'),
TextInput::make('cross_done'),
TextInput::make('total_dribbles'),
TextInput::make('dribbles_won'),
TextInput::make('total_ground_duels'),
TextInput::make('total_ground_duels_won'),
TextInput::make('total_aerial_duels'),
TextInput::make('total_duels_aerial_won'),
TextInput::make('total_pass'),
TextInput::make('pass'),
TextInput::make('total_long_balls'),
TextInput::make('long_balls'),
TextInput::make('blocked_shots'),
TextInput::make('clearances'),
TextInput::make('dribbled_past'),
TextInput::make('hit_woodwork'),
TextInput::make('interceptions'),
TextInput::make('key_pass'),
TextInput::make('last_man_tackle'),
TextInput::make('dispossessed'),
TextInput::make('clearance_off_line'),
TextInput::make('bcc'),
TextInput::make('bcm'),
TextInput::make('errors_lead_to_a_goal'),
TextInput::make('errors_lead_to_a_shot'),
TextInput::make('penalty_committed'),
TextInput::make('penalty_miss'),
TextInput::make('penalty_save'),
TextInput::make('penalty_won'),
TextInput::make('saves'),
TextInput::make('saves_from_in_box'),
TextInput::make('total_runs_out'),
TextInput::make('runs_out'),
TextInput::make('punches'),
TextInput::make('good_high_claim'),
TextInput::make('minutes_played'),
TextInput::make('lineup'),
TextInput::make('minute_event_during_the_match'),
TextInput::make('type_event_during_the_match'),
TextInput::make('description_event_during_the_match'),
TextInput::make('subtype_event_during_the_match'),
TextInput::make('player_position'),
TextInput::make('playerrating_value'),
]),
])->columns(1);
}
}
@@ -1,52 +0,0 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers;
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\StatistikoPlayer;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use UnitEnum;
class StatistikoPlayerResource extends Resource
{
protected static ?string $model = StatistikoPlayer::class;
protected static ?string $navigationLabel = 'Player';
protected static ?string $modelLabel = 'Player';
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
protected static ?string $cluster = StaticDataCluster::class;
protected static ?int $navigationSort = 8;
protected static ?string $recordTitleAttribute = 'player.name';
public static function form(Schema $schema): Schema
{
return StatistikoPlayerForm::configure($schema);
}
public static function table(Table $table): Table
{
return StatistikoPlayersTable::configure($table);
}
public static function getPages(): array
{
return [
'index' => ListStatistikoPlayers::route('/'),
];
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->count();
}
}
@@ -1,88 +0,0 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
class StatistikoPlayersTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('match_id')->color('info')->icon('phosphor-copy')->copyable()
->sortable()
->searchable(
query: fn($query, $search) => $query->orWhere('match_id', (int) $search)
),
TextColumn::make('ss_player_id')
->sortable()
->label('Player Id')
->color('success')->icon('phosphor-copy')->copyable()
->searchable(
query: fn($query, $search) => $query->orWhere('ss_player_id', (int) $search)
),
TextColumn::make('details.player_name')->label('Player')->searchable()
->tooltip(fn($record) => $record->details->full_name)
->sortable(
query: fn(Builder $query) => $query->orderBy('details.player_name')
),
TextColumn::make('event.home.ss_team_name')->color('primary')->searchable()
->sortable(
query: fn(Builder $query) => $query->orderBy('event.home.ss_team_name')
),
TextColumn::make('event.away.ss_team_name')->searchable()->color('success')
->sortable(
query: fn(Builder $query) => $query->orderBy('ss_team_name')
),
])
// ->filters([
// Filter::make('player_filters')
// ->schema([
// Checkbox::make('find_double'),
// ])->query(function (Builder $query, array $data): Builder {
// return $query->when(
// $data['find_double'],
// function (Builder $query) {
// $arr = [];
// $events = StatistikoPlayer::query()->select('match_id', 'ss_player_id')->get()->toArray();
// foreach ($events as $value) {
// $match_id = $value['match_id'];
// $player_id = $value['ss_player_id'];
// if (isset($arr[$match_id]) && in_array($player_id, $arr[$match_id])) {
// return $query->where('match_id', $match_id)->where('ss_player_id', $player_id);
// }
// $arr[$match_id][] = $player_id;
// }
// return $query->where('match_id', 0);
// }
// );
// })->indicateUsing(function (array $data): ?string {
// if (! $data['find_double']) {
// return null;
// }
// return 'Find Double';
// }),
// ], layout: FiltersLayout::AboveContent)
->emptyStateHeading('No player double in an event')
->deferFilters(false)
->recordActions([
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}