Pman.Tab.AdminCompanies.bjs
[Pman.Admin] / Pman.Tab.AdminCompanies.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.AdminCompanies = new Roo.XComponent({
8
9  _strings : {
10   'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
11   '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
12   'edefbda3a2bdd979e42d8944b7325b79' :"Companies",
13   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
14   'fc6f97505d89fe9277965c126744647a' :"No Companies found",
15   '7dce122004969d56ae2e0245cb754d35' :"Edit",
16   '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
17   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
18   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
19   '9c9745a343efeacc9efe9b7222b27afb' :"Ref#",
20   '49ee3087348e8d44e1feda1917443987' :"Name",
21   '2e006b735fbd916d8ab26978ae6714d4' :"Tel",
22   'dd7bf230fde8d4836917806aff6a6b27' :"Address",
23   '9810aa2b9f44401be4bf73188ef2b67d' :"Fax"
24  },
25
26   part     :  ["Admin", "Companies" ],
27   order    : '030-Pman.Tab.AdminCompanies',
28   region   : 'center',
29   parent   : 'Pman.Tab.Admin',
30   name     : "Pman.Tab.AdminCompanies",
31   disabled : false, 
32   permname : 'Admin.Companies', 
33   _tree : function()
34   {
35    var _this = this;
36    var MODULE = this;
37    return {
38    region : 'center',
39    title : _this._strings['edefbda3a2bdd979e42d8944b7325b79'] /* Companies */,
40    xns : Roo,
41    '|xns' : 'Roo',
42    xtype : 'NestedLayoutPanel',
43    layout : {
44     xns : Roo,
45     '|xns' : 'Roo',
46     xtype : 'BorderLayout',
47     center : {
48      xns : Roo,
49      '|xns' : 'Roo',
50      xtype : 'LayoutRegion'
51     },
52     south : {
53      height : 150,
54      split : true,
55      titlebar : true,
56      xns : Roo,
57      '|xns' : 'Roo',
58      xtype : 'LayoutRegion'
59     },
60     items  : [
61      {
62       background : true,
63       fitContainer : true,
64       fitToframe : true,
65       region : 'center',
66       tableName : 'Companies',
67       title : _this._strings['edefbda3a2bdd979e42d8944b7325b79'] /* Companies */,
68       xns : Roo,
69       '|xns' : 'Roo',
70       xtype : 'GridPanel',
71       listeners : {
72        activate : function() {
73             _this.panel = this;
74             if (_this.grid) {
75                 _this.grid.footer.onClick('first');
76             }
77         }
78       },
79       grid : {
80        autoExpandColumn : 'name',
81        loadMask : true,
82        xns : Roo.grid,
83        '|xns' : 'Roo.grid',
84        xtype : 'Grid',
85        listeners : {
86         render : function() 
87          {
88              _this.grid = this; 
89               _this.dialog = Pman.Dialog.Companies;
90              if (_this.panel.active) {
91                 this.footer.onClick('first');
92              }
93          },
94         rowclick : function (_self, rowIndex, e)
95          {
96            try { Pman.Tab.AdminOffice.grid.footer.onClick('refresh'); } catch(e) {}
97          },
98         rowdblclick : function (_self, rowIndex, e)
99          {
100              if (!_this.dialog) return;
101              _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
102                  _this.grid.footer.onClick('first');
103              }); 
104              
105              
106          }
107        },
108        footer : {
109         displayInfo : true,
110         displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
111         emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
112         pageSize : 25,
113         xns : Roo,
114         '|xns' : 'Roo',
115         xtype : 'PagingToolbar'
116        },
117        toolbar : {
118         xns : Roo,
119         '|xns' : 'Roo',
120         xtype : 'Toolbar',
121         items  : [
122          {
123           xns : Roo.form,
124           '|xns' : 'Roo.form',
125           xtype : 'TextField',
126           listeners : {
127            render : function (_self)
128             {
129             _this.searchBox = _self;
130             },
131            show : function (_self)
132             {
133             
134             },
135            specialkey : function (_self, e)
136             {
137              if (e.getKey() == 13) {
138                  _this.grid.footer.onClick( 'first' );
139               }
140             }
141           }
142          },
143          {
144           cls : 'x-btn-icon',
145           icon : rootURL + '/Pman/templates/images/search.gif',
146           xns : Roo.Toolbar,
147           '|xns' : 'Roo.Toolbar',
148           xtype : 'Button',
149           listeners : {
150            click : function (_self, e)
151             {
152             _this.grid.footer.onClick('first');
153             }
154           }
155          },
156          {
157           cls : 'x-btn-icon',
158           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
159           xns : Roo.Toolbar,
160           '|xns' : 'Roo.Toolbar',
161           xtype : 'Button',
162           listeners : {
163            click : function (_self, e)
164             {
165                 _this.searchBox.setValue('');
166                 _this.grid.footer.onClick('first');
167             }
168           }
169          },
170          {
171           xns : Roo.Toolbar,
172           '|xns' : 'Roo.Toolbar',
173           xtype : 'Fill'
174          },
175          {
176           cls : 'x-btn-text-icon',
177           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
178           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
179           xns : Roo.Toolbar,
180           '|xns' : 'Roo.Toolbar',
181           xtype : 'Button',
182           listeners : {
183            click : function()
184             {
185                 if (!_this.dialog) return;
186                 _this.dialog.show( { id : 0 } , function() {
187                     _this.grid.footer.onClick('first');
188                }); 
189             }
190           }
191          },
192          {
193           cls : 'x-btn-text-icon',
194           icon : Roo.rootURL + 'images/default/tree/leaf.gif',
195           text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
196           xns : Roo.Toolbar,
197           '|xns' : 'Roo.Toolbar',
198           xtype : 'Button',
199           listeners : {
200            click : function()
201             {
202                 var s = _this.grid.getSelectionModel().getSelections();
203                 if (!s.length || (s.length > 1))  {
204                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
205                     return;
206                 }
207                 if (!_this.dialog) return;
208                 _this.dialog.show(s[0].data, function() {
209                     _this.grid.footer.onClick('first');
210                 }); 
211                 
212             }
213           }
214          },
215          {
216           cls : 'x-btn-text-icon',
217           icon : rootURL + '/Pman/templates/images/trash.gif',
218           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
219           xns : Roo.Toolbar,
220           '|xns' : 'Roo.Toolbar',
221           xtype : 'Button',
222           listeners : {
223            click : function()
224             {
225                  Pman.genericDelete(_this, 'Companies'); 
226             }
227           }
228          }
229         ]
230        },
231        dataSource : {
232         remoteSort : true,
233         sortInfo : { field : 'name', direction: 'ASC' },
234         xns : Roo.data,
235         '|xns' : 'Roo.data',
236         xtype : 'Store',
237         listeners : {
238          beforeload : function (_self, o)
239           {
240              o.params = o.params || {};
241              try {
242                  o.params['query[name]'] = _this.searchBox.getValue();
243              } catch(e) { return false; }
244           },
245          load : function (_self, records, options)
246           {
247              try {
248                   Pman.Tab.AdminOffice.grid.footer.onClick('refresh');
249               } catch (e) {}
250           }
251         },
252         proxy : {
253          method : 'GET',
254          url : baseURL + '/Roo/Companies.php',
255          xns : Roo.data,
256          '|xns' : 'Roo.data',
257          xtype : 'HttpProxy',
258          listeners : {
259           load : function (This, o, arg)
260            {
261             
262            }
263          }
264         },
265         reader : {
266          fields : [
267              {
268                  'name': 'code',
269                  'type': 'string'
270              },
271              {
272                  'name': 'name',
273                  'type': 'string'
274              },
275              {
276                  'name': 'remarks',
277                  'type': 'string'
278              },
279              {
280                  'name': 'owner_id',
281                  'type': 'int'
282              },
283              {
284                  'name': 'address',
285                  'type': 'string'
286              },
287              {
288                  'name': 'tel',
289                  'type': 'string'
290              },
291              {
292                  'name': 'fax',
293                  'type': 'string'
294              },
295              {
296                  'name': 'email',
297                  'type': 'string'
298              },
299              {
300                  'name': 'id',
301                  'type': 'int'
302              },
303              {
304                  'name': 'isOwner',
305                  'type': 'int'
306              },
307              {
308                  'name': 'logo_id',
309                  'type': 'int'
310              },
311              {
312                  'name': 'background_color',
313                  'type': 'string'
314              },
315              {
316                  'name': 'comptype',
317                  'type': 'string'
318              },
319              {
320                  'name': 'url',
321                  'type': 'string'
322              },
323              {
324                  'name': 'main_office_id',
325                  'type': 'int'
326              },
327              {
328                  'name': 'created_by',
329                  'type': 'int'
330              },
331              {
332                  'name': 'created_dt',
333                  'type': 'date',
334                  'dateFormat': 'Y-m-d'
335              },
336              {
337                  'name': 'updated_by',
338                  'type': 'int'
339              },
340              {
341                  'name': 'updated_dt',
342                  'type': 'date',
343                  'dateFormat': 'Y-m-d'
344              },
345              {
346                  'name': 'passwd',
347                  'type': 'string'
348              },
349              {
350                  'name': 'dispatch_port',
351                  'type': 'string'
352              },
353              {
354                  'name': 'province',
355                  'type': 'string'
356              },
357              {
358                  'name': 'country',
359                  'type': 'string'
360              },
361              {
362                  'name': 'logo_id_id',
363                  'type': 'int'
364              },
365              {
366                  'name': 'logo_id_filename',
367                  'type': 'string'
368              },
369              {
370                  'name': 'logo_id_ontable',
371                  'type': 'string'
372              },
373              {
374                  'name': 'logo_id_onid',
375                  'type': 'int'
376              },
377              {
378                  'name': 'logo_id_mimetype',
379                  'type': 'string'
380              },
381              {
382                  'name': 'logo_id_width',
383                  'type': 'int'
384              },
385              {
386                  'name': 'logo_id_height',
387                  'type': 'int'
388              },
389              {
390                  'name': 'logo_id_filesize',
391                  'type': 'int'
392              },
393              {
394                  'name': 'logo_id_displayorder',
395                  'type': 'int'
396              },
397              {
398                  'name': 'logo_id_language',
399                  'type': 'string'
400              },
401              {
402                  'name': 'logo_id_parent_image_id',
403                  'type': 'int'
404              },
405              {
406                  'name': 'logo_id_created',
407                  'type': 'date'
408              },
409              {
410                  'name': 'logo_id_imgtype',
411                  'type': 'string'
412              },
413              {
414                  'name': 'logo_id_linkurl',
415                  'type': 'string'
416              },
417              {
418                  'name': 'logo_id_descript',
419                  'type': 'string'
420              },
421              {
422                  'name': 'logo_id_title',
423                  'type': 'string'
424              },
425              {
426                  'name': 'owner_id_id',
427                  'type': 'int'
428              },
429              {
430                  'name': 'owner_id_office_id',
431                  'type': 'int'
432              },
433              {
434                  'name': 'owner_id_name',
435                  'type': 'string'
436              },
437              {
438                  'name': 'owner_id_phone',
439                  'type': 'string'
440              },
441              {
442                  'name': 'owner_id_fax',
443                  'type': 'string'
444              },
445              {
446                  'name': 'owner_id_email',
447                  'type': 'string'
448              },
449              {
450                  'name': 'owner_id_company_id',
451                  'type': 'int'
452              },
453              {
454                  'name': 'owner_id_role',
455                  'type': 'string'
456              },
457              {
458                  'name': 'owner_id_active',
459                  'type': 'int'
460              },
461              {
462                  'name': 'owner_id_remarks',
463                  'type': 'string'
464              },
465              {
466                  'name': 'owner_id_passwd',
467                  'type': 'string'
468              },
469              {
470                  'name': 'owner_id_owner_id',
471                  'type': 'int'
472              },
473              {
474                  'name': 'owner_id_lang',
475                  'type': 'string'
476              },
477              {
478                  'name': 'owner_id_no_reset_sent',
479                  'type': 'int'
480              },
481              {
482                  'name': 'owner_id_action_type',
483                  'type': 'string'
484              },
485              {
486                  'name': 'owner_id_project_id',
487                  'type': 'int'
488              },
489              {
490                  'name': 'owner_id_deleted_by',
491                  'type': 'int'
492              },
493              {
494                  'name': 'owner_id_deleted_dt',
495                  'type': 'date'
496              },
497              {
498                  'name': 'main_office_id_id',
499                  'type': 'int'
500              },
501              {
502                  'name': 'main_office_id_company_id',
503                  'type': 'int'
504              },
505              {
506                  'name': 'main_office_id_name',
507                  'type': 'string'
508              },
509              {
510                  'name': 'main_office_id_address',
511                  'type': 'string'
512              },
513              {
514                  'name': 'main_office_id_phone',
515                  'type': 'string'
516              },
517              {
518                  'name': 'main_office_id_fax',
519                  'type': 'string'
520              },
521              {
522                  'name': 'main_office_id_email',
523                  'type': 'string'
524              },
525              {
526                  'name': 'main_office_id_role',
527                  'type': 'string'
528              }
529          ],
530          id : 'id',
531          root : 'data',
532          totalProperty : 'total',
533          xns : Roo.data,
534          '|xns' : 'Roo.data',
535          xtype : 'JsonReader'
536         }
537        },
538        colModel : [
539         {
540          dataIndex : 'comptype',
541          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
542          renderer : function (v,x ,r) {
543              //return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);
544              return v;
545          },
546          sortable : true,
547          width : 90,
548          xns : Roo.grid,
549          '|xns' : 'Roo.grid',
550          xtype : 'ColumnModel'
551         },
552         {
553          dataIndex : 'code',
554          header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
555          renderer : function(v) { return String.format('{0}', v); },
556          sortable : true,
557          width : 50,
558          xns : Roo.grid,
559          '|xns' : 'Roo.grid',
560          xtype : 'ColumnModel'
561         },
562         {
563          dataIndex : 'name',
564          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
565          renderer : function(v,x,r) {
566              return String.format(r.data.comptype == 'OWNER' ? '<B>{0}</B>' : '{0}',v);    
567          },
568          sortable : true,
569          width : 200,
570          xns : Roo.grid,
571          '|xns' : 'Roo.grid',
572          xtype : 'ColumnModel'
573         },
574         {
575          dataIndex : 'tel',
576          header : _this._strings['2e006b735fbd916d8ab26978ae6714d4'] /* Tel */,
577          renderer : function(v) { return String.format('{0}', v); },
578          width : 100,
579          xns : Roo.grid,
580          '|xns' : 'Roo.grid',
581          xtype : 'ColumnModel'
582         },
583         {
584          dataIndex : 'fax',
585          header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
586          renderer : function(v) { return String.format('{0}', v); },
587          width : 100,
588          xns : Roo.grid,
589          '|xns' : 'Roo.grid',
590          xtype : 'ColumnModel'
591         },
592         {
593          dataIndex : 'email',
594          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
595          renderer : function (v) {
596                  return (v.length && v.indexOf('@') > 0 ) ? 
597                      String.format('<a href="mailto:{0}">{0}</a>',v) : v;
598                      
599              },
600          sortable : true,
601          width : 100,
602          xns : Roo.grid,
603          '|xns' : 'Roo.grid',
604          xtype : 'ColumnModel'
605         },
606         {
607          dataIndex : 'address',
608          header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
609          renderer : function(v) { return String.format('{0}', v); },
610          sortable : true,
611          width : 200,
612          xns : Roo.grid,
613          '|xns' : 'Roo.grid',
614          xtype : 'ColumnModel'
615         },
616         {
617          dataIndex : 'remarks',
618          header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
619          renderer : function(v) { return String.format('{0}', v); },
620          width : 200,
621          xns : Roo.grid,
622          '|xns' : 'Roo.grid',
623          xtype : 'ColumnModel'
624         }
625        ]
626       }
627      }
628     ]
629    }
630   };  }
631 });