From 05d91ad2731578779e969d3f74bec529c73be0f3 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Wed, 22 Jan 2025 11:30:47 +0530 Subject: [PATCH 1/6] add count with heading --- public/locale/en.json | 6 ++++-- src/components/Facility/FacilityUsers.tsx | 5 ++++- src/pages/Organization/OrganizationFacilities.tsx | 13 ++++++++++++- src/pages/Organization/OrganizationPatients.tsx | 14 +++++++++++++- src/pages/Organization/OrganizationUsers.tsx | 14 +++++++++++++- src/pages/Organization/OrganizationView.tsx | 13 ++++++++++++- 6 files changed, 58 insertions(+), 7 deletions(-) diff --git a/public/locale/en.json b/public/locale/en.json index e7ab17781fc..8d6ffa95847 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -981,6 +981,8 @@ "entered-in-error": "Entered in error", "entered_in_error": "Entered in Error", "entered_in_error_warning": "This action cannot be undone. The appointment will be marked as entered in error and removed from the system.", + "entity_count_one": "{{count}} {{entity}}", + "entity_count_other": "{{count}} {{entity}}s", "error_404": "Error 404", "error_deleting_shifting": "Error while deleting Shifting record", "error_fetching_facility_data": "Error while fetching facility data", @@ -1014,6 +1016,8 @@ "facility": "Facility", "facility_added_successfully": "Facility created successfully", "facility_consent_requests_page_title": "Patient Consent List", + "facility_count_one": "{{count}} Facility", + "facility_count_other": "{{count}} Facilities ", "facility_district_name": "Facility/District Name", "facility_district_pincode": "Facility/District/Pincode", "facility_for_care_support": "Facility for Care Support", @@ -2166,8 +2170,6 @@ "use_phone_number_for_emergency": "Use this phone number for emergency contact", "user_add_error": "Error while adding User", "user_added_successfully": "User added successfully", - "user_count_one": "{{count}} user", - "user_count_other": "{{count}} users", "user_delete_error": "Error while deleting User", "user_deleted_successfully": "User Deleted Successfully", "user_deleted_successfuly": "User Deleted Successfully", diff --git a/src/components/Facility/FacilityUsers.tsx b/src/components/Facility/FacilityUsers.tsx index 696e1d06b9b..5296ea4e29b 100644 --- a/src/components/Facility/FacilityUsers.tsx +++ b/src/components/Facility/FacilityUsers.tsx @@ -162,7 +162,10 @@ export default function FacilityUsers(props: { facilityId: string }) { className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3" variant="outline" > - {t("user_count", { count: userListData?.count ?? 0 })} + {t("entity_count", { + count: userListData?.count || 0, + entity: "User", + })} } > diff --git a/src/pages/Organization/OrganizationFacilities.tsx b/src/pages/Organization/OrganizationFacilities.tsx index bfc2389a1d6..2dbec2da6ce 100644 --- a/src/pages/Organization/OrganizationFacilities.tsx +++ b/src/pages/Organization/OrganizationFacilities.tsx @@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next"; import CareIcon from "@/CAREUI/icons/CareIcon"; +import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; @@ -57,7 +58,17 @@ export default function OrganizationFacilities({
-

{t("facilities")}

+
+

{t("facilities")}

+ + {t("facility_count", { + count: facilities?.count || 0, + })} + +
diff --git a/src/pages/Organization/OrganizationPatients.tsx b/src/pages/Organization/OrganizationPatients.tsx index 1148ef144f5..300d4aa0363 100644 --- a/src/pages/Organization/OrganizationPatients.tsx +++ b/src/pages/Organization/OrganizationPatients.tsx @@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next"; import RecordMeta from "@/CAREUI/display/RecordMeta"; import CareIcon from "@/CAREUI/icons/CareIcon"; +import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; @@ -96,7 +97,18 @@ export default function OrganizationPatients({ id, navOrganizationId }: Props) { >
-

{t("patients")}

+
+

{t("patients")}

+ + {t("entity_count", { + count: patients?.count || 0, + entity: "Patient", + })} + +
-

{t("users")}

+
+

{t("organizations")}

+ + {t("entity_count", { + count: users?.count || 0, + entity: "User", + })} + +
-

{t("organizations")}

+
+

{t("organizations")}

+ + {t("entity_count", { + count: children?.results.length || 0, + entity: "Organization", + })} + +
Date: Wed, 22 Jan 2025 11:57:53 +0530 Subject: [PATCH 2/6] nitpick sugg --- src/pages/Organization/OrganizationView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Organization/OrganizationView.tsx b/src/pages/Organization/OrganizationView.tsx index c5186582d3c..f42279386fc 100644 --- a/src/pages/Organization/OrganizationView.tsx +++ b/src/pages/Organization/OrganizationView.tsx @@ -58,7 +58,7 @@ export default function OrganizationView({ id, navOrganizationId }: Props) { variant="outline" > {t("entity_count", { - count: children?.results.length || 0, + count: children?.count || 0, entity: "Organization", })} From 3996c56b3731fca4876d09b87b937a53d783980c Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Wed, 22 Jan 2025 12:40:04 +0530 Subject: [PATCH 3/6] typo error --- src/pages/Organization/OrganizationUsers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Organization/OrganizationUsers.tsx b/src/pages/Organization/OrganizationUsers.tsx index ae68654a0b2..272e38c2eb4 100644 --- a/src/pages/Organization/OrganizationUsers.tsx +++ b/src/pages/Organization/OrganizationUsers.tsx @@ -58,7 +58,7 @@ export default function OrganizationUsers({ id, navOrganizationId }: Props) {
-

{t("organizations")}

+

{t("users")}

Date: Wed, 22 Jan 2025 12:50:50 +0530 Subject: [PATCH 4/6] Empty-Commit From 5a3feb05ad46b8e8ee1bdbf6d8f3f335aa18f068 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Wed, 22 Jan 2025 17:38:47 +0530 Subject: [PATCH 5/6] replace 0 with ... --- src/components/Facility/FacilityUsers.tsx | 2 +- src/pages/Organization/OrganizationFacilities.tsx | 2 +- src/pages/Organization/OrganizationPatients.tsx | 2 +- src/pages/Organization/OrganizationUsers.tsx | 2 +- src/pages/Organization/OrganizationView.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Facility/FacilityUsers.tsx b/src/components/Facility/FacilityUsers.tsx index ceb15d6bfef..17201bbdcd7 100644 --- a/src/components/Facility/FacilityUsers.tsx +++ b/src/components/Facility/FacilityUsers.tsx @@ -74,7 +74,7 @@ export default function FacilityUsers(props: { facilityId: string }) { variant="outline" > {t("entity_count", { - count: userListData?.count || 0, + count: userListData?.count || "...", entity: "User", })} diff --git a/src/pages/Organization/OrganizationFacilities.tsx b/src/pages/Organization/OrganizationFacilities.tsx index cf913cd796b..e2be10f987f 100644 --- a/src/pages/Organization/OrganizationFacilities.tsx +++ b/src/pages/Organization/OrganizationFacilities.tsx @@ -66,7 +66,7 @@ export default function OrganizationFacilities({ variant="outline" > {t("facility_count", { - count: facilities?.count || 0, + count: facilities?.count || "...", })}
diff --git a/src/pages/Organization/OrganizationPatients.tsx b/src/pages/Organization/OrganizationPatients.tsx index 50f814e20fd..d7dad97f2fa 100644 --- a/src/pages/Organization/OrganizationPatients.tsx +++ b/src/pages/Organization/OrganizationPatients.tsx @@ -105,7 +105,7 @@ export default function OrganizationPatients({ id, navOrganizationId }: Props) { variant="outline" > {t("entity_count", { - count: patients?.count || 0, + count: patients?.count || "...", entity: "Patient", })} diff --git a/src/pages/Organization/OrganizationUsers.tsx b/src/pages/Organization/OrganizationUsers.tsx index 7b9dcb3d276..603881dd5a5 100644 --- a/src/pages/Organization/OrganizationUsers.tsx +++ b/src/pages/Organization/OrganizationUsers.tsx @@ -65,7 +65,7 @@ export default function OrganizationUsers({ id, navOrganizationId }: Props) { variant="outline" > {t("entity_count", { - count: users?.count || 0, + count: users?.count || "...", entity: "User", })} diff --git a/src/pages/Organization/OrganizationView.tsx b/src/pages/Organization/OrganizationView.tsx index 2bb8c31b698..03ad65a812f 100644 --- a/src/pages/Organization/OrganizationView.tsx +++ b/src/pages/Organization/OrganizationView.tsx @@ -59,7 +59,7 @@ export default function OrganizationView({ id, navOrganizationId }: Props) { variant="outline" > {t("entity_count", { - count: children?.count || 0, + count: children?.count || "...", entity: "Organization", })} From f9c9ae22d97a847952b630676a738d3c406d9231 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Wed, 22 Jan 2025 19:35:28 +0530 Subject: [PATCH 6/6] add loading.. --- src/components/Facility/FacilityUsers.tsx | 10 ++++++---- src/pages/Organization/OrganizationFacilities.tsx | 8 +++++--- src/pages/Organization/OrganizationPatients.tsx | 10 ++++++---- src/pages/Organization/OrganizationUsers.tsx | 10 ++++++---- src/pages/Organization/OrganizationView.tsx | 10 ++++++---- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/components/Facility/FacilityUsers.tsx b/src/components/Facility/FacilityUsers.tsx index 17201bbdcd7..f163adedbe6 100644 --- a/src/components/Facility/FacilityUsers.tsx +++ b/src/components/Facility/FacilityUsers.tsx @@ -73,10 +73,12 @@ export default function FacilityUsers(props: { facilityId: string }) { className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3" variant="outline" > - {t("entity_count", { - count: userListData?.count || "...", - entity: "User", - })} + {userListData + ? t("entity_count", { + count: userListData?.count || 0, + entity: "User", + }) + : "Loading..."} } > diff --git a/src/pages/Organization/OrganizationFacilities.tsx b/src/pages/Organization/OrganizationFacilities.tsx index e2be10f987f..ebcd5a88d17 100644 --- a/src/pages/Organization/OrganizationFacilities.tsx +++ b/src/pages/Organization/OrganizationFacilities.tsx @@ -65,9 +65,11 @@ export default function OrganizationFacilities({ className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3" variant="outline" > - {t("facility_count", { - count: facilities?.count || "...", - })} + {facilities + ? t("facility_count", { + count: facilities.count, + }) + : "Loading..."}
diff --git a/src/pages/Organization/OrganizationPatients.tsx b/src/pages/Organization/OrganizationPatients.tsx index d7dad97f2fa..60e2d6079ee 100644 --- a/src/pages/Organization/OrganizationPatients.tsx +++ b/src/pages/Organization/OrganizationPatients.tsx @@ -104,10 +104,12 @@ export default function OrganizationPatients({ id, navOrganizationId }: Props) { className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3" variant="outline" > - {t("entity_count", { - count: patients?.count || "...", - entity: "Patient", - })} + {patients + ? t("entity_count", { + count: patients.count, + entity: "Patient", + }) + : "Loading..."}
diff --git a/src/pages/Organization/OrganizationUsers.tsx b/src/pages/Organization/OrganizationUsers.tsx index 603881dd5a5..f8f52c2f44c 100644 --- a/src/pages/Organization/OrganizationUsers.tsx +++ b/src/pages/Organization/OrganizationUsers.tsx @@ -64,10 +64,12 @@ export default function OrganizationUsers({ id, navOrganizationId }: Props) { className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3" variant="outline" > - {t("entity_count", { - count: users?.count || "...", - entity: "User", - })} + {users + ? t("entity_count", { + count: users.count || 0, + entity: "User", + }) + : "Loading..."}
diff --git a/src/pages/Organization/OrganizationView.tsx b/src/pages/Organization/OrganizationView.tsx index 03ad65a812f..da67442bc1a 100644 --- a/src/pages/Organization/OrganizationView.tsx +++ b/src/pages/Organization/OrganizationView.tsx @@ -58,10 +58,12 @@ export default function OrganizationView({ id, navOrganizationId }: Props) { className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3" variant="outline" > - {t("entity_count", { - count: children?.count || "...", - entity: "Organization", - })} + {children + ? t("entity_count", { + count: children.count || 0, + entity: "Organization", + }) + : "Loading..."}