reformat to indentation 2

This commit is contained in:
Julien Fastré 2022-05-24 16:22:05 +02:00
parent 17778ab346
commit 352b5b41b0

View File

@ -24,12 +24,12 @@ import {datetimeToISO} from 'ChillMainAssets/chill/js/date';
const fetchings = new Set(); const fetchings = new Set();
export default { export default {
setCurrentDatesView({ commit, dispatch }, {start, end}) { setCurrentDatesView({commit, dispatch}, {start, end}) {
commit('setCurrentDatesView', {start, end}); commit('setCurrentDatesView', {start, end});
return dispatch('fetchCalendarEvents'); return dispatch('fetchCalendarEvents');
}, },
fetchCalendarEvents({ state, getters, dispatch }) { fetchCalendarEvents({state, getters, dispatch}) {
if (state.currentView.start === null && state.currentView.end === null) { if (state.currentView.start === null && state.currentView.end === null) {
return Promise.resolve(); return Promise.resolve();
} }
@ -61,7 +61,7 @@ export default {
return Promise.all(promises); return Promise.all(promises);
}, },
fetchCalendarRangeForUser({ commit, getters }, { user, start, end }) { fetchCalendarRangeForUser({commit, getters}, {user, start, end}) {
if (!getters.isCalendarRangeLoadedForUser({user, start, end})) { if (!getters.isCalendarRangeLoadedForUser({user, start, end})) {
return fetchCalendarRangeForUser(user, start, end).then((ranges) => { return fetchCalendarRangeForUser(user, start, end).then((ranges) => {
commit('addCalendarRangesForUser', {user, ranges, start, end}); commit('addCalendarRangesForUser', {user, ranges, start, end});
@ -70,7 +70,7 @@ export default {
}); });
} }
}, },
fetchCalendarRemotesForUser({ commit, getters }, { user, start, end }) { fetchCalendarRemotesForUser({commit, getters}, {user, start, end}) {
if (!getters.isCalendarRemoteLoadedForUser({user, start, end})) { if (!getters.isCalendarRemoteLoadedForUser({user, start, end})) {
return fetchCalendarRemoteForUser(user, start, end).then((remotes) => { return fetchCalendarRemoteForUser(user, start, end).then((remotes) => {
commit('addCalendarRemotesForUser', {user, remotes, start, end}); commit('addCalendarRemotesForUser', {user, remotes, start, end});
@ -79,7 +79,7 @@ export default {
}); });
} }
}, },
addPersonsInvolved({ commit, dispatch }, payload) { addPersonsInvolved({commit, dispatch}, payload) {
console.log('### action addPersonsInvolved', payload.result.type); console.log('### action addPersonsInvolved', payload.result.type);
switch (payload.result.type) { switch (payload.result.type) {
case 'person': case 'person':
@ -96,10 +96,11 @@ export default {
commit('showUserOnCalendar', {user: payload.result, ranges: false, remotes: true}); commit('showUserOnCalendar', {user: payload.result, ranges: false, remotes: true});
dispatch('fetchCalendarEvents'); dispatch('fetchCalendarEvents');
break; break;
}; }
;
commit('addPersonsInvolved', payload); commit('addPersonsInvolved', payload);
}, },
removePersonInvolved({ commit }, payload) { removePersonInvolved({commit}, payload) {
//console.log('### action removePersonInvolved', payload); //console.log('### action removePersonInvolved', payload);
switch (payload.type) { switch (payload.type) {
case 'person': case 'person':
@ -114,7 +115,8 @@ export default {
let aUsers = document.getElementById("chill_activitybundle_activity_users"); let aUsers = document.getElementById("chill_activitybundle_activity_users");
aUsers.value = removeIdFromValue(aUsers.value, payload.id); aUsers.value = removeIdFromValue(aUsers.value, payload.id);
break; break;
}; }
;
commit('removePersonInvolved', payload); commit('removePersonInvolved', payload);
}, },
@ -130,7 +132,7 @@ export default {
* @param start * @param start
* @param end * @param end
*/ */
setEventTimes({ commit, state, getters }, {start, end}) { setEventTimes({commit, state, getters}, {start, end}) {
console.log('### action createEvent', {start, end}); console.log('### action createEvent', {start, end});
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate"); let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
startDateInput.value = datetimeToISO(start); startDateInput.value = datetimeToISO(start);
@ -147,7 +149,7 @@ export default {
commit('setEventTimes', {start, end}); commit('setEventTimes', {start, end});
}, },
associateCalendarToRange({ state, commit, dispatch }, {range}) { associateCalendarToRange({state, commit, dispatch}, {range}) {
console.log('### action associateCAlendarToRange', range); console.log('### action associateCAlendarToRange', range);
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate"); let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
startDateInput.value = datetimeToISO(range.start); startDateInput.value = datetimeToISO(range.start);
@ -166,27 +168,17 @@ export default {
commit('associateCalendarToRange', {range}); commit('associateCalendarToRange', {range});
return Promise.resolve(); return Promise.resolve();
}, },
setMainUser({ commit }, mainUser) { setMainUser({commit}, mainUser) {
console.log('setMainUser', mainUser); console.log('setMainUser', mainUser);
let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser"); let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
mainUserInput.value = Number(mainUser.id); mainUserInput.value = Number(mainUser.id);
commit('setMainUser', mainUser); commit('setMainUser', mainUser);
/*
const event = new CustomEvent('pick-entity-type-action', {detail: {
name: "chill_activitybundle_activity_mainUser",
entity: toRaw(mainUser),
action: 'add'
}});
document.dispatchEvent(event);
commit('setMainUser', mainUser);
*/
}, },
// Location // Location
updateLocation({ commit }, value) { updateLocation({commit}, value) {
console.log('### action: updateLocation', value); console.log('### action: updateLocation', value);
let hiddenLocation = document.getElementById("chill_activitybundle_activity_location"); let hiddenLocation = document.getElementById("chill_activitybundle_activity_location");
if (value.onthefly) { if (value.onthefly) {