save and claim button added

This commit is contained in:
2025-08-29 14:44:31 +05:30
parent d76db44b8a
commit c9ad84c3a8
3 changed files with 48 additions and 5 deletions

View File

@@ -22,7 +22,9 @@ import { InsertPatient, Patient } from "@repo/db/types";
// Type for the ref to access modal methods
type AddPatientModalRef = {
shouldSchedule: boolean;
shouldClaim: boolean;
navigateToSchedule: (patientId: number) => void;
navigateToClaim: (patientId: number) => void;
};
export default function PatientsPage() {
@@ -57,9 +59,14 @@ export default function PatientsPage() {
variant: "default",
});
// If the add patient modal wants to proceed to scheduling, redirect to appointments page
// ✅ Check claim first, then schedule
if (addPatientModalRef.current?.shouldClaim) {
addPatientModalRef.current.navigateToClaim(newPatient.id);
return;
}
if (addPatientModalRef.current?.shouldSchedule) {
addPatientModalRef.current.navigateToSchedule(newPatient.id);
return;
}
},
onError: (error) => {