Pman.Tab.AdminOffice.bjs
[Pman.Admin] / Pman.Tab.AdminOffice.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.AdminOffice = new Roo.XComponent({
8
9  _strings : {
10   'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
11   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
12   '14820f8c54725a56438e99f6bd57dfa3' :"Displaying Office{0} - {1} of {2}",
13   '7dce122004969d56ae2e0245cb754d35' :"Edit",
14   '7407f706267593de473324b2c07ef2fc' :"Offices / Departments / Sub-Companies",
15   '217574e21514de41ec31aaf5ddadb2c3' :"No Office found",
16   'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
17   'a8fa7984f57a42bb41143f3d7665bd36' :"Name / Department / Sub Comp.",
18   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
19   'dd7bf230fde8d4836917806aff6a6b27' :"Address",
20   '9810aa2b9f44401be4bf73188ef2b67d' :"Fax"
21  },
22
23   part     :  ["Admin", "Office" ],
24   order    : '001-Pman.Tab.AdminOffice',
25   region   : 'center',
26   parent   : 'Pman.Tab.AdminCompanies',
27   name     : "Pman.Tab.AdminOffice",
28   disabled : false, 
29   permname : '', 
30   _tree : function()
31   {
32    var _this = this;
33    var MODULE = this;
34    return {
35    xtype : 'GridPanel',
36    background : true,
37    fitContainer : true,
38    fitToframe : true,
39    region : 'south',
40    tableName : 'Office',
41    title : _this._strings['7407f706267593de473324b2c07ef2fc'] /* Offices / Departments / Sub-Companies */,
42    listeners : {
43     activate : function() {
44          _this.panel = this;
45          if (_this.grid) {
46              _this.grid.footer.onClick('first');
47          }
48      }
49    },
50    xns : Roo,
51    '|xns' : 'Roo',
52    grid : {
53     xtype : 'Grid',
54     autoExpandColumn : 'name',
55     loadMask : true,
56     listeners : {
57      render : function() 
58       {
59           _this.grid = this; 
60           _this.dialog =Pman.Dialog.Office;
61           if (_this.panel.active) {
62              this.footer.onClick('first');
63           } 
64       },
65      rowdblclick : function (_self, rowIndex, e)
66       {
67           if (!_this.dialog) { 
68               return; 
69           }
70           _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
71               _this.grid.footer.onClick('first');
72           }); 
73       }
74     },
75     xns : Roo.grid,
76     '|xns' : 'Roo.grid',
77     footer : {
78      xtype : 'PagingToolbar',
79      displayInfo : true,
80      displayMsg : _this._strings['14820f8c54725a56438e99f6bd57dfa3'] /* Displaying Office{0} - {1} of {2} */,
81      emptyMsg : _this._strings['217574e21514de41ec31aaf5ddadb2c3'] /* No Office found */,
82      pageSize : 25,
83      xns : Roo,
84      '|xns' : 'Roo'
85     },
86     toolbar : {
87      xtype : 'Toolbar',
88      xns : Roo,
89      '|xns' : 'Roo',
90      items  : [
91       {
92        xtype : 'Button',
93        cls : 'x-btn-text-icon',
94        icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
95        text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
96        listeners : {
97         click : function()
98          {
99              if (!_this.dialog) {
100               return;
101              }
102              var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;
103              _dialog.show( { 
104                  id : 0 ,
105                  company_name : cdata.name,
106                  company_id : cdata.id,
107                  address : cdata.address,
108                  phone : cdata.tel,
109                  fax : cdata.fax,
110                  email  : cdata.email
111              } , function() {
112                  _this.grid.footer.onClick('first');
113             });
114          }
115        },
116        xns : Roo.Toolbar,
117        '|xns' : 'Roo.Toolbar'
118       },
119       {
120        xtype : 'Button',
121        cls : 'x-btn-text-icon',
122        icon : Roo.rootURL + 'images/default/tree/leaf.gif',
123        text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
124        listeners : {
125         click : function()
126          {
127              var s = _this.grid.getSelectionModel().getSelections();
128              if (!s.length || (s.length > 1))  {
129                  Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
130                  return;
131              }
132              if (!_this.dialog) {
133                  return;
134              }
135              s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;
136              _this.dialog.show(s[0].data, function() {
137                  _this.grid.footer.onClick('first');
138              }); 
139              
140          }
141        },
142        xns : Roo.Toolbar,
143        '|xns' : 'Roo.Toolbar'
144       },
145       {
146        xtype : 'Button',
147        cls : 'x-btn-text-icon',
148        icon : rootURL + '/Pman/templates/images/trash.gif',
149        text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
150        listeners : {
151         click : function()
152          {
153               Pman.genericDelete(_this, 'Office'); 
154          }
155        },
156        xns : Roo.Toolbar,
157        '|xns' : 'Roo.Toolbar'
158       }
159      ]
160     },
161     dataSource : {
162      xtype : 'Store',
163      remoteSort : true,
164      sortInfo : { field : 'name', direction: 'ASC' },
165      listeners : {
166       beforeload : function (_self, o)
167        {
168            try {
169                var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel();
170                sm = sm.getSelected();
171                if (!sm || !sm.data.id) {
172                    // mask??
173                    return false;
174                }
175                       
176                o.params.company_id = sm.data.id ;
177            } catch (e) {
178                return false;
179            }
180            
181            
182         }
183      },
184      xns : Roo.data,
185      '|xns' : 'Roo.data',
186      proxy : {
187       xtype : 'HttpProxy',
188       method : 'GET',
189       url : baseURL + '/Roo/Office.php',
190       xns : Roo.data,
191       '|xns' : 'Roo.data'
192      },
193      reader : {
194       xtype : 'JsonReader',
195       fields : [
196           {
197               'name': 'id',
198               'type': 'int'
199           },
200           {
201               'name': 'company_id',
202               'type': 'int'
203           },
204           {
205               'name': 'name',
206               'type': 'string'
207           },
208           {
209               'name': 'address',
210               'type': 'string'
211           },
212           {
213               'name': 'phone',
214               'type': 'string'
215           },
216           {
217               'name': 'fax',
218               'type': 'string'
219           },
220           {
221               'name': 'email',
222               'type': 'string'
223           },
224           {
225               'name': 'role',
226               'type': 'string'
227           },
228           {
229               'name': 'company_id_code',
230               'type': 'string'
231           },
232           {
233               'name': 'company_id_name',
234               'type': 'string'
235           },
236           {
237               'name': 'company_id_remarks',
238               'type': 'string'
239           },
240           {
241               'name': 'company_id_owner_id',
242               'type': 'int'
243           },
244           {
245               'name': 'company_id_address',
246               'type': 'string'
247           },
248           {
249               'name': 'company_id_tel',
250               'type': 'string'
251           },
252           {
253               'name': 'company_id_fax',
254               'type': 'string'
255           },
256           {
257               'name': 'company_id_email',
258               'type': 'string'
259           },
260           {
261               'name': 'company_id_id',
262               'type': 'int'
263           },
264           {
265               'name': 'company_id_isOwner',
266               'type': 'int'
267           },
268           {
269               'name': 'company_id_logo_id',
270               'type': 'int'
271           },
272           {
273               'name': 'company_id_background_color',
274               'type': 'string'
275           },
276           {
277               'name': 'company_id_comptype',
278               'type': 'string'
279           },
280           {
281               'name': 'company_id_url',
282               'type': 'string'
283           },
284           {
285               'name': 'company_id_main_office_id',
286               'type': 'int'
287           },
288           {
289               'name': 'company_id_created_by',
290               'type': 'int'
291           },
292           {
293               'name': 'company_id_created_dt',
294               'type': 'date'
295           },
296           {
297               'name': 'company_id_updated_by',
298               'type': 'int'
299           },
300           {
301               'name': 'company_id_updated_dt',
302               'type': 'date'
303           },
304           {
305               'name': 'company_id_passwd',
306               'type': 'string'
307           },
308           {
309               'name': 'company_id_dispatch_port',
310               'type': 'string'
311           },
312           {
313               'name': 'company_id_province',
314               'type': 'string'
315           },
316           {
317               'name': 'company_id_country',
318               'type': 'string'
319           }
320       ],
321       id : 'id',
322       root : 'data',
323       totalProperty : 'total',
324       xns : Roo.data,
325       '|xns' : 'Roo.data'
326      }
327     },
328     colModel : [
329      {
330       xtype : 'ColumnModel',
331       dataIndex : 'name',
332       header : _this._strings['a8fa7984f57a42bb41143f3d7665bd36'] /* Name / Department / Sub Comp. */,
333       renderer : function(v) { return String.format('{0}', v); },
334       sortable : true,
335       width : 200,
336       xns : Roo.grid,
337       '|xns' : 'Roo.grid'
338      },
339      {
340       xtype : 'ColumnModel',
341       dataIndex : 'phone',
342       header : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
343       renderer : function(v) { return String.format('{0}', v); },
344       width : 100,
345       xns : Roo.grid,
346       '|xns' : 'Roo.grid'
347      },
348      {
349       xtype : 'ColumnModel',
350       dataIndex : 'fax',
351       header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
352       renderer : function(v) { return String.format('{0}', v); },
353       width : 100,
354       xns : Roo.grid,
355       '|xns' : 'Roo.grid'
356      },
357      {
358       xtype : 'ColumnModel',
359       dataIndex : 'email',
360       header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
361       renderer : function (v) {
362           return (v.length && v.indexOf('@') > 0 ) ? 
363               String.format('<a href="mailto:{0}">{0}</a>',v) : v;
364               
365       },
366       width : 200,
367       xns : Roo.grid,
368       '|xns' : 'Roo.grid'
369      },
370      {
371       xtype : 'ColumnModel',
372       dataIndex : 'address',
373       header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
374       renderer : function(v) { return String.format('{0}', v); },
375       width : 300,
376       xns : Roo.grid,
377       '|xns' : 'Roo.grid'
378      }
379     ]
380    }
381   };  }
382 });