feat(cambi): dialog squadra, scorciatoie dedicate e aggiornamenti README

Dettagli:
- richiesta squadra prima del cambio e tabella a riga singola
- scorciatoie Ctrl+C (home) e Shift+C (guest)
- conferma cambio con validazioni e sostituzione in formazione
- README aggiornato con nuovi shortcut e funzione cambi
This commit is contained in:
2026-01-28 18:27:50 +01:00
parent 44617f2f86
commit 9df74a760f
3 changed files with 62 additions and 55 deletions

View File

@@ -153,6 +153,7 @@ Serve i file dalla cartella `/dist` per testare la build prima del deploy.
| `Ctrl + ↑` | Incrementa punti | | `Ctrl + ↑` | Incrementa punti |
| `Ctrl + ↓` | Decrementa punti | | `Ctrl + ↓` | Decrementa punti |
| `Ctrl + →` | Incrementa set | | `Ctrl + →` | Incrementa set |
| `Ctrl + C` | Apri dialog cambi |
### Controlli Tastiera Squadra Guest ### Controlli Tastiera Squadra Guest
@@ -161,6 +162,7 @@ Serve i file dalla cartella `/dist` per testare la build prima del deploy.
| `Shift + ↑` | Incrementa punti | | `Shift + ↑` | Incrementa punti |
| `Shift + ↓` | Decrementa punti | | `Shift + ↓` | Decrementa punti |
| `Shift + →` | Incrementa set | | `Shift + →` | Incrementa set |
| `Shift + C` | Apri dialog cambi |
### Comandi Globali ### Comandi Globali
@@ -172,7 +174,6 @@ Serve i file dalla cartella `/dist` per testare la build prima del deploy.
| `Ctrl + F` | Attiva/disattiva fullscreen | | `Ctrl + F` | Attiva/disattiva fullscreen |
| `Ctrl + S` | Annuncio vocale punteggio corrente | | `Ctrl + S` | Annuncio vocale punteggio corrente |
| `Ctrl + Z` | Switch tra visualizzazione formazioni e punteggio | | `Ctrl + Z` | Switch tra visualizzazione formazioni e punteggio |
| `Ctrl + C` | Apri dialog cambi |
--- ---

View File

@@ -68,6 +68,13 @@
Ok Ok
</w-button> </w-button>
</w-dialog> </w-dialog>
<w-dialog v-model="diaCambiTeam.show" :width="420" @close="abilitaTastiSpeciali()">
<div class="text-bold text-center mb2">Scegli squadra</div>
<w-flex justify-center class="pa3">
<w-button class="ma2" @click="selezionaTeamCambi('home')">{{ sp.nomi.home }}</w-button>
<w-button class="ma2" @click="selezionaTeamCambi('guest')">{{ sp.nomi.guest }}</w-button>
</w-flex>
</w-dialog>
<w-dialog v-model="diaCambi.show" :width="520" @close="chiudiDialogCambi"> <w-dialog v-model="diaCambi.show" :width="520" @close="chiudiDialogCambi">
<div class="text-bold text-center mb2">CAMBI</div> <div class="text-bold text-center mb2">CAMBI</div>
<table class="cambi-table"> <table class="cambi-table">
@@ -79,12 +86,12 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr v-if="diaCambi.team === 'home'">
<td class="row-label">{{ sp.nomi.home }}</td> <td class="row-label">{{ sp.nomi.home }}</td>
<td><w-input v-model="diaCambi.home.in" type="text" class="cambi-input"></w-input></td> <td><w-input v-model="diaCambi.home.in" type="text" class="cambi-input"></w-input></td>
<td><w-input v-model="diaCambi.home.out" type="text" class="cambi-input"></w-input></td> <td><w-input v-model="diaCambi.home.out" type="text" class="cambi-input"></w-input></td>
</tr> </tr>
<tr> <tr v-if="diaCambi.team === 'guest'">
<td class="row-label">{{ sp.nomi.guest }}</td> <td class="row-label">{{ sp.nomi.guest }}</td>
<td><w-input v-model="diaCambi.guest.in" type="text" class="cambi-input"></w-input></td> <td><w-input v-model="diaCambi.guest.in" type="text" class="cambi-input"></w-input></td>
<td><w-input v-model="diaCambi.guest.out" type="text" class="cambi-input"></w-input></td> <td><w-input v-model="diaCambi.guest.out" type="text" class="cambi-input"></w-input></td>

View File

