260714_01_ENH: 테스트 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
const ContactProgressPage = () => {
|
||||
//const url = buildUrlWithParams("/login", searchParams, { ref: "root" });
|
||||
//redirect(url);
|
||||
'use client'
|
||||
|
||||
return (<div>This is Contact Progress Page</div>)
|
||||
}
|
||||
import { ProgressPageContent } from "@/components/progress/ProgressPageContent";
|
||||
import { ProgressEventType } from "@/types/progress";
|
||||
import { ResultCodeType } from "@/types/project";
|
||||
|
||||
export default ContactProgressPage;
|
||||
const ContactProgressPage = () => (
|
||||
<ProgressPageContent
|
||||
eventTy={ProgressEventType.CONTACT}
|
||||
resultCdTy={ResultCodeType.CONTACT}
|
||||
pageTitle="컨택 현황"
|
||||
domainLabel="컨택"
|
||||
personLabel="컨택인력"
|
||||
/>
|
||||
);
|
||||
|
||||
export default ContactProgressPage;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
const FieldworkProgressPage = () => {
|
||||
//const url = buildUrlWithParams("/login", searchParams, { ref: "root" });
|
||||
//redirect(url);
|
||||
|
||||
return (<div>This is Fieldwork Progress Page</div>)
|
||||
}
|
||||
|
||||
export default FieldworkProgressPage;
|
||||
17
src/app/(pages)/(main)/progress/interview/page.tsx
Normal file
17
src/app/(pages)/(main)/progress/interview/page.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
'use client'
|
||||
|
||||
import { ProgressPageContent } from "@/components/progress/ProgressPageContent";
|
||||
import { ProgressEventType } from "@/types/progress";
|
||||
import { ResultCodeType } from "@/types/project";
|
||||
|
||||
const InterviewProgressPage = () => (
|
||||
<ProgressPageContent
|
||||
eventTy={ProgressEventType.INTERVIEW}
|
||||
resultCdTy={ResultCodeType.INTERVIEW}
|
||||
pageTitle="면접 현황"
|
||||
domainLabel="면접"
|
||||
personLabel="면접원"
|
||||
/>
|
||||
);
|
||||
|
||||
export default InterviewProgressPage;
|
||||
@@ -1,8 +1,151 @@
|
||||
'use client'
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import AppPageTitle from "@/components/app-shell/AppPageTitle";
|
||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||
import KriDateRangePicker from "@/components/common/KriDateRangePicker";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { useSendResultSummaryQuery } from "@/query/message";
|
||||
import { clientEnv } from "@/lib/env.client";
|
||||
import { MessageType } from "@kri/common/noti-hub";
|
||||
import type { SendResultSummaryResponse } from "@kri/common/noti-hub";
|
||||
|
||||
const SEND_TYPE_ORDER = [MessageType.SMS, MessageType.LMS_MMS, MessageType.EMAIL] as const;
|
||||
|
||||
const SEND_TYPE_LABEL: Record<number, string> = {
|
||||
[MessageType.SMS]: "단문",
|
||||
[MessageType.LMS_MMS]: "장문",
|
||||
[MessageType.EMAIL]: "메일",
|
||||
};
|
||||
|
||||
type SummaryRow = {
|
||||
sendTy: number;
|
||||
price: number;
|
||||
totalCount: number;
|
||||
cost: number;
|
||||
successCount: number;
|
||||
failCount: number;
|
||||
standByCount: number;
|
||||
};
|
||||
|
||||
const sum = (list: SendResultSummaryResponse[], field: keyof SendResultSummaryResponse) =>
|
||||
list.reduce((acc, item) => acc + (item[field] as number | undefined ?? 0), 0);
|
||||
|
||||
const buildRows = (data: SendResultSummaryResponse[]): SummaryRow[] =>
|
||||
SEND_TYPE_ORDER.map((sendTy) => {
|
||||
const matched = data.filter((item) => item.sendTy === sendTy);
|
||||
return {
|
||||
sendTy,
|
||||
price: matched[0]?.price ?? 0,
|
||||
totalCount: sum(matched, "totalCount"),
|
||||
cost: sum(matched, "cost"),
|
||||
successCount: sum(matched, "successCount"),
|
||||
failCount: sum(matched, "failCount"),
|
||||
standByCount: sum(matched, "standByCount"),
|
||||
};
|
||||
});
|
||||
|
||||
const moneyUnit = (value: number) => `${value.toLocaleString()}원`;
|
||||
const caseUnit = (value: number) => `${value.toLocaleString()}건`;
|
||||
|
||||
const getFirstDayOfMonth = (date: Date) => {
|
||||
const d = new Date(date.getFullYear(), date.getMonth(), 1);
|
||||
return d.toISOString().slice(0, 10);
|
||||
};
|
||||
|
||||
const getLastDayOfMonth = (date: Date) => {
|
||||
const d = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
||||
return d.toISOString().slice(0, 10);
|
||||
};
|
||||
|
||||
const MessageProgressPage = () => {
|
||||
//const url = buildUrlWithParams("/login", searchParams, { ref: "root" });
|
||||
//redirect(url);
|
||||
const mounted = useMounted();
|
||||
const { selectedProject } = useSelectedProject();
|
||||
|
||||
return (<div>This is Message Progress Page</div>)
|
||||
}
|
||||
const [dateRange, setDateRange] = useState(() => {
|
||||
const now = new Date();
|
||||
return { from: getFirstDayOfMonth(now), to: getLastDayOfMonth(now) };
|
||||
});
|
||||
|
||||
export default MessageProgressPage;
|
||||
const prjctCd = selectedProject?.prjctCd ?? "";
|
||||
const itrntPrjctCd = selectedProject?.itrntPrjctCd ?? "";
|
||||
const enabled = mounted && !!prjctCd && !!dateRange.from && !!dateRange.to;
|
||||
|
||||
const summaryQuery = useSendResultSummaryQuery(
|
||||
{
|
||||
reqstSvc: clientEnv.REQUEST_SVC,
|
||||
itrntPrjctCd,
|
||||
prjctCd,
|
||||
sendStartDt: dateRange.from ? `${dateRange.from}T00:00:00` : undefined,
|
||||
sendEndDt: dateRange.to ? `${dateRange.to}T23:59:59` : undefined,
|
||||
},
|
||||
enabled,
|
||||
);
|
||||
|
||||
const rows = useMemo(() => buildRows(summaryQuery.data ?? []), [summaryQuery.data]);
|
||||
|
||||
const total = useMemo(
|
||||
() => ({
|
||||
totalCount: rows.reduce((acc, row) => acc + row.totalCount, 0),
|
||||
cost: rows.reduce((acc, row) => acc + row.cost, 0),
|
||||
successCount: rows.reduce((acc, row) => acc + row.successCount, 0),
|
||||
failCount: rows.reduce((acc, row) => acc + row.failCount, 0),
|
||||
standByCount: rows.reduce((acc, row) => acc + row.standByCount, 0),
|
||||
}),
|
||||
[rows],
|
||||
);
|
||||
|
||||
if (!mounted) return <LoadingOverlayAdapter force />;
|
||||
|
||||
return (
|
||||
<div className="space-y-6 text-sm">
|
||||
<AppPageTitle titleText="발송 현황" />
|
||||
|
||||
<KriDateRangePicker value={dateRange} onChange={setDateRange} className="w-80" />
|
||||
|
||||
<div className="rounded-md border overflow-hidden">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-blue-50">
|
||||
<tr>
|
||||
<th className="h-10 px-3 text-center font-semibold border-b">유형</th>
|
||||
<th className="h-10 px-3 text-center font-semibold border-b">단가</th>
|
||||
<th className="h-10 px-3 text-center font-semibold border-b">대상수</th>
|
||||
<th className="h-10 px-3 text-center font-semibold border-b">비용</th>
|
||||
<th className="h-10 px-3 text-center font-semibold border-b">성공</th>
|
||||
<th className="h-10 px-3 text-center font-semibold border-b">실패</th>
|
||||
<th className="h-10 px-3 text-center font-semibold border-b">발송중</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row) => (
|
||||
<tr key={row.sendTy} className="border-b last:border-b-0">
|
||||
<td className="h-10 px-3 text-center">{SEND_TYPE_LABEL[row.sendTy]}</td>
|
||||
<td className="h-10 px-3 text-center">{moneyUnit(row.price)}</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(row.totalCount)}</td>
|
||||
<td className="h-10 px-3 text-center">{moneyUnit(row.cost)}</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(row.successCount)}</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(row.failCount)}</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(row.standByCount)}</td>
|
||||
</tr>
|
||||
))}
|
||||
<tr className="bg-gray-50 font-semibold">
|
||||
<td className="h-10 px-3 text-center" colSpan={2}>합계</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(total.totalCount)}</td>
|
||||
<td className="h-10 px-3 text-center">{moneyUnit(total.cost)}</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(total.successCount)}</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(total.failCount)}</td>
|
||||
<td className="h-10 px-3 text-center">{caseUnit(total.standByCount)}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p className="text-xs text-muted-foreground">
|
||||
※ 보낸 내역을 토대로 계산된 값으로 실제 정산 금액과 차이가 발생할 수 있습니다.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MessageProgressPage;
|
||||
|
||||
68
src/app/(pages)/(main)/progress/survey/page.tsx
Normal file
68
src/app/(pages)/(main)/progress/survey/page.tsx
Normal file
@@ -0,0 +1,68 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import AppPageTitle from "@/components/app-shell/AppPageTitle";
|
||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { useProjectInfoQuery, useSurveyRedirectUrlQuery } from "@/query/project";
|
||||
import { SurveyType } from "@/types/project";
|
||||
|
||||
const SurveyProgressPage = () => {
|
||||
const mounted = useMounted();
|
||||
const { selectedProject } = useSelectedProject();
|
||||
const openedRef = useRef(false);
|
||||
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0;
|
||||
const enabled = mounted && prjctIdx > 0;
|
||||
|
||||
const projectInfoQuery = useProjectInfoQuery(prjctIdx, enabled);
|
||||
const projectInfo = projectInfoQuery.data;
|
||||
const surveyTy = projectInfo?.surveyTy ?? SurveyType.NONE;
|
||||
|
||||
const isKonKiwi = surveyTy === SurveyType.KON || surveyTy === SurveyType.KIWI;
|
||||
const isKiwi = surveyTy === SurveyType.KIWI ? 1 : 0;
|
||||
const pkey = projectInfo?.surveyPrjctCd ?? "";
|
||||
|
||||
const redirectUrlEnabled = enabled && !!projectInfo && isKonKiwi && !!pkey;
|
||||
const redirectUrlQuery = useSurveyRedirectUrlQuery(isKiwi, pkey, redirectUrlEnabled);
|
||||
|
||||
const targetUrl = isKonKiwi
|
||||
? (redirectUrlQuery.data ?? null)
|
||||
: surveyTy === SurveyType.EXTERNAL
|
||||
? (projectInfo?.surveyDashboardUrl || null)
|
||||
: null;
|
||||
|
||||
useEffect(() => {
|
||||
if (openedRef.current || !targetUrl) return;
|
||||
openedRef.current = true;
|
||||
window.open(targetUrl, "_blank");
|
||||
}, [targetUrl]);
|
||||
|
||||
const isLoading = !mounted || projectInfoQuery.isLoading || (redirectUrlEnabled && redirectUrlQuery.isLoading);
|
||||
|
||||
if (isLoading) return <LoadingOverlayAdapter force />;
|
||||
|
||||
if (targetUrl) {
|
||||
return (
|
||||
<div className="space-y-6 text-sm">
|
||||
<AppPageTitle titleText="설문 현황" />
|
||||
<p>
|
||||
새 창에서 열립니다. 열리지 않았다면{" "}
|
||||
<a href={targetUrl} target="_blank" rel="noreferrer" className="text-blue-600 underline">
|
||||
여기
|
||||
</a>
|
||||
를 클릭해 주세요.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6 text-sm">
|
||||
<AppPageTitle titleText="연결 가능한 현황이 없습니다." />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SurveyProgressPage;
|
||||
Reference in New Issue
Block a user