Fix: output number in month form

This commit is contained in:
Bertrand Benjamin 2021-08-04 21:17:40 +02:00
parent a021fe8093
commit 5683b57e24
3 changed files with 41 additions and 42 deletions

View File

@ -8,27 +8,27 @@
<ul> <ul>
<li> <li>
<label for="ca-theo">CA théorique</label> <label for="ca-theo">CA théorique</label>
<input type="number" v-model="monthCopy.ca_theo" id="ca-theo" class="value" > <input type="number" v-model.number="monthCopy.ca_theo" id="ca-theo" class="value" >
</li> </li>
<li> <li>
<label for="ca-retro">CA rétrocession</label> <label for="ca-retro">CA rétrocession</label>
<input type="number" v-model="monthCopy.ca_retro" id="ca-retro" class="value" > <input type="number" v-model.number="monthCopy.ca_retro" id="ca-retro" class="value" >
</li> </li>
<li> <li>
<label for="ca-react">CA réactualisé</label> <label for="ca-react">CA réactualisé</label>
<input type="number" v-model="monthCopy.ca_react" id="ca-react" class="value" > <input type="number" v-model.number="monthCopy.ca_react" id="ca-react" class="value" >
</li> </li>
<li> <li>
<label for="nbr-seances">Nombre de séances effectuées</label> <label for="nbr-seances">Nombre de séances effectuées</label>
<input type="number" v-model="monthCopy.nbr_seances" id="nbr-seances" class="value" > <input type="number" v-model.number="monthCopy.nbr_seances" id="nbr-seances" class="value" >
</li> </li>
<li> <li>
<label for="retro">Montant de la rétrocession</label> <label for="retro">Montant de la rétrocession</label>
<input type="number" v-model="monthCopy.retro" id="retro" class="value" > <input type="number" v-model.number="monthCopy.retro" id="retro" class="value" >
</li> </li>
<li> <li>
<label for="remuneration">Rémunération effectuée</label> <label for="remuneration">Rémunération effectuée</label>
<input type="number" v-model="monthCopy.remuneration" id="remuneration" class="value"> <input type="number" v-model.number="monthCopy.remuneration" id="remuneration" class="value">
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -8,32 +8,32 @@
<li> <li>
<label for="ca-theo">CA "Séances effectuées"</label> <label for="ca-theo">CA "Séances effectuées"</label>
<span class="value" v-show="!editing">{{ TheMonth.ca_theo ?? ""}}</span> <span class="value" v-show="!editing">{{ TheMonth.ca_theo ?? ""}}</span>
<input type="number" v-model="monthCopy.ca_theo" id="ca-theo" class="value" v-show="editing"> <input type="number" v-model.number="monthCopy.ca_theo" id="ca-theo" class="value" v-show="editing">
</li> </li>
<li> <li>
<label for="ca-retro">CA "Séances facturées"</label> <label for="ca-retro">CA "Séances facturées"</label>
<span class="value" v-show="!editing">{{ TheMonth.ca_retro ?? ""}}</span> <span class="value" v-show="!editing">{{ TheMonth.ca_retro ?? ""}}</span>
<input type="number" v-model="monthCopy.ca_retro" id="ca-retro" class="value" v-show="editing"> <input type="number" v-model.number="monthCopy.ca_retro" id="ca-retro" class="value" v-show="editing">
</li> </li>
<li> <li>
<label for="ca-react">CA "Séances facturées" réactualisé</label> <label for="ca-react">CA "Séances facturées" réactualisé</label>
<span class="value" v-show="!editing">{{ TheMonth.ca_react ?? ""}}</span> <span class="value" v-show="!editing">{{ TheMonth.ca_react ?? ""}}</span>
<input type="number" v-model="monthCopy.ca_react" id="ca-react" class="value" v-show="editing"> <input type="number" v-model.number="monthCopy.ca_react" id="ca-react" class="value" v-show="editing">
</li> </li>
<li> <li>
<label for="nbr-seances">Nombre de séances effectuées</label> <label for="nbr-seances">Nombre de séances effectuées</label>
<span class="value" v-show="!editing">{{ TheMonth.nbr_seances ?? ""}}</span> <span class="value" v-show="!editing">{{ TheMonth.nbr_seances ?? ""}}</span>
<input type="number" v-model="monthCopy.nbr_seances" id="nbr-seances" class="value" v-show="editing"> <input type="number" v-model.number="monthCopy.nbr_seances" id="nbr-seances" class="value" v-show="editing">
</li> </li>
<li> <li>
<label for="retro">Montant de la rétrocession</label> <label for="retro">Montant de la rétrocession</label>
<span class="value" v-show="!editing">{{ TheMonth.retro ?? ""}}</span> <span class="value" v-show="!editing">{{ TheMonth.retro ?? ""}}</span>
<input type="number" v-model="monthCopy.retro" id="retro" class="value" v-show="editing"> <input type="number" v-model.number="monthCopy.retro" id="retro" class="value" v-show="editing">
</li> </li>
<li> <li>
<label for="remuneration">Rémunération </label> <label for="remuneration">Rémunération </label>
<span class="value" v-show="!editing">{{ TheMonth.remuneration ?? ""}}</span> <span class="value" v-show="!editing">{{ TheMonth.remuneration ?? ""}}</span>
<input type="number" v-model="monthCopy.remuneration" id="remuneration" class="value" v-show="editing"> <input type="number" v-model.number="monthCopy.remuneration" id="remuneration" class="value" v-show="editing">
</li> </li>
</ul> </ul>
</div> </div>
@ -74,7 +74,7 @@ export default {
this.editing = !this.editing this.editing = !this.editing
}, },
save: function () { save: function () {
this.updateMonth({date: this.TheDate, month: this.monthCopy}) this.updateMonth({date: this.TheDate, month: {...this.monthCopy}})
this.toggleEdit() this.toggleEdit()
}, },
cancel: function () { cancel: function () {

View File

@ -161,38 +161,37 @@ const travail = {
updateMonth(state, { date, month }) { updateMonth(state, { date, month }) {
state.months[date] = month state.months[date] = month
}, },
createMonth (state, { date, month }) { createMonth (state, { date, month }) {
state.months[date] = month state.months[date] = month
},
setRange(state, range) {
state.range = range
},
}, },
setRange(state, range) { actions: {
state.range = range updateMonth(context, { date, month }) {
}, // update month's datas
if (date in context.state.months) {
context.commit('updateMonth', { date, month })
} else {
console.log("This month does not exists")
}
},
createMonth(context, { date, month }) {
// Create a new month
if (!(date in context.state.months)) {
console.log(date)
context.commit('createMonth', { date, month })
console.log(context.state.months)
} else {
console.log("This month already exists")
}
},
setRange(context, range) {
context.commit("setRange", range)
},
}, },
actions: {
updateMonth(context, { date, month }) {
// update month's datas
if (date in context.state.months) {
context.commit('updateMonth', { date, month })
} else {
console.log("This month does not exists")
}
},
createMonth(context, { date, month }) {
// Create a new month
if (!(date in context.state.months)) {
console.log(date)
context.commit('createMonth', { date, month })
console.log(context.state.months)
} else {
console.log("This month already exists")
}
},
setRange(context, range) {
context.commit("setRange", range)
},
},
} }
export default travail export default travail