var buttonGroups,list=document.querySelectorAll(".team-list");function onButtonGroupClick(e){"list-view-button"===e.target.id||"list-view-button"===e.target.parentElement.id?(document.getElementById("list-view-button").classList.add("active"),document.getElementById("grid-view-button").classList.remove("active"),Array.from(list).forEach(function(e){e.classList.add("list-view-filter"),e.classList.remove("grid-view-filter")})):(document.getElementById("grid-view-button").classList.add("active"),document.getElementById("list-view-button").classList.remove("active"),Array.from(list).forEach(function(e){e.classList.remove("list-view-filter"),e.classList.add("grid-view-filter")}))}list&&(buttonGroups=document.querySelectorAll(".filter-button"))&&Array.from(buttonGroups).forEach(function(e){e.addEventListener("click",onButtonGroupClick)});var url="assets/json/",allmemberlist="";function loadTeamData(e){document.querySelector("#team-member-list").innerHTML="",Array.from(e).forEach(function(e,t){var r=e.bookmark?"active":"",m=e.memberImg?'':'
'+e.nickname+"
";document.querySelector("#team-member-list").innerHTML+='',bookmarkBtn(),editMemberList(),removeItem(),memberDetailShow()})}function bookmarkBtn(){Array.from(document.querySelectorAll(".favourite-btn")).forEach(function(e){e.addEventListener("click",function(){e.classList.contains("active")?e.classList.remove("active"):e.classList.add("active")})})}fetch(url+"team-member-list.json").then(e=>e.json()).then(e=>{loadTeamData(allmemberlist=e)}).catch(e=>console.error(e)),bookmarkBtn();var editlist=!1;function editMemberList(){var r;Array.from(document.querySelectorAll(".edit-list")).forEach(function(t){t.addEventListener("click",function(e){r=t.getAttribute("data-edit-id"),allmemberlist=allmemberlist.map(function(e){return e.id==r&&(editlist=!0,document.getElementById("createMemberLabel").innerHTML="Edit Member",document.getElementById("addNewMember").innerHTML="Save",""==e.memberImg?document.getElementById("member-img").src="assets/images/users/user-dummy-img.jpg":document.getElementById("member-img").src=e.memberImg,document.getElementById("cover-img").src=e.coverImg,document.getElementById("memberid-input").value=e.id,document.getElementById("teammembersName").value=e.memberName,document.getElementById("designation").value=e.position,document.getElementById("project-input").value=e.projects,document.getElementById("task-input").value=e.tasks,document.getElementById("memberlist-form").classList.remove("was-validated")),e})})})}function fetchIdFromObj(e){return parseInt(e.id)}function findNextId(){var e,t;return 0===allmemberlist.length?0:(e=fetchIdFromObj(allmemberlist[allmemberlist.length-1]))<=(t=fetchIdFromObj(allmemberlist[0]))?t+1:e+1}function sortElementsById(){loadTeamData(allmemberlist.sort(function(e,t){e=fetchIdFromObj(e),t=fetchIdFromObj(t);return t