"use strict";define(["app","Controller","../Views/LoginView","../Models/LoginModel","utils"],function(f,g,e,d,a){var b;var c=g.extend({title:a.localize(this,["FirstAccess.admin.title"]),initialize:function(h){g.prototype.initialize.apply(this,arguments);_.extend(this,h);this.loginModel=new d();this.loginView=new e();f.instance().sessionTimeout.disabled=true;},renderView:function(i){var j={LoginMode:i};this.view=this.loginView.render(j);this.trigger("controller:attach",this.view);var k=$('[type="submit"]');k.removeAttr("disabled");var h=this;this.listenTo(this.view,"view:submit",_.bind(function(){k.button("loading");var l=$("[name=__RequestVerificationToken]").val();$.ajax({type:"POST",url:"/FirstAccess/LoginAdm",dataType:"HTML",data:{__RequestVerificationToken:l,userName:h.view.$el.find("#userName").val(),userPassword:h.view.$el.find("#userPassword").val()},success:_.bind(function(m){if(m==="Valid"){f.instance().router.navigate("/FirstAccess/1AAdmin/adminglobal");}else{h.view.$el.find("#errorarea").removeClass("error-no-show-area");h.view.$el.find("#errorarea").children("div").removeClass("error-no-show");var n=b===0?a.localize(this,["adminlogin.invaliduserpassword"]):a.localize(this,["adminlogin.invaliduserpin"]);h.view.$el.find("#invalid-error").html(n);k.button("reset");}},this),error:function(o,m,n){}});},this));},index:function(h){$.ajax("/FirstAccess/GetFirstAccessLoginMode",{type:"POST",dataType:"json",success:_.bind(function(i){b=i;this.renderView(b);},this),error:_.bind(function(){b=1;this.renderView(b);},this)});}});return c;});