diff --git a/.env b/.env index b5db3d0088f..77e4641b8b2 100644 --- a/.env +++ b/.env @@ -14,4 +14,4 @@ ESLINT_NO_DEV_ERRORS=true CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566" REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn" -REACT_ENABLED_APPS="" +REACT_ENABLED_APPS="" \ No newline at end of file diff --git a/public/locale/en.json b/public/locale/en.json index ce1d79aa3dd..d686fa181a5 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -487,6 +487,7 @@ "consultation_not_filed_description": "Please file a consultation for this patient to continue.", "consultation_notes": "General Instructions (Advice)", "consultation_updates": "Consultation updates", + "contact_info": "Contact Info", "contact_number": "Contact Number", "contact_person": "Name of Contact Person at Facility", "contact_person_at_the_facility": "Contact person at the current facility", diff --git a/src/Utils/request/api.tsx b/src/Utils/request/api.tsx index 441b9a3d8c8..e1777364b3f 100644 --- a/src/Utils/request/api.tsx +++ b/src/Utils/request/api.tsx @@ -1065,11 +1065,6 @@ const routes = { TBody: Type(), TRes: Type(), }, - deleteShiftRecord: { - path: "/api/v1/shift/{id}/", - method: "DELETE", - TRes: Type<{ detail: string }>(), - }, listShiftRequests: { path: "/api/v1/shift/", method: "GET", @@ -1241,13 +1236,6 @@ const routes = { TRes: Type(), TBody: Type>(), }, - deleteResourceRecord: { - path: "/api/v1/resource/{id}/", - method: "DELETE", - TRes: Type<{ - detail?: string; - }>(), - }, listResourceRequests: { path: "/api/v1/resource/", method: "GET", diff --git a/src/components/Facility/DischargeModal.tsx b/src/components/Facility/DischargeModal.tsx index 359e6437931..07229c9e17a 100644 --- a/src/components/Facility/DischargeModal.tsx +++ b/src/components/Facility/DischargeModal.tsx @@ -290,7 +290,9 @@ const DischargeModal = ({ setPreDischargeForm((form) => ({ ...form, ...updates })); }} required - min={new Date(consultationData?.encounter_date)} + min={dayjs(consultationData?.encounter_date) + .subtract(1, "day") + .toDate()} max={new Date()} error={ discharge_reason === diff --git a/src/components/Form/SearchInput.tsx b/src/components/Form/SearchInput.tsx index bbf59305a0a..69334c0f4db 100644 --- a/src/components/Form/SearchInput.tsx +++ b/src/components/Form/SearchInput.tsx @@ -87,7 +87,7 @@ const SearchInput = ({ className={className} leading={ props.leading || ( - + ) } trailing={ diff --git a/src/components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx b/src/components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx index 86db7353832..b1eac32409d 100644 --- a/src/components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx +++ b/src/components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx @@ -31,17 +31,17 @@ export default function MedicineAdministrationTable({ -
- {t("medicine")} - -

Dosage &

-

- {prescriptions[0]?.dosage_type !== "PRN" - ? "Frequency" - : "Indicator"} -

-
-
+ {t("medicine")} + + + +

{t("dosage")} &

+

+ {prescriptions[0]?.dosage_type !== "PRN" + ? t("frequency") + : t("indicator")} +

+
diff --git a/src/components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx b/src/components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx index d08506d7fbe..7544f405b08 100644 --- a/src/components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx +++ b/src/components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx @@ -59,6 +59,25 @@ export default function MedicineAdministrationTableRow({ key: `${prescription.last_administration?.administered_date}`, }, ); + const DosageFrequencyInfo = () => ( +
+
+ {prescription.dosage_type !== "TITRATED" ? ( +

{prescription.base_dosage}

+ ) : ( +

+ {prescription.base_dosage} - {prescription.target_dosage} +

+ )} + +

+ {prescription.dosage_type !== "PRN" + ? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency) + : prescription.indicator} +

+
+
+ ); return ( <> @@ -216,24 +235,14 @@ export default function MedicineAdministrationTableRow({ {prescription.medicine_object?.generic} - -
- {prescription.dosage_type !== "TITRATED" ? ( -

{prescription.base_dosage}

- ) : ( -

- {prescription.base_dosage} - {prescription.target_dosage} -

- )} - -

- {prescription.dosage_type !== "PRN" - ? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency) - : prescription.indicator} -

+
+
+ + + diff --git a/src/components/Resource/ResourceDetails.tsx b/src/components/Resource/ResourceDetails.tsx index 2495c64433d..d77bdcc3fea 100644 --- a/src/components/Resource/ResourceDetails.tsx +++ b/src/components/Resource/ResourceDetails.tsx @@ -4,21 +4,16 @@ import { useState } from "react"; import CareIcon from "@/CAREUI/icons/CareIcon"; import ButtonV2 from "@/components/Common/ButtonV2"; -import ConfirmDialog from "@/components/Common/ConfirmDialog"; import Loading from "@/components/Common/Loading"; import Page from "@/components/Common/Page"; import CommentSection from "@/components/Resource/ResourceCommentSection"; -import * as Notification from "@/Utils/Notifications"; import routes from "@/Utils/request/api"; -import request from "@/Utils/request/request"; import useQuery from "@/Utils/request/useQuery"; import { classNames, formatDateTime, formatName } from "@/Utils/utils"; export default function ResourceDetails(props: { id: string }) { const [isPrintMode, setIsPrintMode] = useState(false); - const [openDeleteResourceDialog, setOpenDeleteResourceDialog] = - useState(false); const { data, loading } = useQuery(routes.getResourceDetails, { pathParams: { id: props.id }, onResponse: ({ res, data }) => { @@ -27,25 +22,6 @@ export default function ResourceDetails(props: { id: string }) { } }, }); - - const handleResourceDelete = async () => { - setOpenDeleteResourceDialog(true); - const { res, data } = await request(routes.deleteResourceRecord, { - pathParams: { id: props.id }, - }); - if (res?.status === 204) { - Notification.Success({ - msg: "Resource record has been deleted successfully.", - }); - } else { - Notification.Error({ - msg: "Error while deleting Resource: " + (data?.detail || ""), - }); - } - - navigate("/resource"); - }; - const showFacilityCard = (facilityData: any) => { return (
@@ -329,28 +305,6 @@ export default function ResourceDetails(props: { id: string }) {
{data.reason || "--"}
- -
-
- setOpenDeleteResourceDialog(true)} - > - Delete Record - - - setOpenDeleteResourceDialog(false)} - onConfirm={handleResourceDelete} - /> -
-

Audit Log

diff --git a/src/components/Shifting/ShiftDetails.tsx b/src/components/Shifting/ShiftDetails.tsx index d5b251eeb8d..8e85fda3d19 100644 --- a/src/components/Shifting/ShiftDetails.tsx +++ b/src/components/Shifting/ShiftDetails.tsx @@ -9,7 +9,6 @@ import RecordMeta from "@/CAREUI/display/RecordMeta"; import CareIcon from "@/CAREUI/icons/CareIcon"; import ButtonV2 from "@/components/Common/ButtonV2"; -import ConfirmDialog from "@/components/Common/ConfirmDialog"; import Loading from "@/components/Common/Loading"; import Page from "@/components/Common/Page"; import { ConsultationModel } from "@/components/Facility/models"; @@ -22,16 +21,13 @@ import { SHIFTING_CHOICES_WARTIME, } from "@/common/constants"; -import * as Notification from "@/Utils/Notifications"; import routes from "@/Utils/request/api"; -import request from "@/Utils/request/request"; import useQuery from "@/Utils/request/useQuery"; import { formatDateTime, formatName, formatPatientAge } from "@/Utils/utils"; export default function ShiftDetails(props: { id: string }) { const [isPrintMode, setIsPrintMode] = useState(false); const [isCopied, setIsCopied] = useState(false); - const [openDeleteShiftDialog, setOpenDeleteShiftDialog] = useState(false); const { t } = useTranslation(); const shiftStatusOptions = careConfig.wartimeShifting @@ -41,26 +37,6 @@ export default function ShiftDetails(props: { id: string }) { const { data, loading } = useQuery(routes.getShiftDetails, { pathParams: { id: props.id }, }); - - const handleShiftDelete = async () => { - setOpenDeleteShiftDialog(true); - - const { res, data } = await request(routes.deleteShiftRecord, { - pathParams: { id: props.id }, - }); - if (res?.status == 204) { - Notification.Success({ - msg: t("shifting_deleted"), - }); - } else { - Notification.Error({ - msg: t("error_deleting_shifting") + (data?.detail || ""), - }); - } - - navigate("/shifting"); - }; - const showCopyToclipBoard = (data: any) => { return ( @@ -732,25 +708,6 @@ export default function ShiftDetails(props: { id: string }) { time={data?.modified_date} /> - -
-
- setOpenDeleteShiftDialog(true)} - > - {t("delete_record")} - - setOpenDeleteShiftDialog(false)} - onConfirm={handleShiftDelete} - /> -
-
diff --git a/src/components/Shifting/ShiftingList.tsx b/src/components/Shifting/ShiftingList.tsx index 3af77809d7c..d4746ad434b 100644 --- a/src/components/Shifting/ShiftingList.tsx +++ b/src/components/Shifting/ShiftingList.tsx @@ -1,3 +1,4 @@ +import careConfig from "@careConfig"; import { navigate } from "raviger"; import { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -13,15 +14,16 @@ import Page from "@/components/Common/Page"; import { ShiftingModel } from "@/components/Facility/models"; import SearchInput from "@/components/Form/SearchInput"; import BadgesList from "@/components/Shifting/ShiftingBadges"; -import ShiftingBlock from "@/components/Shifting/ShiftingBlock"; import { formatFilter } from "@/components/Shifting/ShiftingCommons"; import ListFilter from "@/components/Shifting/ShiftingFilters"; +import useAuthUser from "@/hooks/useAuthUser"; import useFilters from "@/hooks/useFilters"; import routes from "@/Utils/request/api"; import request from "@/Utils/request/request"; import useQuery from "@/Utils/request/useQuery"; +import { formatDateTime } from "@/Utils/utils"; export default function ListView() { const { @@ -31,19 +33,31 @@ export default function ListView() { FilterBadges, advancedFilter, resultsPerPage, - } = useFilters({ cacheBlacklist: ["patient_name"], limit: 12 }); + } = useFilters({ cacheBlacklist: ["patient_name"] }); - const [modalFor, setModalFor] = useState(); + const [modalFor, setModalFor] = useState<{ + externalId: string | undefined; + loading: boolean; + }>({ + externalId: undefined, + loading: false, + }); + + const authUser = useAuthUser(); const { t } = useTranslation(); - const handleTransferComplete = async (shift?: ShiftingModel) => { - if (!shift) return; - await request(routes.completeTransfer, { - pathParams: { externalId: shift.external_id }, - }); - navigate( - `/facility/${shift.assigned_facility}/patient/${shift.patient}/consultation`, - ); + const handleTransferComplete = async (shift: ShiftingModel) => { + setModalFor({ ...modalFor, loading: true }); + try { + await request(routes.completeTransfer, { + pathParams: { externalId: shift.external_id }, + }); + navigate( + `/facility/${shift.assigned_facility}/patient/${shift.patient}/consultation`, + ); + } catch (error) { + setModalFor({ externalId: undefined, loading: false }); + } }; const { @@ -53,7 +67,6 @@ export default function ListView() { } = useQuery(routes.listShiftRequests, { query: formatFilter({ ...qParams, - limit: resultsPerPage, offset: (qParams.page ? qParams.page - 1 : 0) * resultsPerPage, }), }); @@ -62,42 +75,173 @@ export default function ListView() { if (loading) { return ; } - - if (!data || data.length === 0) { + if (data && !data.length) { return ( -
-
- {t("no_patients_to_show")} -
+
+ {t("no_patients_to_show")}
); } - return ( -
-
- {data.map((shift, i) => ( -
- setModalFor(shift)} - shift={shift} - /> + return data.map((shift: ShiftingModel) => ( +
+
+
+
+ {shift.patient_object.name} +
+
+ {shift.patient_object.age} +
+
+ +
+
+
+ +
+ {shift.patient_object.phone_number || ""} +
+
- ))} +
+
+ +
+ {shift.patient_object.address || "--"} +
+ +
+
+ +
+
+
+ +
{shift.status}
+ + +
+ {shift.emergency && ( + + {t("emergency")} + + )} +
+
+ +
+
+ +
+ {formatDateTime(shift.modified_date) || "--"} +
+ +
+
+ +
+
+ +
+ {shift.origin_facility_object?.name} +
+ + + {careConfig.wartimeShifting && ( +
+ +
+ {shift.shifting_approving_facility_object?.name} +
+ + )} + +
+ +
+ {shift.assigned_facility_external || + shift.assigned_facility_object?.name || + t("yet_to_be_decided")} +
+ +
+
+ navigate(`/shifting/${shift.external_id}`)} + variant="secondary" + border + className="w-full" + > + {t("all_details")} + + {shift.status === "COMPLETED" && shift.assigned_facility && ( +
+ + setModalFor({ + externalId: shift.external_id, + loading: false, + }) + } + > + {t("transfer_to_receiving_facility")} + + + setModalFor({ externalId: undefined, loading: false }) + } + onConfirm={() => handleTransferComplete(shift)} + /> +
+ )} +
- setModalFor(undefined)} - onConfirm={() => handleTransferComplete(modalFor)} - />
- ); + )); }; return ( @@ -118,7 +262,9 @@ export default function ListView() { breadcrumbs={false} options={ <> -
+
+ +
-
- {/* dummy div to align space as per board view */} -
-
+ +
+ advancedFilter.setShow(true)} + /> navigate("/shifting/board", { query: qParams })} @@ -137,10 +284,6 @@ export default function ListView() { {t("board_view")} - - advancedFilter.setShow(true)} - />
} @@ -151,9 +294,9 @@ export default function ListView() { ) : (
-
+
- - {showShiftingCardList(shiftData?.results || [])} +
+
+
+ {t("patients")} +
+
+ {t("contact_info")} +
+
+ {t("consent__status")} +
+
+ {t("facilities")} +
+
+ {t("LOG_UPDATE_FIELD_LABEL__action")} +
+
+
{showShiftingCardList(shiftData?.results || [])}
+