feat: MH claim 15-digit claim number check, procedure code retry, copy/paste appointment
- MassHealth claim: pick the visible typeahead option for procedure codes, verify the code stuck (retry), re-check all lines before submit - MassHealth claim: only an exact 15-digit claim number counts as submitted; otherwise fail with ERROR:CLAIM_NOT_SUBMITTED - Appointments: right-click "Copy the appointment" and "Paste the appointment" on an empty slot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,8 @@ import {
|
||||
Trash2,
|
||||
CreditCard,
|
||||
ClipboardList,
|
||||
ClipboardPaste,
|
||||
Copy,
|
||||
StickyNote,
|
||||
Shield,
|
||||
FileCheck,
|
||||
@@ -168,6 +170,7 @@ function resolveAppointmentBadgeStatus(apt: ScheduledAppointment): PatientStatus
|
||||
|
||||
// Define a unique ID for the appointment context menu
|
||||
const APPOINTMENT_CONTEXT_MENU_ID = "appointment-context-menu";
|
||||
const SLOT_CONTEXT_MENU_ID = "slot-context-menu";
|
||||
|
||||
// 🔑 exported base key
|
||||
const SCHEDULE_DATE_KEY = "schedule_selected_date";
|
||||
@@ -277,6 +280,14 @@ export default function AppointmentsPage() {
|
||||
staffId: number;
|
||||
} | null>(null);
|
||||
const [newApptPrefill, setNewApptPrefill] = useState<NewAppointmentPrefill | null>(null);
|
||||
// Appointment copied via right-click "Copy the appointment", pasted onto an empty slot
|
||||
const [copiedAppointment, setCopiedAppointment] = useState<{
|
||||
patientId: number;
|
||||
patientName: string;
|
||||
title: string;
|
||||
type: string;
|
||||
notes?: string;
|
||||
} | null>(null);
|
||||
|
||||
const toggleReminderColumn = (staffId: number) => {
|
||||
setSelectedReminderColumns((prev) => {
|
||||
@@ -329,6 +340,9 @@ export default function AppointmentsPage() {
|
||||
const { show } = useContextMenu({
|
||||
id: APPOINTMENT_CONTEXT_MENU_ID,
|
||||
});
|
||||
const { show: showSlotMenu } = useContextMenu({
|
||||
id: SLOT_CONTEXT_MENU_ID,
|
||||
});
|
||||
|
||||
// ----------------------
|
||||
// Day-level fetch: appointments + patients for selectedDate (lightweight)
|
||||
@@ -922,6 +936,39 @@ export default function AppointmentsPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleCopyAppointment = (appointmentId: number) => {
|
||||
const apt = appointments.find((a) => a.id === appointmentId) as any;
|
||||
if (!apt) return;
|
||||
const patientName =
|
||||
processedAppointments.find((a) => a.id === appointmentId)?.patientName ?? "";
|
||||
setCopiedAppointment({
|
||||
patientId: apt.patientId,
|
||||
patientName,
|
||||
title: apt.title,
|
||||
type: apt.type,
|
||||
notes: apt.notes ?? undefined,
|
||||
});
|
||||
toast({
|
||||
title: "Appointment Copied",
|
||||
description: `${patientName} — right-click an empty slot to paste.`,
|
||||
});
|
||||
};
|
||||
|
||||
const handlePasteAppointment = (timeSlot: TimeSlot, staffId: number) => {
|
||||
if (!copiedAppointment || !user) return;
|
||||
createAppointmentMutation.mutate({
|
||||
patientId: copiedAppointment.patientId,
|
||||
userId: user.id,
|
||||
staffId,
|
||||
title: copiedAppointment.title,
|
||||
date: formatLocalDate(selectedDate),
|
||||
type: copiedAppointment.type,
|
||||
startTime: timeSlot.time,
|
||||
endTime: timeSlot.time, // backend sets the real end time
|
||||
notes: copiedAppointment.notes,
|
||||
} as unknown as InsertAppointment);
|
||||
};
|
||||
|
||||
// Function to display context menu
|
||||
const handleContextMenu = (e: React.MouseEvent, appointmentId: number) => {
|
||||
// Prevent the default browser context menu
|
||||
@@ -1160,6 +1207,10 @@ export default function AppointmentsPage() {
|
||||
: "text-gray-400 hover:bg-gray-100"
|
||||
}`}
|
||||
onClick={handleClickEmpty}
|
||||
onContextMenu={(e) => {
|
||||
e.preventDefault();
|
||||
showSlotMenu({ event: e, props: { timeSlot, staffId } });
|
||||
}}
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -2245,6 +2296,12 @@ export default function AppointmentsPage() {
|
||||
Edit Appointment
|
||||
</span>
|
||||
</Item>
|
||||
<Item onClick={({ props }) => handleCopyAppointment(props.appointmentId)}>
|
||||
<span className="flex items-center gap-2">
|
||||
<Copy className="h-4 w-4" />
|
||||
Copy the appointment
|
||||
</span>
|
||||
</Item>
|
||||
<Item
|
||||
onClick={({ props }) =>
|
||||
handleDeleteAppointment(props.appointmentId)
|
||||
@@ -2327,6 +2384,21 @@ export default function AppointmentsPage() {
|
||||
</Item>
|
||||
</Menu>
|
||||
|
||||
{/* Empty-slot Context Menu */}
|
||||
<Menu id={SLOT_CONTEXT_MENU_ID} animation="fade">
|
||||
<Item
|
||||
disabled={!copiedAppointment}
|
||||
onClick={({ props }) => handlePasteAppointment(props.timeSlot, props.staffId)}
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
<ClipboardPaste className="h-4 w-4" />
|
||||
{copiedAppointment
|
||||
? `Paste the appointment (${copiedAppointment.patientName})`
|
||||
: "Paste the appointment"}
|
||||
</span>
|
||||
</Item>
|
||||
</Menu>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="flex flex-col lg:flex-row gap-6">
|
||||
{/* Schedule Grid */}
|
||||
|
||||
Reference in New Issue
Block a user