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