summaryrefslogtreecommitdiff
path: root/lib/techsales-rfq/table/rfq-table.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/techsales-rfq/table/rfq-table.tsx')
-rw-r--r--lib/techsales-rfq/table/rfq-table.tsx22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/techsales-rfq/table/rfq-table.tsx b/lib/techsales-rfq/table/rfq-table.tsx
index 424ca70e..615753cd 100644
--- a/lib/techsales-rfq/table/rfq-table.tsx
+++ b/lib/techsales-rfq/table/rfq-table.tsx
@@ -57,6 +57,7 @@ interface TechSalesRfq {
ptypeNm: string
attachmentCount: number
quotationCount: number
+ rfqType: "SHIP" | "TOP" | "HULL" | null
// 필요에 따라 다른 필드들 추가
[key: string]: unknown
}
@@ -135,7 +136,7 @@ export function RFQListTable({
to: searchParams?.get('to') || undefined,
columnVisibility: {},
columnOrder: [],
- pinnedColumns: { left: [], right: ["items", "attachments"] },
+ pinnedColumns: { left: [], right: ["items", "attachments", "tbe-attachments", "cbe-attachments"] },
groupBy: [],
expandedRows: []
}), [searchParams])
@@ -170,6 +171,7 @@ export function RFQListTable({
setSelectedRfq({
id: rfqData.id,
rfqCode: rfqData.rfqCode,
+ rfqType: rfqData.rfqType, // 빠뜨린 rfqType 필드 추가
biddingProjectId: rfqData.biddingProjectId,
materialCode: rfqData.materialCode,
dueDate: rfqData.dueDate,
@@ -201,6 +203,7 @@ export function RFQListTable({
setProjectDetailRfq({
id: projectRfqData.id,
rfqCode: projectRfqData.rfqCode,
+ rfqType: projectRfqData.rfqType, // 빠뜨린 rfqType 필드 추가
biddingProjectId: projectRfqData.biddingProjectId,
materialCode: projectRfqData.materialCode,
dueDate: projectRfqData.dueDate,
@@ -238,8 +241,11 @@ export function RFQListTable({
}
}, [rowAction])
+ // 첨부파일 시트 상태에 타입 추가
+ const [attachmentType, setAttachmentType] = React.useState<"RFQ_COMMON" | "TBE_RESULT" | "CBE_RESULT">("RFQ_COMMON")
+
// 첨부파일 시트 열기 함수
- const openAttachmentsSheet = React.useCallback(async (rfqId: number) => {
+ const openAttachmentsSheet = React.useCallback(async (rfqId: number, attachmentType: 'RFQ_COMMON' | 'TBE_RESULT' | 'CBE_RESULT' = 'RFQ_COMMON') => {
try {
// 선택된 RFQ 찾기
const rfq = tableData?.data?.find(r => r.id === rfqId)
@@ -248,6 +254,9 @@ export function RFQListTable({
return
}
+ // attachmentType을 RFQ_COMMON, TBE_RESULT, CBE_RESULT 중 하나로 변환
+ const validAttachmentType=attachmentType as "RFQ_COMMON" | "TBE_RESULT" | "CBE_RESULT"
+
// 실제 첨부파일 목록 조회 API 호출
const result = await getTechSalesRfqAttachments(rfqId)
@@ -256,8 +265,11 @@ export function RFQListTable({
return
}
+ // 해당 타입의 첨부파일만 필터링
+ const filteredAttachments = result.data.filter(att => att.attachmentType === validAttachmentType)
+
// API 응답을 ExistingTechSalesAttachment 형식으로 변환
- const attachments: ExistingTechSalesAttachment[] = result.data.map(att => ({
+ const attachments: ExistingTechSalesAttachment[] = filteredAttachments.map(att => ({
id: att.id,
techSalesRfqId: att.techSalesRfqId || rfqId, // null인 경우 rfqId 사용
fileName: att.fileName,
@@ -265,12 +277,13 @@ export function RFQListTable({
filePath: att.filePath,
fileSize: att.fileSize || undefined,
fileType: att.fileType || undefined,
- attachmentType: att.attachmentType as "RFQ_COMMON" | "VENDOR_SPECIFIC",
+ attachmentType: att.attachmentType as "RFQ_COMMON" | "TBE_RESULT" | "CBE_RESULT",
description: att.description || undefined,
createdBy: att.createdBy,
createdAt: att.createdAt,
}))
+ setAttachmentType(validAttachmentType)
setAttachmentsDefault(attachments)
setSelectedRfqForAttachments(rfq as unknown as TechSalesRfq)
setAttachmentsOpen(true)
@@ -561,6 +574,7 @@ export function RFQListTable({
onOpenChange={setAttachmentsOpen}
defaultAttachments={attachmentsDefault}
rfq={selectedRfqForAttachments}
+ attachmentType={attachmentType}
onAttachmentsUpdated={handleAttachmentsUpdated}
/>