X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Pman.Dialog.VerifyAccess.js;h=45f7613b9bc3bbe08e0ea2019abab9bcb1ddb7a6;hp=b3e791752d1668be3d3f5af07d95546d7f2d538b;hb=refs%2Fheads%2Fwip_alan_T5884_add_photo_to_report;hpb=e085a3505ffcaa255d83146b3edf0426b195b071 diff --git a/Pman.Dialog.VerifyAccess.js b/Pman.Dialog.VerifyAccess.js index b3e79175..45f7613b 100644 --- a/Pman.Dialog.VerifyAccess.js +++ b/Pman.Dialog.VerifyAccess.js @@ -9,11 +9,12 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { _strings : { 'e2c9d024b79dfb48b42a7807206c6aed' :"Verify New IP Access", - 'd41d8cd98f00b204e9800998ecf8427e' :"", + 'a12a3079e14ced46e69ba52b8a90b21a' :"IP", 'f6039d44b29456b20f8f373155ae4973' :"Username", + '004bf6c9a40003140292e97330236c53' :"Action", + '5a787141d53b573ec9b86e900bfe0d79' :"Expire Date", 'dfb790522fdea3859af206d32916fe77' :"User Agent", - 'd71940f24ee38ee09f6e06b908480bcf' :"Resend email", - '14cf5e829f5cb6fbf8cb54f7c5ff4ca9' :"Start the application process " + '70d9be9b139893aa6c69b5e77e614311' :"Confirm" }, dialog : false, @@ -63,7 +64,25 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { _to_data : 1 }, success : function(res) { - _this.form.setValues(res.data); + + _this.data = res.data; + + if(_this.data.status != 0){ + _this.dialog.hide(); + Roo.bootstrap.MessageBox.alert('Notice', 'This IP has been verified [' + _this.data.ip + ']'); + return; + } + + _this.form.setValues(_this.data); + + if(_this.data.status * 1 == 0){ + _this.form.findField('status').reset(); + } + + _this.form.findField('expire_dt').reset(); + + _this.form.clearInvalid(); + return; }, failure: function(res) { @@ -82,7 +101,7 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { buttons : [ { xtype : 'Button', - html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process */, + html : _this._strings['70d9be9b139893aa6c69b5e77e614311'] /* Confirm */, weight : 'primary', listeners : { click : function (_self, e) @@ -90,66 +109,10 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { if(!_this.form.isValid()){ return; } - - var p1 = _this.form.findField('password').getValue(); - var p2 = _this.form.findField('password1').getValue(); - - if (p1 != p2) { - _this.form.findField('password1').markInvalid('Password do not match'); - return; - } - + _this.dialog.el.mask('Sending...'); _this.form.doAction('submit'); - }, - render : function (_self) - { - _this.btn_ok = _self; - } - }, - xns : Roo.bootstrap, - '|xns' : 'Roo.bootstrap' - }, - { - xtype : 'Button', - html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */, - weight : 'primary', - listeners : { - click : function (_self, e) - { - var path = window.location.pathname.split('/'); - - var verify_key = path.pop(); - - var id = path.pop(); - - new Pman.Request({ - url: baseURL + '/Roo/Coba_application_signup', - method : 'POST', - mask : 'Sending...', - params : { - _resend : id - }, - success : function(res) { - var msg = "We have re-sent you an invitation via email." + - "

" + - "Please check your inbox for the final registration step." + - "

" + - "(Note. emails may accidentally be sent to your Spam Folder)"; - - Roo.bootstrap.MessageBox.alert('Please check your email', msg) ; - }, - failure: function(res) { - Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ; - } - }); - }, - render : function (_self) - { - _this.btn_resend = _self; - this.el.setVisibilityMode(Roo.Element.DISPLAY); - this.el.hide(); } }, xns : Roo.bootstrap, @@ -178,11 +141,7 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { _this.dialog.hide(); - Roo.get(document.body).mask('Start your Application'); - - setTimeout(function() { - window.location.href = baseURL; - }, 500); + Roo.bootstrap.MessageBox.alert('Notice', 'You have verified the IP [' + _this.data.ip + ']'); return; } @@ -235,20 +194,23 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { '|xns' : 'Roo.bootstrap' } ] - } - ] - }, - { - xtype : 'Row', - listeners : { - render : function (_self) - { - _this.row_pwd_label = _self; - } - }, - xns : Roo.bootstrap, - '|xns' : 'Roo.bootstrap', - items : [ + }, + { + xtype : 'Column', + xs : 12, + xns : Roo.bootstrap, + '|xns' : 'Roo.bootstrap', + items : [ + { + xtype : 'Input', + fieldLabel : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */, + name : 'ip', + readOnly : true, + xns : Roo.bootstrap, + '|xns' : 'Roo.bootstrap' + } + ] + }, { xtype : 'Column', xs : 12, @@ -261,24 +223,12 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { name : 'user_agent', readOnly : true, rows : 3, + style : 'margin-bottom: 15px;', xns : Roo.bootstrap, '|xns' : 'Roo.bootstrap' } ] - } - ] - }, - { - xtype : 'Row', - listeners : { - render : function (_self) - { - _this.row_pwd_label = _self; - } - }, - xns : Roo.bootstrap, - '|xns' : 'Roo.bootstrap', - items : [ + }, { xtype : 'Column', xs : 12, @@ -287,21 +237,30 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { items : [ { xtype : 'ComboBox', + allowBlank : false, + alwaysQuery : true, displayField : 'value', editable : false, - hiddenName : 'status_filter', + fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */, + forceSelection : true, + hiddenName : 'status', + indicatorpos : 'right', mode : 'local', - name : 'status_filter_name', + name : 'status_name', + selectOnFocus : true, + tpl : '
{value}
', triggerAction : 'all', valueField : 'code', listeners : { - render : function (_self) - { - _this.status_filter = _self; - }, select : function (combo, record, index) { - _this.table.footer.onClick('first'); + _this.expire_dt.allowBlank = true; + _this.expire_dt.el.hide(); + + if(record.data.code == '-2'){ + _this.expire_dt.allowBlank = false; + _this.expire_dt.el.show(); + } } }, xns : Roo.bootstrap, @@ -309,13 +268,9 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { store : { xtype : 'SimpleStore', data : [ - ['all', 'All'], - ['submitted', 'Submitted'], - ['pending_submission', 'Pending Submission'], - ['pending_approval', 'Pending Approval'], - ['rejected', 'Rejected'], - ['approved', 'Approved'], - ['deleted', 'Deleted'] + ['1', 'Approve'], + ['-2', 'Temporary'], + ['-1', 'Reject'] ], fields : [ 'code', 'value' ], xns : Roo.data, @@ -323,6 +278,40 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { } } ] + }, + { + xtype : 'Column', + xs : 12, + xns : Roo.bootstrap, + '|xns' : 'Roo.bootstrap', + items : [ + { + xtype : 'DateField', + allowBlank : false, + fieldLabel : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */, + format : 'Y-m-d', + indicatorpos : 'right', + name : 'expire_dt', + listeners : { + render : function (_self) + { + _this.expire_dt = this; + + var d = new Date(); + + d.setDate(d.getDate() - 1); + + this.setStartDate(d); + + this.el.setVisibilityMode(Roo.Element.DISPLAY); + + this.el.hide(); + } + }, + xns : Roo.bootstrap, + '|xns' : 'Roo.bootstrap' + } + ] } ] }, @@ -356,43 +345,6 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, { ] } ] - }, - { - xtype : 'Row', - listeners : { - render : function (_self) - { - _this.error_row = this; - - this.el.setVisibilityMode(Roo.Element.DISPLAY); - - this.el.hide(); - } - }, - xns : Roo.bootstrap, - '|xns' : 'Roo.bootstrap', - items : [ - { - xtype : 'Column', - xs : 12, - xns : Roo.bootstrap, - '|xns' : 'Roo.bootstrap', - items : [ - { - xtype : 'Element', - html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /* */, - listeners : { - render : function (_self) - { - _this.text_el = _self; - } - }, - xns : Roo.bootstrap, - '|xns' : 'Roo.bootstrap' - } - ] - } - ] } ] } );