25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

197 lines
7.0 KiB

  1. import Divider from "@mui/material/Divider";
  2. import Box from "@mui/material/Box";
  3. import React 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 Staff from "@mui/icons-material/PeopleAlt";
  21. import Company from '@mui/icons-material/Store';
  22. import Department from '@mui/icons-material/Diversity3';
  23. import Position from '@mui/icons-material/Paragliding';
  24. import Salary from '@mui/icons-material/AttachMoney';
  25. import { useTranslation } from "react-i18next";
  26. import Typography from "@mui/material/Typography";
  27. import { usePathname } from "next/navigation";
  28. import Link from "next/link";
  29. import { NAVIGATION_CONTENT_WIDTH } from "@/config/uiConfig";
  30. import Logo from "../Logo";
  31. import GroupIcon from '@mui/icons-material/Group';
  32. import BusinessIcon from '@mui/icons-material/Business';
  33. interface NavigationItem {
  34. icon: React.ReactNode;
  35. label: string;
  36. path: string;
  37. children?: NavigationItem[];
  38. }
  39. const navigationItems: NavigationItem[] = [
  40. { icon: <WorkHistory />, label: "User Workspace", path: "/home" },
  41. {
  42. icon: <Dashboard />,
  43. label: "Dashboard",
  44. path: "",
  45. children: [
  46. {
  47. icon: <SummarizeIcon />,
  48. label: "Financial Summary",
  49. path: "/dashboard/ProjectFinancialSummary",
  50. },
  51. {
  52. icon: <PaymentsIcon />,
  53. label: "Company / Team Cash Flow",
  54. path: "/dashboard/CompanyTeamCashFlow",
  55. },
  56. {
  57. icon: <PaymentsIcon />,
  58. label: "Project Cash Flow",
  59. path: "/dashboard/ProjectCashFlow",
  60. },
  61. {
  62. icon: <AccountTreeIcon />,
  63. label: "Project Status by Client",
  64. path: "/dashboard/ProjectStatusByClient",
  65. },
  66. {
  67. icon: <AccountTreeIcon />,
  68. label: "Project Status by Team",
  69. path: "/dashboard/ProjectStatusByTeam",
  70. },
  71. {
  72. icon: <PeopleIcon />,
  73. label: "Staff Utilization",
  74. path: "/dashboard/StaffUtilization",
  75. },
  76. ],
  77. },
  78. {
  79. icon: <RequestQuote />,
  80. label: "Staff Reimbursement",
  81. path: "/staffReimbursement",
  82. children: [
  83. {
  84. icon: <RequestQuote />,
  85. label: "Claim Approval",
  86. path: "/staffReimbursement/ClaimApproval",
  87. },
  88. {
  89. icon: <RequestQuote />,
  90. label: "Claim Summary",
  91. path: "/staffReimbursement/ClaimSummary",
  92. },
  93. ],
  94. },
  95. { icon: <Assignment />, label: "Project Management", path: "/projects" },
  96. { icon: <Task />, label: "Task Template", path: "/tasks" },
  97. { icon: <Payments />, label: "Invoice", path: "/invoice" },
  98. { icon: <Analytics />, label: "Analysis Report", path: "",
  99. children: [
  100. {icon: <Analytics />, label:"Late Start Report", path: "/analytics/LateStartReport"},
  101. {icon: <Analytics />, label:"Delay Report", path: "/analytics/DelayReport"},
  102. {icon: <Analytics />, label:"Resource Overconsumption Report", path: "/analytics/ResourceOverconsumptionReport"},
  103. {icon: <Analytics />, label:"Cost and Expense Report", path: "/analytics/CostandExpenseReport"},
  104. {icon: <Analytics />, label:"Completion Report", path: "/analytics/ProjectCompletionReport"},
  105. {icon: <Analytics />, label:"Completion Report with Outstanding Un-billed Hours Report", path: "/analytics/ProjectCompletionReportWO"},
  106. {icon: <Analytics />, label:"Project Claims Report", path: "/analytics/ProjectClaimsReport"},
  107. {icon: <Analytics />, label:"Project P&L Report", path: "/analytics/ProjectPLReport"},
  108. ],
  109. },
  110. {
  111. icon: <Settings />, label: "Setting", path: "",
  112. children: [
  113. { icon: <GroupIcon />, label: "Client", path: "/settings/customer" },
  114. { icon: <BusinessIcon />, label: "Subsidiary", path: "/settings/subsidiary" },
  115. { icon: <Staff />, label: "Staff", path: "/settings/staff" },
  116. { icon: <Company />, label: "Company", path: "/settings/company" },
  117. { icon: <Department />, label: "Department", path: "/settings/department" },
  118. { icon: <Position />, label: "Position", path: "/settings/position" },
  119. { icon: <Salary />, label: "Salary", path: "/settings/salary" },
  120. ],
  121. },
  122. ];
  123. const NavigationContent: React.FC = () => {
  124. const { t } = useTranslation("common");
  125. const pathname = usePathname();
  126. const [openItems, setOpenItems] = React.useState<string[]>([]);
  127. const toggleItem = (label: string) => {
  128. setOpenItems((prevOpenItems) =>
  129. prevOpenItems.includes(label)
  130. ? prevOpenItems.filter((item) => item !== label)
  131. : [...prevOpenItems, label],
  132. );
  133. };
  134. const renderNavigationItem = (item: NavigationItem) => {
  135. const isOpen = openItems.includes(item.label);
  136. return (
  137. <Box
  138. key={`${item.label}-${item.path}`}
  139. component={Link}
  140. href={item.path}
  141. sx={{ textDecoration: "none", color: "inherit" }}
  142. >
  143. <ListItemButton
  144. selected={pathname.includes(item.label)}
  145. onClick={() => item.children && toggleItem(item.label)}
  146. >
  147. <ListItemIcon>{item.icon}</ListItemIcon>
  148. <ListItemText primary={t(item.label)} />
  149. </ListItemButton>
  150. {item.children && isOpen && (
  151. <List sx={{ pl: 2 }}>
  152. {item.children.map((child) => renderNavigationItem(child))}
  153. </List>
  154. )}
  155. </Box>
  156. );
  157. };
  158. return (
  159. <Box sx={{ width: NAVIGATION_CONTENT_WIDTH }}>
  160. <Box sx={{ p: 3, display: "flex" }}>
  161. <Logo height={60} />
  162. {/* <button className="float-right bg-transparent border-transparent" >
  163. <ArrowCircleLeftRoundedIcon className="text-slate-400 hover:text-blue-400 hover:cursor-pointer " style={{ fontSize: '35px' }} />
  164. </button> */}
  165. </Box>
  166. <Divider />
  167. <List component="nav">
  168. {navigationItems.map((item) => renderNavigationItem(item))}
  169. {/* {navigationItems.map(({ icon, label, path }, index) => {
  170. return (
  171. <Box
  172. key={`${label}-${index}`}
  173. component={Link}
  174. href={path}
  175. sx={{ textDecoration: "none", color: "inherit" }}
  176. >
  177. <ListItemButton selected={pathname.includes(path)}>
  178. <ListItemIcon>{icon}</ListItemIcon>
  179. <ListItemText primary={t(label)} />
  180. </ListItemButton>
  181. </Box>
  182. );
  183. })} */}
  184. </List>
  185. </Box>
  186. );
  187. };
  188. export default NavigationContent;