yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
import { AppMP } from '../appmp';
import { CheckboxSOP } from '../../libappsop/checkboxsop';
import { DateTimeSelectorSOP } from '../../libappsop/datetimeselectorsop';
import { DialogSOP } from '../../libappsop/dialogsop';
import { LabelSOP } from '../../libappsop/labelsop';
 
export interface FormWorkflowParametersFields {
  AutomaticBasedOnCurentDate?: string;
  CurrentDate?: string;
  SpecificDate?: string;
  EnableIntegration?: string;
}
 
export class FormWorkflowParameters extends DialogSOP<FormWorkflowParametersFields> {
  public static title = 'S&OP Workflow Parameters';
  public static readonly formPath = 'Workflow > Workflow Parameters';
 
  public cbAutomaticCurrentDate = new CheckboxSOP('CheckboxCurrentDateAutomatic');
  public lblCurrentDate = new LabelSOP('LabelCurrentDate');
  public dsSpecificDate = new DateTimeSelectorSOP('DateSelectorCurrentDate');
  public cbEnableIntegration = new CheckboxSOP('CheckboxIntegration');
 
  public constructor() {
    super('SWF_DialogWorkflowParameter');
 
    // 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('AutomaticBasedOnCurentDate', this.cbAutomaticCurrentDate);
    this._uiMap.set('CurrentDate', this.lblCurrentDate);
    this._uiMap.set('SpecificDate', this.dsSpecificDate);
    this._uiMap.set('EnableIntegration', this.cbEnableIntegration);
 
  }
 
  /**
   * Toggle open/close Workflow Parameters right docked form
   *
   * @param show True = workflow parameter form should be open, False = workflow parameter form should be close
   */
  public async toggleFormWorkflowParameters(show: Boolean): Promise<void> {
    if (await this.isOpen() !== show) {
      const appDP = AppMP.getInstance();
      await appDP.abpWorkflow.click();
      await appDP.abpWorkflow.btnWorkflowParameters.click();
   }
  }
}
 
// Enable integration checkbox field need DP-MP integration configured, check toast message instead
export const toastFormWorkflowParameters = {
  enableIntegration: (): string => "Execute External Action: SOAP Client Method 'SOPDSSCClientInterface.HandleRegistration': SOAPClientParser found unexpected (end) element title in state Initial, ErrorCode 28737",
};
 
// Step description to re-use in spec file to prevent scriptor re-write each time
const stepWorkflowParametersDocked = {
  closeWorkflowParameterRightDockedPanel: (): string => `Click action bar button ${FormWorkflowParameters.formPath} to close ${FormWorkflowParameters.title} right docked panel.`,
  openWorkflowParameterRightDockedPanel: (): string => `Click action bar button ${FormWorkflowParameters.formPath} to open ${FormWorkflowParameters.title} right docked panel.`,
};
 
export { stepWorkflowParametersDocked as StepWorkflowParametersDocked };