From aa2d61b4d9f17e34ef872a1150541b4419d2d4ef Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Fri, 14 Apr 2023 19:20:55 +0530 Subject: [PATCH 1/7] Fix facility filter in asset page (#5341) --- src/Components/Assets/AssetFilter.tsx | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/Components/Assets/AssetFilter.tsx b/src/Components/Assets/AssetFilter.tsx index 21576601ba5..c7a891d4794 100644 --- a/src/Components/Assets/AssetFilter.tsx +++ b/src/Components/Assets/AssetFilter.tsx @@ -40,7 +40,6 @@ function AssetFilter(props: any) { const [qParams, _] = useQueryParams(); useEffect(() => { - console.log(facility); setFacilityId(facility?.id ? facility?.id : ""); setLocationId(location?.id ? location?.id : ""); }, [facility, location]); @@ -62,17 +61,9 @@ function AssetFilter(props: any) { const fetchFacility = useCallback( async (status: statusType) => { if (facilityId) { - const [facilityData]: any = await Promise.all([ - dispatch(getAnyFacility(facilityId)), - ]); + const facilityData: any = await dispatch(getAnyFacility(facilityId)); if (!status.aborted) { - if (!facilityData?.data) - Notification.Error({ - msg: "Something went wrong..!", - }); - else { - setFacility(facilityData.data); - } + setFacility(facilityData?.data); } } }, From da0e2a615fe5eeb82fb70cf87c4edb4ee03d3937 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Fri, 14 Apr 2023 19:21:38 +0530 Subject: [PATCH 2/7] Refactor discharge badge on Patient Dashboard (#5333) * Refactor discharge badge on Patient Dashboard * Bug fix --- .../Facility/ConsultationDetails.tsx | 22 ++++--- src/Components/Patient/PatientInfoCard.tsx | 59 ++++++++++++------- 2 files changed, 47 insertions(+), 34 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails.tsx b/src/Components/Facility/ConsultationDetails.tsx index 26d38226345..5e8f3f67325 100644 --- a/src/Components/Facility/ConsultationDetails.tsx +++ b/src/Components/Facility/ConsultationDetails.tsx @@ -535,7 +535,10 @@ export const ConsultationDetails = (props: any) => { label="Discharge Date" name="discharge_date" value={moment(preDischargeForm.discharge_date).toDate()} - min={moment(consultationData.admission_date).toDate()} + min={moment( + consultationData.admission_date || + consultationData.created_date + ).toDate()} disableFuture={true} required onChange={handleDateChange} @@ -601,7 +604,10 @@ export const ConsultationDetails = (props: any) => { label="Date of Discharge" name="discharge_date" value={moment(preDischargeForm.discharge_date).toDate()} - min={moment(consultationData.admission_date).toDate()} + min={moment( + consultationData.admission_date || + consultationData.created_date + ).toDate()} disableFuture={true} required onChange={handleDateChange} @@ -906,7 +912,7 @@ export const ConsultationDetails = (props: any) => { {consultationData.discharge_reason === "REC" && (
- Date {" - "} + Discharge Date {" - "} {consultationData.discharge_date ? formatDate(consultationData.discharge_date) @@ -984,14 +990,6 @@ export const ConsultationDetails = (props: any) => { )} {consultationData.discharge_reason === "EXP" && (
-
- Discharge Date {" - "} - - {consultationData.discharge_date - ? formatDate(consultationData.discharge_date) - : "--:--"} - -
Date of Death {" - "} @@ -1020,7 +1018,7 @@ export const ConsultationDetails = (props: any) => { ) && (
- Date {" - "} + Discharge Date {" - "} {consultationData.discharge_date ? formatDate(consultationData.discharge_date) diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index ec812d39b47..f1e5b95a114 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -199,29 +199,44 @@ export default function PatientInfoCard(props: { ); })}
-
-
- { - CONSULTATION_SUGGESTION.find( - (suggestion) => suggestion.id === consultation?.suggestion - )?.text - }{" "} - on{" "} - {consultation?.suggestion === "A" - ? moment(consultation?.admission_date).format("DD/MM/YYYY") - : consultation?.suggestion === "DD" - ? moment(consultation?.death_datetime).format("DD/MM/YYYY") - : moment(consultation?.created_date).format("DD/MM/YYYY")} + {patient.is_active === false && ( +
+
+ + { + CONSULTATION_SUGGESTION.find( + (suggestion) => + suggestion.id === consultation?.suggestion + )?.text + }{" "} + on{" "} + {consultation?.suggestion === "A" + ? moment(consultation?.admission_date).format( + "DD/MM/YYYY" + ) + : moment(consultation?.created_date).format("DD/MM/YYYY")} + , + {consultation?.discharge_reason === "EXP" ? ( + + {" "} + Expired on{" "} + {moment(consultation?.death_datetime).format( + "DD/MM/YYYY" + )} + + ) : ( + + {" "} + Discharged on{" "} + {moment(consultation?.discharge_date).format( + "DD/MM/YYYY" + )} + + )} + +
- {patient.is_active === false && - consultation?.suggestion !== "OP" && - consultation?.suggestion !== "DD" && ( -
- Discharged on{" "} - {moment(consultation?.discharge_date).format("DD/MM/YYYY")} -
- )} -
+ )}
From f5d8cf998463852783c066ec87c489ffa1afd60a Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 14 Apr 2023 21:56:50 +0530 Subject: [PATCH 3/7] Consultation Form: Minor fixes for action field (#5340) * fixes #5335 * minor fix * fix action not loaded when editing consultation * fix minor issue * minor hack to fix merge form state * fix issue with dropdown * skip prefill from patient if not update --------- Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- src/Components/Facility/ConsultationForm.tsx | 29 ++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 2abee9604f9..9bc52331372 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -98,7 +98,7 @@ type FormDetails = { prn_prescription: PRNPrescriptionType[]; investigation: InvestigationType[]; is_telemedicine: BooleanStrings; - action: string; + action?: string; assigned_to: string; assigned_to_object: UserModel | null; special_instruction: string; @@ -114,7 +114,8 @@ type FormDetails = { type Action = | { type: "set_form"; form: FormDetails } - | { type: "set_error"; errors: FormDetails }; + | { type: "set_error"; errors: FormDetails } + | { type: "set_form_field"; field: keyof FormDetails; value: any }; const initForm: FormDetails = { symptoms: [], @@ -147,7 +148,7 @@ const initForm: FormDetails = { prn_prescription: [], investigation: [], is_telemedicine: "false", - action: "PENDING", + action: undefined, assigned_to: "", assigned_to_object: null, special_instruction: "", @@ -189,7 +190,7 @@ const consultationFormReducer = (state = initialState, action: Action) => { case "set_form": { return { ...state, - form: action.form, + form: { ...state.form, ...action.form }, }; } case "set_error": { @@ -198,6 +199,15 @@ const consultationFormReducer = (state = initialState, action: Action) => { errors: action.errors, }; } + case "set_form_field": { + return { + ...state, + form: { + ...state.form, + [action.field]: action.value, + }, + }; + } } }; @@ -270,6 +280,14 @@ export const ConsultationForm = (props: any) => { if (res.data) { setPatientName(res.data.name); setFacilityName(res.data.facility_object.name); + if (isUpdate) { + dispatch({ + type: "set_form_field", + field: "action", + value: TELEMEDICINE_ACTIONS.find((a) => a.id === res.data.action) + ?.text, + }); + } } } else { setPatientName(""); @@ -1266,13 +1284,14 @@ export const ConsultationForm = (props: any) => { {...selectField("review_interval")} label="Review After" options={REVIEW_AT_CHOICES} + position="above" />
option.desc} optionValue={(option) => option.text} From f7b6cec414a565250e1d99c2ac7da20d40dc5e06 Mon Sep 17 00:00:00 2001 From: Suprabath kondapally <34211797+suprabathk@users.noreply.github.com> Date: Tue, 18 Apr 2023 07:31:36 -0400 Subject: [PATCH 4/7] Migrated ShiftingBoard.tsx from MaterialUI to Custom Components (#5324) * Migrated ShiftingBoard.tsx from MaterialUI to Custom Components * Update src/Components/Shifting/ShiftingBoard.tsx Co-authored-by: Rithvik Nishad * Update src/Components/Shifting/ShiftingBoard.tsx Co-authored-by: Rithvik Nishad --------- Co-authored-by: Rithvik Nishad Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- src/Components/Common/ConfirmDialogV2.tsx | 2 +- src/Components/Shifting/ShiftingBoard.tsx | 68 ++++++----------------- 2 files changed, 19 insertions(+), 51 deletions(-) diff --git a/src/Components/Common/ConfirmDialogV2.tsx b/src/Components/Common/ConfirmDialogV2.tsx index fd6164b0410..ba99423be21 100644 --- a/src/Components/Common/ConfirmDialogV2.tsx +++ b/src/Components/Common/ConfirmDialogV2.tsx @@ -31,7 +31,7 @@ const ConfirmDialogV2 = ({ onClose={onClose} title={title} description={ - + {description} } diff --git a/src/Components/Shifting/ShiftingBoard.tsx b/src/Components/Shifting/ShiftingBoard.tsx index 90878c3c5ae..36ca8925f4b 100644 --- a/src/Components/Shifting/ShiftingBoard.tsx +++ b/src/Components/Shifting/ShiftingBoard.tsx @@ -5,12 +5,11 @@ import { completeTransfer, downloadShiftRequests, } from "../../Redux/actions"; -import Button from "@material-ui/core/Button"; import { navigate } from "raviger"; import moment from "moment"; -import { Modal } from "@material-ui/core"; +import ConfirmDialogV2 from "../Common/ConfirmDialogV2"; import { CSVLink } from "react-csv"; -import CircularProgress from "@material-ui/core/CircularProgress"; +import CircularProgress from "../Common/components/CircularProgress"; import { useDrag, useDrop } from "react-dnd"; import { classNames, formatDate } from "../../Utils/utils"; import ButtonV2 from "../Common/components/ButtonV2"; @@ -204,60 +203,29 @@ const ShiftCard = ({ shift, filter }: any) => {
{filter === "TRANSFER IN PROGRESS" && shift.assigned_facility && (
- + - + setModalFor({ externalId: undefined, loading: false }) } + action={t("confirm")} + onConfirm={() => handleTransferComplete(shift)} > -
-
-
-

- {t("confirm_transfer_complete")} -

-
-
-

{t("mark_this_transfer_as_complete_question")}

-

- {t("redirected_to_create_consultation")} -

-
-
- - -
-
-
-
+

+ {t("redirected_to_create_consultation")} +

+
)}
From c2b094cbb6272c85ed2b53b7f87b92a1b0906c9b Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:15:05 +0530 Subject: [PATCH 5/7] Show errors on AddLocationForm (#5176) Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- src/Components/Facility/AddLocationForm.tsx | 42 +++++++++++++------ .../Facility/LocationManagement.tsx | 4 +- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/Components/Facility/AddLocationForm.tsx b/src/Components/Facility/AddLocationForm.tsx index e6b0cae3626..1e2413b2807 100644 --- a/src/Components/Facility/AddLocationForm.tsx +++ b/src/Components/Facility/AddLocationForm.tsx @@ -29,7 +29,10 @@ export const AddLocationForm = (props: LocationFormProps) => { const [description, setDescription] = useState(""); const [facilityName, setFacilityName] = useState(""); const [locationName, setLocationName] = useState(""); - + const [errors, setErrors] = useState({ + name: "", + description: "", + }); const headerText = !locationId ? "Add Location" : "Update Location"; const buttonText = !locationId ? "Add Location" : "Update Location"; @@ -56,6 +59,10 @@ export const AddLocationForm = (props: LocationFormProps) => { }, [dispatchAction, facilityId, locationId]); const handleSubmit = async (e: React.SyntheticEvent) => { + setErrors({ + name: "", + description: "", + }); e.preventDefault(); setIsLoading(true); const data = { @@ -69,17 +76,26 @@ export const AddLocationForm = (props: LocationFormProps) => { : createFacilityAssetLocation(data, facilityId) ); setIsLoading(false); - if (res && (res.status === 201 || res.status === 200)) { - const notificationMessage = locationId - ? "Location updated successfully" - : "Location created successfully"; + if (res) { + if (res.status === 201 || res.status === 200) { + const notificationMessage = locationId + ? "Location updated successfully" + : "Location created successfully"; - navigate(`/facility/${facilityId}/location`, { - replace: true, - }); - Notification.Success({ - msg: notificationMessage, - }); + navigate(`/facility/${facilityId}/location`, { + replace: true, + }); + Notification.Success({ + msg: notificationMessage, + }); + } else if (res.status === 400) { + Object.keys(res.data).forEach((key) => { + setErrors((prevState: any) => ({ + ...prevState, + [key]: res.data[key], + })); + }); + } } }; @@ -115,7 +131,7 @@ export const AddLocationForm = (props: LocationFormProps) => { required value={name} onChange={(e) => setName(e.value)} - error="" + error={errors.name} />
@@ -125,7 +141,7 @@ export const AddLocationForm = (props: LocationFormProps) => { label="Description" value={description} onChange={(e) => setDescription(e.value)} - error="" + error={errors.description} />
diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx index c08af89cc9b..d6526e985a2 100644 --- a/src/Components/Facility/LocationManagement.tsx +++ b/src/Components/Facility/LocationManagement.tsx @@ -32,9 +32,7 @@ const LocationRow = (props: LocationRowProps) => { >
-

- {name} -

+

{name}

{description}

From 71c9ee7c3e2cca949db28a822808bbc0f2fef4d2 Mon Sep 17 00:00:00 2001 From: Suprabath kondapally <34211797+suprabathk@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:31:37 -0400 Subject: [PATCH 6/7] Fixed Issue 5350 (#5352) * Migrated ShiftingBoard.tsx from MaterialUI to Custom Components * Update src/Components/Shifting/ShiftingBoard.tsx Co-authored-by: Rithvik Nishad * Update src/Components/Shifting/ShiftingBoard.tsx Co-authored-by: Rithvik Nishad * Fixed Transfer button whitespace issue --------- Co-authored-by: Rithvik Nishad Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- src/Components/Shifting/ShiftingBoard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Shifting/ShiftingBoard.tsx b/src/Components/Shifting/ShiftingBoard.tsx index 36ca8925f4b..98bf39cea6e 100644 --- a/src/Components/Shifting/ShiftingBoard.tsx +++ b/src/Components/Shifting/ShiftingBoard.tsx @@ -206,7 +206,7 @@ const ShiftCard = ({ shift, filter }: any) => { setModalFor(shift.external_id)} > {t("transfer_to_receiving_facility")} From db7b9b2b8d5fe2a6e446186334b84b90bab728f7 Mon Sep 17 00:00:00 2001 From: AbhishekPSingh07 <79076050+AbhishekPSingh07@users.noreply.github.com> Date: Wed, 19 Apr 2023 20:02:32 +0530 Subject: [PATCH 7/7] Made UI Responsive for Issue #5331 (#5344) * Made UI Responsive * made Changes * Update src/Components/Users/ManageUsers.tsx --------- Co-authored-by: Rithvik Nishad Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- src/Components/Users/ManageUsers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx index 0e5a766ca87..250070c689b 100644 --- a/src/Components/Users/ManageUsers.tsx +++ b/src/Components/Users/ManageUsers.tsx @@ -439,7 +439,7 @@ export default function ManageUsers() { setOpen={setExpandFacilityList} slideFrom="right" title="Facilities" - dialogClass="w-[350px]" + dialogClass="md:w-[400px]" onCloseClick={() => { //fetchData({ aborted: false }); }}