Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { PanelBase } from '../../libappbase/panelbase';
import { DialogSOP } from '../../libappsop/dialogsop';
import { EditFieldSOP } from '../../libappsop/editfieldsop';
import { CheckboxSOP } from '../../libappsop/checkboxsop';
import { DropDownListSOP } from '../../libappsop/dropdownlistsop';
 
export interface DialogProductFields {
  ParentProduct?: string;
  Name?: string;
  ID?: string;
  UoM?: string;
  ShelfLife?: string;
  ShelfLifeEnabled?: string;
  Maturation?: string;
  MaturationEnabled?: string;
}
 
export class DialogProduct extends DialogSOP<DialogProductFields> {
  public static title = 'Product';
  public static tabAdvancedTitle = 'Advanced';
 
  public pnlAdvanced = new PanelBase('PanelAdvanced');
  public ddlParent = new DropDownListSOP('selParentProduct');
  public efName = new EditFieldSOP('EditFieldName');
  public efID = new EditFieldSOP('EditFieldID');
  public ddlUoM = new DropDownListSOP('DropDownListUOM');
  public efShelfLife = new EditFieldSOP('EditFieldShelfLife');
  public cbHasShelfLife = new CheckboxSOP('CheckBoxHasShelfLife');
  public efMaturation = new EditFieldSOP('EditFieldMaturation');
  public cbHasMaturation = new CheckboxSOP('CheckBoxHasMaturation');
 
  public constructor() {
    super('DialogCreateEditProduct');
 
    // 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('ParentProduct', this.ddlParent);
    this._uiMap.set('Name', this.efName);
    this._uiMap.set('ID', this.efID);
    this._uiMap.set('UoM', this.ddlUoM);
    this._uiMap.set('ShelfLife', this.efShelfLife);
    this._uiMap.set('ShelfLifeEnabled', this.cbHasShelfLife);
    this._uiMap.set('Maturation', this.efMaturation);
    this._uiMap.set('MaturationEnabled', this.cbHasMaturation);
  }
}