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