|
|
@@ -19,6 +19,7 @@ interface AppointmentModalFromChatProps {
|
|
|
open: boolean;
|
|
|
onClose: () => void;
|
|
|
onSuccess?: () => void;
|
|
|
+ onChatComplete?: () => void; // Callback para finalizar el chat después de agendar
|
|
|
recordId?: string; // ID del Record (reporte médico) asociado a la cita
|
|
|
}
|
|
|
|
|
|
@@ -26,6 +27,7 @@ export const AppointmentModalFromChat = ({
|
|
|
open,
|
|
|
onClose,
|
|
|
onSuccess,
|
|
|
+ onChatComplete,
|
|
|
recordId,
|
|
|
}: AppointmentModalFromChatProps) => {
|
|
|
const [motivoConsulta, setMotivoConsulta] = useState("");
|
|
|
@@ -63,6 +65,15 @@ export const AppointmentModalFromChat = ({
|
|
|
setMotivoConsulta("");
|
|
|
onClose();
|
|
|
onSuccess?.();
|
|
|
+
|
|
|
+ // Finalizar el chat después de agendar exitosamente
|
|
|
+ if (onChatComplete) {
|
|
|
+ console.log("🎯 [AppointmentModal] Finalizando chat después de agendar cita");
|
|
|
+ // Pequeño delay para que el usuario vea la notificación de éxito
|
|
|
+ setTimeout(() => {
|
|
|
+ onChatComplete();
|
|
|
+ }, 1500);
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
const message = error instanceof Error ? error.message : undefined;
|
|
|
notifications.appointments.createError(message);
|