(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.roles=[],f=$("input[name='role']:checked"),f)for(e=0;e<f.length;e++)o=$(f[e]),u.roles.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()})})})();