(function(){$(function(){function r(){location.reload(!0)}function u(n,t){abp.message.confirm("Delete user '"+t+"'?",function(t){t&&i.delete({id:n}).done(function(){r()})})}var i=abp.services.app.user,n=$("#UserCreateModal"),t=n.find("form");t.validate({rules:{Password:"required",ConfirmPassword:{equalTo:"#Password"}}});$("#RefreshButton").click(function(){r()});$(".delete-user").click(function(){var n=$(this).attr("data-user-id"),t=$(this).attr("data-user-name");u(n,t)});$(".edit-user").click(function(n){var t=$(this).attr("data-user-id");n.preventDefault();$.ajax({url:abp.appPath+"Users/EditUserModal?userId="+t,type:"POST",contentType:"application/html",success:function(n){$("#UserEditModal div.modal-content").html(n)},error:function(){}})});t.find('button[type="submit"]').click(function(r){var u,f,e,o;if(r.preventDefault(),t.valid()){if(u=t.serializeFormToObject(),u.roleNames=[],f=$("input[name='role']:checked"),f)for(e=0;e<f.length;e++)o=$(f[e]),u.roleNames.push(o.val());abp.ui.setBusy(n);i.create(u).done(function(){n.modal("hide");location.reload(!0)}).always(function(){abp.ui.clearBusy(n)})}});n.on("shown.bs.modal",function(){n.find("input:not([type=hidden]):first").focus()});$("#UsersGrid").kendoGrid({editable:!0,columns:[{field:"userName",title:app.l("UserName")},{field:"name",title:app.l("Name")},{field:"surname",title:app.l("Surname")},{field:"emailAddress",title:app.l("EmailAddress")},{field:"isActive",title:app.l("IsActive"),template:'#= isActive ? "YES" : "NO" #'}],dataSource:new kendo.data.DataSource({autoSync:!0,transport:{read:function(n){abp.services.app.user.getAll({}).done(function(t){n.success(t.items)}).fail(function(t){n.error(t)})},update:function(n){abp.services.app.user.update(n.data).done(function(){n.success(null)}).fail(function(t){n.error(t)})}},schema:{model:{id:"id",fields:{id:{editable:!1,nullable:!0},userName:{editable:!0},name:{editable:!0},surname:{editable:!0},emailAddress:{editable:!0},isActive:{editable:!1}}}}})})})})();