diff --git a/app/Livewire/Gruppi/GruppoShow.php b/app/Livewire/Gruppi/GruppoShow.php index 2b155ae..bf7dc45 100644 --- a/app/Livewire/Gruppi/GruppoShow.php +++ b/app/Livewire/Gruppi/GruppoShow.php @@ -64,6 +64,11 @@ class GruppoShow extends Component public function aggiungiMembri(): void { $ids = array_map('intval', $this->nuoviMembri); + if ($ids === []) { + $this->avvisaErrore('Spunta almeno un proclamatore.'); + + return; + } $this->esegui(fn () => $this->servizio()->aggiungiMembri($this->gruppo, $ids), count($ids) . ' membri aggiunti.'); $this->nuoviMembri = []; } @@ -77,6 +82,11 @@ class GruppoShow extends Component public function aggiungiTerritori(): void { $ids = array_map('intval', $this->nuoviTerritori); + if ($ids === []) { + $this->avvisaErrore('Spunta almeno un territorio.'); + + return; + } $this->esegui(fn () => $this->servizio()->aggiungiAlPacchetto($this->gruppo, $ids), count($ids) . ' territori aggiunti al pacchetto.'); $this->nuoviTerritori = []; } diff --git a/resources/views/livewire/gruppi/gruppo-show.blade.php b/resources/views/livewire/gruppi/gruppo-show.blade.php index bb3c30a..245b6ec 100644 --- a/resources/views/livewire/gruppi/gruppo-show.blade.php +++ b/resources/views/livewire/gruppi/gruppo-show.blade.php @@ -75,9 +75,7 @@ @endforeach