diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 07768a16cee..426ac12198f 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -354,7 +354,7 @@ export const GENDER_TYPES = [ { id: 1, text: "Male", icon: "M" }, { id: 2, text: "Female", icon: "F" }, { id: 3, text: "Transgender", icon: "TRANS" }, -]; +] as const; export const SAMPLE_TEST_RESULT = [ { id: 1, text: "POSITIVE" }, diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index d2591bf3600..a77a1017b6b 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -19,6 +19,18 @@ const UserGroups = { TELEICU: "TeleICU Doctor", }; +const courtesyTitle = (user: UserAssignedModel) => { + if (user.user_type === "Doctor") { + return "Dr." as const; + } + + return { + 1: "Mr.", + 2: "Ms.", + 3: "Hey", + }[user.gender!]; +}; + type UserGroup = keyof typeof UserGroups; type UserAnnotatedWithGroup = UserAssignedModel & { group?: UserGroup }; @@ -161,7 +173,7 @@ function UserListItem({ user }: { user: UserAnnotatedWithGroup }) { e.stopPropagation(); if (!user.alt_phone_number) return; const phoneNumber = user.alt_phone_number; - const message = `Hey ${user.first_name} ${user.last_name}, I have a query regarding a patient.\n\nPatient Link: ${window.location.href}`; + const message = `${courtesyTitle(user)} ${user.first_name} ${user.last_name}, I have a query regarding a patient.\n\nPatient Link: ${window.location.href}`; const encodedMessage = encodeURIComponent(message); const whatsappAppURL = `whatsapp://send?phone=${phoneNumber}&text=${encodedMessage}`; const whatsappWebURL = `https://web.whatsapp.com/send?phone=${phoneNumber}&text=${encodedMessage}`; diff --git a/src/Components/Users/models.tsx b/src/Components/Users/models.tsx index b0ef2b909cd..4aa315ea6f9 100644 --- a/src/Components/Users/models.tsx +++ b/src/Components/Users/models.tsx @@ -1,4 +1,4 @@ -import { UserRole } from "../../Common/constants"; +import { GENDER_TYPES, UserRole } from "../../Common/constants"; import { DistrictModel, LocalBodyModel, StateModel } from "../Facility/models"; interface HomeFacilityObjectModel { @@ -64,7 +64,7 @@ export interface UserAssignedModel extends UserBareMinimum { phone_number?: string; alt_phone_number?: string; video_connect_link: string; - gender?: number; + gender?: (typeof GENDER_TYPES)[number]["id"]; date_of_birth: Date | null; is_superuser?: boolean; verified?: boolean;