Skip to content

Commit

Permalink
fix: patient category shifting form (#5392)
Browse files Browse the repository at this point in the history
* fix(shifting): updated logic to select patient category value

* Fix patient category display

---------

Co-authored-by: Mohammed Nihal <[email protected]>
Co-authored-by: Ashesh3 <[email protected]>
  • Loading branch information
3 people authored Apr 28, 2023
1 parent 9150a02 commit c990a98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Components/Patient/ShiftCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Shifting/ShiftDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,9 @@ export default function ShiftDetails(props: { id: string }) {
</span>
<span className="badge badge-pill badge-warning py-1 px-2">
{" "}
{data.patient_category}
{data.patient_object.last_consultation?.last_daily_round
?.patient_category ??
data.patient_object.last_consultation?.category}
</span>
</div>
{kasp_enabled && (
Expand Down
5 changes: 4 additions & 1 deletion src/Components/Shifting/ShiftDetailsUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down

0 comments on commit c990a98

Please sign in to comment.