++ 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
|
public function aggiungiMembri(): void
|
||||||
{
|
{
|
||||||
$ids = array_map('intval', $this->nuoviMembri);
|
$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->esegui(fn () => $this->servizio()->aggiungiMembri($this->gruppo, $ids), count($ids) . ' membri aggiunti.');
|
||||||
$this->nuoviMembri = [];
|
$this->nuoviMembri = [];
|
||||||
}
|
}
|
||||||
@@ -77,6 +82,11 @@ class GruppoShow extends Component
|
|||||||
public function aggiungiTerritori(): void
|
public function aggiungiTerritori(): void
|
||||||
{
|
{
|
||||||
$ids = array_map('intval', $this->nuoviTerritori);
|
$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->esegui(fn () => $this->servizio()->aggiungiAlPacchetto($this->gruppo, $ids), count($ids) . ' territori aggiunti al pacchetto.');
|
||||||
$this->nuoviTerritori = [];
|
$this->nuoviTerritori = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,9 +75,7 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<x-btn variante="primary" wire:click="aggiungiTerritori" :disabled="count($nuoviTerritori) === 0">
|
<x-btn variante="primary" wire:click="aggiungiTerritori">Aggiungi i territori selezionati</x-btn>
|
||||||
Aggiungi {{ count($nuoviTerritori) ?: '' }} al pacchetto
|
|
||||||
</x-btn>
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user