{
  "eventsAndFunctions": [
    {
      "algorithm": {
        "parameters": [
          {
            "name": "args",
            "type": "ArgsLoadRecords"
          }
        ],
        "statements": [
          {
            "command": "Return",
            "expression": "loadGoals(^args)"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalCards_loadRecords"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "args",
            "type": "ArgsLoadRecords"
          }
        ],
        "statements": [
          {
            "command": "Return",
            "expression": "loadGoals(^args)"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalGrid_loadRecords"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "SetValue",
            "expression": "{}",
            "widgetName": "goalOptions"
          },
          {
            "command": "WriteModel",
            "expression": "\"list\"",
            "modelVariableName": "presentationType"
          },
          {
            "command": "Execute",
            "expression": "refreshGoals()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "main_init"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "WriteModel",
            "expression": "\"list\"",
            "modelVariableName": "presentationType"
          },
          {
            "command": "Execute",
            "expression": "refreshGoals()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalOptions_handlerRecordAction_list"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "WriteModel",
            "expression": "\"cards\"",
            "modelVariableName": "presentationType"
          },
          {
            "command": "Execute",
            "expression": "refreshGoals()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalOptions_handlerRecordAction_cards"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "Execute",
            "expression": "refreshGoals()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalOptions_handlerRecordAction_refresh"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Execute",
            "expression": "addGoal()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "panelOptions_handlerAction_add"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goal",
            "widgetName": "goalCards"
          },
          {
            "command": "Execute",
            "expression": "removeGoal(^goal)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          }
        ]
      },
      "name": "goalCards_handlerRecordAction_remove"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goal",
            "widgetName": "goalCards"
          },
          {
            "command": "Execute",
            "expression": "editGoal(^goal)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          }
        ]
      },
      "name": "goalCards_handlerRecordAction_edit"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goal",
            "widgetName": "goalGrid"
          },
          {
            "command": "Execute",
            "expression": "removeGoal(^goal)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          }
        ]
      },
      "name": "goalGrid_handlerRecordAction_remove"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goal",
            "widgetName": "goalGrid"
          },
          {
            "command": "Execute",
            "expression": "editGoal(^goal)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          }
        ]
      },
      "name": "goalGrid_handlerRecordAction_edit"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "presentationType",
            "variableName": "presentationType"
          },
          {
            "command": "Switch",
            "expression": "^presentationType"
          },
          {
            "children": [
              {
                "command": "Hide",
                "widgetName": "panelGrids"
              },
              {
                "command": "Refresh",
                "widgetName": "goalCards"
              },
              {
                "command": "Show",
                "widgetName": "panelCards"
              }
            ],
            "command": "Case",
            "expression": "\"cards\""
          },
          {
            "children": [
              {
                "command": "Hide",
                "widgetName": "panelCards"
              },
              {
                "command": "Refresh",
                "widgetName": "goalGrid"
              },
              {
                "command": "Show",
                "widgetName": "panelGrids"
              }
            ],
            "command": "Case",
            "expression": "\"list\""
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "presentationType",
            "type": "string"
          }
        ]
      },
      "name": "refreshGoals"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "args",
            "type": "ArgsLoadRecords"
          }
        ],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalType",
            "variableName": "goalType"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalId",
            "variableName": "goalId"
          },
          {
            "command": "Switch",
            "expression": "^goalType"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "ExtStrategicPlanMng.PlanMainGoalRetrieve(^planId, ^goalId, { fields: [\"Goals\"]})",
                "variableName": "mainGoal"
              },
              {
                "command": "Set",
                "expression": "^mainGoal.goals",
                "variableName": "goals"
              }
            ],
            "command": "Case",
            "expression": "\"mainGoal\""
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "ExtStrategicPlanMng.PlanGoalList(^planId, ^mainGoalId, ^goalId, {offset: ^args.offset, limit: ^args.limit})",
                "variableName": "goals"
              }
            ],
            "command": "Default"
          },
          {
            "command": "Return",
            "expression": "^goals"
          }
        ],
        "typeReturn": "list(ExtStrategicPlanMng.Goal)",
        "variables": [
          {
            "name": "goalType",
            "type": "string"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "goalId",
            "type": "string"
          },
          {
            "name": "mainGoal",
            "type": "ExtStrategicPlanMng.MainGoal"
          },
          {
            "name": "goals",
            "type": "list(ExtStrategicPlanMng.Goal)"
          }
        ]
      },
      "name": "loadGoals"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "goalType",
            "variableName": "goalType"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalId",
            "variableName": "goalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{mainGoalId: ^goalId, planId: ^planId, goal: null, subGoalId: null}",
                "variableName": "data"
              }
            ],
            "command": "If",
            "expression": "^goalType == \"mainGoal\""
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{mainGoalId: ^mainGoalId, planId: ^planId, goal: null, subGoalId: ^goalId}",
                "variableName": "data"
              }
            ],
            "command": "Else"
          },
          {
            "buttons": "ok-cancel",
            "command": "Open",
            "expressionIcon": "\"add.svg\"",
            "expressionStartModel": "^data",
            "expressionTitle": "\"[[Add]] [[Goal]]\"",
            "mode": "right-drawer",
            "size": "default",
            "uiComponentName": "CmpSpGoalEditor"
          },
          {
            "children": [
              {
                "command": "Execute",
                "expression": "refreshGoals()"
              },
              {
                "command": "CloseCurrent"
              }
            ],
            "command": "OnOk",
            "variableNameOpenedModel": "openedModel"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "openedModel",
            "type": "any"
          },
          {
            "name": "data",
            "type": "any"
          },
          {
            "name": "goalId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "goalType",
            "type": "string"
          }
        ]
      },
      "name": "addGoal"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          }
        ],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "goalType",
            "variableName": "goalType"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalId",
            "variableName": "goalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{mainGoalId: ^goalId, planId: ^planId, goal: ^goal, subGoalId: null}",
                "variableName": "data"
              }
            ],
            "command": "If",
            "expression": "^goalType == \"mainGoal\""
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "{mainGoalId: ^mainGoalId, planId: ^planId, goal: ^goal, subGoalId: ^goalId}",
                "variableName": "data"
              }
            ],
            "command": "Else"
          },
          {
            "buttons": "ok-cancel",
            "command": "Open",
            "expressionIcon": "\"add.svg\"",
            "expressionStartModel": "^data",
            "expressionTitle": "\"[[Add]] [[Goal]]\"",
            "mode": "right-drawer",
            "size": "default",
            "uiComponentName": "CmpSpGoalEditor"
          },
          {
            "children": [
              {
                "command": "Execute",
                "expression": "refreshGoals()"
              },
              {
                "command": "CloseCurrent"
              }
            ],
            "command": "OnOk",
            "variableNameOpenedModel": "openedModel"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "openedModel",
            "type": "any"
          },
          {
            "name": "data",
            "type": "any"
          },
          {
            "name": "goalId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "goalType",
            "type": "string"
          }
        ]
      },
      "name": "editGoal"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "goal",
            "type": "ExtStrategicPlanMng.Goal"
          }
        ],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "command": "ConfirmMessage",
            "expressionMessage": "\"[[ConfirmRemoveMainGoal]]\"",
            "expressionTitle": "\"[[ConfirmDelete]] \" + ^goal.name"
          },
          {
            "children": [
              {
                "command": "Execute",
                "expression": "ExtStrategicPlanMng.PlanGoalDelete(^planId, ^mainGoalId, ^goal.id)"
              },
              {
                "command": "Execute",
                "expression": "refreshGoals()"
              },
              {
                "command": "SendDataToParent",
                "expressionData": "{action: \"refreshTree\"}"
              }
            ],
            "command": "OnYes"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          }
        ]
      },
      "name": "removeGoal"
    }
  ],
  "model": [
    {
      "name": "goalId",
      "required": true,
      "type": "string"
    },
    {
      "name": "goalType",
      "required": true,
      "type": "string"
    },
    {
      "name": "planId",
      "required": true,
      "type": "string"
    },
    {
      "name": "mainGoalId",
      "required": false,
      "type": "string"
    },
    {
      "name": "presentationType",
      "required": false,
      "type": "string"
    }
  ],
  "root": {
    "children": [
      {
        "children": [
          {
            "actions": [
              {
                "icon": "add.svg",
                "key": "add",
                "text": "[[Add]]"
              }
            ],
            "children": [
              {
                "cssClass": "blz-padding-top-small blz-padding-right blz-padding-left blz-padding-bottom-small",
                "htmlTemplate": "<section style=\"display: inline-flex\">\n   <div class=\"blz-btn blz-btn-default blz-toolbar-element blz-component-class-enabled plain\n                         blz-border-radius blz-cast-shadow blz-border-top blz-border-right blz-border-left blz-border-bottom\"\n        style=\"width: auto; background-color: white;\" tabindex=\"-1\" onclick=\"[RecordAction:cards]\">\n        <span class=\"blz-btn-icon\">\n            <img src=\"./icons/cards.svg\" style=\"width: 16px;\" />\n        </span>\n        <span class=\"blz-btn-text\"></span>\n        <input type=\"text\"style=\"width: 1px; height: 1px;\">\n    </div>\n    <div class=\"blz-btn blz-btn-default blz-toolbar-element blz-component-class-enabled plain \n                         blz-border-radius blz-cast-shadow blz-border-top blz-border-right blz-border-left blz-border-bottom\"\n        style=\"width: auto; background-color: white;\" onclick=\"[RecordAction:list]\">\n        <span id=\"blz-button-10653-33-blz-btn-icon\" class=\"blz-btn-icon\">\n            [Icon:list.svg]\n        </span>\n        <span id=\"blz-button-10653-33-blz-btn-text\" class=\"blz-btn-text\"></span>\n        <input type=\"text\" style=\"width: 1px; height: 1px;\">\n    </div>\n    <div class=\"blz-btn blz-btn-default blz-toolbar-element blz-component-class-enabled plain \n                         blz-border-radius blz-cast-shadow blz-border-top blz-border-right blz-border-left blz-border-bottom\"\n        style=\"width: auto; background-color: white;\" onclick=\"[RecordAction:refresh]\">\n        <span class=\"blz-btn-icon\">\n            [Icon:refresh.svg]\n        </span>\n        <span class=\"blz-btn-text\"></span>\n        <input type=\"text\" style=\"width: 1px; height: 1px;\">\n    </div> \n</section>",
                "name": "goalOptions",
                "recordActions": [
                  {
                    "key": "cards"
                  },
                  {
                    "key": "list"
                  },
                  {
                    "key": "refresh"
                  }
                ],
                "widget": "HtmlRenderer"
              }
            ],
            "icon": "goal.svg",
            "layout": "responsive",
            "name": "panelOptions",
            "title": "[[Goal]]"
          },
          {
            "children": [
              {
                "actions": [],
                "columns": [
                  {
                    "align": "left",
                    "bindText": "name",
                    "header": "[[Name]]",
                    "size": 1
                  },
                  {
                    "align": "left",
                    "bindText": "period",
                    "header": "[[Period]]",
                    "key": "period"
                  },
                  {
                    "align": "left",
                    "bindText": "percentageAmount",
                    "header": "[[Percentage]]",
                    "key": "percentageAmount"
                  },
                  {
                    "align": "left",
                    "bindText": "goalValue",
                    "header": "[[Value]]",
                    "key": "value"
                  },
                  {
                    "align": "left",
                    "header": "[[RemainingValue]]",
                    "key": "remainingValue"
                  }
                ],
                "cssClass": "blz-area-default",
                "name": "goalGrid",
                "pageSize": 10,
                "recordActions": [
                  {
                    "contextMenu": true,
                    "icon": "edit.svg",
                    "key": "edit",
                    "text": "[[Edit]]"
                  },
                  {
                    "contextMenu": true,
                    "icon": "remove.svg",
                    "key": "remove",
                    "text": "[[Remove]]"
                  }
                ],
                "typeName": "ExtStrategicPlanMng.Goal",
                "widget": "Grid",
                "withPaging": true
              }
            ],
            "cssClass": "blz-padding-top-small blz-padding-right-small blz-padding-left-small blz-padding-bottom-small",
            "layout": "responsive",
            "name": "panelGrids"
          },
          {
            "children": [
              {
                "actions": [],
                "cssClass": "blz-cards-main",
                "htmlTemplate": "<section class=\"blz-cards-brief\">\n    <article class=\"blz-cards-header\">\n        <section class=\"blz-cards-header-logo\">\n\t\t\t<img class=\"header-img\" src=\"./icons/goal.svg\"/>\n\t\t</section>\n        <section class=\"blz-cards-title\">\n            <article class=\"header-title\">\n                <span class=\"blz-text-title-md blz-text-bold blz-text-xlarge\">{{name}}</span>\n                <section>\n                    <span>[[Code]]: {{id}}</span>                     \n                </section>\n            </article>\n           <section class=\"blz-cards-header-dots\" style=\"max-width: 24px; max-height: 24px;\" onclick=\"[MultipleRecordAction:edit,remove]\">[Icon:dots-menu.svg]</section>\n        </section>\n    </article>\n    <article class=\"blz-cards-middle\">\n        <section class=\"blz-area-information\">\n            <p class=\"blz-text-bold blz-text-large\"><span>{{description}}</span></p> \n        </section>\n    </article>\n    <article class=\"blz-cards-content blz-area-brief\">\n         <span>[[Period]]: {{period}} </span>\n         <span>[[Value]] : {{goalValue}}</span>\n         <span>[[RemainingValue]]: </span>        \n    </article>\n</section>",
                "name": "goalCards",
                "pageSize": 10,
                "recordActions": [
                  {
                    "icon": "list.svg",
                    "key": "detail",
                    "text": "[[Details]]"
                  },
                  {
                    "icon": "edit.svg",
                    "key": "edit",
                    "text": "[[Edit]]"
                  },
                  {
                    "icon": "remove.svg",
                    "key": "remove",
                    "text": "[[Remove]]"
                  }
                ],
                "typeName": "ExtStrategicPlanMng.Goal",
                "widget": "HtmlRepeater",
                "withPaging": true
              }
            ],
            "layout": "responsive",
            "name": "panelCards"
          }
        ],
        "cssClass": "blz-area-default",
        "layout": "responsive"
      }
    ],
    "layout": "responsive"
  },
  "routing": {
    "path": "/cust-360-quotes/{partyRoleId}"
  },
  "unused": []
}