!function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=5)}({5:function(e,t,r){e.exports=r("pe5J")},pe5J:function(e,t){$("#client_id,#edit_client_id").select2({width:"100%",placeholder:"Select Client"}),$("#filterClient").select2();var r=$("#projects_table").DataTable({processing:!0,serverSide:!0,order:[[0,"asc"]],ajax:{url:projectUrl,data:function(e){e.filter_client=$("#filterClient").find("option:selected").val()}},columnDefs:[{targets:[0],className:"text-center",width:"7%"},{targets:[3],orderable:!1,className:"text-center",width:"5%"}],columns:[{data:"prefix",name:"prefix"},{data:"name",name:"name"},{data:"client.name",defaultContent:"",name:"client.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"}],fnInitComplete:function(){$("#filterClient").change((function(){r.ajax.reload()}))}});$("#addNewForm").submit((function(e){e.preventDefault();var t=jQuery(this).find("#btnSave");t.button("loading"),$.ajax({url:projectCreateUrl,type:"POST",data:$(this).serialize(),success:function(e){e.success&&(displaySuccessMessage(e.message),$("#AddModal").modal("hide"),$("#projects_table").DataTable().ajax.reload(null,!1),revokerTracker())},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 r=$("#projectId").val();$.ajax({url:projectUrl+r,type:"put",data:$(this).serialize(),success:function(e){e.success&&(displaySuccessMessage(e.message),$("#EditModal").modal("hide"),$("#projects_table").DataTable().ajax.reload(null,!1),revokerTracker())},error:function(e){manageAjaxErrors(e)},complete:function(){t.button("reset")}})})),$("#AddModal").on("hidden.bs.modal",(function(){$("#client_id").val(null).trigger("change"),$("#user_ids").val(null).trigger("change"),resetModalForm("#addNewForm","#validationErrorsBox")})),$("#EditModal").on("hidden.bs.modal",(function(){resetModalForm("#editForm","#editValidationErrorsBox")})),window.renderData=function(e){$.ajax({url:projectUrl+e+"/edit",type:"GET",success:function(e){if(e.success){var t=e.data.project;$("#projectId").val(t.id),$("#edit_name").val(t.name),$("#edit_prefix").val(t.prefix),$("#edit_client_id").val(t.client_id).trigger("change"),$("#edit_description").val(t.description);var r=e.data.users;$("#edit_user_ids").val(r),$("#edit_user_ids").trigger("change"),$("#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");deleteItemInputConfirmation(projectUrl+t,"#projects_table","Project",'<div class="alert alert-warning swal__alert">\n<strong class="swal__text-warning">Are you sure want to delete this project?</strong><div class="swal__text-message">By deleting this project all its task and time entries will be deleted.</div></div>'),setTimeout((function(){revokerTracker()}),1e3)})),$("#user_ids,#edit_user_ids").select2({width:"100%",placeholder:"Select Users"})}});