mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
activity vue component add and remove persons (in store)
This commit is contained in:
@@ -10,22 +10,50 @@ const store = createStore({
|
||||
activity: window.activity
|
||||
},
|
||||
getters: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
addPersonsInvolved(state, payload) {
|
||||
console.log('### mutation addPersonsInvolved', payload);
|
||||
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
||||
switch (payload.result.type) {
|
||||
case 'person':
|
||||
state.activity.persons.push(payload.result);
|
||||
break;
|
||||
case 'thirdparty':
|
||||
state.activity.thirdParties.push(payload.result);
|
||||
break;
|
||||
case 'user':
|
||||
state.activity.users.push(payload.result);
|
||||
break;
|
||||
};
|
||||
},
|
||||
removePersonInvolved(state, payload) {
|
||||
console.log('### mutation removePersonInvolved', payload.type);
|
||||
switch (payload.type) {
|
||||
case 'person':
|
||||
state.activity.persons = state.activity.persons.filter(person => person !== payload);
|
||||
break;
|
||||
case 'thirdparty':
|
||||
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
|
||||
break;
|
||||
case 'user':
|
||||
state.activity.users = state.activity.users.filter(user => user !== payload);
|
||||
break;
|
||||
};
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
addPersonsInvolved({ commit }, payload) {
|
||||
console.log('### action addPersonsInvolved', payload);
|
||||
//let el = document.getElementById('form['activity']['xxx']['xxxx']');
|
||||
//let option = document.createElement('option');
|
||||
//option.value = person.id;
|
||||
//el.appendChild(option);
|
||||
commit('addPersonsInvolved', payload)
|
||||
}
|
||||
//let el = document.getElementById('form['activity']['xxx']['xxxx']');
|
||||
//let option = document.createElement('option');
|
||||
//option.value = person.id;
|
||||
//el.appendChild(option);
|
||||
commit('addPersonsInvolved', payload);
|
||||
},
|
||||
removePersonInvolved({ commit }, payload) {
|
||||
console.log('### action removePersonInvolved', payload);
|
||||
commit('removePersonInvolved', payload);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user