!function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=16)}({16:function(e,t,n){e.exports=n("P3PN")},P3PN:function(e,t){$("#departments-table").DataTable({processing:!0,serverSide:!0,order:[[0,"asc"]],ajax:{url:departmentUrl},columnDefs:[{targets:[1],orderable:!1,className:"text-center",width:"5%"}],columns:[{data:"name",name:"name"},{data:function(e){return'<a title="Edit" class="btn action-btn btn-primary btn-sm edit-btn mr-1" data-id="'+e.id+'"><i class="cui-pencil action-icon"></i></a><a title="Delete" class="btn action-btn btn-danger btn-sm delete-btn"  data-id="'+e.id+'"><i class="cui-trash action-icon"></i></a>'},name:"id"}]}),$("#addNewForm").submit((function(e){e.preventDefault();var t=jQuery(this).find("#btnSave");t.button("loading"),$.ajax({url:departmentCreateUrl,type:"POST",data:$(this).serialize(),success:function(e){e.success&&($("#AddModal").modal("hide"),$("#departments-table").DataTable().ajax.reload(null,!1))},error:function(e){printErrorMessage("#validationErrorsBox",e)},complete:function(){t.button("reset")}})})),$("#editForm").submit((function(e){e.preventDefault();var t=jQuery(this).find("#btnEditSave");t.button("loading");var n=$("#departmentId").val();$.ajax({url:departmentUrl+n+"/update",type:"post",data:$(this).serialize(),success:function(e){e.success&&($("#EditModal").modal("hide"),$("#departments-table").DataTable().ajax.reload(null,!1))},error:function(e){manageAjaxErrors(e)},complete:function(){t.button("reset")}})})),$("#AddModal").on("hidden.bs.modal",(function(){resetModalForm("#addNewForm","#validationErrorsBox")})),$("#EditModal").on("hidden.bs.modal",(function(){resetModalForm("#editForm","#editValidationErrorsBox")})),window.renderData=function(e){$.ajax({url:departmentUrl+e+"/edit",type:"GET",success:function(e){if(e.success){var t=e.data;$("#departmentId").val(t.id),$("#edit_name").val(t.name),$("#edit_email").val(t.email),$("#edit_website").val(t.website),$("#EditModal").modal("show")}},error:function(e){manageAjaxErrors(e)}})},$(document).on("click",".edit-btn",(function(e){var t=$(e.currentTarget).data("id");renderData(t)})),$(document).on("click",".delete-btn",(function(e){var t=$(e.currentTarget).data("id");deleteItem(departmentUrl+t,"#departments-table","Department")}))}});