diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index e4b3f4a195f..ba248b8db6f 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -644,7 +644,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { } case "weight": case "height": { - if (state.form.suggestion !== "DD") { + if (state.form[field] && state.form.suggestion !== "DD") { const value = state.form[field]; if (!value || parseFloat(value) <= 0) { errors[field] = `Please enter a valid ${field}`; diff --git a/src/Components/Facility/TriageForm.tsx b/src/Components/Facility/TriageForm.tsx index 1efe22e66a4..6ad9fdd0e08 100644 --- a/src/Components/Facility/TriageForm.tsx +++ b/src/Components/Facility/TriageForm.tsx @@ -103,37 +103,12 @@ export const TriageForm = ({ facilityId, id }: Props) => { } 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"; + if (state.form[field] != null && state.form[field] < 0) { + errors[field] = "Value must be greater than or equal to 0"; invalidForm = true; } return; diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index d036c3c0067..4309044fba2 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -656,13 +656,9 @@ export const PatientRegister = (props: PatientRegisterProps) => { } 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"; + if (form[field] && form[field] < 0) { + errors[field] = "Value cannot be negative"; } return;