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