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.tsx118
1 files changed, 85 insertions, 33 deletions
diff --git a/lib/rfq-last/vendor/rfq-vendor-table.tsx b/lib/rfq-last/vendor/rfq-vendor-table.tsx
index ad89d1dc..98d53f5d 100644
--- a/lib/rfq-last/vendor/rfq-vendor-table.tsx
+++ b/lib/rfq-last/vendor/rfq-vendor-table.tsx
@@ -488,6 +488,37 @@ export function RfqVendorTable({
}
}, [rfqId, rfqCode, router]);
+ // vendor status에 따른 category 분류 함수
+ const getVendorCategoryFromStatus = React.useCallback((status: string | null): string => {
+ if (!status) return "미분류";
+
+ const categoryMap: Record<string, string> = {
+ "PENDING_REVIEW": "발굴업체", // 가입 신청 중
+ "IN_REVIEW": "잠재업체", // 심사 중
+ "REJECTED": "발굴업체", // 심사 거부됨
+ "IN_PQ": "잠재업체", // PQ 진행 중
+ "PQ_SUBMITTED": "잠재업체", // PQ 제출
+ "PQ_FAILED": "잠재업체", // PQ 실패
+ "PQ_APPROVED": "잠재업체", // PQ 통과
+ "APPROVED": "잠재업체", // 승인됨
+ "READY_TO_SEND": "잠재업체", // 정규등록검토
+ "ACTIVE": "정규업체", // 활성 상태 (실제 거래 중)
+ "INACTIVE": "중지업체", // 비활성 상태
+ "BLACKLISTED": "중지업체", // 거래 금지
+ };
+
+ return categoryMap[status] || "미분류";
+ }, []);
+
+ // vendorCountry를 보기 좋은 형태로 변환
+ const formatVendorCountry = React.useCallback((country: string | null): string => {
+ if (!country) return "미지정";
+
+ // KR 또는 한국이면 내자, 그 외는 전부 외자
+ const isLocal = country === "KR" || country === "한국";
+ return isLocal ? `내자(${country})` : `외자(${country})`;
+ }, []);
+
// 액션 처리
const handleAction = React.useCallback(async (action: string, vendor: any) => {
switch (action) {
@@ -636,7 +667,15 @@ export function RfqVendorTable({
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="업체분류" />,
filterFn: createFilterFn("text"),
- cell: ({ row }) => row.original.vendorCategory || "-",
+ cell: ({ row }) => {
+ const status = row.original.status;
+ const category = getVendorCategoryFromStatus(status);
+ return (
+ <Badge variant="outline" className="text-xs">
+ {category}
+ </Badge>
+ );
+ },
size: 100,
},
{
@@ -646,10 +685,11 @@ export function RfqVendorTable({
cell: ({ row }) => {
const country = row.original.vendorCountry;
+ const formattedCountry = formatVendorCountry(country);
const isLocal = country === "KR" || country === "한국";
return (
<Badge variant={isLocal ? "default" : "secondary"}>
- {country || "-"}
+ {formattedCountry}
</Badge>
);
},
@@ -1503,6 +1543,37 @@ export function RfqVendorTable({
{selectedRows.length > 0 && (
<>
+ {/* 정보 일괄 입력 버튼 */}
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setIsBatchUpdateOpen(true)}
+ disabled={isLoadingSendData}
+ >
+ <Settings2 className="h-4 w-4 mr-2" />
+ 정보 일괄 입력 ({selectedRows.length})
+ </Button>
+
+ {/* RFQ 발송 버튼 */}
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={handleBulkSend}
+ disabled={isLoadingSendData || selectedRows.length === 0}
+ >
+ {isLoadingSendData ? (
+ <>
+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />
+ 데이터 준비중...
+ </>
+ ) : (
+ <>
+ <Send className="h-4 w-4 mr-2" />
+ RFQ 발송 ({shortListCount})
+ </>
+ )}
+ </Button>
+
{/* Short List 확정 버튼 */}
{rfqCode?.startsWith("I") &&
<Button
@@ -1539,37 +1610,6 @@ export function RfqVendorTable({
견적 비교
{quotationCount > 0 && ` (${quotationCount})`}
</Button>
-
- {/* 정보 일괄 입력 버튼 */}
- <Button
- variant="outline"
- size="sm"
- onClick={() => setIsBatchUpdateOpen(true)}
- disabled={isLoadingSendData}
- >
- <Settings2 className="h-4 w-4 mr-2" />
- 정보 일괄 입력 ({selectedRows.length})
- </Button>
-
- {/* RFQ 발송 버튼 */}
- <Button
- variant="outline"
- size="sm"
- onClick={handleBulkSend}
- disabled={isLoadingSendData || selectedRows.length === 0}
- >
- {isLoadingSendData ? (
- <>
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
- 데이터 준비중...
- </>
- ) : (
- <>
- <Send className="h-4 w-4 mr-2" />
- RFQ 발송 ({shortListCount})
- </>
- )}
- </Button>
</>
)}
@@ -1679,6 +1719,18 @@ export function RfqVendorTable({
}}
/>
)}
+
+ {/* AVL 벤더 연동 다이얼로그 */}
+ <AvlVendorDialog
+ open={isAvlDialogOpen}
+ onOpenChange={setIsAvlDialogOpen}
+ rfqId={rfqId}
+ rfqCode={rfqCode}
+ onSuccess={() => {
+ setIsAvlDialogOpen(false);
+ router.refresh();
+ }}
+ />
</>
);
} \ No newline at end of file