Pman.Tab.BAdminCompany.bjs
[Pman.BAdmin] / Pman.Tab.BAdminCompany.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.BAdminCompany = new Roo.XComponent({
8
9  _strings : {
10   'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
11   '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
12   'edefbda3a2bdd979e42d8944b7325b79' :"Companies",
13   'b80bb7740288fda1f201890375a60c8f' :"id",
14   'fc6f97505d89fe9277965c126744647a' :"No Companies found",
15   '694e249c3a9503141fa5ce3fb71d5477' :"<i class=\"fa fa-edit\"></i> Edit",
16   '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
17   'fd5293a712d172f5c556a83c62d44bd6' :"<i class=\"fa fa-plus\"></i> Add",
18   'ed807858fcb68abdd180481f1fcba5c5' :"<i class=\"fa fa-trash\"></i> Delete",
19   'f78e208016407d8756c29673558ac14d' :"Company List",
20   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
21   '9c9745a343efeacc9efe9b7222b27afb' :"Ref#",
22   '49ee3087348e8d44e1feda1917443987' :"Name",
23   '2e006b735fbd916d8ab26978ae6714d4' :"Tel",
24   'dd7bf230fde8d4836917806aff6a6b27' :"Address",
25   '9810aa2b9f44401be4bf73188ef2b67d' :"Fax"
26  },
27
28   part     :  ["BAdmin", "Company" ],
29   order    : '002-Pman.Tab.BAdminCompany',
30   region   : 'center',
31   parent   : 'Pman.Tab.BAdmin',
32   name     : "unnamed module",
33   disabled : false, 
34   permname : '', 
35   _tree : function(_data)
36   {
37    var _this = this;
38    var MODULE = this;
39    return {
40    xtype : 'Nest',
41    background : false,
42    region : 'center',
43    title : _this._strings['edefbda3a2bdd979e42d8944b7325b79'] /* Companies */,
44    xns : Roo.bootstrap.panel,
45    '|xns' : 'Roo.bootstrap.panel',
46    layout : {
47     xtype : 'Border',
48     xns : Roo.bootstrap.layout,
49     '|xns' : 'Roo.bootstrap.layout',
50     center : {
51      xtype : 'Region',
52      tabPosition : 'top',
53      xns : Roo.bootstrap.layout,
54      '|xns' : 'Roo.bootstrap.layout'
55     },
56     items  : [
57      {
58       xtype : 'Grid',
59       closable : false,
60       fitToFrame : true,
61       region : 'center',
62       title : _this._strings['f78e208016407d8756c29673558ac14d'] /* Company List */,
63       listeners : {
64        activate : function (_self)
65         {
66             _this.edit_btn.hide();
67             _this.delete_btn.hide();
68             
69             if (_this.table) {
70                 _this.table.footer.onClick('first');
71             }
72         },
73        render : function (_self)
74         {
75             _this.grid = _self;
76         }
77       },
78       xns : Roo.bootstrap.panel,
79       '|xns' : 'Roo.bootstrap.panel',
80       toolbar : {
81        xtype : 'NavSimplebar',
82        xns : Roo.bootstrap,
83        '|xns' : 'Roo.bootstrap',
84        items  : [
85         {
86          xtype : 'NavGroup',
87          xns : Roo.bootstrap,
88          '|xns' : 'Roo.bootstrap',
89          items  : [
90           {
91            xtype : 'Element',
92            xns : Roo.bootstrap,
93            '|xns' : 'Roo.bootstrap',
94            items  : [
95             {
96              xtype : 'Row',
97              cls : 'roo-toolbar',
98              xns : Roo.bootstrap,
99              '|xns' : 'Roo.bootstrap',
100              items  : [
101               {
102                xtype : 'Column',
103                md : 12,
104                xns : Roo.bootstrap,
105                '|xns' : 'Roo.bootstrap',
106                items  : [
107                 {
108                  xtype : 'Button',
109                  cls : 'roo-toolbar-button',
110                  html : _this._strings['fd5293a712d172f5c556a83c62d44bd6'] /* <i class="fa fa-plus"></i> Add */,
111                  weight : 'default',
112                  listeners : {
113                   click : function (_self, e)
114                    {
115                        Pman.Dialog.BAdminCompany.show({}, function() {
116                            if (_this.table) {
117                                _this.table.footer.onClick('first');
118                            }
119                        }); 
120                    }
121                  },
122                  xns : Roo.bootstrap,
123                  '|xns' : 'Roo.bootstrap'
124                 },
125                 {
126                  xtype : 'Button',
127                  cls : 'roo-toolbar-button',
128                  html : _this._strings['694e249c3a9503141fa5ce3fb71d5477'] /* <i class="fa fa-edit"></i> Edit */,
129                  weight : 'default',
130                  listeners : {
131                   click : function (_self, e)
132                    {
133                        var s = _this.table.getSelectionModel().getSelected();
134                            
135                        if (!s || s.data.id * 1 < 1)  {
136                            Roo.bootstrap.MessageBox.alert("Error", 'Please select a company');
137                            return;
138                        }
139                        
140                        Pman.Dialog.BAdminCompany.show({
141                            id : s.data.id
142                        }, function() {
143                            if (_this.table) {
144                                _this.table.footer.onClick('refresh');
145                            }
146                        });
147                        
148                        
149                    },
150                   render : function (_self)
151                    {
152                        _this.edit_btn = this;
153                        
154                        this.hide();
155                    }
156                  },
157                  xns : Roo.bootstrap,
158                  '|xns' : 'Roo.bootstrap'
159                 },
160                 {
161                  xtype : 'Button',
162                  cls : 'roo-toolbar-button',
163                  html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
164                  weight : 'primary',
165                  listeners : {
166                   click : function (_self, e)
167                    {
168                        Pman.genericDelete(_this.grid, 'core_company'); 
169                    },
170                   render : function (_self)
171                    {
172                        _this.delete_btn = this;
173                        
174                        this.hide();
175                    }
176                  },
177                  xns : Roo.bootstrap,
178                  '|xns' : 'Roo.bootstrap'
179                 }
180                ]
181               }
182              ]
183             }
184            ]
185           }
186          ]
187         }
188        ]
189       },
190       grid : {
191        xtype : 'Table',
192        cls : 'table-fixed',
193        hover : true,
194        loadMask : true,
195        responsive : true,
196        rowSelection : true,
197        striped : false,
198        listeners : {
199         render : function (_self)
200          {
201              _this.table = this;
202          },
203         rowclick : function (_self, el, rowIndex, e)
204          {
205              (function(){
206                  
207                  _this.edit_btn.hide();
208                  _this.delete_btn.hide();
209                  
210                  var s = _this.table.getSelectionModel().getSelected();
211                  
212                  if (!s || s.data.id * 1 < 1)  {
213                      return;
214                  }
215                  
216                  _this.edit_btn.show();
217                  _this.delete_btn.show();
218                  
219              }).defer(100);
220              
221          },
222         rowdblclick : function (_self, el, rowIndex, e)
223          {
224              var s = _this.table.store.getAt(rowIndex);
225              
226              if(!s || s.data.id * 1 < 1){
227                  return;
228              }
229              
230              Pman.Dialog.BAdminCompany.show({
231                  id : s.data.id
232              }, function() {
233                  if (_this.table) {
234                      _this.table.footer.onClick('refresh');
235                  }
236              });
237          }
238        },
239        xns : Roo.bootstrap,
240        '|xns' : 'Roo.bootstrap',
241        footer : {
242         xtype : 'PagingToolbar',
243         displayInfo : false,
244         displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
245         emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
246         name : 'footer',
247         pageSize : 25,
248         listeners : {
249          render : function (_self)
250           {
251               _this.footer = _self;
252           }
253         },
254         xns : Roo.bootstrap,
255         '|xns' : 'Roo.bootstrap'
256        },
257        store : {
258         xtype : 'Store',
259         hover : true,
260         loadMask : true,
261         rowSelection : true,
262         striped : true,
263         listeners : {
264          beforeload : function (_self, options)
265           {
266               options.params = options.params || {};
267           },
268          load : function (_self, records, options)
269           {
270               _this.delete_btn.hide();
271               _this.edit_btn.hide();
272           }
273         },
274         xns : Roo.data,
275         '|xns' : 'Roo.data',
276         proxy : {
277          xtype : 'HttpProxy',
278          method : 'GET',
279          url : baseURL + '/Roo/core_company',
280          listeners : {
281           load : function (This, o, arg)
282            {
283                _this.table.footer.onClick('first');
284            }
285          },
286          xns : Roo.data,
287          '|xns' : 'Roo.data'
288         },
289         reader : {
290          xtype : 'JsonReader',
291          id : 'id',
292          root : 'data',
293          totalProperty : 'total',
294          xns : Roo.data,
295          '|xns' : 'Roo.data'
296         }
297        },
298        sm : {
299         xtype : 'RowSelectionModel',
300         singleSelect : true,
301         xns : Roo.bootstrap.Table,
302         '|xns' : 'Roo.bootstrap.Table'
303        },
304        cm : [
305         {
306          xtype : 'ColumnModel',
307          cursor : 'pointer',
308          dataIndex : 'comptype',
309          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
310          md : 1,
311          renderer : function (v,x ,r) {
312              //return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);
313              return v;
314          },
315          sm : 1,
316          sortable : true,
317          xs : 1,
318          xns : Roo.grid,
319          '|xns' : 'Roo.grid'
320         },
321         {
322          xtype : 'ColumnModel',
323          cursor : 'pointer',
324          dataIndex : 'code',
325          header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
326          hidden : true,
327          renderer : function(v) { return String.format('{0}', v); },
328          sortable : true,
329          xns : Roo.grid,
330          '|xns' : 'Roo.grid'
331         },
332         {
333          xtype : 'ColumnModel',
334          cursor : 'pointer',
335          dataIndex : 'name',
336          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
337          md : 2,
338          renderer : function(v,x,r) {
339              return String.format(r.data.comptype == 'OWNER' ? '<B>{0}</B>' : '{0}',v);    
340          },
341          sm : 2,
342          sortable : true,
343          xs : 2,
344          xns : Roo.grid,
345          '|xns' : 'Roo.grid'
346         },
347         {
348          xtype : 'ColumnModel',
349          cursor : 'pointer',
350          dataIndex : 'tel',
351          header : _this._strings['2e006b735fbd916d8ab26978ae6714d4'] /* Tel */,
352          md : 1,
353          renderer : function(v) { return String.format('{0}', v); },
354          sm : 1,
355          xs : 1,
356          xns : Roo.grid,
357          '|xns' : 'Roo.grid'
358         },
359         {
360          xtype : 'ColumnModel',
361          cursor : 'pointer',
362          dataIndex : 'fax',
363          header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
364          md : 1,
365          renderer : function(v) { return String.format('{0}', v); },
366          sm : 1,
367          xs : 1,
368          xns : Roo.grid,
369          '|xns' : 'Roo.grid'
370         },
371         {
372          xtype : 'ColumnModel',
373          cursor : 'pointer',
374          dataIndex : 'email',
375          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
376          md : 2,
377          renderer : function (v) {
378                  return (v.length && v.indexOf('@') > 0 ) ? 
379                      String.format('<a href="mailto:{0}">{0}</a>',v) : v;
380                      
381              },
382          sm : 2,
383          sortable : true,
384          xs : 2,
385          xns : Roo.grid,
386          '|xns' : 'Roo.grid'
387         },
388         {
389          xtype : 'ColumnModel',
390          cursor : 'pointer',
391          dataIndex : 'address',
392          header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
393          md : 5,
394          renderer : function(v) { return String.format('{0}', v); },
395          sm : 5,
396          sortable : true,
397          xs : 5,
398          xns : Roo.grid,
399          '|xns' : 'Roo.grid'
400         },
401         {
402          xtype : 'ColumnModel',
403          cursor : 'pointer',
404          dataIndex : 'remarks',
405          header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
406          hidden : true,
407          renderer : function(v) { return String.format('{0}', v); },
408          width : 200,
409          xns : Roo.grid,
410          '|xns' : 'Roo.grid'
411         },
412         {
413          xtype : 'ColumnModel',
414          cursor : 'pointer',
415          dataIndex : 'id',
416          header : _this._strings['b80bb7740288fda1f201890375a60c8f'] /* id */,
417          hidden : true,
418          renderer : function(v) { return String.format('{0}', v); },
419          sortable : true,
420          width : 50,
421          xns : Roo.grid,
422          '|xns' : 'Roo.grid'
423         }
424        ]
425       }
426      }
427     ]
428    }
429   };  }
430 });