From 43d08e124154c77e1c331d71224e2387515abcd1 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:15:25 +0530 Subject: [PATCH 01/32] Add delay before live feed reconnect (#6655) * Add delay before live feed reconnect * change to 5s * Initital connect trigger --- .../Facility/Consultations/Feed.tsx | 37 +++++++++++-------- .../Facility/Consultations/LiveFeed.tsx | 17 ++++++--- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/Components/Facility/Consultations/Feed.tsx b/src/Components/Facility/Consultations/Feed.tsx index ac39be325e9..25b656a0a79 100644 --- a/src/Components/Facility/Consultations/Feed.tsx +++ b/src/Components/Facility/Consultations/Feed.tsx @@ -230,8 +230,28 @@ export const Feed: React.FC = ({ consultationId, facilityId }) => { } }; + const startStreamFeed = () => { + startStream({ + onSuccess: () => setStreamStatus(StreamStatus.Playing), + onError: () => { + setStreamStatus(StreamStatus.Offline); + if (!statusReported) { + triggerGoal("Camera Feed Viewed", { + consultationId, + userId: authUser.id, + result: "error", + }); + setStatusReported(true); + } + }, + }); + }; + useEffect(() => { if (cameraAsset.id) { + setTimeout(() => { + startStreamFeed(); + }, 1000); getPresets({ onSuccess: (resp) => setPresets(resp), onError: (_) => { @@ -251,21 +271,8 @@ export const Feed: React.FC = ({ consultationId, facilityId }) => { setStreamStatus(StreamStatus.Loading); } tId = setTimeout(() => { - startStream({ - onSuccess: () => setStreamStatus(StreamStatus.Playing), - onError: () => { - setStreamStatus(StreamStatus.Offline); - if (!statusReported) { - triggerGoal("Camera Feed Viewed", { - consultationId, - userId: authUser.id, - result: "error", - }); - setStatusReported(true); - } - }, - }); - }, 100); + startStreamFeed(); + }, 5000); } else if (!statusReported) { triggerGoal("Camera Feed Viewed", { consultationId, diff --git a/src/Components/Facility/Consultations/LiveFeed.tsx b/src/Components/Facility/Consultations/LiveFeed.tsx index aba473e958d..cd3f055921e 100644 --- a/src/Components/Facility/Consultations/LiveFeed.tsx +++ b/src/Components/Facility/Consultations/LiveFeed.tsx @@ -177,6 +177,9 @@ const LiveFeed = (props: any) => { useEffect(() => { if (cameraAsset?.hostname) { fetchCameraPresets(); + setTimeout(() => { + startStreamFeed(); + }, 1000); } }, []); @@ -192,6 +195,13 @@ const LiveFeed = (props: any) => { } }, [page.offset, cameraAsset.id, refreshPresetsHash]); + const startStreamFeed = () => { + startStream({ + onSuccess: () => setStreamStatus(StreamStatus.Playing), + onError: () => setStreamStatus(StreamStatus.Offline), + }); + }; + const viewOptions = (page: number) => { return presets ? Object.entries(presets) @@ -207,11 +217,8 @@ const LiveFeed = (props: any) => { if (streamStatus !== StreamStatus.Playing) { setStreamStatus(StreamStatus.Loading); tId = setTimeout(() => { - startStream({ - onSuccess: () => setStreamStatus(StreamStatus.Playing), - onError: () => setStreamStatus(StreamStatus.Offline), - }); - }, 500); + startStreamFeed(); + }, 5000); } return () => { From 4827e5007d4c0a1a79f422390c2d1ecb43693e46 Mon Sep 17 00:00:00 2001 From: Shyam Prakash <106866225+shyamprakash123@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:02:05 +0530 Subject: [PATCH 02/32] Fixed Non-uniform height of Asset List Tiles. (#6578) --- src/Components/Assets/AssetsList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx index 8c19928fbee..df6326c6e79 100644 --- a/src/Components/Assets/AssetsList.tsx +++ b/src/Components/Assets/AssetsList.tsx @@ -189,12 +189,12 @@ const AssetsList = () => {

From 826223779d14a94ae86b149a4c749cd056cf1da7 Mon Sep 17 00:00:00 2001 From: Ashraf Mohammed <98876115+AshrafMd-1@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:02:30 +0530 Subject: [PATCH 03/32] fix styling issues (#6639) --- .../Common/RelativeDateUserMention.tsx | 2 +- src/Components/Facility/ConsultationCard.tsx | 26 +++++++++++-------- src/Components/Patient/PatientHome.tsx | 6 ++--- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Components/Common/RelativeDateUserMention.tsx b/src/Components/Common/RelativeDateUserMention.tsx index 55c7a81518b..18fb431574f 100644 --- a/src/Components/Common/RelativeDateUserMention.tsx +++ b/src/Components/Common/RelativeDateUserMention.tsx @@ -8,7 +8,7 @@ function RelativeDateUserMention(props: { tooltipPosition?: "top" | "bottom" | "left" | "right"; }) { return ( -

+
{
{
- Created:{" "} + Created :{" "} +
+ +
+
+ } +
+ Last Modified :{" "} +
- } -
- Last Modified:{" "} -
diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx index b6ceaf2e4dc..a8f2335d484 100644 --- a/src/Components/Patient/PatientHome.tsx +++ b/src/Components/Patient/PatientHome.tsx @@ -457,7 +457,7 @@ export const PatientHome = (props: any) => {
navigate( @@ -717,7 +717,7 @@ export const PatientHome = (props: any) => {
-
+
Created
@@ -730,7 +730,7 @@ export const PatientHome = (props: any) => {
-
+
Last Edited
From 4602398f40391f4a708a30b72c493cdbd5e320f6 Mon Sep 17 00:00:00 2001 From: Gampa Sri Harsh <114745442+sriharsh05@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:07:17 +0530 Subject: [PATCH 04/32] Add Frontend validation in the add multiple bed function (#6643) * add front end validation for number of beds * disabled submit button when number of beds are greater than 100 --- src/Components/Facility/AddBedForm.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/AddBedForm.tsx b/src/Components/Facility/AddBedForm.tsx index 3bb49733141..785c90869ba 100644 --- a/src/Components/Facility/AddBedForm.tsx +++ b/src/Components/Facility/AddBedForm.tsx @@ -229,12 +229,21 @@ export const AddBedForm = (props: BedFormProps) => { min={1} max={100} onChange={(e) => setNumberOfBeds(Number(e.value))} + error={ + numberOfBeds > 100 + ? "Number of beds cannot be greater than 100" + : undefined + } /> )}
- + 100} + />
From 92208a18a60303f4d79b45bfeec78dc36cb2203a Mon Sep 17 00:00:00 2001 From: Ashraf Mohammed <98876115+AshrafMd-1@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:07:42 +0530 Subject: [PATCH 05/32] Move the cancel button to the right in facility inventory add page! (#6623) * move cancel button to the left side * change className --- src/Components/Facility/AddInventoryForm.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/AddInventoryForm.tsx b/src/Components/Facility/AddInventoryForm.tsx index 22be0b9fd0c..df217cad3ec 100644 --- a/src/Components/Facility/AddInventoryForm.tsx +++ b/src/Components/Facility/AddInventoryForm.tsx @@ -16,6 +16,7 @@ import TextFormField from "../Form/FormFields/TextFormField"; import { InventoryItemsModel } from "./models"; import { Cancel, Submit } from "../Common/components/ButtonV2"; import useAppHistory from "../../Common/hooks/useAppHistory"; + const Loading = lazy(() => import("../Common/Loading")); const initForm = { @@ -122,6 +123,7 @@ export const AddInventoryForm = (props: any) => { setFacilityName(""); } } + fetchFacilityName(); }, [dispatchAction, facilityId]); @@ -327,7 +329,7 @@ export const AddInventoryForm = (props: any) => { />
-
+
goBack()} />
From 835cab35188cdd7e1772e34b87f42bf58ba36a24 Mon Sep 17 00:00:00 2001 From: konavivekramakrishna <101407963+konavivekramakrishna@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:08:58 +0530 Subject: [PATCH 06/32] Fixed Facility Cover Image upload pop-up (#6616) * remove unnecessary onClick * removed cursor pointer --- src/Components/Facility/FacilityHome.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index 405ba236f05..f14057d4a91 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -370,11 +370,8 @@ export const FacilityHome = (props: any) => { /> {hasCoverImage ? (
- hasPermissionToEditCoverImage && setEditCoverImage(true) + className={ + "group relative h-48 w-full text-clip rounded-t bg-gray-200 opacity-100 transition-all duration-200 ease-in-out md:h-0 md:opacity-0" } > From 3a777988742de2f86dceaf65d5054e67c0334d5d Mon Sep 17 00:00:00 2001 From: Ashraf Mohammed <98876115+AshrafMd-1@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:09:16 +0530 Subject: [PATCH 07/32] No close button once you open the discontinued prescriptions (#6614) * fix scroll overlay * add style * add hide button * add loading logic --- .../MedicineAdministrationSheet/index.tsx | 79 +++++++++++-------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx index 187d5447314..9b37c53f599 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx @@ -39,7 +39,11 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => { const discontinuedPrescriptions = useQuery(MedicineRoutes.listPrescriptions, { pathParams: { consultation }, - query: { ...filters, discontinued: true }, + query: { + ...filters, + limit: showDiscontinued ? 100 : 1, + discontinued: true, + }, prefetch: !showDiscontinued, }); @@ -97,47 +101,60 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => { ) } /> - - - Scroll to view more prescriptions - -
- } - disableOverlay={loading || !prescriptions?.length} - > - {loading && } - {prescriptions?.length === 0 && } - - {!!prescriptions?.length && ( - { - refetch(); - discontinuedPrescriptions.refetch(); - }} - /> - )} - - {!showDiscontinued && !!discontinuedCount && ( +
+ + Scroll to view more prescriptions + +
+ } + disableOverlay={ + loading || !prescriptions?.length || !(prescriptions?.length > 1) + } + > + {loading ? ( + + ) : ( + <> + {prescriptions?.length === 0 && } + {!!prescriptions?.length && ( + { + refetch(); + discontinuedPrescriptions.refetch(); + }} + /> + )} + + )} + + {!!discontinuedCount && ( setShowDiscontinued(true)} + disabled={loading || discontinuedPrescriptions.loading} + onClick={() => setShowDiscontinued(!showDiscontinued)} > - + - Show {discontinuedCount} discontinued + {showDiscontinued ? "Hide" : "Show"}{" "} + {discontinuedCount} discontinued prescription(s) )} - +
); }; From 45b74d04be49164c55a269935ac9ee9284d7a3c3 Mon Sep 17 00:00:00 2001 From: Shyam Prakash <106866225+shyamprakash123@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:09:41 +0530 Subject: [PATCH 08/32] Fixed reloading issue while Opening Investigations or Treatment Summary in Consultation Dashboard. (#6576) Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- src/Components/Patient/PatientInfoCard.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index fd6213d8e08..bc86b7f4c97 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -441,14 +441,14 @@ export default function PatientInfoCard(props: { (action: any, i) => action[3] && (
- { @@ -473,7 +473,7 @@ export default function PatientInfoCard(props: { className={`care-l-${action[2]} text-lg text-primary-500`} /> {action[1]} - + {action?.[4]?.[0] && ( <>

From 21f53752d2ce85b300a2584b122140d2f0c0e46a Mon Sep 17 00:00:00 2001 From: Shyam Prakash <106866225+shyamprakash123@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:09:53 +0530 Subject: [PATCH 09/32] Improved look of vitals monitor in mobile view. (#6574) --- src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx b/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx index 071da764676..6533d133089 100644 --- a/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx +++ b/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx @@ -43,7 +43,7 @@ export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) {

{props.patientAssetBed && (
-
+
{patient ? ( )}
-
+
{asset && ( From 735fb5f1bf61cd690aa15a048f0a01b83a8533d0 Mon Sep 17 00:00:00 2001 From: Onkar Jadhav <56870381+Omkar76@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:10:19 +0530 Subject: [PATCH 10/32] Improve rounding of the preset buttons. Fixes #6555 (#6567) Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Co-authored-by: Rithvik Nishad --- src/Components/Facility/Consultations/Feed.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Facility/Consultations/Feed.tsx b/src/Components/Facility/Consultations/Feed.tsx index 25b656a0a79..c0b708619ef 100644 --- a/src/Components/Facility/Consultations/Feed.tsx +++ b/src/Components/Facility/Consultations/Feed.tsx @@ -466,9 +466,9 @@ export const Feed: React.FC = ({ consultationId, facilityId }) => { getCameraStatus({}); }} className={classNames( - "block border border-gray-500 px-4 py-2", + "block border border-gray-500 px-4 py-2 first:rounded-l last:rounded-r", currentPreset === preset - ? "rounded border-primary-500 bg-primary-500 text-white" + ? "border-primary-500 bg-primary-500 text-white" : "bg-transparent" )} > From 11da46137e66b9e6a491fc3f3de909711aba6709 Mon Sep 17 00:00:00 2001 From: konavivekramakrishna <101407963+konavivekramakrishna@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:10:45 +0530 Subject: [PATCH 11/32] Aligned buttons to right (#6573) * aligned buttons to right * fixed merge conflict * added pading --- src/Components/Facility/FacilityCard.tsx | 186 +++++++++++------------ 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/src/Components/Facility/FacilityCard.tsx b/src/Components/Facility/FacilityCard.tsx index ab37ac20c96..e8e0dbef70f 100644 --- a/src/Components/Facility/FacilityCard.tsx +++ b/src/Components/Facility/FacilityCard.tsx @@ -157,109 +157,109 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
-
-
-
-
*/} +
+
+
0.85 + ? "button-danger-border bg-red-500" + : "button-primary-border bg-primary-100" + }`} + > + + Live Patients / Total beds + {" "} + 0.85 + ? "text-white" + : "text-primary-600" + )} + />{" "} +
0.85 - ? "button-danger-border bg-red-500" - : "button-primary-border bg-primary-100" + ? "text-white" + : "text-gray-700" }`} > - - Live Patients / Total beds - {" "} - 0.85 - ? "text-white" - : "text-primary-600" - )} - />{" "} -
0.85 - ? "text-white" - : "text-gray-700" - }`} - > - Occupancy: {facility.patient_count} /{" "} - {facility.bed_count}{" "} -
{" "} -
- - Notify: {facility.name} - - } - onClose={() => setNotifyModalFor(undefined)} + Occupancy: {facility.patient_count} /{" "} + {facility.bed_count}{" "} + {" "} +
+ + Notify: {facility.name} + + } + onClose={() => setNotifyModalFor(undefined)} + > +
{ + event.preventDefault(); + handleNotifySubmit(notifyModalFor); + }} + className="flex w-full flex-col bg-white text-center" > - { - event.preventDefault(); - handleNotifySubmit(notifyModalFor); - }} - className="flex w-full flex-col bg-white text-center" - > - setNotifyMessage(e.value)} - placeholder="Type your message..." - error={notifyError} + setNotifyMessage(e.value)} + placeholder="Type your message..." + error={notifyError} + /> +
+ setNotifyModalFor(undefined)} /> -
- setNotifyModalFor(undefined)} - /> - -
- - -
-
- {userType !== "Staff" ? ( - setNotifyModalFor(facility.id)} - > - - Notify - - ) : ( - <> - )} + +
+ +
+
+
+ {userType !== "Staff" ? ( - - - {t("view_faciliy")} - - - setNotifyModalFor(facility.id)} > - - {t("view_patients")} + + Notify -
+ ) : ( + <> + )} + + + + {t("view_faciliy")} + + + + + {t("view_patients")} + + {/*
*/}
From 3eade8768c7b8ff7577bd75add10d575ceb44382 Mon Sep 17 00:00:00 2001 From: Suprabath <34211797+suprabathk@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:11:15 +0530 Subject: [PATCH 12/32] Disable out of constraint dates in DateInputV2 (#6379) * Fixed date buttons out of range * Added translations * Fixed cursor * Update DateInputV2.tsx * Add max value * disable future for last service date --------- Co-authored-by: Ashesh <3626859+Ashesh3@users.noreply.github.com> --- .../Assets/AssetServiceEditModal.tsx | 1 + src/Components/Common/DateInputV2.tsx | 82 ++++++++++++------- src/Components/Facility/AssetCreate.tsx | 1 + src/Locale/en/Common.json | 6 +- 4 files changed, 59 insertions(+), 31 deletions(-) diff --git a/src/Components/Assets/AssetServiceEditModal.tsx b/src/Components/Assets/AssetServiceEditModal.tsx index 3964dfe0770..13a91e36477 100644 --- a/src/Components/Assets/AssetServiceEditModal.tsx +++ b/src/Components/Assets/AssetServiceEditModal.tsx @@ -192,6 +192,7 @@ export const AssetServiceEditModal = (props: { className="mt-2" position="LEFT" value={new Date(form.serviced_on)} + max={new Date(props.service_record.created_date)} onChange={(date) => { if ( dayjs(date.value).format("YYYY-MM-DD") > diff --git a/src/Components/Common/DateInputV2.tsx b/src/Components/Common/DateInputV2.tsx index 95652e68638..da974fbe0e9 100644 --- a/src/Components/Common/DateInputV2.tsx +++ b/src/Components/Common/DateInputV2.tsx @@ -4,6 +4,8 @@ import CareIcon from "../../CAREUI/icons/CareIcon"; import { Popover } from "@headlessui/react"; import { classNames } from "../../Utils/utils"; import dayjs from "../../Utils/dayjs"; +import * as Notification from "../../Utils/Notifications.js"; +import { t } from "i18next"; type DatePickerType = "date" | "month" | "year"; export type DatePickerPosition = "LEFT" | "RIGHT" | "CENTER"; @@ -16,6 +18,7 @@ interface Props { value: Date | undefined; min?: Date; max?: Date; + outOfLimitsErrorMessage?: string; onChange: (date: Date) => void; position?: DatePickerPosition; disabled?: boolean; @@ -34,6 +37,7 @@ const DateInputV2: React.FC = ({ value, min, max, + outOfLimitsErrorMessage, onChange, position, disabled, @@ -100,16 +104,21 @@ const DateInputV2: React.FC = ({ ) => void; const setDateValue = (date: number, close: CloseFunction) => () => { - isDateWithinConstraints(date) && - onChange( - new Date( - datePickerHeaderDate.getFullYear(), - datePickerHeaderDate.getMonth(), - date - ) - ); - close(); - setIsOpen?.(false); + isDateWithinConstraints(date) + ? (() => { + onChange( + new Date( + datePickerHeaderDate.getFullYear(), + datePickerHeaderDate.getMonth(), + date + ) + ); + close(); + setIsOpen?.(false); + })() + : Notification.Error({ + msg: outOfLimitsErrorMessage ?? "Cannot select date out of range", + }); }; const getDayCount = (date: Date) => { @@ -220,7 +229,7 @@ const DateInputV2: React.FC = ({ readOnly disabled={disabled} className={`cui-input-base cursor-pointer disabled:cursor-not-allowed ${className}`} - placeholder={placeholder ?? "Select date"} + placeholder={placeholder ?? t("select_date")} value={value && dayjs(value).format("DD/MM/YYYY")} />
@@ -248,7 +257,7 @@ const DateInputV2: React.FC = ({ [dd, mm, yyyy].filter(Boolean).join("/") ) || "" } // Display the value in DD/MM/YYYY format - placeholder="DD/MM/YYYY" + placeholder={t("DD/MM/YYYY")} onChange={(e) => { setDisplayValue(e.target.value.replaceAll("/", "")); const value = dayjs(e.target.value, "DD/MM/YYYY", true); @@ -330,26 +339,41 @@ const DateInputV2: React.FC = ({ className="aspect-square w-[14.26%] border border-transparent p-1 text-center text-sm" /> ))} - {dayCount.map((d, i) => ( -
+ {dayCount.map((d, i) => { + const withinConstraints = isDateWithinConstraints(d); + const selected = value && isSelectedDate(d); + + const baseClasses = + "flex h-full items-center justify-center rounded text-center text-sm leading-loose transition duration-100 ease-in-out"; + let conditionalClasses = ""; + + if (withinConstraints) { + if (selected) { + conditionalClasses = + "bg-primary-500 font-bold text-white"; + } else { + conditionalClasses = + "hover:bg-gray-300 cursor-pointer"; + } + } else { + conditionalClasses = + "!cursor-not-allowed !text-gray-400"; + } + return (
- {d} +
+ {d} +
-
- ))} + ); + })}
)} diff --git a/src/Components/Facility/AssetCreate.tsx b/src/Components/Facility/AssetCreate.tsx index 84fc09188d0..a1e06a8c7ab 100644 --- a/src/Components/Facility/AssetCreate.tsx +++ b/src/Components/Facility/AssetCreate.tsx @@ -883,6 +883,7 @@ const AssetCreate = (props: AssetProps) => { name="last_serviced_on" className="mt-2" position="RIGHT" + disableFuture value={last_serviced_on && new Date(last_serviced_on)} onChange={(date) => { if ( diff --git a/src/Locale/en/Common.json b/src/Locale/en/Common.json index 0fe1ba1a8bf..7e357bc04b5 100644 --- a/src/Locale/en/Common.json +++ b/src/Locale/en/Common.json @@ -155,5 +155,7 @@ "all_changes_have_been_saved": "All changes have been saved", "no_data_found": "No data found", "edit": "Edit", - "clear_selection": "Clear selection" -} \ No newline at end of file + "clear_selection": "Clear selection", + "select_date": "Select date", + "DD/MM/YYYY": "DD/MM/YYYY" +} From 0787ed74a09bfdf2006425a627fddf2ed84d49d9 Mon Sep 17 00:00:00 2001 From: Kshitij Verma <101321276+kshitijv256@users.noreply.github.com> Date: Wed, 22 Nov 2023 09:05:02 +0530 Subject: [PATCH 13/32] fixed image upload modal (#6666) --- .../Facility/CoverImageEditModal.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Components/Facility/CoverImageEditModal.tsx b/src/Components/Facility/CoverImageEditModal.tsx index 988bc288f58..a1394c6441f 100644 --- a/src/Components/Facility/CoverImageEditModal.tsx +++ b/src/Components/Facility/CoverImageEditModal.tsx @@ -301,11 +301,10 @@ const CoverImageEditModal = ({ ) : (
-
+
{t("capture_cover_photo")} - {facility.name}
{!previewImage ? ( @@ -326,10 +325,13 @@ const CoverImageEditModal = ({ )}
{/* buttons for mobile screens */} -
+
{!previewImage ? ( - + {t("switch")} ) : ( @@ -344,7 +346,7 @@ const CoverImageEditModal = ({ onClick={() => { captureImage(); }} - className="m-2" + className="my-2 w-full" > {t("capture")} @@ -352,17 +354,17 @@ const CoverImageEditModal = ({ ) : ( <> -
+
{ setPreviewImage(null); }} - className="m-2" + className="my-2 w-full" disabled={isUploading} > {t("retake")} - + {isCaptureImgBeingUploaded && ( )} @@ -380,7 +382,7 @@ const CoverImageEditModal = ({ setIsCameraOpen(false); webRef.current.stopCamera(); }} - className="m-2" + className="border-grey-200 my-2 w-full border-2" > {t("close")} From d81b698a987d5ffea9aa1cd706d39ea971531817 Mon Sep 17 00:00:00 2001 From: Ayush Seth Date: Wed, 22 Nov 2023 09:05:45 +0530 Subject: [PATCH 14/32] show delete user button only for stateAdmin (#6663) --- src/Components/Facility/FacilityUsers.tsx | 48 +++++++---------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/src/Components/Facility/FacilityUsers.tsx b/src/Components/Facility/FacilityUsers.tsx index caff279ad7e..6963c4006db 100644 --- a/src/Components/Facility/FacilityUsers.tsx +++ b/src/Components/Facility/FacilityUsers.tsx @@ -1,28 +1,28 @@ import { lazy, useCallback, useEffect, useState } from "react"; import { useDispatch } from "react-redux"; +import CountBlock from "../../CAREUI/display/Count"; +import CareIcon from "../../CAREUI/icons/CareIcon"; +import { RESULTS_PER_PAGE_LIMIT } from "../../Common/constants"; +import useAuthUser from "../../Common/hooks/useAuthUser"; import { statusType, useAbortableEffect } from "../../Common/utils"; import { addUserFacility, - deleteUserFacility, - getUserListFacility, deleteUser, - getFacilityUsers, + deleteUserFacility, getAnyFacility, + getFacilityUsers, + getUserListFacility, } from "../../Redux/actions"; -import Pagination from "../Common/Pagination"; -import { USER_TYPES, RESULTS_PER_PAGE_LIMIT } from "../../Common/constants"; -import { FacilityModel } from "../Facility/models"; -import LinkFacilityDialog from "../Users/LinkFacilityDialog"; -import UserDeleteDialog from "../Users/UserDeleteDialog"; import * as Notification from "../../Utils/Notifications.js"; -import UserDetails from "../Common/UserDetails"; -import UnlinkFacilityDialog from "../Users/UnlinkFacilityDialog"; import { classNames, isUserOnline, relativeTime } from "../../Utils/utils"; -import CountBlock from "../../CAREUI/display/Count"; -import CareIcon from "../../CAREUI/icons/CareIcon"; +import Pagination from "../Common/Pagination"; +import UserDetails from "../Common/UserDetails"; import ButtonV2 from "../Common/components/ButtonV2"; import Page from "../Common/components/Page"; -import useAuthUser from "../../Common/hooks/useAuthUser"; +import { FacilityModel } from "../Facility/models"; +import LinkFacilityDialog from "../Users/LinkFacilityDialog"; +import UnlinkFacilityDialog from "../Users/UnlinkFacilityDialog"; +import UserDeleteDialog from "../Users/UserDeleteDialog"; const Loading = lazy(() => import("../Common/Loading")); @@ -273,26 +273,6 @@ export default function FacilityUsers(props: any) { loadFacilities(username); }; - const showDelete = (user: any) => { - const STATE_ADMIN_LEVEL = USER_TYPES.indexOf("StateAdmin"); - const STATE_READ_ONLY_ADMIN_LEVEL = - USER_TYPES.indexOf("StateReadOnlyAdmin"); - const DISTRICT_ADMIN_LEVEL = USER_TYPES.indexOf("DistrictAdmin"); - const level = USER_TYPES.indexOf(user.user_type); - const currentUserLevel = USER_TYPES.indexOf(authUser.user_type); - if (user.is_superuser) return true; - - if (currentUserLevel >= STATE_ADMIN_LEVEL) - return user.state_object?.id === authUser.state; - if ( - currentUserLevel < STATE_READ_ONLY_ADMIN_LEVEL && - currentUserLevel >= DISTRICT_ADMIN_LEVEL && - currentUserLevel > level - ) - return facilityData?.district_object_id === authUser.district; - return false; - }; - let userList: any[] = []; users && @@ -340,7 +320,7 @@ export default function FacilityUsers(props: any) { aria-label="Online" > ) : null} - {showDelete(user) && ( + {authUser.user_type === "StateAdmin" && (