diff --git a/cypress/pageobject/Facility/FacilityHome.ts b/cypress/pageobject/Facility/FacilityHome.ts index e021171ff0..dea7de0e7b 100644 --- a/cypress/pageobject/Facility/FacilityHome.ts +++ b/cypress/pageobject/Facility/FacilityHome.ts @@ -72,7 +72,7 @@ class FacilityHome { } verifyOccupancyBadgeVisibility() { - cy.get("#occupany-badge").should("be.visible"); + cy.get('[data-test-id="occupancy-badge"]').should("be.visible"); } verifyAndCloseNotifyModal() { diff --git a/src/CAREUI/display/Count.tsx b/src/CAREUI/display/Count.tsx index 997b58794e..6b28ca4f96 100644 --- a/src/CAREUI/display/Count.tsx +++ b/src/CAREUI/display/Count.tsx @@ -11,15 +11,13 @@ interface Props { export default function CountBlock(props: Props) { return ( -
-
-
+
+
+
-
+
{props.text}
{props.loading ? ( diff --git a/src/Components/Common/Avatar.tsx b/src/Components/Common/Avatar.tsx index a519901216..e4d42dd72a 100644 --- a/src/Components/Common/Avatar.tsx +++ b/src/Components/Common/Avatar.tsx @@ -1,4 +1,5 @@ -import React from "react"; +import { cn } from "@/lib/utils"; +import React, { useEffect, useRef, useState } from "react"; const colors: string[] = [ "#E6F3FF", // Light Blue @@ -44,43 +45,54 @@ const initials = (name: string): string => { interface AvatarProps { colors?: [string, string]; name: string; + imageUrl?: string; className?: string; - square?: boolean; // New prop to determine if the avatar should be square } const Avatar: React.FC = ({ colors: propColors, name, + imageUrl, className, - square = false, // Default to false for backwards compatibility }) => { - const [bgColor, fgColor] = propColors || toColor(name); + const [bgColor] = propColors || toColor(name); + const [width, setWidth] = useState(0); + const avatarRef = useRef(null); + + useEffect(() => { + const updateWidth = () => { + const avatarRect = avatarRef.current?.getBoundingClientRect(); + const width = avatarRect?.width || 0; + setWidth(width); + }; + updateWidth(); + document.addEventListener("resize", updateWidth); + return () => document.removeEventListener("resize", updateWidth); + }, []); return ( - - {square ? ( - + {imageUrl ? ( + {name} ) : ( - +
{initials(name)}
)} - - {initials(name)} - - +
); }; diff --git a/src/Components/Common/Sidebar/SidebarUserCard.tsx b/src/Components/Common/Sidebar/SidebarUserCard.tsx index 825507ffb2..9effc947dd 100644 --- a/src/Components/Common/Sidebar/SidebarUserCard.tsx +++ b/src/Components/Common/Sidebar/SidebarUserCard.tsx @@ -40,7 +40,7 @@ const SidebarUserCard: React.FC = ({ shrinked }) => {
diff --git a/src/Components/Facility/FacilityBlock.tsx b/src/Components/Facility/FacilityBlock.tsx index 3232321637..0ad87b050c 100644 --- a/src/Components/Facility/FacilityBlock.tsx +++ b/src/Components/Facility/FacilityBlock.tsx @@ -24,15 +24,11 @@ export default function FacilityBlock(props: { return ( -
- {facility.read_cover_image_url ? ( - - ) : ( - - )} +
+
{facility.name} diff --git a/src/Components/Facility/FacilityCard.tsx b/src/Components/Facility/FacilityCard.tsx index 69b5b9d421..e874a0f85c 100644 --- a/src/Components/Facility/FacilityCard.tsx +++ b/src/Components/Facility/FacilityCard.tsx @@ -9,7 +9,6 @@ import CareIcon from "../../CAREUI/icons/CareIcon"; import { formatPhoneNumber, parsePhoneNumber } from "../../Utils/utils"; import DialogModal from "../Common/Dialog"; import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; -import { classNames } from "../../Utils/utils"; import request from "../../Utils/request/request"; import routes from "../../Redux/api"; import careConfig from "@careConfig"; @@ -52,20 +51,18 @@ export const FacilityCard = (props: { return (
-
+
- {(facility.read_cover_image_url && ( - {facility.name} - )) || } +
@@ -73,21 +70,12 @@ export const FacilityCard = (props: {
- {(facility.read_cover_image_url && ( - {facility.name} - )) || ( - - )} +
{facility.kasp_empanelled && ( @@ -99,12 +87,27 @@ export const FacilityCard = (props: { className="flex flex-wrap items-center justify-between" id="facility-name-card" > - - {facility.name} - +
+ + {facility.name} + +
0.85 ? "justify-center rounded-md border border-red-600 bg-red-500 p-1 font-bold text-white" : "text-secondary-700"}`} + > + + {t("live_patients_total_beds")} + {" "} + +
+ {t("occupancy")}: {facility.patient_count} /{" "} + {facility.bed_count}{" "} +
+
+
- View CNS + {t("view_cns")}
+
-
+
{/*
*/}
-
- 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 - ? "text-white" - : "text-secondary-700" - }`} - > - Occupancy: {facility.patient_count} /{" "} - {facility.bed_count}{" "} -
{" "} -
{
); - const CoverImage = () => ( - {facilityData?.name} - ); - return ( { onDelete={() => facilityFetch()} facility={facilityData ?? ({} as FacilityModel)} /> - {hasCoverImage ? ( -
- - {editCoverImageTooltip} -
- ) : ( -
- hasPermissionToEditCoverImage && setEditCoverImage(true) - } - > - - {editCoverImageTooltip} -
- )} + +
hasPermissionToEditCoverImage && setEditCoverImage(true)} + > + + {editCoverImageTooltip} +
{ hasPermissionToEditCoverImage && setEditCoverImage(true) } > - {hasCoverImage ? ( - - ) : ( -
- -
- )} +
+ +
+ {editCoverImageTooltip}
diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index 5259909beb..7d49ffdaad 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -494,7 +494,7 @@ export const PatientManager = () => { const children = (
{ ) : (
)} diff --git a/src/Locale/en.json b/src/Locale/en.json index a7c2d1a0c2..d4808fa185 100644 --- a/src/Locale/en.json +++ b/src/Locale/en.json @@ -642,6 +642,7 @@ "litres_per_day": "Litres/day", "live": "Live", "live_monitoring": "Live Monitoring", + "live_patients_total_beds": "Live Patients / Total beds", "load_more": "Load More", "loading": "Loading...", "local_body": "Local body", @@ -732,6 +733,7 @@ "nursing_care": "Nursing Care", "nursing_information": "Nursing Information", "nutrition": "Nutrition", + "occupancy": "Occupancy", "occupation": "Occupation", "on": "On", "ongoing_medications": "Ongoing Medications", @@ -1036,6 +1038,7 @@ "view": "View", "view_abdm_records": "View ABDM Records", "view_asset": "View Assets", + "view_cns": "View CNS", "view_details": "View Details", "view_faciliy": "View Facility", "view_patients": "View Patients",