import React from "react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "./alert-dialog"; import { Button } from "./button"; import { Calendar as CalendarPicker } from "./calendar"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "./dialog"; import { Label } from "./label"; import { Separator } from "./separator"; import { Textarea } from "./textarea"; import { Calendar as CalendarIcon, Clock } from "lucide-react"; import { AppointmentSlotSection, type AppointmentTimeSlot, } from "./appointment-time-slot-picker"; // Re-export for consumers who import AppointmentTimeSlot from this module export type { AppointmentTimeSlot } from "./appointment-time-slot-picker"; // --------------------------------------------------------------------------- // AppointmentConfirmDialog // --------------------------------------------------------------------------- export type AppointmentConfirmAction = "accept" | "decline"; export interface AppointmentConfirmDialogProps { open: boolean; onOpenChange: (v: boolean) => void; action: AppointmentConfirmAction; clientName: string; onConfirm: (reason?: string) => void; } export function AppointmentConfirmDialog({ open, onOpenChange, action, clientName, onConfirm, }: AppointmentConfirmDialogProps) { const isDecline = action === "decline"; const [cancelReason, setCancelReason] = React.useState(""); const handleOpenChange = (next: boolean) => { if (!next) setCancelReason(""); onOpenChange(next); }; return ( {isDecline ? "Decline this appointment?" : "Accept this appointment?"} {isDecline ? ( <> This will cancel the appointment with{" "} {clientName} and notify them by email. This action cannot be undone. ) : ( <> The appointment with {clientName} will be confirmed and they will be notified by email. )} {isDecline && (