Kaynağa Gözat

update escalation

master
cyril.tsui 6 gün önce
ebeveyn
işleme
054b874ba9
4 değiştirilmiş dosya ile 23 ekleme ve 11 silme
  1. +3
    -0
      src/app/(main)/dashboard/page.tsx
  2. +4
    -3
      src/app/api/dashboard/index.ts
  3. +6
    -3
      src/components/DashboardPage/DashboardPage.tsx
  4. +10
    -5
      src/components/DashboardPage/DashboardWrapper.tsx

+ 3
- 0
src/app/(main)/dashboard/page.tsx Dosyayı Görüntüle

@@ -4,6 +4,7 @@ import { Suspense } from "react";
import { getServerI18n } from "@/i18n";
import DashboardPage from "@/components/DashboardPage";
import { SearchParams } from "@/app/utils/fetchUtil";
import { fetchEscalationLogsByUser } from "@/app/api/escalation";

export const metadata: Metadata = {
title: "Dashboard",
@@ -14,6 +15,8 @@ type Props = {} & SearchParams;
const Dashboard: React.FC<Props> = async ({ searchParams }) => {
const { t } = await getServerI18n("dashboard");

fetchEscalationLogsByUser()

return (
<I18nProvider namespaces={["dashboard", "common"]}>
<Suspense fallback={<DashboardPage.Loading />}>


+ 4
- 3
src/app/api/dashboard/index.ts Dosyayı Görüntüle

@@ -84,7 +84,8 @@ export const fetchPoWithStockInLines = cache(async (id: number) => {
});

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;
});

+ 6
- 3
src/components/DashboardPage/DashboardPage.tsx Dosyayı Görüntüle

@@ -15,12 +15,15 @@ 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";
type Props = {
iqc: IQCItems[]
// iqc: IQCItems[] | undefined
escalationLogs: EscalationResult[]
};

const DashboardPage: React.FC<Props> = ({
iqc
// iqc,
escalationLogs
}) => {
const { t } = useTranslation("dashboard");
const router = useRouter();
@@ -31,7 +34,7 @@ const DashboardPage: React.FC<Props> = ({
<Grid item xs={12}>
<CollapsibleCard title={t("stock in escalation list")}>
<CardContent>
<SupervisorQcApproval items={iqc || []}/>
<SupervisorQcApproval items={escalationLogs || []}/>
</CardContent>
</CollapsibleCard>
</Grid>


+ 10
- 5
src/components/DashboardPage/DashboardWrapper.tsx Dosyayı Görüntüle

@@ -4,7 +4,8 @@ import DashboardPage from "./DashboardPage";
import { Typography } from "@mui/material";
import { I18nProvider, getServerI18n } from "@/i18n";
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 = {
// abilities: string[]
@@ -23,16 +24,20 @@ const DashboardWrapper: React.FC<Props> & SubComponents = async ({
}) => {
const { t } = await getServerI18n("dashboard");
// 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 (
<>
<Typography variant="h4">{t("Dashboard")}</Typography>
<DashboardPage
iqc={iqcLog}
escalationLogs={escalationLogs}
// iqc={iqcLog}
// abilities={session ? session?.abilities : []}
/>
</>


Yükleniyor…
İptal
Kaydet