wip
This commit is contained in:
1 parent
a05637d33d
commit
8bc59b96b3
8 files changed
+266
-236
No files matched your search
@@ -92,7 +92,6 @@ class Statistic extends BaseDashboard
|
||||
->modalHeading('')
|
||||
->label('Calculate')
|
||||
->icon('icon-player')
|
||||
->color('indigo')
|
||||
->color(fn (): string => $this->filters['team_id'] ? 'primary' : 'gray')
|
||||
->disabled(fn (): string => $this->filters['team_id'] ? false : true)
|
||||
->slideOver()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -89,23 +89,23 @@ class PlayerCalculator extends Component
|
||||
|
||||
if (in_array($val['player_position'], $positions_map['MIDFIELD'])) {
|
||||
$player_position = $val['player_position'];
|
||||
$player_position_field = 'midfield';
|
||||
$position_area = 'midfield';
|
||||
$player_color = 'info';
|
||||
} elseif (in_array($val['player_position'], $positions_map['DEFENCE'])) {
|
||||
$player_position = $val['player_position'];
|
||||
$player_position_field = 'defence';
|
||||
$position_area = 'defence';
|
||||
$player_color = 'success';
|
||||
} elseif (in_array($val['player_position'], $positions_map['ATTACK'])) {
|
||||
$player_position = $val['player_position'];
|
||||
$player_position_field = 'attack';
|
||||
$position_area = 'attack';
|
||||
$player_color = 'warning';
|
||||
} elseif (in_array($val['player_position'], $positions_map['GOALKEEPER'])) {
|
||||
$player_position = $val['player_position'];
|
||||
$player_position_field = 'goalkeeper';
|
||||
$position_area = 'goalkeeper';
|
||||
$player_color = 'gray';
|
||||
} else {
|
||||
$player_position = 'NO SPECIFIC POSITION';
|
||||
$player_position_field = 'non';
|
||||
$position_area = 'non';
|
||||
$player_color = 'danger';
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class PlayerCalculator extends Component
|
||||
'name' => $val['player_name'],
|
||||
'preferred_foot' => $val['preferred_foot'],
|
||||
'player_position' => $player_position,
|
||||
'player_position_field' => $player_position_field,
|
||||
'position_area' => $position_area,
|
||||
'player_color' => $player_color,
|
||||
'timed_color' => $timed_color,
|
||||
'events_played' => $events_played,
|
||||
@@ -144,7 +144,9 @@ class PlayerCalculator extends Component
|
||||
];
|
||||
}
|
||||
|
||||
$sort = array_column($result, 'player_position');
|
||||
$pos = array_column($result, 'player_position');
|
||||
$area = array_column($result, 'position_area');
|
||||
array_multisort($area, SORT_ASC, $pos, SORT_ASC, $result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ use Filament\Support\Facades\FilamentTimezone;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Filament\Tables\View\TablesRenderHook;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
@@ -36,6 +35,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
FilamentTimezone::set('Europe/Vienna');
|
||||
|
||||
/** Alpine Plugin direct */
|
||||
FilamentView::registerRenderHook(
|
||||
'panels::head.end',
|
||||
fn (): HtmlString => new HtmlString('
|
||||
@@ -76,10 +76,10 @@ class AppServiceProvider extends ServiceProvider
|
||||
fn (): string => Blade::render('@livewire(\'top-menu-items\')')
|
||||
);
|
||||
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
|
||||
fn (): View => view('filament.modals.position-abbreviation'),
|
||||
);
|
||||
// FilamentView::registerRenderHook(
|
||||
// PanelsRenderHook::GLOBAL_SEARCH_AFTER,
|
||||
// fn (): View => view('filament.modals.position-abbreviation'),
|
||||
// );
|
||||
|
||||
Carbon::setLocale(app()->getLocale());
|
||||
|
||||
|
||||
Reference in new issue
Block a user