mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
rdv: simplify the vuejs component (removed not used parts)
This commit is contained in:
parent
43d6dc835f
commit
adc462b735
@ -2,7 +2,6 @@ import 'es6-promise/auto';
|
|||||||
import { createStore } from 'vuex';
|
import { createStore } from 'vuex';
|
||||||
|
|
||||||
const debug = process.env.NODE_ENV !== 'production';
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
//console.log('window.activity', window.activity);
|
|
||||||
|
|
||||||
const addIdToValue = (string, id) => {
|
const addIdToValue = (string, id) => {
|
||||||
let array = string ? string.split(',') : [];
|
let array = string ? string.split(',') : [];
|
||||||
@ -18,10 +17,8 @@ const removeIdFromValue = (string, id) => {
|
|||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const activity = {
|
const activity = {
|
||||||
accompanyingPeriod: null,
|
accompanyingPeriod: null,
|
||||||
socialIssues: [],
|
|
||||||
persons: [],
|
persons: [],
|
||||||
professionals: [],
|
professionals: [],
|
||||||
invites: []
|
invites: []
|
||||||
@ -31,60 +28,9 @@ const store = createStore({
|
|||||||
strict: debug,
|
strict: debug,
|
||||||
state: {
|
state: {
|
||||||
activity: activity,
|
activity: activity,
|
||||||
socialIssuesOther: [],
|
|
||||||
socialActionsList: [],
|
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
||||||
// SocialIssueAcc
|
|
||||||
addIssueInList(state, issue) {
|
|
||||||
//console.log('add issue list', issue.id);
|
|
||||||
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
|
||||||
},
|
|
||||||
addIssueSelected(state, issue) {
|
|
||||||
//console.log('add issue selected', issue.id);
|
|
||||||
state.activity.socialIssues.push(issue);
|
|
||||||
},
|
|
||||||
updateIssuesSelected(state, issues) {
|
|
||||||
//console.log('update issues selected', issues);
|
|
||||||
state.activity.socialIssues = issues;
|
|
||||||
},
|
|
||||||
updateIssuesOther(state, payload) {
|
|
||||||
//console.log('update issues other');
|
|
||||||
state.socialIssuesOther = payload;
|
|
||||||
},
|
|
||||||
removeIssueInOther(state, issue) {
|
|
||||||
//console.log('remove issue other', issue.id);
|
|
||||||
state.socialIssuesOther = state.socialIssuesOther.filter(i => i.id !== issue.id);
|
|
||||||
},
|
|
||||||
resetActionsList(state) {
|
|
||||||
//console.log('reset list actions');
|
|
||||||
state.socialActionsList = [];
|
|
||||||
},
|
|
||||||
addActionInList(state, action) {
|
|
||||||
//console.log('add action list', action.id);
|
|
||||||
state.socialActionsList.push(action);
|
|
||||||
},
|
|
||||||
updateActionsSelected(state, actions) {
|
|
||||||
//console.log('update actions selected', actions);
|
|
||||||
state.activity.socialActions = actions;
|
|
||||||
},
|
|
||||||
filterList(state, list) {
|
|
||||||
const filterList = (list) => {
|
|
||||||
// remove duplicates entries
|
|
||||||
list = list.filter((value, index) => list.findIndex(array => array.id === value.id) === index);
|
|
||||||
// alpha sort
|
|
||||||
list.sort((a,b) => (a.text > b.text) ? 1 : ((b.text > a.text) ? -1 : 0));
|
|
||||||
return list;
|
|
||||||
};
|
|
||||||
if (list === 'issues') {
|
|
||||||
state.activity.accompanyingPeriod.socialIssues = filterList(state.activity.accompanyingPeriod.socialIssues);
|
|
||||||
}
|
|
||||||
if (list === 'actions') {
|
|
||||||
state.socialActionsList = filterList(state.socialActionsList);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// ConcernedGroups
|
// ConcernedGroups
|
||||||
addPersonsInvolved(state, payload) {
|
addPersonsInvolved(state, payload) {
|
||||||
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
||||||
@ -116,27 +62,6 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addIssueSelected({ commit }, issue) {
|
|
||||||
let aSocialIssues = document.getElementById("chill_calendarbundle_calendar_socialIssues");
|
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
|
|
||||||
commit('addIssueSelected', issue);
|
|
||||||
},
|
|
||||||
updateIssuesSelected({ commit }, payload) {
|
|
||||||
let aSocialIssues = document.getElementById("chill_calendarbundle_calendar_socialIssues");
|
|
||||||
aSocialIssues.value = '';
|
|
||||||
payload.forEach(item => {
|
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, item.id);
|
|
||||||
});
|
|
||||||
commit('updateIssuesSelected', payload);
|
|
||||||
},
|
|
||||||
updateActionsSelected({ commit }, payload) {
|
|
||||||
let aSocialActions = document.getElementById("chill_calendarbundle_calendar_socialActions");
|
|
||||||
aSocialActions.value = '';
|
|
||||||
payload.forEach(item => {
|
|
||||||
aSocialActions.value = addIdToValue(aSocialActions.value, item.id);
|
|
||||||
});
|
|
||||||
commit('updateActionsSelected', payload);
|
|
||||||
},
|
|
||||||
addPersonsInvolved({ commit }, payload) {
|
addPersonsInvolved({ commit }, payload) {
|
||||||
console.log('### action addPersonsInvolved', payload.result.type);
|
console.log('### action addPersonsInvolved', payload.result.type);
|
||||||
switch (payload.result.type) {
|
switch (payload.result.type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user