{{ "Timeslot selection" }}
{{ "You can add timeslots directly to the calendar or from the list down below." }}
-
participant.isCalendarShown,
- ).length >= this.participantScheduleColors.length
+ this.displayedParticipantSchedulesCount >=
+ this.participantScheduleColors.length
);
},
+ displayedParticipantSchedulesCount() {
+ return this.participants.filter(
+ (participant) => participant.isCalendarShown,
+ ).length;
+ },
},
watch: {
searchInput() {
@@ -143,7 +147,7 @@ export default {
if (!occupiedParticipantColor) return;
occupiedParticipantColor.uid = null;
},
- showCalendar(participantForCalendarToBeDisplayed) {
+ showSchedule(participantForCalendarToBeDisplayed) {
if (this.isMaxDisplayedParticipantSchedulesReached) return;
this.participants = this.participants.map((participant) => {
@@ -160,7 +164,7 @@ export default {
(participantColor) => !participantColor.uid,
).uid = participantForCalendarToBeDisplayed.uid;
},
- hideCalendar(participant) {
+ hideSchedule(participant) {
participant.isCalendarShown = false;
let occupiedParticipantColor = this.participantScheduleColors.find(
@@ -169,6 +173,14 @@ export default {
if (!occupiedParticipantColor) return;
occupiedParticipantColor.uid = null;
},
+ hideAllSchedules() {
+ this.participants.forEach((participant) => {
+ participant.isCalendarShown = false;
+ });
+ this.participantScheduleColors.forEach((participantColor) => {
+ participantColor.uid = null;
+ });
+ },
getParticipantScheduleColor(participant) {
return this.participantScheduleColors.find(
(participantColor) => participantColor.uid === participant.uid,
@@ -229,7 +241,7 @@ export default {
@@ -251,6 +263,14 @@ export default {
{{ "You can display no more participant schedules!" }}
+
+ {{ "Hide all participant schedules" }}
+
`,
};
diff --git a/public/js/directives/Calendar/Click.js b/public/js/directives/Calendar/Click.js
index e5de31f1a..d13e97076 100644
--- a/public/js/directives/Calendar/Click.js
+++ b/public/js/directives/Calendar/Click.js
@@ -9,10 +9,13 @@ function saveAddClickListener(el, source, value) {
const listener = evt => {
evt.preventDefault();
evt.stopPropagation();
+ if (typeof value === "function") {
+ value = value(evt);
+ }
const customEvent = new CustomEvent('cal-click', {
cancelable: true,
bubbles: true,
- detail: { source, value }
+ detail: { source, value },
});
evt.target.dispatchEvent(customEvent);
}