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.
 
 

373 linhas
9.6 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: "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. icon: <RequestQuote />,
  82. label: "Put Away Scan",
  83. path: "/putAway",
  84. },
  85. {
  86. icon: <RequestQuote />,
  87. label: "Finished Good",
  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. },
  211. {
  212. icon: <RequestQuote />,
  213. label: "Settings",
  214. path: "",
  215. children: [
  216. {
  217. icon: <RequestQuote />,
  218. label: "User",
  219. path: "/settings/user",
  220. },
  221. {
  222. icon: <RequestQuote />,
  223. label: "User Group",
  224. path: "/settings/user",
  225. },
  226. // {
  227. // icon: <RequestQuote />,
  228. // label: "Material",
  229. // path: "/settings/material",
  230. // },
  231. // {
  232. // icon: <RequestQuote />,
  233. // label: "By-product",
  234. // path: "/settings/byProduct",
  235. // },
  236. {
  237. icon: <RequestQuote />,
  238. label: "Items",
  239. path: "/settings/items",
  240. },
  241. {
  242. icon: <RequestQuote />,
  243. label: "Demand Forecast Setting",
  244. path: "/settings/rss",
  245. },
  246. {
  247. icon: <RequestQuote />,
  248. label: "Equipment Type",
  249. path: "/settings/equipmentType",
  250. },
  251. {
  252. icon: <RequestQuote />,
  253. label: "Equipment",
  254. path: "/settings/equipment",
  255. },
  256. {
  257. icon: <RequestQuote />,
  258. label: "Warehouse",
  259. path: "/settings/user",
  260. },
  261. {
  262. icon: <RequestQuote />,
  263. label: "Supplier",
  264. path: "/settings/user",
  265. },
  266. {
  267. icon: <RequestQuote />,
  268. label: "Customer",
  269. path: "/settings/user",
  270. },
  271. {
  272. icon: <RequestQuote />,
  273. label: "QC Check Item",
  274. path: "/settings/qcItem",
  275. },
  276. {
  277. icon: <RequestQuote />,
  278. label: "QC Category",
  279. path: "/settings/qcCategory",
  280. },
  281. {
  282. icon: <RequestQuote />,
  283. label: "QC Check Template",
  284. path: "/settings/user",
  285. },
  286. // {
  287. // icon: <RequestQuote />,
  288. // label: "Mail",
  289. // path: "/settings/mail",
  290. // },
  291. {
  292. icon: <RequestQuote />,
  293. label: "Import Testing",
  294. path: "/settings/m18ImportTesting",
  295. },
  296. ],
  297. },
  298. ];
  299. const { t } = useTranslation("common");
  300. const pathname = usePathname();
  301. const [openItems, setOpenItems] = React.useState<string[]>([]);
  302. const toggleItem = (label: string) => {
  303. setOpenItems((prevOpenItems) =>
  304. prevOpenItems.includes(label)
  305. ? prevOpenItems.filter((item) => item !== label)
  306. : [...prevOpenItems, label],
  307. );
  308. };
  309. const renderNavigationItem = (item: NavigationItem) => {
  310. const isOpen = openItems.includes(item.label);
  311. return (
  312. <Box
  313. key={`${item.label}-${item.path}`}
  314. component={Link}
  315. href={item.path}
  316. sx={{ textDecoration: "none", color: "inherit" }}
  317. >
  318. <ListItemButton
  319. selected={pathname.includes(item.label)}
  320. onClick={() => item.children && toggleItem(item.label)}
  321. >
  322. <ListItemIcon>{item.icon}</ListItemIcon>
  323. <ListItemText primary={t(item.label)} />
  324. </ListItemButton>
  325. {item.children && isOpen && (
  326. <List sx={{ pl: 2 }}>
  327. {item.children.map(
  328. (child) => !child.isHidden && renderNavigationItem(child),
  329. )}
  330. </List>
  331. )}
  332. </Box>
  333. );
  334. };
  335. return (
  336. <Box sx={{ width: NAVIGATION_CONTENT_WIDTH }}>
  337. <Box sx={{ p: 3, display: "flex" }}>
  338. <Logo height={60} />
  339. {/* <button className="float-right bg-transparent border-transparent" >
  340. <ArrowCircleLeftRoundedIcon className="text-slate-400 hover:text-blue-400 hover:cursor-pointer " style={{ fontSize: '35px' }} />
  341. </button> */}
  342. </Box>
  343. <Divider />
  344. <List component="nav">
  345. {navigationItems.map((item) => renderNavigationItem(item))}
  346. {/* {navigationItems.map(({ icon, label, path }, index) => {
  347. return (
  348. <Box
  349. key={`${label}-${index}`}
  350. component={Link}
  351. href={path}
  352. sx={{ textDecoration: "none", color: "inherit" }}
  353. >
  354. <ListItemButton selected={pathname.includes(path)}>
  355. <ListItemIcon>{icon}</ListItemIcon>
  356. <ListItemText primary={t(label)} />
  357. </ListItemButton>
  358. </Box>
  359. );
  360. })} */}
  361. </List>
  362. </Box>
  363. );
  364. };
  365. export default NavigationContent;