{
  "eventsAndFunctions": [
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoal",
            "variableName": "mainGoal"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "GetValue",
            "variableName": "name",
            "widgetName": "txtName"
          },
          {
            "command": "GetValue",
            "variableName": "description",
            "widgetName": "txtDescription"
          },
          {
            "command": "GetValue",
            "variableName": "scope",
            "widgetName": "cboScope"
          },
          {
            "command": "GetValue",
            "variableName": "goalValue",
            "widgetName": "txtGoalValue"
          },
          {
            "command": "GetValue",
            "variableName": "entity",
            "widgetName": "cboEntity"
          },
          {
            "command": "GetValue",
            "variableName": "measure",
            "widgetName": "cboMeasure"
          },
          {
            "command": "GetValue",
            "variableName": "dimensionDate",
            "widgetName": "txtDimensionDate"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{}",
                "variableName": "edition"
              },
              {
                "command": "Set",
                "expression": "^name",
                "variableName": "edition.name"
              },
              {
                "command": "Set",
                "expression": "^description",
                "variableName": "edition.description"
              },
              {
                "command": "Set",
                "expression": "^scope",
                "variableName": "edition.scope"
              },
              {
                "command": "Set",
                "expression": "^goalValue",
                "variableName": "edition.goalValue"
              },
              {
                "command": "Set",
                "expression": "ExtStrategicPlanMng.PlanMainGoalUpdate(^planId, ^mainGoal.id, ^edition)",
                "variableName": "mainGoal"
              }
            ],
            "command": "If",
            "expression": "IsNotNull(^mainGoal.id)"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{ filters: [], goals: [], dimensionDate: \"\"}",
                "variableName": "creation"
              },
              {
                "command": "Set",
                "expression": "^name",
                "variableName": "creation.name"
              },
              {
                "command": "Set",
                "expression": "^description",
                "variableName": "creation.description"
              },
              {
                "command": "Set",
                "expression": "^scope",
                "variableName": "creation.scope"
              },
              {
                "command": "Set",
                "expression": "^goalValue",
                "variableName": "creation.goalValue"
              },
              {
                "command": "Set",
                "expression": "{id: ^entity}",
                "variableName": "creation.entity"
              },
              {
                "command": "Set",
                "expression": "{id: ^measure}",
                "variableName": "creation.measure"
              },
              {
                "command": "Set",
                "expression": "^dimensionDate",
                "variableName": "creation.dimensionDate"
              },
              {
                "command": "Set",
                "expression": "ExtStrategicPlanMng.PlanMainGoalCreate(^planId, ^creation)",
                "variableName": "mainGoal"
              }
            ],
            "command": "Else"
          },
          {
            "command": "SendDataToParent",
            "expressionData": "^mainGoal"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "creation",
            "type": "ExtStrategicPlanMng.MainGoalCreation"
          },
          {
            "name": "edition",
            "type": "ExtStrategicPlanMng.MainGoalEdition"
          },
          {
            "name": "mainGoal",
            "type": "ExtStrategicPlanMng.MainGoal"
          },
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "description",
            "type": "string"
          },
          {
            "name": "scope",
            "type": "string"
          },
          {
            "name": "entity",
            "type": "string"
          },
          {
            "name": "measure",
            "type": "string"
          },
          {
            "name": "goalValue",
            "type": "decimal"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "dimensionDate",
            "type": "string"
          }
        ]
      },
      "name": "main_submit"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Set",
            "expression": "{}",
            "variableName": "args"
          },
          {
            "command": "Set",
            "expression": "\"sales\"",
            "variableName": "domainId"
          },
          {
            "command": "WriteModel",
            "expression": "^domainId",
            "modelVariableName": "domainId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "domainId",
            "variableName": "domainId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoal",
            "variableName": "mainGoal"
          },
          {
            "children": [
              {
                "command": "Disable",
                "widgetName": "cboMeasure"
              },
              {
                "command": "Disable",
                "widgetName": "cboEntity"
              }
            ],
            "command": "If",
            "expression": "IsNotNull(^mainGoal.id)"
          },
          {
            "children": [
              {
                "command": "SetValue",
                "expression": "\"ControlDate\"",
                "widgetName": "txtDimensionDate"
              }
            ],
            "command": "Else"
          },
          {
            "command": "Load",
            "expression": "Select(ExtStrategicPlanMng.EntityList(^domainId, ^args),[id, name])",
            "widgetName": "cboEntity"
          },
          {
            "command": "Load",
            "expression": "Select(ExtStrategicPlanMng.ScopesList(), [id, name])",
            "widgetName": "cboScope"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "domainId",
            "type": "string"
          },
          {
            "name": "args",
            "type": "ExtStrategicPlanMng.ArgsEntityList"
          },
          {
            "name": "mainGoal",
            "type": "ExtStrategicPlanMng.MainGoal"
          }
        ]
      },
      "name": "main_init"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "oldValue",
            "type": "any"
          },
          {
            "name": "newValue",
            "type": "any"
          }
        ],
        "statements": [
          {
            "command": "Set",
            "expression": "{}",
            "variableName": "args"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "domainId",
            "variableName": "domainId"
          },
          {
            "command": "Load",
            "expression": "Select(ExtStrategicPlanMng.EntityMeasuresList(^domainId, ^newValue, ^args),[id, name])",
            "widgetName": "cboMeasure"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "domainId",
            "type": "string"
          },
          {
            "name": "args",
            "type": "ExtStrategicPlanMng.ArgsEntityMeasuresList"
          }
        ]
      },
      "name": "cboEntity_change"
    }
  ],
  "model": [
    {
      "name": "mainGoal",
      "required": true,
      "type": "ExtStrategicPlanMng.MainGoal"
    },
    {
      "name": "domainId",
      "required": true,
      "type": "string"
    },
    {
      "name": "planId",
      "required": true,
      "type": "string"
    }
  ],
  "root": {
    "children": [
      {
        "children": [
          {
            "binding": "mainGoal.name",
            "label": "[[Name]]",
            "last": true,
            "mandatory": true,
            "name": "txtName",
            "size": 2,
            "widget": "TextBox"
          },
          {
            "binding": "mainGoal.entity.id",
            "dataFormat": "KeyValueList",
            "label": "[[Entity]]",
            "last": true,
            "mandatory": true,
            "name": "cboEntity",
            "size": 2,
            "widget": "ComboBox"
          },
          {
            "binding": "mainGoal.dimensionDate",
            "label": "[[DimensionDate]]",
            "last": true,
            "mandatory": true,
            "name": "txtDimensionDate",
            "size": 2,
            "widget": "TextBox"
          },
          {
            "binding": "mainGoal.measure.id",
            "dataFormat": "KeyValueList",
            "label": "[[Measure]]",
            "last": true,
            "mandatory": true,
            "name": "cboMeasure",
            "size": 2,
            "widget": "ComboBox"
          },
          {
            "allowDecimals": true,
            "binding": "mainGoal.goalValue",
            "decimalPlaces": 2,
            "label": "[[GoalValue]]",
            "last": true,
            "mandatory": true,
            "name": "txtGoalValue",
            "size": 2,
            "widget": "NumericBox"
          },
          {
            "binding": "mainGoal.scope.id",
            "dataFormat": "KeyValueList",
            "label": "[[Scope]]",
            "last": true,
            "mandatory": true,
            "name": "cboScope",
            "size": 2,
            "widget": "ComboBox"
          },
          {
            "binding": "mainGoal.description",
            "label": "[[Description]]",
            "last": true,
            "name": "txtDescription",
            "size": 2,
            "widget": "TextArea"
          }
        ],
        "layout": "form",
        "name": "frmMainGoal"
      }
    ],
    "layout": "responsive"
  },
  "routing": null,
  "unused": []
}