summaryrefslogtreecommitdiff
path: root/lib/rfqs/cbe-table/cbe-table-columns.tsx
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-04-28 02:13:30 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-04-28 02:13:30 +0000
commitef4c533ebacc2cdc97e518f30e9a9350004fcdfb (patch)
tree345251a3ed0f4429716fa5edaa31024d8f4cb560 /lib/rfqs/cbe-table/cbe-table-columns.tsx
parent9ceed79cf32c896f8a998399bf1b296506b2cd4a (diff)
~20250428 작업사항
Diffstat (limited to 'lib/rfqs/cbe-table/cbe-table-columns.tsx')
-rw-r--r--lib/rfqs/cbe-table/cbe-table-columns.tsx92
1 files changed, 55 insertions, 37 deletions
diff --git a/lib/rfqs/cbe-table/cbe-table-columns.tsx b/lib/rfqs/cbe-table/cbe-table-columns.tsx
index 325b0465..bc16496f 100644
--- a/lib/rfqs/cbe-table/cbe-table-columns.tsx
+++ b/lib/rfqs/cbe-table/cbe-table-columns.tsx
@@ -34,8 +34,9 @@ interface GetColumnsProps {
React.SetStateAction<DataTableRowAction<VendorWithCbeFields> | null>
>
router: NextRouter
- openCommentSheet: (vendorId: number) => void
- openFilesDialog: (cbeId:number , vendorId: number) => void
+ openCommentSheet: (responseId: number) => void
+ openVendorContactsDialog: (vendorId: number, vendor: VendorWithCbeFields) => void // 수정된 시그니처
+
}
/**
@@ -45,7 +46,7 @@ export function getColumns({
setRowAction,
router,
openCommentSheet,
- openFilesDialog
+ openVendorContactsDialog
}: GetColumnsProps): ColumnDef<VendorWithCbeFields>[] {
// ----------------------------------------------------------------
// 1) Select 컬럼 (체크박스)
@@ -104,6 +105,30 @@ export function getColumns({
// 1) 필드값 가져오기
const val = getValue()
+ if (cfg.id === "vendorName") {
+ const vendor = row.original;
+ const vendorId = vendor.vendorId;
+
+ // 협력업체 이름을 클릭할 수 있는 버튼으로 렌더링
+ const handleVendorNameClick = () => {
+ if (vendorId) {
+ openVendorContactsDialog(vendorId, vendor); // 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 === "vendorStatus") {
const statusVal = row.original.vendorStatus
if (!statusVal) return null
@@ -116,8 +141,8 @@ export function getColumns({
}
- if (cfg.id === "rfqVendorStatus") {
- const statusVal = row.original.rfqVendorStatus
+ if (cfg.id === "responseStatus") {
+ const statusVal = row.original.responseStatus
if (!statusVal) return null
// const Icon = getStatusIcon(statusVal)
const variant = statusVal ==="INVITED"?"default" :statusVal ==="DECLINED"?"destructive":statusVal ==="ACCEPTED"?"secondary":"outline"
@@ -128,8 +153,8 @@ export function getColumns({
)
}
- // 예) TBE Updated (날짜)
- if (cfg.id === "cbeUpdated") {
+ // 예) CBE Updated (날짜)
+ if (cfg.id === "respondedAt" ) {
const dateVal = val as Date | undefined
if (!dateVal) return null
return formatDate(dateVal)
@@ -172,39 +197,32 @@ const commentsColumn: ColumnDef<VendorWithCbeFields> = {
function handleClick() {
// rowAction + openCommentSheet
setRowAction({ row, type: "comments" })
- openCommentSheet(vendor.cbeId ?? 0)
+ openCommentSheet(vendor.responseId ?? 0)
}
return (
- <div className="flex items-center justify-center">
- <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">
- {commCount > 0 ? (
- <>
- <MessageSquare className="h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" />
- <Badge
- variant="secondary"
- className="absolute -top-2 -right-2 h-4 min-w-4 text-xs px-1 flex items-center justify-center"
- >
- {commCount}
- </Badge>
- </>
- ) : (
- <MessageSquare className="h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" />
- )}
- </div>
- <span className="sr-only">{commCount > 0 ? `${commCount} Comments` : "Add Comment"}</span>
- </Button>
- {/* <span className="ml-2 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer" onClick={handleClick}>
- {commCount > 0 ? `${commCount} Comments` : "Add Comment"}
- </span> */}
- </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,