FPSMS-frontend
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

383 righe
9.9 KiB

  1. import Divider from "@mui/material/Divider";
  2. import Box from "@mui/material/Box";
  3. import React, { useEffect } from "react";
  4. import List from "@mui/material/List";
  5. import ListItemButton from "@mui/material/ListItemButton";
  6. import ListItemText from "@mui/material/ListItemText";
  7. import ListItemIcon from "@mui/material/ListItemIcon";
  8. import WorkHistory from "@mui/icons-material/WorkHistory";
  9. import Dashboard from "@mui/icons-material/Dashboard";
  10. import SummarizeIcon from "@mui/icons-material/Summarize";
  11. import PaymentsIcon from "@mui/icons-material/Payments";
  12. import AccountTreeIcon from "@mui/icons-material/AccountTree";
  13. import RequestQuote from "@mui/icons-material/RequestQuote";
  14. import PeopleIcon from "@mui/icons-material/People";
  15. import Task from "@mui/icons-material/Task";
  16. import Assignment from "@mui/icons-material/Assignment";
  17. import Settings from "@mui/icons-material/Settings";
  18. import Analytics from "@mui/icons-material/Analytics";
  19. import Payments from "@mui/icons-material/Payments";
  20. import { useTranslation } from "react-i18next";
  21. import Typography from "@mui/material/Typography";
  22. import { usePathname } from "next/navigation";
  23. import Link from "next/link";
  24. import { NAVIGATION_CONTENT_WIDTH } from "@/config/uiConfig";
  25. import Logo from "../Logo";
  26. interface NavigationItem {
  27. icon: React.ReactNode;
  28. label: string;
  29. path: string;
  30. children?: NavigationItem[];
  31. isHidden?: true | undefined;
  32. }
  33. const NavigationContent: React.FC = () => {
  34. const navigationItems: NavigationItem[] = [
  35. {
  36. icon: <Dashboard />,
  37. label: "Dashboard",
  38. path: "/dashboard",
  39. },
  40. {
  41. icon: <RequestQuote />,
  42. label: "Store Management",
  43. path: "",
  44. children: [
  45. {
  46. icon: <RequestQuote />,
  47. label: "Purchase Order",
  48. path: "/po",
  49. },
  50. {
  51. icon: <RequestQuote />,
  52. label: "Pick Order",
  53. path: "/pickOrder",
  54. },
  55. // {
  56. // icon: <RequestQuote />,
  57. // label: "Cons. Pick Order",
  58. // path: "",
  59. // },
  60. // {
  61. // icon: <RequestQuote />,
  62. // label: "Delivery Pick Order",
  63. // path: "",
  64. // },
  65. // {
  66. // icon: <RequestQuote />,
  67. // label: "Warehouse",
  68. // path: "",
  69. // },
  70. // {
  71. // icon: <RequestQuote />,
  72. // label: "Location Transfer Order",
  73. // path: "",
  74. // },
  75. {
  76. icon: <RequestQuote />,
  77. label: "View item In-out And inventory Ledger",
  78. path: "/inventory",
  79. },
  80. {
  81. icon: <RequestQuote />,
  82. label: "Put Away Scan",
  83. path: "/putAway",
  84. },
  85. {
  86. icon: <RequestQuote />,
  87. label: "Finished Good Order",
  88. path: "/finishedGood",
  89. },
  90. ],
  91. },
  92. // {
  93. // icon: <RequestQuote />,
  94. // label: "Production",
  95. // path: "",
  96. // children: [
  97. // {
  98. // icon: <RequestQuote />,
  99. // label: "Job Order",
  100. // path: "",
  101. // },
  102. // {
  103. // icon: <RequestQuote />,
  104. // label: "Job Order Traceablity ",
  105. // path: "",
  106. // },
  107. // {
  108. // icon: <RequestQuote />,
  109. // label: "Work Order",
  110. // path: "",
  111. // },
  112. // {
  113. // icon: <RequestQuote />,
  114. // label: "Work Order Traceablity ",
  115. // path: "",
  116. // },
  117. // ],
  118. // },
  119. // {
  120. // icon: <RequestQuote />,
  121. // label: "Quality Control Log",
  122. // path: "",
  123. // children: [
  124. // {
  125. // icon: <RequestQuote />,
  126. // label: "Quality Control Log",
  127. // path: "",
  128. // },
  129. // ],
  130. // },
  131. {
  132. icon: <RequestQuote />,
  133. label: "Delivery",
  134. path: "",
  135. children: [
  136. {
  137. icon: <RequestQuote />,
  138. label: "Delivery Order",
  139. path: "/do",
  140. },
  141. ],
  142. },
  143. // {
  144. // icon: <RequestQuote />,
  145. // label: "Report",
  146. // path: "",
  147. // children: [
  148. // {
  149. // icon: <RequestQuote />,
  150. // label: "report",
  151. // path: "",
  152. // },
  153. // ],
  154. // },
  155. // {
  156. // icon: <RequestQuote />,
  157. // label: "Recipe",
  158. // path: "",
  159. // children: [
  160. // {
  161. // icon: <RequestQuote />,
  162. // label: "FG Recipe",
  163. // path: "",
  164. // },
  165. // {
  166. // icon: <RequestQuote />,
  167. // label: "SFG Recipe",
  168. // path: "",
  169. // },
  170. // {
  171. // icon: <RequestQuote />,
  172. // label: "Recipe",
  173. // path: "",
  174. // },
  175. // ],
  176. // },
  177. {
  178. icon: <RequestQuote />,
  179. label: "Scheduling",
  180. path: "",
  181. children: [
  182. {
  183. icon: <RequestQuote />,
  184. label: "Demand Forecast",
  185. path: "/scheduling/rough",
  186. },
  187. {
  188. icon: <RequestQuote />,
  189. label: "Detail Scheduling",
  190. path: "/scheduling/detailed",
  191. },
  192. {
  193. icon: <RequestQuote />,
  194. label: "Production",
  195. path: "/production",
  196. },
  197. ],
  198. },
  199. {
  200. icon: <RequestQuote />,
  201. label: "Job Order",
  202. path: "",
  203. children: [
  204. {
  205. icon: <RequestQuote />,
  206. label: "Job Order",
  207. path: "/jo",
  208. },
  209. {
  210. icon: <RequestQuote />,
  211. label: "Job Order detail",
  212. path: "/jodetail",
  213. },
  214. ],
  215. },
  216. {
  217. icon: <RequestQuote />,
  218. label: "Settings",
  219. path: "",
  220. children: [
  221. {
  222. icon: <RequestQuote />,
  223. label: "User",
  224. path: "/settings/user",
  225. },
  226. {
  227. icon: <RequestQuote />,
  228. label: "User Group",
  229. path: "/settings/user",
  230. },
  231. // {
  232. // icon: <RequestQuote />,
  233. // label: "Material",
  234. // path: "/settings/material",
  235. // },
  236. // {
  237. // icon: <RequestQuote />,
  238. // label: "By-product",
  239. // path: "/settings/byProduct",
  240. // },
  241. {
  242. icon: <RequestQuote />,
  243. label: "Items",
  244. path: "/settings/items",
  245. },
  246. {
  247. icon: <RequestQuote />,
  248. label: "Demand Forecast Setting",
  249. path: "/settings/rss",
  250. },
  251. {
  252. icon: <RequestQuote />,
  253. label: "Equipment Type",
  254. path: "/settings/equipmentType",
  255. },
  256. {
  257. icon: <RequestQuote />,
  258. label: "Equipment",
  259. path: "/settings/equipment",
  260. },
  261. {
  262. icon: <RequestQuote />,
  263. label: "Warehouse",
  264. path: "/settings/user",
  265. },
  266. {
  267. icon: <RequestQuote />,
  268. label: "Supplier",
  269. path: "/settings/user",
  270. },
  271. {
  272. icon: <RequestQuote />,
  273. label: "Customer",
  274. path: "/settings/user",
  275. },
  276. {
  277. icon: <RequestQuote />,
  278. label: "QC Check Item",
  279. path: "/settings/qcItem",
  280. },
  281. {
  282. icon: <RequestQuote />,
  283. label: "QC Category",
  284. path: "/settings/qcCategory",
  285. },
  286. {
  287. icon: <RequestQuote />,
  288. label: "QC Check Template",
  289. path: "/settings/user",
  290. },
  291. // {
  292. // icon: <RequestQuote />,
  293. // label: "Mail",
  294. // path: "/settings/mail",
  295. // },
  296. {
  297. icon: <RequestQuote />,
  298. label: "Import Testing",
  299. path: "/settings/m18ImportTesting",
  300. },
  301. {
  302. icon: <RequestQuote />,
  303. label: "Import Excel",
  304. path: "/settings/importExcel",
  305. },
  306. ],
  307. },
  308. ];
  309. const { t } = useTranslation("common");
  310. const pathname = usePathname();
  311. const [openItems, setOpenItems] = React.useState<string[]>([]);
  312. const toggleItem = (label: string) => {
  313. setOpenItems((prevOpenItems) =>
  314. prevOpenItems.includes(label)
  315. ? prevOpenItems.filter((item) => item !== label)
  316. : [...prevOpenItems, label],
  317. );
  318. };
  319. const renderNavigationItem = (item: NavigationItem) => {
  320. const isOpen = openItems.includes(item.label);
  321. return (
  322. <Box
  323. key={`${item.label}-${item.path}`}
  324. component={Link}
  325. href={item.path}
  326. sx={{ textDecoration: "none", color: "inherit" }}
  327. >
  328. <ListItemButton
  329. selected={pathname.includes(item.label)}
  330. onClick={() => item.children && toggleItem(item.label)}
  331. >
  332. <ListItemIcon>{item.icon}</ListItemIcon>
  333. <ListItemText primary={t(item.label)} />
  334. </ListItemButton>
  335. {item.children && isOpen && (
  336. <List sx={{ pl: 2 }}>
  337. {item.children.map(
  338. (child) => !child.isHidden && renderNavigationItem(child),
  339. )}
  340. </List>
  341. )}
  342. </Box>
  343. );
  344. };
  345. return (
  346. <Box sx={{ width: NAVIGATION_CONTENT_WIDTH }}>
  347. <Box sx={{ p: 3, display: "flex" }}>
  348. <Logo height={60} />
  349. {/* <button className="float-right bg-transparent border-transparent" >
  350. <ArrowCircleLeftRoundedIcon className="text-slate-400 hover:text-blue-400 hover:cursor-pointer " style={{ fontSize: '35px' }} />
  351. </button> */}
  352. </Box>
  353. <Divider />
  354. <List component="nav">
  355. {navigationItems.map((item) => renderNavigationItem(item))}
  356. {/* {navigationItems.map(({ icon, label, path }, index) => {
  357. return (
  358. <Box
  359. key={`${label}-${index}`}
  360. component={Link}
  361. href={path}
  362. sx={{ textDecoration: "none", color: "inherit" }}
  363. >
  364. <ListItemButton selected={pathname.includes(path)}>
  365. <ListItemIcon>{icon}</ListItemIcon>
  366. <ListItemText primary={t(label)} />
  367. </ListItemButton>
  368. </Box>
  369. );
  370. })} */}
  371. </List>
  372. </Box>
  373. );
  374. };
  375. export default NavigationContent;