PHP8
[Pman.BAdmin] / Pman.Dialog.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.Dialog');
6
7 Pman.Dialog.BAdminCompany= function() {}
8 Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
9
10  _strings : {
11   '1c76cbfe21c6f44c1d1e59d54f3e4420' :"Company",
12   'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
13   '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
14   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
15   'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
16   '66bc3ece76861852889e623217049d32' :"Edit Company Details",
17   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
18   'ca0dbad92a874b2f69b549293387925e' :"Code",
19   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
20   'dd7bf230fde8d4836917806aff6a6b27' :"Address",
21   'c9cc8cce247e49bae79f15173ce97354' :"Save",
22   'e6b391a8d2c4d45902a23a8b6585703d' :"URL"
23  },
24  _named_strings : {
25   'tel_fieldLabel' : 'bcc254b55c4a1babdf1dcb82c207506b' /* Phone */ ,
26   'comptype_display_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
27   'code_fieldLabel' : 'ca0dbad92a874b2f69b549293387925e' /* Code */ ,
28   'name_fieldLabel' : '1c76cbfe21c6f44c1d1e59d54f3e4420' /* Company */ ,
29   'remarks_fieldLabel' : '231bc72756b5e6de492aaaa1577f61b1' /* Remarks */ ,
30   'url_fieldLabel' : 'e6b391a8d2c4d45902a23a8b6585703d' /* URL */ ,
31   'email_fieldLabel' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
32   'address_fieldLabel' : 'dd7bf230fde8d4836917806aff6a6b27' /* Address */ ,
33   'comptype_display_name_fieldLabel' : 'a1fa27779242b4902f7ae3bdd5c6d508' /* Type */ 
34  },
35
36  dialog : false,
37  callback:  false,
38
39  show : function(data, cb)
40  {
41   if (!this.dialog) {
42    this.create();
43   }
44
45   this.callback = cb;
46   this.data = data;
47   this.dialog.show(this.data._el);
48   if (this.form) {
49    this.form.reset();
50    this.form.setValues(data);
51    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
52   }
53
54  },
55
56  create : function()
57  {
58   var _this = this;
59   this.dialog = Roo.factory({
60     xtype : 'Modal',
61     cls : 'padding-bottom-trim badmin-dialog-company enable-modal-body-overflow',
62     max_width : 650,
63     title : _this._strings['66bc3ece76861852889e623217049d32'] /* Edit Company Details */,
64     listeners : {
65      render : function (_self)
66       {
67           _this.modal = _self;
68       },
69      show : function (_self)
70       {
71           _this.form.findField('code').hide();
72       
73           if(appDisabled.indexOf('Coba.SuperAdmin') * 1 == -1) {
74               _this.form.findField('code').show();
75           }
76       }
77     },
78     xns : Roo.bootstrap,
79     '|xns' : 'Roo.bootstrap',
80     buttons : [
81      {
82       xtype : 'Button',
83       html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
84       weight : 'default',
85       listeners : {
86        click : function (_self, e)
87         {
88             _this.dialog.hide();
89         }
90       },
91       xns : Roo.bootstrap,
92       '|xns' : 'Roo.bootstrap'
93      },
94      {
95       xtype : 'Button',
96       html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
97       weight : 'primary',
98       listeners : {
99        click : function (_self, e)
100         {
101             if(!_this.form.isValid()){
102                 Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
103                 return;
104             }
105             
106             var myID = _this.form.findField('id').getValue();
107             var myName = _this.form.findField('name').getValue();
108             
109             console.log(myID + ' ' + myName);
110             
111             new Pman.Request({
112                 url : baseURL + '/Roo/Core_company.php',
113                 method : 'POST',
114                 params : {
115                   id : _this.form.findField('id').getValue() * 1,
116                   name : _this.form.findField('name').getValue(),
117                   _check_name : 1
118                 }, 
119                 success : function(res) {
120                    
121                     // Adding new record
122                     _this.form.doAction("submit");
123                 },
124                 failure : function(res) {
125                    _this.form.doAction("submit");
126                 }
127             });
128              
129             return;
130             
131         },
132        render : function (_self)
133         {
134             _this.btn_ok=this;
135         }
136       },
137       xns : Roo.bootstrap,
138       '|xns' : 'Roo.bootstrap'
139      }
140     ],
141     items  : [
142      {
143       xtype : 'Container',
144       style : 'width: 100%;',
145       xns : Roo.bootstrap,
146       '|xns' : 'Roo.bootstrap',
147       items  : [
148        {
149         xtype : 'Form',
150         url : baseURL + '/Roo/Core_company.php',
151         listeners : {
152          actioncomplete : function (_self, action)
153           {
154               if(action.type == 'setdata'){
155                   _self.reset(); 
156           
157                   if(_this.data.id * 1 > 0) {
158                       this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
159                       _this.modal.setTitle('Edit Company Details');
160                       
161                   } else {
162                      _this.modal.setTitle('Create Company');
163                   }
164                   return;
165               }
166              
167              
168               if (action.type == 'load') {
169                   _this.data = action.result.data;
170                   
171                   if(_this.data.comptype == 'OWNER'){
172                       _this.form.findField('comptype').hide();
173                   }
174                   
175                   return;
176               }
177               
178               
179               if (action.type == 'submit') { // only submitted here if we are 
180                   //_this.dialog.hide();
181                   
182                   _this.dialog.hide();
183                   
184                    if (_this.callback) {
185                       _this.callback.call(this, action.result.data);
186                    }
187                   return; 
188               }
189           },
190          actionfailed : function (_self, action)
191           {
192               //Pman.standardActionFailed(_self,action);
193               
194               if (!this.isValid) {
195                   return;
196               }
197               
198               Roo.bootstrap.MessageBox.alert(action.result.errorMsg);
199           
200           },
201          render : function (_self)
202           {
203               _this.form = _self; 
204           }
205         },
206         xns : Roo.bootstrap,
207         '|xns' : 'Roo.bootstrap',
208         items  : [
209          {
210           xtype : 'Row',
211           xns : Roo.bootstrap,
212           '|xns' : 'Roo.bootstrap',
213           items  : [
214            {
215             xtype : 'Column',
216             md : 12,
217             xns : Roo.bootstrap,
218             '|xns' : 'Roo.bootstrap',
219             items  : [
220              {
221               xtype : 'Input',
222               fieldLabel : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
223               indicatorpos : 'left',
224               name : 'code',
225               listeners : {
226                render : function (_self)
227                 {
228                     _this.company = _self;
229                 }
230               },
231               xns : Roo.bootstrap,
232               '|xns' : 'Roo.bootstrap'
233              }
234             ]
235            }
236           ]
237          },
238          {
239           xtype : 'Row',
240           xns : Roo.bootstrap,
241           '|xns' : 'Roo.bootstrap',
242           items  : [
243            {
244             xtype : 'Column',
245             md : 12,
246             xns : Roo.bootstrap,
247             '|xns' : 'Roo.bootstrap',
248             items  : [
249              {
250               xtype : 'ComboBox',
251               allowBlank : false,
252               alwaysQuery : true,
253               displayField : 'display_name',
254               editable : false,
255               fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
256               hiddenName : 'comptype',
257               indicatorpos : 'left',
258               loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
259               minChars : 2,
260               name : 'comptype_display_name',
261               queryParam : 'query[name]',
262               selectOnFocus : true,
263               triggerAction : 'all',
264               typeAhead : false,
265               valueField : 'name',
266               listeners : {
267                render : function (_self)
268                 {
269                     _this.type = _self;
270                     _self.store.load({});
271                 }
272               },
273               xns : Roo.bootstrap,
274               '|xns' : 'Roo.bootstrap',
275               store : {
276                xtype : 'Store',
277                remoteSort : true,
278                sortInfo : '{ direction : \'ASC\', field: \'id\' }',
279                listeners : {
280                 beforeload : function (_self, options)
281                  {
282                      options.params = options.params || {};
283                      // set more here
284                      //o.params['query[empty_etype]'] = 1;
285                      options.params.etype = 'COMPTYPE';
286                  }
287                },
288                xns : Roo.data,
289                '|xns' : 'Roo.data',
290                proxy : {
291                 xtype : 'HttpProxy',
292                 method : 'GET',
293                 url : baseURL + '/Roo/core_enum.php',
294                 xns : Roo.data,
295                 '|xns' : 'Roo.data'
296                },
297                reader : {
298                 xtype : 'JsonReader',
299                 id : 'id',
300                 root : 'data',
301                 totalProperty : 'total',
302                 xns : Roo.data,
303                 '|xns' : 'Roo.data'
304                }
305               }
306              }
307             ]
308            }
309           ]
310          },
311          {
312           xtype : 'Row',
313           xns : Roo.bootstrap,
314           '|xns' : 'Roo.bootstrap',
315           items  : [
316            {
317             xtype : 'Column',
318             md : 12,
319             xns : Roo.bootstrap,
320             '|xns' : 'Roo.bootstrap',
321             items  : [
322              {
323               xtype : 'Input',
324               fieldLabel : _this._strings['1c76cbfe21c6f44c1d1e59d54f3e4420'] /* Company */,
325               indicatorpos : 'left',
326               name : 'name',
327               listeners : {
328                render : function (_self)
329                 {
330                     _this.company = _self;
331                 }
332               },
333               xns : Roo.bootstrap,
334               '|xns' : 'Roo.bootstrap'
335              }
336             ]
337            }
338           ]
339          },
340          {
341           xtype : 'Row',
342           xns : Roo.bootstrap,
343           '|xns' : 'Roo.bootstrap',
344           items  : [
345            {
346             xtype : 'Column',
347             md : 12,
348             xns : Roo.bootstrap,
349             '|xns' : 'Roo.bootstrap',
350             items  : [
351              {
352               xtype : 'Input',
353               fieldLabel : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
354               indicatorpos : 'left',
355               name : 'address',
356               listeners : {
357                render : function (_self)
358                 {
359                     _this.address = _self;
360                 }
361               },
362               xns : Roo.bootstrap,
363               '|xns' : 'Roo.bootstrap'
364              }
365             ]
366            }
367           ]
368          },
369          {
370           xtype : 'Row',
371           xns : Roo.bootstrap,
372           '|xns' : 'Roo.bootstrap',
373           items  : [
374            {
375             xtype : 'Column',
376             md : 12,
377             xns : Roo.bootstrap,
378             '|xns' : 'Roo.bootstrap',
379             items  : [
380              {
381               xtype : 'Input',
382               fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
383               indicatorpos : 'left',
384               name : 'tel',
385               listeners : {
386                render : function (_self)
387                 {
388                     _this.tel = _self;
389                 }
390               },
391               xns : Roo.bootstrap,
392               '|xns' : 'Roo.bootstrap'
393              }
394             ]
395            }
396           ]
397          },
398          {
399           xtype : 'Row',
400           xns : Roo.bootstrap,
401           '|xns' : 'Roo.bootstrap',
402           items  : [
403            {
404             xtype : 'Column',
405             md : 12,
406             xns : Roo.bootstrap,
407             '|xns' : 'Roo.bootstrap',
408             items  : [
409              {
410               xtype : 'Input',
411               fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
412               indicatorpos : 'left',
413               name : 'email',
414               listeners : {
415                render : function (_self)
416                 {
417                     _this.fax = _self;
418                 }
419               },
420               xns : Roo.bootstrap,
421               '|xns' : 'Roo.bootstrap'
422              }
423             ]
424            }
425           ]
426          },
427          {
428           xtype : 'Row',
429           xns : Roo.bootstrap,
430           '|xns' : 'Roo.bootstrap',
431           items  : [
432            {
433             xtype : 'Column',
434             md : 12,
435             xns : Roo.bootstrap,
436             '|xns' : 'Roo.bootstrap',
437             items  : [
438              {
439               xtype : 'Input',
440               fieldLabel : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
441               indicatorpos : 'left',
442               name : 'url',
443               listeners : {
444                render : function (_self)
445                 {
446                     _this.url = _self;
447                 }
448               },
449               xns : Roo.bootstrap,
450               '|xns' : 'Roo.bootstrap'
451              }
452             ]
453            }
454           ]
455          },
456          {
457           xtype : 'Row',
458           cls : 'badmin-company-edit-remark',
459           xns : Roo.bootstrap,
460           '|xns' : 'Roo.bootstrap',
461           items  : [
462            {
463             xtype : 'Column',
464             md : 12,
465             xns : Roo.bootstrap,
466             '|xns' : 'Roo.bootstrap',
467             items  : [
468              {
469               xtype : 'TextArea',
470               fieldLabel : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
471               indicatorpos : 'left',
472               name : 'remarks',
473               listeners : {
474                render : function (_self)
475                 {
476                     _this.remarks = _self;
477                 }
478               },
479               xns : Roo.bootstrap,
480               '|xns' : 'Roo.bootstrap'
481              }
482             ]
483            }
484           ]
485          },
486          {
487           xtype : 'Input',
488           inputType : 'hidden',
489           name : 'id',
490           listeners : {
491            render : function (_self)
492             {
493                 _this.companyID = _self;
494             }
495           },
496           xns : Roo.bootstrap,
497           '|xns' : 'Roo.bootstrap'
498          }
499         ]
500        }
501       ]
502      }
503     ]
504    }  );
505  }
506 });
507 Roo.apply(Pman.Dialog.BAdminCompany, Pman.Dialog.BAdminCompany.prototype);