Refactor; add, edit and delete contract forms logic and api calls
This commit is contained in:
@@ -7,7 +7,7 @@ import { Label } from 'Components/Label';
|
||||
import { TextBox } from 'Components/TextBox';
|
||||
import { CheckBox } from 'Components/CheckBox';
|
||||
import { TextArea } from 'Components/TextArea';
|
||||
import { ContractFormsSuccessToast } from '../ContractFormsSuccessToast';
|
||||
import { ContractFormsToast } from '../ContractFormsToast';
|
||||
|
||||
import classes from './contractFormsModal.module.css';
|
||||
|
||||
@@ -35,6 +35,7 @@ interface Props {
|
||||
submitText: string;
|
||||
showToast: boolean;
|
||||
toastMessage: string;
|
||||
toastType?: string;
|
||||
onFormSubmit: (e: any) => void;
|
||||
onClickClose: (e: any) => void;
|
||||
handleChange: (e: any) => void;
|
||||
@@ -51,6 +52,7 @@ const ContractFormsModal = ({
|
||||
formErrors,
|
||||
showToast,
|
||||
toastMessage,
|
||||
toastType = 'success',
|
||||
onFormSubmit,
|
||||
onClickClose,
|
||||
handleChange,
|
||||
@@ -66,7 +68,7 @@ const ContractFormsModal = ({
|
||||
leftHeaderIcon="projects"
|
||||
modalHeader
|
||||
modalCloseClick={onClickClose}
|
||||
toast={<ContractFormsSuccessToast showToast={showToast} message={toastMessage} />}
|
||||
toast={<ContractFormsToast type={toastType as 'success' | 'error'} showToast={showToast} message={toastMessage} />}
|
||||
>
|
||||
<form className={classes.form} onSubmit={onFormSubmit}>
|
||||
<ValidateBackGround isValid={!formErrors?.name.length}>
|
||||
@@ -139,6 +141,10 @@ const ContractFormsModal = ({
|
||||
</Modal>
|
||||
);
|
||||
|
||||
ContractFormsModal.defaultProps = {
|
||||
toastType: 'success',
|
||||
};
|
||||
|
||||
const ContractFormsModalMemo = memo(ContractFormsModal, areEqual);
|
||||
|
||||
export { ContractFormsModalMemo as ContractFormsModal };
|
||||
|
||||
Reference in New Issue
Block a user