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