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.

NavigationContent.tsx 8.7 KiB

10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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: "Raw Material",
  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. },
  82. {
  83. icon: <RequestQuote />,
  84. label: "Production",
  85. path: "",
  86. children: [
  87. {
  88. icon: <RequestQuote />,
  89. label: "Job Order",
  90. path: "",
  91. },
  92. {
  93. icon: <RequestQuote />,
  94. label: "Job Order Traceablity ",
  95. path: "",
  96. },
  97. {
  98. icon: <RequestQuote />,
  99. label: "Work Order",
  100. path: "",
  101. },
  102. {
  103. icon: <RequestQuote />,
  104. label: "Work Order Traceablity ",
  105. path: "",
  106. },
  107. ],
  108. },
  109. {
  110. icon: <RequestQuote />,
  111. label: "Quality Control Log",
  112. path: "",
  113. children: [
  114. {
  115. icon: <RequestQuote />,
  116. label: "Quality Control Log",
  117. path: "",
  118. },
  119. ],
  120. },
  121. {
  122. icon: <RequestQuote />,
  123. label: "Delivery",
  124. path: "",
  125. children: [
  126. {
  127. icon: <RequestQuote />,
  128. label: "Delivery Order",
  129. path: "",
  130. },
  131. ],
  132. },
  133. {
  134. icon: <RequestQuote />,
  135. label: "Report",
  136. path: "",
  137. children: [
  138. {
  139. icon: <RequestQuote />,
  140. label: "report",
  141. path: "",
  142. },
  143. ],
  144. },
  145. {
  146. icon: <RequestQuote />,
  147. label: "Recipe",
  148. path: "",
  149. children: [
  150. {
  151. icon: <RequestQuote />,
  152. label: "FG Recipe",
  153. path: "",
  154. },
  155. {
  156. icon: <RequestQuote />,
  157. label: "SFG Recipe",
  158. path: "",
  159. },
  160. {
  161. icon: <RequestQuote />,
  162. label: "Recipe",
  163. path: "",
  164. },
  165. ],
  166. },
  167. {
  168. icon: <RequestQuote />,
  169. label: "Scheduling",
  170. path: "",
  171. children: [
  172. {
  173. icon: <RequestQuote />,
  174. label: "Demand Forecast",
  175. path: "/scheduling/rough",
  176. },
  177. {
  178. icon: <RequestQuote />,
  179. label: "Detail Scheduling",
  180. path: "/scheduling/detail",
  181. },
  182. ],
  183. },
  184. {
  185. icon: <RequestQuote />,
  186. label: "Settings",
  187. path: "",
  188. children: [
  189. {
  190. icon: <RequestQuote />,
  191. label: "User",
  192. path: "/settings/user",
  193. },
  194. {
  195. icon: <RequestQuote />,
  196. label: "User Group",
  197. path: "/settings/user",
  198. },
  199. // {
  200. // icon: <RequestQuote />,
  201. // label: "Material",
  202. // path: "/settings/material",
  203. // },
  204. // {
  205. // icon: <RequestQuote />,
  206. // label: "By-product",
  207. // path: "/settings/byProduct",
  208. // },
  209. {
  210. icon: <RequestQuote />,
  211. label: "Items",
  212. path: "/settings/items",
  213. },
  214. {
  215. icon: <RequestQuote />,
  216. label: "Demand Forecast Setting",
  217. path: "/settings/rss",
  218. },
  219. {
  220. icon: <RequestQuote />,
  221. label: "Equipment Type",
  222. path: "/settings/user",
  223. },
  224. {
  225. icon: <RequestQuote />,
  226. label: "Equipment",
  227. path: "/settings/user",
  228. },
  229. {
  230. icon: <RequestQuote />,
  231. label: "Warehouse",
  232. path: "/settings/user",
  233. },
  234. {
  235. icon: <RequestQuote />,
  236. label: "Supplier",
  237. path: "/settings/user",
  238. },
  239. {
  240. icon: <RequestQuote />,
  241. label: "Customer",
  242. path: "/settings/user",
  243. },
  244. {
  245. icon: <RequestQuote />,
  246. label: "QC Check Item",
  247. path: "/settings/qcItem",
  248. },
  249. {
  250. icon: <RequestQuote />,
  251. label: "QC Category",
  252. path: "/settings/qcCategory",
  253. },
  254. {
  255. icon: <RequestQuote />,
  256. label: "QC Check Template",
  257. path: "/settings/user",
  258. },
  259. {
  260. icon: <RequestQuote />,
  261. label: "Mail",
  262. path: "/settings/mail",
  263. },
  264. {
  265. icon: <RequestQuote />,
  266. label: "Import Testing",
  267. path: "/settings/importTesting",
  268. },
  269. ],
  270. },
  271. ];
  272. const { t } = useTranslation("common");
  273. const pathname = usePathname();
  274. const [openItems, setOpenItems] = React.useState<string[]>([]);
  275. const toggleItem = (label: string) => {
  276. setOpenItems((prevOpenItems) =>
  277. prevOpenItems.includes(label)
  278. ? prevOpenItems.filter((item) => item !== label)
  279. : [...prevOpenItems, label],
  280. );
  281. };
  282. const renderNavigationItem = (item: NavigationItem) => {
  283. const isOpen = openItems.includes(item.label);
  284. return (
  285. <Box
  286. key={`${item.label}-${item.path}`}
  287. component={Link}
  288. href={item.path}
  289. sx={{ textDecoration: "none", color: "inherit" }}
  290. >
  291. <ListItemButton
  292. selected={pathname.includes(item.label)}
  293. onClick={() => item.children && toggleItem(item.label)}
  294. >
  295. <ListItemIcon>{item.icon}</ListItemIcon>
  296. <ListItemText primary={t(item.label)} />
  297. </ListItemButton>
  298. {item.children && isOpen && (
  299. <List sx={{ pl: 2 }}>
  300. {item.children.map((child) => (!child.isHidden && renderNavigationItem(child)))}
  301. </List>
  302. )}
  303. </Box>
  304. );
  305. };
  306. return (
  307. <Box sx={{ width: NAVIGATION_CONTENT_WIDTH }}>
  308. <Box sx={{ p: 3, display: "flex" }}>
  309. <Logo height={60} />
  310. {/* <button className="float-right bg-transparent border-transparent" >
  311. <ArrowCircleLeftRoundedIcon className="text-slate-400 hover:text-blue-400 hover:cursor-pointer " style={{ fontSize: '35px' }} />
  312. </button> */}
  313. </Box>
  314. <Divider />
  315. <List component="nav">
  316. {navigationItems.map((item) => renderNavigationItem(item))}
  317. {/* {navigationItems.map(({ icon, label, path }, index) => {
  318. return (
  319. <Box
  320. key={`${label}-${index}`}
  321. component={Link}
  322. href={path}
  323. sx={{ textDecoration: "none", color: "inherit" }}
  324. >
  325. <ListItemButton selected={pathname.includes(path)}>
  326. <ListItemIcon>{icon}</ListItemIcon>
  327. <ListItemText primary={t(label)} />
  328. </ListItemButton>
  329. </Box>
  330. );
  331. })} */}
  332. </List>
  333. </Box>
  334. );
  335. };
  336. export default NavigationContent;