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         rowdblclick : function (_self, el, rowIndex, e)
181          {
182              rowElId = el.id;
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        },
221        xns : Roo.bootstrap,
222        '|xns' : 'Roo.bootstrap',
223        footer : {
224         xtype : 'PagingToolbar',
225         displayInfo : true,
226         displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
227         emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
228         name : 'footer',
229         pageSize : 25,
230         listeners : {
231          render : function (_self)
232           {
233               _this.footer = _self;
234           }
235         },
236         xns : Roo.bootstrap,
237         '|xns' : 'Roo.bootstrap'
238        },
239        store : {
240         xtype : 'Store',
241         hover : true,
242         loadMask : true,
243         rowSelection : true,
244         striped : true,
245         listeners : {
246          rowclick : function (_self, el, rowIndex, e)
247           {
248               alert('hit');
249               rowElId = el.id;
250               //var rowId = document.getElementById(rowElId).childNodes[0].innerHTML;
251               var rowType = document.getElementById(rowElId).childNodes[1].innerHTML;
252               var rowRef = document.getElementById(rowElId).childNodes[2].innerHTML;
253               var rowName = document.getElementById(rowElId).childNodes[3].innerHTML;
254               //var rowTel = document.getElementById(rowElId).childNodes[4].innerHTML;
255               //var rowFax = document.getElementById(rowElId).childNodes[5].innerHTML;
256               Pman.Dialog.CompanyModify.show({});
257               
258           }
259         },
260         xns : Roo.data,
261         '|xns' : 'Roo.data',
262         proxy : {
263          xtype : 'HttpProxy',
264          method : 'GET',
265          url : baseURL + '/Roo/core_company',
266          listeners : {
267           load : function (This, o, arg)
268            {
269                _this.table.footer.onClick('first');
270            }
271          },
272          xns : Roo.data,
273          '|xns' : 'Roo.data'
274         },
275         reader : {
276          xtype : 'JsonReader',
277          id : 'id',
278          root : 'data',
279          totalProperty : 'total',
280          xns : Roo.data,
281          '|xns' : 'Roo.data'
282         }
283        },
284        cm : [
285         {
286          xtype : 'ColumnModel',
287          dataIndex : 'comptype',
288          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
289          sortable : true,
290          width : 90,
291          XXXX : '',
292          xns : Roo.grid,
293          '|xns' : 'Roo.grid'
294         },
295         {
296          xtype : 'ColumnModel',
297          dataIndex : 'code',
298          header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
299          renderer : 'function(v) { return String.format(\'{0}\', v); }',
300          sortable : true,
301          width : 50,
302          xns : Roo.grid,
303          '|xns' : 'Roo.grid'
304         },
305         {
306          xtype : 'ColumnModel',
307          dataIndex : 'name',
308          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
309          renderer : 'function(v,x,r) {\n    return String.format(r.data.comptype == \'OWNER\' ? \'<B>{0}</B>\' : \'{0}\',v);    \n}',
310          sortable : true,
311          width : 200,
312          xns : Roo.grid,
313          '|xns' : 'Roo.grid'
314         },
315         {
316          xtype : 'ColumnModel',
317          dataIndex : 'tel',
318          header : _this._strings['2e006b735fbd916d8ab26978ae6714d4'] /* Tel */,
319          renderer : 'function(v) { return String.format(\'{0}\', v); }',
320          width : 100,
321          xns : Roo.grid,
322          '|xns' : 'Roo.grid'
323         },
324         {
325          xtype : 'ColumnModel',
326          dataIndex : 'fax',
327          header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
328          renderer : 'function(v) { return String.format(\'{0}\', v); }',
329          width : 100,
330          xns : Roo.grid,
331          '|xns' : 'Roo.grid'
332         },
333         {
334          xtype : 'ColumnModel',
335          dataIndex : 'email',
336          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
337          renderer : function (v) {
338                  console.log('render:' + v);
339                  return (v.length && v.indexOf('@') > 0 ) ? 
340                      String.format('<a href="mailto:{0}">{0}</a>',v) : v;
341                      
342              },
343          sortable : true,
344          width : 200,
345          xns : Roo.grid,
346          '|xns' : 'Roo.grid'
347         },
348         {
349          xtype : 'ColumnModel',
350          dataIndex : 'address',
351          header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
352          renderer : 'function(v) { return String.format(\'{0}\', v); }',
353          sortable : true,
354          width : 250,
355          xns : Roo.grid,
356          '|xns' : 'Roo.grid'
357         },
358         {
359          xtype : 'ColumnModel',
360          dataIndex : 'remarks',
361          header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
362          hidden : true,
363          renderer : 'function(v) { return String.format(\'{0}\', v); }',
364          width : 200,
365          xns : Roo.grid,
366          '|xns' : 'Roo.grid'
367         },
368         {
369          xtype : 'ColumnModel',
370          dataIndex : 'id',
371          header : _this._strings['b80bb7740288fda1f201890375a60c8f'] /* id */,
372          hidden : true,
373          renderer : 'function(v) { return String.format(\'{0}\', v); }',
374          sortable : true,
375          width : 50,
376          xns : Roo.grid,
377          '|xns' : 'Roo.grid'
378         }
379        ]
380       }
381      }
382     ]
383    }
384   };  }
385 });