| /** | 
|  * @file          Event panel in Event dialog | 
|  * @author        Wong Jia Hui (jiahui.wong@3ds.com) | 
|  */ | 
| import { DataEventCategoryName } from '../../data/data.calendar'; | 
| import { EditFieldSOP } from '../../../libappsop/editfieldsop'; | 
| import { ButtonSOP } from '../../../libappsop/buttonsop'; | 
| import { CheckboxSOP } from '../../../libappsop/checkboxsop'; | 
| import { DropDownStringListSOP } from '../../../libappsop/dropdownstringlistsop'; | 
| import { DropDownListSOP } from '../../../libappsop/dropdownlistsop'; | 
| import { DateTimeSelectorSOP } from '../../../libappsop/datetimeselectorsop'; | 
| import { PanelSOP } from '../../../libappsop/panelsop'; | 
| import { DurationSelectorSOP } from '../../../libappsop/durationselectorsop'; | 
| import { CalendarEventRepeat } from './dialog.calendarevent'; | 
|   | 
| export interface PanelCalendarEventFields { | 
|   Name?: string; | 
|   Description?: string; | 
|   Type?: string; | 
|   Category?: DataEventCategoryName; | 
|   ApplyToNewResources?: string; | 
|   IsAllDay?: string; | 
|   StartDate?: string; | 
|   EndDate?: string; | 
|   StartTime?: string; | 
|   EndTime?: string; | 
|   RecurWeeklyRepeatEvery?: string; // Recurrence weekly fields start here | 
|   RecurWeeklyNoEndDate?: string; | 
|   RecurWeeklyEndAfter?: string; | 
|   RecurWeeklyEndBy?: string; | 
|   RecurWeeklyOccurrencesToEnd?: string; | 
|   RecurWeeklyEndByDate?: string; | 
| } | 
|   | 
| export class PanelCalendarEvent extends PanelSOP { | 
|   // Edit fields | 
|   public readonly efName = new EditFieldSOP('edtName'); | 
|   public readonly efDescription = new EditFieldSOP('edtDescription'); | 
|   | 
|   // Buttons | 
|   public readonly btnOnce = new ButtonSOP('btnOnce'); | 
|   public readonly btnDaily = new ButtonSOP('btnDaily'); | 
|   public readonly btnWeekly = new ButtonSOP('btnWeekly'); | 
|   public readonly btnMonthly = new ButtonSOP('btnMonthly'); | 
|   public readonly btnYearly = new ButtonSOP('btnYearly'); | 
|   | 
|   // Checkboxes | 
|   public readonly cbApplyToNewResources = new CheckboxSOP('ckbApplyToNewResources'); | 
|   public readonly cbIsAllDay = new CheckboxSOP('ckbIsAllDay'); | 
|   | 
|   // Drop down string list | 
|   public readonly ddslType = new DropDownStringListSOP('ddslType'); | 
|   | 
|   // Drop down list | 
|   public readonly ddlCategory = new DropDownListSOP('ddlCategory'); | 
|   | 
|   // Date time selector | 
|   public readonly dsStartDate = new DateTimeSelectorSOP('dsStartDate'); | 
|   public readonly dsEndDate = new DateTimeSelectorSOP('dsEndDate'); | 
|   | 
|   // Duration Selector | 
|   public readonly durationSelectorStart = new DurationSelectorSOP('durStartTimeOfDay', { Hours: 0, Minutes: 0 }); | 
|   public readonly durationSelectorEnd = new DurationSelectorSOP('durEndTimeOfDay', { Hours: 0, Minutes: 0 }); | 
|   | 
|   public constructor() { | 
|     super('tabEvent'); | 
|   } | 
|   | 
|   /** | 
|    * @override | 
|    */ | 
|   public async switchTo(): Promise<void> { | 
|     await super.switchTo(); | 
|     await this.efName.waitUntilPresent(); | 
|     await this.efDescription.waitUntilPresent(); | 
|     await this.btnOnce.waitUntilPresent(); | 
|     await this.btnDaily.waitUntilPresent(); | 
|     await this.btnWeekly.waitUntilPresent(); | 
|     await this.btnMonthly.waitUntilPresent(); | 
|     await this.btnYearly.waitUntilPresent(); | 
|     await this.cbApplyToNewResources.waitUntilPresent(); | 
|     await this.cbIsAllDay.waitUntilPresent(); | 
|     await this.ddslType.waitUntilPresent(); | 
|     await this.ddlCategory.waitUntilPresent(); | 
|     await this.dsStartDate.waitUntilPresent(); | 
|     await this.dsEndDate.waitUntilPresent(); | 
|     await this.durationSelectorStart.waitUntilPresent(); | 
|     await this.durationSelectorEnd.waitUntilPresent(); | 
|   } | 
|   | 
|   public getRepeatButton(repeat: CalendarEventRepeat): ButtonSOP { | 
|     switch (repeat) { | 
|       case CalendarEventRepeat.Once: { | 
|         return this.btnOnce; | 
|       } | 
|       case CalendarEventRepeat.Daily: { | 
|         return this.btnDaily; | 
|       } | 
|       case CalendarEventRepeat.Weekly: { | 
|         return this.btnWeekly; | 
|       } | 
|       case CalendarEventRepeat.Monthly: { | 
|         return this.btnMonthly; | 
|       } | 
|       case CalendarEventRepeat.Yearly: { | 
|         return this.btnYearly; | 
|       } | 
|       default: | 
|         throw Error(`Invalid Repeat button enum "${repeat}".`); | 
|     } | 
|   } | 
| } |