summaryrefslogtreecommitdiff
path: root/lib/rfq-last/vendor/rfq-vendor-table.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rfq-last/vendor/rfq-vendor-table.tsx')
-rw-r--r--lib/rfq-last/vendor/rfq-vendor-table.tsx56
1 files changed, 40 insertions, 16 deletions
diff --git a/lib/rfq-last/vendor/rfq-vendor-table.tsx b/lib/rfq-last/vendor/rfq-vendor-table.tsx
index 20dc5409..efc17171 100644
--- a/lib/rfq-last/vendor/rfq-vendor-table.tsx
+++ b/lib/rfq-last/vendor/rfq-vendor-table.tsx
@@ -333,23 +333,44 @@ export function RfqVendorTable({
console.log(mergedData, "mergedData")
console.log(rfqId, "rfqId")
- // Short List 확정 핸들러
+ // TBE 요청 핸들러
const handleShortListConfirm = React.useCallback(async () => {
try {
setIsUpdatingShortList(true);
- // response가 있는 벤더들만 필터링
- const vendorsWithResponse = selectedRows.filter(vendor =>
- vendor.response && vendor.response.vendor&& vendor.response.isDocumentConfirmed
- );
+ // response가 있는 벤더들 필터링
+ const vendorsWithResponse = selectedRows.filter(vendor =>
+ vendor.response && vendor.response.vendor
+ );
- if (vendorsWithResponse.length === 0) {
- toast.warning("응답이 있는 벤더를 선택해주세요.");
- return;
- }
+ if (vendorsWithResponse.length === 0) {
+ toast.warning("응답이 있는 벤더를 선택해주세요.");
+ return;
+ }
+
+ // 문서확정된 벤더들 필터링
+ const vendorsWithConfirmedDocs = vendorsWithResponse.filter(vendor =>
+ vendor.response.isDocumentConfirmed
+ );
+
+ // 문서확정되지 않은 벤더가 있는 경우 경고 메시지 표시
+ const vendorsWithoutConfirmedDocs = vendorsWithResponse.filter(vendor =>
+ !vendor.response.isDocumentConfirmed
+ );
+
+ if (vendorsWithoutConfirmedDocs.length > 0) {
+ toast.warning("벤더회신문서를 확인하시고 설계전송 문서 확정해주세요");
+ return;
+ }
+
+ // 문서확정된 벤더만 TBE 요청 처리
+ if (vendorsWithConfirmedDocs.length === 0) {
+ toast.warning("문서가 확정된 벤더가 없습니다.");
+ return;
+ }
- const vendorIds = vendorsWithResponse
+ const vendorIds = vendorsWithConfirmedDocs
.map(vendor => vendor.vendorId)
.filter(id => id != null);
@@ -361,8 +382,8 @@ export function RfqVendorTable({
router.refresh();
}
} catch (error) {
- console.error("Short List 확정 실패:", error);
- toast.error("Short List 확정에 실패했습니다.");
+ console.error("TBE 요청 실패:", error);
+ toast.error("TBE 요청에 실패했습니다.");
} finally {
setIsUpdatingShortList(false);
}
@@ -1478,7 +1499,7 @@ export function RfqVendorTable({
},
{
id: "responseDetail",
- header: "회신상세",
+ header: "제출여부",
cell: ({ row }) => {
const hasResponse = !!row.original.response?.submission?.submittedAt;
@@ -1820,7 +1841,10 @@ export function RfqVendorTable({
// 참여 의사가 있는 선택된 벤더 수 계산
const participatingCount = selectedRows.length;
const shortListCount = selectedRows.filter(v => v.shortList).length;
- const vendorsWithResponseCount = selectedRows.filter(v => v.response && v.response.vendor && v.response.isDocumentConfirmed).length;
+ // TBE 요청 버튼용: 응답이 있는 벤더 수 (문서확정 여부와 무관)
+ const vendorsWithResponseCount = selectedRows.filter(v => v.response && v.response.vendor).length;
+ // 문서확정된 벤더 수
+ const vendorsWithConfirmedDocsCount = selectedRows.filter(v => v.response && v.response.vendor && v.response.isDocumentConfirmed).length;
// 견적서가 있는 선택된 벤더 수 계산 (취소되지 않은 벤더만)
const quotationCount = nonCancelledRows.filter(row =>
@@ -1897,7 +1921,7 @@ export function RfqVendorTable({
</Button>
)}
- {/* Short List 확정 버튼 */}
+ {/* TBE 요청 버튼 */}
{!rfqCode?.startsWith("F") &&
<Button
variant="outline"
@@ -1914,7 +1938,7 @@ export function RfqVendorTable({
) : (
<>
<CheckSquare className="h-4 w-4 mr-2" />
- Short List 확정
+ TBE 요청
{vendorsWithResponseCount > 0 && ` (${vendorsWithResponseCount})`}
</>
)}