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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
 * @file          Campaign Dialog
 * @author        Mehrab Kamrani (mehrab.hassan@3ds.com)
 */
import { DialogSOP } from '../../libappsop/dialogsop';
import { DropDownListSOP } from '../../libappsop/dropdownlistsop';
import { DurationSelectorSOP } from '../../libappsop/durationselectorsop';
import { DateTimeSelectorSOP } from '../../libappsop/datetimeselectorsop';
import { RadioButtonSOP } from '../../libappsop/radiobuttonsop';
import { EditFieldSOP } from '../../libappsop/editfieldsop';
import { LabelSOP } from '../../libappsop/labelsop';
 
export class DialogCampaign extends DialogSOP<DialogCampaignFields> {
  public static readonly title = 'Campaign';
  public readonly name = 'Campaign';
  private readonly _ddlCampaignType = new DropDownListSOP('selCampaignType_MP');
  private readonly _dsEarliestStart = new DateTimeSelectorSOP('dsEarliestStart');
 
  private readonly _rbgInputType = new RadioButtonSOP('RadioButtonGroupQuantityDuration');
  private readonly _efMinQuantity = new EditFieldSOP('EditorCampaignMinQuantity');
  private readonly _efMaxQuantity = new EditFieldSOP('EditorCampaignMaxQuantity');
  private readonly _efMinDuration = new DurationSelectorSOP('DurationSelectorMinDuration', { Days: 0, Hours: 0, Minutes: 0 });
  private readonly _efMaxDuration = new DurationSelectorSOP('DurationSelectorMaxDuration', { Days: 0, Hours: 0, Minutes: 0 });
  private readonly _efComment = new EditFieldSOP('edtComment');
 
  // Labels for indicative values
  private readonly _lblIndicatedDurationBasedOnMinQuantity = new LabelSOP('LabelIndicatedDurationBasedOnMinQty');
  private readonly _lblIndicatedDurationBasedOnMaxQuantity = new LabelSOP('LabelIndicatedDurationBasedOnMaxQty');
  private readonly _lblIndicatedQuantityBasedOnMinDuration = new LabelSOP('LabelIndicatedQuantityBasedOnMinDuration');
  private readonly _lblIndicatedQuantityBasedOnMaxDuration = new LabelSOP('LabelIndicatedQuantityBasedOnMaxDuration');
 
  public constructor() {
    super('DialogCreateEditCampaign', 'btnOK', 'btnCancel');
 
    // 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('Campaign type', this._ddlCampaignType);
    this._uiMap.set('Earliest start', this._dsEarliestStart);
    this._uiMap.set('Input type', this._rbgInputType);
    this._uiMap.set('Minimum quantity', this._efMinQuantity);
    this._uiMap.set('Maximum quantity', this._efMaxQuantity);
    this._uiMap.set('Minimum duration', this._efMinDuration);
    this._uiMap.set('Maximum duration', this._efMaxDuration);
    this._uiMap.set('Indicated Duration BasedOn MinQty', this._lblIndicatedDurationBasedOnMinQuantity);
    this._uiMap.set('Indicated Duration BasedOn MaxQty', this._lblIndicatedDurationBasedOnMaxQuantity);
    this._uiMap.set('Indicated Quantity BasedOn MinDuration', this._lblIndicatedQuantityBasedOnMinDuration);
    this._uiMap.set('Indicated Quantity BasedOn MaxDuration', this._lblIndicatedQuantityBasedOnMaxDuration);
    this._uiMap.set('Comment', this._efComment);
  }
}
 
export interface DialogCampaignFields {
  'Campaign type'?: string;
  'Earliest start'?: string;
  'Input type'?: string;
  'Minimum quantity'?: string;
  'Maximum quantity'?: string;
  'Minimum duration'?: string;
  'Maximum duration'?: string;
  'Indicated Duration BasedOn MinQty'?: string;
  'Indicated Duration BasedOn MaxQty'?: string;
  'Indicated Quantity BasedOn MinDuration'?: string;
  'Indicated Quantity BasedOn MaxDuration'?: string;
  Comment?: string;
}