This commit is contained in:
salam committed 2026-09-03 17:26:33 +02:00
1 parent 6b1a68e738
commit dd7617c86f
2 files changed
+37 -70

No files matched your search

+36 -4
View File
@@ -17,6 +17,7 @@ use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Slider;
use Filament\Forms\Components\ToggleButtons;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use Filament\Schemas\Components\Grid;
@@ -88,18 +89,49 @@ class Statistic extends BaseDashboard
->keyBindings(['esc'])
->action('resetFilters'),
Action::make('calculator')
// ->modalHeading('')
->modalSubmitAction(false) // Hides the submit button
->modalCancelAction(false) // Optional: hides the cancel button too
->label('Calculate')
->stickyModalHeader()
->modalHeading('Calculate Player ASG')
->icon('icon-player')
->color(fn(): string => $this->filters['team_id'] ? 'primary' : 'gray')
->disabled(fn(): string => $this->filters['team_id'] ? false : true)
->modalContent(view('filament.modals.player-calculator-modal', ['filters' => $this->filters]))
->slideOver()
->slideOverPosition(SlideOverPosition::Start)
->modalWidth(Width::SevenExtraLarge)
->slideOver()
->schema([
Grid::make(2)
->extraAttributes([
'class' => 'justify-between w-full gap-4'
])
->schema([
ToggleButtons::make('status')
->hiddenLabel()
->multiple()
->inline()
->options([
'attack' => 'Attack',
'midfield' => 'Midfield',
'defence' => 'Defence',
'goalkeeper' => 'Goalkeeper',
]),
Grid::make(3)
->schema([
Action::make('restart')
->color('warning')
->icon('phosphor-arrow-counter-clockwise'),
Action::make('copy')
->color('success')
->icon('phosphor-copy'),
Action::make('calculate')
->icon('phosphor-calculator'),
])
->extraAttributes([
'class' => 'flex justify-start'
])
])
])
->modalContentFooter(view('filament.modals.player-calculator-modal', ['filters' => $this->filters]))
];
}
@@ -1,37 +1,5 @@
@php
use Illuminate\Support\HtmlString;
@endphp
{{-- In Tailwind CSS, a value of 24 equals 96 pixels (or 6rem) --}}
<div class="w-full">
<div class="pb-5 flex flex-row justify-between">
<div class="flex flex-row gap-3">
<x-filament::button wire:click="openNewUserModal" color="gray" size="sm" class="w-24">
ATTACK
</x-filament::button>
<x-filament::button wire:click="openNewUserModal" color="gray" size="sm" class="w-24">
MIDFIELD
</x-filament::button>
<x-filament::button wire:click="openNewUserModal" color="gray" size="sm" class="w-24">
DEFENCE
</x-filament::button>
<x-filament::button wire:click="openNewUserModal" color="gray" size="sm" class="w-24">
GOALKEEPER
</x-filament::button>
</div>
<div class="flex flex-row gap-3">
<x-filament::button wire:click="openNewUserModal" color="gray" icon="phosphor-x-circle">
Reset
</x-filament::button>
<x-filament::button wire:click="openNewUserModal" color="info" icon="phosphor-calculator">
Calculate
</x-filament::button>
<x-filament::button wire:click="openNewUserModal" color="info" icon="phosphor-copy">
Copy
</x-filament::button>
</div>
</div>
<div class="chessboard grid w-258 h-182 grid-cols-10 grid-rows-7 relative gap-2"
<div class="chessboard grid w-258 h-180 grid-cols-10 grid-rows-7 relative gap-2"
style="background-image:url({{ asset('svg/soccerfield.svg') }});">
@foreach ($grid as $key => $elements)
@if ($key % 2 == 0)
@@ -62,37 +30,4 @@
@endif
@endforeach
</div>
{{-- <div class="chessboard grid grid-cols-10 w-240 pr-3 gap-0 bg-no-repeat bg-size-[466px_672px] bg-position-[top_left_476px] overflow-hidden"
style="background-image:url({{ asset('svg/soccerfield.svg') }});">
@foreach ($grid as $key => $elements)
@if ($key % 2 == 0)
@foreach ($elements as $name)
@if (isset($name['color']))
<x-filament::badge color="{{ $name['color'] }}" id="{{ $name['player_id'] }}"
class="piece size-22 m-1 z-20 select-none cursor-grab grid grid-cols-1 gap-3 text-xs">
<div>{{ $name['position'] }}</div>
<div class="font-bold text-wrap">{{ $name['name'] }}</div>
<div class="text-wrap">{{ $name['info'] }}</div>
</x-filament::badge>
@else
<div class="size-22 m-1"></div>
@endif
@endforeach
@else
@foreach ($elements as $pos)
@if ($pos)
<div class="size-22 m-1 bg-white/30 rounded">
<div class="font-black text-3xl text-center text-white/25 p-3">
{{ $pos }}
</div>
</div>
@else
<div class="size-22 m-1"></div>
@endif
@endforeach
@endif
@endforeach
</div> --}}
</div>