feat(controller): aggiunge modal formazione a inizio set
Dopo la conferma di un set finito appare automaticamente un secondo modal "FORMAZIONE SET N" con gli input (resettati a 1-6) per registrare la formazione del set successivo. Al click INIZIA vengono inviati setFormazione per home e guest, e la formazione viene archiviata in formInizioSet (e quindi nel DB a fine partita via strisce[].formInizio). Se la conferma del set conclude la partita, il modal formazione viene chiuso automaticamente non appena lo stato con partitaFinita arriva dal server
This commit is contained in:
@@ -87,7 +87,51 @@
|
||||
<div class="set-score">{{ state.sp.punt.home }} – {{ state.sp.punt.guest }}</div>
|
||||
</div>
|
||||
<div class="dialog-buttons">
|
||||
<button class="btn btn-confirm" @click="sendAction({ type: 'confermaSet' })">CONFERMA</button>
|
||||
<button class="btn btn-confirm" @click="confermaSetEApriFormazione()">CONFERMA</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Finestra formazione inizio set -->
|
||||
<div class="overlay" v-if="showFormazioneModal">
|
||||
<div class="dialog dialog-config">
|
||||
<div class="dialog-title">
|
||||
FORMAZIONE SET {{ state.sp.set.home + state.sp.set.guest + 1 }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{ state.sp.nomi.home }}</label>
|
||||
<div class="form-grid">
|
||||
<div class="form-row">
|
||||
<input type="text" v-model="formazioneSetData.home[3]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.home[2]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.home[1]" class="input-num" />
|
||||
</div>
|
||||
<div class="form-line"></div>
|
||||
<div class="form-row">
|
||||
<input type="text" v-model="formazioneSetData.home[4]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.home[5]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.home[0]" class="input-num" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{ state.sp.nomi.guest }}</label>
|
||||
<div class="form-grid">
|
||||
<div class="form-row">
|
||||
<input type="text" v-model="formazioneSetData.guest[3]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.guest[2]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.guest[1]" class="input-num" />
|
||||
</div>
|
||||
<div class="form-line"></div>
|
||||
<div class="form-row">
|
||||
<input type="text" v-model="formazioneSetData.guest[4]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.guest[5]" class="input-num" />
|
||||
<input type="text" v-model="formazioneSetData.guest[0]" class="input-num" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-buttons">
|
||||
<button class="btn btn-confirm" @click="confermaFormazioneSet()">INIZIA</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -201,6 +245,11 @@ export default {
|
||||
reconnectAttempts: 0,
|
||||
maxReconnectDelay: 30000,
|
||||
confirmReset: false,
|
||||
showFormazioneModal: false,
|
||||
formazioneSetData: {
|
||||
home: ["1", "2", "3", "4", "5", "6"],
|
||||
guest: ["1", "2", "3", "4", "5", "6"],
|
||||
},
|
||||
showConfig: false,
|
||||
showCambiTeam: false,
|
||||
showCambi: false,
|
||||
@@ -374,6 +423,9 @@ export default {
|
||||
|
||||
if (msg.type === 'state') {
|
||||
this.state = msg.state
|
||||
if (this.state.sp.partitaFinita && this.showFormazioneModal) {
|
||||
this.showFormazioneModal = false
|
||||
}
|
||||
} else if (msg.type === 'error') {
|
||||
console.error('[Controller] Server error:', msg.message)
|
||||
// Fornisce feedback di errore all'utente.
|
||||
@@ -454,6 +506,21 @@ export default {
|
||||
console.error('[Controller] Error:', message)
|
||||
},
|
||||
|
||||
confermaSetEApriFormazione() {
|
||||
this.sendAction({ type: 'confermaSet' })
|
||||
this.formazioneSetData = {
|
||||
home: ["1", "2", "3", "4", "5", "6"],
|
||||
guest: ["1", "2", "3", "4", "5", "6"],
|
||||
}
|
||||
this.showFormazioneModal = true
|
||||
},
|
||||
|
||||
confermaFormazioneSet() {
|
||||
this.sendAction({ type: 'setFormazione', team: 'home', form: this.formazioneSetData.home })
|
||||
this.sendAction({ type: 'setFormazione', team: 'guest', form: this.formazioneSetData.guest })
|
||||
this.showFormazioneModal = false
|
||||
},
|
||||
|
||||
doReset() {
|
||||
this.sendAction({ type: 'resetta' })
|
||||
this.confirmReset = false
|
||||
|
||||
Reference in New Issue
Block a user