mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
rename methods, improve logic
This commit is contained in:
parent
020759180b
commit
6f1209eaf5
@ -12,7 +12,7 @@
|
|||||||
v-bind:key="issue.id"
|
v-bind:key="issue.id"
|
||||||
v-bind:issue="issue"
|
v-bind:issue="issue"
|
||||||
v-bind:selection="socialIssuesSelected"
|
v-bind:selection="socialIssuesSelected"
|
||||||
@updateSelected="updateSelectedIssue">
|
@updateSelected="updateIssuesSelected">
|
||||||
</check-social-issue>
|
</check-social-issue>
|
||||||
|
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
@ -34,7 +34,7 @@
|
|||||||
v-bind:placeholder="$t('activity.choose_other_social_issue')"
|
v-bind:placeholder="$t('activity.choose_other_social_issue')"
|
||||||
v-bind:options="socialIssuesOther"
|
v-bind:options="socialIssuesOther"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
@select="addInSocialIssuesList">
|
@select="addIssueInList">
|
||||||
|
|
||||||
<template v-slot:selection="{ values, search, isOpen }"><!-- {{ values.length }} {{ isOpen }} -->
|
<template v-slot:selection="{ values, search, isOpen }"><!-- {{ values.length }} {{ isOpen }} -->
|
||||||
<span v-if="values.length > 0" class="multiselect__single"></span>
|
<span v-if="values.length > 0" class="multiselect__single"></span>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
v-bind:key="action.id"
|
v-bind:key="action.id"
|
||||||
v-bind:action="action"
|
v-bind:action="action"
|
||||||
v-bind:selection="socialActionsSelected"
|
v-bind:selection="socialActionsSelected"
|
||||||
@updateSelected="updateSelectedAction">
|
@updateSelected="updateActionsSelected">
|
||||||
</check-social-action>
|
</check-social-action>
|
||||||
|
|
||||||
<span v-else class="inline-choice chill-no-data-statement mt-3">
|
<span v-else class="inline-choice chill-no-data-statement mt-3">
|
||||||
@ -117,15 +117,15 @@ export default {
|
|||||||
|
|
||||||
this.issueIsLoading = true;
|
this.issueIsLoading = true;
|
||||||
getSocialIssues().then(response => new Promise((resolve, reject) => {
|
getSocialIssues().then(response => new Promise((resolve, reject) => {
|
||||||
this.$store.commit('updateSocialIssuesOther', response.results);
|
this.$store.commit('updateIssuesOther', response.results);
|
||||||
|
|
||||||
this.socialIssuesSelected.forEach(issue => {
|
this.socialIssuesSelected.forEach(issue => {
|
||||||
this.$store.commit('addSocialIssueInList', issue);
|
this.$store.commit('addIssueInList', issue);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
console.log(this.socialIssuesOther.length, this.socialIssuesOther);
|
console.log(this.socialIssuesOther.length, this.socialIssuesOther);
|
||||||
this.socialIssuesList.forEach(issue => {
|
this.socialIssuesList.forEach(issue => {
|
||||||
this.$store.commit('removeSocialIssueInOther', issue);
|
this.$store.commit('removeIssueInOther', issue);
|
||||||
}, this);
|
}, this);
|
||||||
console.log(this.socialIssuesOther.length); // grr !!!
|
console.log(this.socialIssuesOther.length); // grr !!!
|
||||||
// TODO décompter les issues initiales du multiselect
|
// TODO décompter les issues initiales du multiselect
|
||||||
@ -133,7 +133,7 @@ export default {
|
|||||||
this.$store.commit('filterList', 'issues');
|
this.$store.commit('filterList', 'issues');
|
||||||
|
|
||||||
this.socialActionsSelected.forEach(action => {
|
this.socialActionsSelected.forEach(action => {
|
||||||
this.$store.commit('addSocialActionInList', action);
|
this.$store.commit('addActionInList', action);
|
||||||
}, this);
|
}, this);
|
||||||
this.$store.commit('filterList', 'actions');
|
this.$store.commit('filterList', 'actions');
|
||||||
|
|
||||||
@ -146,27 +146,33 @@ export default {
|
|||||||
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
||||||
remove it from multiselect, and add socialActions concerned
|
remove it from multiselect, and add socialActions concerned
|
||||||
*/
|
*/
|
||||||
addInSocialIssuesList(value) {
|
addIssueInList(value) {
|
||||||
console.log('addInSocialIssuesList', value);
|
console.log('addIssueInList', value);
|
||||||
this.$store.commit('addSocialIssueInList', value);
|
this.$store.commit('addIssueInList', value);
|
||||||
this.$store.commit('removeSocialIssueInOther', value);
|
this.$store.commit('removeIssueInOther', value);
|
||||||
this.$store.dispatch('addSocialIssueSelected', value);
|
this.$store.dispatch('addIssueSelected', value);
|
||||||
this.updateActionsList();
|
this.updateActionsList();
|
||||||
},
|
},
|
||||||
/* Update value for selected issues checkboxes
|
/* Update value for selected issues checkboxes
|
||||||
*/
|
*/
|
||||||
updateSelectedIssue(value) {
|
updateIssuesSelected(issues) {
|
||||||
console.log('updateSelectedIssue', value);
|
console.log('updateIssuesSelected', issues);
|
||||||
this.$store.dispatch('updateSocialIssuesSelected', value);
|
this.$store.dispatch('updateIssuesSelected', issues);
|
||||||
this.updateActionsList();
|
this.updateActionsList();
|
||||||
},
|
},
|
||||||
|
/* Update value for selected actions checkboxes
|
||||||
|
*/
|
||||||
|
updateActionsSelected(actions) {
|
||||||
|
console.log('updateActionsSelected', actions);
|
||||||
|
this.$store.dispatch('updateActionsSelected', actions);
|
||||||
|
},
|
||||||
/* Add socialActions concerned: reset actions list, then loop on each issue selected
|
/* Add socialActions concerned: reset actions list, then loop on each issue selected
|
||||||
to get social actions concerned
|
to get social actions concerned
|
||||||
*/
|
*/
|
||||||
updateActionsList() {
|
updateActionsList() {
|
||||||
console.log('updateActionsList');
|
console.log('updateActionsList');
|
||||||
|
|
||||||
this.$store.commit('resetSocialActionList');
|
this.$store.commit('resetActionsList');
|
||||||
|
|
||||||
this.socialIssuesSelected.forEach(item => {
|
this.socialIssuesSelected.forEach(item => {
|
||||||
console.log('for issue', item.id);
|
console.log('for issue', item.id);
|
||||||
@ -176,7 +182,7 @@ export default {
|
|||||||
.then(actions => new Promise((resolve, reject) => {
|
.then(actions => new Promise((resolve, reject) => {
|
||||||
|
|
||||||
actions.results.forEach(action => {
|
actions.results.forEach(action => {
|
||||||
this.$store.commit('addSocialActionInList', action);
|
this.$store.commit('addActionInList', action);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.$store.commit('filterList', 'actions');
|
this.$store.commit('filterList', 'actions');
|
||||||
@ -185,12 +191,6 @@ export default {
|
|||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
}, this);
|
}, this);
|
||||||
},
|
|
||||||
/* Update value for selected actions checkboxes
|
|
||||||
*/
|
|
||||||
updateSelectedAction(value) {
|
|
||||||
console.log('updateSelectedAction', value);
|
|
||||||
this.$store.dispatch('updateSocialActionsSelected', value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ const appMessages = {
|
|||||||
activity: {
|
activity: {
|
||||||
//
|
//
|
||||||
social_issues: "Problématiques sociales",
|
social_issues: "Problématiques sociales",
|
||||||
choose_other_social_issue: "ajouter une autre problématique sociale...",
|
choose_other_social_issue: "Ajouter une autre problématique sociale...",
|
||||||
social_actions: "Actions d'accompagnement",
|
social_actions: "Actions d'accompagnement",
|
||||||
select_first_a_social_issue: "Sélectionnez d'abord une problématique sociale",
|
select_first_a_social_issue: "Sélectionnez d'abord une problématique sociale",
|
||||||
|
|
||||||
|
@ -28,35 +28,35 @@ const store = createStore({
|
|||||||
mutations: {
|
mutations: {
|
||||||
|
|
||||||
// SocialIssueAcc
|
// SocialIssueAcc
|
||||||
addSocialIssueInList(state, issue) {
|
addIssueInList(state, issue) {
|
||||||
console.log('add list issue', issue.id);
|
console.log('add list issue', issue.id);
|
||||||
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
||||||
},
|
},
|
||||||
addSocialIssueSelected(state, issue) {
|
addIssueSelected(state, issue) {
|
||||||
console.log('add selected issue', issue.id);
|
console.log('add selected issue', issue.id);
|
||||||
state.activity.socialIssues.push(issue);
|
state.activity.socialIssues.push(issue);
|
||||||
},
|
},
|
||||||
updateSocialIssuesSelected(state, issues) {
|
updateIssuesSelected(state, issues) {
|
||||||
console.log('update selected issues', issues);
|
console.log('update selected issues', issues);
|
||||||
state.activity.socialIssues = issues;
|
state.activity.socialIssues = issues;
|
||||||
},
|
},
|
||||||
updateSocialIssuesOther(state, payload) {
|
updateIssuesOther(state, payload) {
|
||||||
console.log('update other issues');
|
console.log('update other issues');
|
||||||
state.socialIssuesOther = payload;
|
state.socialIssuesOther = payload;
|
||||||
},
|
},
|
||||||
removeSocialIssueInOther(state, issue) {
|
removeIssueInOther(state, issue) {
|
||||||
console.log('remove other issue', issue.id);
|
console.log('remove other issue', issue.id);
|
||||||
state.socialIssuesOther = state.socialIssuesOther.filter(item => item !== issue);
|
state.socialIssuesOther = state.socialIssuesOther.filter(item => item !== issue);
|
||||||
},
|
},
|
||||||
resetSocialActionList(state) {
|
resetActionsList(state) {
|
||||||
console.log('reset actions list');
|
console.log('reset actions list');
|
||||||
state.socialActionsList = [];
|
state.socialActionsList = [];
|
||||||
},
|
},
|
||||||
addSocialActionInList(state, action) {
|
addActionInList(state, action) {
|
||||||
console.log('add list action', action.id);
|
console.log('add list action', action.id);
|
||||||
state.socialActionsList.push(action);
|
state.socialActionsList.push(action);
|
||||||
},
|
},
|
||||||
updateSocialActionsSelected(state, actions) {
|
updateActionsSelected(state, actions) {
|
||||||
console.log('update selected actions', actions);
|
console.log('update selected actions', actions);
|
||||||
state.activity.socialActions = actions;
|
state.activity.socialActions = actions;
|
||||||
},
|
},
|
||||||
@ -110,14 +110,14 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addSocialIssueSelected({ commit }, issue) {
|
addIssueSelected({ commit }, issue) {
|
||||||
commit('addSocialIssueSelected', issue);
|
commit('addIssueSelected', issue);
|
||||||
},
|
},
|
||||||
updateSocialIssuesSelected({ commit }, payload) {
|
updateIssuesSelected({ commit }, payload) {
|
||||||
commit('updateSocialIssuesSelected', payload);
|
commit('updateIssuesSelected', payload);
|
||||||
},
|
},
|
||||||
updateSocialActionsSelected({ commit }, payload) {
|
updateActionsSelected({ commit }, payload) {
|
||||||
commit('updateSocialActionsSelected', payload);
|
commit('updateActionsSelected', payload);
|
||||||
},
|
},
|
||||||
addPersonsInvolved({ commit }, payload) {
|
addPersonsInvolved({ commit }, payload) {
|
||||||
//console.log('### action addPersonsInvolved', payload.result.type);
|
//console.log('### action addPersonsInvolved', payload.result.type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user