diff --git a/app/Filament/Pages/PlayerProps.php b/app/Filament/Pages/PlayerProps.php index e0c67155..46697e44 100644 --- a/app/Filament/Pages/PlayerProps.php +++ b/app/Filament/Pages/PlayerProps.php @@ -97,10 +97,11 @@ class PlayerProps extends Page implements HasForms } #[On('team-update')] - public function syncData() + public function syncData($team_id) { - if ($this->team_id) { - $this->clientLineUps = SsLineupMemory::where('team_id', $this->team_id)->where('client_id', Auth::user()->client_id)->pluck('lineup')->toArray(); + if ($team_id) { + $this->team_id = $team_id; + $this->clientLineUps = SsLineupMemory::where('team_id', $team_id)->where('client_id', Auth::user()->client_id)->pluck('lineup')->toArray(); } else { $this->players = []; $this->dispatch('clear-all'); diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index 5340263e..f61f0365 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -97,6 +97,7 @@ class PlayerPropsDrop extends Widget { $this->team_name = ''; $this->match_id = 0; + $this->team_id = 0; for ($i = 1; $i <= 35; $i++) { $this->boxes[$i] = []; } @@ -124,12 +125,12 @@ class PlayerPropsDrop extends Widget { $this->team_id = $team_id; - $this->syncData(); + $this->syncData($team_id); } - public function syncData() + public function syncData(int $team_id) { - if ($this->team_id) { + if ($team_id) { $this->players = []; $positions_map = LoadPositions::load(); @@ -503,6 +504,10 @@ class PlayerPropsDrop extends Widget return; } + if (! $this->team_id && ! $this->match_id) { + return; + } + // Log::info($this->team_id, ['calculateAspg']); // Calcolare Aspettativa Team per GOALS // (il valore che appare quando viene selezionato un Evento): nell' esempio,