Commit dce53cdb authored by Rémy Marronnier's avatar Rémy Marronnier

Questions validation rules

parent 3e0f9d1a
<template>
<v-row>
<v-btn @click="back">Revenir</v-btn>
<v-btn @click="submitClick" type="submit">Continuer</v-btn>
</v-row>
</template>
<script>
export default {
name: "QuestionButtons",
methods: {
back() {
this.$router.go(-1);
},
submitClick() {
this.$emit("submit");
}
}
};
</script>
<style>
</style>
\ No newline at end of file
......@@ -56,7 +56,7 @@ export default {
commit('updateLocationCitycode', location_citycode)
commit('updateChanged', true)
}
this.$router.push('other')
// this.$router.push('other')
},
submitAge({ commit, state }, age) {
if (age != state.age) {
......@@ -69,34 +69,43 @@ export default {
commit('updateAllocationType', allocation_type)
commit('updateChanged', true)
}
this.$router.push('ARE')
// this.$router.push('ARE')
},
submitARE({ commit, state }, monthly_allocation_value) {
if (monthly_allocation_value != state.monthly_allocation_value) {
commit('updateMonthlyAllocationValue', monthly_allocation_value)
commit('updateChanged', true)
}
this.$router.push('age') //est-ce vraiment nécessaire si l'âge est déjà renseigné ?
// this.$router.push('age') //est-ce vraiment nécessaire si l'âge est déjà renseigné ?
},
submitCategory({ commit, state }, category) {
if (category != state.category) {
commit('updateCategory', category)
commit('updateChanged', true)
}
this.$router.push('allocation')
//this.$router.push('allocation')
},
submitGrade({ commit, state }, diploma) {
if (diploma != state.diploma) {
commit('updateDiploma', diploma)
commit('updateChanged', true)
}
this.$router.push('address')
},
submitOther({ commit, state }, disabled, spectacle) {
submitDisabled({ commit, state }, disabled) {
if (disabled != state.disabled) {
commit('updateDisabled', disabled)
commit('updateChanged', true)
}
//if (state.filters.length == 0) { put those actions in the result component when loaded.
// dispatch('getFilters')
// //}
// dispatch('getResults')
// dispatch('getEligible')
// dispatch('getNonEligible')
//dispatch('getUncertain') ???
//this.$router.push('results')
},
submitSpectacle({ commit, state }, spectacle) {
if (spectacle != state.spectacle) {
commit('updateSpectacle', spectacle)
commit('updateChanged', true)
......@@ -108,7 +117,7 @@ export default {
// dispatch('getEligible')
// dispatch('getNonEligible')
//dispatch('getUncertain') ???
this.$router.push('results')
//this.$router.push('results')
},
},
......
......@@ -24,7 +24,7 @@ export default {
data: () => ({
monthly_allocation_value: null,
validity: false,
rules: [v => !!v || "doit être renseignée"]
rules: [v => !!v || "doit être renseigné"]
}),
methods: {
validate() {
......
<template>
<v-form>
<v-form @submit.prevent="submitAddress" ref="formAddress" v-model="validity">
Quel est votre code postal de votre lieu de résidence ?
Code postal - facultatif
**Plus que 2 questions avant d'obtenir vos résultats**
<v-text-field single-line type="number" label="Exemple : 44220"></v-text-field>
<v-alert>Plus que 2 questions avant d'obtenir vos résultats</v-alert>
<v-text-field autofocus v-model.number="address" type="number" label="Exemple : 44220"></v-text-field>
<v-btn @click="back">Revenir</v-btn>
<v-btn v-bind:disabled="!validity" type="submit">Continuer</v-btn>
</v-form>
......@@ -12,12 +12,25 @@
<script>
export default {
name: "Address",
created() {
this.address = this.$store.state.situation.location_citycode;
},
data: () => ({
address: 0,
validity: false
}),
methods: {
validate() {
if (this.$refs.formAddress.validate()) {
this.validity = true;
}
},
back() {
this.$router.go(-1);
},
submit() {
//this.$store.dispatch("submitAddress", this.??);
submitAddress() {
this.validate();
this.$store.dispatch("submitAddress", this.address);
this.$router.push("autres-situations");
}
}
......