From 91ae2e8b382e6945f713c66a68c5c3483d6ec5cf Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Mon, 17 Nov 2025 10:35:43 +0900
Subject: (김준회) 견적: 협력업체 조건설정 Dialog: Currency 공통 선택기 적용,
 불필요 텍스트 제거
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../vendor/batch-update-conditions-dialog.tsx      | 96 +++++++++-------------
 1 file changed, 40 insertions(+), 56 deletions(-)

(limited to 'lib/rfq-last/vendor/batch-update-conditions-dialog.tsx')

diff --git a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx
index 6112aed4..acdf751b 100644
--- a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx
+++ b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx
@@ -37,7 +37,6 @@ import {
   PopoverTrigger
 } from "@/components/ui/popover";
 import { Textarea } from "@/components/ui/textarea";
-import { Switch } from "@/components/ui/switch";
 import { Calendar } from "@/components/ui/calendar";
 import { CalendarIcon, Loader2, Info, Package, Check, ChevronsUpDown } from "lucide-react";
 import { format } from "date-fns";
@@ -47,7 +46,7 @@ import { toast } from "sonner";
 import { updateVendorConditionsBatch, getVendorConditions } from "../service";
 import { Badge } from "@/components/ui/badge";
 import { TAX_CONDITIONS } from "@/lib/tax-conditions/types";
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
 import { ScrollArea } from "@/components/ui/scroll-area";
 import { Alert, AlertDescription } from "@/components/ui/alert";
 import { Checkbox } from "@/components/ui/checkbox";
@@ -57,6 +56,8 @@ import {
   getPlaceOfShippingForSelection,
   getPlaceOfDestinationForSelection
 } from "@/lib/procurement-select/service";
+import { CurrencySelectorSingleDialog } from "@/components/common/selectors/currency/currency-selector-single-dialog";
+import type { Currency } from "@/components/common/selectors/currency/currency-service";
 
 interface BatchUpdateConditionsDialogProps {
   open: boolean;
@@ -98,8 +99,6 @@ const formSchema = z.object({
 
 type FormValues = z.infer<typeof formSchema>;
 
-const currencies = ["USD", "EUR", "KRW", "JPY", "CNY"];
-
 export function BatchUpdateConditionsDialog({
   open,
   onOpenChange,
@@ -128,7 +127,10 @@ export function BatchUpdateConditionsDialog({
   const [shippingOpen, setShippingOpen] = React.useState(false);
   const [destinationOpen, setDestinationOpen] = React.useState(false);
   const [calendarOpen, setCalendarOpen] = React.useState(false);
-  const [currencyOpen, setCurrencyOpen] = React.useState(false);
+  const [currencyDialogOpen, setCurrencyDialogOpen] = React.useState(false);
+
+  // 선택된 통화 객체
+  const [selectedCurrencyObj, setSelectedCurrencyObj] = React.useState<Currency | undefined>();
 
   // 체크박스로 각 필드 업데이트 여부 관리
   const [fieldsToUpdate, setFieldsToUpdate] = React.useState({
@@ -280,6 +282,7 @@ export function BatchUpdateConditionsDialog({
           sparepartDescription: "",
         });
       }
+      setSelectedCurrencyObj(undefined);
       setFieldsToUpdate({
         currency: false,
         paymentTermsCode: false,
@@ -304,7 +307,7 @@ export function BatchUpdateConditionsDialog({
     }
 
     // 선택된 필드만 포함하여 conditions 객체 생성
-    const conditions: any = {};
+    const conditions: Record<string, unknown> = {};
 
     if (fieldsToUpdate.currency && data.currency) {
       conditions.currency = data.currency;
@@ -476,56 +479,24 @@ export function BatchUpdateConditionsDialog({
                             </FormLabel>
                             <div className="col-span-2">
                               <FormControl>
-                                <Popover open={currencyOpen} onOpenChange={setCurrencyOpen}>
-                                  <PopoverTrigger asChild>
-                                    <Button
-                                      variant="outline"
-                                      role="combobox"
-                                      aria-expanded={currencyOpen}
-                                      className="w-full justify-between"
-                                      disabled={!fieldsToUpdate.currency}
-                                    >
-                                      <span className="truncate">
-                                      {field.value || "통화 선택"}
-                                      </span>
-                                      <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
-                                    </Button>
-                                  </PopoverTrigger>
-                                  <PopoverContent className="w-full p-0" align="start">
-                                    <Command>
-                                      <CommandInput placeholder="통화 검색..." />
-                                      <CommandList
-                                        onWheel={(e) => {
-                                          e.stopPropagation(); // 이벤트 전파 차단
-                                          const target = e.currentTarget;
-                                          target.scrollTop += e.deltaY; // 직접 스크롤 처리
-                                        }}
-                                      >
-                                        <CommandEmpty>검색 결과가 없습니다.</CommandEmpty>
-                                        <CommandGroup>
-                                          {currencies.map((currency) => (
-                                            <CommandItem
-                                              key={currency}
-                                              value={currency}
-                                              onSelect={() => {
-                                                field.onChange(currency);
-                                                setCurrencyOpen(false);
-                                              }}
-                                            >
-                                              {currency}
-                                              <Check
-                                                className={cn(
-                                                  "ml-auto h-4 w-4",
-                                                  currency === field.value ? "opacity-100" : "opacity-0"
-                                                )}
-                                              />
-                                            </CommandItem>
-                                          ))}
-                                        </CommandGroup>
-                                      </CommandList>
-                                    </Command>
-                                  </PopoverContent>
-                                </Popover>
+                                <Button
+                                  type="button"
+                                  variant="outline"
+                                  className="w-full justify-between"
+                                  disabled={!fieldsToUpdate.currency}
+                                  onClick={() => setCurrencyDialogOpen(true)}
+                                >
+                                  <span className="truncate">
+                                    {selectedCurrencyObj ? (
+                                      <>
+                                        [{selectedCurrencyObj.CURRENCY_CODE}] {selectedCurrencyObj.CURRENCY_NAME}
+                                      </>
+                                    ) : (
+                                      field.value || "통화 선택"
+                                    )}
+                                  </span>
+                                  <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+                                </Button>
                               </FormControl>
                               <FormMessage />
                             </div>
@@ -1234,6 +1205,19 @@ export function BatchUpdateConditionsDialog({
           </form>
         </Form>
       </DialogContent>
+
+      {/* 통화 선택 다이얼로그 */}
+      <CurrencySelectorSingleDialog
+        open={currencyDialogOpen}
+        onOpenChange={setCurrencyDialogOpen}
+        selectedCurrency={selectedCurrencyObj}
+        onCurrencySelect={(currency) => {
+          setSelectedCurrencyObj(currency);
+          form.setValue("currency", currency.CURRENCY_CODE);
+        }}
+        title="통화 선택"
+        description="일괄 설정할 통화를 선택하세요"
+      />
     </Dialog>
   );
 }
\ No newline at end of file
-- 
cgit v1.2.3

