diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index 77088ef57e7..140e321a4d6 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -422,6 +422,9 @@ export const PatientRegister = (props: PatientRegisterProps) => { village: res.data.village ? res.data.village : "", medical_history: [], is_antenatal: String(!!res.data.is_antenatal), + last_menstruation_start_date: res.data.last_menstruation_start_date, + is_postpartum: String(!!res.data.is_postpartum), + date_of_delivery: res.data.date_of_delivery, allergies: res.data.allergies ? res.data.allergies : "", pincode: res.data.pincode ? res.data.pincode : "", ongoing_medication: res.data.ongoing_medication @@ -562,6 +565,8 @@ export const PatientRegister = (props: PatientRegisterProps) => { case "name": case "gender": case "date_of_birth": + case "last_menstruation_start_date": + case "date_of_delivery": errors[field] = RequiredFieldValidator()(form[field]); return; case "permanent_address": @@ -776,6 +781,15 @@ export const PatientRegister = (props: PatientRegisterProps) => { gender: Number(formData.gender), nationality: formData.nationality, is_antenatal: formData.is_antenatal, + is_postpartum: formData.is_postpartum, + last_menstruation_start_date: + formData.is_antenatal === "true" + ? dateQueryString(formData.last_menstruation_start_date) + : null, + date_of_delivery: + formData.is_postpartum === "true" + ? dateQueryString(formData.date_of_delivery) + : null, passport_no: formData.nationality !== "India" ? formData.passport_no : undefined, state: formData.nationality === "India" ? formData.state : undefined, @@ -1299,6 +1313,20 @@ export const PatientRegister = (props: PatientRegisterProps) => { required label="Gender" options={genderTypes} + onChange={(e) => { + field("gender").onChange(e); + if (e.value !== "2") { + field("is_antenatal").onChange({ + name: "is_antenatal", + value: "false", + }); + + field("is_postpartum").onChange({ + name: "is_postpartum", + value: "false", + }); + } + }} optionLabel={(o: any) => o.text} optionValue={(o: any) => o.id} /> @@ -1310,7 +1338,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
{
} + + { +
+ +
+ } +
+ + option.label} + optionValue={(option) => option.value} + /> + + + +