This commit is contained in:
salam committed 2026-09-05 07:36:26 +02:00
1 parent 2e829b984f
commit c2e0e0b89b
18 files changed
+343 -246

No files matched your search

+36 -34
View File
@@ -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('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">± ' . $get('accuracy') . '</div>') : '')
->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">± '.$get('accuracy').'</div>') : '')
->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))
),
]);
}
+91
View File
@@ -0,0 +1,91 @@
<?php
namespace App\Livewire;
use Livewire\Component;
class BoardDispatcher extends Component
{
public array $lists = [];
public function mount()
{
$this->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');
}
}
+6 -4
View File
@@ -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;
}
}
+19 -8
View File
@@ -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('
<script>
document.addEventListener("alpine:init", () => {
(function(){function l(t){t.directive("sort",(e,{modifiers:d,expression:c},{evaluateLater:p,cleanup:f})=>{let m=p(c),v=d.includes("group")?e.getAttribute("x-sort:group"):"default";e._sortable=new Sortable(e,{group:v,animation:150,onEnd:s=>{let n=s.item.getAttribute("x-sort:item"),a=s.oldIndex,i=s.newIndex,r=s.to.getAttribute("id")||"default";m(()=>{},{scope:{$item:n,$oldIndex:a,$newIndex:i,$owner:r}})}});f(()=>e._sortable.destroy())})}l.inline=l;var u=l;document.addEventListener("DOMContentLoaded",()=>{if(typeof Sortable==="undefined"){let t=document.createElement("script");t.src="https://cloudflare.com";document.head.appendChild(t)}});})();
});
</script>
'),
);
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());
+5 -13
View File
@@ -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([