summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/common/selectors/currency/currency-selector.tsx4
-rw-r--r--lib/rfq-last/vendor/batch-update-conditions-dialog.tsx96
2 files changed, 42 insertions, 58 deletions
diff --git a/components/common/selectors/currency/currency-selector.tsx b/components/common/selectors/currency/currency-selector.tsx
index 1e56c972..94223d61 100644
--- a/components/common/selectors/currency/currency-selector.tsx
+++ b/components/common/selectors/currency/currency-selector.tsx
@@ -192,9 +192,9 @@ export function CurrencySelector({
<DialogContent className="max-w-4xl max-h-[80vh]">
<DialogHeader>
<DialogTitle>통화 선택</DialogTitle>
- <div className="text-sm text-muted-foreground">
+ {/* <div className="text-sm text-muted-foreground">
통화 코드(CD_CLF=SPB032) 조회
- </div>
+ </div> */}
</DialogHeader>
<div className="space-y-4">
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