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   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
13   'edefbda3a2bdd979e42d8944b7325b79' :"Companies",
14   'b80bb7740288fda1f201890375a60c8f' :"id",
15   '7dce122004969d56ae2e0245cb754d35' :"Edit",
16   'fc6f97505d89fe9277965c126744647a' :"No Companies found",
17   '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
18   'f78e208016407d8756c29673558ac14d' :"Company List",
19   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
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',
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    region : 'center',
42    title : _this._strings['edefbda3a2bdd979e42d8944b7325b79'] /* Companies */,
43    xns : Roo.bootstrap.panel,
44    '|xns' : 'Roo.bootstrap.panel',
45    layout : {
46     xtype : 'Border',
47     xns : Roo.bootstrap.layout,
48     '|xns' : 'Roo.bootstrap.layout',
49     center : {
50      xtype : 'Region',
51      xns : Roo.bootstrap.layout,
52      '|xns' : 'Roo.bootstrap.layout'
53     },
54     items  : [
55      {
56       xtype : 'Grid',
57       closable : false,
58       fitToFrame : true,
59       region : 'center',
60       title : _this._strings['f78e208016407d8756c29673558ac14d'] /* Company List */,
61       listeners : {
62        activate : function (_self)
63         {
64          
65             if (_this.table) {
66               _this.table.store.load({});
67               _this.dialog = Pman.Dialog.BAdminCompany;
68               }
69         },
70        render : function (_self)
71         {
72             _this.grid = _self;
73         }
74       },
75       xns : Roo.bootstrap.panel,
76       '|xns' : 'Roo.bootstrap.panel',
77       toolbar : {
78        xtype : 'NavSimplebar',
79        xns : Roo.bootstrap,
80        '|xns' : 'Roo.bootstrap',
81        items  : [
82         {
83          xtype : 'NavGroup',
84          xns : Roo.bootstrap,
85          '|xns' : 'Roo.bootstrap',
86          items  : [
87           {
88            xtype : 'NavItem',
89            style : 'float: left',
90            xns : Roo.bootstrap,
91            '|xns' : 'Roo.bootstrap',
92            items  : [
93             {
94              xtype : 'Button',
95              html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
96              style : 'margin: 10px;',
97              weight : 'primary',
98              listeners : {
99               click : function (_self, e)
100                {
101                    if (!_this.dialog) {
102                        return;
103                        }
104                
105                    _this.dialog.show({}, function() {
106                        if (_this.table) {
107                            _this.table.store.load({});
108                        }
109                    }); 
110                    _this.dialog.modal.setTitle('Add Company');
111                    _this.dialog.form.reset();
112                
113                }
114              },
115              xns : Roo.bootstrap,
116              '|xns' : 'Roo.bootstrap'
117             },
118             {
119              xtype : 'Button',
120              html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
121              style : 'margin: 10px;',
122              weight : 'primary',
123              listeners : {
124               click : function (_self, e)
125                {
126                    var s = _this.grid.grid.selModel.getSelections();
127                    if (!s.length || (s.length > 1))  {
128                        Roo.bootstrap.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
129                        return;
130                    }
131                    if (!_this.dialog) {
132                        return;
133                    }
134                    _this.dialog.show(s[0].data, function() {
135                        if (_this.table) {
136                            _this.table.store.load({});
137                        }
138                    }); 
139                    
140                }
141              },
142              xns : Roo.bootstrap,
143              '|xns' : 'Roo.bootstrap'
144             },
145             {
146              xtype : 'Button',
147              html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
148              style : 'margin: 10px;',
149              weight : 'primary',
150              listeners : {
151               click : function (_self, e)
152                {
153                      Pman.genericDelete(_this.grid, 'core_company'); 
154                }
155              },
156              xns : Roo.bootstrap,
157              '|xns' : 'Roo.bootstrap'
158             }
159            ]
160           }
161          ]
162         }
163        ]
164       },
165       grid : {
166        xtype : 'Table',
167        cls : 'table-fixed',
168        hover : true,
169        loadMask : true,
170        responsive : true,
171        rowSelection : true,
172        striped : false,
173        listeners : {
174         render : function (_self)
175          {
176            _this.table = _self;
177            
178            
179            if(_this.table.active) {
180              this.footer.onClick('first');
181            }
182          },
183         rowdblclick : function (_self, el, rowIndex, e)
184          {
185              var s = _this.grid.grid.selModel.getSelections();
186              if (!s.length || (s.length > 1))  {
187                  Roo.bootstrap.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
188                  return;
189              }
190              if (!_this.dialog) {
191                  return;
192              }
193              _this.dialog.show(s[0].data, function() {
194                  if (_this.table) {
195                      _this.table.store.load({});
196                  }
197              });  
198          }
199        },
200        xns : Roo.bootstrap,
201        '|xns' : 'Roo.bootstrap',
202        footer : {
203         xtype : 'PagingToolbar',
204         displayInfo : true,
205         displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
206         emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
207         name : 'footer',
208         pageSize : 25,
209         listeners : {
210          render : function (_self)
211           {
212               _this.footer = _self;
213           }
214         },
215         xns : Roo.bootstrap,
216         '|xns' : 'Roo.bootstrap'
217        },
218        store : {
219         xtype : 'Store',
220         hover : true,
221         loadMask : true,
222         rowSelection : true,
223         striped : true,
224         listeners : {
225          rowclick : function (_self, el, rowIndex, e)
226           {
227               alert('hit');
228               rowElId = el.id;
229               //var rowId = document.getElementById(rowElId).childNodes[0].innerHTML;
230               var rowType = document.getElementById(rowElId).childNodes[1].innerHTML;
231               var rowRef = document.getElementById(rowElId).childNodes[2].innerHTML;
232               var rowName = document.getElementById(rowElId).childNodes[3].innerHTML;
233               //var rowTel = document.getElementById(rowElId).childNodes[4].innerHTML;
234               //var rowFax = document.getElementById(rowElId).childNodes[5].innerHTML;
235               Pman.Dialog.CompanyModify.show({});
236               
237           }
238         },
239         xns : Roo.data,
240         '|xns' : 'Roo.data',
241         proxy : {
242          xtype : 'HttpProxy',
243          method : 'GET',
244          url : baseURL + '/Roo/core_company',
245          listeners : {
246           load : function (This, o, arg)
247            {
248                _this.table.footer.onClick('first');
249            }
250          },
251          xns : Roo.data,
252          '|xns' : 'Roo.data'
253         },
254         reader : {
255          xtype : 'JsonReader',
256          id : 'id',
257          root : 'data',
258          totalProperty : 'total',
259          xns : Roo.data,
260          '|xns' : 'Roo.data'
261         }
262        },
263        cm : [
264         {
265          xtype : 'ColumnModel',
266          dataIndex : 'comptype',
267          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
268          renderer : function (v,x ,r) {
269              //return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);
270              return v;
271          },
272          sortable : true,
273          width : 90,
274          xns : Roo.grid,
275          '|xns' : 'Roo.grid'
276         },
277         {
278          xtype : 'ColumnModel',
279          dataIndex : 'code',
280          header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
281          renderer : function(v) { return String.format('{0}', v); },
282          sortable : true,
283          width : 50,
284          xns : Roo.grid,
285          '|xns' : 'Roo.grid'
286         },
287         {
288          xtype : 'ColumnModel',
289          dataIndex : 'name',
290          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
291          renderer : function(v,x,r) {
292              return String.format(r.data.comptype == 'OWNER' ? '<B>{0}</B>' : '{0}',v);    
293          },
294          sortable : true,
295          width : 200,
296          xns : Roo.grid,
297          '|xns' : 'Roo.grid'
298         },
299         {
300          xtype : 'ColumnModel',
301          dataIndex : 'tel',
302          header : _this._strings['2e006b735fbd916d8ab26978ae6714d4'] /* Tel */,
303          renderer : function(v) { return String.format('{0}', v); },
304          width : 100,
305          xns : Roo.grid,
306          '|xns' : 'Roo.grid'
307         },
308         {
309          xtype : 'ColumnModel',
310          dataIndex : 'fax',
311          header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
312          renderer : function(v) { return String.format('{0}', v); },
313          width : 100,
314          xns : Roo.grid,
315          '|xns' : 'Roo.grid'
316         },
317         {
318          xtype : 'ColumnModel',
319          dataIndex : 'email',
320          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
321          renderer : function (v) {
322                  console.log('render:' + v);
323                  return (v.length && v.indexOf('@') > 0 ) ? 
324                      String.format('<a href="mailto:{0}">{0}</a>',v) : v;
325                      
326              },
327          sortable : true,
328          width : 200,
329          xns : Roo.grid,
330          '|xns' : 'Roo.grid'
331         },
332         {
333          xtype : 'ColumnModel',
334          dataIndex : 'address',
335          header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
336          renderer : function(v) { return String.format('{0}', v); },
337          sortable : true,
338          width : 250,
339          xns : Roo.grid,
340          '|xns' : 'Roo.grid'
341         },
342         {
343          xtype : 'ColumnModel',
344          dataIndex : 'remarks',
345          header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
346          hidden : true,
347          renderer : function(v) { return String.format('{0}', v); },
348          width : 200,
349          xns : Roo.grid,
350          '|xns' : 'Roo.grid'
351         },
352         {
353          xtype : 'ColumnModel',
354          dataIndex : 'id',
355          header : _this._strings['b80bb7740288fda1f201890375a60c8f'] /* id */,
356          hidden : true,
357          renderer : function(v) { return String.format('{0}', v); },
358          sortable : true,
359          width : 50,
360          xns : Roo.grid,
361          '|xns' : 'Roo.grid'
362         }
363        ]
364       }
365      }
366     ]
367    }
368   };  }
369 });