diff options
Diffstat (limited to 'lib/rfq-last')
| -rw-r--r-- | lib/rfq-last/vendor-response/editor/commercial-terms-form.tsx | 53 | ||||
| -rw-r--r-- | lib/rfq-last/vendor/batch-update-conditions-dialog.tsx | 59 |
2 files changed, 103 insertions, 9 deletions
diff --git a/lib/rfq-last/vendor-response/editor/commercial-terms-form.tsx b/lib/rfq-last/vendor-response/editor/commercial-terms-form.tsx index 143d08f3..f0c69d8b 100644 --- a/lib/rfq-last/vendor-response/editor/commercial-terms-form.tsx +++ b/lib/rfq-last/vendor-response/editor/commercial-terms-form.tsx @@ -31,6 +31,7 @@ import { getPlaceOfShippingForSelection, getPlaceOfDestinationForSelection } from "@/lib/procurement-select/service" +import { TAX_CONDITIONS } from "@/lib/tax-conditions/types" import { toast } from "sonner" interface CommercialTermsFormProps { @@ -427,11 +428,53 @@ export default function CommercialTermsForm({ rfqDetail, rfq }: CommercialTermsF <div className="grid grid-cols-2 gap-4"> <div className="space-y-2"> <Label htmlFor="vendorTaxCode">세금 코드</Label> - <Input - id="vendorTaxCode" - {...register("vendorTaxCode")} - placeholder="세금 코드 입력" - /> + <Popover> + <PopoverTrigger asChild> + <Button + variant="outline" + role="combobox" + className="w-full justify-between" + > + {watch("vendorTaxCode") ? ( + <span className="truncate"> + {TAX_CONDITIONS.find(t => t.code === watch("vendorTaxCode"))?.name || watch("vendorTaxCode")} + </span> + ) : ( + <span className="text-muted-foreground">세금 코드 선택</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> + <CommandEmpty>검색 결과가 없습니다.</CommandEmpty> + <CommandGroup> + {TAX_CONDITIONS.map((condition) => ( + <CommandItem + key={condition.code} + value={`${condition.code} ${condition.name}`} + onSelect={() => setValue("vendorTaxCode", condition.code)} + > + <div className="flex items-center gap-2 w-full"> + <span className="font-medium">{condition.code}</span> + <span className="text-muted-foreground">-</span> + <span className="truncate">{condition.name}</span> + <Check + className={cn( + "ml-auto h-4 w-4", + condition.code === watch("vendorTaxCode") ? "opacity-100" : "opacity-0" + )} + /> + </div> + </CommandItem> + ))} + </CommandGroup> + </CommandList> + </Command> + </PopoverContent> + </Popover> </div> <div className="space-y-2"> <Label htmlFor="vendorPlaceOfShipping">선적지</Label> diff --git a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx index 7de8cfa4..af38ff45 100644 --- a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx +++ b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx @@ -46,6 +46,7 @@ import { cn } from "@/lib/utils"; import { toast } from "sonner"; import { updateVendorConditionsBatch } 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 { ScrollArea } from "@/components/ui/scroll-area"; import { Alert, AlertDescription } from "@/components/ui/alert"; @@ -770,10 +771,60 @@ export function BatchUpdateConditionsDialog({ </FormLabel> <div className="col-span-2"> <FormControl> - <Input - {...field} - disabled={!fieldsToUpdate.taxCode} - /> + <Popover> + <PopoverTrigger asChild> + <Button + variant="outline" + role="combobox" + className="w-full justify-between" + disabled={!fieldsToUpdate.taxCode} + > + {field.value ? ( + <span className="truncate"> + {TAX_CONDITIONS.find(t => t.code === field.value)?.name || field.value} + </span> + ) : ( + <span className="text-muted-foreground">세금 코드 선택</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> + {TAX_CONDITIONS.map((condition) => ( + <CommandItem + key={condition.code} + value={`${condition.code} ${condition.name}`} + onSelect={() => field.onChange(condition.code)} + > + <div className="flex items-center gap-2 w-full"> + <span className="font-medium">{condition.code}</span> + <span className="text-muted-foreground">-</span> + <span className="truncate">{condition.name}</span> + <Check + className={cn( + "ml-auto h-4 w-4", + condition.code === field.value ? "opacity-100" : "opacity-0" + )} + /> + </div> + </CommandItem> + ))} + </CommandGroup> + </CommandList> + </Command> + </PopoverContent> + </Popover> </FormControl> <FormMessage /> </div> |
