Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

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