- {/* Start Consultation - For booked and checked in appointments */}
- {["booked", "checked_in"].includes(currentStatus) &&
- canCheckIn &&
- (appointment.associated_encounter?.id ? (
- // When encounter exists: set status to in_consultation and redirect
-
}
- title={t("start_consultation")}
- actionId="start-consultation"
- onClick={() => {
- updateAppointment({
- status: AppointmentStatus.IN_CONSULTATION,
- note: appointment.note,
- });
- navigate(
- `/facility/${facilityId}/patient/${appointment.patient.id}/encounter/${appointment.associated_encounter!.id}/updates`,
- );
- }}
- />
- ) : (
- // When no encounter exists: create encounter and set status to in_consultation
+
+
+ {t("quick_actions")}
+
+
+ {!AppointmentFinalStatuses.includes(appointment.status) && (
+ <>
+ {/* Start Consultation - For booked and checked in appointments */}
+ {["booked", "checked_in"].includes(currentStatus) &&
+ canCheckIn &&
+ (appointment.associated_encounter?.id ? (
+ // When encounter exists: set status to in_consultation and redirect
+ }
+ title={t("start_consultation")}
+ actionId="start-consultation"
+ onClick={() => {
+ updateAppointment({
+ status: AppointmentStatus.IN_CONSULTATION,
+ note: appointment.note,
+ });
+ navigate(
+ `/facility/${facilityId}/patient/${appointment.patient.id}/encounter/${appointment.associated_encounter!.id}/updates`,
+ );
+ }}
+ />
+ ) : (
+ // When no encounter exists: create encounter and set status to in_consultation
+ }
+ title={t("start_consultation")}
+ actionId="start-consultation"
+ />
+ }
+ onSuccess={() => {
+ updateAppointment({
+ status: AppointmentStatus.IN_CONSULTATION,
+ note: appointment.note,
+ });
+ }}
+ />
+ ))}
+
+ {!appointment.associated_encounter?.id && (
}
- title={t("start_consultation")}
- actionId="start-consultation"
+ icon={
+
+ }
+ title={t("create_planned_encounter")}
+ actionId="create-encounter"
/>
}
onSuccess={() => {
- updateAppointment({
- status: AppointmentStatus.IN_CONSULTATION,
- note: appointment.note,
+ queryClient.invalidateQueries({
+ queryKey: ["appointment", appointment.id],
});
}}
/>
- ))}
-
- {!appointment.associated_encounter?.id && (
- }
- title={t("create_planned_encounter")}
- actionId="create-encounter"
- />
- }
- onSuccess={() => {
- queryClient.invalidateQueries({
- queryKey: ["appointment", appointment.id],
- });
- }}
- />
- )}
- {/* Print Appointment */}
+ )}
+ >
+ )}
+ {!CancelledAppointmentStatuses.includes(appointment.status) && (
}
title={t("print_appointment")}
@@ -537,17 +545,16 @@ export default function AppointmentDetail(props: Props) {
basePath="/"
href={`/facility/${facilityId}/patient/${appointment.patient.id}/appointments/${appointment.id}/print`}
/>
-
- }
- title={t("accounts")}
- actionId="goto-account"
- basePath="/"
- href={`/facility/${facilityId}/billing/account?status=active&patient_filter=${appointment.patient.id}&patient_name=${appointment.patient.name}`}
- />
-
+ )}
+
}
+ title={t("accounts")}
+ actionId="goto-account"
+ basePath="/"
+ href={`/facility/${facilityId}/billing/account?status=active&patient_filter=${appointment.patient.id}&patient_name=${encodeURIComponent(appointment.patient.name || "")}`}
+ />
- )}
+