From cab0ac3a3f09e27b385a12ae768158c1ef1bdc11 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 12 May 2011 15:59:04 +0800 Subject: [PATCH] Pman.Tab.AdminCompanies.bjs --- Pman.Tab.AdminCompanies.bjs | 178 ++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/Pman.Tab.AdminCompanies.bjs b/Pman.Tab.AdminCompanies.bjs index fbab996..4ad2621 100644 --- a/Pman.Tab.AdminCompanies.bjs +++ b/Pman.Tab.AdminCompanies.bjs @@ -23,6 +23,184 @@ "*prop": "south", "xtype": "LayoutRegion", "|xns": "Roo" + }, + { + "|xns": "Roo", + "xtype": "GridPanel", + "title": "Companies", + "fitToframe": true, + "fitContainer": true, + "tableName": "Companies", + "background": true, + "region": "center", + "listeners": { + "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" + }, + "items": [ + { + "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), function() {\n _this.grid.footer.onClick('first');\n }); \n}\n" + }, + "*prop": "grid", + "autoExpandColumn": "name", + "loadMask": true, + "xtype": "Grid", + "|xns": "Roo.grid", + "items": [ + { + "listeners": { + "load": "function (_self, records, options)\n{\n try {\n Pman.Tab.Office.grid.footer.onClick('refresh');\n } catch (e) {}\n}" + }, + "*prop": "dataSource", + "remoteSort": true, + "xtype": "Store", + "|sortInfo": "{ field : 'code', direction: 'ASC' }", + "|xns": "Roo.data", + "items": [ + { + "listeners": { + "load": "function (This, o, arg)\n{\n \n}" + }, + "*prop": "proxy", + "method": "GET", + "xtype": "HttpProxy", + "|url": "baseURL + '/Roo/Companies.php'", + "|xns": "Roo.data" + }, + { + "|xns": "Roo.data", + "xtype": "JsonReader", + "totalProperty": "total", + "root": "data", + "*prop": "reader", + "id": "id", + "|fields": "[\n {\n 'name': 'code',\n 'type': 'string'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'remarks',\n 'type': 'string'\n },\n {\n 'name': 'owner_id',\n 'type': 'int'\n },\n {\n 'name': 'address',\n 'type': 'string'\n },\n {\n 'name': 'tel',\n 'type': 'string'\n },\n {\n 'name': 'fax',\n 'type': 'string'\n },\n {\n 'name': 'email',\n 'type': 'string'\n },\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'isOwner',\n 'type': 'int'\n },\n {\n 'name': 'logo_id',\n 'type': 'int'\n },\n {\n 'name': 'background_color',\n 'type': 'string'\n },\n {\n 'name': 'comptype',\n 'type': 'string'\n },\n {\n 'name': 'url',\n 'type': 'string'\n },\n {\n 'name': 'main_office_id',\n 'type': 'int'\n },\n {\n 'name': 'created_by',\n 'type': 'int'\n },\n {\n 'name': 'created_dt',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'updated_by',\n 'type': 'int'\n },\n {\n 'name': 'updated_dt',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'passwd',\n 'type': 'string'\n },\n {\n 'name': 'dispatch_port',\n 'type': 'string'\n },\n {\n 'name': 'province',\n 'type': 'string'\n },\n {\n 'name': 'country',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_id',\n 'type': 'int'\n },\n {\n 'name': 'logo_id_filename',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_ontable',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_onid',\n 'type': 'int'\n },\n {\n 'name': 'logo_id_mimetype',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_width',\n 'type': 'int'\n },\n {\n 'name': 'logo_id_height',\n 'type': 'int'\n },\n {\n 'name': 'logo_id_filesize',\n 'type': 'int'\n },\n {\n 'name': 'logo_id_displayorder',\n 'type': 'int'\n },\n {\n 'name': 'logo_id_language',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_parent_image_id',\n 'type': 'int'\n },\n {\n 'name': 'logo_id_created',\n 'type': 'date'\n },\n {\n 'name': 'logo_id_imgtype',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_linkurl',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_descript',\n 'type': 'string'\n },\n {\n 'name': 'logo_id_title',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_id',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_office_id',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_name',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_phone',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_fax',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_email',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_company_id',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_role',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_active',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_remarks',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_passwd',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_owner_id',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_lang',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_no_reset_sent',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_action_type',\n 'type': 'string'\n },\n {\n 'name': 'owner_id_project_id',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_deleted_by',\n 'type': 'int'\n },\n {\n 'name': 'owner_id_deleted_dt',\n 'type': 'date'\n },\n {\n 'name': 'main_office_id_id',\n 'type': 'int'\n },\n {\n 'name': 'main_office_id_company_id',\n 'type': 'int'\n },\n {\n 'name': 'main_office_id_name',\n 'type': 'string'\n },\n {\n 'name': 'main_office_id_address',\n 'type': 'string'\n },\n {\n 'name': 'main_office_id_phone',\n 'type': 'string'\n },\n {\n 'name': 'main_office_id_fax',\n 'type': 'string'\n },\n {\n 'name': 'main_office_id_email',\n 'type': 'string'\n },\n {\n 'name': 'main_office_id_role',\n 'type': 'string'\n }\n]" + } + ] + }, + { + "*prop": "footer", + "xtype": "PagingToolbar", + "pageSize": 25, + "displayInfo": true, + "displayMsg": "Displaying Companies{0} - {1} of {2}", + "emptyMsg": "No Companies found", + "|xns": "Roo" + }, + { + "*prop": "toolbar", + "xtype": "Toolbar", + "|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" + }, + "|xns": "Roo.Toolbar" + }, + { + "text": "Edit", + "xtype": "Button", + "cls": "x-btn-text-icon", + "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", + "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 _this.dialog.show(s[0].data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n}\n" + }, + "|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, 'Companies'); \n}\n " + }, + "|xns": "Roo.Toolbar" + } + ] + }, + { + "*prop": "colModel[]", + "dataIndex": "comptype", + "header": "Type", + "sortable": true, + "width": 90, + "xtype": "ColumnModel", + "|renderer": "function (v,x ,r) {\n return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);\n}", + "|xns": "Roo.grid" + }, + { + "*prop": "colModel[]", + "dataIndex": "code", + "header": "Ref#", + "width": 50, + "xtype": "ColumnModel", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid" + }, + { + "*prop": "colModel[]", + "dataIndex": "name", + "header": "Name", + "width": 200, + "xtype": "ColumnModel", + "|renderer": "function(v,x,r) {\n return String.format(r.data.isOwner ? '{0}' : '{0}',v); \n}", + "|xns": "Roo.grid" + }, + { + "*prop": "colModel[]", + "dataIndex": "tel", + "header": "Tel", + "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": 100, + "xtype": "ColumnModel", + "|renderer": " function (v) {\n return (v.length && v.indexOf('@') > 0 ) ? \n String.format('{0}',v) : v;\n \n }", + "|xns": "Roo.grid" + }, + { + "xtype": "ColumnModel", + "header": "Address", + "width": 200, + "dataIndex": "address", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Remarks", + "width": 200, + "dataIndex": "remarks", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + } + ] + } + ] } ] } -- 2.39.2