summaryrefslogtreecommitdiff
path: root/lib/vendor-rfq-response/vendor-tbe-table/tbe-table-columns.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vendor-rfq-response/vendor-tbe-table/tbe-table-columns.tsx')
-rw-r--r--lib/vendor-rfq-response/vendor-tbe-table/tbe-table-columns.tsx65
1 files changed, 49 insertions, 16 deletions
diff --git a/lib/vendor-rfq-response/vendor-tbe-table/tbe-table-columns.tsx b/lib/vendor-rfq-response/vendor-tbe-table/tbe-table-columns.tsx
index 7a95d7ed..f664d9a3 100644
--- a/lib/vendor-rfq-response/vendor-tbe-table/tbe-table-columns.tsx
+++ b/lib/vendor-rfq-response/vendor-tbe-table/tbe-table-columns.tsx
@@ -31,6 +31,8 @@ interface GetColumnsProps {
openCommentSheet: (vendorId: number) => void
handleDownloadTbeTemplate: (tbeId: number, vendorId: number, rfqId: number) => void
handleUploadTbeResponse: (tbeId: number, vendorId: number, rfqId: number, vendorResponseId:number) => void
+ openVendorContactsDialog: (rfqId: number, rfq: TbeVendorFields) => void // 수정된 시그니처
+
}
/**
@@ -42,6 +44,7 @@ export function getColumns({
openCommentSheet,
handleDownloadTbeTemplate,
handleUploadTbeResponse,
+ openVendorContactsDialog
}: GetColumnsProps): ColumnDef<TbeVendorFields>[] {
// ----------------------------------------------------------------
// 1) Select 컬럼 (체크박스)
@@ -112,7 +115,30 @@ export function getColumns({
)
}
-
+
+ if (cfg.id === "rfqCode") {
+ const rfq = row.original;
+ const rfqId = rfq.rfqId;
+
+ // 협력업체 이름을 클릭할 수 있는 버튼으로 렌더링
+ const handleVendorNameClick = () => {
+ if (rfqId) {
+ openVendorContactsDialog(rfqId, rfq); // vendor 전체 객체 전달
+ } else {
+ toast.error("협력업체 ID를 찾을 수 없습니다.");
+ }
+ };
+
+ return (
+ <Button
+ variant="link"
+ className="p-0 h-auto text-left font-normal justify-start hover:underline"
+ onClick={handleVendorNameClick}
+ >
+ {val as string}
+ </Button>
+ );
+ }
if (cfg.id === "rfqVendorStatus") {
const statusVal = row.original.rfqVendorStatus
if (!statusVal) return null
@@ -173,21 +199,28 @@ export function getColumns({
}
return (
- <div>
- <Button
- variant="ghost"
- size="sm"
- className="h-8 w-8 p-0 group relative"
- onClick={handleClick}
- aria-label={commCount > 0 ? `View ${commCount} comments` : "Add comment"}
- >
- <div className="flex items-center justify-center relative">
- <MessageSquare className="h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" />
- </div>
- {commCount > 0 && <span className="absolute -top-1 -right-1 inline-flex h-2 w-2 rounded-full bg-red-500"></span>}
- <span className="sr-only">{commCount > 0 ? `${commCount} Comments` : "Add Comment"}</span>
- </Button>
- </div>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="relative h-8 w-8 p-0 group"
+ onClick={handleClick}
+ aria-label={
+ commCount > 0 ? `View ${commCount} comments` : "No comments"
+ }
+ >
+ <MessageSquare className="h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" />
+ {commCount > 0 && (
+ <Badge
+ variant="secondary"
+ className="pointer-events-none absolute -top-1 -right-1 h-4 min-w-[1rem] p-0 text-[0.625rem] leading-none flex items-center justify-center"
+ >
+ {commCount}
+ </Badge>
+ )}
+ <span className="sr-only">
+ {commCount > 0 ? `${commCount} Comments` : "No Comments"}
+ </span>
+ </Button>
)
},
enableSorting: false,