mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
prepare course and relationship dispatch
This commit is contained in:
parent
83d91e61cb
commit
97f6110be3
@ -21,7 +21,6 @@ const store = createStore({
|
|||||||
state.households.forEach(h => {
|
state.households.forEach(h => {
|
||||||
nodes.push(h)
|
nodes.push(h)
|
||||||
})
|
})
|
||||||
// push all others kinds of nodes..
|
|
||||||
return nodes
|
return nodes
|
||||||
},
|
},
|
||||||
edges(state) {
|
edges(state) {
|
||||||
@ -33,17 +32,27 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
addPerson(state, person) {
|
addPerson(state, person) {
|
||||||
|
console.log('addPerson', person.id)
|
||||||
person.label = person.text // vis need label
|
person.label = person.text // vis need label
|
||||||
person.id = `person_${person.id}`
|
person.id = `person_${person.id}` // vis need unique id
|
||||||
state.persons.push(person)
|
state.persons.push(person)
|
||||||
},
|
},
|
||||||
addHousehold(state, household) {
|
addHousehold(state, household) {
|
||||||
|
console.log('addHousehold', household.id)
|
||||||
household.label = `Ménage n° ${household.id}` // vis need label
|
household.label = `Ménage n° ${household.id}` // vis need label
|
||||||
household.id = `household_${household.id}`
|
household.id = `household_${household.id}` // vis need unique id
|
||||||
state.households.push(household)
|
state.households.push(household)
|
||||||
},
|
},
|
||||||
|
addCourse(state, course) {
|
||||||
|
console.log('addCourse', course.id)
|
||||||
|
state.courses.push(course)
|
||||||
|
},
|
||||||
|
addRelationship(state, relationship) {
|
||||||
|
console.log('addRelationship', relationship.id)
|
||||||
|
state.relationships.push(relationship)
|
||||||
|
},
|
||||||
markHouseholdLoading(state, id) {
|
markHouseholdLoading(state, id) {
|
||||||
console.log('mutation: markHouseholdLoading', id)
|
console.log('..loading', id)
|
||||||
state.householdLoadingIds.push(id)
|
state.householdLoadingIds.push(id)
|
||||||
},
|
},
|
||||||
unmarkHouseholdLoading(state, id) {
|
unmarkHouseholdLoading(state, id) {
|
||||||
@ -52,15 +61,13 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addPerson({ commit, dispatch }, person) {
|
addPerson({ commit, dispatch }, person) {
|
||||||
console.log('addPerson', person.id)
|
|
||||||
commit('addPerson', person)
|
commit('addPerson', person)
|
||||||
dispatch('fetchInfoForPerson', person)
|
dispatch('fetchInfoForPerson', person)
|
||||||
},
|
},
|
||||||
fetchInfoForPerson({ dispatch }, person) {
|
fetchInfoForPerson({ dispatch }, person) {
|
||||||
//console.log('fetchInfoForPerson', person.id)
|
|
||||||
dispatch('fetchHouseholdForPerson', person)
|
dispatch('fetchHouseholdForPerson', person)
|
||||||
//getCourseByPerson(person)
|
//dispatch('fetchCourseByPerson', person)
|
||||||
//getRelationship(person)
|
//dispatch('fetchRelationship', person)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +80,7 @@ const store = createStore({
|
|||||||
commit('markHouseholdLoading', person.current_household_id)
|
commit('markHouseholdLoading', person.current_household_id)
|
||||||
getHouseholdByPerson(person)
|
getHouseholdByPerson(person)
|
||||||
.then(household => new Promise(resolve => {
|
.then(household => new Promise(resolve => {
|
||||||
console.log('getHouseholdByPerson', household)
|
//console.log('getHouseholdByPerson', household)
|
||||||
commit('addHousehold', household)
|
commit('addHousehold', household)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
@ -82,6 +89,35 @@ const store = createStore({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch person current AccompanyingCourses
|
||||||
|
*/
|
||||||
|
fetchCourseByPerson({ commit, getters }, person) {
|
||||||
|
console.log('fetchCourseByPerson', person)
|
||||||
|
getCourseByPerson(person)
|
||||||
|
.then(course => new Promise(resolve => {
|
||||||
|
console.log('getCourseByPerson', course)
|
||||||
|
commit('addCourse', course)
|
||||||
|
resolve()
|
||||||
|
}))
|
||||||
|
;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch Relationship
|
||||||
|
*/
|
||||||
|
fetchRelationship({ commit, getters }, person) {
|
||||||
|
console.log('fetchRelationship', person)
|
||||||
|
getRelationship(person)
|
||||||
|
.then(relationship => new Promise(resolve => {
|
||||||
|
console.log('getRelationship', relationship)
|
||||||
|
commit('addRelationship', relationship)
|
||||||
|
resolve()
|
||||||
|
}))
|
||||||
|
;
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user