From 927485e8d3d818dc9a6c1858db2999efc16a754b Mon Sep 17 00:00:00 2001 From: "B.E.N.S.O.N" Date: Mon, 26 Jan 2026 14:31:54 +0800 Subject: [PATCH] Dashboard Page Update --- .../DashboardPage/DashboardPage.tsx | 109 +++++++++++++----- 1 file changed, 81 insertions(+), 28 deletions(-) diff --git a/src/components/DashboardPage/DashboardPage.tsx b/src/components/DashboardPage/DashboardPage.tsx index 840adcd..c14faf2 100644 --- a/src/components/DashboardPage/DashboardPage.tsx +++ b/src/components/DashboardPage/DashboardPage.tsx @@ -2,23 +2,43 @@ import { useTranslation } from "react-i18next"; import { ThemeProvider } from "@mui/material/styles"; import theme from "../../theme"; -import { TabsProps } from "@mui/material/Tabs"; -import React, { useCallback, useEffect, useState } from "react"; +import React, { useEffect, useState, ReactNode } from "react"; import { useRouter } from "next/navigation"; -import { Card, CardContent, CardHeader, Grid } from "@mui/material"; +import { Card, CardContent, CardHeader, Grid, Tabs, Tab, Box, FormControlLabel, Checkbox } from "@mui/material"; import DashboardProgressChart from "./chart/DashboardProgressChart"; import DashboardLineChart from "./chart/DashboardLineChart"; import PendingInspectionChart from "./chart/PendingInspectionChart"; import PendingStorageChart from "./chart/PendingStorageChart"; import ApplicationCompletionChart from "./chart/ApplicationCompletionChart"; import OrderCompletionChart from "./chart/OrderCompletionChart"; -import DashboardBox from "./Dashboardbox"; -import CollapsibleCard from "../CollapsibleCard"; // import SupervisorQcApproval, { IQCItems } from "./QC/SupervisorQcApproval"; import { EscalationResult } from "@/app/api/escalation"; import EscalationLogTable from "./escalation/EscalationLogTable"; import { TruckScheduleDashboard } from "./truckSchedule"; import { GoodsReceiptStatus } from "./goodsReceiptStatus"; +import { CardFilterContext } from "../CollapsibleCard/CollapsibleCard"; + +interface TabPanelProps { + children?: ReactNode; + index: number; + value: number; +} + +function TabPanel(props: TabPanelProps) { + const { children, value, index, ...other } = props; + + return ( + + ); +} type Props = { // iqc: IQCItems[] | undefined escalationLogs: EscalationResult[] @@ -32,6 +52,8 @@ const DashboardPage: React.FC = ({ const router = useRouter(); const [escLog, setEscLog] = useState([]); + const [currentTab, setCurrentTab] = useState(0); + const [showCompletedLogs, setShowCompletedLogs] = useState(false); const getPendingLog = () => { return escLog.filter(esc => esc.status == "pending"); @@ -41,35 +63,66 @@ const DashboardPage: React.FC = ({ setEscLog(escalationLogs); }, [escalationLogs]) + const handleTabChange = (event: React.SyntheticEvent, newValue: number) => { + setCurrentTab(newValue); + }; + + const handleFilterChange = (checked: boolean) => { + setShowCompletedLogs(checked); + }; + return ( - + + + + + + + 0 ? getPendingLog().length : t("No")})`} + id="dashboard-tab-2" + aria-controls="dashboard-tabpanel-2" + /> + + - + + + + + + + + {} + }}> + + handleFilterChange(e.target.checked)} + /> + } + label={t("show completed logs")} + /> + + + + - - - - - - - - - - - 0 ? getPendingLog().length : t("No")})`} - showFilter={true} - filterText={t("show completed logs")} - - > - - - - + {/* Hidden: Progress chart - not in use currently */} {/*