From 8d4ba311444747994585655bdfe53898f105e4b8 Mon Sep 17 00:00:00 2001 From: Anvesh Nalimela <151531961+AnveshNalimela@users.noreply.github.com> Date: Sat, 4 Jan 2025 21:06:41 +0530 Subject: [PATCH 1/5] Added no user assingned message (#9666) Co-authored-by: Rithvik Nishad --- public/locale/en.json | 9 + .../PatientDetailsTab/PatientUsers.tsx | 165 ++++++++++-------- 2 files changed, 101 insertions(+), 73 deletions(-) diff --git a/public/locale/en.json b/public/locale/en.json index 65093b6acae..1a858bb77a8 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -376,6 +376,7 @@ "are_you_still_watching": "Are you still watching?", "are_you_sure_want_to_delete": "Are you sure you want to delete {{name}}?", "are_you_sure_want_to_delete_this_record": "Are you sure want to delete this record?", + "are_you_sure_want_to_remove": "Are you sure you want to remove {{name}} from the patient? This action cannot be undone", "ari": "ARI - Acute Respiratory illness", "arrived": "Arrived", "asset_class": "Asset Class", @@ -388,7 +389,10 @@ "assign": "Assign", "assign_a_volunteer_to": "Assign a volunteer to {{name}}", "assign_bed": "Assign Bed", + "assign_to_patient": "Assign to Patient", "assign_to_volunteer": "Assign to a Volunteer", + "assign_user": "Assign User", + "assign_user_to_patient": "Assign User to Patient", "assigned_doctor": "Assigned Doctor", "assigned_facility": "Facility assigned", "assigned_to": "Assigned to", @@ -1239,6 +1243,7 @@ "no_staff": "No staff found", "no_tests_taken": "No tests taken", "no_treating_physicians_available": "This facility does not have any home facility doctors. Please contact your admin.", + "no_user_assigned": "No User Assigned to this patient", "no_users_found": "No Users Found", "no_vitals_present": "No Vitals Monitor present in this location or facility", "none": "None", @@ -1482,6 +1487,7 @@ "rejected": "Rejected", "reload": "Reload", "remove": "Remove", + "remove_user": "Remove User", "rename": "Rename", "replace_home_facility": "Replace Home Facility", "replace_home_facility_confirm": "Are you sure you want to replace", @@ -1570,6 +1576,8 @@ "search_medication": "Search Medication", "search_patients": "Search Patients", "search_resource": "Search Resource", + "search_user": "Search User", + "search_user_description": "Search for a user and assign a role to add them to the patient.", "searching": "Searching...", "see_attachments": "See Attachments", "select": "Select", @@ -1588,6 +1596,7 @@ "select_policy_to_add_items": "Select a Policy to Add Items", "select_practitioner": "Select Practicioner", "select_register_patient": "Select/Register Patient", + "select_role": "Select Role", "select_seven_day_period": "Select a seven day period", "select_skills": "Select and add some skills", "select_time": "Select time", diff --git a/src/components/Patient/PatientDetailsTab/PatientUsers.tsx b/src/components/Patient/PatientDetailsTab/PatientUsers.tsx index e494b13fe9d..989b3ed0ac3 100644 --- a/src/components/Patient/PatientDetailsTab/PatientUsers.tsx +++ b/src/components/Patient/PatientDetailsTab/PatientUsers.tsx @@ -1,4 +1,5 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; +import { t } from "i18next"; import { useState } from "react"; import { toast } from "sonner"; @@ -38,6 +39,7 @@ import UserSelector from "@/components/Common/UserSelector"; import routes from "@/Utils/request/api"; import mutate from "@/Utils/request/mutate"; import query from "@/Utils/request/query"; +import { formatDisplayName } from "@/Utils/utils"; import { UserBase } from "@/types/user/user"; import { PatientProps } from "."; @@ -103,19 +105,17 @@ function AddUserSheet({ patientId }: AddUserSheetProps) { - Add User to Patient - - Search for a user and assign a role to add them to the patient. - + {t("assign_user_to_patient")} + {t("search_user_description")}
-

Search User

+

{t("search_user")}

- {selectedUser.first_name} {selectedUser.last_name} + {formatDisplayName(selectedUser)} {selectedUser.email} @@ -144,13 +144,17 @@ function AddUserSheet({ patientId }: AddUserSheetProps) {
- Username + + {t("username")} +

{selectedUser.username}

- User Type + + {t("user_type")} +

{selectedUser.user_type}

@@ -159,7 +163,9 @@ function AddUserSheet({ patientId }: AddUserSheetProps) {
- + +
+ {/* Basic Information */} +
+

Basic Information

+
+ ( + + Facility Type + + + + )} + /> + + ( + + Facility Name - - - + - - {FACILITY_TYPES.map((type) => ( - - {type.text} - - ))} - - - - - )} - /> + + + )} + /> +
( - Facility Name + Description - +