Ext.namespace('Login.Mail');
Login.Mail.MainPanel = function(){
this.Txt_Mail = new Ext.form.TextField({
fieldLabel : '
Or
Mail address',
name : 'mailaddress',
disabled : false,
style:'height:25px',
cls :'tipcls',
allowBlank : true,
vtype:'email',
anchor : '100%',
enableKeyEvents:true,
listeners:{
keyup :function(){
if(this.getValue().length==1){
this.setValue(this.getValue()+"@fresenius-kabi.com")
this.selectText(1,1)
}
if(this.getValue().length>0){
$("input[name='userid']").removeClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
}else if(this.getValue().length==0 && Trim($("input[name='userid']").val()).length==0){
$("input[name='userid']").removeClass("borderred")
$("input[name='mailaddress']").addClass("borderred")
}
}, focus :function(){
// alert(Trim($("input[name='userid']").val()).length + " "+Trim($("input[name='mailaddress']").val()).length)
if(Trim($("input[name='userid']").val()).length>0||Trim($("input[name='mailaddress']").val()).length>0){
$("input[name='userid']").removeClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
}else{
$("input[name='userid']").removeClass("borderred")
$("input[name='mailaddress']").addClass("borderred")
}
}
}
});
this.Txt_User = new Ext.form.TextField({
fieldLabel : 'User ID',
name : 'userid',
style:'height:25px',
allowBlank : true,
cls :'tipcls',
enableKeyEvents:true,
disabled : false,
anchor : '100%',
listeners:{
focus :function(){
if(Trim($("input[name='userid']").val()).length>0||Trim($("input[name='mailaddress']").val()).length>0){
$("input[name='userid']").removeClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
}else{
$("input[name='userid']").addClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
}
},keyup :function(){
if(this.getValue().length>0){
$("input[name='userid']").removeClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
}else if(this.getValue().length==0 && Trim($("input[name='mailaddress']").val()).length==0){
$("input[name='userid']").addClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
}
}
}
});
this.Btn_Contine=new Ext.Button({
text: " Get Password ",
scope: this,
handler: function () {
this.sendmail();
}
})
var SendContent='Please enter your email address or user ID to get your password.
';
Login.Mail.MainPanel.superclass.constructor.call(this,
{
layout : 'column',
labelAlign :'top',
border : true,
baseCls:'pvm_loginmail',
//bodyStyle : 'padding:15px 5px 5px 5px;background:#ffffff url(/Content/images/login/loginmail.png) no-repeat 450px 60px',
region : 'center',
items : [{
layout : 'form',
columnWidth : 1,
border : false,
bodyStyle : 'background:transparent;',
html:SendContent
},
{
layout : 'form',
columnWidth : 0.51,
allowBlank : false,
border : false,
bodyStyle : 'background:transparent;padding:15px 0px 0px 25px; ',
items : this.Txt_User
},
{
layout : 'form',
columnWidth : 0.51,
allowBlank : false,
border : false,
bodyStyle : 'background:transparent;padding:0px 0px 5px 25px; ',
items : this.Txt_Mail
},
{
layout : 'form',
columnWidth : 0.5,
border : false,
bodyStyle : 'background:transparent;padding:20px 0px 5px 20px; ',
items: this.Btn_Contine
}],
autoScroll : true
});
};
Ext.extend(Login.Mail.MainPanel, Ext.form.FormPanel,
{
initComponent : function(){
Login.Mail.MainPanel.superclass.initComponent.call(this);
},
sendmail : function () {
var params = {};
params.User = this.Txt_User.getValue();
params.Mail = this.Txt_Mail.getValue();
if(params.User==""&¶ms.Mail==""){
Ext.Msg.alert('Message','Please enter your email address or user ID to get your password.');
$("input[name='userid']").addClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
return ;
}else{
$("input[name='userid']").removeClass("borderred")
$("input[name='mailaddress']").removeClass("borderred")
}
Ext.Ajax.request({
url : '/Login/SendMail',
params : params,
success : function (response, request) {
var result = Ext.util.JSON.decode(response.responseText);
if (!result.success) {
if (result.message != "")
ShowErrorMessage('Message', result.message);
} else {
ShowInfoMessage('Message', result.message);
}
}
});
}
});
Login.Mail.DetailWindow = function(){
this.mainPanel = new Login.Mail.MainPanel({});
Login.Mail.DetailWindow.superclass.constructor.call(this,
{
title : ' Forgot your password
',
width : 750,
height : 400,
bodyStyle : 'padding:12px 0px 0px 0px;',
closable : true,
resizable : false,
draggable : true,
border : true,
closeAction : 'hide',
animateTarget : document.body,
layout : 'border',
modal : true,
constrain : true,
items : [
this.mainPanel
],
listeners:{
show:function(){
$(".tipcls").poshytip({
className: 'tip-violet',
content: "User ID or your mail address is required."
});
}
}
});
};
Ext.extend(Login.Mail.DetailWindow, Ext.Window,
{
initComponent : function(){
Login.Mail.DetailWindow.superclass.initComponent.call(this);
},
onCloseClick : function(){
this.hide();
},
newRecord : function(LoginId){
this.mainPanel.Txt_User.setValue(LoginId);
// this.mainPanel.Txt_Mail.setValue("@fresenius-kabi.com");
},
loadRecord : function(RecordID){
//
}
});