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 = _self;
185          },
186         rowdblclick : function (_self, el, rowIndex, e)
187          {
188              if (!_this.dialog) {
189                  return;
190              }
191              _this.dialog.show(_this.grid.grid.store.getAt(rowIndex).data, function() {
192                  if (_this.table) {
193                      _this.table.footer.onClick('first');
194                  }
195              });
196          }
197        },
198        xns : Roo.bootstrap,
199        '|xns' : 'Roo.bootstrap',
200        footer : {
201         xtype : 'PagingToolbar',
202         displayInfo : false,
203         displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
204         emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
205         name : 'footer',
206         pageSize : 25,
207         listeners : {
208          render : function (_self)
209           {
210               _this.footer = _self;
211           }
212         },
213         xns : Roo.bootstrap,
214         '|xns' : 'Roo.bootstrap'
215        },
216        store : {
217         xtype : 'Store',
218         hover : true,
219         loadMask : true,
220         rowSelection : true,
221         striped : true,
222         xns : Roo.data,
223         '|xns' : 'Roo.data',
224         proxy : {
225          xtype : 'HttpProxy',
226          method : 'GET',
227          url : baseURL + '/Roo/core_company',
228          listeners : {
229           load : function (This, o, arg)
230            {
231                _this.table.footer.onClick('first');
232            }
233          },
234          xns : Roo.data,
235          '|xns' : 'Roo.data'
236         },
237         reader : {
238          xtype : 'JsonReader',
239          id : 'id',
240          root : 'data',
241          totalProperty : 'total',
242          xns : Roo.data,
243          '|xns' : 'Roo.data'
244         }
245        },
246        cm : [
247         {
248          xtype : 'ColumnModel',
249          cursor : 'pointer',
250          dataIndex : 'comptype',
251          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
252          md : 1,
253          renderer : function (v,x ,r) {
254              //return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);
255              return v;
256          },
257          sm : 1,
258          sortable : true,
259          xs : 1,
260          xns : Roo.grid,
261          '|xns' : 'Roo.grid'
262         },
263         {
264          xtype : 'ColumnModel',
265          cursor : 'pointer',
266          dataIndex : 'code',
267          header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
268          hidden : true,
269          renderer : function(v) { return String.format('{0}', v); },
270          sortable : true,
271          xns : Roo.grid,
272          '|xns' : 'Roo.grid'
273         },
274         {
275          xtype : 'ColumnModel',
276          cursor : 'pointer',
277          dataIndex : 'name',
278          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
279          md : 2,
280          renderer : function(v,x,r) {
281              return String.format(r.data.comptype == 'OWNER' ? '<B>{0}</B>' : '{0}',v);    
282          },
283          sm : 2,
284          sortable : true,
285          xs : 2,
286          xns : Roo.grid,
287          '|xns' : 'Roo.grid'
288         },
289         {
290          xtype : 'ColumnModel',
291          cursor : 'pointer',
292          dataIndex : 'tel',
293          header : _this._strings['2e006b735fbd916d8ab26978ae6714d4'] /* Tel */,
294          md : 1,
295          renderer : function(v) { return String.format('{0}', v); },
296          sm : 1,
297          xs : 1,
298          xns : Roo.grid,
299          '|xns' : 'Roo.grid'
300         },
301         {
302          xtype : 'ColumnModel',
303          cursor : 'pointer',
304          dataIndex : 'fax',
305          header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
306          md : 1,
307          renderer : function(v) { return String.format('{0}', v); },
308          sm : 1,
309          xs : 1,
310          xns : Roo.grid,
311          '|xns' : 'Roo.grid'
312         },
313         {
314          xtype : 'ColumnModel',
315          cursor : 'pointer',
316          dataIndex : 'email',
317          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
318          md : 2,
319          renderer : function (v) {
320                  return (v.length && v.indexOf('@') > 0 ) ? 
321                      String.format('<a href="mailto:{0}">{0}</a>',v) : v;
322                      
323              },
324          sm : 2,
325          sortable : true,
326          xs : 2,
327          xns : Roo.grid,
328          '|xns' : 'Roo.grid'
329         },
330         {
331          xtype : 'ColumnModel',
332          cursor : 'pointer',
333          dataIndex : 'address',
334          header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
335          md : 5,
336          renderer : function(v) { return String.format('{0}', v); },
337          sm : 5,
338          sortable : true,
339          xs : 5,
340          xns : Roo.grid,
341          '|xns' : 'Roo.grid'
342         },
343         {
344          xtype : 'ColumnModel',
345          cursor : 'pointer',
346          dataIndex : 'remarks',
347          header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
348          hidden : true,
349          renderer : function(v) { return String.format('{0}', v); },
350          width : 200,
351          xns : Roo.grid,
352          '|xns' : 'Roo.grid'
353         },
354         {
355          xtype : 'ColumnModel',
356          cursor : 'pointer',
357          dataIndex : 'id',
358          header : _this._strings['b80bb7740288fda1f201890375a60c8f'] /* id */,
359          hidden : true,
360          renderer : function(v) { return String.format('{0}', v); },
361          sortable : true,
362          width : 50,
363          xns : Roo.grid,
364          '|xns' : 'Roo.grid'
365         }
366        ]
367       }
368      }
369     ]
370    }
371   };  }
372 });