++ gruppo: i pulsanti per aggiungere territori e membri non restano disabilitati
Il conteggio delle spunte arrivava al server solo al clic: il pulsante restava disabilitato. Ora e' sempre attivo e senza spunte avvisa. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 = [];
|
||||
}
|
||||
|
||||
@@ -75,9 +75,7 @@
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<x-btn variante="primary" wire:click="aggiungiTerritori" :disabled="count($nuoviTerritori) === 0">
|
||||
Aggiungi {{ count($nuoviTerritori) ?: '' }} al pacchetto
|
||||
</x-btn>
|
||||
<x-btn variante="primary" wire:click="aggiungiTerritori">Aggiungi i territori selezionati</x-btn>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user