// Close the dropdown if the user clicks outside of it window.onclick = function (event) { if (!event.target.matches(".dropbtn")) { const dropdowns = document.getElementsByClassName("dropdown-content"); for (let i = 0; i < dropdowns.length; i++) { const openDropdown = dropdowns[i]; if (openDropdown.classList.contains("show")) { openDropdown.classList.remove("show"); } } } }; // **------tab link js** $(document).on('click', '.tab-link', function () { let tabID = $(this).attr('data-tab'); $(this).addClass('active').siblings().removeClass('active'); $('#tab-' + tabID).addClass('active').siblings().removeClass('active'); }); // **------chart js** const polar2Options = { series: [76], chart: { type: 'radialBar', offsetY: -20, sparkline: { enabled: true } }, colors: ['rgba(var(--primary),1)'], plotOptions: { radialBar: { startAngle: -90, endAngle: 90, track: { background: "#e7e7e7", strokeWidth: '97%', margin: 5, // margin is in pixels dropShadow: { enabled: true, top: 2, left: 0, color: '#999', opacity: 1, blur: 2, } }, dataLabels: { name: { show: false }, value: { offsetY: -4, fontSize: '22px' } } } }, grid: { padding: { top: -20 } }, fill: { type: '', gradient: { shade: '', shadeIntensity: 0.4, inverseColors: false, opacityFrom: 1, opacityTo: 1, stops: [0, 60, 73, 108] }, }, labels: ['Average Results'], }; const polar2Chart = new ApexCharts(document.querySelector("#polar2"), polar2Options); polar2Chart.render(); function getActionsFeture() { document.querySelectorAll(".delete-btn").forEach(button => { button.addEventListener("click", () => { try { const modal = $("#apiDeletModal"); modal.modal("show"); const confirmButton = document.getElementById("confirmDelete"); confirmButton.onclick = () => { const container = button.closest(".col-xxl-3"); document.querySelector(".documents-sections .card-body .row").appendChild(container.cloneNode(true)); container.remove(); modal.modal("hide"); confirmButton.onclick = null; // Detach the event listener }; } catch (error) { console.error("Error during delete action:", error); } }); }); document.querySelectorAll('.fav-icon').forEach(icon => { icon.addEventListener('click', function (event) { try { this.classList.toggle('ph-bold'); this.classList.toggle('ph-fill'); const favBtn = this.closest(".col-xxl-3 ").cloneNode(true); if (event.target.classList.contains("ph-fill")) { document.querySelector('#tab-2 .row').appendChild(favBtn.cloneNode(true)); } else { const existingElements = document.querySelectorAll('#tab-3 .row .col-xl-3'); existingElements.forEach(child => { if (child.dataset.originalId === favBtn.dataset.originalId) { child.remove(); } }); } } catch (error) { console.error("Error during favorite action:", error); } }); }); document.querySelectorAll('.star-icon').forEach(icon => { icon.addEventListener('click', function (event) { try { this.classList.toggle('ph-bold'); this.classList.toggle('ph-fill'); const favRow = this.closest("tr").cloneNode(true); if (event.target.classList.contains("ph-fill")) { document.querySelector('#favorites-table tbody').appendChild(favRow); } else { const existingRows = document.querySelectorAll('#favorites-table tbody tr'); existingRows.forEach(row => { if (row.firstChild.textContent === favRow.firstChild.textContent) { row.remove(); } }); } } catch (error) { console.error("Error during star action:", error); } }); }); } //-------- folder rename start-----// function renameFolder() { const renameKeyButton = document.querySelector("#renamekey"); document.querySelectorAll(".edit-folder-list").forEach((element) => { element.addEventListener("click", (event) => { try { const card = event.target.closest(".card-body"); $("#renameModal").modal("show"); const titleName = card.querySelector("p.text-center"); const inputField = document.querySelector("#titlename"); inputField.value = titleName.textContent; function handleRename() { titleName.textContent = inputField.value; $("#renameModal").modal("hide"); renameKeyButton.removeEventListener('click', handleRename); } renameKeyButton.removeEventListener('click', handleRename); renameKeyButton.addEventListener('click', handleRename); } catch (error) { console.error("Error during folder rename:", error); } }); }); } renameFolder(); //-------- folder rename end -----// // Add to file function function tableBodyFun() { return `