"use client"; import React from "react"; import { Check, ChevronsUpDown } from "lucide-react"; import { isValidBranchParam } from "@/lib/frontend/params"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Skeleton } from "@/components/ui/skeleton"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command"; function normalizeTypedBranch(value) { if (typeof value !== "string") return null; const s = value.trim().toUpperCase(); return s ? s : null; } export default function SearchSingleBranchCombobox({ branch, branchesStatus, availableBranches, onSingleBranchChange, isSubmitting, }) { const [open, setOpen] = React.useState(false); const [manual, setManual] = React.useState(""); const listReady = branchesStatus === "ready"; const listLoading = branchesStatus === "loading"; const listError = branchesStatus === "error"; const branchOptions = Array.isArray(availableBranches) ? availableBranches : []; const typed = normalizeTypedBranch(manual); const canApply = Boolean(typed && isValidBranchParam(typed)); return (
Niederlassungen konnten nicht geladen werden. Sie können NLxx manuell eingeben.