{
    "type": "Ext.app.Controller",
    "reference": {
        "name": "items",
        "type": "array"
    },
    "codeClass": null,
    "userConfig": {
        "designer|userClassName": "LicenseController"
    },
    "designerId": "ff64baf6-6ff0-4794-bedb-825509b7738f",
    "cn": [
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "newLicBtn",
                "selector": "#newLicBtn"
            },
            "designerId": "c5720e95-9970-4196-b56f-ad392aadd30a"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "editLicBtn",
                "selector": "#editLicBtn"
            },
            "designerId": "e6ae7cce-f4ed-45e6-9ada-7f6bc1307bf6"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "deleteLicBtn",
                "selector": "#deleteLicBtn"
            },
            "designerId": "82895d01-149a-4d1f-93dd-90cc6f552acd"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "gridPanel",
                "selector": "#GridPanel"
            },
            "designerId": "92d8f2a4-20ef-483f-b452-4feddb52831f"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "button"
                ],
                "fn": "createLicenseWindow",
                "implHandler": [
                    "this.getLicenseWindow().show();\r",
                    "if (button.itemId === 'newLicBtn')\r",
                    "{\r",
                    "\tthis.getLicenseWindow().setTitle('Add License');\r",
                    "\r",
                    "\r",
                    "\t/*\r",
                    "\r",
                    "\tthis.getUploadButton().setText('Add');\r",
                    "\tI cant even change the text of the button???\r",
                    "\r",
                    "\r",
                    "\tthis.getUploadEditBtn().hide(); // THIS WORKS IT HIDES THE BUTTON\r",
                    "\t// NONE OF THIS WORKS?\r",
                    "\t//this.getUploadButton().setVisible(true);\r",
                    "\t//this.getUploadButton().show();\r",
                    "\t//this.getUploadEditBtn().hide();\r",
                    "\t*/\r",
                    "}\r",
                    "else if (button.itemId === 'editLicBtn')\r",
                    "{\r",
                    "\tthis.getLicenseWindow().setTitle('Edit License');\r",
                    "\r",
                    "\tconsole.log(this.selectedLic.data);\r",
                    "\r",
                    "\t//this.getFileUploadField().allowBlank = true;\r",
                    "\t//this.getFileUploadField().validateValue(this.getFileUploadField().getValue()); //force update\r",
                    "\t//this.getInvoiceDateField().setValue(this.selectedLic.data.purchaseDate);\r",
                    "\t//this.getAmountField().setValue(this.selectedLic.data.amount);\r",
                    "\r",
                    "\t//this.getUploadButton().hide(); // THIS DOES NOT WORK!? WHY DOES IT NOT HIDE BUTTON?!\r",
                    "\r",
                    "}"
                ]
            },
            "designerId": "5633dbad-9425-4f1f-ac01-3d8f3cf6d02f"
        },
        {
            "type": "fixedfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "application"
                ],
                "fn": "init",
                "implHandler": [
                    "this.control({\r",
                    "\t'#newLicBtn': {\r",
                    "\t\tclick: function(btn) {\r",
                    "\t\t\tthis.createLicenseWindow(btn);\r",
                    "\t\t}\r",
                    "\t},\r",
                    "\t'#editLicBtn': {\r",
                    "\t\tclick: function(btn) {\r",
                    "\t\t\tthis.createLicenseWindow(btn);\r",
                    "\t\t}\r",
                    "\t},\r",
                    "\t'#deleteLicBtn': {\r",
                    "\t\tclick: function(btn) {\r",
                    "\t\t\tthis.deleteLicense(this.selectedLic);\r",
                    "\t\t}\r",
                    "\t},\r",
                    "\t'#GridPanel': {\r",
                    "\t\tselectionchange: function(component, selection) {\r",
                    "\t\t\tif (selection.length >= 0) {\r",
                    "\t\t\t\t//console.log(selection[0]);\r",
                    "\t\t\t\tthis.selectedLic = selection[0];\r",
                    "\t\t\t\tthis.getEditLicBtn().enable();\r",
                    "\t\t\t\tthis.getDeleteLicBtn().enable();\r",
                    "\t\t\t}\r",
                    "\t\t}\r",
                    "\t}\r",
                    "});"
                ]
            },
            "designerId": "ff5b9b88-8f7f-46e4-ae63-7f1caf207b03"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "uploadForm1",
                "selector": "#uploadForm1"
            },
            "designerId": "c4ae8831-3f66-47a7-afea-d3abd3a158e9"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "autoCreate": true,
                "ref": "licenseWindow",
                "selector": "#LicenseWindow",
                "xtype": "LicenseWindow"
            },
            "designerId": "3e2912d9-797d-4bed-948b-044f007740ac"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "fileUploadField",
                "selector": "#fileUploadField"
            },
            "designerId": "5437b9a0-361d-4cc6-bf5a-a0c038d66a3b"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "invoiceDateField",
                "selector": "#invoiceDateField"
            },
            "designerId": "56e5841a-a8ad-4e39-8936-018f1b172ac7"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "amountField",
                "selector": "#amountField"
            },
            "designerId": "f7d3e22d-5d37-498e-bc94-1e9391245092"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "uploadButton",
                "selector": "#uploadButton"
            },
            "designerId": "1ff635de-fc47-40a9-a58e-68bd42eec0bd"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "lic"
                ],
                "fn": "deleteLicense",
                "implHandler": [
                    "var orgParams = Ext.Object.fromQueryString(document.location.search);\r",
                    "var FID = lic.data.FID;\r",
                    "var params = {\r",
                    "\tdeleteLic: 'true',\r",
                    "\tFID: FID,\r",
                    "\tuser: orgParams.user\r",
                    "};\r",
                    "\r",
                    "var tempurl = '../../service/archive_um_data.php?deleteLic=true&user=' + orgParams.user + '&FID=' + FID;\r",
                    "console.log(tempurl);\r",
                    "\r",
                    "var gridPanel = this.getGridPanel();\r",
                    "gridPanel.setLoading(CCS.Translator.getText('Loading...'));\r",
                    "Ext.Ajax.request({\r",
                    "\turl: tempurl,\r",
                    "\tmethod: 'POST',\r",
                    "\tparams: params,\r",
                    "\tsuccess: function(response, object){\r",
                    "\t\t//console.log(response);\r",
                    "\t\tgridPanel.setLoading(false);\r",
                    "\t\tgridPanel.getStore().load();\r",
                    "\t\tthis.selectedLic = null;\r",
                    "\t},\r",
                    "\tfailure: function(response, object){\r",
                    "\t\t//console.log(response);\r",
                    "\t\tgridPanel.setLoading(false);\r",
                    "\t\tgridPanel.getStore().load();\r",
                    "\t\tthis.selectedLic = null;\r",
                    "\t},\r",
                    "\tscope: this\r",
                    "});\r",
                    ""
                ]
            },
            "designerId": "fce5040d-c6d5-4891-a89a-7dc28b9b76ea"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "commentField",
                "selector": "#commentField"
            },
            "designerId": "45364181-bfcf-434e-9450-341a5928fc1b"
        }
    ]
}