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\Pages\Page;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Livewire\Attributes\On;
class PlayerProps extends Page implements HasForms
@@ -34,7 +36,7 @@ class PlayerProps extends Page implements HasForms
->group(static::getNavigationGroup())
->icon(static::getNavigationIcon())
->activeIcon(static::getActiveNavigationIcon())
->isActiveWhen(fn () => request()->routeIs(static::getRouteName()))
->isActiveWhen(fn() => request()->routeIs(static::getRouteName()))
->sort(static::getNavigationSort())
->url(static::getUrl(), shouldOpenInNewTab: true), // 👈 Forces target="_blank"
];
@@ -85,10 +87,10 @@ class PlayerProps extends Page implements HasForms
->live()
->preload()
->searchable(false)
->prefixIconColor(fn (Get $get): string => $get('cid') ? 'success' : 'danger')
->prefixIconColor(fn(Get $get): string => $get('cid') ? 'success' : 'danger')
->prefixIcon('phosphor-globe-fill')
->hiddenLabel()
->options(fn () => LoadSofaScoreCategory::load())
->options(fn() => LoadSofaScoreCategory::load())
->placeholder('Country')
->afterStateUpdated(function (callable $set, $state) {
$set('lid', null);
@@ -99,10 +101,10 @@ class PlayerProps extends Page implements HasForms
Select::make('lid')
->live()
->preload()
->prefixIconColor(fn (Get $get): string => $get('lid') ? 'success' : 'danger')
->prefixIconColor(fn(Get $get): string => $get('lid') ? 'success' : 'danger')
->prefixIcon('phosphor-trophy-fill')
->hiddenLabel()
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid')))
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid')))
->placeholder('League')
->afterStateUpdated(function (callable $set) {
$set('mid', null);
@@ -112,7 +114,7 @@ class PlayerProps extends Page implements HasForms
Select::make('mid')
->live()
->hiddenLabel()
->prefixIconColor(fn (Get $get): string => $get('mid') ? 'success' : 'danger')
->prefixIconColor(fn(Get $get): string => $get('mid') ? 'success' : 'danger')
->prefixIcon('phosphor-calendar-check-fill')
->options(function (Get $get) {
return LoadStatisticFixturesMatchOptions::load($get('lid'));
@@ -130,7 +132,7 @@ class PlayerProps extends Page implements HasForms
Select::make('tid')
->live()
->hiddenLabel()
->prefixIconColor(fn (Get $get): string => $get('tid') ? 'success' : 'danger')
->prefixIconColor(fn(Get $get): string => $get('tid') ? 'success' : 'danger')
->prefixIcon('icon-player')
->options(function (Get $get) {
if ($get('mid')) {
@@ -145,9 +147,15 @@ class PlayerProps extends Page implements HasForms
return $arr;
}
})
->placeholder('Team')->afterStateUpdated(function ($state) {
->placeholder('Team')
->afterStateUpdated(function ($state, Set $set) {
if ($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')
@@ -163,7 +171,7 @@ class PlayerProps extends Page implements HasForms
$arr = [];
foreach ($res as $key => $value) {
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 {
$arr[$key] = $value;
}