From cd0ce0cbe8af8719a6f542098ec78f2a5c1222ce Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 1 Dec 2025 10:28:05 +0000 Subject: (최겸) 구매 입찰 사전견적 개발(rfq-last) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rfq-last/table/rfq-table-columns.tsx | 338 ++++++++++++++++++++++++++++++- 1 file changed, 337 insertions(+), 1 deletion(-) (limited to 'lib/rfq-last/table/rfq-table-columns.tsx') diff --git a/lib/rfq-last/table/rfq-table-columns.tsx b/lib/rfq-last/table/rfq-table-columns.tsx index 62f14579..58c45aa0 100644 --- a/lib/rfq-last/table/rfq-table-columns.tsx +++ b/lib/rfq-last/table/rfq-table-columns.tsx @@ -24,7 +24,7 @@ type NextRouter = ReturnType; interface GetColumnsProps { setRowAction: React.Dispatch | null>>; - rfqCategory?: "general" | "itb" | "rfq"; + rfqCategory?: "general" | "itb" | "rfq" | "pre_bidding"; router: NextRouter; } @@ -755,6 +755,342 @@ export function getRfqColumns({ ]; } + // ═══════════════════════════════════════════════════════════════ + // 사전견적(입찰) 컬럼 정의 + // ═══════════════════════════════════════════════════════════════ + if (rfqCategory === "pre_bidding") { + return [ + // Checkbox + { + id: "select", + header: ({ table }) => ( + table.toggleAllPageRowsSelected(!!v)} + aria-label="select all" + className="translate-y-0.5" + /> + ), + cell: ({ row }) => ( + row.toggleSelected(!!v)} + aria-label="select row" + className="translate-y-0.5" + /> + ), + size: 40, + enableSorting: false, + enableHiding: false, + }, + + // 견적 No. + { + accessorKey: "rfqCode", + header: ({ column }) => , + cell: ({ row }) => ( + {row.original.rfqCode} + ), + size: 120, + }, + + // 입찰 No. (추가) + { + accessorKey: "biddingNumber", + header: ({ column }) => , + cell: ({ row }) => ( + {row.original.biddingNumber || "-"} + ), + size: 120, + }, + + // 상세 - 수정됨 + { + id: "detail", + header: "상세", + cell: ({ row }) => ( + + ), + size: 60, + }, + + // 견적상태 + { + accessorKey: "status", + header: ({ column }) => , + cell: ({ row }) => ( + + {row.original.status} + + ), + size: 120, + }, + + // 프로젝트 (프로젝트명) + { + accessorKey: "projectName", + header: ({ column }) => , + cell: ({ row }) => ( +
+ + {row.original.projectCode} + + + {row.original.projectName || "-"} + +
+ ), + size: 220, + }, + + // // 시리즈 + // { + // accessorKey: "series", + // header: ({ column }) => , + // cell: ({ row }) => { + // const series = row.original.series; + // if (!series) return "-"; + // const label = series === "SS" ? "시리즈 통합" : series === "II" ? "품목 통합" : series; + // return {label}; + // }, + // size: 100, + // }, + + // // 선급 + // { + // accessorKey: "classNo", + // header: ({ column }) => , + // cell: ({ row }) => row.original.classNo || "-", + // size: 80, + // }, + + // 견적명 + { + accessorKey: "rfqTitle", + header: ({ column }) => , + cell: ({ row }) => ( +
+ {row.original.rfqTitle || "-"} +
+ ), + size: 200, + }, + + // 자재그룹 (자재그룹명) + { + accessorKey: "majorItemMaterialDescription", + header: ({ column }) => , + cell: ({ row }) => ( +
+ + {row.original.majorItemMaterialCategory} + + + {row.original.majorItemMaterialDescription || "-"} + +
+ ), + size: 180, + }, + + // 자재코드 + { + accessorKey: "itemCode", + header: ({ column }) => , + cell: ({ row }) => ( + {row.original.itemCode || "-"} + ), + size: 100, + }, + // 자재명 + { + accessorKey: "itemName", + header: ({ column }) => , + cell: ({ row }) => ( + {row.original.itemName || "-"} + ), + size: 100, + }, + + // 견적 자료 + { + id: "rfqDocument", + header: ({ column }) => , + cell: ({ row }) => ( + + ), + size: 80, + }, + + // 견적품목수 + { + accessorKey: "prItemsCount", + header: ({ column }) => , + cell: ({ row }) => ( + + ), + size: 90, + }, + + // 견적생성일 + { + accessorKey: "createdAt", + header: ({ column }) => , + cell: ({ row }) => { + const date = row.original.createdAt; + return date ? format(new Date(date), "yyyy-MM-dd") : "-"; + }, + size: 100, + }, + + // 견적발송일 + { + accessorKey: "rfqSendDate", + header: ({ column }) => , + cell: ({ row }) => { + const date = row.original.rfqSendDate; + return date ? format(new Date(date), "yyyy-MM-dd") : "-"; + }, + size: 100, + }, + + // 견적마감일 + { + accessorKey: "dueDate", + header: ({ column }) => , + cell: ({ row }) => { + const date = row.original.dueDate; + if (!date) return "-"; + + const now = new Date(); + const dueDate = new Date(date); + const daysLeft = differenceInDays(dueDate, now); + + // 상태별 스타일과 아이콘 설정 + let statusIcon; + let statusText; + let statusClass; + + if (daysLeft < 0) { + const daysOverdue = Math.abs(daysLeft); + statusIcon = ; + statusText = `${daysOverdue}일 지남`; + statusClass = "text-red-600"; + } else if (daysLeft === 0) { + statusIcon = ; + statusText = "오늘 마감"; + statusClass = "text-orange-600"; + } else if (daysLeft <= 3) { + statusIcon = ; + statusText = `${daysLeft}일 남음`; + statusClass = "text-amber-600"; + } else if (daysLeft <= 7) { + statusIcon = ; + statusText = `${daysLeft}일 남음`; + statusClass = "text-blue-600"; + } else { + statusIcon = ; + statusText = `${daysLeft}일 남음`; + statusClass = "text-green-600"; + } + + return ( +
+ + {format(dueDate, "yyyy-MM-dd")} + +
+ {statusIcon} + {statusText} +
+
+ ); + }, + size: 120, + }, + + // 계약기간 (추가) + { + id: "contractPeriod", + header: ({ column }) => , + cell: ({ row }) => { + const start = row.original.contractStartDate; + const end = row.original.contractEndDate; + + if (!start && !end) return "-"; + + return ( +
+ {start ? format(new Date(start), "yyyy-MM-dd") : "미정"} + ~ + {end ? format(new Date(end), "yyyy-MM-dd") : "미정"} +
+ ); + }, + size: 120, + }, + + // 구매담당자 + { + accessorKey: "picUserName", + header: ({ column }) => , + cell: ({ row }) => { + const name = row.original.picUserName || row.original.picName || "-"; + const picCode = row.original.picCode || ""; + return name === "-" ? "-" : `${name}(${picCode})`; + }, + size: 100, + }, + + // 최종수정일 + { + accessorKey: "updatedAt", + header: ({ column }) => , + cell: ({ row }) => { + const date = row.original.updatedAt; + return date ? format(new Date(date), "yyyy-MM-dd HH:mm") : "-"; + }, + size: 120, + }, + + // 최종수정자 + { + accessorKey: "updatedByUserName", + header: ({ column }) => , + cell: ({ row }) => row.original.updatedByUserName || "-", + size: 100, + }, + + // 비고 + { + accessorKey: "remark", + header: ({ column }) => , + cell: ({ row }) => row.original.remark || "-", + size: 150, + }, + ]; + } + // ═══════════════════════════════════════════════════════════════ // 일반견적 컬럼 정의 // ═══════════════════════════════════════════════════════════════ -- cgit v1.2.3