diff options
Diffstat (limited to 'lib/b-rfq')
| -rw-r--r-- | lib/b-rfq/attachment/attachment-columns.tsx | 8 | ||||
| -rw-r--r-- | lib/b-rfq/attachment/revision-dialog.tsx | 2 | ||||
| -rw-r--r-- | lib/b-rfq/final/final-rfq-detail-columns.tsx | 4 | ||||
| -rw-r--r-- | lib/b-rfq/initial/initial-rfq-detail-columns.tsx | 6 | ||||
| -rw-r--r-- | lib/b-rfq/service.ts | 37 | ||||
| -rw-r--r-- | lib/b-rfq/vendor-response/vendor-responses-table.tsx | 12 |
6 files changed, 36 insertions, 33 deletions
diff --git a/lib/b-rfq/attachment/attachment-columns.tsx b/lib/b-rfq/attachment/attachment-columns.tsx index c611e06c..b726ebc8 100644 --- a/lib/b-rfq/attachment/attachment-columns.tsx +++ b/lib/b-rfq/attachment/attachment-columns.tsx @@ -156,13 +156,13 @@ export function getAttachmentColumns({ const updated = row.original.updatedAt as Date return ( <div> - <div>{formatDate(created)}</div> + <div>{formatDate(created, "KR")}</div> <div className="text-xs text-muted-foreground"> {row.original.createdByName} </div> {updated && new Date(updated) > new Date(created) && ( <div className="text-xs text-blue-600"> - 수정: {formatDate(updated)} + 수정: {formatDate(updated, "KR")} </div> )} </div> @@ -252,10 +252,6 @@ export function getAttachmentColumns({ <MessageSquare className="mr-2 h-4 w-4" /> 벤더 응답 보기 </DropdownMenuItem> - <DropdownMenuItem> - <Eye className="mr-2 h-4 w-4" /> - 미리보기 - </DropdownMenuItem> <DropdownMenuItem onClick={() => row.original.filePath && window.open(row.original.filePath, "_blank")} > diff --git a/lib/b-rfq/attachment/revision-dialog.tsx b/lib/b-rfq/attachment/revision-dialog.tsx index b1fe1576..d26abedb 100644 --- a/lib/b-rfq/attachment/revision-dialog.tsx +++ b/lib/b-rfq/attachment/revision-dialog.tsx @@ -143,7 +143,7 @@ export function RevisionDialog({ </TableCell> <TableCell> - {formatDate(revision.createdAt)} + {formatDate(revision.createdAt, "KR")} </TableCell> <TableCell> diff --git a/lib/b-rfq/final/final-rfq-detail-columns.tsx b/lib/b-rfq/final/final-rfq-detail-columns.tsx index 832923eb..88d62765 100644 --- a/lib/b-rfq/final/final-rfq-detail-columns.tsx +++ b/lib/b-rfq/final/final-rfq-detail-columns.tsx @@ -351,7 +351,7 @@ export function getFinalRfqDetailColumns({ const deliveryDate = row.getValue("deliveryDate") as Date return deliveryDate ? ( <div className="text-sm"> - {formatDate(deliveryDate)} + {formatDate(deliveryDate, "KR")} </div> ) : ( <span className="text-muted-foreground">-</span> @@ -487,7 +487,7 @@ export function getFinalRfqDetailColumns({ const updated = row.getValue("updatedAt") as Date return updated ? ( <div className="text-sm"> - {formatDate(updated)} + {formatDate(updated, "KR")} </div> ) : ( <span className="text-muted-foreground">-</span> diff --git a/lib/b-rfq/initial/initial-rfq-detail-columns.tsx b/lib/b-rfq/initial/initial-rfq-detail-columns.tsx index f2be425c..2d9c3a68 100644 --- a/lib/b-rfq/initial/initial-rfq-detail-columns.tsx +++ b/lib/b-rfq/initial/initial-rfq-detail-columns.tsx @@ -288,7 +288,7 @@ export function getInitialRfqDetailColumns({ const validDate = row.getValue("validDate") as Date return validDate ? ( <div className="text-sm"> - {formatDate(validDate)} + {formatDate(validDate, "KR")} </div> ) : ( <span className="text-muted-foreground">-</span> @@ -307,7 +307,7 @@ export function getInitialRfqDetailColumns({ return dueDate ? ( <div className={`${isOverdue ? 'text-red-600' : ''}`}> - <div className="font-medium">{formatDate(dueDate)}</div> + <div className="font-medium">{formatDate(dueDate, "KR")}</div> {isOverdue && ( <div className="text-xs text-red-600">지연</div> )} @@ -384,7 +384,7 @@ export function getInitialRfqDetailColumns({ return ( <div className="space-y-1"> - <div className="text-sm">{formatDate(created)}</div> + <div className="text-sm">{formatDate(created, "KR")}</div> {updated && new Date(updated) > new Date(created) && ( <div className="text-xs text-blue-600"> 수정: {formatDate(updated, "KR")} diff --git a/lib/b-rfq/service.ts b/lib/b-rfq/service.ts index 4def634b..2ef57b34 100644 --- a/lib/b-rfq/service.ts +++ b/lib/b-rfq/service.ts @@ -498,7 +498,7 @@ export async function getVendorResponsesForAttachment( rfqType: 'INITIAL' | 'FINAL' = 'INITIAL' ) { try { - // 1. 기본 벤더 응답 정보 가져오기 + // 1. 기본 벤더 응답 정보 가져오기 (첨부파일 정보와 조인) const responses = await db .select({ id: vendorAttachmentResponses.id, @@ -510,10 +510,16 @@ export async function getVendorResponsesForAttachment( rfqType: vendorAttachmentResponses.rfqType, rfqRecordId: vendorAttachmentResponses.rfqRecordId, responseStatus: vendorAttachmentResponses.responseStatus, - currentRevision: vendorAttachmentResponses.currentRevision, + + // 첨부파일의 현재 리비전 (가장 중요!) + currentRevision: bRfqsAttachments.currentRevision, + + // 벤더가 응답한 리비전 respondedRevision: vendorAttachmentResponses.respondedRevision, + responseComment: vendorAttachmentResponses.responseComment, vendorComment: vendorAttachmentResponses.vendorComment, + // 새로 추가된 필드들 revisionRequestComment: vendorAttachmentResponses.revisionRequestComment, revisionRequestedAt: vendorAttachmentResponses.revisionRequestedAt, @@ -523,6 +529,7 @@ export async function getVendorResponsesForAttachment( }) .from(vendorAttachmentResponses) .leftJoin(vendors, eq(vendorAttachmentResponses.vendorId, vendors.id)) + .leftJoin(bRfqsAttachments, eq(vendorAttachmentResponses.attachmentId, bRfqsAttachments.id)) .where( and( eq(vendorAttachmentResponses.attachmentId, attachmentId), @@ -553,15 +560,23 @@ export async function getVendorResponsesForAttachment( .orderBy(desc(vendorResponseAttachmentsB.uploadedAt)); } - // 3. 응답에 파일 정보 병합 - const enhancedResponses = responses.map(response => ({ - ...response, - files: responseFiles.filter(file => file.vendorResponseId === response.id), - totalFiles: responseFiles.filter(file => file.vendorResponseId === response.id).length, - latestFile: responseFiles - .filter(file => file.vendorResponseId === response.id) - .sort((a, b) => new Date(b.uploadedAt).getTime() - new Date(a.uploadedAt).getTime())[0] || null, - })); + // 3. 응답에 파일 정보 병합 및 리비전 상태 체크 + const enhancedResponses = responses.map(response => { + const files = responseFiles.filter(file => file.vendorResponseId === response.id); + const latestFile = files + .sort((a, b) => new Date(b.uploadedAt).getTime() - new Date(a.uploadedAt).getTime())[0] || null; + + // 벤더가 최신 리비전에 응답했는지 체크 + const isUpToDate = response.respondedRevision === response.currentRevision; + + return { + ...response, + files, + totalFiles: files.length, + latestFile, + isUpToDate, // 최신 리비전 응답 여부 + }; + }); return enhancedResponses; } catch (err) { diff --git a/lib/b-rfq/vendor-response/vendor-responses-table.tsx b/lib/b-rfq/vendor-response/vendor-responses-table.tsx index 251b1ad0..02a5fa59 100644 --- a/lib/b-rfq/vendor-response/vendor-responses-table.tsx +++ b/lib/b-rfq/vendor-response/vendor-responses-table.tsx @@ -52,20 +52,12 @@ export function VendorResponsesTable({ promises }: VendorResponsesTableProps) { ] }, - { - id: "rfqCode", - label: "RFQ 번호", - placeholder: "RFQ 번호 검색...", - } + ]; // 고급 필터 필드 const advancedFilterFields: DataTableAdvancedFilterField<VendorRfqResponseSummary>[] = [ - { - id: "rfqCode", - label: "RFQ 번호", - type: "text", - }, + { id: "overallStatus", label: "전체 상태", |
