Use background events to show times blocked by parent reservations
This commit is contained in:
parent
cfdd261f13
commit
56bbe84249
@ -67,6 +67,7 @@ export function main(
|
|||||||
.filter(([shop_name, shop]) => shop.calendar !== undefined)
|
.filter(([shop_name, shop]) => shop.calendar !== undefined)
|
||||||
.forEach(([shop_name, shop], idx) => {
|
.forEach(([shop_name, shop], idx) => {
|
||||||
calendar.addEventSource({
|
calendar.addEventSource({
|
||||||
|
id: shop_name,
|
||||||
url: '/calendar/ical/' + shop.calendar + '/public/basic.ics',
|
url: '/calendar/ical/' + shop.calendar + '/public/basic.ics',
|
||||||
format: 'ics',
|
format: 'ics',
|
||||||
color: colors[idx],
|
color: colors[idx],
|
||||||
@ -91,6 +92,22 @@ export function main(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add background event if resource has children
|
||||||
|
let tool_resource = calendar.getResourceById(eventData.resourceId);
|
||||||
|
let children = tool_resource?.getChildren();
|
||||||
|
if (tool_resource && children?.length) {
|
||||||
|
let new_event = {
|
||||||
|
...eventData,
|
||||||
|
resourceIds: [
|
||||||
|
tool_resource.id,
|
||||||
|
...children.map((resource) => resource.id),
|
||||||
|
],
|
||||||
|
display: 'background',
|
||||||
|
};
|
||||||
|
calendar.addEvent(new_event, shop_name);
|
||||||
|
}
|
||||||
|
|
||||||
return eventData;
|
return eventData;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user