// Common Navigation and UI Utilities for ChemiFactory MES/HMI document.addEventListener("DOMContentLoaded", () => { renderNavigation(); highlightActiveLink(); }); // Navigation configuration const navItems = [ { name: "λŒ€μ‹œλ³΄λ“œ", icon: "πŸ“Š", path: "index.html" }, { name: "생산 κ³„νš", icon: "πŸ“…", path: "plan.html" }, { name: "생산 ν˜„ν™©", icon: "βš™οΈ", path: "equipment.html" }, { name: "고객사 관리", icon: "🀝", path: "customer.html" }, { name: "곡급사 관리", icon: "🏭", path: "supplier.html" }, { name: "κΈ°κΈ° 관리", icon: "πŸ› οΈ", path: "device.html" }, { name: "재고 관리", icon: "πŸ“¦", path: "inventory.html" }, { name: "계산/뢄석", icon: "πŸ“", path: "analysis.html" }, { name: "μ„€μ •", icon: "βš™οΈ", path: "setting.html" } ]; function renderNavigation() { const sidebar = document.getElementById("sidebar"); if (!sidebar) return; let html = ` `; sidebar.innerHTML = html; } function highlightActiveLink() { // Current page filename detection const path = window.location.pathname; const page = path.split("/").pop() || "index.html"; const links = document.querySelectorAll(".nav-item-link"); links.forEach(link => { const itemPath = link.getAttribute("data-path"); if (page === itemPath || (page === "" && itemPath === "index.html")) { link.classList.add("active"); } else { link.classList.remove("active"); } }); }