{
  "eventsAndFunctions": [
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Execute",
            "expression": "setVisibility()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "main_init"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "args",
            "type": "ArgsLoadRecords"
          }
        ],
        "statements": [
          {
            "command": "Return",
            "expression": "loadGoalFilters(^args)"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalFilterRepeater_loadRecords"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "args",
            "type": "ArgsLoadRecords"
          }
        ],
        "statements": [
          {
            "command": "Return",
            "expression": "loadGoalFilters(^args)"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalFilterGrid_loadRecords"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "WriteModel",
            "expression": "\"cardsView\"",
            "modelVariableName": "presentationType"
          },
          {
            "command": "Execute",
            "expression": "setVisibility()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalFilterContainer_handlerAction_cardsView"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "WriteModel",
            "expression": "\"listView\"",
            "modelVariableName": "presentationType"
          },
          {
            "command": "Execute",
            "expression": "setVisibility()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalFilterContainer_handlerAction_listView"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Execute",
            "expression": "refresh()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalFilterContainer_handlerAction_refresh"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goalFilter",
            "widgetName": "goalFilterGrid"
          },
          {
            "command": "Execute",
            "expression": "editGoalFilter(^goalFilter)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goalFilter",
            "type": "ExtStrategicPlanMng.GoalFilter"
          },
          {
            "name": "openedModel",
            "type": "any"
          }
        ]
      },
      "name": "goalFilterGrid_handlerRecordAction_edit"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goalFilter",
            "widgetName": "goalFilterRepeater"
          },
          {
            "command": "Execute",
            "expression": "editGoalFilter(^goalFilter)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goalFilter",
            "type": "ExtStrategicPlanMng.GoalFilter"
          }
        ]
      },
      "name": "goalFilterRepeater_handlerRecordAction_edit"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goalFilter",
            "widgetName": "goalFilterRepeater"
          },
          {
            "command": "Execute",
            "expression": "removeGoalFilter(^goalFilter)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goalFilter",
            "type": "ExtStrategicPlanMng.GoalFilter"
          }
        ]
      },
      "name": "goalFilterRepeater_handlerRecordAction_remove"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "recordRef",
            "type": "string"
          },
          {
            "name": "arg",
            "type": "string"
          }
        ],
        "statements": [
          {
            "command": "ReadRecord",
            "expressionRecordRef": "^recordRef",
            "variableName": "goalFilter",
            "widgetName": "goalFilterGrid"
          },
          {
            "command": "Execute",
            "expression": "removeGoalFilter(^goalFilter)"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "goalFilter",
            "type": "ExtStrategicPlanMng.GoalFilter"
          }
        ]
      },
      "name": "goalFilterGrid_handlerRecordAction_remove"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Execute",
            "expression": "addGoalFilter()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalFilterRepeater_handlerAction_add"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Execute",
            "expression": "addGoalFilter()"
          }
        ],
        "typeReturn": "any",
        "variables": []
      },
      "name": "goalFilterGrid_handlerAction_add"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "args",
            "type": "ArgsLoadRecords"
          }
        ],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalId",
            "variableName": "goalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalType",
            "variableName": "goalType"
          },
          {
            "command": "Set",
            "expression": "[]",
            "variableName": "listGoalFilter"
          },
          {
            "command": "Switch",
            "expression": "^goalType"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "ExtStrategicPlanMng.PlanMainGoalFilterList(^planId, ^mainGoalId)",
                "variableName": "listGoalFilter"
              }
            ],
            "command": "Case",
            "expression": "\"mainGoal\""
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "ExtStrategicPlanMng.PlanGoalFilterList(^planId, ^mainGoalId, ^goalId)",
                "variableName": "listGoalFilter"
              }
            ],
            "command": "Default"
          },
          {
            "children": [
              {
                "command": "Set",
                "expression": "getValues(^goalFilter.values)",
                "variableName": "goalFilter.name"
              }
            ],
            "command": "ForEach",
            "expressionList": "^listGoalFilter",
            "variableNameItem": "goalFilter"
          },
          {
            "command": "Return",
            "expression": "SortDescending(^listGoalFilter, [id])"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "listGoalFilter",
            "type": "list(ExtStrategicPlanMng.GoalFilter)"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "goalId",
            "type": "string"
          },
          {
            "name": "goalType",
            "type": "string"
          },
          {
            "name": "goalFilter",
            "type": "ExtStrategicPlanMng.GoalFilter"
          }
        ]
      },
      "name": "loadGoalFilters"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "presentationType",
            "variableName": "presentationType"
          },
          {
            "children": [
              {
                "command": "WriteModel",
                "expression": "\"listView\"",
                "modelVariableName": "presentationType"
              },
              {
                "command": "Set",
                "expression": "\"listView\"",
                "variableName": "presentationType"
              }
            ],
            "command": "If",
            "expression": "IsNull(^presentationType)"
          },
          {
            "children": [
              {
                "command": "Show",
                "widgetName": "goalFilterRepeater"
              },
              {
                "command": "Hide",
                "widgetName": "goalFilterGrid"
              }
            ],
            "command": "If",
            "expression": "^presentationType == \"cardsView\""
          },
          {
            "children": [
              {
                "command": "Show",
                "widgetName": "goalFilterGrid"
              },
              {
                "command": "Hide",
                "widgetName": "goalFilterRepeater"
              }
            ],
            "command": "Else"
          },
          {
            "command": "Execute",
            "expression": "refresh()"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "presentationType",
            "type": "string"
          }
        ]
      },
      "name": "setVisibility"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "presentationType",
            "variableName": "presentationType"
          },
          {
            "children": [
              {
                "command": "Refresh",
                "widgetName": "goalFilterRepeater"
              }
            ],
            "command": "If",
            "expression": "^presentationType == \"cardsView\""
          },
          {
            "children": [
              {
                "command": "Refresh",
                "widgetName": "goalFilterGrid"
              }
            ],
            "command": "Else"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "presentationType",
            "type": "string"
          }
        ]
      },
      "name": "refresh"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "goalFilter",
            "type": "ExtStrategicPlanMng.GoalFilter"
          }
        ],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalId",
            "variableName": "goalId"
          },
          {
            "command": "ConfirmMessage",
            "expressionMessage": "\"[[RemoveGoalFilterMsg]]\"",
            "expressionTitle": "\"[[RemoveGoalFilterTitle]]\""
          },
          {
            "children": [
              {
                "children": [
                  {
                    "command": "Execute",
                    "expression": "ExtStrategicPlanMng.PlanGoalFilterDelete(^planId, ^goalId,^mainGoalId, ^goalFilter.id)"
                  }
                ],
                "command": "If",
                "expression": "IsNotNull(^goalId)"
              },
              {
                "children": [
                  {
                    "command": "Execute",
                    "expression": "ExtStrategicPlanMng.PlanMainGoalFilterDelete(^planId, ^mainGoalId, ^goalFilter.id)"
                  }
                ],
                "command": "Else"
              },
              {
                "command": "Execute",
                "expression": "refresh()"
              }
            ],
            "command": "OnYes"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "goalId",
            "type": "string"
          }
        ]
      },
      "name": "removeGoalFilter"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalId",
            "variableName": "goalId"
          },
          {
            "buttons": "ok-cancel",
            "command": "Open",
            "expressionIcon": "\"add.svg\"",
            "expressionStartModel": "{\n planId:^planId,\n mainGoalId: ^mainGoalId,\n goalId: ^goalId\n}",
            "expressionTitle": "\"[[AddFilter]]\"",
            "mode": "right-drawer",
            "size": "default",
            "uiComponentName": "CmpPsGoalFilterEditor"
          },
          {
            "children": [
              {
                "command": "Execute",
                "expression": "refresh()"
              },
              {
                "command": "CloseCurrent"
              }
            ],
            "command": "OnOk",
            "variableNameOpenedModel": "openedModel"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "openedModel",
            "type": "any"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "goalId",
            "type": "string"
          }
        ]
      },
      "name": "addGoalFilter"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "dimensions",
            "type": "list(ExtStrategicPlanMng.DimensionValue)"
          }
        ],
        "statements": [
          {
            "children": [
              {
                "command": "Set",
                "expression": "index+1",
                "variableName": "index"
              },
              {
                "children": [
                  {
                    "command": "Set",
                    "expression": "Concat(^values,^dimension.value)",
                    "variableName": "values"
                  }
                ],
                "command": "If",
                "expression": "Count(^dimensions) == ^index"
              },
              {
                "children": [
                  {
                    "command": "Set",
                    "expression": "Concat(^values,^dimension.value, \", \")",
                    "variableName": "values"
                  }
                ],
                "command": "Else"
              }
            ],
            "command": "ForEach",
            "expressionList": "dimensions",
            "variableNameItem": "dimension"
          },
          {
            "command": "Return",
            "expression": "^values"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "dimension",
            "type": "ExtStrategicPlanMng.DimensionValue"
          },
          {
            "name": "values",
            "type": "string"
          },
          {
            "name": "index",
            "type": "integer"
          }
        ]
      },
      "name": "getValues"
    },
    {
      "algorithm": {
        "parameters": [
          {
            "name": "goalFilter",
            "type": "ExtStrategicPlanMng.GoalFilter"
          }
        ],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "planId",
            "variableName": "planId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "mainGoalId",
            "variableName": "mainGoalId"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "goalId",
            "variableName": "goalId"
          },
          {
            "buttons": "ok-cancel",
            "command": "Open",
            "expressionIcon": "\"edit.svg\"",
            "expressionStartModel": "{\n planId:^planId,\n mainGoalId: ^mainGoalId,\n goalId: ^goalId,\ngoalFilter:^goalFilter\n}",
            "expressionTitle": "\"[[EditGoalFilter]]\"",
            "mode": "right-drawer",
            "size": "default",
            "uiComponentName": "CmpPsGoalFilterEditor"
          },
          {
            "children": [
              {
                "command": "CloseCurrent"
              },
              {
                "command": "Execute",
                "expression": "refresh()"
              }
            ],
            "command": "OnOk",
            "variableNameOpenedModel": "openedModel"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "openedModel",
            "type": "any"
          },
          {
            "name": "planId",
            "type": "string"
          },
          {
            "name": "mainGoalId",
            "type": "string"
          },
          {
            "name": "goalId",
            "type": "string"
          }
        ]
      },
      "name": "editGoalFilter"
    }
  ],
  "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": [
      {
        "actions": [
          {
            "icon": "grid-two-up.svg",
            "key": "cardsView"
          },
          {
            "icon": "list.svg",
            "key": "listView"
          },
          {
            "icon": "reload.svg",
            "key": "refresh"
          }
        ],
        "children": [
          {
            "actions": [
              {
                "icon": "add.svg",
                "key": "add",
                "text": "[[Add]]"
              }
            ],
            "cssClass": "blz-area-default content-center",
            "htmlTemplate": "<section class=\"blz-cards-brief\">\n    <article class=\"blz-cards-header\">\n        <section class=\"blz-cards-header-logo\">\n            <img class=\"header-img\" src=\"./icons/info.svg\" height=\"16\" width=\"16\" />\n        </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\">{{dimension.id}}</span>\n            </article>\n            <section class=\"blz-cards-header-dots\" style=\"max-width: 24px; max-height: 24px;\"\n                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>{{dimension.description}}</span></p>\n        </section>\n    </article>\n    <article class=\"blz-cards-content blz-area-brief\">\n      <section>\n        <span class=\"blz-text-bold\">[[Operator]]:</span> <span>{{operator}} </span>\n      </section>\n      <section>\n        <span class=\"blz-text-bold\">[[Values]] :</span> <span>{{name}}</span>\n      </section>\n    </article>\n</section>",
            "name": "goalFilterRepeater",
            "pageSize": 10,
            "recordActions": [
              {
                "icon": "edit.svg",
                "key": "edit",
                "text": "[[Edit]]"
              },
              {
                "icon": "remove.svg",
                "key": "remove",
                "text": "[[Remove]]"
              }
            ],
            "title": " [[EmptyTitle]]",
            "widget": "HtmlRepeater",
            "withPaging": true
          },
          {
            "actions": [
              {
                "icon": "add.svg",
                "key": "add",
                "text": "[[Add]]"
              }
            ],
            "columns": [
              {
                "align": "left",
                "bindText": "dimension.id",
                "header": "[[Filter]]",
                "key": "dimension"
              },
              {
                "align": "left",
                "bindText": "operator",
                "header": "[[Operator]]",
                "key": "operator"
              },
              {
                "align": "left",
                "bindText": "name",
                "header": "[[Value]]",
                "key": "value"
              },
              {
                "align": "left",
                "bindText": "dimension.description",
                "header": "[[Description]]",
                "key": "description"
              }
            ],
            "cssClass": "blz-area-default blz-toolbar-white",
            "name": "goalFilterGrid",
            "pageSize": 10,
            "recordActions": [
              {
                "contextMenu": true,
                "icon": "edit.svg",
                "key": "edit",
                "text": "[[Edit]]"
              },
              {
                "contextMenu": true,
                "icon": "remove.svg",
                "key": "remove",
                "text": "[[Remove]]"
              }
            ],
            "title": "[[EmptyTitle]]",
            "typeName": "ExtStrategicPlanMng.GoalFilter",
            "widget": "Grid",
            "withPaging": true
          }
        ],
        "cssClass": "blz-toolbar-white blz-padding-top-large blz-padding-right-large blz-padding-left-large blz-padding-bottom-large",
        "layout": "responsive",
        "name": "goalFilterContainer"
      }
    ],
    "layout": "responsive"
  },
  "routing": {
    "path": "ps-goal-filters/{planId}/{goalType}/{mainGoalId}/{goalId}"
  },
  "unused": []
}