{
  "eventsAndFunctions": [
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "goal",
            "variableName": "goal"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "subGoalId",
            "variableName": "subGoalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "GetValue",
            "variableName": "name",
            "widgetName": "txtName"
          },
          {
            "command": "GetValue",
            "variableName": "description",
            "widgetName": "txtDescription"
          },
          {
            "command": "GetValue",
            "variableName": "fixedAmount",
            "widgetName": "txtFixedAmount"
          },
          {
            "command": "GetValue",
            "variableName": "percentageAmount",
            "widgetName": "txtPercentageAmount"
          },
          {
            "command": "GetValue",
            "variableName": "period",
            "widgetName": "txtPeriod"
          },
          {
            "command": "GetValue",
            "variableName": "snapshotFrequency",
            "widgetName": "txtSnapshotFrequency"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{}",
                "variableName": "edition"
              },
              {
                "command": "Set",
                "expression": "^name",
                "variableName": "edition.name"
              },
              {
                "command": "Set",
                "expression": "^description",
                "variableName": "edition.description"
              },
              {
                "command": "Set",
                "expression": "^fixedAmount",
                "variableName": "edition.fixedAmount"
              },
              {
                "command": "Set",
                "expression": "^percentageAmount",
                "variableName": "edition.percentageAmount"
              },
              {
                "command": "Set",
                "expression": "ExtStrategicPlanMng.PlanGoalUpdate(^planId, ^mainGoalId, ^goal.id, ^edition)",
                "variableName": "goal"
              }
            ],
            "command": "If",
            "expression": "IsNotNull(^goal.id)"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{ filters: [], partials: [], supportMeasures: []}",
                "variableName": "creation"
              },
              {
                "command": "Set",
                "expression": "^name",
                "variableName": "creation.name"
              },
              {
                "command": "Set",
                "expression": "^description",
                "variableName": "creation.description"
              },
              {
                "command": "Set",
                "expression": "^fixedAmount",
                "variableName": "creation.fixedAmount"
              },
              {
                "command": "Set",
                "expression": "^percentageAmount",
                "variableName": "creation.percentageAmount"
              },
              {
                "command": "Set",
                "expression": "^period",
                "variableName": "creation.period"
              },
              {
                "command": "Set",
                "expression": "^snapshotFrequency",
                "variableName": "creation.snapshotFrequency"
              },
              {
                "children": [
                  {
                    "command": "Set",
                    "expression": "ExtStrategicPlanMng.PlanMainGoalCreateGoal(^planId, ^mainGoalId, ^creation)",
                    "variableName": "goal"
                  }
                ],
                "command": "If",
                "expression": "IsNullOrWhiteSpace(^subGoalId)"
              },
              {
                "children": [
                  {
                    "command": "Set",
                    "expression": "ExtStrategicPlanMng.PlanGoalCreate(^planId, ^mainGoalId, ^subGoalId, ^creation)",
                    "variableName": "goal"
                  }
                ],
                "command": "Else"
              }
            ],
            "command": "Else"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "creation",
            "type": "ExtStrategicPlanMng.GoalCreation"
          },
          {
            "name": "edition",
            "type": "ExtStrategicPlanMng.GoalEdition"
          },
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "subGoalId",
            "type": "string"
          },
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "description",
            "type": "string"
          },
          {
            "name": "fixedAmount",
            "type": "decimal"
          },
          {
            "name": "percentageAmount",
            "type": "decimal"
          },
          {
            "name": "period",
            "type": "integer"
          },
          {
            "name": "snapshotFrequency",
            "type": "integer"
          }
        ]
      },
      "name": "main_submit"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "goal",
            "variableName": "goal"
          },
          {
            "command": "Execute",
            "expression": "setVisibility()"
          },
          {
            "command": "Load",
            "expression": "Select(getTypeAmount(), [code, name])",
            "widgetName": "cbTypeAmount"
          },
          {
            "children": [
              {
                "command": "Disable",
                "widgetName": "txtSnapshotFrequency"
              },
              {
                "command": "Disable",
                "widgetName": "txtPeriod"
              }
            ],
            "command": "If",
            "expression": "IsNotNull(^goal.id)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "domainId",
            "type": "string"
          },
          {
            "name": "args",
            "type": "ExtStrategicPlanMng.ArgsEntityList"
          },
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          }
        ]
      },
      "name": "main_init"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "oldValue",
            "type": "any"
          },
          {
            "name": "newValue",
            "type": "any"
          }
        ],
        "statements": [
          {
            "command": "Execute",
            "expression": "setVisibility()"
          },
          {
            "children": [
              {
                "command": "Show",
                "widgetName": "txtFixedAmount"
              }
            ],
            "command": "If",
            "expression": "^newValue == \"FIXED\""
          },
          {
            "children": [
              {
                "command": "Show",
                "widgetName": "txtPercentageAmount"
              }
            ],
            "command": "Else"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "cbTypeAmount_change"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Return",
            "expression": "[{\n        code: \"FIXED\",\n        name: \"[[FixedAmount]]\"\n    },\n    {\n        code: \"PERCENTAGE\",\n        name: \"[[PercentageAmount]]\"\n    }\n]"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "getTypeAmount"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Hide",
            "widgetName": "txtFixedAmount"
          },
          {
            "command": "Hide",
            "widgetName": "txtPercentageAmount"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "setVisibility"
    }
  ],
  "model": [
    {
      "name": "goal",
      "required": true,
      "type": "ExtStrategicPlanMng.Goal"
    },
    {
      "name": "planId",
      "required": true,
      "type": "string"
    },
    {
      "name": "mainGoalId",
      "required": false,
      "type": "string"
    },
    {
      "name": "subGoalId",
      "required": false,
      "type": "string"
    }
  ],
  "root": {
    "children": [
      {
        "children": [
          {
            "binding": "goal.name",
            "label": "[[Name]]",
            "last": true,
            "mandatory": true,
            "name": "txtName",
            "size": 2,
            "widget": "TextBox"
          },
          {
            "binding": "goal.description",
            "label": "[[Description]]",
            "last": true,
            "name": "txtDescription",
            "size": 2,
            "widget": "TextArea"
          },
          {
            "dataFormat": "KeyValueList",
            "label": "[[TypeAmount]]",
            "last": true,
            "mandatory": true,
            "name": "cbTypeAmount",
            "size": 2,
            "widget": "ComboBox"
          },
          {
            "allowDecimals": true,
            "binding": "goal.fixedAmount",
            "decimalPlaces": 2,
            "label": "[[FixedAmount]]",
            "last": true,
            "name": "txtFixedAmount",
            "size": 2,
            "widget": "NumericBox"
          },
          {
            "allowDecimals": true,
            "binding": "goal.percentageAmount",
            "decimalPlaces": 2,
            "label": "[[PercentageAmount]]",
            "last": true,
            "name": "txtPercentageAmount",
            "size": 2,
            "widget": "NumericBox"
          },
          {
            "binding": "goal.period",
            "label": "[[Period]]",
            "mandatory": true,
            "name": "txtPeriod",
            "widget": "NumericBox"
          },
          {
            "binding": "goal.snapshotFrequency",
            "label": "[[SnapshotFrequency]]",
            "last": true,
            "name": "txtSnapshotFrequency",
            "widget": "NumericBox"
          }
        ],
        "layout": "form"
      }
    ],
    "layout": "responsive"
  },
  "routing": null,
  "unused": []
}