import { ListSOP } from '../../libappsop/listsop'; 
 | 
import { FormSOP } from '../../libappsop/formsop'; 
 | 
import { DialogUnitOfMeasure } from '../dialogs/dialog.unitofmeasure'; 
 | 
  
 | 
/** 
 | 
 * Units of Measure form. 
 | 
 */ 
 | 
export class FormUnitsOfMeasure extends FormSOP { 
 | 
  public listUnitsOfMeasure = new ListUnitsOfMeasure(); 
 | 
  
 | 
  public constructor() { 
 | 
    super('FormUOM'); 
 | 
  } 
 | 
} 
 | 
  
 | 
/** 
 | 
 * UoM list in Units of Measure form. 
 | 
 */ 
 | 
class ListUnitsOfMeasure extends ListSOP<DialogUnitOfMeasure, ListUnitsOfMeasureColumn> { 
 | 
  public constructor() { 
 | 
    super('ListUOM', new DialogUnitOfMeasure()); 
 | 
  
 | 
    // Set primary key column name(s), to display in error message when assert fails 
 | 
    this.rowPrimaryColumnNames = {Name: ''}; 
 | 
  } 
 | 
  
 | 
  /** 
 | 
   * Verify first row is default UoM (bold text for Name column) while the other rows are non-bold. 
 | 
   * 
 | 
   * @param defaultUoMName Default UoM name to verify the first row. 
 | 
   */ 
 | 
  public async verifyFirstRowDefaultUoM(defaultUoMName: 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 default UoM and bold 
 | 
      if (x === 0) { 
 | 
        await this.verifyRowValues(row, {Name: defaultUoMName}); 
 | 
        await this.verifyRowCellBold(row, {Name: 'true'}); 
 | 
      } else { 
 | 
        // Non-default UoM is NOT bold 
 | 
        await this.verifyRowCellBold(row, {Name: 'false'}); 
 | 
      } 
 | 
    } 
 | 
  } 
 | 
} 
 | 
  
 | 
export interface ListUnitsOfMeasureColumn { 
 | 
  Name?: string; 
 | 
  ImgIsDefault?: string; 
 | 
} 
 | 
  
 | 
const listUnitsOfMeasureContextMenuItem = { 
 | 
  Create: { ContextMenu: 'listContextMenuUOM', Name: 'MenuCreate', Label: 'Create' }, 
 | 
  Edit: { ContextMenu: 'listContextMenuUOM', Name: 'MenuEdit', Label: 'Edit' }, 
 | 
  SetAsDefault: { ContextMenu: 'listContextMenuUOM', Name: 'MenuSetAsDefault', Label: 'Set as default' }, 
 | 
}; 
 | 
  
 | 
export { listUnitsOfMeasureContextMenuItem as ListUnitsOfMeasureContextMenuItem }; 
 |