From c2e0e0b89b4692c7f8358b9a8065a540d4768975 Mon Sep 17 00:00:00 2001 From: salam Date: Sat, 5 Sep 2026 07:36:26 +0200 Subject: [PATCH] wip --- app/Filament/Pages/Statistic.php | 70 ++++----- app/Livewire/BoardDispatcher.php | 91 ++++++++++++ app/Livewire/PlayerCalculator.php | 10 +- app/Providers/AppServiceProvider.php | 27 +++- app/Providers/Filament/AdminPanelProvider.php | 18 +-- composer.lock | 20 +-- package-lock.json | 64 ++------ package.json | 2 +- resources/css/filament/admin/theme.css | 6 +- resources/js/alpine-sort.js | 1 + resources/js/dragndrop-store.js | 44 ------ resources/js/filament-dragula.js | 6 - resources/js/filament-sort.js | 6 + .../modals/player-calculator-modal.blade.php | 1 - .../board-dispatcher-modal-wrapper.blade.php | 4 + .../views/livewire/board-dispatcher.blade.php | 139 ++++++++++++++++++ .../livewire/player-calculator.blade.php | 75 +--------- vite.config.js | 5 +- 18 files changed, 343 insertions(+), 246 deletions(-) create mode 100644 app/Livewire/BoardDispatcher.php create mode 100644 resources/js/alpine-sort.js delete mode 100644 resources/js/dragndrop-store.js delete mode 100644 resources/js/filament-dragula.js create mode 100644 resources/js/filament-sort.js delete mode 100644 resources/views/filament/modals/player-calculator-modal.blade.php create mode 100644 resources/views/livewire/board-dispatcher-modal-wrapper.blade.php create mode 100644 resources/views/livewire/board-dispatcher.blade.php diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index ccf30e21..5301b3e7 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -27,6 +27,7 @@ use Filament\Support\Enums\SlideOverPosition; use Filament\Support\Enums\Width; use Filament\Support\RawJs; use Illuminate\Contracts\Support\Htmlable; +use Illuminate\Contracts\View\View; use Illuminate\Support\HtmlString; class Statistic extends BaseDashboard @@ -87,18 +88,19 @@ class Statistic extends BaseDashboard ->color('gray') ->keyBindings(['esc']) ->action('resetFilters'), - Action::make('calculator') + Action::make('openDispatcherBoard') ->modalHeading('') - ->modalSubmitAction(false) // Hides the submit button - ->modalCancelAction(false) // Optional: hides the cancel button too ->label('Calculate') ->icon('icon-player') - ->color(fn(): string => $this->filters['team_id'] ? 'primary' : 'gray') - ->disabled(fn(): string => $this->filters['team_id'] ? false : true) + ->color('indigo') + ->color(fn (): string => $this->filters['team_id'] ? 'primary' : 'gray') + ->disabled(fn (): string => $this->filters['team_id'] ? false : true) + ->slideOver() ->slideOverPosition(SlideOverPosition::Start) ->modalWidth(Width::SixExtraLarge) - ->slideOver() - ->modalContentFooter(view('filament.modals.player-calculator-modal', ['filters' => $this->filters])), + ->modalSubmitAction(false) + ->modalCancelAction(false) + ->modalContent(fn (): View => view('livewire.board-dispatcher-modal-wrapper', ['filters' => $this->filters])), ]; } @@ -136,10 +138,10 @@ class Statistic extends BaseDashboard ->live() ->preload() ->searchable(false) - ->prefixIconColor(fn(Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger') + ->prefixIconColor(fn (Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger') ->prefixIcon('phosphor-globe-fill') ->hiddenLabel() - ->options(fn() => LoadSofaScoreCategory::load()) + ->options(fn () => LoadSofaScoreCategory::load()) ->placeholder('Country') ->afterStateUpdated(function (callable $set, $state) { $set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode')); @@ -152,10 +154,10 @@ class Statistic extends BaseDashboard Select::make('league_id') ->live() ->preload() - ->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger') + ->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger') ->prefixIcon('phosphor-trophy-fill') ->hiddenLabel() - ->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id'))) + ->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id'))) ->placeholder('League') ->afterStateUpdated(function (callable $set) { $set('match_id', null); @@ -166,7 +168,7 @@ class Statistic extends BaseDashboard Select::make('match_id') ->live() ->hiddenLabel() - ->prefixIconColor(fn(Get $get): string => $get('match_id') ? 'success' : 'danger') + ->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger') ->prefixIcon('phosphor-calendar-check-fill') ->options(function (Get $get) { return LoadStatisticFixturesMatchOptions::load($get('league_id')); @@ -191,7 +193,7 @@ class Statistic extends BaseDashboard } }) ->prefixIcon('phosphor-users-three-fill') - ->hidden(fn(Get $get) => $get('similar_past_matches') != 'none') + ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->options(function (Get $get) { if ($get('match_id')) { $res = StatisticFixtures::where('id', $get('match_id'))->first(); @@ -220,9 +222,9 @@ class Statistic extends BaseDashboard Action::make('iconInfo') ->color('success') ->icon('phosphor-question-fill') - ->tooltip(fn() => 'Team Position') + ->tooltip(fn () => 'Team Position') ) - ->hidden(fn(Get $get) => $get('similar_past_matches') != 'none') + ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->default('all') ->selectablePlaceholder(false) ->options([ @@ -278,17 +280,17 @@ class Statistic extends BaseDashboard ->hiddenLabel() ->suffixAction(Action::make('reset') ->icon('phosphor-x-circle') - ->action(fn(callable $set) => $set('similar_past_matches', 'none')) - ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'info' : 'gray')) + ->action(fn (callable $set) => $set('similar_past_matches', 'none')) + ->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'info' : 'gray')) ->placeholder('Similar Past Matches') - ->suffix(fn(Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('
± ' . $get('accuracy') . '
') : '') + ->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('
± '.$get('accuracy').'
') : '') ->prefix('SPM') ->prefixAction( Action::make('iconInfo') ->icon('phosphor-question-fill') // ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'primary') ->color('success') - ->tooltip(fn() => $this->tooltip_similar_past_matches()) + ->tooltip(fn () => $this->tooltip_similar_past_matches()) ) ->default('none') ->selectablePlaceholder(false) @@ -308,7 +310,7 @@ class Statistic extends BaseDashboard Slider::make('accuracy') ->live() ->hiddenLabel() - ->hidden(fn(Get $get) => $get('similar_past_matches') == 'none') + ->hidden(fn (Get $get) => $get('similar_past_matches') == 'none') ->fillTrack() ->minValue(0) ->maxValue(0.25) @@ -327,17 +329,17 @@ class Statistic extends BaseDashboard ->hiddenLabel() ->allowHtml() ->placeholder('Player') - ->hidden(fn(Get $get) => $get('similar_past_matches') != 'none') - ->prefixIconColor(fn(Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '') + ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') + ->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '') ->prefixIcon('icon-player') ->preload() ->searchable() - ->extraAttributes(fn() => ['id' => 'player_selector']) + ->extraAttributes(fn () => ['id' => 'player_selector']) ->suffixAction( Action::make('iconInfo') ->icon('phosphor-question-fill') ->color('success') - ->tooltip(fn() => $this->tooltip_player_info()) + ->tooltip(fn () => $this->tooltip_player_info()) ) ->options(function (Get $get) { $team_id = $get('team_id'); @@ -354,7 +356,7 @@ class Statistic extends BaseDashboard ->placeholder('Time on field') ->prefixIcon('phosphor-watch-fill') ->default('all') - ->hidden(fn(Get $get) => ! $get('ss_player_id')) + ->hidden(fn (Get $get) => ! $get('ss_player_id')) ->prefixIconColor('success') ->selectablePlaceholder(false) ->options([ @@ -374,7 +376,7 @@ class Statistic extends BaseDashboard ->extraAttributes([ 'class' => 'radio-statistic-group', ]) - ->hidden(fn(Get $get) => $get('similar_past_matches') != 'none') + ->hidden(fn (Get $get) => $get('similar_past_matches') != 'none') ->columnSpan([ 'default' => 4, 'sm' => 4, @@ -398,7 +400,7 @@ class Statistic extends BaseDashboard ->multiple() ->placeholder('Current Season') ->prefixIconColor('success') - ->hidden(fn(Get $get) => $get('seasonmode') == 'halfyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none') + ->hidden(fn (Get $get) => $get('seasonmode') == 'halfyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none') ->prefixIcon('phosphor-calendar-star-fill') ->options([ '2026' => '2026', @@ -418,7 +420,7 @@ class Statistic extends BaseDashboard ->multiple() ->placeholder('Current Season') ->prefixIconColor('success') - ->hidden(fn(Get $get) => $get('seasonmode') == 'fullyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none') + ->hidden(fn (Get $get) => $get('seasonmode') == 'fullyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none') ->prefixIcon('phosphor-calendar-star-fill') ->options([ '26/27' => '26/27', @@ -434,30 +436,30 @@ class Statistic extends BaseDashboard DatePicker::make('start_date') ->live() ->hiddenLabel() - ->hidden(fn(Get $get) => $get('season_or_date') == 'season') + ->hidden(fn (Get $get) => $get('season_or_date') == 'season') ->native(false) - ->prefixIconColor(fn(Get $get): string => $get('start_date') ? 'success' : 'primary') + ->prefixIconColor(fn (Get $get): string => $get('start_date') ? 'success' : 'primary') ->prefixIcon('phosphor-calendar-fill') ->prefix('Start') ->suffixAction( Action::make('clear_start') ->icon('phosphor-x') ->color('gray') - ->action(fn(Set $set) => $set('start_date', null)) + ->action(fn (Set $set) => $set('start_date', null)) ), DatePicker::make('end_date') ->live() ->hiddenLabel() - ->hidden(fn(Get $get) => $get('season_or_date') == 'season') + ->hidden(fn (Get $get) => $get('season_or_date') == 'season') ->native(false) - ->prefixIconColor(fn(Get $get): string => $get('end_date') ? 'success' : 'primary') + ->prefixIconColor(fn (Get $get): string => $get('end_date') ? 'success' : 'primary') ->prefixIcon('phosphor-calendar-fill') ->prefix('End') ->suffixAction( Action::make('clear_end') ->icon('phosphor-x') ->color('gray') - ->action(fn(Set $set) => $set('end_date', null)) + ->action(fn (Set $set) => $set('end_date', null)) ), ]); } diff --git a/app/Livewire/BoardDispatcher.php b/app/Livewire/BoardDispatcher.php new file mode 100644 index 00000000..c753ee09 --- /dev/null +++ b/app/Livewire/BoardDispatcher.php @@ -0,0 +1,91 @@ +lists['source-attack'] = [ + ['id' => '1', 'name' => 'Source Item A', 'origin' => 'source-attack'], + ['id' => '2', 'name' => 'Source Item B', 'origin' => 'source-attack'], + ]; + $this->lists['source-midfield'] = [ + ['id' => '3', 'name' => 'Source Item C', 'origin' => 'source-midfield'], + ]; + $this->lists['source-defence'] = [ + ['id' => '4', 'name' => 'Source Item D', 'origin' => 'source-defence'], + ['id' => '5', 'name' => 'Source Item E', 'origin' => 'source-defence'], + ]; + $this->lists['source-goalkeeper'] = [ + ['id' => '6', 'name' => 'Source Item F', 'origin' => 'source-goalkeeper'], + ]; + + for ($i = 1; $i <= 21; $i++) { + $this->lists["dest-{$i}"] = []; + } + } + + public function moveItem($itemId, $fromList, $toList, $newIndex) + { + $itemId = (string) $itemId; + $newIndex = (int) $newIndex; + + // Abbrechen falls kein Ziel vorhanden ist oder die Position unverändert blieb + if (! $toList || $fromList === $toList) { + return; + } + + $foundItem = null; + + // 1. Element aus der alten Liste entfernen + if (isset($this->lists[$fromList])) { + foreach ($this->lists[$fromList] as $key => $item) { + if ((string) $item['id'] === $itemId) { + $foundItem = $item; + unset($this->lists[$fromList][$key]); + $this->lists[$fromList] = array_values($this->lists[$fromList]); // Array-Keys korrigieren + break; + } + } + } + + // 2. Element in die neue Zielliste am exakten Index einfügen + if ($foundItem && isset($this->lists[$toList])) { + array_splice($this->lists[$toList], $newIndex, 0, [$foundItem]); + } + } + + public function returnToOrigin($itemId, $currentListId) + { + $itemId = (string) $itemId; + + if (! isset($this->lists[$currentListId])) { + return; + } + + $foundItem = null; + + foreach ($this->lists[$currentListId] as $key => $item) { + if ((string) $item['id'] === $itemId) { + $foundItem = $item; + unset($this->lists[$currentListId][$key]); + $this->lists[$currentListId] = array_values($this->lists[$currentListId]); + break; + } + } + + if ($foundItem && isset($this->lists[$foundItem['origin']])) { + array_unshift($this->lists[$foundItem['origin']], $foundItem); + } + } + + public function render() + { + return view('livewire.board-dispatcher'); + } +} diff --git a/app/Livewire/PlayerCalculator.php b/app/Livewire/PlayerCalculator.php index 394641c9..1204165b 100644 --- a/app/Livewire/PlayerCalculator.php +++ b/app/Livewire/PlayerCalculator.php @@ -106,7 +106,7 @@ class PlayerCalculator extends Component $name = $val['player_name']; $preferred_foot = $val['preferred_foot'] ?? '-'; - $everage_minutes = round($minues_played / $events_played) . ' min'; + $everage_minutes = round($minues_played / $events_played).' min'; if ($colorlevel > 1 && $events_played < $colorlevel) { $color = 'danger'; } elseif ($events_played < $colorlevel * 2) { @@ -119,12 +119,14 @@ class PlayerCalculator extends Component 'player_id' => $player_id, 'player_name' => $name, 'position' => $position, - 'position_color' => $position_color, - 'color' => $color, - 'info' => 'Ev ' . $events_played . ', ' . $preferred_foot . ', ' . $everage_minutes, + 'type_color' => $position_color, + 'event_color' => $color, + 'info' => 'Ev '.$events_played.', '.$preferred_foot.', '.$everage_minutes, ]; } + // dd($result); + return $result; } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 2682b7d5..4abace98 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -15,6 +15,7 @@ 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; class AppServiceProvider extends ServiceProvider @@ -35,19 +36,29 @@ class AppServiceProvider extends ServiceProvider FilamentTimezone::set('Europe/Vienna'); + FilamentView::registerRenderHook( + 'panels::head.end', + fn (): HtmlString => new HtmlString(' + + '), + ); + FilamentAsset::register([ - Css::make('font-stylesheet', __DIR__ . '/../../resources/css/font.css'), - Js::make('number-animator', __DIR__ . '/../../resources/js/number-animator.js'), - Js::make('dragndrop', __DIR__ . '/../../resources/js/dragndrop-store.js'), + Css::make('font-stylesheet', __DIR__.'/../../resources/css/font.css'), + Js::make('number-animator', __DIR__.'/../../resources/js/number-animator.js'), ]); FilamentView::registerRenderHook( PanelsRenderHook::USER_MENU_PROFILE_AFTER, - fn(): string => Blade::render('@livewire(\'konto-switcher\')'), + fn (): string => Blade::render('@livewire(\'konto-switcher\')'), ); FilamentView::registerRenderHook( TablesRenderHook::TOOLBAR_SEARCH_BEFORE, - fn(): string => Blade::render('@livewire(\'sport-switcher\')'), + fn (): string => Blade::render('@livewire(\'sport-switcher\')'), scopes: [ ListEvents::class, ] @@ -55,19 +66,19 @@ class AppServiceProvider extends ServiceProvider // PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE, FilamentView::registerRenderHook( TablesRenderHook::TOOLBAR_SEARCH_AFTER, - fn(): string => Blade::render('@livewire(\'bettype-toggle\')'), + fn (): string => Blade::render('@livewire(\'bettype-toggle\')'), scopes: [ ListEvents::class, ] ); FilamentView::registerRenderHook( PanelsRenderHook::GLOBAL_SEARCH_BEFORE, - fn(): string => Blade::render('@livewire(\'top-menu-items\')') + fn (): string => Blade::render('@livewire(\'top-menu-items\')') ); FilamentView::registerRenderHook( PanelsRenderHook::GLOBAL_SEARCH_AFTER, - fn(): View => view('filament.modals.position-abbreviation'), + fn (): View => view('filament.modals.position-abbreviation'), ); Carbon::setLocale(app()->getLocale()); diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index da2e346d..92114ade 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -20,8 +20,6 @@ use Filament\Http\Middleware\DisableBladeIconComponents; use Filament\Http\Middleware\DispatchServingFilamentEvent; use Filament\Panel; use Filament\PanelProvider; -use Filament\Support\Assets\Css; -use Filament\Support\Assets\Js; use Filament\Support\Enums\Width; use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; use Illuminate\Cookie\Middleware\EncryptCookies; @@ -30,7 +28,6 @@ use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Session\Middleware\StartSession; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Vite; use Illuminate\View\Middleware\ShareErrorsFromSession; use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin; use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage; @@ -48,19 +45,14 @@ class AdminPanelProvider extends PanelProvider ->middleware([ RecordUserActivity::class, ]) - ->assets([ - // Point directly to the source files on disk relative to this provider - Css::make('dragula-css', base_path('resources/js/filament-dragula.js')), // Vite extracts CSS imported here - Js::make('filament-dragula', Vite::asset('resources/js/filament-dragula.js'))->module(), - ]) ->userMenuItems([ ExportAction::make('download_betfair') ->columnMapping(false) ->exporter(BetfairExporter::class) ->label('Download Betfair') - ->visible(fn(): bool => auth()->user()->hasRole('download_betfair')) - ->fileName(fn(Export $export): string => 'betfair-odds-' . date('d.m.Y-H.i') . "-{$export->getKey()}") - ->modifyQueryUsing(fn(Builder $query) => $query->whereHas('odds_3ways_bf') + ->visible(fn (): bool => auth()->user()->hasRole('download_betfair')) + ->fileName(fn (Export $export): string => 'betfair-odds-'.date('d.m.Y-H.i')."-{$export->getKey()}") + ->modifyQueryUsing(fn (Builder $query) => $query->whereHas('odds_3ways_bf') ->whereHas('odds_totals_bf') ->where('sport_id', 1)) ->icon('phosphor-download'), @@ -99,8 +91,8 @@ class AdminPanelProvider extends PanelProvider ->sidebarCollapsibleOnDesktop(false) ->userMenuItems([ 'profile' => Action::make('profile') - ->label(fn() => Auth::user()->name) - ->url(fn(): string => EditProfilePage::getUrl()) + ->label(fn () => Auth::user()->name) + ->url(fn (): string => EditProfilePage::getUrl()) ->icon('phosphor-user-circle-fill'), ]) ->pages([ diff --git a/composer.lock b/composer.lock index cb9b75df..26198244 100644 --- a/composer.lock +++ b/composer.lock @@ -4705,24 +4705,24 @@ }, { "name": "mongodb/mongodb", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", - "url": "https://github.com/mongodb/mongo-php-library.git", - "reference": "bbb13f969e37e047fd822527543df55fdc1c9298" + "url": "https://github.com/mongodb/mongo-php-library", + "reference": "12e56461166d915e3dd8e4969ad0940ed5207d88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/bbb13f969e37e047fd822527543df55fdc1c9298", - "reference": "bbb13f969e37e047fd822527543df55fdc1c9298", + "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/12e56461166d915e3dd8e4969ad0940ed5207d88", + "reference": "12e56461166d915e3dd8e4969ad0940ed5207d88", "shasum": "" }, "require": { "composer-runtime-api": "^2.0", - "ext-mongodb": "^2.2", + "ext-mongodb": "^2.3", "php": "^8.1", "psr/log": "^1.1.4|^2|^3", - "symfony/polyfill-php85": "^1.32" + "symfony/polyfill-php85": "^1.33" }, "replace": { "mongodb/builder": "*" @@ -4774,11 +4774,7 @@ "mongodb", "persistence" ], - "support": { - "issues": "https://github.com/mongodb/mongo-php-library/issues", - "source": "https://github.com/mongodb/mongo-php-library/tree/2.2.0" - }, - "time": "2026-02-11T11:39:56+00:00" + "time": "2026-04-28T12:50:06+00:00" }, { "name": "monolog/monolog", diff --git a/package-lock.json b/package-lock.json index 31a9d9f8..fa33b8d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "dragula": "^3.7.3", + "@alpinejs/sort": "^3.17.1", "prettier-plugin-blade": "^3.3.2" }, "devDependencies": { @@ -18,6 +18,15 @@ "vite": "^7.0.4" } }, + "node_modules/@alpinejs/sort": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/@alpinejs/sort/-/sort-3.17.1.tgz", + "integrity": "sha512-Q6qF00WI4cQAZdIxPgbsHnxZIiIv4T1kfSPyEy2QB/SLhLdISuIjzTBa3TQAe1P45BkRtNk5Y8fQuDZuKhN/6w==", + "license": "MIT", + "dependencies": { + "sortablejs": "^1.15.2" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", @@ -1268,12 +1277,6 @@ "dev": true, "license": "MIT" }, - "node_modules/atoa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/atoa/-/atoa-1.0.0.tgz", - "integrity": "sha512-VVE1H6cc4ai+ZXo/CRWoJiHXrA1qfA31DPnx6D20+kSI547hQN5Greh51LQ1baMRMfxO5K5M4ImMtZbZt2DODQ==", - "license": "MIT" - }, "node_modules/axios": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/axios/-/axios-1.20.0.tgz", @@ -1404,31 +1407,6 @@ "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" } }, - "node_modules/contra": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/contra/-/contra-1.9.4.tgz", - "integrity": "sha512-N9ArHAqwR/lhPq4OdIAwH4e1btn6EIZMAz4TazjnzCiVECcWUPTma+dRAM38ERImEJBh8NiCCpjoQruSZ+agYg==", - "license": "MIT", - "dependencies": { - "atoa": "1.0.0", - "ticky": "1.0.1" - } - }, - "node_modules/crossvent": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/crossvent/-/crossvent-1.5.5.tgz", - "integrity": "sha512-MY4xhBYEnVi+pmTpHCOCsCLYczc0PVtGdPBz6NXNXxikLaUZo4HdAeUb1UqAo3t3yXAloSelTmfxJ+/oUqkW5w==", - "license": "MIT", - "dependencies": { - "custom-event": "^1.0.0" - } - }, - "node_modules/custom-event": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", - "integrity": "sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==", - "license": "MIT" - }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -1467,16 +1445,6 @@ "node": ">=8" } }, - "node_modules/dragula": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/dragula/-/dragula-3.7.3.tgz", - "integrity": "sha512-/rRg4zRhcpf81TyDhaHLtXt6sEywdfpv1cRUMeFFy7DuypH2U0WUL0GTdyAQvXegviT4PJK4KuMmOaIDpICseQ==", - "license": "MIT", - "dependencies": { - "contra": "1.9.4", - "crossvent": "1.5.5" - } - }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -2403,6 +2371,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/sortablejs": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.7.tgz", + "integrity": "sha512-Kk8wLQPlS+yi1ZEf48a4+fzHa4yxjC30M/Sr2AnQu+f/MPwvvX9XjZ6OWejiz8crBsLwSq8GHqaxaET7u6ux0A==", + "license": "MIT" + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -2478,12 +2452,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/ticky": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ticky/-/ticky-1.0.1.tgz", - "integrity": "sha512-RX35iq/D+lrsqhcPWIazM9ELkjOe30MSeoBHQHSsRwd1YuhJO5ui1K1/R0r7N3mFvbLBs33idw+eR6j+w6i/DA==", - "license": "MIT" - }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", diff --git a/package.json b/package.json index bffc6114..f9a5063a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "esbuild@0.28.2": true }, "dependencies": { - "dragula": "^3.7.3", + "@alpinejs/sort": "^3.17.1", "prettier-plugin-blade": "^3.3.2" } } diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css index 4448f4f6..188655c2 100644 --- a/resources/css/filament/admin/theme.css +++ b/resources/css/filament/admin/theme.css @@ -274,6 +274,6 @@ less padding in table } /* 3. Sicherstellen, dass die Dropzones Platz für das Element bieten */ -.drag-box { - @apply flex flex-col gap-0 size-24 bg-gray-100/50 border-2 border-dashed border-gray-300 rounded-xl text-xs p-0; -} \ No newline at end of file +/* .drag-box { + @apply flex flex-col gap-0 bg-gray-100/50 border-2 border-dashed border-gray-300 rounded-xl text-xs p-0; +} */ \ No newline at end of file diff --git a/resources/js/alpine-sort.js b/resources/js/alpine-sort.js new file mode 100644 index 00000000..7d915823 --- /dev/null +++ b/resources/js/alpine-sort.js @@ -0,0 +1 @@ +(() => { function l(f) { f.directive("sort", (m, { modifiers: E, expression: I }, { Alpine: g, effect: v, evaluateLater: w }) => { let a = m.closest("[x-data]"); if (!a) return; let x = w(I), o = g.$data(a), [r] = E; v(() => { x(e => { let n = [...o[r]]; if (["asc", "desc"].includes(e)) { let c = e === "asc" ? n.sort((s, t) => s > t ? 1 : -1) : n.sort((s, t) => s < t ? 1 : -1); o[r] = c; return } let [y, ...p] = e.split("."), A = n.sort((c, s) => { let t = p.reduce((i, d) => i[d], c), u = p.reduce((i, d) => i[d], s); return y === "asc" ? t > u ? 1 : -1 : t < u ? 1 : -1 }); o[r] = A }) }) }) } document.addEventListener("alpine:init", () => window.Alpine.plugin(l)); })(); diff --git a/resources/js/dragndrop-store.js b/resources/js/dragndrop-store.js deleted file mode 100644 index 47f19fb6..00000000 --- a/resources/js/dragndrop-store.js +++ /dev/null @@ -1,44 +0,0 @@ -document.addEventListener("alpine:init", () => { - Alpine.store("main", { - attack: true, - midfield: true, - defence: true, - goalkeeper: true, - players: [], - groups: [], - toggleAttack() { - this.attack = !this.attack; - // Loop through them and add Tailwind's invisible class - elements.forEach((el) => el.classList.add("invisible")); - }, - console(index) { - console.log(this.players[index].player_id); - var p = this.players[index].player_id; - }, - loadPlayer(data) { - this.players = data; - }, - setPosGroup(group) { - this.groups = group; - console.log(this.groups, group); - }, - hasVisible(type) { - console.log(type); - return true; - }, - toggleType(toggleStates) { - var toggleState = toggleStates; - // var toggleState = JSON.parse(mode); - // this.visa = toggleState[0].data.status; - // console.log(this.visabilities); - }, - findByPlayerId(player_id) { - const index = this.items.findIndex( - (item) => item.player_id === player_id, - ); - if (index > -1) { - return item; - } - }, - }); -}); diff --git a/resources/js/filament-dragula.js b/resources/js/filament-dragula.js deleted file mode 100644 index dbc7fcf8..00000000 --- a/resources/js/filament-dragula.js +++ /dev/null @@ -1,6 +0,0 @@ -import dragula from "dragula"; -import "dragula/dist/dragula.css"; - -document.addEventListener("alpine:init", () => { - window.dragula = dragula; -}); diff --git a/resources/js/filament-sort.js b/resources/js/filament-sort.js new file mode 100644 index 00000000..ba4ccc3a --- /dev/null +++ b/resources/js/filament-sort.js @@ -0,0 +1,6 @@ +import sort from '@alpinejs/sort'; + +// Intercept the global document event before Filament initializes its engine +document.addEventListener('alpine:init', () => { + window.Alpine.plugin(sort); +}); diff --git a/resources/views/filament/modals/player-calculator-modal.blade.php b/resources/views/filament/modals/player-calculator-modal.blade.php deleted file mode 100644 index 355374b7..00000000 --- a/resources/views/filament/modals/player-calculator-modal.blade.php +++ /dev/null @@ -1 +0,0 @@ -@livewire('player-calculator', ['filters' => $filters]) diff --git a/resources/views/livewire/board-dispatcher-modal-wrapper.blade.php b/resources/views/livewire/board-dispatcher-modal-wrapper.blade.php new file mode 100644 index 00000000..74667d19 --- /dev/null +++ b/resources/views/livewire/board-dispatcher-modal-wrapper.blade.php @@ -0,0 +1,4 @@ +
+ + @livewire('board-dispatcher') +
diff --git a/resources/views/livewire/board-dispatcher.blade.php b/resources/views/livewire/board-dispatcher.blade.php new file mode 100644 index 00000000..37206298 --- /dev/null +++ b/resources/views/livewire/board-dispatcher.blade.php @@ -0,0 +1,139 @@ + +
+ + +
+ +
+ + + + @foreach($lists as $listId => $items) + @if(str_starts_with($listId, 'source-')) + + +
+ {{ ucwords(str_replace('source-', '', $listId)) }} + + + {{ count($items) }} + +
+ +
+ @endif + @endforeach +
+ +
+ +
+
+ + +
+ @foreach($lists as $listId => $items) + @if(str_starts_with($listId, 'source-')) +
+ + +
+ + @foreach($items as $item) +
+ {{ $item['name'] }} + + + +
+ @endforeach +
+
+
+ @endif + @endforeach +
+
+ + +
+
Target Destination Slots (21)
+ +
+ @foreach($lists as $listId => $items) + @if(str_starts_with($listId, 'dest-')) +
+
+ Bay {{ str_replace('dest-', '', $listId) }} + + {{ count($items) }} + +
+ + +
+ + @foreach($items as $item) +
+ + + {{ $item['name'] }} + + +
+ + + + + + +
+
+ @endforeach +
+
+ @endif + @endforeach +
+
+
diff --git a/resources/views/livewire/player-calculator.blade.php b/resources/views/livewire/player-calculator.blade.php index 54508cf4..ac06f5b4 100644 --- a/resources/views/livewire/player-calculator.blade.php +++ b/resources/views/livewire/player-calculator.blade.php @@ -1,71 +1,4 @@ - -
-
- @foreach ($players as $player) - - ⚽️ {{ $player['player_name'] }} - - @endforeach -
- -
-
- {{-- first row --}} -
-
-
-
SW
-
-
-
- {{-- second row --}} -
-
DR
-
-
-
DC
-
-
-
DC
-
-
-
DC
-
-
-
DL
-
-
-
-
Actions
-
+ + + + diff --git a/vite.config.js b/vite.config.js index 86bd4bc8..ac8ff7ed 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,11 +8,14 @@ export default defineConfig({ input: [ "resources/css/app.css", "resources/js/app.js", - "resources/js/filament-dragula.js", + 'resources/js/filament-sort.js', "resources/css/filament/admin/theme.css", ], refresh: true, }), tailwindcss(), ], + define: { + global: 'window', + }, });