fix: show only user-typed notes on appointment card

Remove auto-appending of "Appointment with [staff name]" to notes on
save, and preserve existing notes when dragging an appointment to a
new slot.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ff
2026-06-09 21:48:17 -04:00
parent 541d65da6d
commit facf9e79e2
2 changed files with 10 additions and 10 deletions

View File

@@ -265,7 +265,7 @@ export function AppointmentForm({
title = format(data.date, "MMMM d"); title = format(data.date, "MMMM d");
} }
let notes = data.notes || ""; const notes = data.notes || "";
const selectedStaff = const selectedStaff =
staffMembers.find((staff) => staff.id?.toString() === data.staffId) || staffMembers.find((staff) => staff.id?.toString() === data.staffId) ||
@@ -273,14 +273,7 @@ export function AppointmentForm({
if (!selectedStaff) { if (!selectedStaff) {
console.error("No staff selected and no available staff in the list"); console.error("No staff selected and no available staff in the list");
return; // Handle this case as well return;
}
// If there's no staff information in the notes, add it
if (!notes.includes("Appointment with")) {
notes = notes
? `${notes}\nAppointment with ${selectedStaff?.name}`
: `Appointment with ${selectedStaff?.name}`;
} }
const formattedDate = formatLocalDate(data.date); const formattedDate = formatLocalDate(data.date);

View File

@@ -98,6 +98,7 @@ interface ScheduledAppointment {
endTime: string | Date; endTime: string | Date;
status: string | null; status: string | null;
type: string; type: string;
notes?: string | null;
procedureCodes?: string[]; procedureCodes?: string[];
} }
@@ -571,6 +572,7 @@ export default function AppointmentsPage() {
patientInsuranceProvider, patientInsuranceProvider,
hasProcedures: !!(apt as any).hasProcedures, hasProcedures: !!(apt as any).hasProcedures,
hasClaimWithNumber: !!(apt as any).hasClaimWithNumber, hasClaimWithNumber: !!(apt as any).hasClaimWithNumber,
notes: (apt as any).notes ?? null,
procedureCodes: (apt as any).procedureCodes ?? [], procedureCodes: (apt as any).procedureCodes ?? [],
movedByAi: !!(apt as any).movedByAi, movedByAi: !!(apt as any).movedByAi,
staffId, staffId,
@@ -733,7 +735,7 @@ export default function AppointmentsPage() {
status: apt.status ?? undefined, status: apt.status ?? undefined,
startTime: newTimeSlot.time, startTime: newTimeSlot.time,
endTime: endTime, endTime: endTime,
notes: `Appointment with ${staff?.name}`, notes: apt.notes ?? undefined,
}; };
// Call update mutation // Call update mutation
updateAppointmentMutation.mutate({ updateAppointmentMutation.mutate({
@@ -838,6 +840,11 @@ export default function AppointmentsPage() {
{appointment.procedureCodes.join(", ")} {appointment.procedureCodes.join(", ")}
</div> </div>
)} )}
{appointment.notes && (
<div className="truncate text-[10px] opacity-90 font-semibold">
{appointment.notes}
</div>
)}
</div> </div>
); );
} }