- updated version;

This commit is contained in:
Vitalii Kiiko
2024-09-05 17:15:57 +02:00
parent d2a28bea1b
commit 4054745695
33 changed files with 516 additions and 296 deletions

View File

@@ -13,6 +13,7 @@ import BandoEditFormActions from '../BandoEditFormActions';
import UnsavedChangesDetector from '../../../../components/UnsavedChangesDetector';
import BandoService from '../../../../service/bando-service';
import LookupdataService from '../../../../service/lookupdata-service';
import { storeSet } from '../../../../store';
const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors }, ref) {
const navigate = useNavigate();
@@ -94,11 +95,11 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors },
}
const openPreview = () => {
navigate('/bandi/preview/11');
navigate('/tenders/preview/11');
}
const openPreviewEvaluation = () => {
navigate('/bandi/preview-evaluation/11');
navigate('/tenders/preview-evaluation/11');
}
useImperativeHandle(
@@ -118,6 +119,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors },
}, [errors, isValid]);
useEffect(() => {
storeSet.main.formInitialData(initialData);
setFormInitialData(initialData);
}, [initialData]);
@@ -131,12 +133,16 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors },
useEffect(() => {
trigger().then(() => clearErrors());
LookupdataService.getItems(lookupdataCallback, errLookupdataCallback, [['type', ['CHECKLIST', 'EVALUATION_CRITERIA']]])
LookupdataService.getItems(lookupdataCallback, errLookupdataCallback, [['type', ['CHECKLIST', 'EVALUATION_CRITERIA']]]);
return () => {
storeSet.main.formInitialData({});
}
}, []);
return (
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
<UnsavedChangesDetector initialData={initialData} getValuesFn={getValues}/>
<UnsavedChangesDetector getValuesFn={getValues}/>
<FormFieldRepeaterCriteria
data={values}
setDataFn={setValue}