+
-
- {fileName}
-
+ {canDownload ? (
+
+ ) : (
+
+ {fileName}
+
+ )}
{onRemove ? (
diff --git a/apps/as/src/widgets/pbadms-sprt/ui/attachments-view-section.tsx b/apps/as/src/widgets/pbadms-sprt/ui/attachments-view-section.tsx
index 4a49e5855..2a492fd56 100644
--- a/apps/as/src/widgets/pbadms-sprt/ui/attachments-view-section.tsx
+++ b/apps/as/src/widgets/pbadms-sprt/ui/attachments-view-section.tsx
@@ -1,11 +1,9 @@
"use client";
-import { Paperclip } from "lucide-react";
-
import { formatFileSize } from "@/shared/lib/file-utils";
import type { AtflMngClientResponseDto, EsntlAtchFileMngTreeResponseDto } from "@/shared/model";
import { SectionCollapsible } from "@/shared/ui";
-import { useDownloadAttachmentByAtflCd, useDownloadAttachmentByAtflId } from "@/entities/attach";
+import { AttachmentDownloadLink } from "@/entities/attach";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
interface AttachmentsViewSectionProps {
@@ -14,9 +12,6 @@ interface AttachmentsViewSectionProps {
}
function AttachmentsViewSection({ esntlFileList, etcFileList }: AttachmentsViewSectionProps) {
- const { mutate: downloadByAtflCd } = useDownloadAttachmentByAtflCd();
- const { mutate: downloadByAtflId } = useDownloadAttachmentByAtflId();
-
return (
<>
{esntlFileList.length > 0 && (
@@ -48,14 +43,12 @@ function AttachmentsViewSection({ esntlFileList, etcFileList }: AttachmentsViewS
) : (
)}
@@ -95,13 +88,11 @@ function AttachmentsViewSection({ esntlFileList, etcFileList }: AttachmentsViewS
{file.atflCd ? (
- downloadByAtflCd(file.atflCd)}
- >
-
- {file.orgnlFileNm || file.physFileNm || file.atflId}
-
+
) : (
{file.orgnlFileNm || file.physFileNm || file.atflId}
)}
diff --git a/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-dialog.tsx b/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-dialog.tsx
index 2e225a286..8e1facf38 100644
--- a/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-dialog.tsx
+++ b/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-dialog.tsx
@@ -4,7 +4,7 @@ import { useEffect, useId, useState } from "react";
import { getDefaultFileKey, useTus } from "@/shared/lib";
import { AttachmentFileField } from "@/shared/ui";
-import { attachService } from "@/entities/attach";
+import { attachService, useDownloadAttachmentByAtflId } from "@/entities/attach";
import { CodeSelect } from "@/entities/code";
import {
Button,
@@ -96,6 +96,7 @@ function SplmntDmndDialog({
}: SplmntDmndDialogProps) {
const formId = useId();
const [rows, setRows] = useState([createEmptyRow()]);
+ const { mutate: downloadByAtflId } = useDownloadAttachmentByAtflId();
const { uploadFileAsync, isUploading, uploads } = useTus({
onSuccess: (atflCd, atflId, _file, fileKey) => {
@@ -289,6 +290,9 @@ function SplmntDmndDialog({
files={row.uploadedFiles.map((file) => ({
fileKey: file.fileKey,
fileName: file.fileName,
+ onDownload: file.atflId
+ ? () => downloadByAtflId(file.atflId!)
+ : undefined,
}))}
inputId={fileInputId}
isUploadingByKey={isUploading}
diff --git a/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-form-section.tsx b/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-form-section.tsx
index eea7fb7af..8fdbec031 100644
--- a/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-form-section.tsx
+++ b/apps/as/src/widgets/pbadms-sprt/ui/splmnt-dmnd-form-section.tsx
@@ -3,11 +3,9 @@
import { useEffect, useId, useRef, useState } from "react";
import { Controller, useFormContext, useWatch } from "react-hook-form";
-import { Paperclip } from "lucide-react";
-
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib";
import { AttachmentFileField, SectionCollapsible } from "@/shared/ui";
-import { attachService } from "@/entities/attach";
+import { AttachmentDownloadLink, attachService, useDownloadAttachmentByAtflId } from "@/entities/attach";
import {
Badge,
Table,
@@ -75,6 +73,7 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
const initialFilesMappedRef = useRef(false);
const isMountedRef = useRef(true);
const atflCdByRowRef = useRef>({});
+ const { mutate: downloadByAtflId } = useDownloadAttachmentByAtflId();
const { uploadFileAsync, isUploading, uploads } = useTus({
onSuccess: (atflCd, atflId, _file, fileKey) => {
@@ -274,10 +273,10 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
{item.splmntDmndCn || "-"}
{item.splmntDmndAtchFileGroupId ? (
-
-
- {item.splmntDmndAtchFileNm || "첨부파일"}
-
+
) : null}
@@ -308,6 +307,9 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
files={rowFiles.map((file) => ({
fileKey: file.fileKey,
fileName: file.fileName,
+ onDownload: file.atflId
+ ? () => downloadByAtflId(file.atflId!)
+ : undefined,
}))}
inputId={fileInputId}
isUploadingByKey={isUploading}
diff --git a/apps/as/src/widgets/pbadms-sprt/ui/supplement-demand-section.tsx b/apps/as/src/widgets/pbadms-sprt/ui/supplement-demand-section.tsx
index 1da222fdf..7151323bb 100644
--- a/apps/as/src/widgets/pbadms-sprt/ui/supplement-demand-section.tsx
+++ b/apps/as/src/widgets/pbadms-sprt/ui/supplement-demand-section.tsx
@@ -1,11 +1,9 @@
"use client";
-import { Paperclip } from "lucide-react";
-
import { dayjs } from "@/shared/lib";
import type { SplmntDmndResponseExtension, SplmntDmndSaveBase } from "@/shared/model";
import { SectionCollapsible } from "@/shared/ui";
-import { useDownloadAttachmentByAtflCd } from "@/entities/attach";
+import { AttachmentDownloadLink } from "@/entities/attach";
import {
Badge,
Table,
@@ -23,8 +21,6 @@ interface SupplementDemandSectionProps {
}
function SupplementDemandSection({ splmntDmndList }: SupplementDemandSectionProps) {
- const { mutate: downloadAttachment } = useDownloadAttachmentByAtflCd();
-
if (splmntDmndList.length === 0) {
return null;
}
@@ -70,13 +66,10 @@ function SupplementDemandSection({ splmntDmndList }: SupplementDemandSectionProp
@@ -89,13 +82,10 @@ function SupplementDemandSection({ splmntDmndList }: SupplementDemandSectionProp