Commit 4ad49e62 authored by Rémy Marronnier's avatar Rémy Marronnier

Stores foundations

parent 5d853613
......@@ -2,11 +2,41 @@ import ClaraService from "@/api/clara";
export default {
state: {
eligible: [],
nonEligible: [],
// uncertain: [], ???
filters: [],
},
mutations: {
updateEligible(state, eligible) {
state.eligible = eligible
},
actions: {
updateNonEligible(state, nonEligible) {
state.nonEligible = nonEligible
},
// updateUncertain(state, uncertain) {
// state.uncertain = uncertain
// },
updateFilters(state, filters) {
state.filters = filters
}
},
actions: {
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(),
non_eligible: state => state.nonEligible,
non_eligible_quantity: state => state.nonEligible.length(),
//uncertain: state => state.uncertain,
filters: state => state.filters,
filters_quantity: state => state.filters.length(),
},
}
\ No newline at end of file
......@@ -2,11 +2,130 @@ import ClaraService from "@/api/clara";
export default {
state: {
changed: false,
disabled: false,
spectacle: false,
diploma: "",
inscription_period: "",
allocation_type: "",
monthly_allocation_value: 0,
age: 0,
location_citycode: "",
category: "",
},
mutations: {
updateChanged(state, changed) {
state.changed = changed
},
updateDisabled(state, disabled) {
state.disabled = disabled
},
updateSpectacle(state, spectacle) {
state.spectacle = spectacle
},
updateDiploma(state, diploma) {
state.diploma = diploma
},
updateInscriptionPeriod(state, inscription_period) {
state.inscription_period = inscription_period
},
updateAllocationType(state, allocation_type) {
state.allocation_type = allocation_type
},
updateMonthlyAllocationValue(state, monthly_allocation_value) {
state.monthly_allocation_value = monthly_allocation_value
},
updateAge(state, age) {
state.age = age
},
updateLocationCitycode(state, location_citycode) {
state.location_citycode = location_citycode
},
updateCategory(state, category) {
state.category = category
},
},
actions: {
submitInscription({ commit }, inscription_period) {
},
submitAddress({ commit, state }, location_citycode) {
if (location_citycode != state.location_citycode) {
commit('updateLocationCitycode', location_citycode)
commit('updateChanged', true)
}
this.$router.push('other')
},
submitAge({ commit, state }, age) {
if (age != state.age) {
commit('updateAge', age)
commit('updateChanged', true)
}
this.$router.push('grade')
},
submitAllocation({ commit, state }, allocation_type) {
if (allocation_type != state.allocation_type) {