check double upload player event wip
This commit is contained in:
1 parent
9954f47139
commit
fd7b8fadad
7 files changed
+86
-91
No files matched your search
+2
-13
@@ -60,25 +60,14 @@ class StatistikoImportsTable
|
||||
Action::make('import')
|
||||
->label('Import')
|
||||
->color('success')
|
||||
->tooltip('Import is much faster but does no check for doubles')
|
||||
->tooltip('Update or create')
|
||||
->icon('phosphor-database')
|
||||
->action(fn ($record) => StatistikoImporter::run($record, 'import'))
|
||||
->action(fn($record) => StatistikoImporter::run($record))
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->info()
|
||||
->title('Import started')
|
||||
),
|
||||
Action::make('update')
|
||||
->label('Update')
|
||||
->color('info')
|
||||
->tooltip('Compares ervery row in database and takes time')
|
||||
->icon('phosphor-database')
|
||||
->action(fn ($record) => StatistikoImporter::run($record, 'update'))
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->info()
|
||||
->title('Update started')
|
||||
),
|
||||
DeleteAction::make()
|
||||
->successNotificationTitle('File deleted')
|
||||
->label('Delete file'),
|
||||
|
||||
+39
-3
@@ -2,11 +2,16 @@
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables;
|
||||
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
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
|
||||
{
|
||||
@@ -19,15 +24,46 @@ class StatistikoPlayersTable
|
||||
TextColumn::make('details.name')
|
||||
->label('Player')
|
||||
->searchable()
|
||||
->tooltip(fn ($record) => $record->details->full_name),
|
||||
->tooltip(fn($record) => $record->details->full_name),
|
||||
TextColumn::make('tm_player_id')->label('TM Id')->searchable(),
|
||||
TextColumn::make('ss_player_id')->label('SS Id')->searchable(),
|
||||
TextColumn::make('event.home.name')->searchable()->color('primary'),
|
||||
TextColumn::make('event.away.name')->searchable()->color('success'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
Filter::make('event_filters')
|
||||
->schema([
|
||||
Checkbox::make('find_double'),
|
||||
])->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['find_double'],
|
||||
function (Builder $query) use ($data) {
|
||||
$arr = [];
|
||||
// $events = StatistikoPlayer::query()->select('match_id', 'ss_player_id')->get()->toArray();
|
||||
// foreach ($events as $value) {
|
||||
// $match_id = $value['match_id'];
|
||||
// $ss_player_id = $value['ss_player_id'];
|
||||
// if (in_array($ss_player_id, $arr[$value['match_id']]))
|
||||
// $arr[$value['match_id']][] = $value['ss_player_id'];
|
||||
// }
|
||||
// dd($arr);
|
||||
// dd($events);
|
||||
// $doublEvents = array_diff_assoc(
|
||||
// $events,
|
||||
// array_unique($events)
|
||||
// );
|
||||
// $query->whereIn('match_id', $doublEvents)->orderBy('match_id');
|
||||
}
|
||||
);
|
||||
})->indicateUsing(function (array $data): ?string {
|
||||
if (! $data['find_double']) {
|
||||
return null;
|
||||
}
|
||||
return 'Find Double';
|
||||
}),
|
||||
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
|
||||
Reference in new issue
Block a user