@@ -13,9 +13,13 @@ export default {
}, },
diaCambi: { diaCambi: {
show: false, show: false,
team: "home",
guest: { in: "", out: "" }, guest: { in: "", out: "" },
home: { in: "", out: "" }, home: { in: "", out: "" },
}, },
diaCambiTeam: {
show: false,
},
visuForm: false, visuForm: false,
visuButt: true, visuButt: true,
visuStriscia: true, visuStriscia: true,
@@ -49,20 +53,11 @@ export default {
return this.sp.punt.home === 0 && this.sp.punt.guest === 0; return this.sp.punt.home === 0 && this.sp.punt.guest === 0;
}, },
cambiConfermabili() { cambiConfermabili() {
const guestIn = (this.diaCambi.guest.in || "").trim(); const team = this.diaCambi.team;
const guestOut = (this.diaCambi.guest.out || "").trim(); const teamIn = (this.diaCambi[team].in || "").trim();
const homeIn = (this.diaCambi.home.in || "").trim(); const teamOut = (this.diaCambi[team].out || "").trim();
const homeOut = (this.diaCambi.home.out || "").trim();
const guestEmpty = !guestIn && !guestOut; return !!teamIn && !!teamOut;
const homeEmpty = !homeIn && !homeOut;
const guestComplete = !!guestIn && !!guestOut;
const homeComplete = !!homeIn && !!homeOut;
const noIncomplete = (guestEmpty || guestComplete) && (homeEmpty || homeComplete);
const atLeastOne = guestComplete || homeComplete;
return noIncomplete && atLeastOne;
} }
}, },
methods: { methods: {
@@ -235,20 +230,30 @@ export default {
this.disabilitaTastiSpeciali(); this.disabilitaTastiSpeciali();
this.diaNomi.show = true; this.diaNomi.show = true;
}, },
resettaCambi() { resettaCambi(team) {
this.diaCambi.guest.in = ""; const teams = team ? [team] : ["home", "guest"];
this.diaCambi.guest.out = ""; teams.forEach((t) => {
this.diaCambi.home.in = ""; this.diaCambi[t].in = "";
this.diaCambi.home.out = ""; this.diaCambi[t].out = "";
});
}, },
apriDialogCambi() { apriDialogCambi() {
this.disabilitaTastiSpeciali(); this.disabilitaTastiSpeciali();
this.resettaCambi(); this.diaCambiTeam.show = true;
},
apriDialogCambiTeam(team) {
this.disabilitaTastiSpeciali();
this.diaCambi.team = team;
this.resettaCambi(team);
this.diaCambi.show = true; this.diaCambi.show = true;
}, },
selezionaTeamCambi(team) {
this.diaCambiTeam.show = false;
this.apriDialogCambiTeam(team);
},
chiudiDialogCambi() { chiudiDialogCambi() {
this.diaCambi.show = false; this.diaCambi.show = false;
this.resettaCambi(); this.resettaCambi(this.diaCambi.team);
this.abilitaTastiSpeciali(); this.abilitaTastiSpeciali();
}, },
confermaCambi() { confermaCambi() {
@@ -256,40 +261,31 @@ export default {
return; return;
} }
const cambi = [ const team = this.diaCambi.team;
{ team: "guest", in: (this.diaCambi.guest.in || "").trim(), out: (this.diaCambi.guest.out || "").trim() }, const cambio = {
{ team: "home", in: (this.diaCambi.home.in || "").trim(), out: (this.diaCambi.home.out || "").trim() }, team,
]; in: (this.diaCambi[team].in || "").trim(),
out: (this.diaCambi[team].out || "").trim(),
};
const cambiDaApplicare = []; const form = this.sp.form[cambio.team].map((val) => String(val).trim());
for (const cambio of cambi) {
if (!cambio.in && !cambio.out) {
continue;
}
const form = this.sp.form[cambio.team].map((val) => String(val).trim()); if (form.includes(cambio.in)) {
this.$waveui.notify(`Numero ${cambio.in} già presente in formazione ${cambio.team}`, "warning");
if (form.includes(cambio.in)) { return;
this.$waveui.notify(`Numero ${cambio.in} già presente in formazione ${cambio.team}`, "warning"); }
return; if (!form.includes(cambio.out)) {
} this.$waveui.notify(`Numero ${cambio.out} non presente in formazione ${cambio.team}`, "warning");
if (!form.includes(cambio.out)) { return;
this.$waveui.notify(`Numero ${cambio.out} non presente in formazione ${cambio.team}`, "warning"); }
return; if (cambio.in === cambio.out) {
} this.$waveui.notify(`Numero IN e OUT uguali per ${cambio.team}`, "warning");
if (cambio.in === cambio.out) { return;
this.$waveui.notify(`Numero IN e OUT uguali per ${cambio.team}`, "warning");
return;
}
cambiDaApplicare.push({ ...cambio });
} }
for (const cambio of cambiDaApplicare) { const idx = this.sp.form[cambio.team].findIndex((val) => String(val).trim() === cambio.out);
const idx = this.sp.form[cambio.team].findIndex((val) => String(val).trim() === cambio.out); if (idx !== -1) {
if (idx !== -1) { this.sp.form[cambio.team].splice(idx, 1, cambio.in);
this.sp.form[cambio.team].splice(idx, 1, cambio.in);
}
} }
this.chiudiDialogCambi(); this.chiudiDialogCambi();
@@ -301,7 +297,7 @@ export default {
window.addEventListener("keydown", this.funzioneTastiSpeciali); window.addEventListener("keydown", this.funzioneTastiSpeciali);
}, },
funzioneTastiSpeciali(e) { funzioneTastiSpeciali(e) {
if (this.diaNomi.show || this.diaCambi.show) { if (this.diaNomi.show || this.diaCambi.show || this.diaCambiTeam.show) {
return; return;
} }
@@ -367,7 +363,10 @@ export default {
this.cambiaPalla() this.cambiaPalla()
handled = true; handled = true;
} else if (e.ctrlKey && (e.key == "c" || e.key == "C")) { } else if (e.ctrlKey && (e.key == "c" || e.key == "C")) {
this.apriDialogCambi() this.apriDialogCambiTeam("home")
handled = true;
} else if (e.shiftKey && (e.key == "c" || e.key == "C")) {
this.apriDialogCambiTeam("guest")
handled = true; handled = true;
} else { return false } } else { return false }