diff options
| -rw-r--r-- | app/[lng]/evcp/(evcp)/(procurement)/rfq-last/[id]/vendor/page.tsx | 22 | ||||
| -rw-r--r-- | lib/rfq-last/vendor/add-vendor-dialog.tsx | 27 | ||||
| -rw-r--r-- | lib/rfq-last/vendor/rfq-vendor-table.tsx | 3 |
3 files changed, 43 insertions, 9 deletions
diff --git a/app/[lng]/evcp/(evcp)/(procurement)/rfq-last/[id]/vendor/page.tsx b/app/[lng]/evcp/(evcp)/(procurement)/rfq-last/[id]/vendor/page.tsx index c3a786b9..00a9ef13 100644 --- a/app/[lng]/evcp/(evcp)/(procurement)/rfq-last/[id]/vendor/page.tsx +++ b/app/[lng]/evcp/(evcp)/(procurement)/rfq-last/[id]/vendor/page.tsx @@ -1,7 +1,7 @@ import { Separator } from "@/components/ui/separator"; import { getRfqWithDetails, getRfqVendorResponses } from "@/lib/rfq-last/service"; import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"; -import { AlertCircle, Users, Send, FileText, CheckCircle2, Clock, XCircle } from "lucide-react"; +import { AlertCircle, Users, Send, FileText, CheckCircle2, Clock } from "lucide-react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { RfqVendorTable } from "@/lib/rfq-last/vendor/rfq-vendor-table"; @@ -12,7 +12,15 @@ interface VendorPageProps { lng: string; id: string; }; - searchParams: Promise<Record<string, any>>; + searchParams: Promise<Record<string, string | string[]>>; +} + +// rfqCode를 기반으로 rfqCategory 결정 +function getRfqCategory(rfqCode: string): "itb" | "rfq" | "general" { + if (rfqCode.startsWith("I")) return "itb"; + if (rfqCode.startsWith("R")) return "rfq"; + if (rfqCode.startsWith("F")) return "general"; + return "general"; // 기본값 } export default async function VendorPage(props: VendorPageProps) { @@ -48,10 +56,13 @@ export default async function VendorPage(props: VendorPageProps) { ); } + // rfqCategory 결정 + const rfqCategory = getRfqCategory(rfqData.rfqCode); + // 응답 상태별 집계 const statusSummary = { total: rfqData?.details.length || 0, - invited: vendorResponses?.filter(v => v.status === "초대됨").length || 0, + invited: vendorResponses?.filter(v => v.status === "대기중").length || 0, drafting: vendorResponses?.filter(v => v.status === "작성중").length || 0, submitted: vendorResponses?.filter(v => v.status === "제출완료").length || 0, confirmed: vendorResponses?.filter(v => v.status === "최종확정").length || 0, @@ -125,8 +136,9 @@ export default async function VendorPage(props: VendorPageProps) { <RfqVendorTable rfqId={rfqId} rfqCode={rfqData.rfqCode } - rfqDetails={rfqData.details || []} - vendorResponses={vendorResponses || []} + rfqDetails={rfqData.details as any || []} + vendorResponses={vendorResponses as any || []} + rfqCategory={rfqCategory} /> </CardContent> </Card> diff --git a/lib/rfq-last/vendor/add-vendor-dialog.tsx b/lib/rfq-last/vendor/add-vendor-dialog.tsx index 6b4efe74..bcf882a1 100644 --- a/lib/rfq-last/vendor/add-vendor-dialog.tsx +++ b/lib/rfq-last/vendor/add-vendor-dialog.tsx @@ -51,6 +51,7 @@ interface AddVendorDialogProps { open: boolean; onOpenChange: (open: boolean) => void; rfqId: number; + rfqCategory?: "itb" | "rfq" | "general"; onSuccess: () => void; } @@ -58,6 +59,7 @@ export function AddVendorDialog({ open, onOpenChange, rfqId, + rfqCategory = "general", onSuccess, }: AddVendorDialogProps) { const [isLoading, setIsLoading] = React.useState(false); @@ -194,8 +196,17 @@ export function AddVendorDialog({ // 해당 벤더의 기본계약 설정 추가 const isInternational = isInternationalVendor(vendor); - // 외자업체이거나 MRC Type이 "P"가 아닌 경우 false로 설정 - const shouldCheckAgreement = hasMrcTypeP && !isInternational; + + let shouldCheckAgreement = false; + + // ITB인 경우: 국내기업만 체크 + if (rfqCategory === "itb") { + shouldCheckAgreement = !isInternational; + } else { + // 기존 로직: 외자업체이거나 MRC Type이 "P"가 아닌 경우 false로 설정 + shouldCheckAgreement = hasMrcTypeP && !isInternational; + } + setVendorContracts([ ...vendorContracts, { @@ -569,7 +580,11 @@ export function AddVendorDialog({ <div className="flex items-center space-x-2"> <Checkbox checked={contract?.agreementYn || false} - disabled={!hasMrcTypeP || isInternational} + disabled={ + rfqCategory === "itb" + ? true // ITB는 항상 비활성화 + : (!hasMrcTypeP || isInternational) // 기존 로직 + } onCheckedChange={(checked) => updateVendorContract(vendor.id, "agreementYn", !!checked) } @@ -579,7 +594,11 @@ export function AddVendorDialog({ <div className="flex items-center space-x-2"> <Checkbox checked={contract?.ndaYn || false} - disabled={!hasMrcTypeP || isInternational} + disabled={ + rfqCategory === "itb" + ? true // ITB는 항상 비활성화 + : (!hasMrcTypeP || isInternational) // 기존 로직 + } onCheckedChange={(checked) => updateVendorContract(vendor.id, "ndaYn", !!checked) } diff --git a/lib/rfq-last/vendor/rfq-vendor-table.tsx b/lib/rfq-last/vendor/rfq-vendor-table.tsx index e21ec242..20dc5409 100644 --- a/lib/rfq-last/vendor/rfq-vendor-table.tsx +++ b/lib/rfq-last/vendor/rfq-vendor-table.tsx @@ -176,6 +176,7 @@ interface RfqVendorTableProps { rfqCode?: string; rfqDetails: RfqDetail[]; vendorResponses: VendorResponse[]; + rfqCategory?: "itb" | "rfq" | "general"; rfqInfo?: { rfqTitle: string; rfqType: string; @@ -261,6 +262,7 @@ export function RfqVendorTable({ rfqCode, rfqDetails, vendorResponses, + rfqCategory = "general", rfqInfo, attachments, }: RfqVendorTableProps) { @@ -1972,6 +1974,7 @@ export function RfqVendorTable({ open={isAddDialogOpen} onOpenChange={setIsAddDialogOpen} rfqId={rfqId} + rfqCategory={rfqCategory} onSuccess={() => { toast.success("벤더가 추가되었습니다."); setIsAddDialogOpen(false); |
