In Create New Project form is not empty when we click on cancel button or cross.
This commit is contained in:
parent
e15a7b887d
commit
0c40543f87
@ -102,13 +102,21 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
|||||||
const onSubmitForm = (updatedProject) => {
|
const onSubmitForm = (updatedProject) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
handleSubmitForm( updatedProject, setLoading,reset );
|
handleSubmitForm( updatedProject, setLoading,reset );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
reset({
|
||||||
|
id: project?.id || "",
|
||||||
|
name: project?.name || "",
|
||||||
|
contactPerson: project?.contactPerson || "",
|
||||||
|
projectAddress: project?.projectAddress || "",
|
||||||
|
startDate: formatDate(project?.startDate) || currentDate,
|
||||||
|
endDate: formatDate(project?.endDate) || currentDate,
|
||||||
|
projectStatusId: String(project?.projectStatusId || "00000000-0000-0000-0000-000000000000"),
|
||||||
|
});
|
||||||
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="modal-dialog modal-lg modal-simple mx-sm-auto mx-1 edit-project-modal"
|
className="modal-dialog modal-lg modal-simple mx-sm-auto mx-1 edit-project-modal"
|
||||||
@ -119,7 +127,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-close"
|
className="btn-close"
|
||||||
onClick={onClose}
|
onClick={handleCancel}
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
></button>
|
></button>
|
||||||
<div className="text-center mb-2">
|
<div className="text-center mb-2">
|
||||||
@ -280,7 +288,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-sm btn-label-secondary"
|
className="btn btn-sm btn-label-secondary"
|
||||||
onClick={onClose}
|
onClick={handleCancel}
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user