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