import Divider from "@mui/material/Divider"; import Box from "@mui/material/Box"; import React, { useEffect } from "react"; import List from "@mui/material/List"; import ListItemButton from "@mui/material/ListItemButton"; import ListItemText from "@mui/material/ListItemText"; import ListItemIcon from "@mui/material/ListItemIcon"; import WorkHistory from "@mui/icons-material/WorkHistory"; import Dashboard from "@mui/icons-material/Dashboard"; import SummarizeIcon from "@mui/icons-material/Summarize"; import PaymentsIcon from "@mui/icons-material/Payments"; import AccountTreeIcon from "@mui/icons-material/AccountTree"; import RequestQuote from "@mui/icons-material/RequestQuote"; import PeopleIcon from "@mui/icons-material/People"; import Task from "@mui/icons-material/Task"; import Assignment from "@mui/icons-material/Assignment"; import Settings from "@mui/icons-material/Settings"; import Analytics from "@mui/icons-material/Analytics"; import Payments from "@mui/icons-material/Payments"; import { useTranslation } from "react-i18next"; import Typography from "@mui/material/Typography"; import { usePathname } from "next/navigation"; import Link from "next/link"; import { NAVIGATION_CONTENT_WIDTH } from "@/config/uiConfig"; import Logo from "../Logo"; interface NavigationItem { icon: React.ReactNode; label: string; path: string; children?: NavigationItem[]; isHidden?: true | undefined } const NavigationContent: React.FC = () => { const navigationItems: NavigationItem[] = [ { icon: , label: ("Dashboard"), path: "/dashboard", }, { icon: , label: "Raw Material", path: "", children: [ { icon: , label: "Purchase Order", path: "/po", }, { icon: , label: "Pick Order", path: "/pickOrder", }, // { // icon: , // label: "Cons. Pick Order", // path: "", // }, // { // icon: , // label: "Delivery Pick Order", // path: "", // }, // { // icon: , // label: "Warehouse", // path: "", // }, // { // icon: , // label: "Location Transfer Order", // path: "", // }, { icon: , label: "View item In-out And inventory Ledger", path: "/inventory", }, ], }, // { // icon: , // label: "Production", // path: "", // children: [ // { // icon: , // label: "Job Order", // path: "", // }, // { // icon: , // label: "Job Order Traceablity ", // path: "", // }, // { // icon: , // label: "Work Order", // path: "", // }, // { // icon: , // label: "Work Order Traceablity ", // path: "", // }, // ], // }, // { // icon: , // label: "Quality Control Log", // path: "", // children: [ // { // icon: , // label: "Quality Control Log", // path: "", // }, // ], // }, { icon: , label: "Delivery", path: "", children: [ { icon: , label: "Delivery Order", path: "/do", }, ], }, // { // icon: , // label: "Report", // path: "", // children: [ // { // icon: , // label: "report", // path: "", // }, // ], // }, // { // icon: , // label: "Recipe", // path: "", // children: [ // { // icon: , // label: "FG Recipe", // path: "", // }, // { // icon: , // label: "SFG Recipe", // path: "", // }, // { // icon: , // label: "Recipe", // path: "", // }, // ], // }, { icon: , label: "Scheduling", path: "", children: [ { icon: , label: "Demand Forecast", path: "/scheduling/rough", }, { icon: , label: "Detail Scheduling", path: "/scheduling/detail", }, ], }, { icon: , label: "Settings", path: "", children: [ { icon: , label: "User", path: "/settings/user", }, { icon: , label: "User Group", path: "/settings/user", }, // { // icon: , // label: "Material", // path: "/settings/material", // }, // { // icon: , // label: "By-product", // path: "/settings/byProduct", // }, { icon: , label: "Items", path: "/settings/items", }, { icon: , label: "Demand Forecast Setting", path: "/settings/rss", }, { icon: , label: "Equipment Type", path: "/settings/user", }, { icon: , label: "Equipment", path: "/settings/user", }, { icon: , label: "Warehouse", path: "/settings/user", }, { icon: , label: "Supplier", path: "/settings/user", }, { icon: , label: "Customer", path: "/settings/user", }, { icon: , label: "QC Check Item", path: "/settings/qcItem", }, { icon: , label: "QC Category", path: "/settings/qcCategory", }, { icon: , label: "QC Check Template", path: "/settings/user", }, { icon: , label: "Mail", path: "/settings/mail", }, { icon: , label: "Import Testing", path: "/settings/m18ImportTesting", }, ], }, ]; const { t } = useTranslation("common"); const pathname = usePathname(); const [openItems, setOpenItems] = React.useState([]); const toggleItem = (label: string) => { setOpenItems((prevOpenItems) => prevOpenItems.includes(label) ? prevOpenItems.filter((item) => item !== label) : [...prevOpenItems, label], ); }; const renderNavigationItem = (item: NavigationItem) => { const isOpen = openItems.includes(item.label); return ( item.children && toggleItem(item.label)} > {item.icon} {item.children && isOpen && ( {item.children.map((child) => (!child.isHidden && renderNavigationItem(child)))} )} ); }; return ( {/* */} {navigationItems.map((item) => renderNavigationItem(item))} {/* {navigationItems.map(({ icon, label, path }, index) => { return ( {icon} ); })} */} ); }; export default NavigationContent;