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                 if (!s.length || (s.length > 1))  {
188                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
189                     return;
190                 }
191                 
192                 _this.dialog.show(s[0].data, function() {
193                     _this.grid.footer.onClick('first');
194                 }); 
195                 
196             }
197           },
198           xns : Roo.Toolbar,
199           '|xns' : 'Roo.Toolbar'
200          },
201          {
202           xtype : 'Separator',
203           xns : Roo.Toolbar,
204           '|xns' : 'Roo.Toolbar'
205          },
206          {
207           xtype : 'Button',
208           cls : 'x-btn-text-icon',
209           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
210           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
211           listeners : {
212            click : function()
213             {
214                 if (!_this.dialog) {
215                     return;
216                     }
217                 _this.dialog.show( { id : 0 } , function() {
218                     _this.grid.footer.onClick('first');
219                }); 
220             }
221           },
222           xns : Roo.Toolbar,
223           '|xns' : 'Roo.Toolbar'
224          },
225          {
226           xtype : 'Button',
227           cls : 'x-btn-text-icon',
228           icon : Roo.rootURL + 'images/default/tree/leaf.gif',
229           text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
230           listeners : {
231            click : function()
232             {
233                 var s = _this.grid.getSelectionModel().getSelections();
234                 if (!s.length || (s.length > 1))  {
235                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
236                     return;
237                 }
238                 if (!_this.dialog) {
239                     return;
240                 }
241                 _this.dialog.show(s[0].data, function() {
242                     _this.grid.footer.onClick('first');
243                 }); 
244                 
245             }
246           },
247           xns : Roo.Toolbar,
248           '|xns' : 'Roo.Toolbar'
249          },
250          {
251           xtype : 'Button',
252           cls : 'x-btn-text-icon',
253           icon : rootURL + '/Pman/templates/images/trash.gif',
254           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
255           listeners : {
256            click : function()
257             {
258                  Pman.genericDelete(_this, 'Companies'); 
259             }
260           },
261           xns : Roo.Toolbar,
262           '|xns' : 'Roo.Toolbar'
263          }
264         ]
265        },
266        dataSource : {
267         xtype : 'Store',
268         remoteSort : true,
269         sortInfo : { field : 'name', direction: 'ASC' },
270         listeners : {
271          beforeload : function (_self, o)
272           {
273              o.params = o.params || {};
274              try {
275                  o.params['query[name]'] = _this.searchBox.getValue();
276              } catch(e) { return false; }
277           },
278          load : function (_self, records, options)
279           {
280              try {
281                   Pman.Tab.AdminOffice.grid.footer.onClick('refresh');
282               } catch (e) {}
283           }
284         },
285         xns : Roo.data,
286         '|xns' : 'Roo.data',
287         proxy : {
288          xtype : 'HttpProxy',
289          method : 'GET',
290          url : baseURL + '/Roo/Companies.php',
291          listeners : {
292           load : function (This, o, arg)
293            {
294             
295            }
296          },
297          xns : Roo.data,
298          '|xns' : 'Roo.data'
299         },
300         reader : {
301          xtype : 'JsonReader',
302          fields : [
303              {
304                  'name': 'code',
305                  'type': 'string'
306              },
307              {
308                  'name': 'name',
309                  'type': 'string'
310              },
311              {
312                  'name': 'remarks',
313                  'type': 'string'
314              },
315              {
316                  'name': 'owner_id',
317                  'type': 'int'
318              },
319              {
320                  'name': 'address',
321                  'type': 'string'
322              },
323              {
324                  'name': 'tel',
325                  'type': 'string'
326              },
327              {
328                  'name': 'fax',
329                  'type': 'string'
330              },
331              {
332                  'name': 'email',
333                  'type': 'string'
334              },
335              {
336                  'name': 'id',
337                  'type': 'int'
338              },
339              {
340                  'name': 'isOwner',
341                  'type': 'int'
342              },
343              {
344                  'name': 'logo_id',
345                  'type': 'int'
346              },
347              {
348                  'name': 'background_color',
349                  'type': 'string'
350              },
351              {
352                  'name': 'comptype',
353                  'type': 'string'
354              },
355              {
356                  'name': 'url',
357                  'type': 'string'
358              },
359              {
360                  'name': 'main_office_id',
361                  'type': 'int'
362              },
363              {
364                  'name': 'created_by',
365                  'type': 'int'
366              },
367              {
368                  'name': 'created_dt',
369                  'type': 'date',
370                  'dateFormat': 'Y-m-d'
371              },
372              {
373                  'name': 'updated_by',
374                  'type': 'int'
375              },
376              {
377                  'name': 'updated_dt',
378                  'type': 'date',
379                  'dateFormat': 'Y-m-d'
380              },
381              {
382                  'name': 'passwd',
383                  'type': 'string'
384              },
385              {
386                  'name': 'dispatch_port',
387                  'type': 'string'
388              },
389              {
390                  'name': 'province',
391                  'type': 'string'
392              },
393              {
394                  'name': 'country',
395                  'type': 'string'
396              },
397              {
398                  'name': 'logo_id_id',
399                  'type': 'int'
400              },
401              {
402                  'name': 'logo_id_filename',
403                  'type': 'string'
404              },
405              {
406                  'name': 'logo_id_ontable',
407                  'type': 'string'
408              },
409              {
410                  'name': 'logo_id_onid',
411                  'type': 'int'
412              },
413              {
414                  'name': 'logo_id_mimetype',
415                  'type': 'string'
416              },
417              {
418                  'name': 'logo_id_width',
419                  'type': 'int'
420              },
421              {
422                  'name': 'logo_id_height',
423                  'type': 'int'
424              },
425              {
426                  'name': 'logo_id_filesize',
427                  'type': 'int'
428              },
429              {
430                  'name': 'logo_id_displayorder',
431                  'type': 'int'
432              },
433              {
434                  'name': 'logo_id_language',
435                  'type': 'string'
436              },
437              {
438                  'name': 'logo_id_parent_image_id',
439                  'type': 'int'
440              },
441              {
442                  'name': 'logo_id_created',
443                  'type': 'date'
444              },
445              {
446                  'name': 'logo_id_imgtype',
447                  'type': 'string'
448              },
449              {
450                  'name': 'logo_id_linkurl',
451                  'type': 'string'
452              },
453              {
454                  'name': 'logo_id_descript',
455                  'type': 'string'
456              },
457              {
458                  'name': 'logo_id_title',
459                  'type': 'string'
460              },
461              {
462                  'name': 'owner_id_id',
463                  'type': 'int'
464              },
465              {
466                  'name': 'owner_id_office_id',
467                  'type': 'int'
468              },
469              {
470                  'name': 'owner_id_name',
471                  'type': 'string'
472              },
473              {
474                  'name': 'owner_id_phone',
475                  'type': 'string'
476              },
477              {
478                  'name': 'owner_id_fax',
479                  'type': 'string'
480              },
481              {
482                  'name': 'owner_id_email',
483                  'type': 'string'
484              },
485              {
486                  'name': 'owner_id_company_id',
487                  'type': 'int'
488              },
489              {
490                  'name': 'owner_id_role',
491                  'type': 'string'
492              },
493              {
494                  'name': 'owner_id_active',
495                  'type': 'int'
496              },
497              {
498                  'name': 'owner_id_remarks',
499                  'type': 'string'
500              },
501              {
502                  'name': 'owner_id_passwd',
503                  'type': 'string'
504              },
505              {
506                  'name': 'owner_id_owner_id',
507                  'type': 'int'
508              },
509              {
510                  'name': 'owner_id_lang',
511                  'type': 'string'
512              },
513              {
514                  'name': 'owner_id_no_reset_sent',
515                  'type': 'int'
516              },
517              {
518                  'name': 'owner_id_action_type',
519                  'type': 'string'
520              },
521              {
522                  'name': 'owner_id_project_id',
523                  'type': 'int'
524              },
525              {
526                  'name': 'owner_id_deleted_by',
527                  'type': 'int'
528              },
529              {
530                  'name': 'owner_id_deleted_dt',
531                  'type': 'date'
532              },
533              {
534                  'name': 'main_office_id_id',
535                  'type': 'int'
536              },
537              {
538                  'name': 'main_office_id_company_id',
539                  'type': 'int'
540              },
541              {
542                  'name': 'main_office_id_name',
543                  'type': 'string'
544              },
545              {
546                  'name': 'main_office_id_address',
547                  'type': 'string'
548              },
549              {
550                  'name': 'main_office_id_phone',
551                  'type': 'string'
552              },
553              {
554                  'name': 'main_office_id_fax',
555                  'type': 'string'
556              },
557              {
558                  'name': 'main_office_id_email',
559                  'type': 'string'
560              },
561              {
562                  'name': 'main_office_id_role',
563                  'type': 'string'
564              }
565          ],
566          id : 'id',
567          root : 'data',
568          totalProperty : 'total',
569          xns : Roo.data,
570          '|xns' : 'Roo.data'
571         }
572        },
573        colModel : [
574         {
575          xtype : 'ColumnModel',
576          dataIndex : 'comptype',
577          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
578          renderer : function (v,x ,r) {
579              //return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);
580              return v;
581          },
582          sortable : true,
583          width : 90,
584          xns : Roo.grid,
585          '|xns' : 'Roo.grid'
586         },
587         {
588          xtype : 'ColumnModel',
589          dataIndex : 'code',
590          header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
591          renderer : function(v) { return String.format('{0}', v); },
592          sortable : true,
593          width : 50,
594          xns : Roo.grid,
595          '|xns' : 'Roo.grid'
596         },
597         {
598          xtype : 'ColumnModel',
599          dataIndex : 'name',
600          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
601          renderer : function(v,x,r) {
602              return String.format(r.data.comptype == 'OWNER' ? '<B>{0}</B>' : '{0}',v);    
603          },
604          sortable : true,
605          width : 200,
606          xns : Roo.grid,
607          '|xns' : 'Roo.grid'
608         },
609         {
610          xtype : 'ColumnModel',
611          dataIndex : 'tel',
612          header : _this._strings['2e006b735fbd916d8ab26978ae6714d4'] /* Tel */,
613          renderer : function(v) { return String.format('{0}', v); },
614          width : 100,
615          xns : Roo.grid,
616          '|xns' : 'Roo.grid'
617         },
618         {
619          xtype : 'ColumnModel',
620          dataIndex : 'fax',
621          header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
622          renderer : function(v) { return String.format('{0}', v); },
623          width : 100,
624          xns : Roo.grid,
625          '|xns' : 'Roo.grid'
626         },
627         {
628          xtype : 'ColumnModel',
629          dataIndex : 'email',
630          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
631          renderer : function (v) {
632                  return (v.length && v.indexOf('@') > 0 ) ? 
633                      String.format('<a href="mailto:{0}">{0}</a>',v) : v;
634                      
635              },
636          sortable : true,
637          width : 100,
638          xns : Roo.grid,
639          '|xns' : 'Roo.grid'
640         },
641         {
642          xtype : 'ColumnModel',
643          dataIndex : 'address',
644          header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
645          renderer : function(v) { return String.format('{0}', v); },
646          sortable : true,
647          width : 200,
648          xns : Roo.grid,
649          '|xns' : 'Roo.grid'
650         },
651         {
652          xtype : 'ColumnModel',
653          dataIndex : 'remarks',
654          header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
655          renderer : function(v) { return String.format('{0}', v); },
656          width : 200,
657          xns : Roo.grid,
658          '|xns' : 'Roo.grid'
659         }
660        ]
661       }
662      }
663     ]
664    }
665   };  }
666 });