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:
@@ -153,6 +153,7 @@ Serve i file dalla cartella `/dist` per testare la build prima del deploy.
|
||||
| `Ctrl + ↑` | Incrementa punti |
|
||||
| `Ctrl + ↓` | Decrementa punti |
|
||||
| `Ctrl + →` | Incrementa set |
|
||||
| `Ctrl + C` | Apri dialog cambi |
|
||||
|
||||
### 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 + ↓` | Decrementa punti |
|
||||
| `Shift + →` | Incrementa set |
|
||||
| `Shift + C` | Apri dialog cambi |
|
||||
|
||||
### 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 + S` | Annuncio vocale punteggio corrente |
|
||||
| `Ctrl + Z` | Switch tra visualizzazione formazioni e punteggio |
|
||||
| `Ctrl + C` | Apri dialog cambi |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -68,6 +68,13 @@
|
||||
Ok
|
||||
</w-button>
|
||||
</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">
|
||||
<div class="text-bold text-center mb2">CAMBI</div>
|
||||
<table class="cambi-table">
|
||||
@@ -79,12 +86,12 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<tr v-if="diaCambi.team === 'home'">
|
||||
<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.out" type="text" class="cambi-input"></w-input></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr v-if="diaCambi.team === 'guest'">
|
||||
<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.out" type="text" class="cambi-input"></w-input></td>
|
||||
|
||||
@@ -13,9 +13,13 @@ export default {
|
||||
},
|
||||
diaCambi: {
|
||||
show: false,
|
||||
team: "home",
|
||||
guest: { in: "", out: "" },
|
||||
home: { in: "", out: "" },
|
||||
},
|
||||
diaCambiTeam: {
|
||||
show: false,
|
||||
},
|
||||
visuForm: false,
|
||||
visuButt: true,
|
||||
visuStriscia: true,
|
||||
@@ -49,20 +53,11 @@ export default {
|
||||
return this.sp.punt.home === 0 && this.sp.punt.guest === 0;
|
||||
},
|
||||
cambiConfermabili() {
|
||||
const guestIn = (this.diaCambi.guest.in || "").trim();
|
||||
const guestOut = (this.diaCambi.guest.out || "").trim();
|
||||
const homeIn = (this.diaCambi.home.in || "").trim();
|
||||
const homeOut = (this.diaCambi.home.out || "").trim();
|
||||
const team = this.diaCambi.team;
|
||||
const teamIn = (this.diaCambi[team].in || "").trim();
|
||||
const teamOut = (this.diaCambi[team].out || "").trim();
|
||||
|
||||
const guestEmpty = !guestIn && !guestOut;
|
||||
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;
|
||||
return !!teamIn && !!teamOut;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -235,20 +230,30 @@ export default {
|
||||
this.disabilitaTastiSpeciali();
|
||||
this.diaNomi.show = true;
|
||||
},
|
||||
resettaCambi() {
|
||||
this.diaCambi.guest.in = "";
|
||||
this.diaCambi.guest.out = "";
|
||||
this.diaCambi.home.in = "";
|
||||
this.diaCambi.home.out = "";
|
||||
resettaCambi(team) {
|
||||
const teams = team ? [team] : ["home", "guest"];
|
||||
teams.forEach((t) => {
|
||||
this.diaCambi[t].in = "";
|
||||
this.diaCambi[t].out = "";
|
||||
});
|
||||
},
|
||||
apriDialogCambi() {
|
||||
this.disabilitaTastiSpeciali();
|
||||
this.resettaCambi();
|
||||
this.diaCambiTeam.show = true;
|
||||
},
|
||||
apriDialogCambiTeam(team) {
|
||||
this.disabilitaTastiSpeciali();
|
||||
this.diaCambi.team = team;
|
||||
this.resettaCambi(team);
|
||||
this.diaCambi.show = true;
|
||||
},
|
||||
selezionaTeamCambi(team) {
|
||||
this.diaCambiTeam.show = false;
|
||||
this.apriDialogCambiTeam(team);
|
||||
},
|
||||
chiudiDialogCambi() {
|
||||
this.diaCambi.show = false;
|
||||
this.resettaCambi();
|
||||
this.resettaCambi(this.diaCambi.team);
|
||||
this.abilitaTastiSpeciali();
|
||||
},
|
||||
confermaCambi() {
|
||||
@@ -256,40 +261,31 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
const cambi = [
|
||||
{ team: "guest", in: (this.diaCambi.guest.in || "").trim(), out: (this.diaCambi.guest.out || "").trim() },
|
||||
{ team: "home", in: (this.diaCambi.home.in || "").trim(), out: (this.diaCambi.home.out || "").trim() },
|
||||
];
|
||||
const team = this.diaCambi.team;
|
||||
const cambio = {
|
||||
team,
|
||||
in: (this.diaCambi[team].in || "").trim(),
|
||||
out: (this.diaCambi[team].out || "").trim(),
|
||||
};
|
||||
|
||||
const cambiDaApplicare = [];
|
||||
for (const cambio of cambi) {
|
||||
if (!cambio.in && !cambio.out) {
|
||||
continue;
|
||||
}
|
||||
const form = this.sp.form[cambio.team].map((val) => String(val).trim());
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
if (!form.includes(cambio.out)) {
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
cambiDaApplicare.push({ ...cambio });
|
||||
if (form.includes(cambio.in)) {
|
||||
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");
|
||||
return;
|
||||
}
|
||||
if (cambio.in === cambio.out) {
|
||||
this.$waveui.notify(`Numero IN e OUT uguali per ${cambio.team}`, "warning");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const cambio of cambiDaApplicare) {
|
||||
const idx = this.sp.form[cambio.team].findIndex((val) => String(val).trim() === cambio.out);
|
||||
if (idx !== -1) {
|
||||
this.sp.form[cambio.team].splice(idx, 1, cambio.in);
|
||||
}
|
||||
const idx = this.sp.form[cambio.team].findIndex((val) => String(val).trim() === cambio.out);
|
||||
if (idx !== -1) {
|
||||
this.sp.form[cambio.team].splice(idx, 1, cambio.in);
|
||||
}
|
||||
|
||||
this.chiudiDialogCambi();
|
||||
@@ -301,7 +297,7 @@ export default {
|
||||
window.addEventListener("keydown", this.funzioneTastiSpeciali);
|
||||
},
|
||||
funzioneTastiSpeciali(e) {
|
||||
if (this.diaNomi.show || this.diaCambi.show) {
|
||||
if (this.diaNomi.show || this.diaCambi.show || this.diaCambiTeam.show) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -367,7 +363,10 @@ export default {
|
||||
this.cambiaPalla()
|
||||
handled = true;
|
||||
} 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;
|
||||
} else { return false }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user