mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
wip store mainUser in both store and input data with event
This commit is contained in:
parent
1eee8c6c49
commit
6144f2439a
@ -36,6 +36,7 @@ const store = createStore({
|
|||||||
activity: mapEntity(window.entity), // activity is the calendar entity actually
|
activity: mapEntity(window.entity), // activity is the calendar entity actually
|
||||||
currentEvent: null,
|
currentEvent: null,
|
||||||
availableLocations: [],
|
availableLocations: [],
|
||||||
|
mainUser: null
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
suggestedEntities(state) {
|
suggestedEntities(state) {
|
||||||
@ -94,6 +95,11 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
setMainUser(state, mainUser) {
|
||||||
|
if (state.mainUser === null || state.mainUser.id != mainUser.id) {
|
||||||
|
state.mainUser = mainUser;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// ConcernedGroups
|
// ConcernedGroups
|
||||||
addPersonsInvolved(state, payload) {
|
addPersonsInvolved(state, payload) {
|
||||||
@ -184,7 +190,7 @@ const store = createStore({
|
|||||||
//mainUserInput.value = payload.users.logged.id;
|
//mainUserInput.value = payload.users.logged.id;
|
||||||
commit('setEvents', payload);
|
commit('setEvents', payload);
|
||||||
},
|
},
|
||||||
updateEvent({ commit }, payload) {
|
updateEvent({ commit, dispatch }, payload) {
|
||||||
console.log('### action updateEvent', payload);
|
console.log('### action updateEvent', payload);
|
||||||
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
||||||
startDateInput.value = payload.event.start.toISOString();
|
startDateInput.value = payload.event.start.toISOString();
|
||||||
@ -192,10 +198,21 @@ const store = createStore({
|
|||||||
endDateInput.value = payload.event.end.toISOString();
|
endDateInput.value = payload.event.end.toISOString();
|
||||||
let calendarRangeInput = document.getElementById("chill_activitybundle_activity_calendarRange");
|
let calendarRangeInput = document.getElementById("chill_activitybundle_activity_calendarRange");
|
||||||
calendarRangeInput.value = Number(payload.event.extendedProps.calendarRangeId);
|
calendarRangeInput.value = Number(payload.event.extendedProps.calendarRangeId);
|
||||||
|
|
||||||
|
dispatch('setMainUser', payload.event.source);
|
||||||
//let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
|
//let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
|
||||||
//mainUserInput.value = Number(payload.event.source.id);
|
//mainUserInput.value = Number(payload.event.source.id);
|
||||||
commit('setEvents', payload);
|
commit('setEvents', payload);
|
||||||
},
|
},
|
||||||
|
setMainUser({ commit }, mainUser) {
|
||||||
|
const event = new CustomEvent('pick-entity-type-action', {detail: {
|
||||||
|
name: "chill_activitybundle_activity_mainUser",
|
||||||
|
entity: mainUser,
|
||||||
|
action: 'add'
|
||||||
|
}});
|
||||||
|
document.dispatchEvent(event);
|
||||||
|
commit('setMainUser', mainUser);
|
||||||
|
},
|
||||||
|
|
||||||
// Location
|
// Location
|
||||||
updateLocation({ commit }, value) {
|
updateLocation({ commit }, value) {
|
||||||
|
@ -101,7 +101,7 @@ document.addEventListener('show-hide-hide', function(e) {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('pick-entity-type', function (e) {
|
document.addEventListener('pick-entity-type-action', function (e) {
|
||||||
console.log('pick entity event', e);
|
console.log('pick entity event', e);
|
||||||
if (!appsPerInput.has(e.detail.name)) {
|
if (!appsPerInput.has(e.detail.name)) {
|
||||||
console.error('no app with this name');
|
console.error('no app with this name');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user