260625_01_ENH: 연구, 실사 수정사항 적용 1차
This commit is contained in:
@@ -26,7 +26,7 @@ import {StatusPill} from "@/components/gwcf/StatusPill";
|
||||
const today = toLocalDateString();
|
||||
const todayTime = new Date(`${today}T00:00:00`).getTime();
|
||||
|
||||
const toDateTime = (date?: string) => {
|
||||
const toDateTime = (date?: string | null) => {
|
||||
if (!date) return Number.POSITIVE_INFINITY;
|
||||
const time = new Date(`${date}T00:00:00`).getTime();
|
||||
return Number.isNaN(time) ? Number.POSITIVE_INFINITY : time;
|
||||
@@ -78,7 +78,6 @@ const MonitoringPage = () => {
|
||||
const userId = auth.user?.userId;
|
||||
|
||||
const [selectedId, setSelectedId] = useState<number | null>(null);
|
||||
const [detailId, setDetailId] = useState<number | null>(null);
|
||||
const [visitMode, setVisitMode] = useState<"departure" | "arrival">("departure");
|
||||
|
||||
const refreshMonitoringList = () => {
|
||||
@@ -100,11 +99,6 @@ const MonitoringPage = () => {
|
||||
return sortedItems.find((item) => item.id === selectedId) ?? sortedItems[0] ?? null;
|
||||
}, [selectedId, sortedItems]);
|
||||
|
||||
const detailSelected = useMemo(() => {
|
||||
if (!detailId) return null;
|
||||
return sortedItems.find((item) => item.id === detailId) ?? null;
|
||||
}, [detailId, sortedItems]);
|
||||
|
||||
const selectedMonitoringRow = useMemo(() => {
|
||||
if (!selected || !userId) return undefined;
|
||||
return ([0, 1] as const)
|
||||
@@ -114,8 +108,6 @@ const MonitoringPage = () => {
|
||||
const hasDeparture = Boolean(selectedMonitoringRow?.slot.timeline.departure || selectedMonitoringRow?.slot.visit?.length);
|
||||
const hasArrival = Boolean(selectedMonitoringRow?.slot.timeline.arrival);
|
||||
|
||||
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{
|
||||
accessorKey: "performanceName",
|
||||
@@ -146,18 +138,18 @@ const MonitoringPage = () => {
|
||||
{
|
||||
id: "monitoringDate",
|
||||
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate?.slice(5) || "-",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate?.slice(5) ?? "",
|
||||
},
|
||||
{
|
||||
id: "monitoringTime",
|
||||
header: PERFORMANCE_FIELD_LABELS.monitoringTimeInfo,
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo || "-",
|
||||
},
|
||||
], []);
|
||||
], [codes]);
|
||||
|
||||
const visitOpen = isDialogOpen("monitoringVisitDialog");
|
||||
const detailOpen = isDialogOpen("monitoringDetailDialog");
|
||||
const {data: detailData} = usePerformanceDetailQuery(detailId ?? 0, Boolean(detailId && detailOpen));
|
||||
const {data: detailData} = usePerformanceDetailQuery(selectedId ?? 0, Boolean(selectedId && detailOpen));
|
||||
|
||||
const openVisit = (mode: "departure" | "arrival") => {
|
||||
setVisitMode(mode);
|
||||
@@ -261,7 +253,7 @@ const MonitoringPage = () => {
|
||||
{selected && (
|
||||
<section className="rounded-md border">
|
||||
<div className="border-b bg-muted px-3 py-2 text-center font-semibold">
|
||||
{selected.performanceMonitoringSchedule?.monitoringDate} {selected.performanceMonitoringSchedule?.monitoringTimeInfo}
|
||||
{[selected.performanceMonitoringSchedule?.monitoringDate, selected.performanceMonitoringSchedule?.monitoringTimeInfo].filter(Boolean).join(" ")}
|
||||
</div>
|
||||
<div className="grid grid-cols-[80px_1fr] border-b">
|
||||
<div className="bg-muted px-3 py-2 text-sm font-semibold">{PERFORMANCE_FIELD_LABELS.performanceName}</div>
|
||||
@@ -292,7 +284,7 @@ const MonitoringPage = () => {
|
||||
getRowId={(row) => String(row.id)}
|
||||
selectMode="click-event"
|
||||
onRowClick={(item) => {
|
||||
setDetailId(item.id);
|
||||
setSelectedId(item.id);
|
||||
showDialog("monitoringDetailDialog");
|
||||
}}
|
||||
highlightRowIds={selected ? [String(selected.id)] : []}
|
||||
@@ -329,10 +321,9 @@ const MonitoringPage = () => {
|
||||
}
|
||||
|
||||
hideDialog("monitoringDetailDialog");
|
||||
setDetailId(null);
|
||||
refreshMonitoringList();
|
||||
}}
|
||||
performance={detailData ?? detailSelected}
|
||||
performance={detailData ?? selected}
|
||||
codes={codes}
|
||||
userId={userId}
|
||||
/>
|
||||
|
||||
@@ -60,6 +60,7 @@ type PerformanceFilters = {
|
||||
area: string[];
|
||||
startMonth: string[];
|
||||
monitoringDate: string;
|
||||
monitoringAdd: string[];
|
||||
localReviewStatus: string[];
|
||||
monitoring1Status: string[];
|
||||
monitoring2Status: string[];
|
||||
@@ -67,13 +68,39 @@ type PerformanceFilters = {
|
||||
keyword: string;
|
||||
};
|
||||
|
||||
const monthOptions: Code[] = Array.from({length: 12}, (_, index) => ({
|
||||
codeGroup: "month",
|
||||
codeValue: index + 1,
|
||||
codeGroupLabel: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||
codeLabel: `${index + 1}월`,
|
||||
memo: "",
|
||||
}));
|
||||
const monthOptions: Code[] = [
|
||||
{
|
||||
codeGroup: "month",
|
||||
codeValue: 0,
|
||||
codeGroupLabel: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||
codeLabel: `미정`,
|
||||
memo: "",
|
||||
},
|
||||
...Array.from({length: 12}, (_, index) => ({
|
||||
codeGroup: "month",
|
||||
codeValue: index + 1,
|
||||
codeGroupLabel: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||
codeLabel: `${index + 1}월`,
|
||||
memo: "",
|
||||
}))
|
||||
];
|
||||
|
||||
const monitoringAddOptions: Code[] = [
|
||||
{
|
||||
codeGroup: "monitoring_add",
|
||||
codeValue: 0,
|
||||
codeGroupLabel: PERFORMANCE_FIELD_LABELS.monitoringAdd,
|
||||
codeLabel: "추가 모니터링 X",
|
||||
memo: "",
|
||||
},
|
||||
{
|
||||
codeGroup: "monitoring_add",
|
||||
codeValue: 1,
|
||||
codeGroupLabel: PERFORMANCE_FIELD_LABELS.monitoringAdd,
|
||||
codeLabel: "추가 모니터링 O",
|
||||
memo: "",
|
||||
},
|
||||
];
|
||||
|
||||
const PerformancePage = () => {
|
||||
const mounted = useMounted();
|
||||
@@ -101,6 +128,7 @@ const PerformancePage = () => {
|
||||
area: [],
|
||||
startMonth: [],
|
||||
monitoringDate: "",
|
||||
monitoringAdd: [],
|
||||
localReviewStatus: [],
|
||||
monitoring1Status: [],
|
||||
monitoring2Status: [],
|
||||
@@ -191,6 +219,7 @@ const PerformancePage = () => {
|
||||
keyword: filters.keyword,
|
||||
}) &&
|
||||
matchesStatus(filters.startMonth, String(item.performanceStartMonth)) &&
|
||||
matchesStatus(filters.monitoringAdd, item.id % 100 === 1 ? "0" : "1") &&
|
||||
matchesStatus(filters.localReviewStatus, getReviewStatusFilterValue(
|
||||
localReview,
|
||||
getCodeLabel(codes, "review_status", localReview?.reviewStatus),
|
||||
@@ -269,7 +298,7 @@ const PerformancePage = () => {
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<div className="flex min-w-24 justify-center text-xs">
|
||||
<div className="flex justify-center text-xs">
|
||||
<StatusPill
|
||||
variant={display.variant}
|
||||
onClick={onClick}
|
||||
@@ -299,7 +328,7 @@ const PerformancePage = () => {
|
||||
const visitUser = getMonitoringRecordedUser(latestVisit);
|
||||
|
||||
return (
|
||||
<div className="flex min-w-24 justify-center text-xs">
|
||||
<div className="flex justify-center text-xs">
|
||||
<StatusPill
|
||||
variant={display.variant}
|
||||
onClick={isReviewComplete(row.review) ? () => downloadReviewOriginal(performance.id, row.review) : undefined}
|
||||
@@ -319,27 +348,47 @@ const PerformancePage = () => {
|
||||
};
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{accessorKey: "no", header: PERFORMANCE_FIELD_LABELS.no,
|
||||
accessorFn: (row) => row.performanceDetail["performanceNo"] ?? "",
|
||||
cell: ({row}) => row.original.performanceDetail["performanceNo"] ?? "",
|
||||
},
|
||||
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id},
|
||||
{accessorKey: "monitoringAdd", header: PERFORMANCE_FIELD_LABELS.monitoringAdd,
|
||||
accessorFn: (row) => row.id % 100 !== 1? "추가" : "",
|
||||
cell: ({row}) => row.original.id % 100 !== 1? "추가" : "",
|
||||
},
|
||||
{id: "businessType", header: PERFORMANCE_FIELD_LABELS.businessType, cell: ({row}) => getCodeLabel(codes, "business_type", row.original.businessType)},
|
||||
{id: "genre", header: PERFORMANCE_FIELD_LABELS.performanceGenre, cell: ({row}) => getCodeLabel(codes, "genre", row.original.performanceGenre)},
|
||||
{id: "area", header: PERFORMANCE_FIELD_LABELS.performanceArea, cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||
{accessorKey: "artistName", header: PERFORMANCE_FIELD_LABELS.artistName},
|
||||
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName},
|
||||
{id: "startMonth", header: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||
accessorFn: (row) => row.performanceStartMonth ?? 99,
|
||||
cell: ({row}) => `${row.original.performanceStartMonth}월`},
|
||||
accessorFn: (row) => row.performanceStartMonth ?? 0,
|
||||
cell: ({row}) => row.original.performanceStartMonth === 0? "미정":`${row.original.performanceStartMonth}월`},
|
||||
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo, enableSorting: false},
|
||||
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo, enableSorting: false},
|
||||
...(!isWrittenReviewer ? [{
|
||||
id: "monitoringDate",
|
||||
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||
accessorFn: (row) => row.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
} satisfies DataTableColumn<PerformanceFull>] : []),
|
||||
...(!isWrittenReviewer ? [
|
||||
{
|
||||
id: "monitoringDate",
|
||||
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||
accessorFn: (row) => row.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
},
|
||||
{
|
||||
id: "timeTreeCheckDt",
|
||||
header: PERFORMANCE_FIELD_LABELS.timeTreeCheckDt,
|
||||
accessorFn: (row) => row.performanceDetail["timeTreeCheckDt"] ?? "",
|
||||
cell: ({row}) => row.original.performanceDetail["timeTreeCheckDt"] ?? "",
|
||||
}
|
||||
]: []) as DataTableColumn<PerformanceFull>[],
|
||||
{
|
||||
id: "localReview",
|
||||
header: "지자체 평가",
|
||||
cell: ({row}) => {
|
||||
if(row.original.id % 100 !== 1){
|
||||
return "-";
|
||||
}
|
||||
|
||||
const found = getReviewByType(row.original, LOCAL_GOVERNMENT_REVIEW_TYPE);
|
||||
return renderReviewStatus({
|
||||
performance: row.original,
|
||||
@@ -349,13 +398,22 @@ const PerformancePage = () => {
|
||||
noTooltip: isWrittenReviewer,
|
||||
});
|
||||
},
|
||||
size:40,
|
||||
},
|
||||
{id: "monitoring1", header: "모니터링 1", cell: ({row}) => renderMonitoringStatus(row.original, 0)},
|
||||
{id: "monitoring2", header: "모니터링 2", cell: ({row}) => renderMonitoringStatus(row.original, 1)},
|
||||
...(!isWrittenReviewer ? [
|
||||
{id: "monitoring1", header: "모니터링 1", cell: ({row}) => renderMonitoringStatus(row.original, 0), size:40,},
|
||||
{id: "monitoring2", header: "모니터링 2", cell: ({row}) => renderMonitoringStatus(row.original, 1), size:40,},
|
||||
] : [
|
||||
{id: "monitoring", header: "모니터링", cell: ({row}) => renderMonitoringStatus(row.original, 0), size:40,}
|
||||
]) as DataTableColumn<PerformanceFull>[],
|
||||
{
|
||||
id: "writtenReview",
|
||||
header: "서면 평가",
|
||||
cell: ({row}) => {
|
||||
if(row.original.id % 100 !== 1){
|
||||
return "-";
|
||||
}
|
||||
|
||||
const found = getVisibleWrittenReviewRow(row.original);
|
||||
return renderReviewStatus({
|
||||
performance: row.original,
|
||||
@@ -365,6 +423,7 @@ const PerformancePage = () => {
|
||||
alwaysAssigned: Boolean(found?.assign),
|
||||
});
|
||||
},
|
||||
size:40,
|
||||
},
|
||||
], [codes, getVisibleWrittenReviewRow, isWrittenReviewer]);
|
||||
|
||||
@@ -410,7 +469,10 @@ const PerformancePage = () => {
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
<div className="grid gap-2 md:grid-cols-[183px_183px_183px_183px]">
|
||||
<div className="grid gap-2 md:grid-cols-[183px_183px_183px_183px_183px]">
|
||||
{!isWrittenReviewer && (
|
||||
<MultiFilterSelect value={filters.monitoringAdd} onChange={(value) => updateFilters((prev) => ({...prev, monitoringAdd: value}))} options={monitoringAddOptions} placeholder={PERFORMANCE_FIELD_LABELS.monitoringAdd} />
|
||||
)}
|
||||
<MultiFilterSelect value={filters.localReviewStatus} onChange={(value) => updateFilters((prev) => ({...prev, localReviewStatus: value}))} options={localReviewStatusOptions} placeholder="지자체 평가 상태" />
|
||||
<MultiFilterSelect value={filters.monitoring1Status} onChange={(value) => updateFilters((prev) => ({...prev, monitoring1Status: value}))} options={monitoringStatusOptions} placeholder="모니터링1 상태" />
|
||||
<MultiFilterSelect value={filters.monitoring2Status} onChange={(value) => updateFilters((prev) => ({...prev, monitoring2Status: value}))} options={monitoringStatusOptions} placeholder="모니터링2 상태" />
|
||||
@@ -444,6 +506,8 @@ const PerformancePage = () => {
|
||||
selectMode={isWrittenReviewer ? "none" : "click-event"}
|
||||
onRowClick={isWrittenReviewer ? undefined : openDetail}
|
||||
defaultPageSize={10}
|
||||
headerFontClass="content-text-base"
|
||||
cellFontClass="content-text-sm"
|
||||
/>
|
||||
</PagePanel>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createBackApi} from "@/lib/server-api";
|
||||
import {PerformanceCompact} from "@/types/gwcf";
|
||||
import {PerformanceCompact, PerformanceFull} from "@/types/gwcf";
|
||||
|
||||
const ALLOWED_ORIGIN = "https://kon.kric.com";
|
||||
|
||||
@@ -73,6 +73,11 @@ export const POST = async (
|
||||
return withCors(NextResponse.json(result, { status: 200 }));
|
||||
}
|
||||
|
||||
if(action === "performance" && slug.length === 2) {
|
||||
const result = await backApi.get<PerformanceFull>(`/performance/${encodeURIComponent(slug[1])}`)
|
||||
return withCors(NextResponse.json(result, { status: 200 }));
|
||||
}
|
||||
|
||||
if(action === "performance-list") {
|
||||
const result = await backApi.get<PerformanceCompact[]>(`/performance/list/compact`)
|
||||
return withCors(NextResponse.json(result, { status: 200 }));
|
||||
|
||||
@@ -19,10 +19,10 @@ export const GET = async (
|
||||
const [action, second, third, fourth] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "template" && second === "download" && third && slug.length === 3) {
|
||||
if (action === "template" && second === "download" && third && fourth && slug.length === 4) {
|
||||
const cookieStore = await cookies();
|
||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
|
||||
const response = await fetch(`${serverEnv.API_BACK_SERVER.replace(/\/+$/, "")}/review/template/download/${encodeURIComponent(third)}`, {
|
||||
const response = await fetch(`${serverEnv.API_BACK_SERVER.replace(/\/+$/, "")}/review/template/download/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`, {
|
||||
headers: accessToken ? {authorization: `Bearer ${accessToken}`} : undefined,
|
||||
cache: "no-store",
|
||||
});
|
||||
@@ -43,6 +43,21 @@ export const GET = async (
|
||||
});
|
||||
}
|
||||
|
||||
if (action === "template" && second === "pdf" && third && fourth && slug.length === 4) {
|
||||
const result = await backApi.get<ArrayBuffer>(
|
||||
`/review/pdf/download/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
const disposition = req.nextUrl.searchParams.get("disposition") === "inline" ? "inline" : "attachment";
|
||||
return new NextResponse(result, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/pdf",
|
||||
"Content-Disposition": `${disposition}; filename="review-template-${third}-${fourth}.pdf"`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (action === "download" && second && third && fourth && slug.length === 4) {
|
||||
const result = await backApi.get<ArrayBuffer>(
|
||||
`/review/download/${encodeURIComponent(second)}/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`,
|
||||
|
||||
Reference in New Issue
Block a user