260617_01_ENH: 배정 테스트를 위해 개발 중도 커밋
This commit is contained in:
@@ -1,9 +1,484 @@
|
||||
'use client'
|
||||
"use client";
|
||||
|
||||
import {useMemo, useRef, useState} from "react";
|
||||
import {Search, Upload} from "lucide-react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {DatePicker} from "@/components/common/DatePicker";
|
||||
import {MultiFilterSelect} from "@/components/gwcf/MultiFilterSelect";
|
||||
import {PagePanel} from "@/components/gwcf/PagePanel";
|
||||
import {StatusPill} from "@/components/gwcf/StatusPill";
|
||||
import {ExcelRegisterDialog} from "@/components/dialog/ExcelRegisterDialog";
|
||||
import {PerformanceDetailDialog} from "@/components/dialog/PerformanceDetailDialog";
|
||||
import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {DataTableColumn} from "@/components/data-table/DataTable.type";
|
||||
import {useCodesQuery} from "@/query/code";
|
||||
import {
|
||||
useDownloadAssignExcelTemplateMutation,
|
||||
useDownloadPerformanceExcelTemplateMutation,
|
||||
usePerformanceDetailQuery,
|
||||
usePerformanceListQuery,
|
||||
useUpdatePerformanceMutation,
|
||||
useUploadPerformanceExcelMutation,
|
||||
} from "@/query/performance";
|
||||
import {useUploadWrittenAssignExcelMutation} from "@/query/assign";
|
||||
import {useDownloadReviewPdfMutation} from "@/query/review";
|
||||
import {useDownloadEvidenceZipMutation} from "@/query/monitoring";
|
||||
import {filterPerformance, getCodeLabel, isInternalRole, isWrittenReviewerRole} from "@/lib/gwcf/view";
|
||||
import {
|
||||
getMonitoringRecordedAt,
|
||||
getMonitoringRecordedUser,
|
||||
getMonitoringSlots,
|
||||
getMonitoringStatusDisplay,
|
||||
getReviewByType,
|
||||
getReviewStatusDisplay,
|
||||
getWrittenReviewRows,
|
||||
getWrittenReviewerSimpleMonitoringStatusDisplay,
|
||||
getWrittenReviewerSimpleReviewStatusDisplay,
|
||||
isReviewComplete,
|
||||
LOCAL_GOVERNMENT_REVIEW_TYPE,
|
||||
} from "@/lib/gwcf/performance-status";
|
||||
import {buildWrittenReviewLink} from "@/config/gwcf.config";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {Code, PerformanceFull, PerformanceReview} from "@/types/gwcf";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {downloadFile} from "@/lib/utils";
|
||||
|
||||
type PerformanceFilters = {
|
||||
businessType: string[];
|
||||
genre: string[];
|
||||
area: string[];
|
||||
startMonth: string[];
|
||||
monitoringDate: string;
|
||||
localReviewStatus: string[];
|
||||
monitoring1Status: string[];
|
||||
monitoring2Status: string[];
|
||||
writtenReviewStatus: string[];
|
||||
keyword: string;
|
||||
};
|
||||
|
||||
const monthOptions: Code[] = Array.from({length: 12}, (_, index) => ({
|
||||
codeGroup: "month",
|
||||
codeValue: index + 1,
|
||||
codeGroupLabel: "사업 수행 월",
|
||||
codeLabel: `${index + 1}월`,
|
||||
memo: "",
|
||||
}));
|
||||
|
||||
const STATUS_FILTER = {
|
||||
UNASSIGNED: "-1001",
|
||||
INCOMPLETE: "-1002",
|
||||
PENDING: "-1003",
|
||||
IN_PROGRESS: "-1004",
|
||||
DEPARTED: "-1005",
|
||||
ARRIVED: "-1006",
|
||||
DONE: "-1007",
|
||||
} as const;
|
||||
|
||||
const makeStatusOption = (value: string, label: string): Code => ({
|
||||
codeGroup: "status_filter",
|
||||
codeValue: Number(value),
|
||||
codeGroupLabel: "상태",
|
||||
codeLabel: label,
|
||||
memo: "",
|
||||
});
|
||||
|
||||
const normalizeStatusLabel = (label?: string) => label?.replace(/\s/g, "") ?? "";
|
||||
const labelHasComplete = (label?: string) => normalizeStatusLabel(label).includes("완료");
|
||||
const labelHasInProgress = (label?: string) => normalizeStatusLabel(label).includes("진행");
|
||||
const labelHasDeparted = (label?: string) => normalizeStatusLabel(label).includes("출발");
|
||||
const labelHasArrived = (label?: string) => normalizeStatusLabel(label).includes("도착");
|
||||
|
||||
const statusFilterOptions = {
|
||||
incomplete: makeStatusOption(STATUS_FILTER.INCOMPLETE, "미완료"),
|
||||
pending: makeStatusOption(STATUS_FILTER.PENDING, "미진행"),
|
||||
inProgress: makeStatusOption(STATUS_FILTER.IN_PROGRESS, "진행중"),
|
||||
departed: makeStatusOption(STATUS_FILTER.DEPARTED, "출발"),
|
||||
arrived: makeStatusOption(STATUS_FILTER.ARRIVED, "도착"),
|
||||
done: makeStatusOption(STATUS_FILTER.DONE, "완료"),
|
||||
};
|
||||
|
||||
const PerformancePage = () => {
|
||||
return (
|
||||
<div>PerformancePage</div>
|
||||
);
|
||||
}
|
||||
const mounted = useMounted();
|
||||
const {auth} = useAuth();
|
||||
const userRole = auth.user?.userRole;
|
||||
const canEdit = isInternalRole(userRole);
|
||||
const isWrittenReviewer = isWrittenReviewerRole(userRole);
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
|
||||
export default PerformancePage;
|
||||
const {data: codes} = useCodesQuery();
|
||||
const {data = [], refetch: refetchPerformanceList} = usePerformanceListQuery();
|
||||
const updateMutation = useUpdatePerformanceMutation();
|
||||
const performanceUploadMutation = useUploadPerformanceExcelMutation();
|
||||
const writtenAssignUploadMutation = useUploadWrittenAssignExcelMutation();
|
||||
const performanceTemplateMutation = useDownloadPerformanceExcelTemplateMutation();
|
||||
const writtenAssignTemplateMutation = useDownloadAssignExcelTemplateMutation();
|
||||
const reviewPdfMutation = useDownloadReviewPdfMutation();
|
||||
const evidenceZipMutation = useDownloadEvidenceZipMutation();
|
||||
|
||||
const [filters, setFilters] = useState<PerformanceFilters>({
|
||||
businessType: [],
|
||||
genre: [],
|
||||
area: [],
|
||||
startMonth: [],
|
||||
monitoringDate: "",
|
||||
localReviewStatus: [],
|
||||
monitoring1Status: [],
|
||||
monitoring2Status: [],
|
||||
writtenReviewStatus: [],
|
||||
keyword: "",
|
||||
});
|
||||
const [selectedId, setSelectedId] = useState<number | null>(null);
|
||||
const lastSelectedRef = useRef<number | null>(null);
|
||||
|
||||
const detailOpen = isDialogOpen("performanceDetailDialog");
|
||||
const performanceRegisterOpen = isDialogOpen("performanceExcelRegisterDialog");
|
||||
const assignWrittenOpen = isDialogOpen("assignWrittenExcelDialog");
|
||||
const {data: detailData} = usePerformanceDetailQuery(selectedId ?? 0, Boolean(selectedId && detailOpen && !isWrittenReviewer));
|
||||
|
||||
const refreshPerformanceList = () => {
|
||||
void refetchPerformanceList();
|
||||
};
|
||||
|
||||
const updateFilters = (updater: (prev: PerformanceFilters) => PerformanceFilters) => {
|
||||
setFilters(updater);
|
||||
refreshPerformanceList();
|
||||
};
|
||||
|
||||
const handlePerformanceDetailOpenChange = (open: boolean) => {
|
||||
if (open) {
|
||||
showDialog("performanceDetailDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("performanceDetailDialog");
|
||||
refreshPerformanceList();
|
||||
};
|
||||
|
||||
const handlePerformanceRegisterOpenChange = (open: boolean) => {
|
||||
if (open) {
|
||||
showDialog("performanceExcelRegisterDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("performanceExcelRegisterDialog");
|
||||
refreshPerformanceList();
|
||||
};
|
||||
|
||||
const handleAssignWrittenOpenChange = (open: boolean) => {
|
||||
if (open) {
|
||||
showDialog("assignWrittenExcelDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("assignWrittenExcelDialog");
|
||||
refreshPerformanceList();
|
||||
};
|
||||
const matchesStatus = (filter: string[], value: string) => filter.length === 0 || filter.includes(value);
|
||||
|
||||
const getReviewFilterValue = (review?: PerformanceReview, allowInProgress = false, alwaysAssigned = false) => {
|
||||
const label = getCodeLabel(codes, "review_status", review?.reviewStatus);
|
||||
|
||||
if (isWrittenReviewer) {
|
||||
if (isReviewComplete(review) || labelHasComplete(label)) return STATUS_FILTER.DONE;
|
||||
return STATUS_FILTER.INCOMPLETE;
|
||||
}
|
||||
|
||||
if (!alwaysAssigned && !review) return STATUS_FILTER.UNASSIGNED;
|
||||
if (isReviewComplete(review) || labelHasComplete(label)) return STATUS_FILTER.DONE;
|
||||
if (allowInProgress && labelHasInProgress(label)) return STATUS_FILTER.IN_PROGRESS;
|
||||
return STATUS_FILTER.PENDING;
|
||||
};
|
||||
|
||||
const getMonitoringFilterValue = (performance: PerformanceFull, index: 0 | 1) => {
|
||||
const slot = getMonitoringSlots(performance)[index];
|
||||
const label = getCodeLabel(codes, "monitoring_visit_status", slot.visit?.monitoringVisitStatus);
|
||||
|
||||
if (isWrittenReviewer) {
|
||||
return slot.visit ? STATUS_FILTER.DONE : STATUS_FILTER.INCOMPLETE;
|
||||
}
|
||||
|
||||
if (!slot.assign) return STATUS_FILTER.UNASSIGNED;
|
||||
if (!slot.visit) return STATUS_FILTER.PENDING;
|
||||
if (labelHasComplete(label)) return STATUS_FILTER.DONE;
|
||||
if (labelHasDeparted(label)) return STATUS_FILTER.DEPARTED;
|
||||
if (labelHasArrived(label)) return STATUS_FILTER.ARRIVED;
|
||||
return STATUS_FILTER.PENDING;
|
||||
};
|
||||
|
||||
const localReviewStatusOptions = isWrittenReviewer
|
||||
? [statusFilterOptions.incomplete, statusFilterOptions.done]
|
||||
: [statusFilterOptions.pending, statusFilterOptions.done];
|
||||
const monitoringStatusOptions = isWrittenReviewer
|
||||
? [statusFilterOptions.incomplete, statusFilterOptions.done]
|
||||
: [statusFilterOptions.pending, statusFilterOptions.departed, statusFilterOptions.arrived, statusFilterOptions.done];
|
||||
const writtenReviewStatusOptions = isWrittenReviewer
|
||||
? [statusFilterOptions.incomplete, statusFilterOptions.done]
|
||||
: [statusFilterOptions.pending, statusFilterOptions.inProgress, statusFilterOptions.done];
|
||||
|
||||
const filteredData = useMemo(() => {
|
||||
return data.filter((item) => {
|
||||
const localReview = getReviewByType(item, LOCAL_GOVERNMENT_REVIEW_TYPE)?.review;
|
||||
const writtenReviewRow = getWrittenReviewRows(item)[0];
|
||||
|
||||
return (
|
||||
filterPerformance(item, {
|
||||
businessType: filters.businessType,
|
||||
genre: filters.genre,
|
||||
area: filters.area,
|
||||
monitoringDate: filters.monitoringDate,
|
||||
keyword: filters.keyword,
|
||||
}) &&
|
||||
matchesStatus(filters.startMonth, String(item.performanceStartMonth)) &&
|
||||
matchesStatus(filters.localReviewStatus, getReviewFilterValue(localReview, false, true)) &&
|
||||
matchesStatus(filters.monitoring1Status, getMonitoringFilterValue(item, 0)) &&
|
||||
matchesStatus(filters.monitoring2Status, getMonitoringFilterValue(item, 1)) &&
|
||||
matchesStatus(filters.writtenReviewStatus, getReviewFilterValue(writtenReviewRow?.review, true, Boolean(writtenReviewRow?.assign)))
|
||||
);
|
||||
});
|
||||
}, [codes, data, filters, isWrittenReviewer]);
|
||||
|
||||
const openDetail = (performance: PerformanceFull) => {
|
||||
if (isWrittenReviewer) return;
|
||||
lastSelectedRef.current = performance.id;
|
||||
setSelectedId(performance.id);
|
||||
showDialog("performanceDetailDialog");
|
||||
};
|
||||
|
||||
const downloadBlob = (buffer: ArrayBuffer, fileName: string, type = "application/octet-stream") => {
|
||||
downloadFile(new Blob([buffer], {type}), fileName);
|
||||
};
|
||||
|
||||
const downloadReviewPdf = async (performanceId: number, review?: PerformanceReview) => {
|
||||
if (!review || !isReviewComplete(review)) return;
|
||||
const buffer = await reviewPdfMutation.mutateAsync({performanceId, reviewType: review.reviewType});
|
||||
downloadBlob(buffer, review.pdfFileName || `review-${performanceId}-${review.reviewType}.pdf`, "application/pdf");
|
||||
};
|
||||
|
||||
const downloadEvidenceZip = async (performanceId: number, userId?: string) => {
|
||||
if (!userId) return;
|
||||
const buffer = await evidenceZipMutation.mutateAsync({performanceId, userId});
|
||||
downloadBlob(buffer, `monitoring-evidence-${performanceId}-${userId}.zip`, "application/zip");
|
||||
};
|
||||
|
||||
const openWrittenReviewLink = (performanceId: number, userId?: string, complete = false) => {
|
||||
if (!userId) return;
|
||||
window.open(buildWrittenReviewLink({performanceId, userId, complete}), "_blank", "noopener,noreferrer");
|
||||
};
|
||||
|
||||
const renderReviewStatus = ({
|
||||
performance,
|
||||
review,
|
||||
userId,
|
||||
useWrittenLink = false,
|
||||
alwaysAssigned = false,
|
||||
noTooltip = false,
|
||||
}: {
|
||||
performance: PerformanceFull;
|
||||
review?: PerformanceReview;
|
||||
userId?: string;
|
||||
useWrittenLink?: boolean;
|
||||
alwaysAssigned?: boolean;
|
||||
noTooltip?: boolean;
|
||||
}) => {
|
||||
const label = getCodeLabel(codes, "review_status", review?.reviewStatus);
|
||||
const display = isWrittenReviewer
|
||||
? getWrittenReviewerSimpleReviewStatusDisplay(review, false, label)
|
||||
: getReviewStatusDisplay(label, review, alwaysAssigned || Boolean(review));
|
||||
const complete = isReviewComplete(review);
|
||||
const onClick = !useWrittenLink && isReviewComplete(review)
|
||||
? () => downloadReviewPdf(performance.id, review)
|
||||
: useWrittenLink
|
||||
? () => openWrittenReviewLink(performance.id, userId, complete)
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<div className="flex min-w-24 justify-center text-xs">
|
||||
<StatusPill
|
||||
variant={display.variant}
|
||||
onClick={onClick}
|
||||
tooltip={useWrittenLink || noTooltip ? undefined : (
|
||||
<div className="space-y-1">
|
||||
<div>사용자: {userId || "-"}</div>
|
||||
<div>기록일시: -</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
{display.label}
|
||||
</StatusPill>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const renderMonitoringStatus = (performance: PerformanceFull, index: 0 | 1) => {
|
||||
const slot = getMonitoringSlots(performance)[index];
|
||||
const label = getCodeLabel(codes, "monitoring_visit_status", slot.visit?.monitoringVisitStatus);
|
||||
const display = isWrittenReviewer
|
||||
? getWrittenReviewerSimpleMonitoringStatusDisplay(slot)
|
||||
: getMonitoringStatusDisplay(label, slot);
|
||||
|
||||
return (
|
||||
<div className="flex min-w-24 justify-center text-xs">
|
||||
<StatusPill
|
||||
variant={display.variant}
|
||||
onClick={!isWrittenReviewer && slot.visit ? () => downloadEvidenceZip(performance.id, slot.assign?.assignUser) : undefined}
|
||||
tooltip={isWrittenReviewer ? undefined : (
|
||||
<div className="space-y-1">
|
||||
<div>사용자: {getMonitoringRecordedUser(slot.visit)}</div>
|
||||
<div>기록일시: {getMonitoringRecordedAt(slot.visit)}</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
{display.label}
|
||||
</StatusPill>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{accessorKey: "id", header: "연번", cell: ({row}) => row.original.id, enableSorting: true},
|
||||
{id: "businessType", header: "사업 유형", cell: ({row}) => getCodeLabel(codes, "business_type", row.original.businessType)},
|
||||
{id: "genre", header: "분야(장르)", cell: ({row}) => getCodeLabel(codes, "genre", row.original.performanceGenre)},
|
||||
{id: "area", header: "지역", cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||
{accessorKey: "artistName", header: "단체(팀)명", enableSorting: true},
|
||||
{accessorKey: "performanceName", header: "사업명", enableSorting: true},
|
||||
{id: "startMonth", header: "사업 수행 월", cell: ({row}) => `${row.original.performanceStartMonth}월`, enableSorting: true},
|
||||
{accessorKey: "performanceDtInfo", header: "사업 일정"},
|
||||
{accessorKey: "performanceTimeInfo", header: "운영 시간"},
|
||||
...(!isWrittenReviewer ? [{
|
||||
id: "monitoringDate",
|
||||
header: "모니터링 일정",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
enableSorting: true,
|
||||
} satisfies DataTableColumn<PerformanceFull>] : []),
|
||||
{
|
||||
id: "localReview",
|
||||
header: "지자체 평가",
|
||||
cell: ({row}) => {
|
||||
const found = getReviewByType(row.original, LOCAL_GOVERNMENT_REVIEW_TYPE);
|
||||
return renderReviewStatus({
|
||||
performance: row.original,
|
||||
review: found?.review,
|
||||
userId: found?.userId,
|
||||
alwaysAssigned: true,
|
||||
noTooltip: isWrittenReviewer,
|
||||
});
|
||||
},
|
||||
},
|
||||
{id: "monitoring1", header: "모니터링 1", cell: ({row}) => renderMonitoringStatus(row.original, 0)},
|
||||
{id: "monitoring2", header: "모니터링 2", cell: ({row}) => renderMonitoringStatus(row.original, 1)},
|
||||
{
|
||||
id: "writtenReview",
|
||||
header: "서면 평가",
|
||||
cell: ({row}) => {
|
||||
const found = getWrittenReviewRows(row.original)[0];
|
||||
return renderReviewStatus({
|
||||
performance: row.original,
|
||||
review: found?.review,
|
||||
userId: found?.userId,
|
||||
useWrittenLink: isWrittenReviewer,
|
||||
alwaysAssigned: Boolean(found?.assign),
|
||||
});
|
||||
},
|
||||
},
|
||||
], [codes, isWrittenReviewer]);
|
||||
|
||||
const downloadPerformanceTemplate = async () => {
|
||||
const buffer = await performanceTemplateMutation.mutateAsync();
|
||||
const blob = new Blob([buffer], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
downloadFile(blob, "사업 등록 template.xlsx");
|
||||
};
|
||||
|
||||
const downloadWrittenAssignTemplate = async () => {
|
||||
const buffer = await writtenAssignTemplateMutation.mutateAsync();
|
||||
const blob = new Blob([buffer], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
downloadFile(blob, "서면 평가 배정 template.xlsx");
|
||||
};
|
||||
|
||||
if(!mounted) return <LoadingOverlay force={true} />
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<PagePanel>
|
||||
<div className="space-y-2">
|
||||
<div className={isWrittenReviewer ? "grid gap-2 md:grid-cols-[280px_170px_140px_140px_1fr_auto]" : "grid gap-2 md:grid-cols-[280px_170px_140px_140px_140px_1fr_auto]"}>
|
||||
<MultiFilterSelect value={filters.businessType} onChange={(value) => updateFilters((prev) => ({...prev, businessType: value}))} options={codes.business_type} placeholder="사업 유형" />
|
||||
<MultiFilterSelect value={filters.genre} onChange={(value) => updateFilters((prev) => ({...prev, genre: value}))} options={codes.genre} placeholder="분야(장르)" />
|
||||
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder="지역" />
|
||||
<MultiFilterSelect value={filters.startMonth} onChange={(value) => updateFilters((prev) => ({...prev, startMonth: value}))} options={monthOptions} placeholder="사업 수행 월" />
|
||||
{!isWrittenReviewer && (
|
||||
<DatePicker value={filters.monitoringDate} onChange={(value) => updateFilters((prev) => ({...prev, monitoringDate: value}))} placeholder="모니터링 일정" />
|
||||
)}
|
||||
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder="연번 or 사업명" />
|
||||
<Button type="button" variant="outline" onClick={refreshPerformanceList}>
|
||||
<Search className="h-4 w-4" />
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
<div className="grid gap-2 md:grid-cols-[183px_183px_183px_183px]">
|
||||
<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 상태" />
|
||||
<MultiFilterSelect value={filters.writtenReviewStatus} onChange={(value) => updateFilters((prev) => ({...prev, writtenReviewStatus: value}))} options={writtenReviewStatusOptions} placeholder="서면평가 상태" />
|
||||
</div>
|
||||
</div>
|
||||
</PagePanel>
|
||||
|
||||
<PagePanel>
|
||||
{canEdit && (
|
||||
<div className="mb-3 flex justify-end gap-2">
|
||||
<Button type="button" onClick={() => showDialog("performanceExcelRegisterDialog")}>
|
||||
<Upload className="h-4 w-4" />
|
||||
사업 등록
|
||||
</Button>
|
||||
<Button type="button" variant="outline" onClick={() => showDialog("assignWrittenExcelDialog")}>
|
||||
서면 평가 배정
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={filteredData}
|
||||
getRowId={(row) => String(row.id)}
|
||||
selectMode={isWrittenReviewer ? "none" : "click-event"}
|
||||
onRowClick={isWrittenReviewer ? undefined : openDetail}
|
||||
defaultPageSize={10}
|
||||
/>
|
||||
</PagePanel>
|
||||
|
||||
{!isWrittenReviewer && (
|
||||
<PerformanceDetailDialog
|
||||
open={detailOpen}
|
||||
onOpenChange={handlePerformanceDetailOpenChange}
|
||||
performance={detailData ?? data.find((item) => item.id === selectedId) ?? null}
|
||||
codes={codes}
|
||||
canEdit={canEdit}
|
||||
isWrittenReviewer={false}
|
||||
onSave={(draft) => updateMutation.mutate(draft)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<ExcelRegisterDialog
|
||||
open={performanceRegisterOpen}
|
||||
onOpenChange={handlePerformanceRegisterOpenChange}
|
||||
title="사업 등록"
|
||||
onDownloadTemplate={downloadPerformanceTemplate}
|
||||
onUpload={(file) => performanceUploadMutation.mutateAsync(file)}
|
||||
isUploading={performanceUploadMutation.isPending}
|
||||
/>
|
||||
|
||||
<ExcelRegisterDialog
|
||||
open={assignWrittenOpen}
|
||||
onOpenChange={handleAssignWrittenOpenChange}
|
||||
title="서면 평가 위원 배정"
|
||||
onDownloadTemplate={downloadWrittenAssignTemplate}
|
||||
onUpload={(file) => writtenAssignUploadMutation.mutateAsync(file)}
|
||||
isUploading={writtenAssignUploadMutation.isPending}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PerformancePage;
|
||||
|
||||
Reference in New Issue
Block a user