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