Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed WhatsApp message: doctor connect #7715

Merged
merged 7 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
14 changes: 13 additions & 1 deletion src/Components/Facility/DoctorVideoSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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}`;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Users/models.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
Loading