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