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