/** * RegistroClienteController * * @classDescription Controller para Registro de Clientes * @namespace controllers * @author Pablo Viojo, Juan Francisco Prado * @version 1 */ var RegistroClienteController = svweb.controllers.common.MultiActionController.extend({ initialize:function(){ $("a.help").click(this.showHelp); var id = $("#iden_Direcciones").val(); var lbl = $("#desc_Direcciones").val(); $("span.error").each(function(){ if ($(this).html()==""){ $(this).hide(); } }); $("#iden_Direcciones").remove(); $("#desc_Direcciones").remove(); $("#rut_Titular").blur(this.onBlurRut,this); this.wndDirecciones = new svweb.components.custom.AddressBox({ obj:$("#fldDireccion .input"), idenVivienda:id, lblVivienda:lbl, content:$(".cntWndDirecciones").html(), id:"wndDirecciones", name:"iden_Direcciones", descName:"desc_Direcciones", buttons:[ { image:imgBotonCancelar, type:"cancel", alt:varMensajeCancelar }, { image:imgBotonAceptar, type:"ok", alt:varMensajeAceptar } ], offset:{ x:0, y:-110 } }); this.wndDirecciones.suscribe("open",this.onOpenWndDireccion,this); this.wndDirecciones.suscribe("close",this.onCloseWndDireccion,this); }, onBlurRut:function(e){ if ($("#rut_Titular").val()){ $(".msgRut").hide(); startLoadingComponent({obj:$("#rut_Titular")}); $.getJSON( "registroCliente.html?_action=validaNoRegistrado&rut="+$("#rut_Titular").val(), function(data){ var btnSubmit = $("input[@type=submit]"); btnSubmit.attr("disabled",""); endLoadingComponent({obj:$("#rut_Titular")}); if (data){ var msg = ""; var showMessage = false; if (data.valid){ if (data.registered){ msg = varMensajeClienteRegistrado + '' + varLinkOlvideMiClave + ''; showMessage = true; } } else { msg = varMensajeRutErroneo; showMessage = true; } if (showMessage){ $(".msgRut").html(msg); $(".msgRut").show(); btnSubmit.attr("disabled","disabled"); } } } ) } }, onOpenWndDireccion:function(){ $(".frm select").css({visibility:"hidden"}); }, onCloseWndDireccion:function(){ $(".frm select").css({visibility:"visible"}); }, viviendaSelected:function(data){ }, showHelp:function(){ window.open('boleta.html',null,'height=635px,width=420px,left=50,top=50,status=no,toolbar=no,menubar=no',true); } }); $().ready(function (){window.registroClienteController = new RegistroClienteController();});