260625_01_ENH: 연구, 실사 수정사항 적용 1차
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import {useIsFetching} from "@tanstack/react-query";
|
||||
import {useIsFetching, useIsMutating} from "@tanstack/react-query";
|
||||
import {useLoading} from "@/hooks/useLoading";
|
||||
import {useEffect} from "react";
|
||||
|
||||
const ReactQueryLoadingSync = () => {
|
||||
const fetching = useIsFetching();
|
||||
const mutating = useIsMutating();
|
||||
const { showLoading, hideLoading } = useLoading();
|
||||
|
||||
useEffect(() => {
|
||||
if (fetching > 0) showLoading();
|
||||
if (fetching > 0 || mutating > 0) showLoading();
|
||||
else hideLoading();
|
||||
}, [fetching, showLoading, hideLoading]);
|
||||
}, [fetching, mutating, showLoading, hideLoading]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export default ReactQueryLoadingSync;
|
||||
export default ReactQueryLoadingSync;
|
||||
|
||||
@@ -48,7 +48,9 @@ export function DataTable<TData>({
|
||||
defaultPageSize = 10,
|
||||
pageSizeOptions = [5, 10, 25, 50],
|
||||
showPagination = true,
|
||||
paginationItemsToDisplay = 5
|
||||
paginationItemsToDisplay = 5,
|
||||
headerFontClass = 'content-text-lg',
|
||||
cellFontClass = 'content-text-base',
|
||||
}: Readonly<DataTableProps<TData>>) {
|
||||
// Pagination state
|
||||
const [pagination, setPagination] = useState<PaginationState>({
|
||||
@@ -200,7 +202,8 @@ export function DataTable<TData>({
|
||||
<TableHead
|
||||
key={header.id}
|
||||
className={cn(
|
||||
'content-text-lg font-semibold text-gray-900',
|
||||
'font-semibold text-gray-900',
|
||||
headerFontClass,
|
||||
column.id === 'actions' && 'w-[140px] text-center'
|
||||
)}
|
||||
style={{ width: header.getSize() !== 150 ? header.getSize() : undefined }}
|
||||
@@ -209,7 +212,7 @@ export function DataTable<TData>({
|
||||
<Button
|
||||
type='button'
|
||||
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()}
|
||||
>
|
||||
<span>{headerContent}</span>
|
||||
@@ -240,7 +243,7 @@ export function DataTable<TData>({
|
||||
onPointerCancel={drag.onPointerCancel}
|
||||
onClick={drag.wrapClick(() => handleRowClick(row))}
|
||||
className={cn(
|
||||
'content-text-base',
|
||||
cellFontClass,
|
||||
'[&>td]:py-3 [&>td]:px-3',
|
||||
selectMode !== 'none' && 'cursor-pointer',
|
||||
'data-[state=selected]:bg-slate-100 data-[state=selected]:font-semibold',
|
||||
|
||||
@@ -38,4 +38,6 @@ export interface DataTableProps<TData> {
|
||||
pageSizeOptions?: number[];
|
||||
showPagination?: boolean;
|
||||
paginationItemsToDisplay?: number;
|
||||
headerFontClass?: string;
|
||||
cellFontClass?: string;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ export function AssignMonitoringDialog({
|
||||
[PERFORMANCE_FIELD_LABELS.performanceName, selected?.performanceName],
|
||||
[PERFORMANCE_FIELD_LABELS.performanceDtInfo, selected?.performanceDtInfo],
|
||||
[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.monitoringAddress, selected?.performanceMonitoringSchedule?.monitoringAddress],
|
||||
[PERFORMANCE_FIELD_LABELS.ticketReservationStatus, getCodeLabel(codes, "ticket_reservation_status", selected?.ticketReservationStatus)],
|
||||
@@ -171,7 +171,7 @@ export function AssignMonitoringDialog({
|
||||
].map(([label, value]) => (
|
||||
<tr key={String(label)}>
|
||||
<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>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
buildEvidenceImageSrc,
|
||||
buildImagePreviewUrl,
|
||||
buildReviewPdfPreviewUrl,
|
||||
buildReviewTemplatePdfPreviewUrl,
|
||||
downloadBlob,
|
||||
downloadFromUrl,
|
||||
getEvidenceZipDownloadName,
|
||||
@@ -39,25 +40,27 @@ function MobileDetailRow({label, children}: {label: string; children: ReactNode}
|
||||
return (
|
||||
<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="break-words text-sm">{children || "-"}</div>
|
||||
<div className="break-words text-sm">{children ?? "-"}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ActionButton({
|
||||
children,
|
||||
className,
|
||||
icon = "download",
|
||||
disabled = false,
|
||||
onClick,
|
||||
}: Readonly<{
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
icon?: "download" | "upload" | "image" | "preview";
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
}>) {
|
||||
const Icon = icon === "upload" ? Upload : icon === "image" ? ImageIcon : icon === "preview" ? ScanSearch : Download;
|
||||
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" />
|
||||
{children}
|
||||
</Button>
|
||||
@@ -190,7 +193,12 @@ export function MonitoringPerformanceDetailDialog({
|
||||
)
|
||||
: {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 (
|
||||
<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.ticketReservationStatus}>{getCodeLabel(codes, "ticket_reservation_status", performance.ticketReservationStatus)}</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.monitoringAddress}>{performance.performanceMonitoringSchedule?.monitoringAddress}</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="font-semibold">나의 진행 상태</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button type="button" size="sm" variant="outline" onClick={downloadTemplate}>
|
||||
<Download className="h-4 w-4" />
|
||||
양식
|
||||
</Button>
|
||||
<ActionButton icon="preview" onClick={previewTemplate} className="min-h-5">미리보기</ActionButton>
|
||||
<ActionButton icon="download" onClick={downloadTemplate} className="min-h-5">양식</ActionButton>
|
||||
<StatusPill variant={status.variant}>{status.label}</StatusPill>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@ function DetailRow({label, children}: {label: string; children: ReactNode}) {
|
||||
return (
|
||||
<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="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>
|
||||
);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export function MonitoringVisitDialog({
|
||||
<div className="rounded-md border">
|
||||
<DetailRow label="현재 시간">{nowText}</DetailRow>
|
||||
<DetailRow label="모니터링 일정">
|
||||
{performance?.performanceMonitoringSchedule?.monitoringDate} {performance?.performanceMonitoringSchedule?.monitoringTimeInfo}
|
||||
{[performance?.performanceMonitoringSchedule?.monitoringDate, performance?.performanceMonitoringSchedule?.monitoringTimeInfo].filter(Boolean).join(" ")}
|
||||
</DetailRow>
|
||||
<DetailRow label="사업명">{performance?.performanceName}</DetailRow>
|
||||
<DetailRow label="장소">{performance?.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
||||
|
||||
@@ -45,12 +45,13 @@ import {
|
||||
import {PERFORMANCE_FIELD_LABELS, USER_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||
|
||||
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
||||
type PerformanceDetail = PerformanceCompact["performanceDetail"];
|
||||
|
||||
function DetailRow({label, children}: {label: string; children: ReactNode}) {
|
||||
return (
|
||||
<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="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>
|
||||
);
|
||||
}
|
||||
@@ -225,6 +226,11 @@ function LocalGovernmentReviewRow({
|
||||
const fallbackReviewRow = getReviewByType(performance as PerformanceFull, reviewType);
|
||||
const userId = fallbackReviewRow?.review.regUser || fallbackReviewRow?.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 label = getCodeLabel(codes, "review_status", review?.reviewStatus);
|
||||
const display = getReviewStatusDisplay(label, review, true);
|
||||
@@ -319,6 +325,10 @@ function WrittenReviewRows({
|
||||
userMap: Map<string, UserFull>;
|
||||
canEdit: boolean;
|
||||
}>) {
|
||||
if(performance.id % 100 !== 1){
|
||||
return null;
|
||||
}
|
||||
|
||||
const rows = getWrittenReviewRows(performance as PerformanceFull);
|
||||
|
||||
if(rows.length === 0){
|
||||
@@ -419,6 +429,16 @@ export function PerformanceDetailDialog({
|
||||
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]) => {
|
||||
setDraft((prev) => prev ? {
|
||||
...prev,
|
||||
@@ -481,10 +501,13 @@ export function PerformanceDetailDialog({
|
||||
<div className="grid gap-4 lg:grid-cols-[1.1fr_0.9fr]">
|
||||
<div className="space-y-4">
|
||||
<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.monitoringAdd}>{draft.id % 100 !== 1? "추가" : ""}</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.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.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>
|
||||
@@ -496,10 +519,15 @@ export function PerformanceDetailDialog({
|
||||
) : getCodeLabel(codes, "ticket_reservation_status", draft.ticketReservationStatus)}
|
||||
</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.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.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 className="rounded-md border">
|
||||
|
||||
Reference in New Issue
Block a user