feat: open select procedures inline on appointments page instead of navigating to claims
This commit is contained in:
@@ -40,7 +40,9 @@ import {
|
|||||||
Patient,
|
Patient,
|
||||||
PatientStatus,
|
PatientStatus,
|
||||||
UpdateAppointment,
|
UpdateAppointment,
|
||||||
|
UpdatePatient,
|
||||||
} from "@repo/db/types";
|
} from "@repo/db/types";
|
||||||
|
import { ClaimForm } from "@/components/claims/claim-form";
|
||||||
import {
|
import {
|
||||||
Popover,
|
Popover,
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
@@ -150,6 +152,11 @@ export default function AppointmentsPage() {
|
|||||||
|
|
||||||
const [, setLocation] = useLocation();
|
const [, setLocation] = useLocation();
|
||||||
|
|
||||||
|
// Select Procedures modal state (opened inline, no navigation)
|
||||||
|
const [isSelectProceduresOpen, setIsSelectProceduresOpen] = useState(false);
|
||||||
|
const [selectProceduresPatientId, setSelectProceduresPatientId] = useState<number | null>(null);
|
||||||
|
const [selectProceduresAppointmentId, setSelectProceduresAppointmentId] = useState<number | null>(null);
|
||||||
|
|
||||||
// Create context menu hook
|
// Create context menu hook
|
||||||
const { show } = useContextMenu({
|
const { show } = useContextMenu({
|
||||||
id: APPOINTMENT_CONTEXT_MENU_ID,
|
id: APPOINTMENT_CONTEXT_MENU_ID,
|
||||||
@@ -741,7 +748,11 @@ export default function AppointmentsPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSelectProcedures = (appointmentId: number) => {
|
const handleSelectProcedures = (appointmentId: number) => {
|
||||||
setLocation(`/claims?appointmentId=${appointmentId}&mode=procedures`);
|
const appt = appointments.find((a) => a.id === appointmentId);
|
||||||
|
if (!appt) return;
|
||||||
|
setSelectProceduresAppointmentId(appointmentId);
|
||||||
|
setSelectProceduresPatientId(appt.patientId);
|
||||||
|
setIsSelectProceduresOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePayments = (appointmentId: number) => {
|
const handlePayments = (appointmentId: number) => {
|
||||||
@@ -1354,6 +1365,25 @@ export default function AppointmentsPage() {
|
|||||||
onCancel={() => setConfirmDeleteState({ open: false })}
|
onCancel={() => setConfirmDeleteState({ open: false })}
|
||||||
entityName={String(confirmDeleteState.appointmentId)}
|
entityName={String(confirmDeleteState.appointmentId)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* Select Procedures modal — stays on appointments page */}
|
||||||
|
{isSelectProceduresOpen && selectProceduresPatientId !== null && (
|
||||||
|
<ClaimForm
|
||||||
|
patientId={selectProceduresPatientId}
|
||||||
|
appointmentId={selectProceduresAppointmentId ?? undefined}
|
||||||
|
proceduresOnly={true}
|
||||||
|
onClose={() => {
|
||||||
|
setIsSelectProceduresOpen(false);
|
||||||
|
setSelectProceduresPatientId(null);
|
||||||
|
setSelectProceduresAppointmentId(null);
|
||||||
|
}}
|
||||||
|
onSubmit={async () => { throw new Error("not used in proceduresOnly mode"); }}
|
||||||
|
onHandleAppointmentSubmit={async () => 0}
|
||||||
|
onHandleUpdatePatient={(_patient: UpdatePatient & { id: number }) => {}}
|
||||||
|
onHandleForMHSeleniumClaim={() => {}}
|
||||||
|
onHandleForMHSeleniumClaimPreAuth={() => {}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user