Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleReports.bjs
index 18c8c23..32528ed 100644 (file)
@@ -1,7 +1,7 @@
 {
-    "id": "roo-file-527",
+    "id": "roo-file-384",
     "name": "Pman.Tab.XtupleReports",
-    "parent": "",
+    "parent": "Pman.Tab.Admin",
     "title": "",
     "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleReports.bjs",
     "items": [
                         },
                         {
                             "*prop": "east",
+                            "split": true,
                             "title": "Versions",
                             "titlebar": true,
-                            "width": 150,
+                            "width": 200,
                             "xtype": "LayoutRegion",
                             "|xns": "Roo"
                         },
                             },
                             "items": [
                                 {
-                                    "*prop": "grid",
-                                    "xtype": "Grid",
-                                    "autoExpandColumn": "report_name",
-                                    "loadMask": true,
                                     "listeners": {
                                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                                        "rowdblclick": "function (_self, rowIndex, e)\n{\n    var rec = this.ds.getAt(rowIndex);\n    new Pman.Download({\n        url : baseURL + '/Roo/Report/' + rec.data.report_name +'-' + rec.data.report_id + '.rpt',\n        method : 'GET',\n        params : {\n            _id : rec.data.report_id,\n            _download : 1\n        }\n    });\n    Roo.MessageBox.alert(\"Downloading\",\n    \n       \"Report template is downloading - use \" +\n           '<a target=\"_new\" href=\"http://sourceforge.net/projects/openrpt/files/openrpt/\">' + \n           \"report writer to edit this\" + \n           '</a>'\n       );\n           \n    \n    \n}"
                                     },
+                                    "*prop": "grid",
+                                    "autoExpandColumn": "report_descrip",
+                                    "loadMask": true,
+                                    "xtype": "Grid",
                                     "|xns": "Roo.grid",
                                     "items": [
                                         {
+                                            "listeners": {
+                                                "beforeload": "function (_self, options)\n{\n    options.params['search[name]'] = _this.searchName.getValue();\n    options.params._max_versions = 1;\n}"
+                                            },
                                             "*prop": "dataSource",
-                                            "xtype": "Store",
                                             "remoteSort": true,
+                                            "xtype": "Store",
                                             "|sortInfo": "{ field : 'report_name', direction: 'ASC' }",
                                             "|xns": "Roo.data",
                                             "items": [
                                                 }
                                             ]
                                         },
+                                        {
+                                            "listeners": {
+                                                "afterselectionchange": "function (_self)\n{\n    _this.vgrid.footer.onClick('first');\n}"
+                                            },
+                                            "*prop": "sm",
+                                            "singleSelect": true,
+                                            "xtype": "RowSelectionModel",
+                                            "|xns": "Roo.grid"
+                                        },
                                         {
                                             "*prop": "footer",
                                             "xtype": "PagingToolbar",
                                             "|xns": "Roo",
                                             "items": [
                                                 {
-                                                    "text": "Add",
-                                                    "xtype": "Button",
-                                                    "cls": "x-btn-text-icon",
-                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
                                                     "listeners": {
-                                                        "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                                        "render": "function (_self)\n{\n    _this.searchName = _self;\n}",
+                                                        "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                                    },
+                                                    "xtype": "TextField",
+                                                    "|xns": "Roo.form"
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
                                                     },
+                                                    "cls": "x-btn-icon",
+                                                    "xtype": "Button",
+                                                    "|icon": "rootURL + '/Pman/templates/images/search.gif'",
                                                     "|xns": "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "text": "Delete",
-                                                    "cls": "x-btn-text-icon",
-                                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                                    "listeners": {
+                                                        "|click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    _this.publication_name_combo.setValue('');\n    _this.publication_lang_combo.setValue('');\n    _this.country_combo.setValue('');\n    _this.category_media_id_combo.setValue('');\n    _this.role_combo.setValue('');      \n\n    \n    _this.grid.footer.onClick('first');\n}"
+                                                    },
+                                                    "cls": "x-btn-icon",
                                                     "xtype": "Button",
+                                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                                    "|xns": "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "|xns": "Roo.Toolbar",
+                                                    "xtype": "Fill"
+                                                },
+                                                {
                                                     "listeners": {
-                                                        "|click": "function()\n{\n     Pman.genericDelete(_this, 'report'); \n}\n        "
+                                                        "click": "function (_self, e)\n{\n    \n    var sel = _this.grid.selModel.getSelected();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a report\");\n        return;\n    }\n    \n    Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Report',\n             onid : sel.data.report_id\n             \n            \n       },\n       function (data) {\n            Roo.MessageBox.alert(\"Notice\", \"Updated\");\n            _this.grid.footer.onClick('refresh');\n       }\n   );\n}"
                                                     },
+                                                    "text": "Upload New version",
+                                                    "xtype": "Button",
                                                     "|xns": "Roo.Toolbar"
                                                 }
                                             ]
                                         },
-                                        {
-                                            "xtype": "ColumnModel",
-                                            "header": "Report",
-                                            "width": 75,
-                                            "dataIndex": "report_id",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "*prop": "colModel[]"
-                                        },
                                         {
                                             "xtype": "ColumnModel",
                                             "header": "Report name",
                                             "|xns": "Roo.grid",
                                             "*prop": "colModel[]"
                                         },
-                                        {
-                                            "xtype": "ColumnModel",
-                                            "header": "Report sys",
-                                            "width": 75,
-                                            "dataIndex": "report_sys",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "*prop": "colModel[]"
-                                        },
-                                        {
-                                            "xtype": "ColumnModel",
-                                            "header": "Report source",
-                                            "width": 200,
-                                            "dataIndex": "report_source",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "*prop": "colModel[]"
-                                        },
                                         {
                                             "xtype": "ColumnModel",
                                             "header": "Report descrip",
                             ]
                         },
                         {
-                            "|xns": "Roo",
-                            "xtype": "GridPanel",
-                            "title": "report",
-                            "fitToframe": true,
-                            "fitContainer": true,
-                            "tableName": "report",
-                            "background": true,
-                            "region": "center",
                             "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                                "|activate": "function() {\n    _this.vpanel = this;\n    if (_this.vgrid) {\n        _this.vgrid.footer.onClick('first');\n    }\n}"
                             },
+                            "background": false,
+                            "fitContainer": true,
+                            "fitToframe": true,
+                            "region": "east",
+                            "tableName": "report",
+                            "title": "report",
+                            "xtype": "GridPanel",
+                            "|xns": "Roo",
                             "items": [
                                 {
-                                    "*prop": "grid",
-                                    "xtype": "Grid",
-                                    "autoExpandColumn": "report_name",
-                                    "loadMask": true,
                                     "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                                        "|render": "function() \n{\n    _this.vgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.vpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
+                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    var rec = this.ds.getAt(rowIndex);\n    new Pman.Download({\n        url : baseURL + '/Roo/Report/' + rec.data.report_name +'-' + rec.data.report_id + '.rpt',\n        method : 'GET',\n        params : {\n            _id : rec.data.report_id,\n            _download : 1\n        }\n    });\n    Roo.MessageBox.alert(\"Downloading\",\n    \n       \"Report template is downloading - use \" +\n           '<a target=\"_new\" href=\"http://sourceforge.net/projects/openrpt/files/openrpt/\">' + \n           \"report writer to edit this\" + \n           '</a>'\n       );\n           \n    \n    \n}"
                                     },
+                                    "*prop": "grid",
+                                    "autoExpandColumn": "Report loaddate",
+                                    "loadMask": true,
+                                    "xtype": "Grid",
                                     "|xns": "Roo.grid",
                                     "items": [
                                         {
+                                            "listeners": {
+                                                "beforeload": "function (_self, options)\n{\n    if (!_this.grid) {\n        return false;\n    } \n    var sel  = _this.grid.selModel.getSelected();\n    if (!sel) {\n        this.removeAll();\n        return false;\n    }\n    options.params.report_name = sel.data.report_name;\n    \n    \n}"
+                                            },
                                             "*prop": "dataSource",
-                                            "xtype": "Store",
                                             "remoteSort": true,
-                                            "|sortInfo": "{ field : 'report_name', direction: 'ASC' }",
+                                            "xtype": "Store",
+                                            "|sortInfo": "{ field : 'report_grade', direction: 'DESC' }",
                                             "|xns": "Roo.data",
                                             "items": [
                                                 {
                                             "|xns": "Roo"
                                         },
                                         {
-                                            "xtype": "ColumnModel",
-                                            "header": "Report grade",
-                                            "width": 75,
+                                            "*prop": "colModel[]",
                                             "dataIndex": "report_grade",
+                                            "header": "Version",
+                                            "width": 20,
+                                            "xtype": "ColumnModel",
                                             "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "*prop": "colModel[]"
+                                            "|xns": "Roo.grid"
                                         },
                                         {
-                                            "xtype": "ColumnModel",
-                                            "header": "Report loaddate",
-                                            "width": 75,
+                                            "*prop": "colModel[]",
                                             "dataIndex": "report_loaddate",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
-                                            "|xns": "Roo.grid",
-                                            "*prop": "colModel[]"
+                                            "header": "Created",
+                                            "width": 200,
+                                            "xtype": "ColumnModel",
+                                            "|renderer": "function(v,x,r) { \n    var vv =   Date.parseDate(r.json.report_loaddate.split('.')[0], 'Y-m-d H:i:s').format('d/M/Y h:ia');\n    return String.format('{0}', vv); \n\n    }",
+                                            "|xns": "Roo.grid"
                                         }
                                     ]
                                 }
         }
     ],
     "permname": "",
-    "modOrder": "001"
+    "modOrder": "500"
 }
\ No newline at end of file