diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index 1ec33062..be735f17 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -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])) ]; } diff --git a/resources/views/livewire/player-calculator.blade.php b/resources/views/livewire/player-calculator.blade.php index 17cbe95a..bb43df62 100644 --- a/resources/views/livewire/player-calculator.blade.php +++ b/resources/views/livewire/player-calculator.blade.php @@ -1,98 +1,33 @@ -@php - use Illuminate\Support\HtmlString; - -@endphp {{-- In Tailwind CSS, a value of 24 equals 96 pixels (or 6rem) --}} -
-
-
- - ATTACK - - - MIDFIELD - - - DEFENCE - - - GOALKEEPER - -
-
- - Reset - - - Calculate - - - Copy - -
-
-
- @foreach ($grid as $key => $elements) - @if ($key % 2 == 0) - @foreach ($elements as $name) - @if (isset($name['color'])) - -
{{ $name['position'] }}
-
{{ $name['name'] }}
-
{{ $name['info'] }}
-
- @else -
- @endif - @endforeach - @else - @foreach ($elements as $pos) - @if ($pos) -
-
- {{ $pos }} -
+
+ @foreach ($grid as $key => $elements) + @if ($key % 2 == 0) + @foreach ($elements as $name) + @if (isset($name['color'])) + +
{{ $name['position'] }}
+
{{ $name['name'] }}
+
{{ $name['info'] }}
+
+ @else +
+ @endif + @endforeach + @else + @foreach ($elements as $pos) + @if ($pos) +
+
+ {{ $pos }}
- @else -
- @endif - @endforeach - @endif - @endforeach +
+ @else +
+ @endif + @endforeach + @endif + @endforeach -
- {{--
- - @foreach ($grid as $key => $elements) - @if ($key % 2 == 0) - @foreach ($elements as $name) - @if (isset($name['color'])) - -
{{ $name['position'] }}
-
{{ $name['name'] }}
-
{{ $name['info'] }}
-
- @else -
- @endif - @endforeach - @else - @foreach ($elements as $pos) - @if ($pos) -
-
- {{ $pos }} -
-
- @else -
- @endif - @endforeach - @endif - @endforeach -
--}}