{
  "eventsAndFunctions": [
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "Set",
            "expression": "ExtStrategicPlanMng.PlanRetrieve(^planId)",
            "variableName": "plan"
          },
          {
            "command": "SetValue",
            "expression": "^plan",
            "widgetName": "renPlanTitle"
          },
          {
            "command": "OpenInContainer",
            "expressionIcon": "\"\"",
            "expressionStartModel": "{planId: ^planId, actions: true}",
            "expressionTitle": "\"\"",
            "uiComponentName": "CmpSfPlanGoalsTree",
            "widgetNameContainer": "planGoalsTreeContainer"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "plan",
            "type": "ExtStrategicPlanMng.Plan"
          }
        ]
      },
      "name": "main_init"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "data",
            "type": "any"
          }
        ],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "children": [
              {
                "children": [
                  {
                    "command": "OpenInContainer",
                    "expressionIcon": "\"\"",
                    "expressionStartModel": "{planId: ^planId, goalId: ^data.goalId, goalType: ^data.goalType, mainGoalId: ^data.mainGoalId}",
                    "expressionTitle": "\"\"",
                    "uiComponentName": "CmpSfGoalMain",
                    "widgetNameContainer": "planGoalMainContainer"
                  }
                ],
                "command": "If",
                "expression": "IsNotNull(^data.goalId)"
              },
              {
                "children": [],
                "command": "Else"
              }
            ],
            "command": "If",
            "expression": "Contains(^data.action,\"openGoal\")"
          },
          {
            "children": [
              {
                "buttons": "ok-cancel",
                "command": "Open",
                "expressionIcon": "\"add.svg\"",
                "expressionStartModel": "{mainGoal: null, planId: ^planId}",
                "expressionTitle": "\"[[Add]] [[MainGoal]]\"",
                "mode": "right-drawer",
                "size": "default",
                "uiComponentName": "CmpSpMainGoalEditor"
              },
              {
                "children": [
                  {
                    "command": "SendDataToChild",
                    "expressionData": "{action: \"refresh\"}",
                    "widgetNameContainer": "planGoalsTreeContainer"
                  },
                  {
                    "command": "CloseCurrent"
                  }
                ],
                "command": "OnOk",
                "variableNameOpenedModel": "openedModel"
              }
            ],
            "command": "ElseIf",
            "expression": "Contains(^data.action, \"createMainGoal\")"
          },
          {
            "children": [
              {
                "command": "SendDataToChild",
                "expressionData": "{action: \"refresh\"}",
                "widgetNameContainer": "planGoalsTreeContainer"
              },
              {
                "command": "OpenInContainer",
                "expressionIcon": "\"\"",
                "expressionStartModel": "{}",
                "expressionTitle": "\"\"",
                "uiComponentName": "CmpSpEmpty",
                "widgetNameContainer": "planGoalMainContainer"
              }
            ],
            "command": "ElseIf",
            "expression": "Contains(^data.action, \"mainGoalDeleted\") || Contains(^data.action, \"goalDeleted\")"
          },
          {
            "children": [
              {
                "buttons": "ok-cancel",
                "command": "Open",
                "expressionIcon": "\"add.svg\"",
                "expressionStartModel": "{mainGoalId: ^data.mainGoalId, planId: ^planId, goal: null, subGoalId: ^data.goalId}",
                "expressionTitle": "\"[[Add]] [[Goal]]\"",
                "mode": "right-drawer",
                "size": "default",
                "uiComponentName": "CmpSpGoalEditor"
              },
              {
                "children": [
                  {
                    "command": "SendDataToChild",
                    "expressionData": "{action: \"refresh\"}",
                    "widgetNameContainer": "planGoalsTreeContainer"
                  },
                  {
                    "command": "CloseCurrent"
                  }
                ],
                "command": "OnOk",
                "variableNameOpenedModel": "openedModel"
              }
            ],
            "command": "ElseIf",
            "expression": "Contains(^data.action, \"createGoal\")"
          },
          {
            "children": [
              {
                "command": "SendDataToChild",
                "expressionData": "{action: \"refresh\"}",
                "widgetNameContainer": "planGoalsTreeContainer"
              }
            ],
            "command": "ElseIf",
            "expression": "Contains(^data.action, \"refreshTree\")"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "openedModel",
            "type": "any"
          }
        ]
      },
      "name": "main_receiveData"
    }
  ],
  "model": [
    {
      "name": "planId",
      "required": true,
      "type": "string"
    }
  ],
  "root": {
    "children": [
      {
        "children": [
          {
            "cssClass": "blz-area-default blz-padding-top blz-padding-right blz-padding-left blz-padding-bottom blz-border-top blz-border-right blz-border-left blz-border-bottom blz-border-radius blz-cast-shadow",
            "htmlTemplate": "<div class=\"blz-header-cards\">\n\t<div class=\"blz-header-icon-container\">\n\t\t<span class=\"icon\">\n\t\t\t<img src=\"./icons/plan.svg#root\" />\n\t\t</span>\n\t</div>\n\t<div class=\"blz-header-text-container\">\n\t\t<div class=\"main-title\">\n\t\t\t[[StrategicSalesPlan]]\n\t\t</div>\n\t\t<div class=\"main-subtitle\">\n\t\t\t<span class=\"header\">\n\t\t\t\t{{name}} - ({{dateFormat fromDate format=\"DD/MM/YYYY\"}} - {{dateFormat toDate format=\"DD/MM/YYYY\"}})\n\t\t\t</span>\n\t\t\t<div class=\"details\">\n\t\t\t\t<span>\n\t\t\t\t\t[[ControlFrequency]] {{#if controlFrequency}}[[{{controlFrequency}}]]{{/if}}\n\t\t\t\t</span>\n\t\t\t\t<span>\n\t\t\t\t\t[[PartialFrequency]] {{#if partialFrequency}}[[{{partialFrequency}}]]{{/if}}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</div>\n\t</div> \n</div>",
            "name": "renPlanTitle",
            "typeName": "ExtStrategicPlanMng.Plan",
            "widget": "HtmlRenderer"
          }
        ],
        "cssClass": "blz-padding-bottom",
        "layout": "responsive"
      },
      {
        "children": [
          {
            "cssClass": "blz-area-default blz-padding-top blz-padding-right blz-padding-left blz-padding-bottom blz-border-top blz-border-right blz-border-left blz-border-bottom blz-border-radius blz-cast-shadow",
            "name": "planGoalsTreeContainer",
            "widget": "FixedContainer"
          }
        ],
        "cssClass": "blz-padding-right",
        "layout": "responsive",
        "size": 5
      },
      {
        "children": [
          {
            "name": "planGoalMainContainer",
            "widget": "FixedContainer"
          }
        ],
        "layout": "responsive",
        "size": 7
      }
    ],
    "cssClass": "blz-padding-top blz-padding-right blz-padding-left blz-padding-bottom",
    "layout": "responsive"
  },
  "routing": {
    "path": "/sf-plan/{planId}"
  },
  "unused": []
}