| @@ -4,6 +4,7 @@ import { Suspense } from "react"; | |||||
| import { getServerI18n } from "@/i18n"; | import { getServerI18n } from "@/i18n"; | ||||
| import DashboardPage from "@/components/DashboardPage"; | import DashboardPage from "@/components/DashboardPage"; | ||||
| import { SearchParams } from "@/app/utils/fetchUtil"; | import { SearchParams } from "@/app/utils/fetchUtil"; | ||||
| import { fetchEscalationLogsByUser } from "@/app/api/escalation"; | |||||
| export const metadata: Metadata = { | export const metadata: Metadata = { | ||||
| title: "Dashboard", | title: "Dashboard", | ||||
| @@ -14,6 +15,8 @@ type Props = {} & SearchParams; | |||||
| const Dashboard: React.FC<Props> = async ({ searchParams }) => { | const Dashboard: React.FC<Props> = async ({ searchParams }) => { | ||||
| const { t } = await getServerI18n("dashboard"); | const { t } = await getServerI18n("dashboard"); | ||||
| fetchEscalationLogsByUser() | |||||
| return ( | return ( | ||||
| <I18nProvider namespaces={["dashboard", "common"]}> | <I18nProvider namespaces={["dashboard", "common"]}> | ||||
| <Suspense fallback={<DashboardPage.Loading />}> | <Suspense fallback={<DashboardPage.Loading />}> | ||||
| @@ -84,7 +84,8 @@ export const fetchPoWithStockInLines = cache(async (id: number) => { | |||||
| }); | }); | ||||
| export const fetchIqcLogByUser = cache(async () => { | export const fetchIqcLogByUser = cache(async () => { | ||||
| return serverFetchJson<IQCItems[]>(`${BASE_API_URL}/supervisionApprovalLog/stock-in`, { | |||||
| next: { tags: ["qcLog"] }, | |||||
| }); | |||||
| // return serverFetchJson<IQCItems[]>(`${BASE_API_URL}/supervisionApprovalLog/stock-in`, { | |||||
| // next: { tags: ["qcLog"] }, | |||||
| // }); | |||||
| return undefined; | |||||
| }); | }); | ||||
| @@ -15,12 +15,15 @@ import OrderCompletionChart from "./chart/OrderCompletionChart"; | |||||
| import DashboardBox from "./Dashboardbox"; | import DashboardBox from "./Dashboardbox"; | ||||
| import CollapsibleCard from "./CollapsibleCard"; | import CollapsibleCard from "./CollapsibleCard"; | ||||
| import SupervisorQcApproval, { IQCItems } from "./QC/SupervisorQcApproval"; | import SupervisorQcApproval, { IQCItems } from "./QC/SupervisorQcApproval"; | ||||
| import { EscalationResult } from "@/app/api/escalation"; | |||||
| type Props = { | type Props = { | ||||
| iqc: IQCItems[] | |||||
| // iqc: IQCItems[] | undefined | |||||
| escalationLogs: EscalationResult[] | |||||
| }; | }; | ||||
| const DashboardPage: React.FC<Props> = ({ | const DashboardPage: React.FC<Props> = ({ | ||||
| iqc | |||||
| // iqc, | |||||
| escalationLogs | |||||
| }) => { | }) => { | ||||
| const { t } = useTranslation("dashboard"); | const { t } = useTranslation("dashboard"); | ||||
| const router = useRouter(); | const router = useRouter(); | ||||
| @@ -31,7 +34,7 @@ const DashboardPage: React.FC<Props> = ({ | |||||
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <CollapsibleCard title={t("stock in escalation list")}> | <CollapsibleCard title={t("stock in escalation list")}> | ||||
| <CardContent> | <CardContent> | ||||
| <SupervisorQcApproval items={iqc || []}/> | |||||
| <SupervisorQcApproval items={escalationLogs || []}/> | |||||
| </CardContent> | </CardContent> | ||||
| </CollapsibleCard> | </CollapsibleCard> | ||||
| </Grid> | </Grid> | ||||
| @@ -4,7 +4,8 @@ import DashboardPage from "./DashboardPage"; | |||||
| import { Typography } from "@mui/material"; | import { Typography } from "@mui/material"; | ||||
| import { I18nProvider, getServerI18n } from "@/i18n"; | import { I18nProvider, getServerI18n } from "@/i18n"; | ||||
| import DashboardLoading from "./DashboardLoading"; | import DashboardLoading from "./DashboardLoading"; | ||||
| import { fetchIqcLogByUser } from "@/app/api/dashboard"; | |||||
| import { fetchEscalationLogsByUser } from "@/app/api/escalation"; | |||||
| // import { fetchIqcLogByUser } from "@/app/api/dashboard"; | |||||
| // export type SessionWithAbilities = { | // export type SessionWithAbilities = { | ||||
| // abilities: string[] | // abilities: string[] | ||||
| @@ -23,16 +24,20 @@ const DashboardWrapper: React.FC<Props> & SubComponents = async ({ | |||||
| }) => { | }) => { | ||||
| const { t } = await getServerI18n("dashboard"); | const { t } = await getServerI18n("dashboard"); | ||||
| // const session: SessionWithAbilities = await getServerSession(authOptions) | // const session: SessionWithAbilities = await getServerSession(authOptions) | ||||
| const [iqcLog] = await Promise.all([ | |||||
| fetchIqcLogByUser() | |||||
| // const [iqcLog] = await Promise.all([ | |||||
| // fetchIqcLogByUser() | |||||
| // ]) | |||||
| const [escalationLogs] = await Promise.all([ | |||||
| fetchEscalationLogsByUser() | |||||
| ]) | ]) | ||||
| console.log(iqcLog) | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <Typography variant="h4">{t("Dashboard")}</Typography> | <Typography variant="h4">{t("Dashboard")}</Typography> | ||||
| <DashboardPage | <DashboardPage | ||||
| iqc={iqcLog} | |||||
| escalationLogs={escalationLogs} | |||||
| // iqc={iqcLog} | |||||
| // abilities={session ? session?.abilities : []} | // abilities={session ? session?.abilities : []} | ||||
| /> | /> | ||||
| </> | </> | ||||