mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
use the location from the calendar range, when associating a range with the calendar
This commit is contained in:
parent
71b6b158ba
commit
a5b5eea146
@ -149,7 +149,7 @@ export default {
|
||||
|
||||
commit('setEventTimes', {start, end});
|
||||
},
|
||||
associateCalendarToRange({state, commit, dispatch}, {range}) {
|
||||
associateCalendarToRange({state, commit, dispatch, getters}, {range}) {
|
||||
console.log('### action associateCAlendarToRange', range);
|
||||
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
||||
startDateInput.value = null !== range ? datetimeToISO(range.start) : "";
|
||||
@ -157,6 +157,13 @@ export default {
|
||||
endDateInput.value = null !== range ? datetimeToISO(range.end) : "";
|
||||
let calendarRangeInput = document.getElementById("chill_activitybundle_activity_calendarRange");
|
||||
calendarRangeInput.value = null !== range ? Number(range.extendedProps.calendarRangeId) : "";
|
||||
let location = getters.getLocationById(range.extendedProps.locationId);
|
||||
|
||||
if (null === location) {
|
||||
console.error("location not found!", range.extendedProps.locationId);
|
||||
}
|
||||
|
||||
dispatch('updateLocation', location);
|
||||
|
||||
if (null !== range) {
|
||||
const userId = range.extendedProps.userId;
|
||||
|
@ -192,6 +192,17 @@ export default {
|
||||
return k.remotes;
|
||||
},
|
||||
|
||||
getLocationById: (state) => (id) => {
|
||||
for (let group of state.availableLocations) {
|
||||
console.log('group', group);
|
||||
const found = group.locations.find(l => l.id === id);
|
||||
if (typeof found !== "undefined") {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
suggestedEntities(state, getters) {
|
||||
if (typeof (state.activity.accompanyingPeriod) === 'undefined') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user