Pman.Dialog.VerifyAccess.bjs
[Pman.Core] / Pman.Dialog.VerifyAccess.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.VerifyAccess= function() {}
8 Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
9
10  _strings : {
11   'e2c9d024b79dfb48b42a7807206c6aed' :"Verify New IP Access",
12   'd41d8cd98f00b204e9800998ecf8427e' :"",
13   '7c5ba892645af8d7dba520e3978c726f' :"Director",
14   'f6039d44b29456b20f8f373155ae4973' :"Username",
15   'dfb790522fdea3859af206d32916fe77' :"User Agent",
16   'd71940f24ee38ee09f6e06b908480bcf' :"Resend email",
17   '14cf5e829f5cb6fbf8cb54f7c5ff4ca9' :"Start the application process   "
18  },
19
20  dialog : false,
21  callback:  false,
22
23  show : function(data, cb)
24  {
25   if (!this.dialog) {
26    this.create();
27   }
28
29   this.callback = cb;
30   this.data = data;
31   this.dialog.show(this.data._el);
32   if (this.form) {
33    this.form.reset();
34    this.form.setValues(data);
35    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
36   }
37
38  },
39
40  create : function()
41  {
42   var _this = this;
43   this.dialog = Roo.factory({
44     xtype : 'Modal',
45     allow_close : false,
46     cls : 'enable-overflow',
47     title : _this._strings['e2c9d024b79dfb48b42a7807206c6aed'] /* Verify New IP Access */,
48     listeners : {
49      show : function (_self)
50       {
51           var path = window.location.pathname.split('/');
52           
53           var authorized_key = path.pop();
54           
55           var id = path.pop();
56           
57           new Pman.Request({
58               url: baseURL + '/Core/VerifyAccess',
59               method : 'POST',
60               mask : 'Loading...',
61               params : {
62                   id : id,
63                   authorized_key : authorized_key,
64                   _to_data : 1
65               }, 
66               success : function(res) {
67                   _this.form.setValues(res.data);
68                   return;
69               },
70               failure: function(res) {
71                   
72                   _this.dialog.hide();
73                   
74                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
75                   
76                   return;
77              }
78           });
79       }
80     },
81     xns : Roo.bootstrap,
82     '|xns' : 'Roo.bootstrap',
83     buttons : [
84      {
85       xtype : 'Button',
86       html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
87       weight : 'primary',
88       listeners : {
89        click : function (_self, e)
90         {
91             if(!_this.form.isValid()){
92                 return;
93             }
94             
95             var p1 = _this.form.findField('password').getValue();
96             var p2 = _this.form.findField('password1').getValue();
97             
98             if (p1 != p2) {
99                 _this.form.findField('password1').markInvalid('Password do not match');
100                 return;
101             }
102             
103             _this.dialog.el.mask('Sending...');
104             _this.form.doAction('submit');
105             
106         },
107        render : function (_self)
108         {
109             _this.btn_ok = _self;
110         }
111       },
112       xns : Roo.bootstrap,
113       '|xns' : 'Roo.bootstrap'
114      },
115      {
116       xtype : 'Button',
117       html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
118       weight : 'primary',
119       listeners : {
120        click : function (_self, e)
121         {
122             var path = window.location.pathname.split('/');
123             
124             var verify_key = path.pop();
125             
126             var id = path.pop();
127             
128             new Pman.Request({
129                 url: baseURL + '/Roo/Coba_application_signup',
130                 method : 'POST',
131                 mask : 'Sending...',
132                 params : {
133                     _resend : id
134                 }, 
135                 success : function(res) {
136                     var msg = "We have re-sent you an invitation via email." +
137                                 "<br/><br/>" + 
138                                 "Please check your inbox for the final registration step." + 
139                                  "<br/><br/>" + 
140                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
141                                 
142                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
143                 },
144                 failure: function(res) {
145                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
146                 }
147             });
148         },
149        render : function (_self)
150         {
151             _this.btn_resend = _self;
152              this.el.setVisibilityMode(Roo.Element.DISPLAY);
153              this.el.hide();
154         }
155       },
156       xns : Roo.bootstrap,
157       '|xns' : 'Roo.bootstrap'
158      }
159     ],
160     items  : [
161      {
162       xtype : 'Form',
163       errorMask : true,
164       labelAlign : 'top',
165       loadMask : false,
166       url : baseURL + '/Core/VerifyAccess',
167       listeners : {
168        actioncomplete : function (_self, action)
169         {
170             if (action.type == 'setdata') {
171                 
172                 return;
173             }
174             if (action.type == 'load') {
175                 
176                 return;
177             }
178             if (action.type =='submit') {
179                 
180                 _this.dialog.hide();
181                 
182                 Roo.get(document.body).mask('Start your Application');
183                 
184                 setTimeout(function() {
185                     window.location.href = baseURL;
186                 }, 500); 
187                 
188                 return;
189             }
190             
191         },
192        actionfailed : function (_self, action)
193         {
194             _this.dialog.el.unmask();
195             Roo.log("action failed");
196             Roo.log(action);
197           
198             if(!action.result.errorMsg){
199                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
200             }
201            
202             var msg = action.result.errorMsg;
203            
204             if(msg.length >= 200){
205                 msg = msg.substring(0,199) + '...'
206             }
207             
208             Roo.bootstrap.MessageBox.alert("Error", msg);
209         },
210        render : function (_self,e)
211         {
212             _this.form = _self;
213             
214         }
215       },
216       xns : Roo.bootstrap,
217       '|xns' : 'Roo.bootstrap',
218       items  : [
219        {
220         xtype : 'Row',
221         xns : Roo.bootstrap,
222         '|xns' : 'Roo.bootstrap',
223         items  : [
224          {
225           xtype : 'Column',
226           xs : 12,
227           xns : Roo.bootstrap,
228           '|xns' : 'Roo.bootstrap',
229           items  : [
230            {
231             xtype : 'Input',
232             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
233             name : 'email',
234             readOnly : true,
235             xns : Roo.bootstrap,
236             '|xns' : 'Roo.bootstrap'
237            }
238           ]
239          }
240         ]
241        },
242        {
243         xtype : 'Row',
244         listeners : {
245          render : function (_self)
246           {
247               _this.row_pwd_label = _self;
248           }
249         },
250         xns : Roo.bootstrap,
251         '|xns' : 'Roo.bootstrap',
252         items  : [
253          {
254           xtype : 'Column',
255           xs : 12,
256           xns : Roo.bootstrap,
257           '|xns' : 'Roo.bootstrap',
258           items  : [
259            {
260             xtype : 'TextArea',
261             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
262             name : 'user_agent',
263             readOnly : true,
264             rows : 3,
265             xns : Roo.bootstrap,
266             '|xns' : 'Roo.bootstrap'
267            }
268           ]
269          }
270         ]
271        },
272        {
273         xtype : 'Row',
274         listeners : {
275          render : function (_self)
276           {
277               _this.row_pwd_label = _self;
278           }
279         },
280         xns : Roo.bootstrap,
281         '|xns' : 'Roo.bootstrap',
282         items  : [
283          {
284           xtype : 'Column',
285           xs : 12,
286           xns : Roo.bootstrap,
287           '|xns' : 'Roo.bootstrap',
288           items  : [
289            {
290             xtype : 'ComboBox',
291             allowBlank : false,
292             alwaysQuery : true,
293             displayField : 'fullname',
294             editable : true,
295             fieldLabel : _this._strings['7c5ba892645af8d7dba520e3978c726f'] /* Director */,
296             forceSelection : true,
297             hiddenName : '_existing_director',
298             indicatorpos : 'right',
299             md : 12,
300             minChars : 2,
301             name : '_existing_director_name',
302             queryParam : 'query[name]',
303             tpl : '<div class=\"roo-select2-result\">{fullname}</div>',
304             triggerAction : 'all',
305             typeAhead : true,
306             valueField : 'id',
307             xns : Roo.bootstrap,
308             '|xns' : 'Roo.bootstrap',
309             store : {
310              xtype : 'Store',
311              remoteSort : true,
312              sortInfo : {field:"firstname",direction:"ASC"},
313              listeners : {
314               beforeload : function (_self, o)
315                {
316                    o.params = o.params || {};
317                    
318                    o.params._with_fullname = 1;
319                    
320                    var parent = _this.form.findField('parent_company_id').getValue() * 1;
321                    
322                    o.params._hide_existing = 1;
323                    
324                    o.params._parent_company_id = parent;
325                    
326                    if (Roo.select('main').first().dom.className.indexOf('trust') >= 0) {
327                        
328                        o.params._find_person_type = 'trustee';
329                    }
330                    
331                }
332              },
333              xns : Roo.data,
334              '|xns' : 'Roo.data',
335              proxy : {
336               xtype : 'HttpProxy',
337               method : 'GET',
338               url : baseURL+'/Roo/Coba_person',
339               xns : Roo.data,
340               '|xns' : 'Roo.data'
341              },
342              reader : {
343               xtype : 'JsonReader',
344               fields : [
345                   {
346                       'name': 'id',
347                       'type': 'int'
348                   },
349                   {
350                       'name': 'honor',
351                       'type': 'string'
352                   },
353                   {
354                       'name': 'firstname',
355                       'type': 'string'
356                   },
357                   {
358                       'name': 'middlename',
359                       'type': 'string'
360                   },
361                   {
362                       'name': 'lastname',
363                       'type': 'string'
364                   },
365                   {
366                       'name': 'fullname',
367                       'type': 'string'
368                   }
369               ],
370               xns : Roo.data,
371               '|xns' : 'Roo.data'
372              }
373             }
374            }
375           ]
376          }
377         ]
378        },
379        {
380         xtype : 'Row',
381         xns : Roo.bootstrap,
382         '|xns' : 'Roo.bootstrap',
383         items  : [
384          {
385           xtype : 'Column',
386           xs : 12,
387           xns : Roo.bootstrap,
388           '|xns' : 'Roo.bootstrap',
389           items  : [
390            {
391             xtype : 'Input',
392             inputType : 'hidden',
393             name : 'id',
394             xns : Roo.bootstrap,
395             '|xns' : 'Roo.bootstrap'
396            },
397            {
398             xtype : 'Input',
399             inputType : 'hidden',
400             name : 'authorized_key',
401             xns : Roo.bootstrap,
402             '|xns' : 'Roo.bootstrap'
403            }
404           ]
405          }
406         ]
407        }
408       ]
409      },
410      {
411       xtype : 'Row',
412       listeners : {
413        render : function (_self)
414         {
415             _this.error_row = this;
416             
417             this.el.setVisibilityMode(Roo.Element.DISPLAY);
418             
419             this.el.hide();
420         }
421       },
422       xns : Roo.bootstrap,
423       '|xns' : 'Roo.bootstrap',
424       items  : [
425        {
426         xtype : 'Column',
427         xs : 12,
428         xns : Roo.bootstrap,
429         '|xns' : 'Roo.bootstrap',
430         items  : [
431          {
432           xtype : 'Element',
433           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
434           listeners : {
435            render : function (_self)
436             {
437                 _this.text_el = _self;
438             }
439           },
440           xns : Roo.bootstrap,
441           '|xns' : 'Roo.bootstrap'
442          }
443         ]
444        }
445       ]
446      }
447     ]
448    }  );
449  }
450 });
451 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);