mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-29 05:26:13 +00:00
prepare dispatch
This commit is contained in:
parent
3748b4fbf4
commit
020759180b
@ -149,15 +149,15 @@ export default {
|
||||
addInSocialIssuesList(value) {
|
||||
console.log('addInSocialIssuesList', value);
|
||||
this.$store.commit('addSocialIssueInList', value);
|
||||
this.$store.commit('addSocialIssueSelected', value);
|
||||
this.$store.commit('removeSocialIssueInOther', value);
|
||||
this.$store.dispatch('addSocialIssueSelected', value);
|
||||
this.updateActionsList();
|
||||
},
|
||||
/* Update value for selected issues checkboxes
|
||||
*/
|
||||
updateSelectedIssue(value) {
|
||||
console.log('updateSelectedIssue', value);
|
||||
this.$store.commit('updateSocialIssuesSelected', value);
|
||||
this.$store.dispatch('updateSocialIssuesSelected', value);
|
||||
this.updateActionsList();
|
||||
},
|
||||
/* Add socialActions concerned: reset actions list, then loop on each issue selected
|
||||
@ -185,8 +185,13 @@ export default {
|
||||
resolve();
|
||||
}));
|
||||
}, this);
|
||||
},
|
||||
/* Update value for selected actions checkboxes
|
||||
*/
|
||||
updateSelectedAction(value) {
|
||||
console.log('updateSelectedAction', value);
|
||||
this.$store.dispatch('updateSocialActionsSelected', value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -4,6 +4,20 @@ import { createStore } from 'vuex';
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
//console.log('window.activity', window.activity);
|
||||
|
||||
const addIdToValue = (string, id) => {
|
||||
let array = string ? string.split(',') : [];
|
||||
array.push(id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
};
|
||||
|
||||
const removeIdFromValue = (string, id) => {
|
||||
let array = string.split(',');
|
||||
array = array.filter(el => el !== id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
};
|
||||
|
||||
const store = createStore({
|
||||
strict: debug,
|
||||
state: {
|
||||
@ -22,9 +36,9 @@ const store = createStore({
|
||||
console.log('add selected issue', issue.id);
|
||||
state.activity.socialIssues.push(issue);
|
||||
},
|
||||
updateSocialIssuesSelected(state, issue) {
|
||||
console.log('update selected issues');
|
||||
state.activity.socialIssues = issue;
|
||||
updateSocialIssuesSelected(state, issues) {
|
||||
console.log('update selected issues', issues);
|
||||
state.activity.socialIssues = issues;
|
||||
},
|
||||
updateSocialIssuesOther(state, payload) {
|
||||
console.log('update other issues');
|
||||
@ -42,9 +56,9 @@ const store = createStore({
|
||||
console.log('add list action', action.id);
|
||||
state.socialActionsList.push(action);
|
||||
},
|
||||
addSocialActionSelected(state, action) {
|
||||
console.log('add selected action', action.id);
|
||||
state.activity.socialActions.push(action);
|
||||
updateSocialActionsSelected(state, actions) {
|
||||
console.log('update selected actions', actions);
|
||||
state.activity.socialActions = actions;
|
||||
},
|
||||
filterList(state, list) {
|
||||
const filterList = (list) => {
|
||||
@ -96,16 +110,17 @@ const store = createStore({
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
addSocialIssueSelected({ commit }, issue) {
|
||||
commit('addSocialIssueSelected', issue);
|
||||
},
|
||||
updateSocialIssuesSelected({ commit }, payload) {
|
||||
commit('updateSocialIssuesSelected', payload);
|
||||
},
|
||||
updateSocialActionsSelected({ commit }, payload) {
|
||||
commit('updateSocialActionsSelected', payload);
|
||||
},
|
||||
addPersonsInvolved({ commit }, payload) {
|
||||
//console.log('### action addPersonsInvolved', payload.result.type);
|
||||
|
||||
const addIdToValue = (string, id) => {
|
||||
let array = string ? string.split(',') : [];
|
||||
array.push(id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
};
|
||||
|
||||
switch (payload.result.type) {
|
||||
case 'person':
|
||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||
@ -124,14 +139,6 @@ const store = createStore({
|
||||
},
|
||||
removePersonInvolved({ commit }, payload) {
|
||||
//console.log('### action removePersonInvolved', payload);
|
||||
|
||||
const removeIdFromValue = (string, id) => {
|
||||
let array = string.split(',');
|
||||
array = array.filter(el => el !== id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
};
|
||||
|
||||
switch (payload.type) {
|
||||
case 'person':
|
||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||
|
Loading…
x
Reference in New Issue
Block a user