fix:clear cancellation reason on other select (#18982)

This commit is contained in:
sean-brydon
2025-01-29 14:12:19 +00:00
committed by GitHub
parent 92678dc042
commit 33903f1a03
@@ -15,11 +15,13 @@ interface InternalNotePresetsSelectProps {
label: string;
} | null
) => void;
setCancellationReason: (reason: string) => void;
}
const InternalNotePresetsSelect = ({
internalNotePresets,
onPresetSelect,
setCancellationReason,
}: InternalNotePresetsSelectProps) => {
const { t } = useLocale();
const [showOtherInput, setShowOtherInput] = useState(false);
@@ -31,6 +33,7 @@ const InternalNotePresetsSelect = ({
const handleSelectChange = (option: { value: number | string; label: string } | null) => {
if (option?.value === "other") {
setShowOtherInput(true);
setCancellationReason("");
} else {
setShowOtherInput(false);
onPresetSelect && onPresetSelect(option);
@@ -140,6 +143,7 @@ export default function CancelBooking(props: Props) {
<>
<InternalNotePresetsSelect
internalNotePresets={props.internalNotePresets}
setCancellationReason={setCancellationReason}
onPresetSelect={(option) => {
if (!option) return;