| import { Form } from '../../e2elib/lib/src/pageobjects/form.component'; | 
| import { ListRow } from '../../e2elib/lib/src/pageobjects/list/listrow.component'; | 
| import { ListBase } from '../../libappbase/listbase'; | 
| import { DialogOperationCost } from '../dialogs/dialog.operationcost'; | 
| import { CheckboxBase } from '../../libappbase/checkboxbase'; | 
| import { QContextMenu } from '../../e2elib/lib/api/pageobjects/qcontextmenu.component'; | 
|   | 
| export class FormOperationCost extends Form { | 
|   public cbFilterByAccounts = new CheckboxBase('cbFilterByAccounts'); | 
|   public listOperationCost = new ListOperationCost(); | 
|   | 
|   public constructor() { | 
|     super('FormOperationCosts'); | 
|   } | 
|   | 
|   /** | 
|    * To pass-in boolean to toggle on FilterByAccount checbox | 
|    * | 
|    * @param toBeToggleOn boolean to toggle on or off check box (false | true) | 
|    */ | 
|   public async toggleFilterByAccount(toBeToggleOn: boolean): Promise<void> { | 
|     const cbStatus = await this.cbFilterByAccounts.isChecked(); | 
|     if (cbStatus !== toBeToggleOn) { | 
|       await this.cbFilterByAccounts.click(); | 
|     } | 
|   } | 
| } | 
|   | 
| export class ListOperationCost extends ListBase { | 
|   private readonly _cmMenu = new QContextMenu('lsContextMenuAccCosts'); | 
|   public dlgOperationCost = new DialogOperationCost(); | 
|   | 
|   public constructor() { | 
|     super('lsAccountCosts'); | 
|   } | 
|   | 
|   public async getOperationCostRowCount(): Promise<number> { | 
|     return this.getRowCount(); | 
|   } | 
|   | 
|   public async getAllOperationCostRows(): Promise<ListRow[]> { | 
|     return this.getAllRows(); | 
|   } | 
|   | 
|   /** | 
|    * To verify is all pass-in operation cost rows is matched with expected values | 
|    * | 
|    * @param rowsToMatchValues OperationCost rows that need to satisfy expected values | 
|    * @param expectedValues A string array that store a list of string values that need to be matched | 
|    * @param errMsg Error message if there is any row does not match expected values | 
|    */ | 
|   public async verifyAllRowsSatisfyColumnValuesByUnit(rowsToMatchValues: ListRow[], expectedValues: string[]): Promise<boolean> { | 
|     return this.rowHasValidValue( | 
|       rowsToMatchValues, | 
|       'Unit', | 
|       expectedValues, | 
|     ); | 
|   } | 
|   | 
|   /** | 
|    * Open create edit operation cost dialog in the list | 
|    * | 
|    * @param row Row of operation cost to edit, create dialog will be triggered if this is undefined | 
|    * @param isCopy Indicate to open the dialog for copy or edit, defaulted to false (edit) | 
|    */ | 
|   public async openCreateEditUnitCostDialog(row?: ListRow, isCopy: boolean = false): Promise<void> { | 
|     if (row !== undefined) { | 
|       if (isCopy) { | 
|         await row.rightClick(undefined, this._cmMenu, 'MenuCopy'); | 
|       } else { | 
|         await row.rightClick(undefined, this._cmMenu, 'MenuEdit'); | 
|       } | 
|     } else { | 
|       await this.rightClick(undefined, this._cmMenu, 'MenuCreate'); | 
|     } | 
|     await this.dlgOperationCost.waitUntilPresent(); | 
|   } | 
| } | 
|   | 
| export enum ListColumnOperationCost { | 
|   Unit = 'Unit', | 
|   Operation = 'Operation', | 
|   Account = 'Account', | 
|   CostDriver = 'Cost driver', | 
|   Cost = 'Cost', | 
|   UoM = 'UoM', | 
|   Start = 'Start', | 
|   End = 'End', | 
| } |