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