Merge pull request 'In Create New Project form is not empty when we click on cancel button or cross.' (#151) from Kartik_bug#386 into Issue_May_5W

Reviewed-on: #151
This commit is contained in:
ashutosh.nehete 2025-05-27 10:57:12 +00:00
commit a68bd7dc38

View File

@ -102,13 +102,21 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
const onSubmitForm = (updatedProject) => {
setLoading(true);
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 (
<div
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
type="button"
className="btn-close"
onClick={onClose}
onClick={handleCancel}
aria-label="Close"
></button>
<div className="text-center mb-2">
@ -280,7 +288,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
<button
type="button"
className="btn btn-sm btn-label-secondary"
onClick={onClose}
onClick={handleCancel}
aria-label="Close"
>
Cancel