diff --git a/app/Filament/Pages/PlayerProps.php b/app/Filament/Pages/PlayerProps.php
index 9753896b..4a55c3be 100644
--- a/app/Filament/Pages/PlayerProps.php
+++ b/app/Filament/Pages/PlayerProps.php
@@ -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.' has lineup';
+ $arr[$key] = $value . ' has lineup';
} else {
$arr[$key] = $value;
}