var tasks_list=[document.getElementById("kanbanboard"),document.getElementById("unassigned-task"),document.getElementById("todo-task"),document.getElementById("inprogress-task"),document.getElementById("reviews-task"),document.getElementById("completed-task"),document.getElementById("new-task")],myModalEl=document.getElementById("deleteRecordModal");function taskCounter(){task_lists=document.querySelectorAll("#kanbanboard .task-list"),task_lists.forEach(function(e){tasks=e.getElementsByClassName("task"),tasks.forEach(function(e){task_box=e.getElementsByClassName("task-box"),task_counted=task_box.length}),badge=e.querySelector(".card-title .badge").innerText="",badge=e.querySelector(".card-title .badge").innerText=task_counted})}myModalEl.addEventListener("show.bs.modal",function(e){document.getElementById("delete-record").addEventListener("click",function(){e.relatedTarget.closest(".tasks-box").remove(),document.getElementById("btn-close").click()})}),taskCounter(),drake=dragula(tasks_list).on("drag",function(e){e.className=e.className.replace("ex-moved","")}).on("drop",function(e){e.className+=" ex-moved"}).on("over",function(e,t){t.className+=" ex-over"}).on("out",function(e,t){t.className=t.className.replace("ex-over",""),taskCounter()});var scroll=autoScroll([document.querySelector("#kanbanboard")],{margin:20,maxSpeed:100,scrollWhenOutside:!0,autoScroll:function(){return this.down&&drake.dragging}});function newKanbanbaord(){var e=document.getElementById("boardName").value,t=Math.floor(100*Math.random()),a="review_task_"+t;kanbanlisthtml='<div class="tasks-list" id='+("remove_item_"+t)+'><div class="d-flex mb-3"><div class="flex-grow-1"><h6 class="fs-14 text-uppercase fw-semibold mb-0">'+e+'</h6></div><div class="flex-shrink-0"><div class="dropdown card-header-dropdown"><a class="text-reset dropdown-btn" href="#" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="fw-medium text-muted fs-12">Priority<i class="mdi mdi-chevron-down ms-1"></i></span></a><div class="dropdown-menu dropdown-menu-end"><a class="dropdown-item" href="#">Priority</a><a class="dropdown-item" href="#">Date Added</a></div></div></div></div><div data-simplebar class="tasks-wrapper px-3 mx-n3"><div class="tasks" id="'+a+'" ></div></div><div class="my-3"><button class="btn btn-soft-info w-100" data-bs-toggle="modal" data-bs-target="#creatertaskModal">Add More</button></div></div>',document.getElementById("kanbanboard").insertAdjacentHTML("beforeend",kanbanlisthtml),document.getElementById("btn-close").click(),drake.destroy(),tasks_list.push(document.getElementById(a)),drake=dragula(tasks_list),document.getElementById("boardName").value=""}document.getElementById("addNewBoard").addEventListener("click",newKanbanbaord),document.getElementById("addMember").addEventListener("click",newMemberAdd);var profileField=document.getElementById("profileimgInput"),reader=new FileReader;function newMemberAdd(){var e=document.getElementById("firstnameInput").value,t=localStorage.getItem("kanbanboard-member");newMembar='<a href="javascript: void(0);" class="avatar-group-item" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-placement="top" title="'+e+'">'+t+"</a>",document.getElementById("newMembar").insertAdjacentHTML("afterbegin",newMembar),document.getElementById("btn-close-member").click()}profileField.addEventListener("change",function(e){reader.readAsDataURL(profileField.files[0]),reader.onload=function(){var e=reader.result;localStorage.setItem("kanbanboard-member",'<img src="'+e+'" alt="profile" class="rounded-circle avatar-xs">')}});