From 1668a9d03dd0b388af68c088ac21d1f05a3e27e2 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 27 Jun 2016 15:49:53 +0800 Subject: [PATCH] Pman.Tab.AdminOffice.bjs Pman.Tab.AdminOffice.js --- Pman.Tab.AdminOffice.bjs | 322 +++++++++--------- Pman.Tab.AdminOffice.js | 716 ++++++++++++++++++++------------------- 2 files changed, 543 insertions(+), 495 deletions(-) diff --git a/Pman.Tab.AdminOffice.bjs b/Pman.Tab.AdminOffice.bjs index fc82136..eab7d55 100644 --- a/Pman.Tab.AdminOffice.bjs +++ b/Pman.Tab.AdminOffice.bjs @@ -1,159 +1,171 @@ { - "id": "roo-file-151", - "name": "Pman.Tab.AdminOffice", - "parent": "Pman.Tab.AdminCompanies", - "title": "Pman.Tab.AdminOffice", - "path": "/home/chris/gitlive/Pman.Admin/Pman.Tab.AdminOffice.bjs", - "items": [ + "name" : "Pman.Tab.AdminOffice", + "parent" : "Pman.Tab.AdminCompanies", + "title" : "Pman.Tab.AdminOffice", + "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminOffice.bjs", + "permname" : "", + "modOrder" : "001", + "strings" : { + "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email", + "ec211f7c20af43e742bf2570c3cb84f9" : "Add", + "14820f8c54725a56438e99f6bd57dfa3" : "Displaying Office{0} - {1} of {2}", + "7dce122004969d56ae2e0245cb754d35" : "Edit", + "7407f706267593de473324b2c07ef2fc" : "Offices / Departments / Sub-Companies", + "217574e21514de41ec31aaf5ddadb2c3" : "No Office found", + "bcc254b55c4a1babdf1dcb82c207506b" : "Phone", + "a8fa7984f57a42bb41143f3d7665bd36" : "Name / Department / Sub Comp.", + "f2a6c498fb90ee345d997f888fce3b18" : "Delete", + "dd7bf230fde8d4836917806aff6a6b27" : "Address", + "9810aa2b9f44401be4bf73188ef2b67d" : "Fax" + }, + "items" : [ + { + "listeners" : { + "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" + }, + "region" : "south", + "fitToframe" : true, + "background" : true, + "title" : "Offices / Departments / Sub-Companies", + "xtype" : "GridPanel", + "fitContainer" : true, + "$ xns" : "Roo", + "tableName" : "Office", + "items" : [ + { + "listeners" : { + "|rowdblclick" : "function (_self, rowIndex, e)\n{\n if (!_this.dialog) { \n return; \n }\n _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n _this.grid.footer.onClick('first');\n }); \n}\n", + "|render" : "function() \n{\n _this.grid = this; \n _this.dialog =Pman.Dialog.Office;\n if (_this.panel.active) {\n this.footer.onClick('first');\n } \n}" + }, + "autoExpandColumn" : "name", + "xtype" : "Grid", + "loadMask" : true, + "$ xns" : "Roo.grid", + "* prop" : "grid", + "items" : [ + { + "listeners" : { + "beforeload" : "function (_self, o)\n{\n try {\n var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel();\n sm = sm.getSelected();\n if (!sm || !sm.data.id) {\n // mask??\n return false;\n }\n \n o.params.company_id = sm.data.id ;\n } catch (e) {\n return false;\n }\n \n \n }" + }, + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ field : 'name', direction: 'ASC' }", + "$ xns" : "Roo.data", + "* prop" : "dataSource", + "items" : [ { - "listeners": { - "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" - }, - "background": true, - "fitContainer": true, - "fitToframe": true, - "region": "south", - "tableName": "Office", - "title": "Offices / Departments / Sub-Companies", - "xtype": "GridPanel", - "|xns": "Roo", - "items": [ - { - "listeners": { - "|render": "function() \n{\n _this.grid = this; \n _this.dialog =Pman.Dialog.Office;\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" - }, - "*prop": "grid", - "autoExpandColumn": "name", - "loadMask": true, - "xtype": "Grid", - "|xns": "Roo.grid", - "items": [ - { - "listeners": { - "beforeload": "function (_self, o)\n{\n try {\n var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel();\n sm = sm.getSelected();\n if (!sm || !sm.data.id) {\n // mask??\n return false;\n }\n \n o.params.company_id = sm.data.id ;\n } catch (e) {\n return false;\n }\n \n \n }" - }, - "*prop": "dataSource", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ field : 'name', direction: 'ASC' }", - "|xns": "Roo.data", - "items": [ - { - "*prop": "proxy", - "xtype": "HttpProxy", - "method": "GET", - "|url": "baseURL + '/Roo/Office.php'", - "|xns": "Roo.data" - }, - { - "|xns": "Roo.data", - "xtype": "JsonReader", - "totalProperty": "total", - "root": "data", - "*prop": "reader", - "id": "id", - "|fields": "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'company_id',\n 'type': 'int'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'address',\n 'type': 'string'\n },\n {\n 'name': 'phone',\n 'type': 'string'\n },\n {\n 'name': 'fax',\n 'type': 'string'\n },\n {\n 'name': 'email',\n 'type': 'string'\n },\n {\n 'name': 'role',\n 'type': 'string'\n },\n {\n 'name': 'company_id_code',\n 'type': 'string'\n },\n {\n 'name': 'company_id_name',\n 'type': 'string'\n },\n {\n 'name': 'company_id_remarks',\n 'type': 'string'\n },\n {\n 'name': 'company_id_owner_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_address',\n 'type': 'string'\n },\n {\n 'name': 'company_id_tel',\n 'type': 'string'\n },\n {\n 'name': 'company_id_fax',\n 'type': 'string'\n },\n {\n 'name': 'company_id_email',\n 'type': 'string'\n },\n {\n 'name': 'company_id_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_isOwner',\n 'type': 'int'\n },\n {\n 'name': 'company_id_logo_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_background_color',\n 'type': 'string'\n },\n {\n 'name': 'company_id_comptype',\n 'type': 'string'\n },\n {\n 'name': 'company_id_url',\n 'type': 'string'\n },\n {\n 'name': 'company_id_main_office_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_created_by',\n 'type': 'int'\n },\n {\n 'name': 'company_id_created_dt',\n 'type': 'date'\n },\n {\n 'name': 'company_id_updated_by',\n 'type': 'int'\n },\n {\n 'name': 'company_id_updated_dt',\n 'type': 'date'\n },\n {\n 'name': 'company_id_passwd',\n 'type': 'string'\n },\n {\n 'name': 'company_id_dispatch_port',\n 'type': 'string'\n },\n {\n 'name': 'company_id_province',\n 'type': 'string'\n },\n {\n 'name': 'company_id_country',\n 'type': 'string'\n }\n]" - } - ] - }, - { - "*prop": "footer", - "xtype": "PagingToolbar", - "pageSize": 25, - "displayInfo": true, - "displayMsg": "Displaying Office{0} - {1} of {2}", - "emptyMsg": "No Office found", - "|xns": "Roo" - }, - { - "*prop": "toolbar", - "xtype": "Toolbar", - "|xns": "Roo", - "items": [ - { - "listeners": { - "|click": "function()\n{\n if (!_this.dialog) return;\n \n var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;\n _dialog.show( { \n id : 0 ,\n company_name : cdata.name,\n company_id : cdata.id,\n address : cdata.address,\n phone : cdata.tel,\n fax : cdata.fax,\n email : cdata.email\n } , function() {\n _this.grid.footer.onClick('first');\n });\n}\n" - }, - "cls": "x-btn-text-icon", - "text": "Add", - "xtype": "Button", - "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'", - "|xns": "Roo.Toolbar" - }, - { - "listeners": { - "|click": "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n if (!_this.dialog) return;\n s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;\n _this.dialog.show(s[0].data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n}\n" - }, - "cls": "x-btn-text-icon", - "text": "Edit", - "xtype": "Button", - "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", - "|xns": "Roo.Toolbar" - }, - { - "text": "Delete", - "cls": "x-btn-text-icon", - "|icon": "rootURL + '/Pman/templates/images/trash.gif'", - "xtype": "Button", - "listeners": { - "|click": "function()\n{\n Pman.genericDelete(_this, 'Office'); \n}\n " - }, - "|xns": "Roo.Toolbar" - } - ] - }, - { - "*prop": "colModel[]", - "dataIndex": "name", - "header": "Name / Department / Sub Comp.", - "sortable": true, - "width": 200, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v); }", - "|xns": "Roo.grid" - }, - { - "*prop": "colModel[]", - "dataIndex": "phone", - "header": "Phone", - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v); }", - "|xns": "Roo.grid" - }, - { - "*prop": "colModel[]", - "dataIndex": "fax", - "header": "Fax", - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v); }", - "|xns": "Roo.grid" - }, - { - "*prop": "colModel[]", - "dataIndex": "email", - "header": "Email", - "width": 200, - "xtype": "ColumnModel", - "|renderer": "function (v) {\n return (v.length && v.indexOf('@') > 0 ) ? \n String.format('{0}',v) : v;\n \n}", - "|xns": "Roo.grid" - }, - { - "*prop": "colModel[]", - "dataIndex": "address", - "header": "Address", - "width": 300, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v); }", - "|xns": "Roo.grid" - } - ] - } - ] + "$ url" : "baseURL + '/Roo/Office.php'", + "xtype" : "HttpProxy", + "method" : "GET", + "$ xns" : "Roo.data", + "* prop" : "proxy" + }, + { + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ xns" : "Roo.data", + "$ fields" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'company_id',\n 'type': 'int'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'address',\n 'type': 'string'\n },\n {\n 'name': 'phone',\n 'type': 'string'\n },\n {\n 'name': 'fax',\n 'type': 'string'\n },\n {\n 'name': 'email',\n 'type': 'string'\n },\n {\n 'name': 'role',\n 'type': 'string'\n },\n {\n 'name': 'company_id_code',\n 'type': 'string'\n },\n {\n 'name': 'company_id_name',\n 'type': 'string'\n },\n {\n 'name': 'company_id_remarks',\n 'type': 'string'\n },\n {\n 'name': 'company_id_owner_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_address',\n 'type': 'string'\n },\n {\n 'name': 'company_id_tel',\n 'type': 'string'\n },\n {\n 'name': 'company_id_fax',\n 'type': 'string'\n },\n {\n 'name': 'company_id_email',\n 'type': 'string'\n },\n {\n 'name': 'company_id_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_isOwner',\n 'type': 'int'\n },\n {\n 'name': 'company_id_logo_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_background_color',\n 'type': 'string'\n },\n {\n 'name': 'company_id_comptype',\n 'type': 'string'\n },\n {\n 'name': 'company_id_url',\n 'type': 'string'\n },\n {\n 'name': 'company_id_main_office_id',\n 'type': 'int'\n },\n {\n 'name': 'company_id_created_by',\n 'type': 'int'\n },\n {\n 'name': 'company_id_created_dt',\n 'type': 'date'\n },\n {\n 'name': 'company_id_updated_by',\n 'type': 'int'\n },\n {\n 'name': 'company_id_updated_dt',\n 'type': 'date'\n },\n {\n 'name': 'company_id_passwd',\n 'type': 'string'\n },\n {\n 'name': 'company_id_dispatch_port',\n 'type': 'string'\n },\n {\n 'name': 'company_id_province',\n 'type': 'string'\n },\n {\n 'name': 'company_id_country',\n 'type': 'string'\n }\n]", + "* prop" : "reader", + "totalProperty" : "total" + } + ] + }, + { + "pageSize" : 25, + "xtype" : "PagingToolbar", + "emptyMsg" : "No Office found", + "$ xns" : "Roo", + "displayInfo" : true, + "displayMsg" : "Displaying Office{0} - {1} of {2}", + "* prop" : "footer" + }, + { + "xtype" : "Toolbar", + "$ xns" : "Roo", + "* prop" : "toolbar", + "items" : [ + { + "listeners" : { + "|click" : "function()\n{\n if (!_this.dialog) {\n return;\n }\n var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;\n _dialog.show( { \n id : 0 ,\n company_name : cdata.name,\n company_id : cdata.id,\n address : cdata.address,\n phone : cdata.tel,\n fax : cdata.fax,\n email : cdata.email\n } , function() {\n _this.grid.footer.onClick('first');\n });\n}" + }, + "text" : "Add", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'", + "$ xns" : "Roo.Toolbar" + }, + { + "listeners" : { + "|click" : "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n if (!_this.dialog) {\n return;\n }\n s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;\n _this.dialog.show(s[0].data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n}\n" + }, + "text" : "Edit", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'", + "$ xns" : "Roo.Toolbar" + }, + { + "listeners" : { + "|click" : "function()\n{\n Pman.genericDelete(_this, 'Office'); \n}\n " + }, + "text" : "Delete", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'", + "$ xns" : "Roo.Toolbar" } - ], - "permname": "", - "modOrder": "001" + ] + }, + { + "xtype" : "ColumnModel", + "sortable" : true, + "header" : "Name / Department / Sub Comp.", + "width" : 200, + "$ renderer" : "function(v) { return String.format('{0}', v); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "name" + }, + { + "xtype" : "ColumnModel", + "width" : 100, + "header" : "Phone", + "$ renderer" : "function(v) { return String.format('{0}', v); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "phone" + }, + { + "xtype" : "ColumnModel", + "width" : 100, + "header" : "Fax", + "$ renderer" : "function(v) { return String.format('{0}', v); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "fax" + }, + { + "xtype" : "ColumnModel", + "width" : 200, + "header" : "Email", + "$ renderer" : "function (v) {\n return (v.length && v.indexOf('@') > 0 ) ? \n String.format('{0}',v) : v;\n \n}", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "email" + }, + { + "xtype" : "ColumnModel", + "width" : 300, + "header" : "Address", + "$ renderer" : "function(v) { return String.format('{0}', v); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "address" + } + ] + } + ] + } + ] } \ No newline at end of file diff --git a/Pman.Tab.AdminOffice.js b/Pman.Tab.AdminOffice.js index 75d5370..ab343d7 100644 --- a/Pman.Tab.AdminOffice.js +++ b/Pman.Tab.AdminOffice.js @@ -2,345 +2,381 @@ // Auto generated file - created by app.Builder.js- do not edit directly (at present!) +Roo.namespace('Pman.Tab'); + Pman.Tab.AdminOffice = new Roo.XComponent({ - part : ["Admin","Office"], - order : '001-Pman.Tab.AdminOffice', - region : 'center', - parent : 'Pman.Tab.AdminCompanies', - name : "Pman.Tab.AdminOffice", - disabled : false, - permname : '', - _tree : function() - { - var _this = this; - var MODULE = this; - return { - xtype: 'GridPanel', - xns: Roo, - listeners : { - activate : function() { - _this.panel = this; - if (_this.grid) { - _this.grid.footer.onClick('first'); - } - } - }, - background : true, - fitContainer : true, - fitToframe : true, - region : 'south', - tableName : 'Office', - title : "Offices / Departments / Sub-Companies", - grid : { - xtype: 'Grid', - xns: Roo.grid, - listeners : { - render : function() - { - _this.grid = this; - _this.dialog =Pman.Dialog.Office; - if (_this.panel.active) { - this.footer.onClick('first'); - } - }, - rowdblclick : function (_self, rowIndex, e) - { - if (!_this.dialog) return; - _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() { - _this.grid.footer.onClick('first'); - }); - } - }, - autoExpandColumn : 'name', - loadMask : true, - dataSource : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o) - { - try { - var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel(); - sm = sm.getSelected(); - if (!sm || !sm.data.id) { - // mask?? - return false; - } - - o.params.company_id = sm.data.id ; - } catch (e) { - return false; - } - - - } - }, - remoteSort : true, - sortInfo : { field : 'name', direction: 'ASC' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/Office.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - totalProperty : 'total', - root : 'data', - id : 'id', - fields : [ - { - 'name': 'id', - 'type': 'int' - }, - { - 'name': 'company_id', - 'type': 'int' - }, - { - 'name': 'name', - 'type': 'string' - }, - { - 'name': 'address', - 'type': 'string' - }, - { - 'name': 'phone', - 'type': 'string' - }, - { - 'name': 'fax', - 'type': 'string' - }, - { - 'name': 'email', - 'type': 'string' - }, - { - 'name': 'role', - 'type': 'string' - }, - { - 'name': 'company_id_code', - 'type': 'string' - }, - { - 'name': 'company_id_name', - 'type': 'string' - }, - { - 'name': 'company_id_remarks', - 'type': 'string' - }, - { - 'name': 'company_id_owner_id', - 'type': 'int' - }, - { - 'name': 'company_id_address', - 'type': 'string' - }, - { - 'name': 'company_id_tel', - 'type': 'string' - }, - { - 'name': 'company_id_fax', - 'type': 'string' - }, - { - 'name': 'company_id_email', - 'type': 'string' - }, - { - 'name': 'company_id_id', - 'type': 'int' - }, - { - 'name': 'company_id_isOwner', - 'type': 'int' - }, - { - 'name': 'company_id_logo_id', - 'type': 'int' - }, - { - 'name': 'company_id_background_color', - 'type': 'string' - }, - { - 'name': 'company_id_comptype', - 'type': 'string' - }, - { - 'name': 'company_id_url', - 'type': 'string' - }, - { - 'name': 'company_id_main_office_id', - 'type': 'int' - }, - { - 'name': 'company_id_created_by', - 'type': 'int' - }, - { - 'name': 'company_id_created_dt', - 'type': 'date' - }, - { - 'name': 'company_id_updated_by', - 'type': 'int' - }, - { - 'name': 'company_id_updated_dt', - 'type': 'date' - }, - { - 'name': 'company_id_passwd', - 'type': 'string' - }, - { - 'name': 'company_id_dispatch_port', - 'type': 'string' - }, - { - 'name': 'company_id_province', - 'type': 'string' - }, - { - 'name': 'company_id_country', - 'type': 'string' - } - ] - } - }, - footer : { - xtype: 'PagingToolbar', - xns: Roo, - pageSize : 25, - displayInfo : true, - displayMsg : "Displaying Office{0} - {1} of {2}", - emptyMsg : "No Office found" - }, - toolbar : { - xtype: 'Toolbar', - xns: Roo, - items : [ - { - xtype: 'Button', - xns: Roo.Toolbar, - listeners : { - click : function() - { - if (!_this.dialog) return; - - var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data; - _dialog.show( { - id : 0 , - company_name : cdata.name, - company_id : cdata.id, - address : cdata.address, - phone : cdata.tel, - fax : cdata.fax, - email : cdata.email - } , function() { - _this.grid.footer.onClick('first'); - }); - } - }, - cls : 'x-btn-text-icon', - text : "Add", - icon : Roo.rootURL + 'images/default/dd/drop-add.gif' - }, - { - xtype: 'Button', - xns: Roo.Toolbar, - listeners : { - click : function() - { - var s = _this.grid.getSelectionModel().getSelections(); - if (!s.length || (s.length > 1)) { - Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row"); - return; - } - if (!_this.dialog) return; - s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name; - _this.dialog.show(s[0].data, function() { - _this.grid.footer.onClick('first'); - }); - - } - }, - cls : 'x-btn-text-icon', - text : "Edit", - icon : Roo.rootURL + 'images/default/tree/leaf.gif' - }, - { - xtype: 'Button', - xns: Roo.Toolbar, - text : "Delete", - cls : 'x-btn-text-icon', - icon : rootURL + '/Pman/templates/images/trash.gif', - listeners : { - click : function() - { - Pman.genericDelete(_this, 'Office'); - } - } - } - ] - }, - colModel : [ - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'name', - header : 'Name / Department / Sub Comp.', - sortable : true, - width : 200, - renderer : function(v) { return String.format('{0}', v); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'phone', - header : 'Phone', - width : 100, - renderer : function(v) { return String.format('{0}', v); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'fax', - header : 'Fax', - width : 100, - renderer : function(v) { return String.format('{0}', v); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'email', - header : 'Email', - width : 200, - renderer : function (v) { - return (v.length && v.indexOf('@') > 0 ) ? - String.format('{0}',v) : v; - - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'address', - header : 'Address', - width : 300, - renderer : function(v) { return String.format('{0}', v); } - } - ] - } - }; - } + + _strings : { + 'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email", + 'ec211f7c20af43e742bf2570c3cb84f9' :"Add", + '14820f8c54725a56438e99f6bd57dfa3' :"Displaying Office{0} - {1} of {2}", + '7dce122004969d56ae2e0245cb754d35' :"Edit", + '7407f706267593de473324b2c07ef2fc' :"Offices / Departments / Sub-Companies", + '217574e21514de41ec31aaf5ddadb2c3' :"No Office found", + 'bcc254b55c4a1babdf1dcb82c207506b' :"Phone", + 'a8fa7984f57a42bb41143f3d7665bd36' :"Name / Department / Sub Comp.", + 'f2a6c498fb90ee345d997f888fce3b18' :"Delete", + 'dd7bf230fde8d4836917806aff6a6b27' :"Address", + '9810aa2b9f44401be4bf73188ef2b67d' :"Fax" + }, + + part : ["Admin", "Office" ], + order : '001-Pman.Tab.AdminOffice', + region : 'center', + parent : 'Pman.Tab.AdminCompanies', + name : "Pman.Tab.AdminOffice", + disabled : false, + permname : '', + _tree : function() + { + var _this = this; + var MODULE = this; + return { + xtype : 'GridPanel', + background : true, + fitContainer : true, + fitToframe : true, + region : 'south', + tableName : 'Office', + title : _this._strings['7407f706267593de473324b2c07ef2fc'] /* Offices / Departments / Sub-Companies */, + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } + } + }, + xns : Roo, + '|xns' : 'Roo', + grid : { + xtype : 'Grid', + autoExpandColumn : 'name', + loadMask : true, + listeners : { + render : function() + { + _this.grid = this; + _this.dialog =Pman.Dialog.Office; + if (_this.panel.active) { + this.footer.onClick('first'); + } + }, + rowdblclick : function (_self, rowIndex, e) + { + if (!_this.dialog) { + return; + } + _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() { + _this.grid.footer.onClick('first'); + }); + } + }, + xns : Roo.grid, + '|xns' : 'Roo.grid', + footer : { + xtype : 'PagingToolbar', + displayInfo : true, + displayMsg : _this._strings['14820f8c54725a56438e99f6bd57dfa3'] /* Displaying Office{0} - {1} of {2} */, + emptyMsg : _this._strings['217574e21514de41ec31aaf5ddadb2c3'] /* No Office found */, + pageSize : 25, + xns : Roo, + '|xns' : 'Roo' + }, + toolbar : { + xtype : 'Toolbar', + xns : Roo, + '|xns' : 'Roo', + items : [ + { + xtype : 'Button', + cls : 'x-btn-text-icon', + icon : Roo.rootURL + 'images/default/dd/drop-add.gif', + text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */, + listeners : { + click : function() + { + if (!_this.dialog) { + return; + } + var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data; + _dialog.show( { + id : 0 , + company_name : cdata.name, + company_id : cdata.id, + address : cdata.address, + phone : cdata.tel, + fax : cdata.fax, + email : cdata.email + } , function() { + _this.grid.footer.onClick('first'); + }); + } + }, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar' + }, + { + xtype : 'Button', + cls : 'x-btn-text-icon', + icon : Roo.rootURL + 'images/default/tree/leaf.gif', + text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */, + listeners : { + click : function() + { + var s = _this.grid.getSelectionModel().getSelections(); + if (!s.length || (s.length > 1)) { + Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row"); + return; + } + if (!_this.dialog) { + return; + } + s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name; + _this.dialog.show(s[0].data, function() { + _this.grid.footer.onClick('first'); + }); + + } + }, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar' + }, + { + xtype : 'Button', + cls : 'x-btn-text-icon', + icon : rootURL + '/Pman/templates/images/trash.gif', + text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */, + listeners : { + click : function() + { + Pman.genericDelete(_this, 'Office'); + } + }, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar' + } + ] + }, + dataSource : { + xtype : 'Store', + remoteSort : true, + sortInfo : { field : 'name', direction: 'ASC' }, + listeners : { + beforeload : function (_self, o) + { + try { + var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel(); + sm = sm.getSelected(); + if (!sm || !sm.data.id) { + // mask?? + return false; + } + + o.params.company_id = sm.data.id ; + } catch (e) { + return false; + } + + + } + }, + xns : Roo.data, + '|xns' : 'Roo.data', + proxy : { + xtype : 'HttpProxy', + method : 'GET', + url : baseURL + '/Roo/Office.php', + xns : Roo.data, + '|xns' : 'Roo.data' + }, + reader : { + xtype : 'JsonReader', + fields : [ + { + 'name': 'id', + 'type': 'int' + }, + { + 'name': 'company_id', + 'type': 'int' + }, + { + 'name': 'name', + 'type': 'string' + }, + { + 'name': 'address', + 'type': 'string' + }, + { + 'name': 'phone', + 'type': 'string' + }, + { + 'name': 'fax', + 'type': 'string' + }, + { + 'name': 'email', + 'type': 'string' + }, + { + 'name': 'role', + 'type': 'string' + }, + { + 'name': 'company_id_code', + 'type': 'string' + }, + { + 'name': 'company_id_name', + 'type': 'string' + }, + { + 'name': 'company_id_remarks', + 'type': 'string' + }, + { + 'name': 'company_id_owner_id', + 'type': 'int' + }, + { + 'name': 'company_id_address', + 'type': 'string' + }, + { + 'name': 'company_id_tel', + 'type': 'string' + }, + { + 'name': 'company_id_fax', + 'type': 'string' + }, + { + 'name': 'company_id_email', + 'type': 'string' + }, + { + 'name': 'company_id_id', + 'type': 'int' + }, + { + 'name': 'company_id_isOwner', + 'type': 'int' + }, + { + 'name': 'company_id_logo_id', + 'type': 'int' + }, + { + 'name': 'company_id_background_color', + 'type': 'string' + }, + { + 'name': 'company_id_comptype', + 'type': 'string' + }, + { + 'name': 'company_id_url', + 'type': 'string' + }, + { + 'name': 'company_id_main_office_id', + 'type': 'int' + }, + { + 'name': 'company_id_created_by', + 'type': 'int' + }, + { + 'name': 'company_id_created_dt', + 'type': 'date' + }, + { + 'name': 'company_id_updated_by', + 'type': 'int' + }, + { + 'name': 'company_id_updated_dt', + 'type': 'date' + }, + { + 'name': 'company_id_passwd', + 'type': 'string' + }, + { + 'name': 'company_id_dispatch_port', + 'type': 'string' + }, + { + 'name': 'company_id_province', + 'type': 'string' + }, + { + 'name': 'company_id_country', + 'type': 'string' + } + ], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + '|xns' : 'Roo.data' + } + }, + colModel : [ + { + xtype : 'ColumnModel', + dataIndex : 'name', + header : _this._strings['a8fa7984f57a42bb41143f3d7665bd36'] /* Name / Department / Sub Comp. */, + renderer : function(v) { return String.format('{0}', v); }, + sortable : true, + width : 200, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'phone', + header : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */, + renderer : function(v) { return String.format('{0}', v); }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'fax', + header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */, + renderer : function(v) { return String.format('{0}', v); }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'email', + header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */, + renderer : function (v) { + return (v.length && v.indexOf('@') > 0 ) ? + String.format('{0}',v) : v; + + }, + width : 200, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'address', + header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */, + renderer : function(v) { return String.format('{0}', v); }, + width : 300, + xns : Roo.grid, + '|xns' : 'Roo.grid' + } + ] + } + }; } }); -- 2.39.2