@idea-ionic/agenda 6.13.0 → 7.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1064 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, NgModule } from '@angular/core';
3
- import * as i3$1 from '@angular/common';
4
- import { formatDate, CommonModule } from '@angular/common';
5
- import * as i5 from '@angular/forms';
6
- import { FormsModule } from '@angular/forms';
7
- import * as i2 from '@ionic/angular';
8
- import { IonicModule } from '@ionic/angular';
9
- import * as i4 from 'angular-calendar';
10
- import { CalendarDateFormatter, CalendarView, CalendarModule, DateAdapter } from 'angular-calendar';
11
- import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
12
- import * as i3 from '@idea-ionic/common';
13
- import { IDEASuggestionsComponent, IDEATranslationsModule, IDEAColorPickerModule, IDEACheckerModule, IDEAUserAvatarModule } from '@idea-ionic/common';
14
- import { Subject, fromEvent, finalize, takeUntil } from 'rxjs';
15
- import { isFuture, isToday, isSameDay, endOfWeek, addMinutes, addDays } from 'date-fns';
16
- import ColorParse from 'color-parse';
17
- import { __awaiter } from 'tslib';
18
- import { ExternalCalendarSources, Calendar, Suggestion, Check, ExternalCalendarInfo } from 'idea-toolbox';
19
- import { Browser } from '@capacitor/browser';
20
- import { environment } from '@env';
21
-
22
- class CustomDateFormatter extends CalendarDateFormatter {
23
- constructor() {
24
- super(...arguments);
25
- // MONTH VIEW
26
- this.monthViewColumnHeader = ({ date, locale }) => formatDate(date, 'EEE', locale);
27
- this.monthViewTitle = ({ date, locale }) => formatDate(date, 'MMMM y', locale);
28
- // WEEK VIEW
29
- this.weekViewHour = ({ date, locale }) => locale === 'it' ? formatDate(date, 'HH:mm', locale) : formatDate(date, 'h aa', locale);
30
- this.weekViewColumnHeader = ({ date, locale }) => formatDate(date, 'EEE', locale);
31
- this.weekViewTitle = ({ date, locale }) => formatDate(date, 'MMMM yyyy', locale);
32
- // DAY VIEW
33
- this.dayViewHour = ({ date, locale }) => locale === 'it' ? formatDate(date, 'HH:mm', locale) : formatDate(date, 'h aa', locale);
34
- this.dayViewTitle = ({ date, locale }) => locale === 'it' ? formatDate(date, 'EEEE, dd MMM yyyy', locale) : formatDate(date, 'EEEE, MMM dd, yyyy', locale);
35
- }
36
- }
37
- CustomDateFormatter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CustomDateFormatter, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
38
- CustomDateFormatter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CustomDateFormatter });
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CustomDateFormatter, decorators: [{
40
- type: Injectable
41
- }] });
42
-
43
- class IDEAAgendaComponent {
44
- constructor(cdr, platform, t) {
45
- this.cdr = cdr;
46
- this.platform = platform;
47
- this.t = t;
48
- /**
49
- * The events to display in the calendar.
50
- */
51
- this.events = [];
52
- /**
53
- * An array of day indexes (0 = sunday, 1 = monday, etc.) that will be hidden on the view.
54
- */
55
- this.excludeDays = [];
56
- /**
57
- * The day start hours in 24 hour time. Must be 0-23
58
- */
59
- this.dayStartHour = 0;
60
- /**
61
- * The day start hours in 24 hour time. Must be 0-23
62
- */
63
- this.dayEndHour = 23;
64
- /**
65
- * The number of segments in an hour. Must divide equally into 60.
66
- */
67
- this.hourSegments = 2;
68
- /**
69
- * Whether to open the current day's details right away in month view.
70
- */
71
- this.activeDayIsOpen = false;
72
- /**
73
- * The view mode for the agenda.
74
- */
75
- this.view = CalendarView.Week;
76
- /**
77
- * The allowed view mode for the agenda.
78
- */
79
- this.allowedViews = [CalendarView.Day, CalendarView.Week, CalendarView.Month];
80
- /**
81
- * Whether to block any day/slot in the past.
82
- */
83
- this.onlyFuture = false;
84
- /**
85
- * The template for new events created by drag&drop.
86
- */
87
- this.newEventTemplate = { title: 'New', start: null, meta: {} };
88
- /**
89
- * Whether (and how) to allow the creation of events by drag&drop.
90
- * If enabled, on mobile it requires the `parentContent` to be set for a correct execution.
91
- */
92
- this.allowDragToCreate = DragToCreateOptions.DISABLED;
93
- /**
94
- * Trigger when an event is selected.
95
- */
96
- this.selectEvent = new EventEmitter();
97
- /**
98
- * Trigger when a day is selected.
99
- */
100
- this.selectDay = new EventEmitter();
101
- /**
102
- * Trigger when a time slot is selected.
103
- */
104
- this.selectSlot = new EventEmitter();
105
- /**
106
- * Trigger when a new event is added by drag and drop.
107
- */
108
- this.newEventByDrag = new EventEmitter();
109
- /**
110
- * Trigger when an event changed date (drag&drop or resize).
111
- */
112
- this.changeEvent = new EventEmitter();
113
- /**
114
- * Trigger when the view date of reference changed (because we moved inside the calendar).
115
- */
116
- this.changeDate = new EventEmitter();
117
- /**
118
- * Trigger before the rendering of the week or day view.
119
- */
120
- this.beforeWeekOrDayViewRenderEmitter = new EventEmitter();
121
- /**
122
- * Trigger before the rendering of the month view.
123
- */
124
- this.beforeMonthViewRenderEmitter = new EventEmitter();
125
- /**
126
- * Helper to use the enum in the UX.
127
- */
128
- this.CalendarView = CalendarView;
129
- /**
130
- * The currently selected date.
131
- */
132
- this.viewDate = new Date();
133
- /**
134
- * A controller to refresh the current view.
135
- */
136
- this.refresh = new Subject();
137
- this.Attendance = EventAttendance;
138
- this.darkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
139
- }
140
- ngOnInit() {
141
- this.locale = this.t.getCurrentLang();
142
- // in case of Italian locale the starting day for the week is monday (1), otherwise sunday (0)
143
- this.weekStartsOn = this.locale === 'it' ? 1 : 0;
144
- }
145
- isMobile() {
146
- return this.platform.is('mobile');
147
- }
148
- /**
149
- * Run some checks before the month view is rendered (e.g. disable invalid days).
150
- */
151
- beforeMonthViewRender(event) {
152
- this.beforeMonthViewRenderEmitter.emit(event);
153
- const { body } = event;
154
- body.forEach(day => {
155
- if (!this.dateIsValid(day.date))
156
- day.cssClass = 'cal-disabled';
157
- });
158
- }
159
- /**
160
- * Run some checks before the week/day view is rendered (e.g. disable invalid days).
161
- */
162
- beforeWeekOrDayViewRender(event) {
163
- this.beforeWeekOrDayViewRenderEmitter.emit(event);
164
- const { header, hourColumns } = event;
165
- header.forEach(day => {
166
- if (!this.dateIsValid(day.date))
167
- day.cssClass = 'cal-disabled';
168
- });
169
- hourColumns.forEach(hourCol => {
170
- hourCol.hours.forEach(hour => {
171
- hour.segments.forEach(segment => {
172
- if (!this.dateIsValid(segment.date))
173
- segment.cssClass = 'cal-disabled';
174
- });
175
- });
176
- });
177
- }
178
- /**
179
- * Check whether a date is valid based on the configured parameters.
180
- */
181
- dateIsValid(date, sameDayIsValid) {
182
- if (!this.onlyFuture)
183
- return true;
184
- return isFuture(date) || (sameDayIsValid ? isToday(date) : false);
185
- }
186
- /**
187
- * Change the current view for the agenda.
188
- */
189
- setView(view) {
190
- this.view = view;
191
- }
192
- /**
193
- * Emit the change of the view date and close the detail component of the month view, if needed.
194
- */
195
- viewDateChanged(newDate) {
196
- if (this.view === CalendarView.Month)
197
- this.activeDayIsOpen = false;
198
- this.changeDate.emit(newDate);
199
- }
200
- /**
201
- * A day was selected: manage the detailed view.
202
- */
203
- changeDay({ date, events }) {
204
- // skip if the date isn't valid
205
- if (!this.dateIsValid(date, true))
206
- return;
207
- // if the selected day changed, if the new day has events, open the details in month view (otherwise close them)
208
- if ((isSameDay(this.viewDate, date) && this.activeDayIsOpen === true) || !events || events.length === 0)
209
- this.activeDayIsOpen = false;
210
- else
211
- this.activeDayIsOpen = true;
212
- // update the current date in the agenda
213
- this.viewDate = date;
214
- }
215
- /**
216
- * The time of an event was changed.
217
- */
218
- eventTimesChanged({ event, newStart, newEnd }) {
219
- // update the event
220
- event.start = newStart;
221
- event.end = newEnd;
222
- // re-map the array to trigger the UI refresh
223
- this.events = this.events.slice();
224
- // trigger the event to the parent component
225
- this.changeEvent.emit(event);
226
- }
227
- /**
228
- * Given a color, it returns an opaque version of it.
229
- */
230
- getAlternateColor(color, amount, opacity) {
231
- if (!(color === null || color === void 0 ? void 0 : color.trim()))
232
- return undefined;
233
- const alt = ColorParse(color.trim());
234
- const r = Math.max(Math.min(255, Number(alt.values[0]) + amount), 0);
235
- const g = Math.max(Math.min(255, Number(alt.values[1]) + amount), 0);
236
- const b = Math.max(Math.min(255, Number(alt.values[2]) + amount), 0);
237
- return `rgba(${r}, ${g}, ${b}, ${opacity || 1})`;
238
- }
239
- /**
240
- * Get the content of the tooltip based on the event.
241
- */
242
- getTooltipContent(event) {
243
- if (!event)
244
- return '';
245
- let str = event.title ? '<b>' + event.title + '</b>' : '';
246
- if (event.description)
247
- str = str.concat('<br>', event.description);
248
- if (event.icons)
249
- event.icons.forEach(x => (str = str.concat('<br>', '<i>', x.title, '</i>')));
250
- if (event.avatars && event.avatars.length) {
251
- str = str.concat('<br><br>~');
252
- event.avatars.forEach(x => (str = str.concat('<br>', x.title)));
253
- }
254
- return str;
255
- }
256
- /**
257
- * Get a shortened version of the description as preview.
258
- */
259
- getPreviewDescription(description) {
260
- return description && description.length > 100 ? description.slice(0, 100).concat('...') : description;
261
- }
262
- /**
263
- * Handle the drag&drop to create a new event.
264
- */
265
- startDragToCreate(event, segmentDate, segmentElement) {
266
- if (!this.allowDragToCreate)
267
- return;
268
- if (this.parentContent)
269
- this.parentContent.scrollY = false;
270
- const eventByDragAndDrop = Object.assign(Object.assign({}, this.newEventTemplate), { start: segmentDate });
271
- this.events = [...this.events, eventByDragAndDrop];
272
- const segmentPosition = segmentElement.getBoundingClientRect();
273
- const endOfView = endOfWeek(this.viewDate, { weekStartsOn: this.weekStartsOn });
274
- const whileDragging = (draggingEvent) => {
275
- const { clientY, clientX } = draggingEvent.type === 'touchmove' ? draggingEvent.touches[0] : draggingEvent;
276
- const minutesDiff = ceilToNearest(clientY - segmentPosition.top, 30);
277
- const daysDiff = floorToNearest(clientX - segmentPosition.left, segmentPosition.width) / segmentPosition.width;
278
- let newEnd;
279
- if (this.allowDragToCreate === DragToCreateOptions.ONLY_SAME_DAY)
280
- newEnd = addMinutes(segmentDate, minutesDiff);
281
- else
282
- newEnd = addDays(addMinutes(segmentDate, minutesDiff), daysDiff);
283
- if (newEnd > segmentDate && newEnd < endOfView)
284
- eventByDragAndDrop.end = newEnd;
285
- refreshView();
286
- };
287
- const endOfDrag = () => {
288
- if (this.parentContent)
289
- this.parentContent.scrollY = true;
290
- eventByDragAndDrop.end = this.getFixedEndDateWithMinimumSegmentDuration(eventByDragAndDrop);
291
- refreshView();
292
- this.newEventByDrag.emit(eventByDragAndDrop);
293
- };
294
- const refreshView = () => {
295
- this.events = [...this.events];
296
- this.cdr.detectChanges();
297
- };
298
- if (event.type === 'touchstart') {
299
- fromEvent(document, 'touchmove')
300
- .pipe(finalize(endOfDrag), takeUntil(fromEvent(document, 'touchend')))
301
- .subscribe(whileDragging);
302
- }
303
- else {
304
- fromEvent(document, 'mousemove')
305
- .pipe(finalize(endOfDrag), takeUntil(fromEvent(document, 'mouseup')))
306
- .subscribe(whileDragging);
307
- }
308
- }
309
- getFixedEndDateWithMinimumSegmentDuration(agendaBooking) {
310
- var _a;
311
- const fixedEnd = new Date((_a = agendaBooking.end) !== null && _a !== void 0 ? _a : agendaBooking.start);
312
- const segmentSizeInMinutes = 60 / this.hourSegments;
313
- if (fixedEnd.getTime() <= agendaBooking.start.getTime() + segmentSizeInMinutes * 60 * 1000)
314
- fixedEnd.setMinutes(agendaBooking.start.getMinutes() + segmentSizeInMinutes);
315
- return fixedEnd;
316
- }
317
- }
318
- IDEAAgendaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEAAgendaComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2.Platform }, { token: i3.IDEATranslationsService }], target: i0.ɵɵFactoryTarget.Component });
319
- IDEAAgendaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: IDEAAgendaComponent, selector: "idea-agenda", inputs: { events: "events", excludeDays: "excludeDays", dayStartHour: "dayStartHour", dayEndHour: "dayEndHour", hourSegments: "hourSegments", activeDayIsOpen: "activeDayIsOpen", view: "view", allowedViews: "allowedViews", onlyFuture: "onlyFuture", titleNotes: "titleNotes", newEventTemplate: "newEventTemplate", allowDragToCreate: "allowDragToCreate", parentContent: "parentContent" }, outputs: { selectEvent: "selectEvent", selectDay: "selectDay", selectSlot: "selectSlot", newEventByDrag: "newEventByDrag", changeEvent: "changeEvent", changeDate: "changeDate", beforeWeekOrDayViewRenderEmitter: "beforeWeekOrDayViewRenderEmitter", beforeMonthViewRenderEmitter: "beforeMonthViewRenderEmitter" }, ngImport: i0, template: "<div class=\"agenda\">\n <!-- TOOLBAR -->\n <ion-row class=\"ion-align-items-center\">\n <ion-col\n class=\"ion-align-self-center ion-text-right\"\n [size]=\"5\"\n [sizeSm]=\"3\"\n [pushSm]=\"5\"\n [sizeLg]=\"2\"\n [pushLg]=\"8\"\n >\n <ion-item lines=\"none\" class=\"calendarViewSelector\" *ngIf=\"allowedViews.length > 1\">\n <ion-select\n interface=\"popover\"\n [value]=\"view\"\n (ionChange)=\"$event?.detail ? setView($event.detail.value) : null\"\n >\n <ion-select-option *ngFor=\"let view of allowedViews\" [value]=\"view\">\n {{ 'IDEA_AGENDA.' + view | uppercase | translate }}\n </ion-select-option>\n </ion-select>\n </ion-item>\n </ion-col>\n <ion-col\n class=\"ion-align-self-center ion-text-right\"\n [size]=\"7\"\n [sizeSm]=\"4\"\n [pushSm]=\"5\"\n [sizeLg]=\"2\"\n [pushLg]=\"8\"\n >\n <ion-button\n fill=\"clear\"\n color=\"dark\"\n size=\"small\"\n mwlCalendarPreviousView\n [view]=\"view\"\n [(viewDate)]=\"viewDate\"\n (viewDateChange)=\"viewDateChanged($event)\"\n >\n <ion-icon name=\"chevron-back-outline\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n <ion-button\n fill=\"clear\"\n color=\"dark\"\n size=\"small\"\n mwlCalendarToday\n [(viewDate)]=\"viewDate\"\n (viewDateChange)=\"viewDateChanged($event)\"\n >\n <ion-icon name=\"today-outline\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n <ion-button\n fill=\"clear\"\n color=\"dark\"\n size=\"small\"\n mwlCalendarNextView\n [view]=\"view\"\n [(viewDate)]=\"viewDate\"\n (viewDateChange)=\"viewDateChanged($event)\"\n >\n <ion-icon name=\"chevron-forward-outline\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col class=\"ion-align-self-center titleCol\" [size]=\"12\" [sizeSm]=\"5\" [pullSm]=\"7\" [sizeLg]=\"8\" [pullLg]=\"4\">\n <h2>{{ viewDate | calendarDate : view + 'ViewTitle' : locale }}</h2>\n <p *ngIf=\"titleNotes\">{{ titleNotes }}</p>\n </ion-col>\n </ion-row>\n <!-- TEMPLATES (touch only what's necessary and leave everything else as it is) -->\n <ng-template #eventTitleTemplate let-event=\"event\" let-view=\"view\">\n <span\n class=\"cal-event-title\"\n [class.noWrap]=\"event.allDay\"\n [attr.aria-hidden]=\"{} | calendarA11y : 'hideEventTitle'\"\n >\n {{ event.title | calendarEventTitle : view : event }}\n <p *ngIf=\"!event.allDay\">{{ getPreviewDescription(event.description) }}</p>\n </span>\n </ng-template>\n <ng-template\n #eventTemplate\n let-weekEvent=\"weekEvent\"\n let-tooltipPlacement=\"tooltipPlacement\"\n let-eventClicked=\"eventClicked\"\n let-tooltipTemplate=\"tooltipTemplate\"\n let-tooltipAppendToBody=\"tooltipAppendToBody\"\n let-tooltipDisabled=\"tooltipDisabled\"\n let-tooltipDelay=\"tooltipDelay\"\n let-column=\"column\"\n let-daysInWeek=\"daysInWeek\"\n >\n <div\n class=\"cal-event\"\n [class.external]=\"weekEvent.event.external\"\n [class.needsAction]=\"Attendance.NEEDS_ACTION === weekEvent.event.attendance\"\n [class.declined]=\"Attendance.DECLINED === weekEvent.event.attendance\"\n [class.tentative]=\"Attendance.TENTATIVE === weekEvent.event.attendance\"\n [style.border-left-color]=\"weekEvent.event.color?.primary\"\n [style.color]=\"getAlternateColor(weekEvent.event.color?.primary, darkMode ? 80 : -40)\"\n [style.background-color]=\"getAlternateColor(weekEvent.event.color?.primary, darkMode ? 60 : 80, 0.2)\"\n [mwlCalendarTooltip]=\"!tooltipDisabled && !isMobile() ? getTooltipContent(weekEvent.event) : ''\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipEvent]=\"weekEvent.tempEvent || weekEvent.event\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipAppendToBody]=\"tooltipAppendToBody\"\n [tooltipDelay]=\"tooltipDelay\"\n (mwlClick)=\"eventClicked.emit({ sourceEvent: $event })\"\n (mwlKeydownEnter)=\"eventClicked.emit({ sourceEvent: $event })\"\n tabindex=\"0\"\n role=\"application\"\n [attr.aria-label]=\"\n { event: weekEvent.tempEvent || weekEvent.event, locale: locale } | calendarA11y : 'eventDescription'\n \"\n >\n <mwl-calendar-event-actions [event]=\"weekEvent.tempEvent || weekEvent.event\"></mwl-calendar-event-actions>\n &ngsp;\n <mwl-calendar-event-title\n [event]=\"weekEvent.tempEvent || weekEvent.event\"\n [customTemplate]=\"eventTitleTemplate\"\n [view]=\"daysInWeek === 1 ? 'day' : 'week'\"\n >\n </mwl-calendar-event-title>\n <div class=\"eventGadgets\" *ngIf=\"!weekEvent.event.allDay\">\n <ion-icon *ngFor=\"let icon of weekEvent.event.icons\" [name]=\"icon.name\" [title]=\"icon.title\"></ion-icon>\n <idea-user-avatar\n size=\"mini\"\n *ngFor=\"let avatar of weekEvent.event.avatars\"\n [src]=\"avatar.url\"\n [name]=\"avatar.title\"\n ></idea-user-avatar>\n </div>\n </div>\n </ng-template>\n <ng-template\n #hourSegmentTemplate\n let-segment=\"segment\"\n let-locale=\"locale\"\n let-segmentHeight=\"segmentHeight\"\n let-isTimeLabel=\"isTimeLabel\"\n >\n <div\n #segmentElement\n class=\"cal-hour-segment\"\n [style.height.px]=\"segmentHeight\"\n [class.cal-hour-start]=\"segment.isStart\"\n [class.cal-after-hour-start]=\"!segment.isStart\"\n [ngClass]=\"segment.cssClass\"\n (mousedown)=\"allowDragToCreate ? startDragToCreate($event, segment.date, segmentElement) : null\"\n (touchstart)=\"allowDragToCreate ? startDragToCreate($event, segment.date, segmentElement) : null\"\n >\n <div class=\"cal-time\" *ngIf=\"isTimeLabel\">\n {{ segment.date | calendarDate : 'weekViewHour' : locale }}\n </div>\n </div>\n </ng-template>\n <!-- VIEWS -->\n <div [ngSwitch]=\"view\">\n <mwl-calendar-month-view\n *ngSwitchCase=\"CalendarView.Month\"\n [viewDate]=\"viewDate\"\n [events]=\"events\"\n [refresh]=\"refresh\"\n [activeDayIsOpen]=\"activeDayIsOpen\"\n [locale]=\"locale\"\n [excludeDays]=\"excludeDays\"\n [weekStartsOn]=\"weekStartsOn\"\n [eventTitleTemplate]=\"eventTitleTemplate\"\n (eventClicked)=\"selectEvent.emit($event.event)\"\n (eventTimesChanged)=\"eventTimesChanged($event)\"\n (dayClicked)=\"changeDay($event.day)\"\n (beforeViewRender)=\"beforeMonthViewRender($event)\"\n >\n </mwl-calendar-month-view>\n <mwl-calendar-week-view\n *ngSwitchCase=\"CalendarView.Week\"\n [viewDate]=\"viewDate\"\n [events]=\"events\"\n [refresh]=\"refresh\"\n [locale]=\"locale\"\n [excludeDays]=\"excludeDays\"\n [weekStartsOn]=\"weekStartsOn\"\n [dayStartHour]=\"dayStartHour\"\n [dayEndHour]=\"dayEndHour\"\n [hourSegments]=\"hourSegments\"\n [eventTemplate]=\"eventTemplate\"\n [hourSegmentTemplate]=\"hourSegmentTemplate\"\n (eventClicked)=\"selectEvent.emit($event.event)\"\n (eventTimesChanged)=\"eventTimesChanged($event)\"\n (dayHeaderClicked)=\"dateIsValid($event.day.date) ? selectDay.emit($event.day.date) : null\"\n (hourSegmentClicked)=\"dateIsValid($event.date) ? selectSlot.emit($event.date) : null\"\n (beforeViewRender)=\"beforeWeekOrDayViewRender($event)\"\n >\n </mwl-calendar-week-view>\n <mwl-calendar-day-view\n *ngSwitchCase=\"CalendarView.Day\"\n [viewDate]=\"viewDate\"\n [events]=\"events\"\n [refresh]=\"refresh\"\n [locale]=\"locale\"\n [dayStartHour]=\"dayStartHour\"\n [dayEndHour]=\"dayEndHour\"\n [hourSegments]=\"hourSegments\"\n [eventTemplate]=\"eventTemplate\"\n [hourSegmentTemplate]=\"hourSegmentTemplate\"\n (eventClicked)=\"selectEvent.emit($event.event)\"\n (eventTimesChanged)=\"eventTimesChanged($event)\"\n (hourSegmentClicked)=\"dateIsValid($event.date) ? selectSlot.emit($event.date) : null\"\n (beforeViewRender)=\"beforeWeekOrDayViewRender($event)\"\n >\n </mwl-calendar-day-view>\n </div>\n</div>\n", styles: [".agenda{margin-top:15px}.agenda ion-col.titleCol{padding-left:8px}.agenda ion-col.titleCol h2,.agenda ion-col.titleCol p{margin:0}.agenda ion-col.titleCol h2{font-size:1.2em}.agenda ion-col.titleCol p{font-size:.8em;font-style:italic}.agenda .calendarViewSelector{background-color:transparent;--ion-background-color: transparent;--background: transparent}.agenda .calendarViewSelector ion-select{max-width:100%;width:100%;padding-left:0;font-weight:500}.agenda .eventGadgets{margin-top:4px;margin-left:5px;text-align:right}.agenda .eventGadgets idea-user-avatar{display:block;float:left;margin:2px 1px}.agenda .eventGadgets ion-icon{padding-right:2px;opacity:.7;font-size:1.15em}@media only screen and (max-width: 575px){.agenda ion-col.titleCol{padding:0 8px 12px;text-align:center}}\n"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "component", type: i2.IonSelect, selector: "ion-select", inputs: ["cancelText", "compareWith", "disabled", "interface", "interfaceOptions", "mode", "multiple", "name", "okText", "placeholder", "selectedText", "value"] }, { kind: "component", type: i2.IonSelectOption, selector: "ion-select-option", inputs: ["disabled", "value"] }, { kind: "directive", type: i2.SelectValueAccessor, selector: "ion-range, ion-select, ion-radio-group, ion-segment, ion-datetime" }, { kind: "component", type: i3.IDEAUserAvatarComponent, selector: "idea-user-avatar", inputs: ["src", "name", "size", "color"] }, { kind: "component", type: i4.ɵCalendarEventActionsComponent, selector: "mwl-calendar-event-actions", inputs: ["event", "customTemplate"] }, { kind: "component", type: i4.ɵCalendarEventTitleComponent, selector: "mwl-calendar-event-title", inputs: ["event", "customTemplate", "view"] }, { kind: "directive", type: i4.ɵCalendarTooltipDirective, selector: "[mwlCalendarTooltip]", inputs: ["mwlCalendarTooltip", "tooltipPlacement", "tooltipTemplate", "tooltipEvent", "tooltipAppendToBody", "tooltipDelay"] }, { kind: "directive", type: i4.ɵCalendarPreviousViewDirective, selector: "[mwlCalendarPreviousView]", inputs: ["view", "viewDate", "excludeDays", "daysInWeek"], outputs: ["viewDateChange"] }, { kind: "directive", type: i4.ɵCalendarNextViewDirective, selector: "[mwlCalendarNextView]", inputs: ["view", "viewDate", "excludeDays", "daysInWeek"], outputs: ["viewDateChange"] }, { kind: "directive", type: i4.ɵCalendarTodayDirective, selector: "[mwlCalendarToday]", inputs: ["viewDate"], outputs: ["viewDateChange"] }, { kind: "directive", type: i4.ɵClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "directive", type: i4.ɵKeydownEnterDirective, selector: "[mwlKeydownEnter]", outputs: ["mwlKeydownEnter"] }, { kind: "component", type: i4.CalendarMonthViewComponent, selector: "mwl-calendar-month-view", inputs: ["viewDate", "events", "excludeDays", "activeDayIsOpen", "activeDay", "refresh", "locale", "tooltipPlacement", "tooltipTemplate", "tooltipAppendToBody", "tooltipDelay", "weekStartsOn", "headerTemplate", "cellTemplate", "openDayEventsTemplate", "eventTitleTemplate", "eventActionsTemplate", "weekendDays"], outputs: ["beforeViewRender", "dayClicked", "eventClicked", "columnHeaderClicked", "eventTimesChanged"] }, { kind: "component", type: i4.CalendarWeekViewComponent, selector: "mwl-calendar-week-view", inputs: ["viewDate", "events", "excludeDays", "refresh", "locale", "tooltipPlacement", "tooltipTemplate", "tooltipAppendToBody", "tooltipDelay", "weekStartsOn", "headerTemplate", "eventTemplate", "eventTitleTemplate", "eventActionsTemplate", "precision", "weekendDays", "snapDraggedEvents", "hourSegments", "hourDuration", "hourSegmentHeight", "minimumEventHeight", "dayStartHour", "dayStartMinute", "dayEndHour", "dayEndMinute", "hourSegmentTemplate", "eventSnapSize", "allDayEventsLabelTemplate", "daysInWeek", "currentTimeMarkerTemplate", "validateEventTimesChanged"], outputs: ["dayHeaderClicked", "eventClicked", "eventTimesChanged", "beforeViewRender", "hourSegmentClicked"] }, { kind: "component", type: i4.CalendarDayViewComponent, selector: "mwl-calendar-day-view", inputs: ["viewDate", "events", "hourSegments", "hourSegmentHeight", "hourDuration", "minimumEventHeight", "dayStartHour", "dayStartMinute", "dayEndHour", "dayEndMinute", "refresh", "locale", "eventSnapSize", "tooltipPlacement", "tooltipTemplate", "tooltipAppendToBody", "tooltipDelay", "hourSegmentTemplate", "eventTemplate", "eventTitleTemplate", "eventActionsTemplate", "snapDraggedEvents", "allDayEventsLabelTemplate", "currentTimeMarkerTemplate", "validateEventTimesChanged"], outputs: ["eventClicked", "hourSegmentClicked", "eventTimesChanged", "beforeViewRender"] }, { kind: "pipe", type: i3$1.UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i3.IDEATranslatePipe, name: "translate" }, { kind: "pipe", type: i4.ɵCalendarDatePipe, name: "calendarDate" }, { kind: "pipe", type: i4.ɵCalendarEventTitlePipe, name: "calendarEventTitle" }, { kind: "pipe", type: i4.ɵCalendarA11yPipe, name: "calendarA11y" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEAAgendaComponent, decorators: [{
321
- type: Component,
322
- args: [{ selector: 'idea-agenda', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"agenda\">\n <!-- TOOLBAR -->\n <ion-row class=\"ion-align-items-center\">\n <ion-col\n class=\"ion-align-self-center ion-text-right\"\n [size]=\"5\"\n [sizeSm]=\"3\"\n [pushSm]=\"5\"\n [sizeLg]=\"2\"\n [pushLg]=\"8\"\n >\n <ion-item lines=\"none\" class=\"calendarViewSelector\" *ngIf=\"allowedViews.length > 1\">\n <ion-select\n interface=\"popover\"\n [value]=\"view\"\n (ionChange)=\"$event?.detail ? setView($event.detail.value) : null\"\n >\n <ion-select-option *ngFor=\"let view of allowedViews\" [value]=\"view\">\n {{ 'IDEA_AGENDA.' + view | uppercase | translate }}\n </ion-select-option>\n </ion-select>\n </ion-item>\n </ion-col>\n <ion-col\n class=\"ion-align-self-center ion-text-right\"\n [size]=\"7\"\n [sizeSm]=\"4\"\n [pushSm]=\"5\"\n [sizeLg]=\"2\"\n [pushLg]=\"8\"\n >\n <ion-button\n fill=\"clear\"\n color=\"dark\"\n size=\"small\"\n mwlCalendarPreviousView\n [view]=\"view\"\n [(viewDate)]=\"viewDate\"\n (viewDateChange)=\"viewDateChanged($event)\"\n >\n <ion-icon name=\"chevron-back-outline\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n <ion-button\n fill=\"clear\"\n color=\"dark\"\n size=\"small\"\n mwlCalendarToday\n [(viewDate)]=\"viewDate\"\n (viewDateChange)=\"viewDateChanged($event)\"\n >\n <ion-icon name=\"today-outline\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n <ion-button\n fill=\"clear\"\n color=\"dark\"\n size=\"small\"\n mwlCalendarNextView\n [view]=\"view\"\n [(viewDate)]=\"viewDate\"\n (viewDateChange)=\"viewDateChanged($event)\"\n >\n <ion-icon name=\"chevron-forward-outline\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col class=\"ion-align-self-center titleCol\" [size]=\"12\" [sizeSm]=\"5\" [pullSm]=\"7\" [sizeLg]=\"8\" [pullLg]=\"4\">\n <h2>{{ viewDate | calendarDate : view + 'ViewTitle' : locale }}</h2>\n <p *ngIf=\"titleNotes\">{{ titleNotes }}</p>\n </ion-col>\n </ion-row>\n <!-- TEMPLATES (touch only what's necessary and leave everything else as it is) -->\n <ng-template #eventTitleTemplate let-event=\"event\" let-view=\"view\">\n <span\n class=\"cal-event-title\"\n [class.noWrap]=\"event.allDay\"\n [attr.aria-hidden]=\"{} | calendarA11y : 'hideEventTitle'\"\n >\n {{ event.title | calendarEventTitle : view : event }}\n <p *ngIf=\"!event.allDay\">{{ getPreviewDescription(event.description) }}</p>\n </span>\n </ng-template>\n <ng-template\n #eventTemplate\n let-weekEvent=\"weekEvent\"\n let-tooltipPlacement=\"tooltipPlacement\"\n let-eventClicked=\"eventClicked\"\n let-tooltipTemplate=\"tooltipTemplate\"\n let-tooltipAppendToBody=\"tooltipAppendToBody\"\n let-tooltipDisabled=\"tooltipDisabled\"\n let-tooltipDelay=\"tooltipDelay\"\n let-column=\"column\"\n let-daysInWeek=\"daysInWeek\"\n >\n <div\n class=\"cal-event\"\n [class.external]=\"weekEvent.event.external\"\n [class.needsAction]=\"Attendance.NEEDS_ACTION === weekEvent.event.attendance\"\n [class.declined]=\"Attendance.DECLINED === weekEvent.event.attendance\"\n [class.tentative]=\"Attendance.TENTATIVE === weekEvent.event.attendance\"\n [style.border-left-color]=\"weekEvent.event.color?.primary\"\n [style.color]=\"getAlternateColor(weekEvent.event.color?.primary, darkMode ? 80 : -40)\"\n [style.background-color]=\"getAlternateColor(weekEvent.event.color?.primary, darkMode ? 60 : 80, 0.2)\"\n [mwlCalendarTooltip]=\"!tooltipDisabled && !isMobile() ? getTooltipContent(weekEvent.event) : ''\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipEvent]=\"weekEvent.tempEvent || weekEvent.event\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipAppendToBody]=\"tooltipAppendToBody\"\n [tooltipDelay]=\"tooltipDelay\"\n (mwlClick)=\"eventClicked.emit({ sourceEvent: $event })\"\n (mwlKeydownEnter)=\"eventClicked.emit({ sourceEvent: $event })\"\n tabindex=\"0\"\n role=\"application\"\n [attr.aria-label]=\"\n { event: weekEvent.tempEvent || weekEvent.event, locale: locale } | calendarA11y : 'eventDescription'\n \"\n >\n <mwl-calendar-event-actions [event]=\"weekEvent.tempEvent || weekEvent.event\"></mwl-calendar-event-actions>\n &ngsp;\n <mwl-calendar-event-title\n [event]=\"weekEvent.tempEvent || weekEvent.event\"\n [customTemplate]=\"eventTitleTemplate\"\n [view]=\"daysInWeek === 1 ? 'day' : 'week'\"\n >\n </mwl-calendar-event-title>\n <div class=\"eventGadgets\" *ngIf=\"!weekEvent.event.allDay\">\n <ion-icon *ngFor=\"let icon of weekEvent.event.icons\" [name]=\"icon.name\" [title]=\"icon.title\"></ion-icon>\n <idea-user-avatar\n size=\"mini\"\n *ngFor=\"let avatar of weekEvent.event.avatars\"\n [src]=\"avatar.url\"\n [name]=\"avatar.title\"\n ></idea-user-avatar>\n </div>\n </div>\n </ng-template>\n <ng-template\n #hourSegmentTemplate\n let-segment=\"segment\"\n let-locale=\"locale\"\n let-segmentHeight=\"segmentHeight\"\n let-isTimeLabel=\"isTimeLabel\"\n >\n <div\n #segmentElement\n class=\"cal-hour-segment\"\n [style.height.px]=\"segmentHeight\"\n [class.cal-hour-start]=\"segment.isStart\"\n [class.cal-after-hour-start]=\"!segment.isStart\"\n [ngClass]=\"segment.cssClass\"\n (mousedown)=\"allowDragToCreate ? startDragToCreate($event, segment.date, segmentElement) : null\"\n (touchstart)=\"allowDragToCreate ? startDragToCreate($event, segment.date, segmentElement) : null\"\n >\n <div class=\"cal-time\" *ngIf=\"isTimeLabel\">\n {{ segment.date | calendarDate : 'weekViewHour' : locale }}\n </div>\n </div>\n </ng-template>\n <!-- VIEWS -->\n <div [ngSwitch]=\"view\">\n <mwl-calendar-month-view\n *ngSwitchCase=\"CalendarView.Month\"\n [viewDate]=\"viewDate\"\n [events]=\"events\"\n [refresh]=\"refresh\"\n [activeDayIsOpen]=\"activeDayIsOpen\"\n [locale]=\"locale\"\n [excludeDays]=\"excludeDays\"\n [weekStartsOn]=\"weekStartsOn\"\n [eventTitleTemplate]=\"eventTitleTemplate\"\n (eventClicked)=\"selectEvent.emit($event.event)\"\n (eventTimesChanged)=\"eventTimesChanged($event)\"\n (dayClicked)=\"changeDay($event.day)\"\n (beforeViewRender)=\"beforeMonthViewRender($event)\"\n >\n </mwl-calendar-month-view>\n <mwl-calendar-week-view\n *ngSwitchCase=\"CalendarView.Week\"\n [viewDate]=\"viewDate\"\n [events]=\"events\"\n [refresh]=\"refresh\"\n [locale]=\"locale\"\n [excludeDays]=\"excludeDays\"\n [weekStartsOn]=\"weekStartsOn\"\n [dayStartHour]=\"dayStartHour\"\n [dayEndHour]=\"dayEndHour\"\n [hourSegments]=\"hourSegments\"\n [eventTemplate]=\"eventTemplate\"\n [hourSegmentTemplate]=\"hourSegmentTemplate\"\n (eventClicked)=\"selectEvent.emit($event.event)\"\n (eventTimesChanged)=\"eventTimesChanged($event)\"\n (dayHeaderClicked)=\"dateIsValid($event.day.date) ? selectDay.emit($event.day.date) : null\"\n (hourSegmentClicked)=\"dateIsValid($event.date) ? selectSlot.emit($event.date) : null\"\n (beforeViewRender)=\"beforeWeekOrDayViewRender($event)\"\n >\n </mwl-calendar-week-view>\n <mwl-calendar-day-view\n *ngSwitchCase=\"CalendarView.Day\"\n [viewDate]=\"viewDate\"\n [events]=\"events\"\n [refresh]=\"refresh\"\n [locale]=\"locale\"\n [dayStartHour]=\"dayStartHour\"\n [dayEndHour]=\"dayEndHour\"\n [hourSegments]=\"hourSegments\"\n [eventTemplate]=\"eventTemplate\"\n [hourSegmentTemplate]=\"hourSegmentTemplate\"\n (eventClicked)=\"selectEvent.emit($event.event)\"\n (eventTimesChanged)=\"eventTimesChanged($event)\"\n (hourSegmentClicked)=\"dateIsValid($event.date) ? selectSlot.emit($event.date) : null\"\n (beforeViewRender)=\"beforeWeekOrDayViewRender($event)\"\n >\n </mwl-calendar-day-view>\n </div>\n</div>\n", styles: [".agenda{margin-top:15px}.agenda ion-col.titleCol{padding-left:8px}.agenda ion-col.titleCol h2,.agenda ion-col.titleCol p{margin:0}.agenda ion-col.titleCol h2{font-size:1.2em}.agenda ion-col.titleCol p{font-size:.8em;font-style:italic}.agenda .calendarViewSelector{background-color:transparent;--ion-background-color: transparent;--background: transparent}.agenda .calendarViewSelector ion-select{max-width:100%;width:100%;padding-left:0;font-weight:500}.agenda .eventGadgets{margin-top:4px;margin-left:5px;text-align:right}.agenda .eventGadgets idea-user-avatar{display:block;float:left;margin:2px 1px}.agenda .eventGadgets ion-icon{padding-right:2px;opacity:.7;font-size:1.15em}@media only screen and (max-width: 575px){.agenda ion-col.titleCol{padding:0 8px 12px;text-align:center}}\n"] }]
323
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2.Platform }, { type: i3.IDEATranslationsService }]; }, propDecorators: { events: [{
324
- type: Input
325
- }], excludeDays: [{
326
- type: Input
327
- }], dayStartHour: [{
328
- type: Input
329
- }], dayEndHour: [{
330
- type: Input
331
- }], hourSegments: [{
332
- type: Input
333
- }], activeDayIsOpen: [{
334
- type: Input
335
- }], view: [{
336
- type: Input
337
- }], allowedViews: [{
338
- type: Input
339
- }], onlyFuture: [{
340
- type: Input
341
- }], titleNotes: [{
342
- type: Input
343
- }], newEventTemplate: [{
344
- type: Input
345
- }], allowDragToCreate: [{
346
- type: Input
347
- }], parentContent: [{
348
- type: Input
349
- }], selectEvent: [{
350
- type: Output
351
- }], selectDay: [{
352
- type: Output
353
- }], selectSlot: [{
354
- type: Output
355
- }], newEventByDrag: [{
356
- type: Output
357
- }], changeEvent: [{
358
- type: Output
359
- }], changeDate: [{
360
- type: Output
361
- }], beforeWeekOrDayViewRenderEmitter: [{
362
- type: Output
363
- }], beforeMonthViewRenderEmitter: [{
364
- type: Output
365
- }] } });
366
- /**
367
- * Possible attendance statuses for the event.
368
- */
369
- var EventAttendance;
370
- (function (EventAttendance) {
371
- EventAttendance[EventAttendance["DECLINED"] = -1] = "DECLINED";
372
- EventAttendance[EventAttendance["NEEDS_ACTION"] = 0] = "NEEDS_ACTION";
373
- EventAttendance[EventAttendance["TENTATIVE"] = 1] = "TENTATIVE";
374
- EventAttendance[EventAttendance["ACCEPTED"] = 2] = "ACCEPTED";
375
- })(EventAttendance || (EventAttendance = {}));
376
- /**
377
- * The options to allow (or not) drag&drop to create a new event.
378
- */
379
- var DragToCreateOptions;
380
- (function (DragToCreateOptions) {
381
- DragToCreateOptions[DragToCreateOptions["DISABLED"] = 0] = "DISABLED";
382
- DragToCreateOptions[DragToCreateOptions["ONLY_SAME_DAY"] = 1] = "ONLY_SAME_DAY";
383
- DragToCreateOptions[DragToCreateOptions["FREE"] = 2] = "FREE";
384
- })(DragToCreateOptions || (DragToCreateOptions = {}));
385
- const floorToNearest = (amount, precision) => Math.floor(amount / precision) * precision;
386
- const ceilToNearest = (amount, precision) => Math.ceil(amount / precision) * precision;
387
-
388
- /**
389
- * Note: to test locally, you need to temporarily change the redirect URI:
390
- * - in the lambda `idea_calendars`, e.g. `SCARLETT_URL`;
391
- * - in the client config file: `APP_URL`.
392
- * In both cases, the value should be set to `http://localhost:8100` (or according to the local URL).
393
- */
394
- class IDEACalendarsService {
395
- constructor(modalCtrl, alertCtrl, message, loading, API, t) {
396
- this.modalCtrl = modalCtrl;
397
- this.alertCtrl = alertCtrl;
398
- this.message = message;
399
- this.loading = loading;
400
- this.API = API;
401
- this.t = t;
402
- }
403
- /**
404
- * Get the ion-icon of an external service from its name.
405
- */
406
- getServiceIcon(service) {
407
- switch (service) {
408
- case ExternalCalendarSources.GOOGLE:
409
- return 'logo-google';
410
- case ExternalCalendarSources.MICROSOFT:
411
- return 'logo-windows';
412
- default:
413
- return 'help';
414
- }
415
- }
416
- /**
417
- * Get the base URL for API request (shared/private calendar).
418
- */
419
- getRequestURL(calendar) {
420
- return (calendar.teamId ? `teams/${calendar.teamId}/` : '').concat('calendars');
421
- }
422
- /**
423
- * Create a new calendar.
424
- */
425
- postCalendar(cal) {
426
- return new Promise((resolve, reject) => {
427
- this.API.postResource(this.getRequestURL(cal), { idea: true, body: cal })
428
- .then((res) => resolve(new Calendar(res)))
429
- .catch(err => reject(err));
430
- });
431
- }
432
- /**
433
- * Update an existing calendar.
434
- */
435
- putCalendar(cal) {
436
- return new Promise((resolve, reject) => {
437
- this.API.putResource(this.getRequestURL(cal), { idea: true, resourceId: cal.calendarId, body: cal })
438
- .then((res) => resolve(new Calendar(res)))
439
- .catch(err => reject(err));
440
- });
441
- }
442
- /**
443
- * Delete a calendar.
444
- */
445
- deleteCalendar(cal) {
446
- return new Promise((resolve, reject) => {
447
- this.API.deleteResource(this.getRequestURL(cal), { idea: true, resourceId: cal.calendarId })
448
- .then(() => resolve())
449
- .catch(err => reject(err));
450
- });
451
- }
452
- /**
453
- * Associate an external calendar with the given calendar.
454
- */
455
- setExternalCalendar(cal, externalId) {
456
- return new Promise((resolve, reject) => {
457
- this.API.patchResource(this.getRequestURL(cal), {
458
- idea: true,
459
- resourceId: cal.calendarId,
460
- body: { action: 'SET_EXTERNAL_CALENDAR', externalId }
461
- })
462
- .then(res => resolve(new Calendar(res)))
463
- .catch(err => reject(err));
464
- });
465
- }
466
- /**
467
- * Link the calendar with the chosen external service (auth flow).
468
- */
469
- linkExtService(cal) {
470
- return new Promise((resolve, reject) => {
471
- if (!cal.external)
472
- return reject(new Error('NOT_EXTERNAL'));
473
- let url;
474
- switch (cal.external.service) {
475
- case ExternalCalendarSources.GOOGLE:
476
- url =
477
- 'https://accounts.google.com/o/oauth2/v2/auth?' +
478
- `client_id=${encodeURIComponent(environment.google.apiClientId)}` +
479
- '&response_type=code' +
480
- `&redirect_uri=${encodeURIComponent(environment.idea.app.url.concat('/echo/google-calendars-integration'))}` +
481
- '&include_granted_scopes=true' +
482
- '&access_type=offline&prompt=consent' +
483
- `&scope=${encodeURIComponent(environment.google.apiScope)}` +
484
- `&state=${encodeURIComponent(cal.calendarId)}`;
485
- break;
486
- case ExternalCalendarSources.MICROSOFT:
487
- url =
488
- 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?' +
489
- `client_id=${encodeURIComponent(environment.microsoft.apiClientId)}` +
490
- '&response_type=code' +
491
- `&redirect_uri=${encodeURIComponent(environment.idea.app.url.concat('/echo/microsoft-calendars-integration'))}` +
492
- '&response_mode=query' +
493
- `&scope=${encodeURIComponent(environment.microsoft.apiScope)}` +
494
- `&state=${encodeURIComponent(cal.calendarId)}`;
495
- break;
496
- }
497
- if (!url)
498
- return reject(new Error('INVALID_SERVICE'));
499
- // start the auth flow in the browser
500
- Browser.open({ url }).then(() => {
501
- // since we don't know when/if the auth flow will finish, we wait
502
- this.alertCtrl
503
- .create({
504
- header: this.t._('IDEA_AGENDA.CALENDARS.LINKING_CALENDAR'),
505
- message: this.t._('IDEA_AGENDA.CALENDARS.LINKING_CALENDAR_CONFIRM_ONCE_DONE'),
506
- backdropDismiss: false,
507
- buttons: [{ text: this.t._('COMMON.DONE'), handler: () => resolve() }]
508
- })
509
- .then(alert => alert.present());
510
- });
511
- });
512
- }
513
- /**
514
- * Get the external calendars list of the external service.
515
- */
516
- getExternalCalendars(cal) {
517
- return new Promise((resolve, reject) => {
518
- if (!cal.external)
519
- return reject(new Error('NOT_EXTERNAL'));
520
- // get the access token to make requests; in case it fails, proceed to link the external service
521
- this.API.patchResource(this.getRequestURL(cal), {
522
- idea: true,
523
- resourceId: cal.calendarId,
524
- body: { action: 'GET_ACCESS_TOKEN' }
525
- })
526
- .then((result) => {
527
- // prepare the headers (authorization) for the request to the external service
528
- const headers = { Authorization: 'Bearer '.concat(result.token) };
529
- // acquire and return the calendars
530
- switch (cal.external.service) {
531
- case ExternalCalendarSources.GOOGLE:
532
- this.API.rawRequest()
533
- .get('https://www.googleapis.com/calendar/v3/users/me/calendarList', { headers })
534
- .toPromise()
535
- .then((res) => resolve(res.items.map((c) => ({ name: c.summary, id: c.id }))))
536
- .catch(err => reject(err));
537
- break;
538
- case ExternalCalendarSources.MICROSOFT:
539
- this.API.rawRequest()
540
- .get('https://graph.microsoft.com/v1.0/me/calendars', { headers })
541
- .toPromise()
542
- .then((res) => resolve(res.value.map((c) => ({ name: c.name, id: c.id }))))
543
- .catch(err => reject(err));
544
- break;
545
- }
546
- })
547
- .catch(err => reject(err));
548
- });
549
- }
550
- /**
551
- * If the external service is linked, choose an external calendar and set it for the chosen calendar.
552
- * @return the updated calendar.
553
- */
554
- chooseAndSetExternalCalendar(cal) {
555
- return new Promise((resolve, reject) => {
556
- this.openModalAndPickExternalCalendar(cal)
557
- .then(extCalId => {
558
- // the external calendar will be set later on
559
- if (!extCalId)
560
- return resolve(null);
561
- // an external calendar was chosen: set it right away
562
- this.setExternalCalendar(cal, extCalId)
563
- .then(res => resolve(res))
564
- .catch(err => reject(err));
565
- })
566
- .catch(err => reject(err));
567
- });
568
- }
569
- /**
570
- * Open the modal to pick a calendar from the external service.
571
- * @return the id of the external calendar.
572
- */
573
- openModalAndPickExternalCalendar(cal) {
574
- return __awaiter(this, void 0, void 0, function* () {
575
- yield this.loading.show();
576
- return new Promise((resolve, reject) => {
577
- this.getExternalCalendars(cal)
578
- .then((extCals) => {
579
- if (!extCals.length)
580
- return reject(new Error('NO_EXTERNAL_CALENDARS'));
581
- // let the user to choose the external calendar to associate
582
- this.modalCtrl
583
- .create({
584
- component: IDEASuggestionsComponent,
585
- componentProps: {
586
- data: extCals.map(c => new Suggestion({ value: c.id, name: c.name })),
587
- searchPlaceholder: this.t._('IDEA_AGENDA.CALENDARS.CHOOSE_AN_EXTERNAL_CALENDAR_TO_LINK'),
588
- sortData: true,
589
- hideIdFromUI: true,
590
- hideClearButton: true,
591
- mustChoose: true
592
- },
593
- backdropDismiss: false
594
- })
595
- .then(modal => {
596
- modal.onDidDismiss().then(res => resolve(res.data ? res.data.value : null));
597
- modal.present();
598
- });
599
- })
600
- .catch(err => reject(err))
601
- .finally(() => this.loading.hide());
602
- });
603
- });
604
- }
605
- /**
606
- * First sync of the extenal calendar.
607
- */
608
- syncCalendar(cal) {
609
- return new Promise((resolve, reject) => this.syncCalendarHelper(cal, err => (err ? reject(err) : resolve())));
610
- }
611
- /**
612
- * Helper to recursively sync an the extenal calendar.
613
- */
614
- syncCalendarHelper(cal, done) {
615
- // this is a recursive operation: the API returns if the sync has to continue or it finished
616
- this.API.patchResource(this.getRequestURL(cal), {
617
- idea: true,
618
- resourceId: cal.calendarId,
619
- body: { action: 'SYNC_EXTERNAL_CALENDAR', firstSync: true }
620
- })
621
- .then((res) => {
622
- if (res.moreData)
623
- this.syncCalendarHelper(cal, done);
624
- else
625
- done();
626
- })
627
- .catch(err => done(err));
628
- }
629
- }
630
- IDEACalendarsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarsService, deps: [{ token: i2.ModalController }, { token: i2.AlertController }, { token: i3.IDEAMessageService }, { token: i3.IDEALoadingService }, { token: i3.IDEAAWSAPIService }, { token: i3.IDEATranslationsService }], target: i0.ɵɵFactoryTarget.Injectable });
631
- IDEACalendarsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarsService });
632
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarsService, decorators: [{
633
- type: Injectable
634
- }], ctorParameters: function () { return [{ type: i2.ModalController }, { type: i2.AlertController }, { type: i3.IDEAMessageService }, { type: i3.IDEALoadingService }, { type: i3.IDEAAWSAPIService }, { type: i3.IDEATranslationsService }]; } });
635
-
636
- class IDEACalendarComponent {
637
- constructor(calendars, modalCtrl, alertCtrl, tc, loading, message, API, t) {
638
- this.calendars = calendars;
639
- this.modalCtrl = modalCtrl;
640
- this.alertCtrl = alertCtrl;
641
- this.tc = tc;
642
- this.loading = loading;
643
- this.message = message;
644
- this.API = API;
645
- this.t = t;
646
- /**
647
- * Errors while validating the entity.
648
- */
649
- this.errors = new Set();
650
- /**
651
- * The default color for a calendar.
652
- */
653
- this.DEFAULT_COLOR = '#555';
654
- }
655
- ngOnInit() {
656
- this.membership = this.tc.get('membership');
657
- // work on a copy
658
- this._calendar = new Calendar(this.calendar);
659
- // load the teammates to use for shared calendars permissions
660
- this.API.getResource(`teams/${this.membership.teamId}/memberships`)
661
- .then((memberships) => (this.membershipsChecks = memberships.map(m => new Check({
662
- value: m.userId,
663
- name: m.name,
664
- checked: (this._calendar.usersCanManageAppointments || []).some(x => x === m.userId)
665
- }))))
666
- .catch(() => { });
667
- }
668
- /**
669
- * Set the support array to display errors in the UI.
670
- */
671
- hasFieldAnError(field) {
672
- return this.errors.has(field);
673
- }
674
- /**
675
- * Save a calendar with the new info.
676
- */
677
- save() {
678
- return __awaiter(this, void 0, void 0, function* () {
679
- // set the default color, in case none was selected
680
- if (!this._calendar.color)
681
- this._calendar.color = this.DEFAULT_COLOR;
682
- // map the memberships able to manage appointments
683
- if (this._calendar.isShared() && this.advancedPermissions)
684
- this._calendar.usersCanManageAppointments = this.membershipsChecks
685
- .filter(x => x.checked)
686
- .map(x => String(x.value));
687
- else
688
- delete this._calendar.usersCanManageAppointments;
689
- // checkings
690
- this.errors = new Set(this._calendar.validate());
691
- if (this.errors.size)
692
- return this.message.error('COMMON.FORM_HAS_ERROR_TO_CHECK');
693
- // send a put request
694
- yield this.loading.show();
695
- this.calendars
696
- .putCalendar(this._calendar)
697
- .then((res) => {
698
- this.calendar.load(res);
699
- this.message.success('IDEA_AGENDA.CALENDARS.CALENDAR_SAVED');
700
- this.modalCtrl.dismiss(this.calendar);
701
- })
702
- .catch(() => this.message.error('COMMON.OPERATION_FAILED'))
703
- .finally(() => this.loading.hide());
704
- });
705
- }
706
- /**
707
- * Delete the calendar.
708
- */
709
- delete() {
710
- this.alertCtrl
711
- .create({
712
- header: this.t._('COMMON.ARE_YOU_SURE'),
713
- subHeader: this.t._('IDEA_AGENDA.CALENDARS.DELETE_CALENDAR'),
714
- message: this.t._('IDEA_AGENDA.CALENDARS.DELETE_CALENDAR_HINT'),
715
- buttons: [
716
- { text: this.t._('COMMON.CANCEL'), role: 'cancel' },
717
- {
718
- text: this.t._('COMMON.DELETE'),
719
- handler: () => __awaiter(this, void 0, void 0, function* () {
720
- yield this.loading.show();
721
- this.calendars
722
- .deleteCalendar(this._calendar)
723
- .then(() => {
724
- this.message.success('IDEA_AGENDA.CALENDARS.CALENDAR_DELETED');
725
- this.modalCtrl.dismiss(true);
726
- })
727
- .catch(() => this.message.error('COMMON.OPERATION_FAILED'))
728
- .finally(() => this.loading.hide());
729
- })
730
- }
731
- ]
732
- })
733
- .then(alert => alert.present());
734
- }
735
- /**
736
- * Close the component.
737
- */
738
- close() {
739
- this.modalCtrl.dismiss();
740
- }
741
- }
742
- IDEACalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarComponent, deps: [{ token: IDEACalendarsService }, { token: i2.ModalController }, { token: i2.AlertController }, { token: i3.IDEATinCanService }, { token: i3.IDEALoadingService }, { token: i3.IDEAMessageService }, { token: i3.IDEAAWSAPIService }, { token: i3.IDEATranslationsService }], target: i0.ɵɵFactoryTarget.Component });
743
- IDEACalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: IDEACalendarComponent, selector: "idea-calendar", inputs: { calendar: "calendar", advancedPermissions: "advancedPermissions", hideColor: "hideColor" }, ngImport: i0, template: "<ion-header>\n <ion-toolbar color=\"ideaToolbar\">\n <ion-buttons slot=\"start\">\n <ion-button [title]=\"t._('COMMON.CLOSE')\" (click)=\"close()\">\n <ion-icon name=\"close-circle\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'IDEA_AGENDA.CALENDARS.EDIT_CALENDAR' | translate }}</ion-title>\n <ion-buttons slot=\"end\">\n <ion-button [title]=\"t._('COMMON.SAVE')\" (click)=\"save()\">\n <ion-icon name=\"checkmark-circle\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <div class=\"maxWidthContainer\" *ngIf=\"_calendar\">\n <ion-list class=\"aList\">\n <ion-item\n lines=\"inset\"\n [class.fieldHasError]=\"hasFieldAnError('name')\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.NAME_HINT')\"\n >\n <ion-label position=\"stacked\">{{ 'IDEA_AGENDA.CALENDARS.NAME' | translate }} </ion-label>\n <ion-input [placeholder]=\"t._('IDEA_AGENDA.CALENDARS.NAME_HINT')\" [(ngModel)]=\"_calendar.name\"></ion-input>\n </ion-item>\n <ion-item\n lines=\"inset\"\n [class.fieldHasError]=\"hasFieldAnError('description')\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.DESCRIPTION_HINT')\"\n >\n <ion-label position=\"stacked\">{{ 'IDEA_AGENDA.CALENDARS.DESCRIPTION' | translate }} </ion-label>\n <ion-input\n [placeholder]=\"t._('IDEA_AGENDA.CALENDARS.DESCRIPTION_HINT')\"\n [(ngModel)]=\"_calendar.description\"\n ></ion-input>\n </ion-item>\n <idea-color-picker\n *ngIf=\"!hideColor\"\n [lines]=\"'inset'\"\n [current]=\"_calendar.color\"\n [label]=\"t._('IDEA_AGENDA.CALENDARS.COLOR')\"\n [class.fieldHasError]=\"hasFieldAnError('color')\"\n (select)=\"$event ? (_calendar.color = $event) : null\"\n ></idea-color-picker>\n <idea-checker\n *ngIf=\"membershipsChecks && _calendar.isShared() && advancedPermissions\"\n [data]=\"membershipsChecks\"\n [label]=\"t._('IDEA_AGENDA.CALENDARS.USERS_ALLOWED_TO_MANAGE_APPOINTMENTS')\"\n [searchPlaceholder]=\"t._('IDEA_AGENDA.CALENDARS.WHO_CAN_MANAGE_APPOINTMENTS')\"\n [noneText]=\"t._('IDEA_AGENDA.CALENDARS.NOBODY')\"\n [allText]=\"t._('IDEA_AGENDA.CALENDARS.EVERYONE')\"\n [allowSelectDeselectAll]=\"true\"\n [lines]=\"'inset'\"\n ></idea-checker>\n </ion-list>\n <ion-list class=\"aList\" *ngIf=\"_calendar.external?.service\">\n <ion-list-header>\n <ion-label>\n <h2>{{ 'IDEA_AGENDA.CALENDARS.INFO_ON_CALENDAR' | translate }}</h2>\n </ion-label>\n </ion-list-header>\n <ion-item lines=\"inset\" *ngIf=\"calendar.userId\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.PRIVATE_CALENDAR' | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.PRIVATE_CALENDAR_HINT' | translate }}</p>\n </ion-label>\n <ion-icon slot=\"end\" name=\"person\"></ion-icon>\n </ion-item>\n <ion-item lines=\"inset\" *ngIf=\"calendar.teamId\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR' | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR_HINT' | translate }}</p>\n </ion-label>\n <ion-icon slot=\"end\" name=\"people\"></ion-icon>\n </ion-item>\n <ion-item lines=\"inset\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.LINKED_TO' | translate }}\n {{ 'IDEA_AGENDA.CALENDARS.SERVICES.' + _calendar.external.service | translate }}\n <p>{{ _calendar.external.name }} ({{ _calendar.external.email }})</p>\n </ion-label>\n <ion-icon slot=\"end\" [name]=\"calendars.getServiceIcon(_calendar.external.service)\"></ion-icon>\n </ion-item>\n <ion-item lines=\"inset\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.ACCESS_LEVELS.' + _calendar.external.userAccess | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.BASED_ON_EXTERNAL_SERVICE_SHARING_PERMISSION' | translate }}</p>\n </ion-label>\n <ion-icon slot=\"end\" name=\"shield\"></ion-icon>\n </ion-item>\n </ion-list>\n <ion-list class=\"aList\">\n <ion-list-header>\n <ion-label color=\"danger\">\n <h2>{{ 'IDEA_AGENDA.CALENDARS.DANGEROUS_ZONE' | translate }}</h2>\n </ion-label>\n </ion-list-header>\n <ion-item lines=\"inset\">\n <ion-label class=\"ion-text-wrap\">\n {{ 'IDEA_AGENDA.CALENDARS.DELETE_CALENDAR' | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.DELETE_CALENDAR_HINT' | translate }}</p>\n </ion-label>\n <ion-button color=\"danger\" [title]=\"t._('IDEA_AGENDA.CALENDARS.DELETE_CALENDAR_HINT')\" (click)=\"delete()\">\n {{ 'COMMON.DELETE' | translate }}\n </ion-button>\n </ion-item>\n </ion-list>\n </div>\n</ion-content>\n", styles: [".maxWidthContainer{max-width:500px;padding-top:20px}\n"], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i2.IonContent, selector: "ion-content", inputs: ["color", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i2.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "debounce", "disabled", "enterkeyhint", "inputmode", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: i2.IonListHeader, selector: "ion-list-header", inputs: ["color", "lines", "mode"] }, { kind: "component", type: i2.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: i2.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }, { kind: "component", type: i3.IDEAColorPickerComponent, selector: "idea-color-picker", inputs: ["colors", "current", "label", "placeholder", "icon", "iconColor", "disabled", "obligatory", "lines"], outputs: ["select", "iconSelect"] }, { kind: "component", type: i3.IDEACheckerComponent, selector: "idea-checker", inputs: ["data", "dataProvider", "label", "icon", "iconColor", "searchPlaceholder", "noPreviewText", "noElementsFoundText", "noneEqualsAll", "noneText", "allText", "lines", "disabled", "tappableWhenDisabled", "obligatory", "sortData", "numMaxElementsInPreview", "showAvatars", "limitSelectionToNum", "allowSelectDeselectAll"], outputs: ["change", "iconSelect"] }, { kind: "pipe", type: i3.IDEATranslatePipe, name: "translate" }] });
744
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarComponent, decorators: [{
745
- type: Component,
746
- args: [{ selector: 'idea-calendar', template: "<ion-header>\n <ion-toolbar color=\"ideaToolbar\">\n <ion-buttons slot=\"start\">\n <ion-button [title]=\"t._('COMMON.CLOSE')\" (click)=\"close()\">\n <ion-icon name=\"close-circle\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'IDEA_AGENDA.CALENDARS.EDIT_CALENDAR' | translate }}</ion-title>\n <ion-buttons slot=\"end\">\n <ion-button [title]=\"t._('COMMON.SAVE')\" (click)=\"save()\">\n <ion-icon name=\"checkmark-circle\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <div class=\"maxWidthContainer\" *ngIf=\"_calendar\">\n <ion-list class=\"aList\">\n <ion-item\n lines=\"inset\"\n [class.fieldHasError]=\"hasFieldAnError('name')\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.NAME_HINT')\"\n >\n <ion-label position=\"stacked\">{{ 'IDEA_AGENDA.CALENDARS.NAME' | translate }} </ion-label>\n <ion-input [placeholder]=\"t._('IDEA_AGENDA.CALENDARS.NAME_HINT')\" [(ngModel)]=\"_calendar.name\"></ion-input>\n </ion-item>\n <ion-item\n lines=\"inset\"\n [class.fieldHasError]=\"hasFieldAnError('description')\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.DESCRIPTION_HINT')\"\n >\n <ion-label position=\"stacked\">{{ 'IDEA_AGENDA.CALENDARS.DESCRIPTION' | translate }} </ion-label>\n <ion-input\n [placeholder]=\"t._('IDEA_AGENDA.CALENDARS.DESCRIPTION_HINT')\"\n [(ngModel)]=\"_calendar.description\"\n ></ion-input>\n </ion-item>\n <idea-color-picker\n *ngIf=\"!hideColor\"\n [lines]=\"'inset'\"\n [current]=\"_calendar.color\"\n [label]=\"t._('IDEA_AGENDA.CALENDARS.COLOR')\"\n [class.fieldHasError]=\"hasFieldAnError('color')\"\n (select)=\"$event ? (_calendar.color = $event) : null\"\n ></idea-color-picker>\n <idea-checker\n *ngIf=\"membershipsChecks && _calendar.isShared() && advancedPermissions\"\n [data]=\"membershipsChecks\"\n [label]=\"t._('IDEA_AGENDA.CALENDARS.USERS_ALLOWED_TO_MANAGE_APPOINTMENTS')\"\n [searchPlaceholder]=\"t._('IDEA_AGENDA.CALENDARS.WHO_CAN_MANAGE_APPOINTMENTS')\"\n [noneText]=\"t._('IDEA_AGENDA.CALENDARS.NOBODY')\"\n [allText]=\"t._('IDEA_AGENDA.CALENDARS.EVERYONE')\"\n [allowSelectDeselectAll]=\"true\"\n [lines]=\"'inset'\"\n ></idea-checker>\n </ion-list>\n <ion-list class=\"aList\" *ngIf=\"_calendar.external?.service\">\n <ion-list-header>\n <ion-label>\n <h2>{{ 'IDEA_AGENDA.CALENDARS.INFO_ON_CALENDAR' | translate }}</h2>\n </ion-label>\n </ion-list-header>\n <ion-item lines=\"inset\" *ngIf=\"calendar.userId\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.PRIVATE_CALENDAR' | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.PRIVATE_CALENDAR_HINT' | translate }}</p>\n </ion-label>\n <ion-icon slot=\"end\" name=\"person\"></ion-icon>\n </ion-item>\n <ion-item lines=\"inset\" *ngIf=\"calendar.teamId\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR' | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR_HINT' | translate }}</p>\n </ion-label>\n <ion-icon slot=\"end\" name=\"people\"></ion-icon>\n </ion-item>\n <ion-item lines=\"inset\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.LINKED_TO' | translate }}\n {{ 'IDEA_AGENDA.CALENDARS.SERVICES.' + _calendar.external.service | translate }}\n <p>{{ _calendar.external.name }} ({{ _calendar.external.email }})</p>\n </ion-label>\n <ion-icon slot=\"end\" [name]=\"calendars.getServiceIcon(_calendar.external.service)\"></ion-icon>\n </ion-item>\n <ion-item lines=\"inset\">\n <ion-label>\n {{ 'IDEA_AGENDA.CALENDARS.ACCESS_LEVELS.' + _calendar.external.userAccess | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.BASED_ON_EXTERNAL_SERVICE_SHARING_PERMISSION' | translate }}</p>\n </ion-label>\n <ion-icon slot=\"end\" name=\"shield\"></ion-icon>\n </ion-item>\n </ion-list>\n <ion-list class=\"aList\">\n <ion-list-header>\n <ion-label color=\"danger\">\n <h2>{{ 'IDEA_AGENDA.CALENDARS.DANGEROUS_ZONE' | translate }}</h2>\n </ion-label>\n </ion-list-header>\n <ion-item lines=\"inset\">\n <ion-label class=\"ion-text-wrap\">\n {{ 'IDEA_AGENDA.CALENDARS.DELETE_CALENDAR' | translate }}\n <p>{{ 'IDEA_AGENDA.CALENDARS.DELETE_CALENDAR_HINT' | translate }}</p>\n </ion-label>\n <ion-button color=\"danger\" [title]=\"t._('IDEA_AGENDA.CALENDARS.DELETE_CALENDAR_HINT')\" (click)=\"delete()\">\n {{ 'COMMON.DELETE' | translate }}\n </ion-button>\n </ion-item>\n </ion-list>\n </div>\n</ion-content>\n", styles: [".maxWidthContainer{max-width:500px;padding-top:20px}\n"] }]
747
- }], ctorParameters: function () { return [{ type: IDEACalendarsService }, { type: i2.ModalController }, { type: i2.AlertController }, { type: i3.IDEATinCanService }, { type: i3.IDEALoadingService }, { type: i3.IDEAMessageService }, { type: i3.IDEAAWSAPIService }, { type: i3.IDEATranslationsService }]; }, propDecorators: { calendar: [{
748
- type: Input
749
- }], advancedPermissions: [{
750
- type: Input
751
- }], hideColor: [{
752
- type: Input
753
- }] } });
754
-
755
- class IDEACalendarItemComponent {
756
- constructor(calendars, alertCtrl, modalCtrl, message, loading, t) {
757
- this.calendars = calendars;
758
- this.alertCtrl = alertCtrl;
759
- this.modalCtrl = modalCtrl;
760
- this.message = message;
761
- this.loading = loading;
762
- this.t = t;
763
- /**
764
- * Report to parent components a change.
765
- */
766
- this.somethingChanged = new EventEmitter();
767
- }
768
- /**
769
- * Open the modal to manage the calendar.
770
- */
771
- manageCalendar() {
772
- if (this.disabled)
773
- return;
774
- this.modalCtrl
775
- .create({
776
- component: IDEACalendarComponent,
777
- componentProps: {
778
- calendar: this.calendar,
779
- advancedPermissions: this.advancedPermissions,
780
- hideColor: this.hideColor
781
- }
782
- })
783
- .then(modal => {
784
- modal.onDidDismiss().then(res => {
785
- const cal = res.data;
786
- // nothing changed
787
- if (cal === undefined)
788
- return;
789
- // the calendar was deleted
790
- else if (cal === null)
791
- this.calendar = null;
792
- // the calendar was updated
793
- else
794
- this.calendar.load(cal);
795
- // report changes to parent components
796
- this.somethingChanged.emit();
797
- });
798
- modal.present();
799
- });
800
- }
801
- /**
802
- * Continue the auth flow to link an external service and set an external calendar;
803
- * otherwise, the calendar can be deleted.
804
- */
805
- linkExtCalendarOrDelete() {
806
- if (this.disabled)
807
- return;
808
- // let the user pick an external calendar, in case the external service is linked
809
- this.calendars
810
- .chooseAndSetExternalCalendar(this.calendar)
811
- .then((cal) => __awaiter(this, void 0, void 0, function* () {
812
- if (!cal)
813
- return new Error('NO_EXTERNAL_CALENDAR_CHOSEN');
814
- this.calendar.load(cal);
815
- this.message.success('IDEA_AGENDA.CALENDARS.CALENDAR_LINKED');
816
- // run a first sync for the linked external calendar
817
- yield this.loading.show(this.t._('IDEA_AGENDA.CALENDARS.FIRST_SYNC_MAY_TAKE_A_WHILE'));
818
- this.calendars
819
- .syncCalendar(this.calendar)
820
- .then(() => this.message.success('IDEA_AGENDA.CALENDARS.FIRST_SYNC_COMPLETED'))
821
- .catch(() => this.message.error('COMMON.OPERATION_FAILED'))
822
- .finally(() => {
823
- this.loading.hide();
824
- // report changes to parent components
825
- this.somethingChanged.emit();
826
- });
827
- }))
828
- .catch(() => {
829
- // the external service isn't linked yet (we don't have a token): link or delete
830
- this.alertCtrl
831
- .create({
832
- header: this.t._('IDEA_AGENDA.CALENDARS.CALENDAR_NOT_YET_LINKED'),
833
- message: this.t._('IDEA_AGENDA.CALENDARS.DO_YOU_WANT_PROCEED_LINKING_OR_DELETE'),
834
- buttons: [
835
- {
836
- text: this.t._('COMMON.DELETE'),
837
- handler: () => __awaiter(this, void 0, void 0, function* () {
838
- // request the calendar deletion
839
- yield this.loading.show();
840
- this.calendars
841
- .deleteCalendar(this.calendar)
842
- .then(() => {
843
- this.message.success('COMMON.OPERATION_COMPLETED');
844
- // report changes to parent components
845
- this.somethingChanged.emit();
846
- })
847
- .catch(() => this.message.error('COMMON.OPERATION_FAILED'))
848
- .finally(() => this.loading.hide());
849
- })
850
- },
851
- {
852
- text: this.t._('IDEA_AGENDA.CALENDARS.LINK'),
853
- handler: () =>
854
- // try again to link the service
855
- this.calendars
856
- .linkExtService(this.calendar)
857
- // if the service was successfully linked, go recursive to choose and set the external calendar
858
- .then(() => this.linkExtCalendarOrDelete())
859
- .catch(() => this.message.error('COMMON.OPERATION_FAILED'))
860
- }
861
- ]
862
- })
863
- .then(alert => alert.present());
864
- });
865
- }
866
- }
867
- IDEACalendarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarItemComponent, deps: [{ token: IDEACalendarsService }, { token: i2.AlertController }, { token: i2.ModalController }, { token: i3.IDEAMessageService }, { token: i3.IDEALoadingService }, { token: i3.IDEATranslationsService }], target: i0.ɵɵFactoryTarget.Component });
868
- IDEACalendarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: IDEACalendarItemComponent, selector: "idea-calendar-item", inputs: { calendar: "calendar", disabled: "disabled", advancedPermissions: "advancedPermissions", hideColor: "hideColor" }, outputs: { somethingChanged: "somethingChanged" }, ngImport: i0, template: "<ion-item\n class=\"calendarItem\"\n *ngIf=\"calendar\"\n [button]=\"!disabled\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.EDIT_CALENDAR')\"\n (click)=\"calendar.external && !calendar.external.calendarId ? linkExtCalendarOrDelete() : manageCalendar()\"\n>\n <ion-avatar\n slot=\"start\"\n class=\"colorCircle\"\n *ngIf=\"!hideColor\"\n [style.background-color]=\"calendar.color\"\n ></ion-avatar>\n <ion-label>\n {{ calendar.name }}\n <p>\n <ion-text color=\"danger\" *ngIf=\"calendar.external && !calendar.external.calendarId\">\n {{ 'IDEA_AGENDA.CALENDARS.TAP_TO_CONFIGURE' | translate }}\n </ion-text>\n {{ calendar.description }}\n </p>\n </ion-label>\n <ion-icon\n slot=\"end\"\n color=\"danger\"\n name=\"flash-off\"\n *ngIf=\"calendar.external && !calendar.external.calendarId\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.CALENDAR_NOT_YET_LINKED_HINT')\"\n ></ion-icon>\n <ion-icon\n slot=\"end\"\n *ngIf=\"calendar.external?.service\"\n [name]=\"calendars.getServiceIcon(calendar.external.service)\"\n [title]=\"\n t._('IDEA_AGENDA.CALENDARS.LINKED_TO') + ' ' + t._('IDEA_AGENDA.CALENDARS.SERVICES.' + calendar.external.service)\n \"\n ></ion-icon>\n</ion-item>\n", styles: [".calendarItem ion-avatar.colorCircle{width:20px;height:20px;background-color:#555}\n"], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonAvatar, selector: "ion-avatar" }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "pipe", type: i3.IDEATranslatePipe, name: "translate" }] });
869
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarItemComponent, decorators: [{
870
- type: Component,
871
- args: [{ selector: 'idea-calendar-item', template: "<ion-item\n class=\"calendarItem\"\n *ngIf=\"calendar\"\n [button]=\"!disabled\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.EDIT_CALENDAR')\"\n (click)=\"calendar.external && !calendar.external.calendarId ? linkExtCalendarOrDelete() : manageCalendar()\"\n>\n <ion-avatar\n slot=\"start\"\n class=\"colorCircle\"\n *ngIf=\"!hideColor\"\n [style.background-color]=\"calendar.color\"\n ></ion-avatar>\n <ion-label>\n {{ calendar.name }}\n <p>\n <ion-text color=\"danger\" *ngIf=\"calendar.external && !calendar.external.calendarId\">\n {{ 'IDEA_AGENDA.CALENDARS.TAP_TO_CONFIGURE' | translate }}\n </ion-text>\n {{ calendar.description }}\n </p>\n </ion-label>\n <ion-icon\n slot=\"end\"\n color=\"danger\"\n name=\"flash-off\"\n *ngIf=\"calendar.external && !calendar.external.calendarId\"\n [title]=\"t._('IDEA_AGENDA.CALENDARS.CALENDAR_NOT_YET_LINKED_HINT')\"\n ></ion-icon>\n <ion-icon\n slot=\"end\"\n *ngIf=\"calendar.external?.service\"\n [name]=\"calendars.getServiceIcon(calendar.external.service)\"\n [title]=\"\n t._('IDEA_AGENDA.CALENDARS.LINKED_TO') + ' ' + t._('IDEA_AGENDA.CALENDARS.SERVICES.' + calendar.external.service)\n \"\n ></ion-icon>\n</ion-item>\n", styles: [".calendarItem ion-avatar.colorCircle{width:20px;height:20px;background-color:#555}\n"] }]
872
- }], ctorParameters: function () { return [{ type: IDEACalendarsService }, { type: i2.AlertController }, { type: i2.ModalController }, { type: i3.IDEAMessageService }, { type: i3.IDEALoadingService }, { type: i3.IDEATranslationsService }]; }, propDecorators: { calendar: [{
873
- type: Input
874
- }], disabled: [{
875
- type: Input
876
- }], advancedPermissions: [{
877
- type: Input
878
- }], hideColor: [{
879
- type: Input
880
- }], somethingChanged: [{
881
- type: Output
882
- }] } });
883
-
884
- class IDEACalendarCreationComponent {
885
- constructor(calendars, modalCtrl, tc, loading, message, API, t) {
886
- this.calendars = calendars;
887
- this.modalCtrl = modalCtrl;
888
- this.tc = tc;
889
- this.loading = loading;
890
- this.message = message;
891
- this.API = API;
892
- this.t = t;
893
- /**
894
- * The default color for a new calendar.
895
- */
896
- this.DEFAULT_COLOR = '#555';
897
- /**
898
- * The possible external services for the new calendar.
899
- */
900
- this.SOURCES = Object.keys(ExternalCalendarSources);
901
- }
902
- ngOnInit() {
903
- this.calendar = new Calendar();
904
- this.membership = this.tc.get('membership');
905
- if (this.fixScope === CalendarScopes.SHARED)
906
- this.calendar.teamId = this.membership.teamId;
907
- if (this.fixScope === CalendarScopes.PRIVATE)
908
- this.calendar.userId = this.membership.userId;
909
- }
910
- /**
911
- * If allowed by the component configuration, reset the scope of the calendar (private/shared).
912
- */
913
- resetScope() {
914
- if (this.canChangeScope())
915
- this.calendar.teamId = this.calendar.userId = null;
916
- }
917
- /**
918
- * Whether we can change the scope of the calendar (private/shared).
919
- */
920
- canChangeScope() {
921
- return !this.fixScope && this.scopeIsSet();
922
- }
923
- /**
924
- * Whether the scope has been set already.
925
- */
926
- scopeIsSet() {
927
- return Boolean(this.calendar.userId) || Boolean(this.calendar.teamId);
928
- }
929
- /**
930
- * Add a new calendar based on the configuration set.
931
- */
932
- saveNewCalendar(service) {
933
- return __awaiter(this, void 0, void 0, function* () {
934
- // be sure the scope of the calendar was chosen
935
- if (!this.scopeIsSet())
936
- return;
937
- // be sure we are allowed to create the calendar
938
- if (!service && this.onlyExternalCalendars)
939
- return;
940
- // flag the calendar so it has to be linked to an externals service (the procedure follows the creation)
941
- if (service) {
942
- this.calendar.external = new ExternalCalendarInfo({ service });
943
- this.calendar.name = '-'; // it will be substituted with the external name
944
- }
945
- else {
946
- // default values for local calendars
947
- this.calendar.name = this.calendar.userId
948
- ? this.t._('IDEA_AGENDA.CALENDARS.DEFAULT_PERSONAL_CALENDAR_NAME')
949
- : this.t._('IDEA_AGENDA.CALENDARS.DEFAULT_TEAM_CALENDAR_NAME');
950
- this.calendar.color = this.DEFAULT_COLOR;
951
- }
952
- // save (create) the new calendar
953
- yield this.loading.show();
954
- this.calendars
955
- .postCalendar(this.calendar)
956
- .then(cal => {
957
- this.calendar.load(cal);
958
- this.message.success('IDEA_AGENDA.CALENDARS.CALENDAR_CREATED');
959
- // if the calendar is local, no further action is needed
960
- if (!cal.external)
961
- return this.modalCtrl.dismiss(this.calendar);
962
- // if the calendar should be linked to an external service, proceed
963
- this.calendars
964
- .linkExtService(this.calendar)
965
- // if the link was successful, let the user pick an external calendar to set
966
- .then(() => this.calendars.chooseAndSetExternalCalendar(this.calendar))
967
- .then((res) => __awaiter(this, void 0, void 0, function* () {
968
- // if a calendar wasn't set, it can be done later on
969
- if (!res)
970
- return this.modalCtrl.dismiss(this.calendar);
971
- // if an external calendar was set, update the calendar
972
- this.calendar.load(res);
973
- // run a first sync for the linked external calendar
974
- yield this.loading.show(this.t._('IDEA_AGENDA.CALENDARS.FIRST_SYNC_MAY_TAKE_A_WHILE'));
975
- this.calendars
976
- .syncCalendar(this.calendar)
977
- .then(() => this.message.success('IDEA_AGENDA.CALENDARS.FIRST_SYNC_COMPLETED'))
978
- .catch(() => this.message.error('COMMON.OPERATION_FAILED'))
979
- .finally(() => {
980
- this.loading.hide();
981
- // the calendar is ready to go
982
- this.modalCtrl.dismiss(this.calendar);
983
- });
984
- }))
985
- .catch(() => {
986
- this.message.error('COMMON.OPERATION_FAILED');
987
- // the operation can be retried later on; close the modal anyway
988
- this.modalCtrl.dismiss(this.calendar);
989
- });
990
- })
991
- .catch(() => this.message.error('COMMON.OPERATION_FAILED'))
992
- .finally(() => this.loading.hide());
993
- });
994
- }
995
- /**
996
- * Close the component.
997
- */
998
- close() {
999
- this.modalCtrl.dismiss();
1000
- }
1001
- }
1002
- IDEACalendarCreationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarCreationComponent, deps: [{ token: IDEACalendarsService }, { token: i2.ModalController }, { token: i3.IDEATinCanService }, { token: i3.IDEALoadingService }, { token: i3.IDEAMessageService }, { token: i3.IDEAAWSAPIService }, { token: i3.IDEATranslationsService }], target: i0.ɵɵFactoryTarget.Component });
1003
- IDEACalendarCreationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: IDEACalendarCreationComponent, selector: "idea-calendar-creation", inputs: { fixScope: "fixScope", onlyExternalCalendars: "onlyExternalCalendars" }, ngImport: i0, template: "<ion-header>\n <ion-toolbar color=\"ideaToolbar\">\n <ion-buttons slot=\"start\">\n <ion-button *ngIf=\"!canChangeScope()\" [title]=\"t._('COMMON.CLOSE')\" (click)=\"close()\">\n <ion-icon name=\"close\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n <ion-button *ngIf=\"canChangeScope()\" (click)=\"resetScope()\">\n <ion-icon name=\"arrow-back\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>\n <span *ngIf=\"!scopeIsSet()\">{{ 'IDEA_AGENDA.CALENDARS.ADD_A_CALENDAR' | translate }}</span>\n <span *ngIf=\"calendar.userId\">{{ 'IDEA_AGENDA.CALENDARS.PERSONAL_CALENDAR' | translate }}</span>\n <span *ngIf=\"calendar.teamId\">\n {{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR' | translate: { team: tc.get('team').name } }}\n </span>\n </ion-title>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <!-- 1st STEP -->\n <ion-grid class=\"ion-padding choiceGrid\" *ngIf=\"!scopeIsSet()\">\n <ion-row>\n <ion-col class=\"ion-text-center\">\n <h1>{{ 'IDEA_AGENDA.CALENDARS.CREATE_PRIVATE_OR_TEAM' | translate }}</h1>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-align-items-center\">\n <ion-col class=\"ion-text-center\" [size]=\"12\" [sizeSm]=\"6\">\n <ion-card [button]=\"true\" (click)=\"calendar.userId = membership.userId\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon name=\"person\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>{{ 'IDEA_AGENDA.CALENDARS.PERSONAL_CALENDAR' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.PERSONAL_CALENDAR_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n <ion-col class=\"ion-text-center\" [size]=\"12\" [sizeSm]=\"6\">\n <ion-card [button]=\"true\" (click)=\"calendar.teamId = membership.teamId\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon name=\"people\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>{{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n <!-- 2nd STEP -->\n <ion-grid class=\"ion-padding choiceGrid\" *ngIf=\"scopeIsSet()\">\n <ion-row>\n <ion-col class=\"ion-text-center\">\n <h1>{{ 'IDEA_AGENDA.CALENDARS.WHICH_EXTERNAL_SERVICE_TO_LINK' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.WHICH_EXTERNAL_SERVICE_TO_LINK_HINT' | translate }}</p>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-align-items-center\">\n <ion-col class=\"ion-text-center\" [size]=\"12\" *ngIf=\"!onlyExternalCalendars\">\n <ion-card class=\"step2\" [button]=\"true\" (click)=\"saveNewCalendar()\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon name=\"remove\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>{{ 'IDEA_AGENDA.CALENDARS.DONT_LINK' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.DONT_LINK_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n <ion-col class=\"ion-text-center\" *ngFor=\"let s of SOURCES\" [size]=\"12\">\n <ion-card class=\"step2\" [button]=\"true\" (click)=\"saveNewCalendar(s)\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon [name]=\"calendars.getServiceIcon(s)\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>\n {{ 'IDEA_AGENDA.CALENDARS.LINK_TO' | translate }}\n {{ 'IDEA_AGENDA.CALENDARS.SERVICES.' + s | translate }}\n </h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.LINK_TO_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n</ion-content>\n", styles: ["ion-content{--background: var(--ion-color-white-shade)}.choiceGrid ion-row ion-col>h1{margin:10px 0 0;font-size:1.1em}.choiceGrid ion-row ion-col>p{margin-top:0;margin-bottom:0;font-size:.9em}.choiceGrid ion-row:first-child ion-col{padding-bottom:25px}.choiceGrid ion-card{--ion-item-background: var(--ion-color-white);--color: var(--ion-color-dark-tint);height:240px;margin:0 auto;text-align:center}.choiceGrid ion-card ion-card-header{padding-bottom:10px}.choiceGrid ion-card ion-card-header ion-card-title{font-size:2.5em}.choiceGrid ion-card ion-card-content h1{font-size:1.4em;height:60px}.choiceGrid ion-card.step2{height:135px}.choiceGrid ion-card.step2 ion-card-header{padding-top:10px;padding-bottom:0}.choiceGrid ion-card.step2 ion-card-content h1{height:auto}\n"], dependencies: [{ kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i2.IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: i2.IonCardContent, selector: "ion-card-content", inputs: ["mode"] }, { kind: "component", type: i2.IonCardHeader, selector: "ion-card-header", inputs: ["color", "mode", "translucent"] }, { kind: "component", type: i2.IonCardTitle, selector: "ion-card-title", inputs: ["color", "mode"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonContent, selector: "ion-content", inputs: ["color", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i2.IonGrid, selector: "ion-grid", inputs: ["fixed"] }, { kind: "component", type: i2.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "component", type: i2.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: i2.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "pipe", type: i3.IDEATranslatePipe, name: "translate" }] });
1004
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEACalendarCreationComponent, decorators: [{
1005
- type: Component,
1006
- args: [{ selector: 'idea-calendar-creation', template: "<ion-header>\n <ion-toolbar color=\"ideaToolbar\">\n <ion-buttons slot=\"start\">\n <ion-button *ngIf=\"!canChangeScope()\" [title]=\"t._('COMMON.CLOSE')\" (click)=\"close()\">\n <ion-icon name=\"close\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n <ion-button *ngIf=\"canChangeScope()\" (click)=\"resetScope()\">\n <ion-icon name=\"arrow-back\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>\n <span *ngIf=\"!scopeIsSet()\">{{ 'IDEA_AGENDA.CALENDARS.ADD_A_CALENDAR' | translate }}</span>\n <span *ngIf=\"calendar.userId\">{{ 'IDEA_AGENDA.CALENDARS.PERSONAL_CALENDAR' | translate }}</span>\n <span *ngIf=\"calendar.teamId\">\n {{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR' | translate: { team: tc.get('team').name } }}\n </span>\n </ion-title>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <!-- 1st STEP -->\n <ion-grid class=\"ion-padding choiceGrid\" *ngIf=\"!scopeIsSet()\">\n <ion-row>\n <ion-col class=\"ion-text-center\">\n <h1>{{ 'IDEA_AGENDA.CALENDARS.CREATE_PRIVATE_OR_TEAM' | translate }}</h1>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-align-items-center\">\n <ion-col class=\"ion-text-center\" [size]=\"12\" [sizeSm]=\"6\">\n <ion-card [button]=\"true\" (click)=\"calendar.userId = membership.userId\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon name=\"person\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>{{ 'IDEA_AGENDA.CALENDARS.PERSONAL_CALENDAR' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.PERSONAL_CALENDAR_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n <ion-col class=\"ion-text-center\" [size]=\"12\" [sizeSm]=\"6\">\n <ion-card [button]=\"true\" (click)=\"calendar.teamId = membership.teamId\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon name=\"people\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>{{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.TEAM_CALENDAR_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n <!-- 2nd STEP -->\n <ion-grid class=\"ion-padding choiceGrid\" *ngIf=\"scopeIsSet()\">\n <ion-row>\n <ion-col class=\"ion-text-center\">\n <h1>{{ 'IDEA_AGENDA.CALENDARS.WHICH_EXTERNAL_SERVICE_TO_LINK' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.WHICH_EXTERNAL_SERVICE_TO_LINK_HINT' | translate }}</p>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-align-items-center\">\n <ion-col class=\"ion-text-center\" [size]=\"12\" *ngIf=\"!onlyExternalCalendars\">\n <ion-card class=\"step2\" [button]=\"true\" (click)=\"saveNewCalendar()\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon name=\"remove\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>{{ 'IDEA_AGENDA.CALENDARS.DONT_LINK' | translate }}</h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.DONT_LINK_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n <ion-col class=\"ion-text-center\" *ngFor=\"let s of SOURCES\" [size]=\"12\">\n <ion-card class=\"step2\" [button]=\"true\" (click)=\"saveNewCalendar(s)\">\n <ion-card-header>\n <ion-card-title>\n <ion-icon [name]=\"calendars.getServiceIcon(s)\"></ion-icon>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <h1>\n {{ 'IDEA_AGENDA.CALENDARS.LINK_TO' | translate }}\n {{ 'IDEA_AGENDA.CALENDARS.SERVICES.' + s | translate }}\n </h1>\n <p>{{ 'IDEA_AGENDA.CALENDARS.LINK_TO_HINT' | translate }}</p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n</ion-content>\n", styles: ["ion-content{--background: var(--ion-color-white-shade)}.choiceGrid ion-row ion-col>h1{margin:10px 0 0;font-size:1.1em}.choiceGrid ion-row ion-col>p{margin-top:0;margin-bottom:0;font-size:.9em}.choiceGrid ion-row:first-child ion-col{padding-bottom:25px}.choiceGrid ion-card{--ion-item-background: var(--ion-color-white);--color: var(--ion-color-dark-tint);height:240px;margin:0 auto;text-align:center}.choiceGrid ion-card ion-card-header{padding-bottom:10px}.choiceGrid ion-card ion-card-header ion-card-title{font-size:2.5em}.choiceGrid ion-card ion-card-content h1{font-size:1.4em;height:60px}.choiceGrid ion-card.step2{height:135px}.choiceGrid ion-card.step2 ion-card-header{padding-top:10px;padding-bottom:0}.choiceGrid ion-card.step2 ion-card-content h1{height:auto}\n"] }]
1007
- }], ctorParameters: function () { return [{ type: IDEACalendarsService }, { type: i2.ModalController }, { type: i3.IDEATinCanService }, { type: i3.IDEALoadingService }, { type: i3.IDEAMessageService }, { type: i3.IDEAAWSAPIService }, { type: i3.IDEATranslationsService }]; }, propDecorators: { fixScope: [{
1008
- type: Input
1009
- }], onlyExternalCalendars: [{
1010
- type: Input
1011
- }] } });
1012
- /**
1013
- * The possible scopes of the calendar.
1014
- */
1015
- var CalendarScopes;
1016
- (function (CalendarScopes) {
1017
- CalendarScopes["SHARED"] = "shared";
1018
- CalendarScopes["PRIVATE"] = "private"; // userId
1019
- })(CalendarScopes || (CalendarScopes = {}));
1020
-
1021
- class IDEAAgendaModule {
1022
- }
1023
- IDEAAgendaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEAAgendaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1024
- IDEAAgendaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: IDEAAgendaModule, declarations: [IDEAAgendaComponent, IDEACalendarComponent, IDEACalendarItemComponent, IDEACalendarCreationComponent], imports: [CommonModule,
1025
- FormsModule,
1026
- IonicModule,
1027
- IDEATranslationsModule,
1028
- IDEAColorPickerModule,
1029
- IDEACheckerModule,
1030
- IDEAUserAvatarModule, i4.CalendarModule], exports: [IDEAAgendaComponent, IDEACalendarComponent, IDEACalendarItemComponent, IDEACalendarCreationComponent] });
1031
- IDEAAgendaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEAAgendaModule, providers: [{ provide: CalendarDateFormatter, useClass: CustomDateFormatter }, IDEACalendarsService], imports: [CommonModule,
1032
- FormsModule,
1033
- IonicModule,
1034
- IDEATranslationsModule,
1035
- IDEAColorPickerModule,
1036
- IDEACheckerModule,
1037
- IDEAUserAvatarModule,
1038
- CalendarModule.forRoot({ provide: DateAdapter, useFactory: adapterFactory })] });
1039
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IDEAAgendaModule, decorators: [{
1040
- type: NgModule,
1041
- args: [{
1042
- imports: [
1043
- CommonModule,
1044
- FormsModule,
1045
- IonicModule,
1046
- IDEATranslationsModule,
1047
- IDEAColorPickerModule,
1048
- IDEACheckerModule,
1049
- IDEAUserAvatarModule,
1050
- CalendarModule.forRoot({ provide: DateAdapter, useFactory: adapterFactory })
1051
- ],
1052
- declarations: [IDEAAgendaComponent, IDEACalendarComponent, IDEACalendarItemComponent, IDEACalendarCreationComponent],
1053
- exports: [IDEAAgendaComponent, IDEACalendarComponent, IDEACalendarItemComponent, IDEACalendarCreationComponent],
1054
- providers: [{ provide: CalendarDateFormatter, useClass: CustomDateFormatter }, IDEACalendarsService]
1055
- }]
1056
- }] });
1057
-
1058
- /**
1059
- * Generated bundle index. Do not edit.
1060
- */
1061
-
1062
- export { CalendarScopes, CustomDateFormatter, DragToCreateOptions, EventAttendance, IDEAAgendaComponent, IDEAAgendaModule, IDEACalendarComponent, IDEACalendarCreationComponent, IDEACalendarItemComponent, IDEACalendarsService };
1063
- //# sourceMappingURL=idea-ionic-agenda.mjs.map
1064
- //# sourceMappingURL=idea-ionic-agenda.mjs.map