Commit 2aeb92a6 authored by Rémy Marronnier's avatar Rémy Marronnier

store + form validation wip

parent d97faad7
<template>
<v-row>
<v-btn @click="back">Revenir</v-btn>
<v-btn @click="submit">Continuer</v-btn>
<v-btn @click="submitClick" type="submit">Continuer</v-btn>
</v-row>
</template>
......@@ -11,6 +11,9 @@ export default {
methods: {
back() {
this.$router.go(-1);
},
submitClick() {
this.$emit("submit");
}
}
};
......
import Vue from 'vue'
import App from './App.vue'
import router from './router'
//import store from './store/'
import store from './store/'
import vuetify from './plugins/vuetify';
Vue.config.productionTip = false
......@@ -9,6 +9,6 @@ Vue.config.productionTip = false
new Vue({
vuetify,
router,
//store,
store,
render: h => h(App)
}).$mount('#app')
......@@ -68,7 +68,7 @@ export default new Router({
]
},
{
path: '/aides-possibles',
path: '/resultats',
name: 'results',
component: Results
},
......
import ClaraService from "@/api/clara";
//import ClaraService from "@/api/clara";
export default {
state: {
......@@ -22,21 +22,21 @@ export default {
}
},
actions: {
getFilters({ commit }) {
// promise + fetch + API call
},
getResults({ commit, dispatch }) {
// promise + fetch + API call
this.$store.commit("updateChanged", false)
},
// getFilters({ commit }) {
// // promise + fetch + API call
// },
// getResults({ commit, dispatch }) {
// // promise + fetch + API call
// this.$store.commit("updateChanged", false)
// },
},
getters: {
eligible: state => state.eligible,
eligible_quantity: state => state.eligible.length(),
eligible_quantity: state => state.eligible.length,
non_eligible: state => state.nonEligible,
non_eligible_quantity: state => state.nonEligible.length(),
non_eligible_quantity: state => state.nonEligible.length,
//uncertain: state => state.uncertain,
filters: state => state.filters,
filters_quantity: state => state.filters.length(),
filters_quantity: state => state.filters.length,
},
}
\ No newline at end of file
import ClaraService from "@/api/clara";
//import ClaraService from "@/api/clara";
export default {
state: {
......@@ -48,9 +48,9 @@ export default {
},
actions: {
submitInscription({ commit }, inscription_period) {
// submitInscription({ commit }, inscription_period) {
},
// },
submitAddress({ commit, state }, location_citycode) {
if (location_citycode != state.location_citycode) {
commit('updateLocationCitycode', location_citycode)
......@@ -63,7 +63,6 @@ export default {
commit('updateAge', age)
commit('updateChanged', true)
}
this.$router.push('grade')
},
submitAllocation({ commit, state }, allocation_type) {
if (allocation_type != state.allocation_type) {
......
<template>
<v-content>
<v-card>
<v-form>
<router-view></router-view>
<QuestionButtons></QuestionButtons>
</v-form>
</v-card>
</v-content>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "Questions",
components: {
QuestionButtons
}
name: "Questions"
};
</script>
......
<template>
<v-card>
<v-form>
Quel est le montant de cette allocation ?
<v-text-field single-line type="number" label="Montant par mois"></v-text-field>
</v-card>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "ARE"
components: {
QuestionButtons
},
name: "ARE",
methods: {
submit() {
this.$router.push("votre-age");
}
}
};
</script>
......
<template>
<v-card>
<v-form>
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-card>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "Address"
components: {
QuestionButtons
},
name: "Address",
methods: {
submit() {
//this.$store.dispatch("submitAddress", this.??);
this.$router.push("autres-situations");
}
}
};
</script>
......
<template>
<v-card>
<v-form>
Quel est votre âge ?
<v-text-field single-line type="number"></v-text-field>
</v-card>
<v-text-field
v-model.number="age"
single-line
type="number"
v-validate="'required|min:16'"
:rules="rules"
></v-text-field>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "ARE"
name: "Age",
components: {
QuestionButtons
},
computed: {
age: {
get() {
return this.$store.state.situation.age;
},
set(value) {
this.$store.dispatch("submitAge", value);
}
}
},
data: () => ({
rules: [
value => !!value || "Required."
// value => value || >= 15 || 'doit être supérieur ou égal à 16',
// value => {
// const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
// return pattern.test(value) || 'Invalid e-mail.'
//},
]
}),
methods: {
submit() {
//this.$store.dispatch("submitAge", this.age);
this.$router.push("votre-diplome");
}
}
};
</script>
......
<template>
<v-card>
<v-form>
Quelle allocation percevez-vous actuellement ?
<v-radio-group v-model="radios">
<v-radio label="Choix 1" value="radio-1"></v-radio>
......@@ -9,12 +9,24 @@
<v-radio label="Choix 5" value="radio-5"></v-radio>
<v-radio label="Choix 6" value="radio-6"></v-radio>
</v-radio-group>
</v-card>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "Allocation"
components: {
QuestionButtons
},
name: "Allocation",
methods: {
submit() {
//this.$store.dispatch("submitAddress", this.??);
//if value != none OR !retraite...
this.$router.push("montant-ARE");
}
}
};
</script>
......
<template>
<v-card>
<v-form>
Êtes-vous actuellement dans l'une des situations suivantes ?
<v-radio-group v-model="radios">
<v-radio label="Choix 1" value="radio-1"></v-radio>
<v-radio label="Choix 2" value="radio-2"></v-radio>
</v-radio-group>
</v-card>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "Category"
components: {
QuestionButtons
},
name: "Category",
methods: {
submit() {
//this.$store.dispatch("submitCategory", this.??);
this.$router.push("votre-allocation");
}
}
};
</script>
......
<template>
<v-card>
<v-form>
Quel est le diplôme le plus élevé que vous ayez obtenu ?
<v-radio-group v-model="radios">
<v-radio label="Choix 1" value="radio-1"></v-radio>
......@@ -9,12 +9,23 @@
<v-radio label="Choix 5" value="radio-5"></v-radio>
<v-radio label="Choix 6" value="radio-6"></v-radio>
</v-radio-group>
</v-card>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "Grade"
name: "Grade",
components: {
QuestionButtons
},
methods: {
submit() {
//this.$store.dispatch("submitDiploma", this.??);
this.$router.push("votre-adresse");
}
}
};
</script>
......
<template>
<v-card>
<v-form>
Depuis combien de temps êtes-vous inscrit•e à Pôle emploi ?
<v-radio-group v-model="radios">
<v-radio label="Je ne suis pas inscrit.e" value="not_registred"></v-radio>
<v-radio label="Moins d'un an" value="less_than_year"></v-radio>
<v-radio label="Plus d'un an" value="more_than_a_year"></v-radio>
</v-radio-group>
</v-card>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "Inscription"
components: {
QuestionButtons
},
name: "Inscription",
methods: {
submit() {
//this.$store.dispatch("submitInscription", this.??);
// if choice != non inscrit
this.$router.push("categorie");
}
}
};
</script>
......
<template>
<v-card>
<v-form>
Êtes-vous dans l'une des situations suivantes ?
Cochez la ou les situations correspondantes
<v-checkbox v-model="selected" label="Choix 1" value="John"></v-checkbox>
<v-checkbox v-model="selected" label="Choix 2" value="John"></v-checkbox>
<v-checkbox v-model="selected" label="Choix 3" value="John"></v-checkbox>
<v-checkbox v-model="selected" label="Choix 4" value="John"></v-checkbox>
</v-card>
<QuestionButtons @submit="submit"></QuestionButtons>
</v-form>
</template>
<script>
import QuestionButtons from "@/components/QuestionButtons";
export default {
name: "Other"
components: {
QuestionButtons
},
name: "Other",
methods: {
submit() {
//this.$store.dispatch("submitOther", this.??);
// if choice != non inscrit
this.$router.push({ path: "/resultats" });
}
}
};
</script>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment