wip
This commit is contained in:
1 parent
eb884603d9
commit
0518e9563f
15 files changed
+108
-37
No files matched your search
+31
@@ -6,7 +6,10 @@ use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlaye
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class ListStatistikoPlayers extends ListRecords
|
||||
{
|
||||
@@ -15,6 +18,34 @@ class ListStatistikoPlayers extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('missing')
|
||||
->modalHeading('Missing Player')
|
||||
->icon('phosphor-magnifying-glass')
|
||||
// ->action(fn(StatistikoPlayer $record) => StatistikoPlayer::doesntHave('details')->get())
|
||||
// ->modalContent(fn($record = StatistikoPlayer::doesntHave('details')->get()): View => view(
|
||||
// 'filament.pages.list-missing-player',
|
||||
// ['record' => $record],
|
||||
// ))
|
||||
// ->action(fn(Contract $record) => $record = StatistikoPlayer::doesntHave('details')->get())
|
||||
// ->action(fn() => StatistikoPlayer::doesntHave('details')->get())
|
||||
// ->modalContent(view('filament.pages.list-missing-player'))
|
||||
// ->modalContent(fn(Contract $record): View => view(
|
||||
// 'filament.pages.list-missing-player',
|
||||
// ['record' => $record],
|
||||
// ))
|
||||
->color('gray'),
|
||||
Action::make('double')
|
||||
->icon('phosphor-magnifying-glass')
|
||||
->color('gray')
|
||||
->schema([
|
||||
TextEntry::make('created_at')
|
||||
->dateTime(),
|
||||
TextEntry::make('updated_at')
|
||||
->dateTime(),
|
||||
])
|
||||
->action(function () {
|
||||
// StatistikoPlayer::truncate();
|
||||
}),
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
|
||||
+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([
|
||||
|
||||
@@ -199,9 +199,12 @@ class LoadEvents
|
||||
$events = [];
|
||||
$results = ['w' => 0, 'd' => 0, 'l' => 0, 'w2' => 0, 'l2' => 0];
|
||||
|
||||
// dd($res);
|
||||
|
||||
foreach ($res as $value) {
|
||||
|
||||
$labels[] = round($value['starttime']->diffInDays(Carbon::now()));
|
||||
|
||||
// $labels[] = $value['starttime']->format('Y-m-d H:i');
|
||||
|
||||
$playing_date[] = $value['starttime']->format('d. F Y H:i');
|
||||
|
||||
Reference in new issue
Block a user