wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
+88
@@ -0,0 +1,88 @@
|
||||
<?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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user