Merge pull request '260623_07_ENH: 필터 옵션에 불필요 내용 제거, 모니터링에서 리스트 클릭시 select box에 선택 내용 적용 제거, 모니터링에서 도착이 아닌 경우 업로드 못하게 조치, 지자체 파일 업로드 항시 가능하게 수정' (#2) from develop into master
Reviewed-on: #2
This commit is contained in:
@@ -75,6 +75,7 @@ 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 = () => {
|
||||||
@@ -96,6 +97,11 @@ 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)
|
||||||
@@ -129,7 +135,7 @@ const MonitoringPage = () => {
|
|||||||
|
|
||||||
const visitOpen = isDialogOpen("monitoringVisitDialog");
|
const visitOpen = isDialogOpen("monitoringVisitDialog");
|
||||||
const detailOpen = isDialogOpen("monitoringDetailDialog");
|
const detailOpen = isDialogOpen("monitoringDetailDialog");
|
||||||
const {data: detailData} = usePerformanceDetailQuery(selected?.id ?? 0, Boolean(selected?.id && detailOpen));
|
const {data: detailData} = usePerformanceDetailQuery(detailId ?? 0, Boolean(detailId && detailOpen));
|
||||||
|
|
||||||
const openVisit = (mode: "departure" | "arrival") => {
|
const openVisit = (mode: "departure" | "arrival") => {
|
||||||
setVisitMode(mode);
|
setVisitMode(mode);
|
||||||
@@ -264,7 +270,7 @@ const MonitoringPage = () => {
|
|||||||
getRowId={(row) => String(row.id)}
|
getRowId={(row) => String(row.id)}
|
||||||
selectMode="click-event"
|
selectMode="click-event"
|
||||||
onRowClick={(item) => {
|
onRowClick={(item) => {
|
||||||
setSelectedId(item.id);
|
setDetailId(item.id);
|
||||||
showDialog("monitoringDetailDialog");
|
showDialog("monitoringDetailDialog");
|
||||||
}}
|
}}
|
||||||
highlightRowIds={selected ? [String(selected.id)] : []}
|
highlightRowIds={selected ? [String(selected.id)] : []}
|
||||||
@@ -301,9 +307,10 @@ const MonitoringPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hideDialog("monitoringDetailDialog");
|
hideDialog("monitoringDetailDialog");
|
||||||
|
setDetailId(null);
|
||||||
refreshMonitoringList();
|
refreshMonitoringList();
|
||||||
}}
|
}}
|
||||||
performance={detailData ?? selected}
|
performance={detailData ?? detailSelected}
|
||||||
codes={codes}
|
codes={codes}
|
||||||
userId={userId}
|
userId={userId}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function LoadingOverlay({ force = false }: { force?: boolean }) {
|
|||||||
return (
|
return (
|
||||||
<div className="fixed inset-0 z-[9999] bg-black/60 flex items-center justify-center">
|
<div className="fixed inset-0 z-[9999] bg-black/60 flex items-center justify-center">
|
||||||
{/* 심플 로딩 인디케이터 */}
|
{/* 심플 로딩 인디케이터 */}
|
||||||
<div className="h-20 w-20 rounded-full border-10 !border-white/45 !border-t-white animate-spin" />
|
<div className="h-20 w-20 rounded-full border-10 border-white/45! border-t-white! animate-spin" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -64,12 +64,14 @@ function ActionButton({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function MonitoringReviewActions({
|
function MonitoringReviewActions({
|
||||||
|
canUpload,
|
||||||
performanceId,
|
performanceId,
|
||||||
reviewType,
|
reviewType,
|
||||||
userId,
|
userId,
|
||||||
uploadFileName,
|
uploadFileName,
|
||||||
pdfFileName,
|
pdfFileName,
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
|
canUpload: boolean;
|
||||||
performanceId: number;
|
performanceId: number;
|
||||||
reviewType: number;
|
reviewType: number;
|
||||||
userId?: string;
|
userId?: string;
|
||||||
@@ -112,7 +114,7 @@ function MonitoringReviewActions({
|
|||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-2 gap-2">
|
<div className="grid grid-cols-2 gap-2">
|
||||||
<input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} />
|
<input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} />
|
||||||
<ActionButton icon="upload" disabled={uploadMutation.isPending} onClick={() => fileInputRef.current?.click()}>파일 업로드</ActionButton>
|
<ActionButton icon="upload" disabled={!canUpload || uploadMutation.isPending} onClick={() => fileInputRef.current?.click()}>파일 업로드</ActionButton>
|
||||||
<ActionButton disabled={!userId || !uploadFileName || originalMutation.isPending} onClick={downloadOriginal}>원본</ActionButton>
|
<ActionButton disabled={!userId || !uploadFileName || originalMutation.isPending} onClick={downloadOriginal}>원본</ActionButton>
|
||||||
<ActionButton disabled={!userId || !pdfFileName || pdfMutation.isPending} onClick={downloadPdf}>PDF</ActionButton>
|
<ActionButton disabled={!userId || !pdfFileName || pdfMutation.isPending} onClick={downloadPdf}>PDF</ActionButton>
|
||||||
<ActionButton icon="preview" disabled={!userId || !pdfFileName} onClick={previewPdf}>미리보기</ActionButton>
|
<ActionButton icon="preview" disabled={!userId || !pdfFileName} onClick={previewPdf}>미리보기</ActionButton>
|
||||||
@@ -230,6 +232,7 @@ export function MonitoringPerformanceDetailDialog({
|
|||||||
</div>
|
</div>
|
||||||
{row ? (
|
{row ? (
|
||||||
<MonitoringReviewActions
|
<MonitoringReviewActions
|
||||||
|
canUpload={[3, 10].includes(row.review?.reviewStatus ?? 0)}
|
||||||
performanceId={performance.id}
|
performanceId={performance.id}
|
||||||
reviewType={row.reviewType}
|
reviewType={row.reviewType}
|
||||||
userId={row.review?.regUser || row.userId}
|
userId={row.review?.regUser || row.userId}
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ function ReviewFileActions({
|
|||||||
userId,
|
userId,
|
||||||
uploadFileName,
|
uploadFileName,
|
||||||
pdfFileName,
|
pdfFileName,
|
||||||
|
canUpload,
|
||||||
canEdit,
|
canEdit,
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
performanceId: number;
|
performanceId: number;
|
||||||
@@ -120,6 +121,7 @@ function ReviewFileActions({
|
|||||||
userId?: string;
|
userId?: string;
|
||||||
uploadFileName?: string;
|
uploadFileName?: string;
|
||||||
pdfFileName?: string;
|
pdfFileName?: string;
|
||||||
|
canUpload: boolean;
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
}>) {
|
}>) {
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
@@ -127,7 +129,6 @@ function ReviewFileActions({
|
|||||||
const originalMutation = useDownloadReviewOriginalMutation();
|
const originalMutation = useDownloadReviewOriginalMutation();
|
||||||
const pdfMutation = useDownloadReviewPdfMutation();
|
const pdfMutation = useDownloadReviewPdfMutation();
|
||||||
const {withLoadingAsync} = useLoading();
|
const {withLoadingAsync} = useLoading();
|
||||||
const complete = Boolean(pdfFileName);
|
|
||||||
|
|
||||||
const upload = async (file?: File) => {
|
const upload = async (file?: File) => {
|
||||||
try {
|
try {
|
||||||
@@ -168,7 +169,7 @@ function ReviewFileActions({
|
|||||||
{canEdit && (
|
{canEdit && (
|
||||||
<>
|
<>
|
||||||
<input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} />
|
<input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} />
|
||||||
<FileActionButton icon="upload" disabled={uploadMutation.isPending || !complete} onClick={() => fileInputRef.current?.click()}>파일 업로드</FileActionButton>
|
<FileActionButton icon="upload" disabled={uploadMutation.isPending || !canUpload} onClick={() => fileInputRef.current?.click()}>파일 업로드</FileActionButton>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<FileActionButton icon="download" disabled={!userId || !uploadFileName || originalMutation.isPending} onClick={downloadOriginal}>원본</FileActionButton>
|
<FileActionButton icon="download" disabled={!userId || !uploadFileName || originalMutation.isPending} onClick={downloadOriginal}>원본</FileActionButton>
|
||||||
@@ -232,7 +233,15 @@ function LocalGovernmentReviewRow({
|
|||||||
<div className="font-semibold">지자체</div>
|
<div className="font-semibold">지자체</div>
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
<StatusPill variant={display.variant}>{display.label}</StatusPill>
|
<StatusPill variant={display.variant}>{display.label}</StatusPill>
|
||||||
<ReviewFileActions performanceId={performance.id} reviewType={reviewType} userId={review?.regUser || userId} uploadFileName={review?.uploadFileName} pdfFileName={review?.pdfFileName} canEdit={true} />
|
<ReviewFileActions
|
||||||
|
performanceId={performance.id}
|
||||||
|
reviewType={reviewType}
|
||||||
|
userId={review?.regUser || userId}
|
||||||
|
uploadFileName={review?.uploadFileName}
|
||||||
|
pdfFileName={review?.pdfFileName}
|
||||||
|
canUpload={true}
|
||||||
|
canEdit={true}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -267,7 +276,15 @@ function MonitoringStatusRow({
|
|||||||
<AssignedUserInfo userId={row.userId} user={user} codes={codes} type="monitoring" />
|
<AssignedUserInfo userId={row.userId} user={user} codes={codes} type="monitoring" />
|
||||||
<div className="flex flex-wrap items-center gap-2 mb-2">
|
<div className="flex flex-wrap items-center gap-2 mb-2">
|
||||||
<StatusPill variant={display.variant}>{display.label}</StatusPill>
|
<StatusPill variant={display.variant}>{display.label}</StatusPill>
|
||||||
<ReviewFileActions performanceId={performance.id} reviewType={row.reviewType} userId={row.review?.regUser || row.userId} uploadFileName={row.review?.uploadFileName} pdfFileName={row.review?.pdfFileName} canEdit={canEdit} />
|
<ReviewFileActions
|
||||||
|
performanceId={performance.id}
|
||||||
|
reviewType={row.reviewType}
|
||||||
|
userId={row.review?.regUser || row.userId}
|
||||||
|
uploadFileName={row.review?.uploadFileName}
|
||||||
|
pdfFileName={row.review?.pdfFileName}
|
||||||
|
canUpload={canEdit && isReviewComplete(row.review)}
|
||||||
|
canEdit={canEdit}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{row.slot.visit?.length ? (
|
{row.slot.visit?.length ? (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1385,11 +1385,7 @@ function MultiSelectInner(
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<span>
|
<span>
|
||||||
(전체 선택
|
(전체 선택)
|
||||||
{getAllOptions().length > 20
|
|
||||||
? ` - ${getAllOptions().length} options`
|
|
||||||
: ""}
|
|
||||||
)
|
|
||||||
</span>
|
</span>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user