| import { Form } from '../../e2elib/lib/src/pageobjects/form.component'; | 
| import { DialogCurrency } from '../dialogs/dialog.currency'; | 
| import { ListSOP } from '../../libappsop/listsop'; | 
|   | 
| /** | 
|  * Currency form. | 
|  */ | 
| export class FormCurrency extends Form { | 
|   public listCurrency = new ListCurrency(); | 
|   | 
|   public constructor() { | 
|     super('FormCurrency'); | 
|   } | 
| } | 
|   | 
| /** | 
|  * Currency list in Currency form. | 
|  */ | 
| class ListCurrency extends ListSOP<DialogCurrency, ListCurrencyColumn> { | 
|   public constructor() { | 
|     super('ListCurrency', new DialogCurrency()); | 
|   | 
|     // Set primary key column name(s), to display in error message when assert fails | 
|     this.rowPrimaryColumnNames = {Name: ''}; | 
|   } | 
|   | 
|   /** | 
|    * Verify first row is base currency (bold text for Name column) while the other rows are non-bold. | 
|    * | 
|    * @param baseCurrency Base currency name to verify the first row. | 
|    */ | 
|   public async verifyFirstRowBaseCurrency(baseCurrency: string): Promise<void> { | 
|     const totalRows = await this.getRowCount(); | 
|     for (let x = 0; x < totalRows; x++) { | 
|       const row = await this.getRowByIndex(x); | 
|       // Verify 1st row is the base currency and bold | 
|       if (x === 0) { | 
|         await this.verifyRowValues(row, {Name: baseCurrency}); | 
|         await this.verifyRowCellBold(row, {Name: 'true'}); | 
|       } else { | 
|         // Non-base currency is NOT bold | 
|         await this.verifyRowCellBold(row, {Name: 'false'}); | 
|       } | 
|     } | 
|   } | 
| } | 
|   | 
| export interface ListCurrencyColumn { | 
|   Name?: string; | 
|   Base?: string; // Image attribute to indicate if base currency | 
| } | 
|   | 
| const listCurrencyContextMenuItem = { | 
|   Create: { ContextMenu: 'listContextMenuCurrency', Name: 'MenuCreate', Label: 'Create' }, | 
|   Delete: { ContextMenu: 'listContextMenuCurrency', Name: 'MenuDelete', Label: 'Delete' }, | 
|   SetAsBase: { ContextMenu: 'listContextMenuCurrency', Name: 'MenuSetAsBase', Label: 'Set as base' }, | 
| }; | 
|   | 
| export { listCurrencyContextMenuItem as ListCurrencyContextMenuItem }; | 
|   | 
| /** | 
|  * Disabled context menu tooltip. | 
|  */ | 
| export const menuDisabledTooltip = { | 
|   // Partial prefix indicates precondition defined partially thus use partial match when verifying. | 
|   currencyIsDefault: (): string => 'Base currencies are used to determine the value of other currencies and cannot be deleted.', | 
|   currencyInUse: (currencyName: string): string => `Currency ${currencyName} is in use.`, | 
| }; |