| import { DialogSOP } from '../../libappsop/dialogsop'; | 
| import { DropDownListSOP } from '../../libappsop/dropdownlistsop'; | 
| import { DropDownStringListSOP } from '../../libappsop/dropdownstringlistsop'; | 
| import { EditFieldSOP } from '../../libappsop/editfieldsop'; | 
|   | 
| export interface DialogAccountFields { | 
|   Name?: string; | 
|   ParentAccountName?: string; | 
|   AccountType?: string; | 
|   ReportType?: string; | 
|   Budget?: string; | 
|   CostDriver?: string; | 
|   Cost?: string; | 
|   TimeUnit?: string; | 
|   LengthOfTime?: string; | 
| } | 
|   | 
| export class DialogAccount extends DialogSOP<DialogAccountFields> { | 
|   public static readonly title = 'Accounts'; | 
|   | 
|   public ddlParentAccount = new DropDownListSOP('DropDownListParentAccount'); | 
|   public efName = new EditFieldSOP('EditFieldName'); | 
|   public ddlAccountType = new DropDownListSOP('DropDownListAccountType'); | 
|   public efReportType = new EditFieldSOP('EditFieldReportType'); | 
|   public efBudget = new EditFieldSOP('EditFieldBudget'); | 
|   public ddlCostDriver = new DropDownStringListSOP('DropDownStringListDefaultCostDriver'); | 
|   public efCost = new EditFieldSOP('EditFieldCost'); | 
|   public ddlTimeUnit = new DropDownStringListSOP('DropDownStringListTimeUnit'); | 
|   public efLengthOfTime = new EditFieldSOP('EditFieldLengthOfTime'); | 
|   | 
|   public constructor() { | 
|     super('DialogCreateEditAccountStructure'); | 
|   | 
|     // 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.efName); | 
|     this._uiMap.set('ParentAccountName', this.ddlParentAccount); | 
|     this._uiMap.set('AccountType', this.ddlAccountType); | 
|     this._uiMap.set('ReportType', this.efReportType); | 
|     this._uiMap.set('Budget', this.efBudget); | 
|     this._uiMap.set('CostDriver', this.ddlCostDriver); | 
|     this._uiMap.set('Cost', this.efCost); | 
|     this._uiMap.set('TimeUnit', this.ddlTimeUnit); | 
|     this._uiMap.set('LengthOfTime', this.efLengthOfTime); | 
|   } | 
|   | 
|   public async createEditAccount(name?: string, costDriver?: string, cost?: string, timeUnit?: string, lengthOfTime?: string): Promise<boolean> { | 
|     if (name && !(await this.efName.isDisabled())) { | 
|       await this.efName.sendInput(name); | 
|     } | 
|   | 
|     if (costDriver && (await this.ddlCostDriver.getSelectedString()) !== costDriver) { | 
|       await this.ddlCostDriver.selectItem(costDriver); | 
|     } | 
|   | 
|     // Wait until the Cost field is present which will appear only after selecting Cost Driver | 
|     if (cost) { | 
|       await this.efCost.waitUntilPresent(); | 
|       await this.efCost.sendInput(cost); | 
|     } | 
|   | 
|     if (timeUnit && (await this.ddlTimeUnit.isVisible())) { | 
|       await this.ddlTimeUnit.selectItem(timeUnit); | 
|     } | 
|     if (lengthOfTime) { | 
|       await this.efLengthOfTime.sendInput(lengthOfTime); | 
|     } | 
|   | 
|     return this.clickOK(); | 
|   } | 
|   | 
|   /** | 
|    * Get precondition feedback text on the OK button | 
|    * | 
|    * @returns Precondition feedback text in string | 
|    */ | 
|   public async getOKButtonTooltip(): Promise<string> { | 
|     return this.btnOk.getTooltip(); | 
|   } | 
| } |