FPSMS-frontend
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

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