diff --git a/README.md b/README.md index 002afc979bc..3b57cb1eb37 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Authenticate to staging API with any of the following credentials - username: staffdev password: Coronasafe@123 - role: Staff + role: Nurse - username: doctordev password: Coronasafe@123 diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 0b08b4b9a42..36abcb54a73 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -28,6 +28,8 @@ export type UserRole = | "Volunteer" | "StaffReadOnly" | "Staff" + | "NurseReadOnly" + | "Nurse" | "Doctor" | "WardAdmin" | "LocalBodyAdmin" @@ -47,6 +49,8 @@ export const USER_TYPE_OPTIONS: { { id: "Volunteer", role: "Volunteer", readOnly: false }, { id: "StaffReadOnly", role: "Staff", readOnly: true }, { id: "Staff", role: "Staff", readOnly: false }, + { id: "NurseReadOnly", role: "Nurse", readOnly: true }, + { id: "Nurse", role: "Nurse", readOnly: false }, { id: "Doctor", role: "Doctor", readOnly: false }, { id: "WardAdmin", role: "Ward Admin", readOnly: false }, { id: "LocalBodyAdmin", role: "Local Body Admin", readOnly: false }, @@ -410,24 +414,6 @@ export const SAMPLE_FLOW_RULES = { RECEIVED_AT_LAB: ["COMPLETED"], }; -export const ROLE_STATUS_MAP = { - Staff: ["SENT_TO_COLLECTON_CENTRE"], - DistrictAdmin: [ - "APPROVED", - "DENIED", - "SENT_TO_COLLECTON_CENTRE", - "RECEIVED_AND_FORWARED", - ], - StateLabAdmin: [ - "APPROVED", - "DENIED", - "SENT_TO_COLLECTON_CENTRE", - "RECEIVED_AND_FORWARED", - "RECEIVED_AT_LAB", - "COMPLETED", - ], -}; - export const DISEASE_STATUS = [ "POSITIVE", "SUSPECTED", diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 59c443cb64e..ec664d9cdca 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -58,8 +58,8 @@ export default function DoctorVideoSlideover(props: { home: true, }, { - title: "Staff", - user_type: "Staff", + title: "Nurse", + user_type: "Nurse", home: true, }, { diff --git a/src/Components/Users/UserAdd.tsx b/src/Components/Users/UserAdd.tsx index a6553bad01b..14b0b40999e 100644 --- a/src/Components/Users/UserAdd.tsx +++ b/src/Components/Users/UserAdd.tsx @@ -105,6 +105,13 @@ const initForm: UserForm = { doctor_medical_council_registration: undefined, }; +const STAFF_OR_NURSE_USER = [ + "Staff", + "StaffReadOnly", + "Nurse", + "NurseReadOnly", +]; + const initError = Object.assign( {}, ...Object.keys(initForm).map((k) => ({ [k]: "" })) @@ -246,13 +253,12 @@ export const UserAdd = (props: UserProps) => { const headerText = !userId ? "Add User" : "Update User"; const buttonText = !userId ? "Save User" : "Update Details"; - const showLocalbody = !( - state.form.user_type === "Pharmacist" || - state.form.user_type === "Volunteer" || - state.form.user_type === "Doctor" || - state.form.user_type === "Staff" || - state.form.user_type === "StaffReadOnly" - ); + const showLocalbody = ![ + "Pharmacist", + "Volunteer", + "Doctor", + ...STAFF_OR_NURSE_USER, + ].includes(state.form.user_type); const fetchDistricts = useCallback( async (id: number) => { @@ -340,10 +346,7 @@ export const UserAdd = (props: UserProps) => { useAbortableEffect( (status: statusType) => { fetchStates(status); - if ( - authUser.user_type === "Staff" || - authUser.user_type === "StaffReadOnly" - ) { + if (STAFF_OR_NURSE_USER.includes(authUser.user_type)) { fetchFacilities(status); } }, @@ -398,10 +401,8 @@ export const UserAdd = (props: UserProps) => { case "facilities": if ( state.form[field].length === 0 && - (authUser.user_type === "Staff" || - authUser.user_type === "StaffReadOnly") && - (state.form["user_type"] === "Staff" || - state.form["user_type"] === "StaffReadOnly") + STAFF_OR_NURSE_USER.includes(authUser.user_type) && + STAFF_OR_NURSE_USER.includes(state.form.user_type) ) { errors[field] = "Please select atleast one of the facilities you are linked to";