FPSMS-frontend
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

NavigationContent.tsx 9.1 KiB

9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
5ヶ月前
9ヶ月前
6ヶ月前
9ヶ月前
6ヶ月前
9ヶ月前
6ヶ月前
9ヶ月前
9ヶ月前
6ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
6ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
9ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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: "/do",
  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/detailed",
  181. },
  182. {
  183. icon: <RequestQuote />,
  184. label: "Production",
  185. path: "/production",
  186. },
  187. ],
  188. },
  189. {
  190. icon: <RequestQuote />,
  191. label: "Settings",
  192. path: "",
  193. children: [
  194. {
  195. icon: <RequestQuote />,
  196. label: "User",
  197. path: "/settings/user",
  198. },
  199. {
  200. icon: <RequestQuote />,
  201. label: "User Group",
  202. path: "/settings/user",
  203. },
  204. // {
  205. // icon: <RequestQuote />,
  206. // label: "Material",
  207. // path: "/settings/material",
  208. // },
  209. // {
  210. // icon: <RequestQuote />,
  211. // label: "By-product",
  212. // path: "/settings/byProduct",
  213. // },
  214. {
  215. icon: <RequestQuote />,
  216. label: "Items",
  217. path: "/settings/items",
  218. },
  219. {
  220. icon: <RequestQuote />,
  221. label: "Demand Forecast Setting",
  222. path: "/settings/rss",
  223. },
  224. {
  225. icon: <RequestQuote />,
  226. label: "Equipment Type",
  227. path: "/settings/equipmentType",
  228. },
  229. {
  230. icon: <RequestQuote />,
  231. label: "Equipment",
  232. path: "/settings/equipment",
  233. },
  234. {
  235. icon: <RequestQuote />,
  236. label: "Warehouse",
  237. path: "/settings/user",
  238. },
  239. {
  240. icon: <RequestQuote />,
  241. label: "Supplier",
  242. path: "/settings/user",
  243. },
  244. {
  245. icon: <RequestQuote />,
  246. label: "Customer",
  247. path: "/settings/user",
  248. },
  249. {
  250. icon: <RequestQuote />,
  251. label: "QC Check Item",
  252. path: "/settings/qcItem",
  253. },
  254. {
  255. icon: <RequestQuote />,
  256. label: "QC Category",
  257. path: "/settings/qcCategory",
  258. },
  259. {
  260. icon: <RequestQuote />,
  261. label: "QC Check Template",
  262. path: "/settings/user",
  263. },
  264. {
  265. icon: <RequestQuote />,
  266. label: "Mail",
  267. path: "/settings/mail",
  268. },
  269. {
  270. icon: <RequestQuote />,
  271. label: "Import Testing",
  272. path: "/settings/m18ImportTesting",
  273. },
  274. ],
  275. },
  276. ];
  277. const { t } = useTranslation("common");
  278. const pathname = usePathname();
  279. const [openItems, setOpenItems] = React.useState<string[]>([]);
  280. const toggleItem = (label: string) => {
  281. setOpenItems((prevOpenItems) =>
  282. prevOpenItems.includes(label)
  283. ? prevOpenItems.filter((item) => item !== label)
  284. : [...prevOpenItems, label],
  285. );
  286. };
  287. const renderNavigationItem = (item: NavigationItem) => {
  288. const isOpen = openItems.includes(item.label);
  289. return (
  290. <Box
  291. key={`${item.label}-${item.path}`}
  292. component={Link}
  293. href={item.path}
  294. sx={{ textDecoration: "none", color: "inherit" }}
  295. >
  296. <ListItemButton
  297. selected={pathname.includes(item.label)}
  298. onClick={() => item.children && toggleItem(item.label)}
  299. >
  300. <ListItemIcon>{item.icon}</ListItemIcon>
  301. <ListItemText primary={t(item.label)} />
  302. </ListItemButton>
  303. {item.children && isOpen && (
  304. <List sx={{ pl: 2 }}>
  305. {item.children.map(
  306. (child) => !child.isHidden && renderNavigationItem(child),
  307. )}
  308. </List>
  309. )}
  310. </Box>
  311. );
  312. };
  313. return (
  314. <Box sx={{ width: NAVIGATION_CONTENT_WIDTH }}>
  315. <Box sx={{ p: 3, display: "flex" }}>
  316. <Logo height={60} />
  317. {/* <button className="float-right bg-transparent border-transparent" >
  318. <ArrowCircleLeftRoundedIcon className="text-slate-400 hover:text-blue-400 hover:cursor-pointer " style={{ fontSize: '35px' }} />
  319. </button> */}
  320. </Box>
  321. <Divider />
  322. <List component="nav">
  323. {navigationItems.map((item) => renderNavigationItem(item))}
  324. {/* {navigationItems.map(({ icon, label, path }, index) => {
  325. return (
  326. <Box
  327. key={`${label}-${index}`}
  328. component={Link}
  329. href={path}
  330. sx={{ textDecoration: "none", color: "inherit" }}
  331. >
  332. <ListItemButton selected={pathname.includes(path)}>
  333. <ListItemIcon>{icon}</ListItemIcon>
  334. <ListItemText primary={t(label)} />
  335. </ListItemButton>
  336. </Box>
  337. );
  338. })} */}
  339. </List>
  340. </Box>
  341. );
  342. };
  343. export default NavigationContent;