mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +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
|
||||
currentEvent: null,
|
||||
availableLocations: [],
|
||||
mainUser: null
|
||||
},
|
||||
getters: {
|
||||
suggestedEntities(state) {
|
||||
@ -94,6 +95,11 @@ const store = createStore({
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setMainUser(state, mainUser) {
|
||||
if (state.mainUser === null || state.mainUser.id != mainUser.id) {
|
||||
state.mainUser = mainUser;
|
||||
}
|
||||
},
|
||||
|
||||
// ConcernedGroups
|
||||
addPersonsInvolved(state, payload) {
|
||||
@ -184,7 +190,7 @@ const store = createStore({
|
||||
//mainUserInput.value = payload.users.logged.id;
|
||||
commit('setEvents', payload);
|
||||
},
|
||||
updateEvent({ commit }, payload) {
|
||||
updateEvent({ commit, dispatch }, payload) {
|
||||
console.log('### action updateEvent', payload);
|
||||
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
||||
startDateInput.value = payload.event.start.toISOString();
|
||||
@ -192,10 +198,21 @@ const store = createStore({
|
||||
endDateInput.value = payload.event.end.toISOString();
|
||||
let calendarRangeInput = document.getElementById("chill_activitybundle_activity_calendarRange");
|
||||
calendarRangeInput.value = Number(payload.event.extendedProps.calendarRangeId);
|
||||
|
||||
dispatch('setMainUser', payload.event.source);
|
||||
//let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
|
||||
//mainUserInput.value = Number(payload.event.source.id);
|
||||
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
|
||||
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);
|
||||
if (!appsPerInput.has(e.detail.name)) {
|
||||
console.error('no app with this name');
|
||||
|
Loading…
x
Reference in New Issue
Block a user