wip
This commit is contained in:
1 parent
a05637d33d
commit
8bc59b96b3
8 files changed
+266
-236
No files matched your search
@@ -12,13 +12,15 @@ use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||
use Filament\Schemas\Concerns\RestrictsFileUploadsToSchemaComponents;
|
||||
use Filament\Schemas\Contracts\HasSchemas;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\Size;
|
||||
use Filament\Support\Enums\SlideOverPosition;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Tables\Columns\ViewColumn;
|
||||
use Filament\Tables\Concerns\InteractsWithTable;
|
||||
use Filament\Tables\Contracts\HasTable;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
@@ -178,8 +180,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
|
||||
public function getHeadingTable(): HtmlString
|
||||
{
|
||||
return new HtmlString('<div class="text-xl w-full">'.$this->ss_team_name.'</div>
|
||||
<div class="text-[11px] p-0 flex flex-row gap-4 font-bold font-mono" style="position: relative; left: -2px; bottom: -13px;">
|
||||
return new HtmlString('<div class="text-[11px] p-0 flex flex-row gap-4 font-bold font-mono" style="position: relative; left: -2px; bottom: -13px;">
|
||||
<div>Gls</div>
|
||||
<div>Fls</div>
|
||||
<div>Ofs</div>
|
||||
@@ -200,7 +201,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
Select::make('lineup_selected')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->columnSpan(1)
|
||||
->columnSpan(2)
|
||||
->prefix('Lineup')
|
||||
->prefixIcon('icon-soccerplayer')
|
||||
->searchable()
|
||||
@@ -215,17 +216,44 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
{
|
||||
return $table
|
||||
->headerActions([
|
||||
// FilamentView::registerRenderHook(
|
||||
// PanelsRenderHook::GLOBAL_SEARCH_AFTER,
|
||||
// fn (): View => view('filament.modals.position-abbreviation'),
|
||||
// );
|
||||
Action::make('close')
|
||||
->size(Size::Small)
|
||||
->tooltip('Close application')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-x')
|
||||
->close(),
|
||||
Action::make('lineups')
|
||||
->size(Size::Small)
|
||||
->tooltip('Lineup abbreviation explanation')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-question-mark')
|
||||
->slideOver()
|
||||
->slideOverPosition(SlideOverPosition::Start)
|
||||
->modalWidth(Width::ExtraLarge)
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelAction(false)
|
||||
->modalContent(fn () => view('filament.modals.position-abbreviation')),
|
||||
Action::make('reset')
|
||||
->hiddenLabel()
|
||||
->size(Size::Small)
|
||||
->tooltip('Remove all players from field')
|
||||
->icon('phosphor-arrows-clockwise')
|
||||
->action(fn () => $this->clearAll()),
|
||||
Action::make('calculate')
|
||||
->hiddenLabel()
|
||||
->tooltip('Calculate expected values')
|
||||
->size(Size::Small)
|
||||
->icon('phosphor-calculator')
|
||||
->disabled($this->calculationDisabled)
|
||||
->action(fn () => $this->calculateAspg()),
|
||||
Action::make('copy')
|
||||
->tooltip('Copy results for pasting into a spread sheet')
|
||||
->hiddenLabel()
|
||||
->size(Size::Small)
|
||||
->icon('phosphor-copy')
|
||||
->disabled($this->copyDisabled)
|
||||
->action(fn () => $this->copyResult()),
|
||||
@@ -242,17 +270,17 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
ViewColumn::make('drag_card')
|
||||
->columnSpanFull()
|
||||
->label(fn () => $this->getHeadingTable())
|
||||
->view('filament.tables.columns.drag-card')
|
||||
->extraAttributes([
|
||||
// Limits height, forces scrollbar, and switches layout to block to respect max-height
|
||||
'class' => 'max-h-[150px] overflow-y-auto block p-2 bg-gray-50 dark:bg-gray-900 rounded border border-gray-200 dark:border-gray-700',
|
||||
]),
|
||||
->view('filament.tables.columns.drag-card'),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('player_position')
|
||||
SelectFilter::make('position_area')
|
||||
->columnSpanFull()
|
||||
->native(false)
|
||||
->options([
|
||||
// 'attack' => 'Attack',
|
||||
// 'midfield' => 'Midfield',
|
||||
// 'defence' => 'Denfence',
|
||||
// 'goalkeeper' => 'Goalkeeper',
|
||||
'attack' => '<span class="text-amber-500">Attack</span>',
|
||||
'midfield' => '<span class="text-blue-500">Midfield</span>',
|
||||
'defence' => '<span class="text-green-500">Defence</span>',
|
||||
@@ -260,14 +288,17 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
])->modifyFormFieldUsing(fn (Select $component) => $component->allowHtml())
|
||||
->query(function ($query) {
|
||||
return $query;
|
||||
})->indicateUsing(function (array $data): array {
|
||||
// WICHTIG: Ein leeres Array sorgt dafür, dass kein Indicator-Badge erzeugt wird
|
||||
return [];
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->records(function () {
|
||||
$collection = collect($this->sourceRecords);
|
||||
$selectedPosition = $this->tableFilters['player_position']['value'] ?? null;
|
||||
$selectedPosition = $this->tableFilters['position_area']['value'] ?? null;
|
||||
if (! empty($selectedPosition)) {
|
||||
$collection = $collection->where('player_position', $selectedPosition);
|
||||
$collection = $collection->where('position_area', $selectedPosition);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
|
||||
Reference in new issue
Block a user