45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { Col, Row } from "reactstrap";
|
|
import ValidationField from "../../../../Components/ValidationField/ValidationField";
|
|
import { useFormikContext } from "formik";
|
|
import { useModalState } from "../../../../zustand/Modal";
|
|
import { useEffect } from "react";
|
|
|
|
const Form = () => {
|
|
const formik = useFormikContext();
|
|
const { isOpen } = useModalState((state) => state);
|
|
|
|
useEffect(() => {
|
|
if (isOpen === "") {
|
|
formik.setErrors({});
|
|
}
|
|
if (isOpen === "isSuccess") {
|
|
formik.setErrors({});
|
|
formik.resetForm();
|
|
}
|
|
}, [isOpen]);
|
|
return (
|
|
<Row className="w-100">
|
|
<Col>
|
|
<ValidationField placeholder="name" label="name" name="name" />
|
|
<ValidationField label="status" name="status" type="Checkbox" />
|
|
</Col>
|
|
<Col>
|
|
<ValidationField
|
|
placeholder="starting_date"
|
|
label="starting_date"
|
|
type="Date"
|
|
name="starting_date"
|
|
/>
|
|
<ValidationField
|
|
placeholder="ending_date"
|
|
label="ending_date"
|
|
type="Date"
|
|
name="ending_date"
|
|
/>{" "}
|
|
</Col>
|
|
</Row>
|
|
);
|
|
};
|
|
|
|
export default Form;
|