diff --git a/cypress/e2e/users_spec/UsersCreation.cy.ts b/cypress/e2e/users_spec/UsersCreation.cy.ts index e24fdeca9e2..e245dd271ac 100644 --- a/cypress/e2e/users_spec/UsersCreation.cy.ts +++ b/cypress/e2e/users_spec/UsersCreation.cy.ts @@ -149,7 +149,7 @@ describe("User Creation", () => { userCreationPage.setInputDate("date_of_birth", "date-input", "25081999"); userCreationPage.selectDropdownOption("user_type", "Doctor"); userCreationPage.typeIntoElementById("c_password", "Test@123"); - userCreationPage.typeIntoElementById("doctor_qualification", "MBBS"); + userCreationPage.typeIntoElementById("qualification", "MBBS"); userCreationPage.typeIntoElementById("doctor_experience_commenced_on", "2"); userCreationPage.typeIntoElementById( "doctor_medical_council_registration", @@ -172,7 +172,7 @@ describe("User Creation", () => { "home_facility", "Dummy Shifting Center", ); - userCreationPage.verifyElementContainsText("doctor-qualification", "MBBS"); + userCreationPage.verifyElementContainsText("qualification", "MBBS"); userCreationPage.verifyElementContainsText("doctor-experience", "2"); userCreationPage.verifyElementContainsText( "medical-council-registration", diff --git a/cypress/e2e/users_spec/UsersProfile.cy.ts b/cypress/e2e/users_spec/UsersProfile.cy.ts index 2672cccad7e..63fd71f5793 100644 --- a/cypress/e2e/users_spec/UsersProfile.cy.ts +++ b/cypress/e2e/users_spec/UsersProfile.cy.ts @@ -12,7 +12,7 @@ describe("Manage User Profile", () => { const email = "test@example.com"; const phone = "+918899887788"; const workinghours = "8"; - const doctorQualification = "MBBS"; + const qualification = "MBBS"; const doctorYoE = "10"; const medicalCouncilRegistration = "1234567890"; @@ -40,7 +40,7 @@ describe("Manage User Profile", () => { userProfilePage.typePhone(phone); userProfilePage.typeWhatsApp(phone); userProfilePage.typeWorkingHours(workinghours); - userProfilePage.typeDoctorQualification(doctorQualification); + userProfilePage.typeQualification(qualification); userProfilePage.typeDoctorYoE(doctorYoE); userProfilePage.typeMedicalCouncilRegistration(medicalCouncilRegistration); diff --git a/cypress/pageobject/Users/UserProfilePage.ts b/cypress/pageobject/Users/UserProfilePage.ts index c3de5035dc7..20fd1911c49 100644 --- a/cypress/pageobject/Users/UserProfilePage.ts +++ b/cypress/pageobject/Users/UserProfilePage.ts @@ -42,8 +42,8 @@ export default class UserProfilePage { cy.get("#weekly_working_hours").click().clear().type(workinghours); } - typeDoctorQualification = (doctorQualification: string) => { - cy.get("#doctor_qualification").click().clear().type(doctorQualification); + typeQualification = (qualification: string) => { + cy.get("#qualification").click().clear().type(qualification); }; typeDoctorYoE = (doctorYoE: string) => { diff --git a/package-lock.json b/package-lock.json index 5bb1a8b35e7..5665fe00f1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "browserslist-useragent-regexp": "^4.1.3", "cross-env": "^7.0.3", "dayjs": "^1.11.11", - "echarts": "^5.5.0", + "echarts": "^5.5.1", "echarts-for-react": "^3.0.2", "events": "^3.3.0", "hi-profiles": "^1.0.6", @@ -40,7 +40,7 @@ "react-dnd-scrolling": "^1.3.8", "react-dom": "18.3.1", "react-google-recaptcha": "^3.1.0", - "react-i18next": "^13.0.1", + "react-i18next": "^15.0.2", "react-infinite-scroll-component": "^6.1.0", "react-markdown": "^8.0.7", "react-pdf": "^9.1.0", @@ -1869,9 +1869,9 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.1.tgz", - "integrity": "sha512-+BIznRzyqBf+2wCTxcKE3wDjfGeCoVE61KSHGpkzqrLi8qxqFwBeUFyId2cxkTmm55fzDGnm0+yCxaxygrLUnQ==", + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -7273,12 +7273,12 @@ } }, "node_modules/echarts": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.5.0.tgz", - "integrity": "sha512-rNYnNCzqDAPCr4m/fqyUFv7fD9qIsd50S6GDFgO1DxZhncCsNsG7IfUlAlvZe5oSEQxtsjnHiUuppzccry93Xw==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.5.1.tgz", + "integrity": "sha512-Fce8upazaAXUVUVsjgV6mBnGuqgO+JNDlcgF79Dksy4+wgGpQB2lmYoO4TSweFg/mZITdpGHomw/cNBJZj1icA==", "dependencies": { "tslib": "2.3.0", - "zrender": "5.5.0" + "zrender": "5.6.0" } }, "node_modules/echarts-for-react": { @@ -14344,11 +14344,11 @@ } }, "node_modules/react-i18next": { - "version": "13.5.0", - "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-13.5.0.tgz", - "integrity": "sha512-CFJ5NDGJ2MUyBohEHxljOq/39NQ972rh1ajnadG9BjTk+UXbHLq4z5DKEbEQBDoIhUmmbuS/fIMJKo6VOax1HA==", + "version": "15.0.2", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.0.2.tgz", + "integrity": "sha512-z0W3/RES9Idv3MmJUcf0mDNeeMOUXe+xoL0kPfQPbDoZHmni/XsIoq5zgT2MCFUiau283GuBUK578uD/mkAbLQ==", "dependencies": { - "@babel/runtime": "^7.22.5", + "@babel/runtime": "^7.25.0", "html-parse-stringify": "^3.0.1" }, "peerDependencies": { @@ -19217,9 +19217,9 @@ } }, "node_modules/zrender": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.5.0.tgz", - "integrity": "sha512-O3MilSi/9mwoovx77m6ROZM7sXShR/O/JIanvzTwjN3FORfLSr81PsUGd7jlaYOeds9d8tw82oP44+3YucVo+w==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.6.0.tgz", + "integrity": "sha512-uzgraf4njmmHAbEUxMJ8Oxg+P3fT04O+9p7gY+wJRVxo8Ge+KmYv0WJev945EH4wFuc4OY2NLXz46FZrWS9xJg==", "dependencies": { "tslib": "2.3.0" } diff --git a/package.json b/package.json index 8eead0e45a3..e0b415a9523 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "browserslist-useragent-regexp": "^4.1.3", "cross-env": "^7.0.3", "dayjs": "^1.11.11", - "echarts": "^5.5.0", + "echarts": "^5.5.1", "echarts-for-react": "^3.0.2", "events": "^3.3.0", "hi-profiles": "^1.0.6", @@ -75,7 +75,7 @@ "react-dnd-scrolling": "^1.3.8", "react-dom": "18.3.1", "react-google-recaptcha": "^3.1.0", - "react-i18next": "^13.0.1", + "react-i18next": "^15.0.2", "react-infinite-scroll-component": "^6.1.0", "react-markdown": "^8.0.7", "react-pdf": "^9.1.0", diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx index a3cb3063577..88069ca5e29 100644 --- a/src/Components/Users/ManageUsers.tsx +++ b/src/Components/Users/ManageUsers.tsx @@ -188,7 +188,6 @@ export default function ManageUsers() { }; let userList: any[] = []; - userListData?.results && userListData.results.length && (userList = userListData.results.map((user: any, idx) => { @@ -283,15 +282,17 @@ export default function ManageUsers() { <>
- {user.doctor_qualification ? ( + {user.qualification ? ( - {user.doctor_qualification} + {user.qualification} ) : ( - Unknown + + {t("unknown")} + )}
@@ -307,7 +308,9 @@ export default function ManageUsers() { years ) : ( - Unknown + + {t("unknown")} + )} @@ -321,7 +324,9 @@ export default function ManageUsers() { {user.doctor_medical_council_registration} ) : ( - Unknown + + {t("unknown")} + )} @@ -335,11 +340,30 @@ export default function ManageUsers() { )} +
+ {user.user_type === "Nurse" && ( +
+ + {user.qualification ? ( + + {user.qualification} + + ) : ( + + {t("unknown")} + + )} + +
+ )} {user.created_by && (
diff --git a/src/Components/Users/UserAdd.tsx b/src/Components/Users/UserAdd.tsx index 9ee1e722ee1..73c7fb63c26 100644 --- a/src/Components/Users/UserAdd.tsx +++ b/src/Components/Users/UserAdd.tsx @@ -44,7 +44,6 @@ import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField"; import { useTranslation } from "react-i18next"; const Loading = lazy(() => import("../Common/Loading")); - interface UserProps { userId?: number; } @@ -72,7 +71,7 @@ type UserForm = { state: number; district: number; local_body: number; - doctor_qualification: string | undefined; + qualification: string | undefined; doctor_experience_commenced_on: string | undefined; doctor_medical_council_registration: string | undefined; }; @@ -95,7 +94,7 @@ const initForm: UserForm = { state: 0, district: 0, local_body: 0, - doctor_qualification: undefined, + qualification: undefined, doctor_experience_commenced_on: undefined, doctor_medical_council_registration: undefined, }; @@ -372,7 +371,16 @@ export const UserAdd = (props: UserProps) => { invalidForm = true; } return; - case "doctor_qualification": + case "qualification": + if ( + (state.form.user_type === "Doctor" || + state.form.user_type === "Nurse") && + !state.form[field] + ) { + errors[field] = t("field_required"); + invalidForm = true; + } + return; case "doctor_medical_council_registration": if (state.form.user_type === "Doctor" && !state.form[field]) { errors[field] = t("field_required"); @@ -553,9 +561,9 @@ export const UserAdd = (props: UserProps) => { : state.form.alt_phone_number, ) ?? "", date_of_birth: dateQueryString(state.form.date_of_birth), - doctor_qualification: - state.form.user_type === "Doctor" - ? state.form.doctor_qualification + qualification: + state.form.user_type === "Doctor" || state.form.user_type == "Nurse" + ? state.form.qualification : undefined, doctor_experience_commenced_on: state.form.user_type === "Doctor" @@ -650,15 +658,17 @@ export const UserAdd = (props: UserProps) => { optionValue={(o) => o.id} /> + {(state.form.user_type === "Doctor" || + state.form.user_type === "Nurse") && ( + + )} {state.form.user_type === "Doctor" && ( <> - - { if (!result || !result.res || !result.data) return; + const formData: EditForm = { firstName: result.data.first_name, lastName: result.data.last_name, @@ -159,7 +160,7 @@ export default function UserProfile() { phoneNumber: result.data.phone_number?.toString() || "", altPhoneNumber: result.data.alt_phone_number?.toString() || "", user_type: result.data.user_type, - doctor_qualification: result.data.doctor_qualification, + qualification: result.data.qualification, doctor_experience_commenced_on: dayjs().diff( dayjs(result.data.doctor_experience_commenced_on), "years", @@ -277,7 +278,16 @@ export default function UserProfile() { invalidForm = true; } return; - case "doctor_qualification": + case "qualification": + if ( + (states.form.user_type === "Doctor" || + states.form.user_type === "Nurse") && + !states.form[field] + ) { + errors[field] = t("field_required"); + invalidForm = true; + } + return; case "doctor_medical_council_registration": if (states.form.user_type === "Doctor" && !states.form[field]) { errors[field] = t("field_required"); @@ -344,9 +354,10 @@ export default function UserProfile() { alt_phone_number: parsePhoneNumber(states.form.altPhoneNumber) ?? "", gender: states.form.gender, date_of_birth: dateQueryString(states.form.date_of_birth), - doctor_qualification: - states.form.user_type === "Doctor" - ? states.form.doctor_qualification + qualification: + states.form.user_type === "Doctor" || + states.form.user_type === "Nurse" + ? states.form.qualification : undefined, doctor_experience_commenced_on: states.form.user_type === "Doctor" @@ -727,15 +738,18 @@ export default function UserProfile() { required type="email" /> + {(states.form.user_type === "Doctor" || + states.form.user_type === "Nurse") && ( + + )} {states.form.user_type === "Doctor" && ( <> -