Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 

197 рядки
6.9 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 Team from '@mui/icons-material/Paragliding';
  26. import { useTranslation } from "react-i18next";
  27. import Typography from "@mui/material/Typography";
  28. import { usePathname } from "next/navigation";
  29. import Link from "next/link";
  30. import { NAVIGATION_CONTENT_WIDTH } from "@/config/uiConfig";
  31. import Logo from "../Logo";
  32. import GroupIcon from '@mui/icons-material/Group';
  33. import BusinessIcon from '@mui/icons-material/Business';
  34. interface NavigationItem {
  35. icon: React.ReactNode;
  36. label: string;
  37. path: string;
  38. children?: NavigationItem[];
  39. }
  40. const navigationItems: NavigationItem[] = [
  41. { icon: <WorkHistory />, label: "User Workspace", path: "/home" },
  42. {
  43. icon: <Dashboard />,
  44. label: "Dashboard",
  45. path: "",
  46. children: [
  47. {
  48. icon: <SummarizeIcon />,
  49. label: "Financial Summary",
  50. path: "/dashboard/ProjectFinancialSummary",
  51. },
  52. {
  53. icon: <PaymentsIcon />,
  54. label: "Company / Team Cash Flow",
  55. path: "/dashboard/CompanyTeamCashFlow",
  56. },
  57. {
  58. icon: <PaymentsIcon />,
  59. label: "Project Cash Flow",
  60. path: "/dashboard/ProjectCashFlow",
  61. },
  62. {
  63. icon: <AccountTreeIcon />,
  64. label: "Project Status by Client",
  65. path: "/dashboard/ProjectStatusByClient",
  66. },
  67. {
  68. icon: <AccountTreeIcon />,
  69. label: "Project Status by Team",
  70. path: "/dashboard/ProjectStatusByTeam",
  71. },
  72. {
  73. icon: <PeopleIcon />,
  74. label: "Staff Utilization",
  75. path: "/dashboard/StaffUtilization",
  76. },
  77. ],
  78. },
  79. {
  80. icon: <RequestQuote />,
  81. label: "Staff Reimbursement",
  82. path: "/staffReimbursement",
  83. children: [
  84. {
  85. icon: <RequestQuote />,
  86. label: "Claim Approval",
  87. path: "/staffReimbursement/ClaimApproval",
  88. },
  89. {
  90. icon: <RequestQuote />,
  91. label: "Claim Summary",
  92. path: "/staffReimbursement/ClaimSummary",
  93. },
  94. ],
  95. },
  96. { icon: <Assignment />, label: "Project Management", path: "/projects" },
  97. { icon: <Task />, label: "Task Template", path: "/tasks" },
  98. { icon: <Payments />, label: "Invoice", path: "/invoice" },
  99. { icon: <Analytics />, label: "Analysis Report", path: "",
  100. children: [
  101. {icon: <Analytics />, label:"Late Start Report", path: "/analytics/LateStartReport"},
  102. {icon: <Analytics />, label:"Delay Report", path: "/analytics/DelayReport"},
  103. {icon: <Analytics />, label:"Resource Overconsumption Report", path: "/analytics/ResourceOverconsumptionReport"},
  104. {icon: <Analytics />, label:"Cost and Expense Report", path: "/analytics/CostandExpenseReport"},
  105. {icon: <Analytics />, label:"Completion Report", path: "/analytics/ProjectCompletionReport"},
  106. {icon: <Analytics />, label:"Completion Report with Outstanding Un-billed Hours Report", path: "/analytics/ProjectCompletionReportWO"},
  107. ],
  108. },
  109. {
  110. icon: <Settings />, label: "Setting", path: "",
  111. children: [
  112. { icon: <GroupIcon />, label: "Client", path: "/settings/customer" },
  113. { icon: <BusinessIcon />, label: "Subsidiary", path: "/settings/subsidiary" },
  114. { icon: <Staff />, label: "Staff", path: "/settings/staff" },
  115. { icon: <Company />, label: "Company", path: "/settings/company" },
  116. { icon: <Department />, label: "Department", path: "/settings/department" },
  117. { icon: <Position />, label: "Position", path: "/settings/position" },
  118. { icon: <Salary />, label: "Salary", path: "/settings/salary" },
  119. { icon: <Team />, label: "Team", path: "/settings/team" },
  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;