260625_01_ENH: 연구, 실사 수정사항 적용 1차
This commit is contained in:
@@ -26,7 +26,7 @@ import {StatusPill} from "@/components/gwcf/StatusPill";
|
|||||||
const today = toLocalDateString();
|
const today = toLocalDateString();
|
||||||
const todayTime = new Date(`${today}T00:00:00`).getTime();
|
const todayTime = new Date(`${today}T00:00:00`).getTime();
|
||||||
|
|
||||||
const toDateTime = (date?: string) => {
|
const toDateTime = (date?: string | null) => {
|
||||||
if (!date) return Number.POSITIVE_INFINITY;
|
if (!date) return Number.POSITIVE_INFINITY;
|
||||||
const time = new Date(`${date}T00:00:00`).getTime();
|
const time = new Date(`${date}T00:00:00`).getTime();
|
||||||
return Number.isNaN(time) ? Number.POSITIVE_INFINITY : time;
|
return Number.isNaN(time) ? Number.POSITIVE_INFINITY : time;
|
||||||
@@ -78,7 +78,6 @@ const MonitoringPage = () => {
|
|||||||
const userId = auth.user?.userId;
|
const userId = auth.user?.userId;
|
||||||
|
|
||||||
const [selectedId, setSelectedId] = useState<number | null>(null);
|
const [selectedId, setSelectedId] = useState<number | null>(null);
|
||||||
const [detailId, setDetailId] = useState<number | null>(null);
|
|
||||||
const [visitMode, setVisitMode] = useState<"departure" | "arrival">("departure");
|
const [visitMode, setVisitMode] = useState<"departure" | "arrival">("departure");
|
||||||
|
|
||||||
const refreshMonitoringList = () => {
|
const refreshMonitoringList = () => {
|
||||||
@@ -100,11 +99,6 @@ const MonitoringPage = () => {
|
|||||||
return sortedItems.find((item) => item.id === selectedId) ?? sortedItems[0] ?? null;
|
return sortedItems.find((item) => item.id === selectedId) ?? sortedItems[0] ?? null;
|
||||||
}, [selectedId, sortedItems]);
|
}, [selectedId, sortedItems]);
|
||||||
|
|
||||||
const detailSelected = useMemo(() => {
|
|
||||||
if (!detailId) return null;
|
|
||||||
return sortedItems.find((item) => item.id === detailId) ?? null;
|
|
||||||
}, [detailId, sortedItems]);
|
|
||||||
|
|
||||||
const selectedMonitoringRow = useMemo(() => {
|
const selectedMonitoringRow = useMemo(() => {
|
||||||
if (!selected || !userId) return undefined;
|
if (!selected || !userId) return undefined;
|
||||||
return ([0, 1] as const)
|
return ([0, 1] as const)
|
||||||
@@ -114,8 +108,6 @@ const MonitoringPage = () => {
|
|||||||
const hasDeparture = Boolean(selectedMonitoringRow?.slot.timeline.departure || selectedMonitoringRow?.slot.visit?.length);
|
const hasDeparture = Boolean(selectedMonitoringRow?.slot.timeline.departure || selectedMonitoringRow?.slot.visit?.length);
|
||||||
const hasArrival = Boolean(selectedMonitoringRow?.slot.timeline.arrival);
|
const hasArrival = Boolean(selectedMonitoringRow?.slot.timeline.arrival);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||||
{
|
{
|
||||||
accessorKey: "performanceName",
|
accessorKey: "performanceName",
|
||||||
@@ -146,18 +138,18 @@ const MonitoringPage = () => {
|
|||||||
{
|
{
|
||||||
id: "monitoringDate",
|
id: "monitoringDate",
|
||||||
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate?.slice(5) || "-",
|
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate?.slice(5) ?? "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "monitoringTime",
|
id: "monitoringTime",
|
||||||
header: PERFORMANCE_FIELD_LABELS.monitoringTimeInfo,
|
header: PERFORMANCE_FIELD_LABELS.monitoringTimeInfo,
|
||||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo || "-",
|
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo || "-",
|
||||||
},
|
},
|
||||||
], []);
|
], [codes]);
|
||||||
|
|
||||||
const visitOpen = isDialogOpen("monitoringVisitDialog");
|
const visitOpen = isDialogOpen("monitoringVisitDialog");
|
||||||
const detailOpen = isDialogOpen("monitoringDetailDialog");
|
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") => {
|
const openVisit = (mode: "departure" | "arrival") => {
|
||||||
setVisitMode(mode);
|
setVisitMode(mode);
|
||||||
@@ -261,7 +253,7 @@ const MonitoringPage = () => {
|
|||||||
{selected && (
|
{selected && (
|
||||||
<section className="rounded-md border">
|
<section className="rounded-md border">
|
||||||
<div className="border-b bg-muted px-3 py-2 text-center font-semibold">
|
<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>
|
||||||
<div className="grid grid-cols-[80px_1fr] border-b">
|
<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>
|
<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)}
|
getRowId={(row) => String(row.id)}
|
||||||
selectMode="click-event"
|
selectMode="click-event"
|
||||||
onRowClick={(item) => {
|
onRowClick={(item) => {
|
||||||
setDetailId(item.id);
|
setSelectedId(item.id);
|
||||||
showDialog("monitoringDetailDialog");
|
showDialog("monitoringDetailDialog");
|
||||||
}}
|
}}
|
||||||
highlightRowIds={selected ? [String(selected.id)] : []}
|
highlightRowIds={selected ? [String(selected.id)] : []}
|
||||||
@@ -329,10 +321,9 @@ const MonitoringPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hideDialog("monitoringDetailDialog");
|
hideDialog("monitoringDetailDialog");
|
||||||
setDetailId(null);
|
|
||||||
refreshMonitoringList();
|
refreshMonitoringList();
|
||||||
}}
|
}}
|
||||||
performance={detailData ?? detailSelected}
|
performance={detailData ?? selected}
|
||||||
codes={codes}
|
codes={codes}
|
||||||
userId={userId}
|
userId={userId}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ type PerformanceFilters = {
|
|||||||
area: string[];
|
area: string[];
|
||||||
startMonth: string[];
|
startMonth: string[];
|
||||||
monitoringDate: string;
|
monitoringDate: string;
|
||||||
|
monitoringAdd: string[];
|
||||||
localReviewStatus: string[];
|
localReviewStatus: string[];
|
||||||
monitoring1Status: string[];
|
monitoring1Status: string[];
|
||||||
monitoring2Status: string[];
|
monitoring2Status: string[];
|
||||||
@@ -67,13 +68,39 @@ type PerformanceFilters = {
|
|||||||
keyword: string;
|
keyword: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const monthOptions: Code[] = Array.from({length: 12}, (_, index) => ({
|
const monthOptions: Code[] = [
|
||||||
codeGroup: "month",
|
{
|
||||||
codeValue: index + 1,
|
codeGroup: "month",
|
||||||
codeGroupLabel: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
codeValue: 0,
|
||||||
codeLabel: `${index + 1}월`,
|
codeGroupLabel: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||||
memo: "",
|
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 PerformancePage = () => {
|
||||||
const mounted = useMounted();
|
const mounted = useMounted();
|
||||||
@@ -101,6 +128,7 @@ const PerformancePage = () => {
|
|||||||
area: [],
|
area: [],
|
||||||
startMonth: [],
|
startMonth: [],
|
||||||
monitoringDate: "",
|
monitoringDate: "",
|
||||||
|
monitoringAdd: [],
|
||||||
localReviewStatus: [],
|
localReviewStatus: [],
|
||||||
monitoring1Status: [],
|
monitoring1Status: [],
|
||||||
monitoring2Status: [],
|
monitoring2Status: [],
|
||||||
@@ -191,6 +219,7 @@ const PerformancePage = () => {
|
|||||||
keyword: filters.keyword,
|
keyword: filters.keyword,
|
||||||
}) &&
|
}) &&
|
||||||
matchesStatus(filters.startMonth, String(item.performanceStartMonth)) &&
|
matchesStatus(filters.startMonth, String(item.performanceStartMonth)) &&
|
||||||
|
matchesStatus(filters.monitoringAdd, item.id % 100 === 1 ? "0" : "1") &&
|
||||||
matchesStatus(filters.localReviewStatus, getReviewStatusFilterValue(
|
matchesStatus(filters.localReviewStatus, getReviewStatusFilterValue(
|
||||||
localReview,
|
localReview,
|
||||||
getCodeLabel(codes, "review_status", localReview?.reviewStatus),
|
getCodeLabel(codes, "review_status", localReview?.reviewStatus),
|
||||||
@@ -269,7 +298,7 @@ const PerformancePage = () => {
|
|||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-24 justify-center text-xs">
|
<div className="flex justify-center text-xs">
|
||||||
<StatusPill
|
<StatusPill
|
||||||
variant={display.variant}
|
variant={display.variant}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
@@ -299,7 +328,7 @@ const PerformancePage = () => {
|
|||||||
const visitUser = getMonitoringRecordedUser(latestVisit);
|
const visitUser = getMonitoringRecordedUser(latestVisit);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-24 justify-center text-xs">
|
<div className="flex justify-center text-xs">
|
||||||
<StatusPill
|
<StatusPill
|
||||||
variant={display.variant}
|
variant={display.variant}
|
||||||
onClick={isReviewComplete(row.review) ? () => downloadReviewOriginal(performance.id, row.review) : undefined}
|
onClick={isReviewComplete(row.review) ? () => downloadReviewOriginal(performance.id, row.review) : undefined}
|
||||||
@@ -319,27 +348,47 @@ const PerformancePage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
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: "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: "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: "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)},
|
{id: "area", header: PERFORMANCE_FIELD_LABELS.performanceArea, cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||||
{accessorKey: "artistName", header: PERFORMANCE_FIELD_LABELS.artistName},
|
{accessorKey: "artistName", header: PERFORMANCE_FIELD_LABELS.artistName},
|
||||||
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName},
|
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName},
|
||||||
{id: "startMonth", header: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
{id: "startMonth", header: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||||
accessorFn: (row) => row.performanceStartMonth ?? 99,
|
accessorFn: (row) => row.performanceStartMonth ?? 0,
|
||||||
cell: ({row}) => `${row.original.performanceStartMonth}월`},
|
cell: ({row}) => row.original.performanceStartMonth === 0? "미정":`${row.original.performanceStartMonth}월`},
|
||||||
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo, enableSorting: false},
|
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo, enableSorting: false},
|
||||||
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo, enableSorting: false},
|
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo, enableSorting: false},
|
||||||
...(!isWrittenReviewer ? [{
|
...(!isWrittenReviewer ? [
|
||||||
id: "monitoringDate",
|
{
|
||||||
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
id: "monitoringDate",
|
||||||
accessorFn: (row) => row.performanceMonitoringSchedule?.monitoringDate ?? "",
|
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
accessorFn: (row) => row.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||||
} satisfies DataTableColumn<PerformanceFull>] : []),
|
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",
|
id: "localReview",
|
||||||
header: "지자체 평가",
|
header: "지자체 평가",
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
|
if(row.original.id % 100 !== 1){
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
|
||||||
const found = getReviewByType(row.original, LOCAL_GOVERNMENT_REVIEW_TYPE);
|
const found = getReviewByType(row.original, LOCAL_GOVERNMENT_REVIEW_TYPE);
|
||||||
return renderReviewStatus({
|
return renderReviewStatus({
|
||||||
performance: row.original,
|
performance: row.original,
|
||||||
@@ -349,13 +398,22 @@ const PerformancePage = () => {
|
|||||||
noTooltip: isWrittenReviewer,
|
noTooltip: isWrittenReviewer,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
size:40,
|
||||||
},
|
},
|
||||||
{id: "monitoring1", header: "모니터링 1", cell: ({row}) => renderMonitoringStatus(row.original, 0)},
|
...(!isWrittenReviewer ? [
|
||||||
{id: "monitoring2", header: "모니터링 2", cell: ({row}) => renderMonitoringStatus(row.original, 1)},
|
{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",
|
id: "writtenReview",
|
||||||
header: "서면 평가",
|
header: "서면 평가",
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
|
if(row.original.id % 100 !== 1){
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
|
||||||
const found = getVisibleWrittenReviewRow(row.original);
|
const found = getVisibleWrittenReviewRow(row.original);
|
||||||
return renderReviewStatus({
|
return renderReviewStatus({
|
||||||
performance: row.original,
|
performance: row.original,
|
||||||
@@ -365,6 +423,7 @@ const PerformancePage = () => {
|
|||||||
alwaysAssigned: Boolean(found?.assign),
|
alwaysAssigned: Boolean(found?.assign),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
size:40,
|
||||||
},
|
},
|
||||||
], [codes, getVisibleWrittenReviewRow, isWrittenReviewer]);
|
], [codes, getVisibleWrittenReviewRow, isWrittenReviewer]);
|
||||||
|
|
||||||
@@ -410,7 +469,10 @@ const PerformancePage = () => {
|
|||||||
검색
|
검색
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</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.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.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 상태" />
|
<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"}
|
selectMode={isWrittenReviewer ? "none" : "click-event"}
|
||||||
onRowClick={isWrittenReviewer ? undefined : openDetail}
|
onRowClick={isWrittenReviewer ? undefined : openDetail}
|
||||||
defaultPageSize={10}
|
defaultPageSize={10}
|
||||||
|
headerFontClass="content-text-base"
|
||||||
|
cellFontClass="content-text-sm"
|
||||||
/>
|
/>
|
||||||
</PagePanel>
|
</PagePanel>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {NextRequest, NextResponse} from "next/server";
|
|||||||
import {RouteContext} from "@/types/common";
|
import {RouteContext} from "@/types/common";
|
||||||
import {errorToResponse} from "@/lib/http-util";
|
import {errorToResponse} from "@/lib/http-util";
|
||||||
import {createBackApi} from "@/lib/server-api";
|
import {createBackApi} from "@/lib/server-api";
|
||||||
import {PerformanceCompact} from "@/types/gwcf";
|
import {PerformanceCompact, PerformanceFull} from "@/types/gwcf";
|
||||||
|
|
||||||
const ALLOWED_ORIGIN = "https://kon.kric.com";
|
const ALLOWED_ORIGIN = "https://kon.kric.com";
|
||||||
|
|
||||||
@@ -73,6 +73,11 @@ export const POST = async (
|
|||||||
return withCors(NextResponse.json(result, { status: 200 }));
|
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") {
|
if(action === "performance-list") {
|
||||||
const result = await backApi.get<PerformanceCompact[]>(`/performance/list/compact`)
|
const result = await backApi.get<PerformanceCompact[]>(`/performance/list/compact`)
|
||||||
return withCors(NextResponse.json(result, { status: 200 }));
|
return withCors(NextResponse.json(result, { status: 200 }));
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ export const GET = async (
|
|||||||
const [action, second, third, fourth] = slug;
|
const [action, second, third, fourth] = slug;
|
||||||
const backApi = await createBackApi();
|
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 cookieStore = await cookies();
|
||||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
|
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,
|
headers: accessToken ? {authorization: `Bearer ${accessToken}`} : undefined,
|
||||||
cache: "no-store",
|
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) {
|
if (action === "download" && second && third && fourth && slug.length === 4) {
|
||||||
const result = await backApi.get<ArrayBuffer>(
|
const result = await backApi.get<ArrayBuffer>(
|
||||||
`/review/download/${encodeURIComponent(second)}/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`,
|
`/review/download/${encodeURIComponent(second)}/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`,
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import {useIsFetching} from "@tanstack/react-query";
|
import {useIsFetching, useIsMutating} from "@tanstack/react-query";
|
||||||
import {useLoading} from "@/hooks/useLoading";
|
import {useLoading} from "@/hooks/useLoading";
|
||||||
import {useEffect} from "react";
|
import {useEffect} from "react";
|
||||||
|
|
||||||
const ReactQueryLoadingSync = () => {
|
const ReactQueryLoadingSync = () => {
|
||||||
const fetching = useIsFetching();
|
const fetching = useIsFetching();
|
||||||
|
const mutating = useIsMutating();
|
||||||
const { showLoading, hideLoading } = useLoading();
|
const { showLoading, hideLoading } = useLoading();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (fetching > 0) showLoading();
|
if (fetching > 0 || mutating > 0) showLoading();
|
||||||
else hideLoading();
|
else hideLoading();
|
||||||
}, [fetching, showLoading, hideLoading]);
|
}, [fetching, mutating, showLoading, hideLoading]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ReactQueryLoadingSync;
|
export default ReactQueryLoadingSync;
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ export function DataTable<TData>({
|
|||||||
defaultPageSize = 10,
|
defaultPageSize = 10,
|
||||||
pageSizeOptions = [5, 10, 25, 50],
|
pageSizeOptions = [5, 10, 25, 50],
|
||||||
showPagination = true,
|
showPagination = true,
|
||||||
paginationItemsToDisplay = 5
|
paginationItemsToDisplay = 5,
|
||||||
|
headerFontClass = 'content-text-lg',
|
||||||
|
cellFontClass = 'content-text-base',
|
||||||
}: Readonly<DataTableProps<TData>>) {
|
}: Readonly<DataTableProps<TData>>) {
|
||||||
// Pagination state
|
// Pagination state
|
||||||
const [pagination, setPagination] = useState<PaginationState>({
|
const [pagination, setPagination] = useState<PaginationState>({
|
||||||
@@ -200,7 +202,8 @@ export function DataTable<TData>({
|
|||||||
<TableHead
|
<TableHead
|
||||||
key={header.id}
|
key={header.id}
|
||||||
className={cn(
|
className={cn(
|
||||||
'content-text-lg font-semibold text-gray-900',
|
'font-semibold text-gray-900',
|
||||||
|
headerFontClass,
|
||||||
column.id === 'actions' && 'w-[140px] text-center'
|
column.id === 'actions' && 'w-[140px] text-center'
|
||||||
)}
|
)}
|
||||||
style={{ width: header.getSize() !== 150 ? header.getSize() : undefined }}
|
style={{ width: header.getSize() !== 150 ? header.getSize() : undefined }}
|
||||||
@@ -209,7 +212,7 @@ export function DataTable<TData>({
|
|||||||
<Button
|
<Button
|
||||||
type='button'
|
type='button'
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
className='px-0 font-semibold content-text-lg flex items-center gap-1'
|
className={cn('px-0 font-semibold flex items-center gap-1', headerFontClass)}
|
||||||
onClick={column.getToggleSortingHandler()}
|
onClick={column.getToggleSortingHandler()}
|
||||||
>
|
>
|
||||||
<span>{headerContent}</span>
|
<span>{headerContent}</span>
|
||||||
@@ -240,7 +243,7 @@ export function DataTable<TData>({
|
|||||||
onPointerCancel={drag.onPointerCancel}
|
onPointerCancel={drag.onPointerCancel}
|
||||||
onClick={drag.wrapClick(() => handleRowClick(row))}
|
onClick={drag.wrapClick(() => handleRowClick(row))}
|
||||||
className={cn(
|
className={cn(
|
||||||
'content-text-base',
|
cellFontClass,
|
||||||
'[&>td]:py-3 [&>td]:px-3',
|
'[&>td]:py-3 [&>td]:px-3',
|
||||||
selectMode !== 'none' && 'cursor-pointer',
|
selectMode !== 'none' && 'cursor-pointer',
|
||||||
'data-[state=selected]:bg-slate-100 data-[state=selected]:font-semibold',
|
'data-[state=selected]:bg-slate-100 data-[state=selected]:font-semibold',
|
||||||
|
|||||||
@@ -38,4 +38,6 @@ export interface DataTableProps<TData> {
|
|||||||
pageSizeOptions?: number[];
|
pageSizeOptions?: number[];
|
||||||
showPagination?: boolean;
|
showPagination?: boolean;
|
||||||
paginationItemsToDisplay?: number;
|
paginationItemsToDisplay?: number;
|
||||||
|
headerFontClass?: string;
|
||||||
|
cellFontClass?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export function AssignMonitoringDialog({
|
|||||||
[PERFORMANCE_FIELD_LABELS.performanceName, selected?.performanceName],
|
[PERFORMANCE_FIELD_LABELS.performanceName, selected?.performanceName],
|
||||||
[PERFORMANCE_FIELD_LABELS.performanceDtInfo, selected?.performanceDtInfo],
|
[PERFORMANCE_FIELD_LABELS.performanceDtInfo, selected?.performanceDtInfo],
|
||||||
[PERFORMANCE_FIELD_LABELS.performanceTimeInfo, selected?.performanceTimeInfo],
|
[PERFORMANCE_FIELD_LABELS.performanceTimeInfo, selected?.performanceTimeInfo],
|
||||||
[PERFORMANCE_FIELD_LABELS.monitoringDate, selected?.performanceMonitoringSchedule?.monitoringDate],
|
[PERFORMANCE_FIELD_LABELS.monitoringDate, selected?.performanceMonitoringSchedule?.monitoringDate ?? ""],
|
||||||
[PERFORMANCE_FIELD_LABELS.monitoringTimeInfo, selected?.performanceMonitoringSchedule?.monitoringTimeInfo],
|
[PERFORMANCE_FIELD_LABELS.monitoringTimeInfo, selected?.performanceMonitoringSchedule?.monitoringTimeInfo],
|
||||||
[PERFORMANCE_FIELD_LABELS.monitoringAddress, selected?.performanceMonitoringSchedule?.monitoringAddress],
|
[PERFORMANCE_FIELD_LABELS.monitoringAddress, selected?.performanceMonitoringSchedule?.monitoringAddress],
|
||||||
[PERFORMANCE_FIELD_LABELS.ticketReservationStatus, getCodeLabel(codes, "ticket_reservation_status", selected?.ticketReservationStatus)],
|
[PERFORMANCE_FIELD_LABELS.ticketReservationStatus, getCodeLabel(codes, "ticket_reservation_status", selected?.ticketReservationStatus)],
|
||||||
@@ -171,7 +171,7 @@ export function AssignMonitoringDialog({
|
|||||||
].map(([label, value]) => (
|
].map(([label, value]) => (
|
||||||
<tr key={String(label)}>
|
<tr key={String(label)}>
|
||||||
<th className="w-32 border bg-muted p-2 text-left">{label}</th>
|
<th className="w-32 border bg-muted p-2 text-left">{label}</th>
|
||||||
<td className="border p-2">{value || "-"}</td>
|
<td className="border p-2">{value || (label === PERFORMANCE_FIELD_LABELS.monitoringDate ? "" : "-")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
buildEvidenceImageSrc,
|
buildEvidenceImageSrc,
|
||||||
buildImagePreviewUrl,
|
buildImagePreviewUrl,
|
||||||
buildReviewPdfPreviewUrl,
|
buildReviewPdfPreviewUrl,
|
||||||
|
buildReviewTemplatePdfPreviewUrl,
|
||||||
downloadBlob,
|
downloadBlob,
|
||||||
downloadFromUrl,
|
downloadFromUrl,
|
||||||
getEvidenceZipDownloadName,
|
getEvidenceZipDownloadName,
|
||||||
@@ -39,25 +40,27 @@ function MobileDetailRow({label, children}: {label: string; children: ReactNode}
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-1 border-b px-3 py-2 last:border-b-0">
|
<div className="space-y-1 border-b px-3 py-2 last:border-b-0">
|
||||||
<div className="text-xs font-semibold text-muted-foreground">{label}</div>
|
<div className="text-xs font-semibold text-muted-foreground">{label}</div>
|
||||||
<div className="break-words text-sm">{children || "-"}</div>
|
<div className="break-words text-sm">{children ?? "-"}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ActionButton({
|
function ActionButton({
|
||||||
children,
|
children,
|
||||||
|
className,
|
||||||
icon = "download",
|
icon = "download",
|
||||||
disabled = false,
|
disabled = false,
|
||||||
onClick,
|
onClick,
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
className?: string;
|
||||||
icon?: "download" | "upload" | "image" | "preview";
|
icon?: "download" | "upload" | "image" | "preview";
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}>) {
|
}>) {
|
||||||
const Icon = icon === "upload" ? Upload : icon === "image" ? ImageIcon : icon === "preview" ? ScanSearch : Download;
|
const Icon = icon === "upload" ? Upload : icon === "image" ? ImageIcon : icon === "preview" ? ScanSearch : Download;
|
||||||
return (
|
return (
|
||||||
<Button type="button" size="sm" variant="outline" disabled={disabled} onClick={onClick} className="min-h-10 flex-1">
|
<Button type="button" size="sm" variant="outline" disabled={disabled} onClick={onClick} className={className? className : "min-h-10 flex-1"}>
|
||||||
<Icon className="h-4 w-4" />
|
<Icon className="h-4 w-4" />
|
||||||
{children}
|
{children}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -190,7 +193,12 @@ export function MonitoringPerformanceDetailDialog({
|
|||||||
)
|
)
|
||||||
: {label: "미배치", variant: "danger" as const};
|
: {label: "미배치", variant: "danger" as const};
|
||||||
|
|
||||||
const downloadTemplate = () => downloadFromUrl("/api/review/template/download/1");
|
const reviewType = row?.reviewType ?? 1;
|
||||||
|
const templateClassification = Number(String(performance?.id ?? 0).charAt(0));
|
||||||
|
const downloadTemplate = () => downloadFromUrl(`/api/review/template/download/${reviewType}/${templateClassification}`);
|
||||||
|
const previewTemplate = () => {
|
||||||
|
openPreviewWindow(buildReviewTemplatePdfPreviewUrl(reviewType, templateClassification, `review-template-${reviewType}-${templateClassification}.pdf`));
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
@@ -214,7 +222,7 @@ export function MonitoringPerformanceDetailDialog({
|
|||||||
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceTimeInfo}>{performance.performanceTimeInfo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceTimeInfo}>{performance.performanceTimeInfo}</MobileDetailRow>
|
||||||
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationStatus}>{getCodeLabel(codes, "ticket_reservation_status", performance.ticketReservationStatus)}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationStatus}>{getCodeLabel(codes, "ticket_reservation_status", performance.ticketReservationStatus)}</MobileDetailRow>
|
||||||
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{performance.ticketReservationMemo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{performance.ticketReservationMemo}</MobileDetailRow>
|
||||||
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{performance.performanceMonitoringSchedule?.monitoringDate}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{performance.performanceMonitoringSchedule?.monitoringDate ?? ""}</MobileDetailRow>
|
||||||
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{performance.performanceMonitoringSchedule?.monitoringTimeInfo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{performance.performanceMonitoringSchedule?.monitoringTimeInfo}</MobileDetailRow>
|
||||||
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{performance.performanceMonitoringSchedule?.monitoringAddress}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{performance.performanceMonitoringSchedule?.monitoringAddress}</MobileDetailRow>
|
||||||
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{performance.performanceMemo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{performance.performanceMemo}</MobileDetailRow>
|
||||||
@@ -224,10 +232,8 @@ export function MonitoringPerformanceDetailDialog({
|
|||||||
<div className="flex items-center justify-between gap-2">
|
<div className="flex items-center justify-between gap-2">
|
||||||
<div className="font-semibold">나의 진행 상태</div>
|
<div className="font-semibold">나의 진행 상태</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Button type="button" size="sm" variant="outline" onClick={downloadTemplate}>
|
<ActionButton icon="preview" onClick={previewTemplate} className="min-h-5">미리보기</ActionButton>
|
||||||
<Download className="h-4 w-4" />
|
<ActionButton icon="download" onClick={downloadTemplate} className="min-h-5">양식</ActionButton>
|
||||||
양식
|
|
||||||
</Button>
|
|
||||||
<StatusPill variant={status.variant}>{status.label}</StatusPill>
|
<StatusPill variant={status.variant}>{status.label}</StatusPill>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function DetailRow({label, children}: {label: string; children: ReactNode}) {
|
|||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-[130px_1fr] border-b last:border-b-0">
|
<div className="grid grid-cols-[130px_1fr] border-b last:border-b-0">
|
||||||
<div className="bg-muted px-3 py-2 text-sm font-semibold">{label}</div>
|
<div className="bg-muted px-3 py-2 text-sm font-semibold">{label}</div>
|
||||||
<div className="min-h-9 px-3 py-2 text-sm">{children || "-"}</div>
|
<div className="min-h-9 px-3 py-2 text-sm">{children ?? "-"}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ export function MonitoringVisitDialog({
|
|||||||
<div className="rounded-md border">
|
<div className="rounded-md border">
|
||||||
<DetailRow label="현재 시간">{nowText}</DetailRow>
|
<DetailRow label="현재 시간">{nowText}</DetailRow>
|
||||||
<DetailRow label="모니터링 일정">
|
<DetailRow label="모니터링 일정">
|
||||||
{performance?.performanceMonitoringSchedule?.monitoringDate} {performance?.performanceMonitoringSchedule?.monitoringTimeInfo}
|
{[performance?.performanceMonitoringSchedule?.monitoringDate, performance?.performanceMonitoringSchedule?.monitoringTimeInfo].filter(Boolean).join(" ")}
|
||||||
</DetailRow>
|
</DetailRow>
|
||||||
<DetailRow label="사업명">{performance?.performanceName}</DetailRow>
|
<DetailRow label="사업명">{performance?.performanceName}</DetailRow>
|
||||||
<DetailRow label="장소">{performance?.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
<DetailRow label="장소">{performance?.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
||||||
|
|||||||
@@ -45,12 +45,13 @@ import {
|
|||||||
import {PERFORMANCE_FIELD_LABELS, USER_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
import {PERFORMANCE_FIELD_LABELS, USER_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
||||||
|
type PerformanceDetail = PerformanceCompact["performanceDetail"];
|
||||||
|
|
||||||
function DetailRow({label, children}: {label: string; children: ReactNode}) {
|
function DetailRow({label, children}: {label: string; children: ReactNode}) {
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-[130px_1fr] border-b last:border-b-0">
|
<div className="grid grid-cols-[130px_1fr] border-b last:border-b-0">
|
||||||
<div className="bg-muted px-3 py-2 text-sm font-semibold">{label}</div>
|
<div className="bg-muted px-3 py-2 text-sm font-semibold">{label}</div>
|
||||||
<div className="min-h-9 px-3 py-2 text-sm">{children || "-"}</div>
|
<div className="min-h-9 px-3 py-2 text-sm">{children ?? "-"}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -225,6 +226,11 @@ function LocalGovernmentReviewRow({
|
|||||||
const fallbackReviewRow = getReviewByType(performance as PerformanceFull, reviewType);
|
const fallbackReviewRow = getReviewByType(performance as PerformanceFull, reviewType);
|
||||||
const userId = fallbackReviewRow?.review.regUser || fallbackReviewRow?.userId;
|
const userId = fallbackReviewRow?.review.regUser || fallbackReviewRow?.userId;
|
||||||
const {data: fetchedReview} = useReviewFileQuery(performance.id, reviewType, userId, performance.id > 0 && Boolean(userId));
|
const {data: fetchedReview} = useReviewFileQuery(performance.id, reviewType, userId, performance.id > 0 && Boolean(userId));
|
||||||
|
|
||||||
|
if(performance.id % 100 !== 1){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const review = fetchedReview ?? fallbackReviewRow?.review;
|
const review = fetchedReview ?? fallbackReviewRow?.review;
|
||||||
const label = getCodeLabel(codes, "review_status", review?.reviewStatus);
|
const label = getCodeLabel(codes, "review_status", review?.reviewStatus);
|
||||||
const display = getReviewStatusDisplay(label, review, true);
|
const display = getReviewStatusDisplay(label, review, true);
|
||||||
@@ -319,6 +325,10 @@ function WrittenReviewRows({
|
|||||||
userMap: Map<string, UserFull>;
|
userMap: Map<string, UserFull>;
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
}>) {
|
}>) {
|
||||||
|
if(performance.id % 100 !== 1){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const rows = getWrittenReviewRows(performance as PerformanceFull);
|
const rows = getWrittenReviewRows(performance as PerformanceFull);
|
||||||
|
|
||||||
if(rows.length === 0){
|
if(rows.length === 0){
|
||||||
@@ -419,6 +429,16 @@ export function PerformanceDetailDialog({
|
|||||||
setDraft((prev) => prev ? {...prev, [key]: value} : prev);
|
setDraft((prev) => prev ? {...prev, [key]: value} : prev);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateDetail = <K extends keyof PerformanceDetail>(key: K, value: PerformanceDetail[K]) => {
|
||||||
|
setDraft((prev) => prev ? {
|
||||||
|
...prev,
|
||||||
|
performanceDetail: {
|
||||||
|
...prev.performanceDetail,
|
||||||
|
[key]: value,
|
||||||
|
},
|
||||||
|
} : prev);
|
||||||
|
};
|
||||||
|
|
||||||
const updateSchedule = <K extends keyof PerformanceMonitoringSchedule>(key: K, value: PerformanceMonitoringSchedule[K]) => {
|
const updateSchedule = <K extends keyof PerformanceMonitoringSchedule>(key: K, value: PerformanceMonitoringSchedule[K]) => {
|
||||||
setDraft((prev) => prev ? {
|
setDraft((prev) => prev ? {
|
||||||
...prev,
|
...prev,
|
||||||
@@ -481,10 +501,13 @@ export function PerformanceDetailDialog({
|
|||||||
<div className="grid gap-4 lg:grid-cols-[1.1fr_0.9fr]">
|
<div className="grid gap-4 lg:grid-cols-[1.1fr_0.9fr]">
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<section className="rounded-md border">
|
<section className="rounded-md border">
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.no}>{draft.performanceDetail["performanceNo"] ?? ""}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.id}>{draft.id}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.id}>{draft.id}</DetailRow>
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAdd}>{draft.id % 100 !== 1? "추가" : ""}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.businessType}>{getCodeLabel(codes, "business_type", draft.businessType)}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.businessType}>{getCodeLabel(codes, "business_type", draft.businessType)}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceGenre}>{getCodeLabel(codes, "genre", draft.performanceGenre)}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceGenre}>{getCodeLabel(codes, "genre", draft.performanceGenre)}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceArea}>{getCodeLabel(codes, "area", draft.performanceArea)}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceArea}>{getCodeLabel(codes, "area", draft.performanceArea)}</DetailRow>
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceAreaDetail}>{isEditing ? <Input value={draft.performanceDetail["performanceAreaDetail"] ?? ""} onChange={(event) => updateDetail("performanceAreaDetail", event.target.value)} /> : draft.performanceDetail["performanceAreaDetail"] ?? ""}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.artistName}>{draft.artistName}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.artistName}>{draft.artistName}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceName}>{isEditing ? <Input value={draft.performanceName} onChange={(event) => updateDraft("performanceName", event.target.value)} /> : draft.performanceName}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceName}>{isEditing ? <Input value={draft.performanceName} onChange={(event) => updateDraft("performanceName", event.target.value)} /> : draft.performanceName}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceStartMonth}>{isEditing ? <Input type="number" value={draft.performanceStartMonth} onChange={(event) => updateDraft("performanceStartMonth", Number(event.target.value))} /> : `${draft.performanceStartMonth}월`}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceStartMonth}>{isEditing ? <Input type="number" value={draft.performanceStartMonth} onChange={(event) => updateDraft("performanceStartMonth", Number(event.target.value))} /> : `${draft.performanceStartMonth}월`}</DetailRow>
|
||||||
@@ -496,10 +519,15 @@ export function PerformanceDetailDialog({
|
|||||||
) : getCodeLabel(codes, "ticket_reservation_status", draft.ticketReservationStatus)}
|
) : getCodeLabel(codes, "ticket_reservation_status", draft.ticketReservationStatus)}
|
||||||
</DetailRow>
|
</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{isEditing ? <Input value={draft.ticketReservationMemo} onChange={(event) => updateDraft("ticketReservationMemo", event.target.value)} /> : draft.ticketReservationMemo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{isEditing ? <Input value={draft.ticketReservationMemo} onChange={(event) => updateDraft("ticketReservationMemo", event.target.value)} /> : draft.ticketReservationMemo}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{isEditing ? <DatePicker value={draft.performanceMonitoringSchedule?.monitoringDate ?? ""} onChange={(value) => updateSchedule("monitoringDate", value)} /> : draft.performanceMonitoringSchedule?.monitoringDate}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{isEditing ? <DatePicker value={draft.performanceMonitoringSchedule?.monitoringDate ?? ""} onChange={(value) => updateSchedule("monitoringDate", value)} /> : draft.performanceMonitoringSchedule?.monitoringDate ?? ""}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""} onChange={(event) => updateSchedule("monitoringTimeInfo", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringTimeInfo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""} onChange={(event) => updateSchedule("monitoringTimeInfo", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringTimeInfo}</DetailRow>
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.needMonitoring}>{isEditing ? <Input value={draft.performanceDetail["needMonitoring"] ?? ""} onChange={(event) => updateDetail("needMonitoring", event.target.value)} /> : draft.performanceDetail["needMonitoring"] ?? ""}</DetailRow>
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.needWrittenReview}>{isEditing ? <Input value={draft.performanceDetail["needWrittenReview"] ?? ""} onChange={(event) => updateDetail("needWrittenReview", event.target.value)} /> : draft.performanceDetail["needWrittenReview"] ?? ""}</DetailRow>
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.checkDeliver}>{isEditing ? <Input value={draft.performanceDetail["checkDeliver"] ?? ""} onChange={(event) => updateDetail("checkDeliver", event.target.value)} /> : draft.performanceDetail["checkDeliver"] ?? ""}</DetailRow>
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.timeTreeCheckDt}>{isEditing ? <DatePicker value={draft.performanceDetail["timeTreeCheckDt"] ?? ""} onChange={(value) => updateDetail("timeTreeCheckDt", value)} /> : draft.performanceDetail["timeTreeCheckDt"] ?? ""}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringAddress ?? ""} onChange={(event) => updateSchedule("monitoringAddress", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringAddress ?? ""} onChange={(event) => updateSchedule("monitoringAddress", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
||||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{isEditing ? <Input value={draft.performanceMemo} onChange={(event) => updateDraft("performanceMemo", event.target.value)} /> : draft.performanceMemo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{isEditing ? <Input value={draft.performanceMemo} onChange={(event) => updateDraft("performanceMemo", event.target.value)} /> : draft.performanceMemo}</DetailRow>
|
||||||
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.checkReport}>{isEditing ? <Input value={draft.performanceDetail["checkReport"] ?? ""} onChange={(event) => updateDetail("checkReport", event.target.value)} /> : draft.performanceDetail["checkReport"] ?? ""}</DetailRow>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="rounded-md border">
|
<section className="rounded-md border">
|
||||||
|
|||||||
@@ -16,10 +16,13 @@ export const USER_FIELD_LABELS = {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const PERFORMANCE_FIELD_LABELS = {
|
export const PERFORMANCE_FIELD_LABELS = {
|
||||||
|
no: "No.",
|
||||||
id: "연번",
|
id: "연번",
|
||||||
|
monitoringAdd: "추가 모니터링",
|
||||||
businessType: "사업유형",
|
businessType: "사업유형",
|
||||||
performanceGenre: "분야(장르)",
|
performanceGenre: "분야(장르)",
|
||||||
performanceArea: "지역",
|
performanceArea: "지역",
|
||||||
|
performanceAreaDetail: "지역 세부",
|
||||||
artistName: "단체(인)명",
|
artistName: "단체(인)명",
|
||||||
performanceName: "사업명",
|
performanceName: "사업명",
|
||||||
performanceStartMonth: "사업 수행 월",
|
performanceStartMonth: "사업 수행 월",
|
||||||
@@ -30,7 +33,12 @@ export const PERFORMANCE_FIELD_LABELS = {
|
|||||||
performanceMemo: "메모",
|
performanceMemo: "메모",
|
||||||
monitoringDate: "모니터링 일정",
|
monitoringDate: "모니터링 일정",
|
||||||
monitoringTimeInfo: "모니터링 시간",
|
monitoringTimeInfo: "모니터링 시간",
|
||||||
|
needMonitoring: "모니터링 필요여부",
|
||||||
|
needWrittenReview: "서면평가 필요여부",
|
||||||
|
checkDeliver: "교부여부",
|
||||||
|
timeTreeCheckDt: "타임트리 확인일시",
|
||||||
monitoringAddress: "방문 장소",
|
monitoringAddress: "방문 장소",
|
||||||
|
checkReport: "보고서 확인여부",
|
||||||
performanceId: "사업 ID",
|
performanceId: "사업 ID",
|
||||||
monitoringPaymentDate: "요원 비용지급일",
|
monitoringPaymentDate: "요원 비용지급일",
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ export const buildReviewPdfPreviewUrl = (
|
|||||||
return `/file-preview?type=pdf&src=${encodeURIComponent(src)}&title=${encodeURIComponent(title || getReviewPdfDownloadName(performanceId, reviewType))}`;
|
return `/file-preview?type=pdf&src=${encodeURIComponent(src)}&title=${encodeURIComponent(title || getReviewPdfDownloadName(performanceId, reviewType))}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const buildReviewTemplatePdfPreviewUrl = (
|
||||||
|
reviewType: number,
|
||||||
|
classification: number,
|
||||||
|
title?: string
|
||||||
|
) => {
|
||||||
|
const src = `/api/review/template/pdf/${reviewType}/${classification}?disposition=inline`;
|
||||||
|
return `/file-preview?type=pdf&src=${encodeURIComponent(src)}&title=${encodeURIComponent(title || `review-template-${reviewType}-${classification}.pdf`)}`;
|
||||||
|
};
|
||||||
|
|
||||||
export const buildEvidenceImageSrc = (
|
export const buildEvidenceImageSrc = (
|
||||||
performanceId: number,
|
performanceId: number,
|
||||||
userId: string,
|
userId: string,
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ export const getReviewRows = (performance: Partial<PerformanceFull>) => {
|
|||||||
|
|
||||||
export const getMonitoringReviewByIndex = (
|
export const getMonitoringReviewByIndex = (
|
||||||
performance: Partial<PerformanceFull>,
|
performance: Partial<PerformanceFull>,
|
||||||
index: 0 | 1,
|
|
||||||
slot?: MonitoringSlot
|
slot?: MonitoringSlot
|
||||||
) => {
|
) => {
|
||||||
const assignedUserId = slot?.assign?.assignUser;
|
const assignedUserId = slot?.assign?.assignUser;
|
||||||
@@ -140,10 +139,11 @@ export const getMonitoringReviewByIndex = (
|
|||||||
|
|
||||||
export const getMonitoringDisplayRow = (
|
export const getMonitoringDisplayRow = (
|
||||||
performance: Partial<PerformanceFull>,
|
performance: Partial<PerformanceFull>,
|
||||||
index: 0 | 1
|
index: 0 | 1,
|
||||||
|
isWrittenReviewer: boolean = false
|
||||||
): MonitoringDisplayRow => {
|
): MonitoringDisplayRow => {
|
||||||
const slot = getMonitoringSlots(performance)[index];
|
const slot = getMonitoringSlots(performance)[index];
|
||||||
const reviewRow = getMonitoringReviewByIndex(performance, index, slot);
|
const reviewRow = getMonitoringReviewByIndex(performance, slot);
|
||||||
const visit = slot.visit?.[0];
|
const visit = slot.visit?.[0];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export type PerformanceFull = PerformanceBase & {
|
|||||||
export type PerformanceMonitoringSchedule = {
|
export type PerformanceMonitoringSchedule = {
|
||||||
id: number;
|
id: number;
|
||||||
performanceId: number;
|
performanceId: number;
|
||||||
monitoringDate: string;
|
monitoringDate: string | null;
|
||||||
monitoringTimeInfo: string;
|
monitoringTimeInfo: string;
|
||||||
monitoringAddress: string;
|
monitoringAddress: string;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user