mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 09:03:48 +00:00
calendar app: set mainUser and options for form
This commit is contained in:
@@ -135,9 +135,9 @@ export default {
|
||||
setEventTimes({commit, state, getters}, {start, end}) {
|
||||
console.log('### action createEvent', {start, end});
|
||||
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
||||
startDateInput.value = datetimeToISO(start);
|
||||
startDateInput.value = null !== start ? datetimeToISO(start) : '';
|
||||
let endDateInput = document.getElementById("chill_activitybundle_activity_endDate");
|
||||
endDateInput.value = datetimeToISO(end);
|
||||
endDateInput.value = null !== end ? datetimeToISO(end) : '';
|
||||
let calendarRangeInput = document.getElementById("chill_activitybundle_activity_calendarRange");
|
||||
calendarRangeInput.value = "";
|
||||
|
||||
@@ -152,31 +152,40 @@ export default {
|
||||
associateCalendarToRange({state, commit, dispatch}, {range}) {
|
||||
console.log('### action associateCAlendarToRange', range);
|
||||
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
||||
startDateInput.value = datetimeToISO(range.start);
|
||||
startDateInput.value = null !== range ? datetimeToISO(range.start) : "";
|
||||
let endDateInput = document.getElementById("chill_activitybundle_activity_endDate");
|
||||
endDateInput.value = datetimeToISO(range.end);
|
||||
endDateInput.value = null !== range ? datetimeToISO(range.end) : "";
|
||||
let calendarRangeInput = document.getElementById("chill_activitybundle_activity_calendarRange");
|
||||
calendarRangeInput.value = Number(range.extendedProps.calendarRangeId);
|
||||
calendarRangeInput.value = null !== range ? Number(range.extendedProps.calendarRangeId) : "";
|
||||
|
||||
const userId = range.extendedProps.userId;
|
||||
if (state.activity.mainUser !== null && state.activity.mainUser.id !== userId) {
|
||||
dispatch('setMainUser', state.usersData.get(userId).user);
|
||||
if (null !== range) {
|
||||
const userId = range.extendedProps.userId;
|
||||
if (state.activity.mainUser !== null && state.activity.mainUser.id !== userId) {
|
||||
dispatch('setMainUser', state.usersData.get(userId).user);
|
||||
|
||||
// TODO: remove persons involved with this user
|
||||
// TODO: remove persons involved with this user
|
||||
}
|
||||
}
|
||||
|
||||
commit('associateCalendarToRange', {range});
|
||||
return Promise.resolve();
|
||||
},
|
||||
setMainUser({commit}, mainUser) {
|
||||
setMainUser({commit, dispatch, state}, mainUser) {
|
||||
console.log('setMainUser', mainUser);
|
||||
let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
|
||||
mainUserInput.value = Number(mainUser.id);
|
||||
if (state.activity.mainUser.id !== mainUser.id) {
|
||||
let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
|
||||
mainUserInput.value = Number(mainUser.id);
|
||||
|
||||
commit('setMainUser', mainUser);
|
||||
if (state.activity.calendarRange !== null || state.activity.startDate !== null || state.acdtivity.endDate !== null) {
|
||||
dispatch('associateCalendarToRange', { range: null });
|
||||
}
|
||||
|
||||
commit('setMainUser', mainUser);
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
|
||||
// Location
|
||||
updateLocation({commit}, value) {
|
||||
console.log('### action: updateLocation', value);
|
||||
|
@@ -48,6 +48,16 @@ export default {
|
||||
* @param range
|
||||
*/
|
||||
associateCalendarToRange(state, {range}) {
|
||||
console.log('associateCalendarToRange', range);
|
||||
|
||||
if (null === range) {
|
||||
state.activity.calendarRange = null;
|
||||
state.activity.startDate = null;
|
||||
state.activity.endDate = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('userId', range.extendedProps.userId);
|
||||
|
||||
const r = state.usersData.get(range.extendedProps.userId).calendarRanges
|
||||
|
@@ -67,6 +67,7 @@ const calendarRangeToFullCalendarEvent = (entity) => {
|
||||
}
|
||||
|
||||
const remoteToFullCalendarEvent = (entity) => {
|
||||
console.log(entity);
|
||||
return {
|
||||
id: `range_${entity.id}`,
|
||||
title: entity.title,
|
||||
|
Reference in New Issue
Block a user