Skip to content

Commit

Permalink
Edit User Details (#10027)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobjeevan authored Jan 22, 2025
1 parent 6a26ae0 commit 9f2d856
Show file tree
Hide file tree
Showing 12 changed files with 515 additions and 309 deletions.
7 changes: 3 additions & 4 deletions cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { UserCreation } from "../../pageObject/Users/UserCreation";
import { FacilityCreation } from "../../pageObject/facility/FacilityCreation";
import { UserCreation } from "pageObject/Users/UserCreation";
import { FacilityCreation } from "pageObject/facility/FacilityCreation";
import {
generateName,
generatePhoneNumber,
generateUsername,
} from "../../utils/commonUtils";
} from "utils/commonUtils";

describe("User Creation", () => {
const facilityCreation = new FacilityCreation();
Expand All @@ -30,7 +30,6 @@ describe("User Creation", () => {
confirmPassword: defaultPassword,
email: `${generateUsername(firstName)}@test.com`,
phoneNumber: generatePhoneNumber(),
dateOfBirth: "1990-01-01",
userType: "Doctor",
state: "Kerala",
district: "Ernakulam",
Expand Down
8 changes: 0 additions & 8 deletions cypress/pageObject/Users/UserCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface UserData {
password?: string;
email?: string;
phoneNumber?: string;
dateOfBirth?: string;
userType?: string;
state?: string;
district?: string;
Expand Down Expand Up @@ -78,17 +77,11 @@ export class UserCreation {
label: "Alternate Phone Number",
message: "Phone number must start with +91 followed by 10 digits",
},
{ label: "Date of Birth", message: "Required" },
{ label: "State", message: "Required" },
]);
return this;
}

fillDateOfBirth(dateOfBirth: string) {
cy.typeIntoField('[data-cy="dob-input"]', dateOfBirth);
return this;
}

selectUserType(userType: string) {
cy.clickAndSelectOption('[data-cy="user-type-select"]', userType);
return this;
Expand Down Expand Up @@ -125,7 +118,6 @@ export class UserCreation {
}
if (userData.email) this.fillEmail(userData.email);
if (userData.phoneNumber) this.fillPhoneNumber(userData.phoneNumber);
if (userData.dateOfBirth) this.fillDateOfBirth(userData.dateOfBirth);
if (userData.state) this.selectState(userData.state);
if (userData.district) this.selectDistrict(userData.district);
if (userData.localBody) this.selectLocalBody(userData.localBody);
Expand Down
5 changes: 5 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
"add_skill": "Add Skill",
"add_spoke": "Add Spoke Facility",
"add_tags": "Add Tags",
"add_user": "Add User",
"additional_information": "Additional Information",
"additional_instructions": "Additional Instructions",
"address": "Address",
Expand Down Expand Up @@ -702,6 +703,7 @@
"create_tag": "Create Tag",
"create_template": "Create Template",
"create_user": "Create User",
"create_user_and_add_to_org": "Create a new user and add them to the organization.",
"created": "Created",
"created_by": "Created By",
"created_date": "Created Date",
Expand Down Expand Up @@ -831,6 +833,7 @@
"edit_profile": "Edit Profile",
"edit_role": "Edit Role",
"edit_schedule_template": "Edit Schedule Template",
"edit_user": "Edit User",
"edit_user_profile": "Edit Profile",
"edit_user_role": "Edit User Role",
"edited_by": "Edited by",
Expand Down Expand Up @@ -2140,6 +2143,7 @@
"update_shift_request": "Update Shift Request",
"update_status": "Update Status",
"update_status_details": "Update Status/Details",
"update_user": "Update User",
"update_user_role_organization": "Update the role for this user in the organization",
"update_volunteer": "Reassign Volunteer",
"updated": "Updated",
Expand Down Expand Up @@ -2177,6 +2181,7 @@
"user_removed_success": "User removed from organization successfully",
"user_role_update_success": "User role updated successfully",
"user_type": "User Type",
"user_updated_successfully": "User updated successfully",
"username": "Username",
"username_already_exists": "This username already exists",
"username_available": "Username is available",
Expand Down
4 changes: 4 additions & 0 deletions src/common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export const GENDER_TYPES = [
{ id: "non_binary", text: "Non Binary", icon: "TRANS" },
] as const;

export const GENDERS = GENDER_TYPES.map((gender) => gender.id) as [
(typeof GENDER_TYPES)[number]["id"],
];

export const CONSULTATION_SUGGESTION = [
{ id: "HI", text: "Home Isolation", deprecated: true }, // # Deprecated. Preserving option for backward compatibility (use only for readonly operations)
{ id: "A", text: "Admission" },
Expand Down
5 changes: 1 addition & 4 deletions src/components/Patient/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
GENDER_TYPES, // OCCUPATION_TYPES,
//RATION_CARD_CATEGORY, // SOCIOECONOMIC_STATUS_CHOICES ,
} from "@/common/constants";
import { GENDERS } from "@/common/constants";
import countryList from "@/common/static/countries.json";

import { PLUGIN_Component } from "@/PluginEngine";
Expand All @@ -63,10 +64,6 @@ interface PatientRegistrationPageProps {
patientId?: string;
}

export const GENDERS = GENDER_TYPES.map((gender) => gender.id) as [
(typeof GENDER_TYPES)[number]["id"],
];

export const BLOOD_GROUPS = BLOOD_GROUP_CHOICES.map((bg) => bg.id) as [
(typeof BLOOD_GROUP_CHOICES)[number]["id"],
];
Expand Down
Loading

0 comments on commit 9f2d856

Please sign in to comment.