{
  "custom": {},
  "params": {
    "equipmentPath": "New Enterprise\\Site 1\\Area 1\\Packaging Line 1"
  },
  "propConfig": {
    "params.equipmentPath": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 469
    }
  },
  "root": {
    "children": [
      {
        "children": [
          {
            "meta": {
              "name": "Label"
            },
            "position": {
              "grow": 1
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "view.params.equipmentPath"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "fontSize": 18,
                "textAlign": "center"
              }
            },
            "type": "ia.display.label"
          }
        ],
        "meta": {
          "name": "topContainer"
        },
        "position": {
          "basis": "50px"
        },
        "props": {
          "direction": "column",
          "wrap": "wrap"
        },
        "type": "ia.container.flex"
      },
      {
        "children": [
          {
            "children": [
              {
                "meta": {
                  "name": "Counter Label"
                },
                "position": {
                  "basis": "50px",
                  "grow": 1
                },
                "props": {
                  "style": {
                    "fontWeight": "bold",
                    "textAlign": "center"
                  },
                  "text": "Counter Name"
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "Past Data Label"
                },
                "position": {
                  "basis": "50px",
                  "grow": 1
                },
                "props": {
                  "style": {
                    "fontWeight": "bold",
                    "textAlign": "center"
                  },
                  "text": "Past Count"
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "InputLabel"
                },
                "position": {
                  "basis": "50px",
                  "grow": 1
                },
                "props": {
                  "style": {
                    "fontWeight": "bold",
                    "textAlign": "center"
                  },
                  "text": "User Input"
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "Difference Label"
                },
                "position": {
                  "grow": 1
                },
                "props": {
                  "style": {
                    "fontWeight": "bold",
                    "textAlign": "center"
                  },
                  "text": "Change"
                },
                "type": "ia.display.label"
              }
            ],
            "meta": {
              "name": "FlexContainer"
            },
            "props": {
              "alignItems": "center",
              "justify": "center"
            },
            "type": "ia.container.flex"
          },
          {
            "meta": {
              "name": "FlexRepeater"
            },
            "position": {
              "grow": 1
            },
            "propConfig": {
              "props.instances": {
                "binding": {
                  "config": {
                    "path": "view.params.equipmentPath"
                  },
                  "transforms": [
                    {
                      "code": "\t\n\tresult \u003d []\n\tlineObj \u003d system.mes.loadMESObjectByEquipmentPath(value)\n\tcounters \u003d lineObj.getCounters()\n\tfor item in counters:\n\t\tif(system.mes.getTagCollectorLastValue(value,\"Equipment Count\",item.getName()) \u003d\u003d 0):\n\t\t\tsystem.mes.addTagCollectorValue(value,\"Equipment Count\",item.getName(),1)\n\t\tresult.append({\n\t  \"instanceStyle\": {\n\t    \"classes\": \"\"\n\t  },\n\t  \"instancePosition\": {},\n\t  \"counterName\": item.getName(),\n\t  \"equipmentPath\": value,\n\t  \"userInput\": 0,\n\t  \"change\": \"null\"\n\t})\n\treturn result",
                      "type": "script"
                    }
                  ],
                  "type": "property"
                }
              }
            },
            "props": {
              "direction": "column",
              "path": "Page/Embedded/Counters Info"
            },
            "type": "ia.display.flex-repeater"
          }
        ],
        "meta": {
          "name": "dataContainer"
        },
        "position": {
          "grow": 1
        },
        "props": {
          "direction": "column"
        },
        "type": "ia.container.flex"
      },
      {
        "children": [
          {
            "events": {
              "component": {
                "onActionPerformed": {
                  "config": {
                    "script": "\teqPath \u003d self.view.params.equipmentPath\n\toperationResponse  \u003d system.mes.getCurrentOperation(eqPath)\n\tstartTimeStamp \u003d  operationResponse.getPropertyValue(\"BeginDateTime\")\n\n\tfor instance in self.parent.parent.getChild(\"dataContainer\").getChild(\"FlexRepeater\").props.instances:\n\t\tlastTimeStamp \u003d system.mes.getTagCollectorLastTimeStamp(eqPath, \"Equipment Count\", instance.counterName)\n\t\t#checks sequential order before adding\n\t\tif (str(instance.change).startswith(\"+\")):\n\t\t\tsystem.mes.updateTagCollectorLastValue(eqPath, \"Equipment Count\", instance.counterName, int(instance.userInput))\n\t\t\tsystem.perspective.openPopup(\"InfoPane\",\"Popup/InfoPane\", params \u003d {\"action\":  str(instance.counterName) + \"counter with the value of \"+ instance.userInput + \" was updated.\"},title \u003d \"Success\")\n\t\t\tsystem.perspective.closePopup(\"123\")\n\t\telse:\n\t\t\tsystem.perspective.openPopup(\"1234\",\"Popup/Error\", params \u003d {\"message\":  \"Refer back to \" +  str(instance.counterName) + \" counter for more information.\"  },title \u003d \"Error\")"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "AdjustButton"
            },
            "position": {
              "display": false
            },
            "props": {
              "style": {
                "classes": "Buttons/Small_Button",
                "height": "48px",
                "width": "125px"
              },
              "text": "Adjust"
            },
            "type": "ia.input.button"
          },
          {
            "events": {
              "component": {
                "onActionPerformed": {
                  "config": {
                    "script": "\teqPath \u003d self.view.params.equipmentPath\n\toperationResponse  \u003d system.mes.getCurrentOperation(eqPath)\n\tfor instance in self.parent.parent.getChild(\"dataContainer\").getChild(\"FlexRepeater\").props.instances:\n\t\tlastTimeStamp \u003d system.mes.getTagCollectorLastTimeStamp(eqPath, \"Equipment Count\", instance.counterName)\n\t\t#checks sequential order before adding\n\t\tif not(system.date.isAfter(system.date.now(),lastTimeStamp)):\n\t\t\tsystem.perspective.openPopup(\"1234\",\"Popup/Error\", params \u003d {\"message\":  \"A tag already exists at the current time stamp\" + str(system.date.now()) },title \u003d \"Error\")\n\t\telif (system.date.isAfter(system.date.now(),lastTimeStamp) and str(instance.change).startswith(\"+\")):\n\t\t\tsystem.mes.addTagCollectorValue(eqPath, \"Equipment Count\", instance.counterName, int(instance.userInput))\n\t\t\tsystem.perspective.openPopup(\"InfoPane\",\"Popup/InfoPane\", params \u003d {\"action\":  str(instance.counterName) + \"counter with the value of \"+ str(instance.userInput) + \" was added.\"},title \u003d \"Success\")\n\t\t\tsystem.perspective.closePopup(\"123\")\n\t\telse:\n\t\t\tsystem.perspective.openPopup(\"1234\",\"Popup/Error\", params \u003d {\"message\":  \"Refer back to \" +  str(instance.counterName) + \" counter for more information.\"  },title \u003d \"Error\")"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "addButton"
            },
            "props": {
              "style": {
                "classes": "Buttons/Small_Button",
                "height": "48px",
                "width": "125px"
              },
              "text": "Add"
            },
            "type": "ia.input.button"
          }
        ],
        "meta": {
          "name": "buttonContainer"
        },
        "props": {
          "justify": "space-around",
          "style": {
            "paddingBottom": 11
          }
        },
        "type": "ia.container.flex"
      }
    ],
    "meta": {
      "name": "root"
    },
    "props": {
      "direction": "column",
      "style": {
        "backgroundColor": "#FFFFFF"
      }
    },
    "type": "ia.container.flex"
  }
}