From b54f6f03150dd78d86db62201b6386bf14b72394 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 15 Oct 2025 12:52:11 +0000
Subject: (대표님) 커버, 데이터룸, 파일매니저, 담당자할당 등
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/rfq-last/table/rfq-assign-pic-dialog.tsx | 36 +++++++++-------------------
 1 file changed, 11 insertions(+), 25 deletions(-)

(limited to 'lib/rfq-last/table/rfq-assign-pic-dialog.tsx')

diff --git a/lib/rfq-last/table/rfq-assign-pic-dialog.tsx b/lib/rfq-last/table/rfq-assign-pic-dialog.tsx
index 9ca34ccd..70d2ed7e 100644
--- a/lib/rfq-last/table/rfq-assign-pic-dialog.tsx
+++ b/lib/rfq-last/table/rfq-assign-pic-dialog.tsx
@@ -39,15 +39,6 @@ export function RfqAssignPicDialog({
   const [selectedCode, setSelectedCode] = React.useState<PurchaseGroupCodeWithUser | undefined>(undefined);
   const [selectorOpen, setSelectorOpen] = React.useState(false);
 
-  // ITB만 필터링 (rfqCode가 "I"로 시작하는 것)
-  const itbCodes = React.useMemo(() => {
-    return selectedRfqCodes.filter(code => code.startsWith("I"));
-  }, [selectedRfqCodes]);
-
-  const itbIds = React.useMemo(() => {
-    return selectedRfqIds.filter((id, index) => selectedRfqCodes[index]?.startsWith("I"));
-  }, [selectedRfqIds, selectedRfqCodes]);
-
   // 다이얼로그 열릴 때 초기화
   React.useEffect(() => {
     if (open) {
@@ -81,15 +72,15 @@ export function RfqAssignPicDialog({
       return;
     }
 
-    if (itbIds.length === 0) {
-      toast.error("선택한 항목 중 ITB가 없습니다");
+    if (selectedRfqIds.length === 0) {
+      toast.error("담당자 지정이 가능한 ITB가 없습니다");
       return;
     }
 
     setIsAssigning(true);
     try {
       const result = await assignPicToRfqs({
-        rfqIds: itbIds,
+        rfqIds: selectedRfqIds,
         picUserId: selectedCode.user.id,
       });
 
@@ -127,32 +118,27 @@ export function RfqAssignPicDialog({
             <label className="text-sm font-medium">선택된 ITB</label>
             <div className="p-3 bg-muted rounded-md">
               <div className="flex items-center gap-2 mb-2">
-                <Badge variant="secondary">{itbCodes.length}건</Badge>
-                {itbCodes.length !== selectedRfqCodes.length && (
-                  <span className="text-xs text-muted-foreground">
-                    (전체 {selectedRfqCodes.length}건 중)
-                  </span>
-                )}
+                <Badge variant="secondary">{selectedRfqCodes.length}건</Badge>
               </div>
               <div className="max-h-[100px] overflow-y-auto">
                 <div className="flex flex-wrap gap-1">
-                  {itbCodes.slice(0, 10).map((code, index) => (
+                  {selectedRfqCodes.slice(0, 10).map((code, index) => (
                     <Badge key={index} variant="outline" className="text-xs">
                       {code}
                     </Badge>
                   ))}
-                  {itbCodes.length > 10 && (
+                  {selectedRfqCodes.length > 10 && (
                     <Badge variant="outline" className="text-xs">
-                      +{itbCodes.length - 10}개
+                      +{selectedRfqCodes.length - 10}개
                     </Badge>
                   )}
                 </div>
               </div>
             </div>
-            {itbCodes.length === 0 && (
+            {selectedRfqCodes.length === 0 && (
               <Alert className="border-orange-200 bg-orange-50">
                 <AlertDescription className="text-orange-800">
-                  선택한 항목 중 ITB (I로 시작하는 코드)가 없습니다.
+                  담당자 지정이 가능한 ITB가 없습니다. (상태가 "RFQ 생성" 또는 "구매담당지정"인 ITB만 가능)
                 </AlertDescription>
               </Alert>
             )}
@@ -165,7 +151,7 @@ export function RfqAssignPicDialog({
               type="button"
               variant="outline"
               className="w-full justify-start h-auto min-h-[40px]"
-              disabled={itbCodes.length === 0}
+              disabled={selectedRfqCodes.length === 0}
               onClick={() => setSelectorOpen(true)}
             >
               {selectedCode ? (
@@ -227,7 +213,7 @@ export function RfqAssignPicDialog({
           <Button
             type="submit"
             onClick={handleAssign}
-            disabled={!selectedCode || !selectedCode.user || itbCodes.length === 0 || isAssigning}
+            disabled={!selectedCode || !selectedCode.user || selectedRfqCodes.length === 0 || isAssigning}
           >
             {isAssigning ? (
               <>
-- 
cgit v1.2.3

