wip
This commit is contained in:
1 parent
eb884603d9
commit
0518e9563f
15 files changed
+108
-37
No files matched your search
+35
-35
@@ -2,16 +2,16 @@
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables;
|
||||
|
||||
use Filament\Tables\Table;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class StatistikoPlayersTable
|
||||
@@ -26,40 +26,40 @@ class StatistikoPlayersTable
|
||||
->label('Player')
|
||||
->searchable()
|
||||
->tooltip(fn($record) => $record->details->full_name),
|
||||
TextColumn::make('event.home.name')->searchable()->color('primary'),
|
||||
TextColumn::make('event.away.name')->searchable()->color('success'),
|
||||
TextColumn::make('event.home.ss_team_name')->searchable()->color('primary'),
|
||||
TextColumn::make('event.away.ss_team_name')->searchable()->color('success'),
|
||||
])
|
||||
->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'];
|
||||
// ->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;
|
||||
}
|
||||
// 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';
|
||||
}),
|
||||
// return $query->where('match_id', 0);
|
||||
// }
|
||||
// );
|
||||
// })->indicateUsing(function (array $data): ?string {
|
||||
// if (! $data['find_double']) {
|
||||
// return null;
|
||||
// }
|
||||
// return 'Find Double';
|
||||
// }),
|
||||
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
// ], layout: FiltersLayout::AboveContent)
|
||||
->emptyStateHeading('No player double in an event')
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
|
||||
Reference in new issue
Block a user