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