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