From 9a1c3372f7c3a3154cafc96186788c01c6152e3e Mon Sep 17 00:00:00 2001 From: Keshav Malik <91189139+Keshav-0907@users.noreply.github.com> Date: Tue, 7 May 2024 14:30:50 +0530 Subject: [PATCH 01/22] Fix : Minimum value in forms should be greater than 0 (#7273) * Triage Form Fix * Added Validation for Negative Values in forms * Update src/Components/Facility/ConsultationForm.tsx Co-authored-by: Khavin Shankar * fix lint --------- Co-authored-by: Ashesh <3626859+Ashesh3@users.noreply.github.com> Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Co-authored-by: Rithvik Nishad Co-authored-by: Khavin Shankar Co-authored-by: Rithvik Nishad --- src/Components/Facility/ConsultationForm.tsx | 12 +++++++ src/Components/Facility/TriageForm.tsx | 36 ++++++++++++++++++++ src/Components/Patient/PatientRegister.tsx | 10 ++++++ 3 files changed, 58 insertions(+) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index e0c79823434..e4b3f4a195f 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -642,6 +642,18 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { } return; } + case "weight": + case "height": { + if (state.form.suggestion !== "DD") { + const value = state.form[field]; + if (!value || parseFloat(value) <= 0) { + errors[field] = `Please enter a valid ${field}`; + invalidForm = true; + break; + } + } + return; + } default: return; diff --git a/src/Components/Facility/TriageForm.tsx b/src/Components/Facility/TriageForm.tsx index 5cf76fbda49..1efe22e66a4 100644 --- a/src/Components/Facility/TriageForm.tsx +++ b/src/Components/Facility/TriageForm.tsx @@ -102,6 +102,42 @@ export const TriageForm = ({ facilityId, id }: Props) => { invalidForm = true; } return; + case "num_patients_visited": + if (state.form[field] < 0) { + errors[field] = + "Number of patients visited must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patients_home_quarantine": + if (state.form[field] < 0) { + errors[field] = + "Number of patients in Home Qurantine must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patients_isolation": + if (state.form[field] < 0) { + errors[field] = + "Number of patients in Isolation must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patient_referred": + if (state.form[field] < 0) { + errors[field] = + "Number of patients referred must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patient_confirmed_positive": + if (state.form[field] < 0) { + errors[field] = + "Number of patients confirmed positive must be greater than or equal to 0"; + invalidForm = true; + } + return; + default: return; } diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index dea0484a67c..67032abede8 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -649,6 +649,16 @@ export const PatientRegister = (props: PatientRegisterProps) => { errors[field] = "Please select a blood group"; } return; + case "number_of_primary_contacts": + if (form[field] < 0) { + errors[field] = "Number of primary contacts cannot be negative"; + } + return; + case "number_of_secondary_contacts": + if (form[field] < 0) { + errors[field] = "Number of secondary contacts cannot be negative"; + } + return; case "is_vaccinated": if (form.is_vaccinated === "true") { From 02d9b90a59d08774f65db2843229326bb145d28b Mon Sep 17 00:00:00 2001 From: Vibhu Chandransh Bhanot <66901877+Vibhu1710@users.noreply.github.com> Date: Tue, 7 May 2024 14:31:25 +0530 Subject: [PATCH 02/22] #7308 fix : use "hidden" css property to toggle b/w Login & Forgot Password (#7323) * fix : use "hidden" css property to toggle b/w Login & Forgot Password page * suggestions from code review --------- Co-authored-by: Vibhu1710 Co-authored-by: rithviknishad --- src/Components/Auth/Login.tsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx index b3d2fef8d31..a74969fbfa4 100644 --- a/src/Components/Auth/Login.tsx +++ b/src/Components/Auth/Login.tsx @@ -13,6 +13,7 @@ import ReactMarkdown from "react-markdown"; import rehypeRaw from "rehype-raw"; import { useAuthContext } from "../../Common/hooks/useAuthUser"; import FiltersCache from "../../Utils/FiltersCache"; +import { classNames } from "../../Utils/utils"; export const Login = (props: { forgot?: boolean }) => { const { signIn } = useAuthContext(); @@ -276,12 +277,10 @@ export const Login = (props: { forgot?: boolean }) => {
{t("auth_login_title")} @@ -353,12 +352,10 @@ export const Login = (props: { forgot?: boolean }) => {