diff --git a/web-app/src/components/PatientModal.jsx b/web-app/src/components/PatientModal.jsx index 0e6fabf..2e0dd81 100644 --- a/web-app/src/components/PatientModal.jsx +++ b/web-app/src/components/PatientModal.jsx @@ -9,15 +9,17 @@ const PatientModal = ({visible, onCancel, onSubmit, patient}) => { const [form] = Form.useForm(); useEffect(() => { - if (patient) { - form.setFieldsValue({ - ...patient, - birthday: patient.birthday ? moment(patient.birthday) : null, - }); - } else { - form.resetFields(); + if (visible) { + if (patient) { + form.setFieldsValue({ + ...patient, + birthday: patient.birthday ? moment(patient.birthday) : null, + }); + } else { + form.resetFields(); + } } - }, [patient, form]); + }, [visible, patient, form]); const handleOk = async () => { try { @@ -26,6 +28,7 @@ const PatientModal = ({visible, onCancel, onSubmit, patient}) => { values.birthday = values.birthday.format("YYYY-MM-DD"); } onSubmit(values); + form.resetFields(); } catch (errorInfo) { console.log("Validation Failed:", errorInfo); } @@ -35,13 +38,17 @@ const PatientModal = ({visible, onCancel, onSubmit, patient}) => { { + form.resetFields(); + onCancel(); + }} onOk={handleOk} okText="Сохранить" cancelText="Отмена" centered maskClosable={false} - bodyStyle={{padding: 24}} + forceRender={true} + styles={{body: {padding: 24}}} style={{top: 20}} >
diff --git a/web-app/src/pages/PatientsPage.jsx b/web-app/src/pages/PatientsPage.jsx index a1be1f1..93c9a54 100644 --- a/web-app/src/pages/PatientsPage.jsx +++ b/web-app/src/pages/PatientsPage.jsx @@ -6,7 +6,6 @@ import getAllPatients from "../api/GetAllPatients.jsx"; import PatientListCard from "../components/PatientListCard.jsx"; import PatientModal from "../components/PatientModal.jsx"; // Подключаем модальное окно -const { Search } = Input; const { Option } = Select; const PatientsPage = () => { @@ -83,7 +82,7 @@ const PatientsPage = () => {
- setSearchText(e.target.value)} style={{ width: "100%" }}