From 535de26b9cf3242c04543d6891d78352b9593a60 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 11 Nov 2025 09:22:58 +0000
Subject: (최겸) 구매 수정사항 개발
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/rfq-last/quotation-compare-view.tsx | 46 +++++++--------------------------
 1 file changed, 10 insertions(+), 36 deletions(-)

(limited to 'lib/rfq-last/quotation-compare-view.tsx')

diff --git a/lib/rfq-last/quotation-compare-view.tsx b/lib/rfq-last/quotation-compare-view.tsx
index 3bb27b55..7a4fd751 100644
--- a/lib/rfq-last/quotation-compare-view.tsx
+++ b/lib/rfq-last/quotation-compare-view.tsx
@@ -70,7 +70,6 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
   const [selectedResponse, setSelectedResponse] = React.useState<VendorResponseVersion | null>(null);
   const [selectedVendorName, setSelectedVendorName] = React.useState<string>("");
   const [selectedContractType, setSelectedContractType] = React.useState<"PO" | "CONTRACT" | "BIDDING" | "">("");
-  const [selectionReason, setSelectionReason] = React.useState("");
   const [cancelReason, setCancelReason] = React.useState("");
   const [isSubmitting, setIsSubmitting] = React.useState(false);
   const router = useRouter()
@@ -323,11 +322,6 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
       return;
     }
 
-    if (!selectionReason.trim()) {
-      toast.error("선정 사유를 입력해주세요.");
-      return;
-    }
-
     setIsSubmitting(true);
     try {
       const vendor = data.vendors.find(v => v.vendorId === parseInt(selectedVendorId));
@@ -348,8 +342,8 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
         vendorCode: vendor.vendorCode,
         totalAmount: latestResponse.totalAmount,
         currency: latestResponse.currency,
-        selectionReason: selectionReason,
-        priceRank: latestResponse.rank || 0,
+        selectionReason: "",
+        priceRank: 0,
         hasConditionDifferences: latestResponse.conditionDifferences.hasDifferences,
         criticalDifferences: latestResponse.conditionDifferences.criticalDifferences,
       });
@@ -357,7 +351,6 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
       if (result.success) {
         toast.success("업체가 성공적으로 선정되었습니다.");
         setShowSelectionDialog(false);
-        setSelectionReason("");
         router.refresh()
       } else {
         throw new Error(result.error || "업체 선정 중 오류가 발생했습니다.");
@@ -410,24 +403,25 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
                 <Button
                   variant="destructive"
                   onClick={() => setShowCancelDialog(true)}
+                  disabled={selectedContractType !== ""}
                   className="gap-2"
                 >
                   <X className="h-4 w-4" />
                   선정 취소
                 </Button>
               )}
-              <Button
+              {/* <Button
                 variant="outline"
                 onClick={() => {
                   setSelectedVendorId("");
                   setShowSelectionDialog(true);
                 }}
-                disabled={isSelectionApproved}
+                disabled={isSelectionApproved || selectedContractType !== ""}
                 className="gap-2"
               >
                 <RefreshCw className="h-4 w-4" />
                 재선정
-              </Button>
+              </Button> */}
             </>
           ) : (
             <Button
@@ -479,7 +473,6 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
                   <p className="font-semibold">선정 업체: {selectedVendor.vendorName} ({selectedVendor.vendorCode})</p>
                   <p>선정 금액: {formatAmount(selectedVendor.totalAmount, selectedVendor.currency)}</p>
                   <p>선정일: {selectedVendor.selectionDate ? format(new Date(selectedVendor.selectionDate), "yyyy년 MM월 dd일", { locale: ko }) : "-"}</p>
-                  <p>선정 사유: {selectedVendor.selectionReason || "-"}</p>
                   {selectedVendor.contractNo && (
                     <>
                       <div className="border-t pt-1 mt-2">
@@ -508,6 +501,7 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
                     setSelectedContractType("PO");
                     setShowContractDialog(true);
                   }}
+                  disabled={data.rfqInfo.rfqCode?.startsWith("I")}
                   className="gap-1 bg-green-600 hover:bg-green-700 text-xs"
                 >
                   <FileText className="h-3 w-3" />
@@ -929,7 +923,7 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
 
                   {/* 납기일 */}
                   <tr>
-                    <td className="p-3 font-medium">납기일</td>
+                    <td className="p-3 font-medium">PR납기 요청일</td>
                     {data.vendors.map((vendor) => {
                       const latestResponse = vendor.responses[0];
                       return (
@@ -1245,36 +1239,17 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
                           )}
                         </span>
                       </div>
-                      <div className="flex justify-between">
-                        <span className="text-sm font-medium">가격 순위</span>
-                        <span className="text-sm">
-                          #{latestResponse?.rank || 0}
-                        </span>
-                      </div>
                       {latestResponse?.conditionDifferences.hasDifferences && (
                         <Alert className="mt-2">
                           <AlertCircle className="h-4 w-4" />
                           <AlertDescription>
-                            제시 조건과 차이가 있습니다. 선정 사유를 명확히 기재해주세요.
+                            제시 조건과 차이가 있습니다.
                           </AlertDescription>
                         </Alert>
                       )}
                     </div>
                   </div>
 
-                  <div className="space-y-2">
-                    <label htmlFor="selection-reason" className="text-sm font-medium">
-                      선정 사유 *
-                    </label>
-                    <textarea
-                      id="selection-reason"
-                      className="w-full min-h-[100px] p-3 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
-                      placeholder="업체 선정 사유를 입력해주세요..."
-                      value={selectionReason}
-                      onChange={(e) => setSelectionReason(e.target.value)}
-                      required
-                    />
-                  </div>
                 </div>
               );
             })()}
@@ -1284,7 +1259,6 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
                 variant="outline"
                 onClick={() => {
                   setShowSelectionDialog(false);
-                  setSelectionReason("");
                 }}
                 disabled={isSubmitting}
               >
@@ -1292,7 +1266,7 @@ export function QuotationCompareView({ data }: QuotationCompareViewProps) {
               </Button>
               <Button
                 onClick={handleVendorSelection}
-                disabled={!selectionReason || isSubmitting}
+                disabled={isSubmitting}
               >
                 {isSubmitting ? "처리 중..." : hasSelection ? "재선정 확정" : "선정 확정"}
               </Button>
-- 
cgit v1.2.3

