| /** | 
|  * @file          Event Dialog | 
|  * @author        Wong Jia Hui (jiahui.wong@3ds.com) | 
|  */ | 
| import { ButtonSOP } from '../../../libappsop/buttonsop'; | 
| import { DialogSOP } from '../../../libappsop/dialogsop'; | 
| import { PanelCalendarEventFields, PanelCalendarEvent } from './panel.calendarevent'; | 
| import { PanelRecurrenceWeekly } from './panel.recurrenceweekly'; | 
|   | 
| export class DialogCalendarEvent extends DialogSOP<PanelCalendarEventFields> { | 
|   public static readonly title = 'Calendar event'; | 
|   public pnlCalendarEvent = new PanelCalendarEvent(); | 
|   public pnlRecurrenceWeekly = new PanelRecurrenceWeekly(); | 
|   public readonly btnCustomizeRepetition = new ButtonSOP('btnCustomize'); | 
|   | 
|   public constructor() { | 
|     super('LibCal_dlgEvent', 'btnOK'); | 
|   | 
|     // Set UI element mapping to pair the UI name to the UI element for use in DialogSOP to find the UI object to set value or verify value | 
|     // This prevents each new Dialog to duplicate code just to set/verify UI element value | 
|     this._uiMap.set('Name', this.pnlCalendarEvent.efName); | 
|     this._uiMap.set('Description', this.pnlCalendarEvent.efDescription); | 
|     this._uiMap.set('ApplyToNewResources', this.pnlCalendarEvent.cbApplyToNewResources); | 
|     this._uiMap.set('IsAllDay', this.pnlCalendarEvent.cbIsAllDay); | 
|     this._uiMap.set('Type', this.pnlCalendarEvent.ddslType); | 
|     this._uiMap.set('Category', this.pnlCalendarEvent.ddlCategory); | 
|     this._uiMap.set('StartDate', this.pnlCalendarEvent.dsStartDate); | 
|     this._uiMap.set('EndDate', this.pnlCalendarEvent.dsEndDate); | 
|     this._uiMap.set('StartTime', this.pnlCalendarEvent.durationSelectorStart); | 
|     this._uiMap.set('EndTime', this.pnlCalendarEvent.durationSelectorEnd); | 
|   | 
|     // Repetition weekly | 
|     this._uiMap.set('RecurWeeklyRepeatEvery', this.pnlRecurrenceWeekly.efRepeatFrequency); | 
|     this._uiMap.set('RecurWeeklyNoEndDate', this.pnlRecurrenceWeekly.cbNoEndDate); | 
|     this._uiMap.set('RecurWeeklyEndAfter', this.pnlRecurrenceWeekly.cbEndAfter); | 
|     this._uiMap.set('RecurWeeklyEndBy', this.pnlRecurrenceWeekly.cbEndBy); | 
|     this._uiMap.set('RecurWeeklyOccurrencesToEnd', this.pnlRecurrenceWeekly.efNrOfOccurrencesToEnd); | 
|     this._uiMap.set('RecurWeeklyEndByDate', this.pnlRecurrenceWeekly.dtsRecurrenceEndDate); | 
|   } | 
|   | 
|   /** | 
|    * Click on Customize repetition button to expand/collapse. A panel is shown to customize repetition in more details. | 
|    */ | 
|   public async clickCustomizeRepetition(): Promise<void> { | 
|     await this.btnCustomizeRepetition.click(); | 
|   } | 
|   | 
|   /** | 
|    * Click on the correct Repeat button for this event. As each Repeat type is a button thus we cannot utilize the usual method on dialogSOP.updateDialogvalues. | 
|    * | 
|    * @param repeat The repeat type for this event. | 
|    */ | 
|   public async setEventRepeat(repeat: CalendarEventRepeat): Promise<void> { | 
|     await this.pnlCalendarEvent.getRepeatButton(repeat).click(); | 
|   } | 
| } | 
|   | 
| export enum CalendarEventRepeat { | 
|   Once = 'Once', | 
|   Daily = 'Daily', | 
|   Weekly = 'Weekly', | 
|   Monthly = 'Monthly', | 
|   Yearly = 'Yearly', | 
| } | 
|   | 
| const stepDialogCalendarEvent = { | 
|   clickCustomizeRepetition: (): string => `In dialog ${DialogCalendarEvent.title}, click on Customize repetition button to expand the detail panel.`, | 
|   setEventRepeat: (repeat: CalendarEventRepeat): string => `In dialog ${DialogCalendarEvent.title}, click button Repeat = ${repeat}.`, | 
| }; | 
|   | 
| export { stepDialogCalendarEvent as StepDialogCalendarEvent }; |