From c990a9889aa0068db5c15b7aa74df02db05eb457 Mon Sep 17 00:00:00 2001 From: Abhiuday Gupta <77210185+cp-Coder@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:19:49 +0530 Subject: [PATCH] fix: patient category shifting form (#5392) * fix(shifting): updated logic to select patient category value * Fix patient category display --------- Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Co-authored-by: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> --- src/Components/Patient/ShiftCreate.tsx | 4 ++-- src/Components/Shifting/ShiftDetails.tsx | 4 +++- src/Components/Shifting/ShiftDetailsUpdate.tsx | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Components/Patient/ShiftCreate.tsx b/src/Components/Patient/ShiftCreate.tsx index a569bdf950e..e863ae3fd84 100644 --- a/src/Components/Patient/ShiftCreate.tsx +++ b/src/Components/Patient/ShiftCreate.tsx @@ -411,8 +411,8 @@ export const ShiftCreate = (props: patientShiftProps) => { required={false} name="patient_category" value={patientCategory} - onChange={(value) => { - setPatientCategory(value); + onChange={(e) => { + setPatientCategory(e.value); }} label="Patient Category" /> diff --git a/src/Components/Shifting/ShiftDetails.tsx b/src/Components/Shifting/ShiftDetails.tsx index 2653f141592..8305f06b9a9 100644 --- a/src/Components/Shifting/ShiftDetails.tsx +++ b/src/Components/Shifting/ShiftDetails.tsx @@ -679,7 +679,9 @@ export default function ShiftDetails(props: { id: string }) { {" "} - {data.patient_category} + {data.patient_object.last_consultation?.last_daily_round + ?.patient_category ?? + data.patient_object.last_consultation?.category} {kasp_enabled && ( diff --git a/src/Components/Shifting/ShiftDetailsUpdate.tsx b/src/Components/Shifting/ShiftDetailsUpdate.tsx index aa7a38e62c5..36c64efbd45 100644 --- a/src/Components/Shifting/ShiftDetailsUpdate.tsx +++ b/src/Components/Shifting/ShiftDetailsUpdate.tsx @@ -262,8 +262,11 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { }; d["initial_status"] = res.data.status; d["status"] = qParams.status || res.data.status; + const patient_category = + d.patient.last_consultation?.last_daily_round?.patient_category ?? + d.patient.last_consultation?.category; d["patient_category"] = PATIENT_CATEGORIES.find( - (c) => c.text === res.data.patient_category + (c) => c.text === patient_category )?.id; dispatch({ type: "set_form", form: d }); }