Pman.Tab.AdminCompanies.bjs
[Pman.Admin] / Pman.Tab.AdminCompanies.bjs
1 {
2     "name" : "Pman.Tab.AdminCompanies",
3     "parent" : "Pman.Tab.Admin",
4     "title" : "Pman.Tab.AdminCompanies",
5     "path" : "/home/michael/gitlive/Pman.Admin/Pman.Tab.AdminCompanies.bjs",
6     "permname" : "Admin.Companies",
7     "modOrder" : "030",
8     "items" : [
9         {
10             "region" : "center",
11             "xtype" : "NestedLayoutPanel",
12             "title" : "Companies",
13             "$ xns" : "Roo",
14             "items" : [
15                 {
16                     "xtype" : "BorderLayout",
17                     "$ xns" : "Roo",
18                     "* prop" : "layout",
19                     "items" : [
20                         {
21                             "xtype" : "LayoutRegion",
22                             "$ xns" : "Roo",
23                             "* prop" : "center"
24                         },
25                         {
26                             "xtype" : "LayoutRegion",
27                             "$ xns" : "Roo",
28                             "split" : true,
29                             "* prop" : "south",
30                             "height" : 150,
31                             "titlebar" : true
32                         },
33                         {
34                             "listeners" : {
35                                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
36                             },
37                             "fitToframe" : true,
38                             "background" : true,
39                             "region" : "center",
40                             "title" : "Companies",
41                             "xtype" : "GridPanel",
42                             "fitContainer" : true,
43                             "$ xns" : "Roo",
44                             "tableName" : "Companies",
45                             "items" : [
46                                 {
47                                     "listeners" : {
48                                         "|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    \n}\n",
49                                         "|render" : "function() \n{\n    _this.grid = this; \n     _this.dialog = Pman.Dialog.Companies;\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
50                                         "rowclick" : "function (_self, rowIndex, e)\n{\n  try { Pman.Tab.AdminOffice.grid.footer.onClick('refresh'); } catch(e) {}\n}"
51                                     },
52                                     "autoExpandColumn" : "name",
53                                     "xtype" : "Grid",
54                                     "loadMask" : true,
55                                     "$ xns" : "Roo.grid",
56                                     "* prop" : "grid",
57                                     "items" : [
58                                         {
59                                             "listeners" : {
60                                                 "beforeload" : "function (_self, o)\n{\n   o.params = o.params || {};\n   try {\n       o.params['query[name]'] = _this.searchBox.getValue();\n   } catch(e) { return false; }\n}",
61                                                 "load" : "function (_self, records, options)\n{\n   try {\n        Pman.Tab.AdminOffice.grid.footer.onClick('refresh');\n    } catch (e) {}\n}"
62                                             },
63                                             "xtype" : "Store",
64                                             "remoteSort" : true,
65                                             "$ sortInfo" : "{ field : 'name', direction: 'ASC' }",
66                                             "$ xns" : "Roo.data",
67                                             "* prop" : "dataSource",
68                                             "items" : [
69                                                 {
70                                                     "listeners" : {
71                                                         "load" : "function (This, o, arg)\n{\n \n}"
72                                                     },
73                                                     "$ url" : "baseURL + '/Roo/Companies.php'",
74                                                     "xtype" : "HttpProxy",
75                                                     "method" : "GET",
76                                                     "$ xns" : "Roo.data",
77                                                     "* prop" : "proxy"
78                                                 },
79                                                 {
80                                                     "id" : "id",
81                                                     "root" : "data",
82                                                     "xtype" : "JsonReader",
83                                                     "$ xns" : "Roo.data",
84                                                     "$ 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]",
85                                                     "* prop" : "reader",
86                                                     "totalProperty" : "total"
87                                                 }
88                                             ]
89                                         },
90                                         {
91                                             "pageSize" : 25,
92                                             "xtype" : "PagingToolbar",
93                                             "emptyMsg" : "No Companies found",
94                                             "$ xns" : "Roo",
95                                             "displayInfo" : true,
96                                             "displayMsg" : "Displaying Companies{0} - {1} of {2}",
97                                             "* prop" : "footer"
98                                         },
99                                         {
100                                             "xtype" : "Toolbar",
101                                             "$ xns" : "Roo",
102                                             "* prop" : "toolbar",
103                                             "items" : [
104                                                 {
105                                                     "listeners" : {
106                                                         "specialkey" : "function (_self, e)\n{\n if (e.getKey() == 13) {\n     _this.grid.footer.onClick( 'first' );\n  }\n}",
107                                                         "show" : "function (_self)\n{\n\n}",
108                                                         "render" : "function (_self)\n{\n_this.searchBox = _self;\n}"
109                                                     },
110                                                     "xtype" : "TextField",
111                                                     "$ xns" : "Roo.form"
112                                                 },
113                                                 {
114                                                     "listeners" : {
115                                                         "|click" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
116                                                     },
117                                                     "xtype" : "Button",
118                                                     "cls" : "x-btn-icon",
119                                                     "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
120                                                     "$ xns" : "Roo.Toolbar"
121                                                 },
122                                                 {
123                                                     "listeners" : {
124                                                         "|click" : "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    _this.grid.footer.onClick('first');\n}"
125                                                     },
126                                                     "xtype" : "Button",
127                                                     "cls" : "x-btn-icon",
128                                                     "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
129                                                     "$ xns" : "Roo.Toolbar"
130                                                 },
131                                                 {
132                                                     "xtype" : "Fill",
133                                                     "$ xns" : "Roo.Toolbar"
134                                                 },
135                                                 {
136                                                     "listeners" : {
137                                                         "|click" : "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
138                                                     },
139                                                     "text" : "Add",
140                                                     "xtype" : "Button",
141                                                     "cls" : "x-btn-text-icon",
142                                                     "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
143                                                     "$ xns" : "Roo.Toolbar"
144                                                 },
145                                                 {
146                                                     "listeners" : {
147                                                         "|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"
148                                                     },
149                                                     "text" : "Edit",
150                                                     "xtype" : "Button",
151                                                     "cls" : "x-btn-text-icon",
152                                                     "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
153                                                     "$ xns" : "Roo.Toolbar"
154                                                 },
155                                                 {
156                                                     "listeners" : {
157                                                         "|click" : "function()\n{\n     Pman.genericDelete(_this, 'Companies'); \n}\n        "
158                                                     },
159                                                     "text" : "Delete",
160                                                     "xtype" : "Button",
161                                                     "cls" : "x-btn-text-icon",
162                                                     "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
163                                                     "$ xns" : "Roo.Toolbar"
164                                                 }
165                                             ]
166                                         },
167                                         {
168                                             "xtype" : "ColumnModel",
169                                             "sortable" : true,
170                                             "header" : "Type",
171                                             "width" : 90,
172                                             "$ renderer" : "function (v,x ,r) {\n    //return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);\n    return v;\n}",
173                                             "$ xns" : "Roo.grid",
174                                             "* prop" : "colModel[]",
175                                             "dataIndex" : "comptype"
176                                         },
177                                         {
178                                             "xtype" : "ColumnModel",
179                                             "sortable" : true,
180                                             "header" : "Ref#",
181                                             "width" : 50,
182                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
183                                             "$ xns" : "Roo.grid",
184                                             "* prop" : "colModel[]",
185                                             "dataIndex" : "code"
186                                         },
187                                         {
188                                             "xtype" : "ColumnModel",
189                                             "sortable" : true,
190                                             "header" : "Name",
191                                             "width" : 200,
192                                             "$ renderer" : "function(v,x,r) {\n    return String.format(r.data.comptype == 'OWNER' ? '<B>{0}</B>' : '{0}',v);    \n}",
193                                             "$ xns" : "Roo.grid",
194                                             "* prop" : "colModel[]",
195                                             "dataIndex" : "name"
196                                         },
197                                         {
198                                             "xtype" : "ColumnModel",
199                                             "header" : "Tel",
200                                             "width" : 100,
201                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
202                                             "$ xns" : "Roo.grid",
203                                             "* prop" : "colModel[]",
204                                             "dataIndex" : "tel"
205                                         },
206                                         {
207                                             "xtype" : "ColumnModel",
208                                             "header" : "Fax",
209                                             "width" : 100,
210                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
211                                             "$ xns" : "Roo.grid",
212                                             "* prop" : "colModel[]",
213                                             "dataIndex" : "fax"
214                                         },
215                                         {
216                                             "xtype" : "ColumnModel",
217                                             "sortable" : true,
218                                             "header" : "Email",
219                                             "width" : 100,
220                                             "$ renderer" : " function (v) {\n        return (v.length && v.indexOf('@') > 0 ) ? \n            String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n            \n    }",
221                                             "$ xns" : "Roo.grid",
222                                             "* prop" : "colModel[]",
223                                             "dataIndex" : "email"
224                                         },
225                                         {
226                                             "xtype" : "ColumnModel",
227                                             "sortable" : true,
228                                             "header" : "Address",
229                                             "width" : 200,
230                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
231                                             "$ xns" : "Roo.grid",
232                                             "* prop" : "colModel[]",
233                                             "dataIndex" : "address"
234                                         },
235                                         {
236                                             "xtype" : "ColumnModel",
237                                             "width" : 200,
238                                             "header" : "Remarks",
239                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
240                                             "$ xns" : "Roo.grid",
241                                             "* prop" : "colModel[]",
242                                             "dataIndex" : "remarks"
243                                         }
244                                     ]
245                                 }
246                             ]
247                         }
248                     ]
249                 }
250             ]
251         }
252     ]
253 }