This commit is contained in:
salam committed 2026-09-19 21:50:30 +02:00
1 parent 4e460fba49
commit 02fb8801a5
1 file changed
+17 -9
+17 -9
View File
@@ -17,8 +17,10 @@ use Filament\Forms\Contracts\HasForms;
use Filament\Navigation\NavigationItem; use Filament\Navigation\NavigationItem;
use Filament\Pages\Page; use Filament\Pages\Page;
use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Livewire\Attributes\On; use Livewire\Attributes\On;
class PlayerProps extends Page implements HasForms class PlayerProps extends Page implements HasForms
@@ -34,7 +36,7 @@ class PlayerProps extends Page implements HasForms
->group(static::getNavigationGroup()) ->group(static::getNavigationGroup())
->icon(static::getNavigationIcon()) ->icon(static::getNavigationIcon())
->activeIcon(static::getActiveNavigationIcon()) ->activeIcon(static::getActiveNavigationIcon())
->isActiveWhen(fn () => request()->routeIs(static::getRouteName())) ->isActiveWhen(fn() => request()->routeIs(static::getRouteName()))
->sort(static::getNavigationSort()) ->sort(static::getNavigationSort())
->url(static::getUrl(), shouldOpenInNewTab: true), // 👈 Forces target="_blank" ->url(static::getUrl(), shouldOpenInNewTab: true), // 👈 Forces target="_blank"
]; ];
@@ -85,10 +87,10 @@ class PlayerProps extends Page implements HasForms
->live() ->live()
->preload() ->preload()
->searchable(false) ->searchable(false)
->prefixIconColor(fn (Get $get): string => $get('cid') ? 'success' : 'danger') ->prefixIconColor(fn(Get $get): string => $get('cid') ? 'success' : 'danger')
->prefixIcon('phosphor-globe-fill') ->prefixIcon('phosphor-globe-fill')
->hiddenLabel() ->hiddenLabel()
->options(fn () => LoadSofaScoreCategory::load()) ->options(fn() => LoadSofaScoreCategory::load())
->placeholder('Country') ->placeholder('Country')
->afterStateUpdated(function (callable $set, $state) { ->afterStateUpdated(function (callable $set, $state) {
$set('lid', null); $set('lid', null);
@@ -99,10 +101,10 @@ class PlayerProps extends Page implements HasForms
Select::make('lid') Select::make('lid')
->live() ->live()
->preload() ->preload()
->prefixIconColor(fn (Get $get): string => $get('lid') ? 'success' : 'danger') ->prefixIconColor(fn(Get $get): string => $get('lid') ? 'success' : 'danger')
->prefixIcon('phosphor-trophy-fill') ->prefixIcon('phosphor-trophy-fill')
->hiddenLabel() ->hiddenLabel()
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid'))) ->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid')))
->placeholder('League') ->placeholder('League')
->afterStateUpdated(function (callable $set) { ->afterStateUpdated(function (callable $set) {
$set('mid', null); $set('mid', null);
@@ -112,7 +114,7 @@ class PlayerProps extends Page implements HasForms
Select::make('mid') Select::make('mid')
->live() ->live()
->hiddenLabel() ->hiddenLabel()
->prefixIconColor(fn (Get $get): string => $get('mid') ? 'success' : 'danger') ->prefixIconColor(fn(Get $get): string => $get('mid') ? 'success' : 'danger')
->prefixIcon('phosphor-calendar-check-fill') ->prefixIcon('phosphor-calendar-check-fill')
->options(function (Get $get) { ->options(function (Get $get) {
return LoadStatisticFixturesMatchOptions::load($get('lid')); return LoadStatisticFixturesMatchOptions::load($get('lid'));
@@ -130,7 +132,7 @@ class PlayerProps extends Page implements HasForms
Select::make('tid') Select::make('tid')
->live() ->live()
->hiddenLabel() ->hiddenLabel()
->prefixIconColor(fn (Get $get): string => $get('tid') ? 'success' : 'danger') ->prefixIconColor(fn(Get $get): string => $get('tid') ? 'success' : 'danger')
->prefixIcon('icon-player') ->prefixIcon('icon-player')
->options(function (Get $get) { ->options(function (Get $get) {
if ($get('mid')) { if ($get('mid')) {
@@ -145,9 +147,15 @@ class PlayerProps extends Page implements HasForms
return $arr; return $arr;
} }
}) })
->placeholder('Team')->afterStateUpdated(function ($state) { ->placeholder('Team')
->afterStateUpdated(function ($state, Set $set) {
if ($state) { if ($state) {
$this->dispatch('team-update', team_id: $state); $this->dispatch('team-update', team_id: $state);
$tmp = SsLineupMemory::where('client_id', Auth::user()->client_id)->where('team_id', $state)->orderBy('created_at', 'desc')->first();
if ($tmp) {
$set('lineup', $tmp->lineup);
$this->dispatch('lineup-update', activeLineUp: $tmp->lineup);
}
} }
}), }),
Select::make('lineup') Select::make('lineup')
@@ -163,7 +171,7 @@ class PlayerProps extends Page implements HasForms
$arr = []; $arr = [];
foreach ($res as $key => $value) { foreach ($res as $key => $value) {
if ($this->players && in_array($key, $this->clientLineUps)) { if ($this->players && in_array($key, $this->clientLineUps)) {
$arr[$key] = $value.'<span class="text-blue-600"> has lineup</span>'; $arr[$key] = $value . '<span class="text-blue-600"> has lineup</span>';
} else { } else {
$arr[$key] = $value; $arr[$key] = $value;
} }