From 0c3342fb910306884782d87a9d39d582680bcd32 Mon Sep 17 00:00:00 2001 From: Aditya Jindal Date: Tue, 28 Jan 2025 20:59:11 +0530 Subject: [PATCH 01/10] Disable Unnecessary Browser Pop-up on Patient Registration Form (#10251) --- .../PatientRegistration.tsx | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/pages/PublicAppointments/PatientRegistration.tsx b/src/pages/PublicAppointments/PatientRegistration.tsx index 608df6c64c1..855e3fe1336 100644 --- a/src/pages/PublicAppointments/PatientRegistration.tsx +++ b/src/pages/PublicAppointments/PatientRegistration.tsx @@ -136,36 +136,37 @@ export function PatientRegistration(props: PatientRegistrationProps) { defaultValues: initialForm, }); - const { mutate: createAppointment } = useMutation({ - mutationFn: (body: AppointmentCreateRequest) => - mutate(PublicAppointmentApi.createAppointment, { - pathParams: { id: selectedSlot?.id }, - body, - headers: { - Authorization: `Bearer ${tokenData.token}`, - }, - })(body), - onSuccess: (data: Appointment) => { - toast.success(t("appointment_created_success")); - queryClient.invalidateQueries({ - queryKey: [ - ["patients", tokenData.phoneNumber], - ["appointment", tokenData.phoneNumber], - ], - }); - navigate( - `/facility/${props.facilityId}/appointments/${data.id}/success`, - { - replace: true, - }, - ); - }, - onError: (error) => { - toast.error(error?.message || t("failed_to_create_appointment")); - }, - }); + const { mutate: createAppointment, isPending: isCreatingAppointment } = + useMutation({ + mutationFn: (body: AppointmentCreateRequest) => + mutate(PublicAppointmentApi.createAppointment, { + pathParams: { id: selectedSlot?.id }, + body, + headers: { + Authorization: `Bearer ${tokenData.token}`, + }, + })(body), + onSuccess: (data: Appointment) => { + toast.success(t("appointment_created_success")); + queryClient.invalidateQueries({ + queryKey: [ + ["patients", tokenData.phoneNumber], + ["appointment", tokenData.phoneNumber], + ], + }); + navigate( + `/facility/${props.facilityId}/appointments/${data.id}/success`, + { + replace: true, + }, + ); + }, + onError: (error) => { + toast.error(error?.message || t("failed_to_create_appointment")); + }, + }); - const { mutate: createPatient, isPending: isCreatingPatient } = useMutation({ + const { mutate: createPatient } = useMutation({ mutationFn: (body: Partial) => mutate(routes.otp.createPatient, { body: { ...body, phone_number: tokenData.phoneNumber }, @@ -214,7 +215,7 @@ export function PatientRegistration(props: PatientRegistrationProps) { // TODO: Use useBlocker hook after switching to tanstack router // https://tanstack.com/router/latest/docs/framework/react/guide/navigation-blocking#how-do-i-use-navigation-blocking useNavigationPrompt( - form.formState.isDirty && !isCreatingPatient, + form.formState.isDirty && !isCreatingAppointment, t("unsaved_changes"), ); From 25cdaf68712d45b9182c2c63c5e04f8c389cf64a Mon Sep 17 00:00:00 2001 From: Jacob John Jeevan <40040905+Jacobjeevan@users.noreply.github.com> Date: Wed, 29 Jan 2025 05:48:09 +0530 Subject: [PATCH 02/10] Patient Age and Facility Location Edits (#10260) --- src/Utils/utils.ts | 1 - src/components/Facility/FacilityForm.tsx | 4 ++-- .../Patient/PatientDetailsTab/Demography.tsx | 16 ---------------- src/components/Patient/PatientRegistration.tsx | 7 ++++--- src/types/emr/patient.ts | 1 - 5 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index a0694146ba1..64d8aeca38b 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -135,7 +135,6 @@ export const formatPatientAge = ( obj: PatientModel | Patient, abbreviated = false, ) => { - if (obj.age != null) return `${obj.age} Y`; const suffixes = getRelativeDateSuffix(abbreviated); const start = dayjs( obj.date_of_birth diff --git a/src/components/Facility/FacilityForm.tsx b/src/components/Facility/FacilityForm.tsx index bac5b022fdc..a748d408944 100644 --- a/src/components/Facility/FacilityForm.tsx +++ b/src/components/Facility/FacilityForm.tsx @@ -211,8 +211,8 @@ export default function FacilityForm(props: FacilityProps) { )?.id, address: facilityData.address, phone_number: facilityData.phone_number, - latitude: facilityData.latitude, - longitude: facilityData.longitude, + latitude: Number(facilityData.latitude), + longitude: Number(facilityData.longitude), is_public: facilityData.is_public, }); } diff --git a/src/components/Patient/PatientDetailsTab/Demography.tsx b/src/components/Patient/PatientDetailsTab/Demography.tsx index a246d8d464c..c88cd4f27dd 100644 --- a/src/components/Patient/PatientDetailsTab/Demography.tsx +++ b/src/components/Patient/PatientDetailsTab/Demography.tsx @@ -265,22 +265,6 @@ export const Demography = (props: PatientProps) => {
-
-
- -
-
{/*
{[ { label: t("abha_number"), value: "-" }, diff --git a/src/components/Patient/PatientRegistration.tsx b/src/components/Patient/PatientRegistration.tsx index e5a89632ef3..858054e3356 100644 --- a/src/components/Patient/PatientRegistration.tsx +++ b/src/components/Patient/PatientRegistration.tsx @@ -283,9 +283,10 @@ export default function PatientRegistration( same_address: patientQuery.data.address === patientQuery.data.permanent_address, age_or_dob: patientQuery.data.date_of_birth ? "dob" : "age", - age: !patientQuery.data.date_of_birth - ? patientQuery.data.age - : undefined, + age: + !patientQuery.data.date_of_birth && patientQuery.data.year_of_birth + ? new Date().getFullYear() - patientQuery.data.year_of_birth + : undefined, date_of_birth: patientQuery.data.date_of_birth ? patientQuery.data.date_of_birth : undefined, diff --git a/src/types/emr/patient.ts b/src/types/emr/patient.ts index 98ba1f582f4..eebe4b9e305 100644 --- a/src/types/emr/patient.ts +++ b/src/types/emr/patient.ts @@ -87,7 +87,6 @@ export interface PatientModel { assigned_to?: number | null; assigned_to_object?: AssignedToObjectModel; meta_info?: PatientMeta; - age?: string; } export const validatePatient = (patient: PatientModel, useDob: boolean) => { From 5cd4b17d9bf4b9a2c93a9ee9d9e773631e2e34a3 Mon Sep 17 00:00:00 2001 From: Mohamed amaan <121436543+modamaan@users.noreply.github.com> Date: Wed, 29 Jan 2025 07:04:26 +0530 Subject: [PATCH 03/10] Fix Layout Overflow on Appointment and Patient Details Pages for Mobile Screens (#10267) --- src/components/Resource/ResourceDetails.tsx | 8 ++++++-- src/components/ui/phone-input.tsx | 2 +- src/pages/Appointments/AppointmentDetail.tsx | 2 +- src/pages/Appointments/AppointmentsPage.tsx | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/Resource/ResourceDetails.tsx b/src/components/Resource/ResourceDetails.tsx index ec4c617d532..8308935f197 100644 --- a/src/components/Resource/ResourceDetails.tsx +++ b/src/components/Resource/ResourceDetails.tsx @@ -228,13 +228,17 @@ export default function ResourceDetails(props: { id: string }) {
{/* Action Buttons */}
-
-