- added auto saving on validation application request;

This commit is contained in:
Vitalii Kiiko
2025-02-14 10:09:56 +01:00
parent 75d3ef06cc
commit 0211df0329
2 changed files with 18 additions and 12 deletions

View File

@@ -100,11 +100,7 @@ const BandoApplication = () => {
const formValues = watch(); const formValues = watch();
const onValidate = () => { const onValidate = () => {
const applId = getApplicationId(); saveDraft('VALIDATE');
storeSet.main.setAsyncRequest();
formMsgs.current.clear();
ApplicationService.validateApplication(applId, {}, validateApplicationCallback, errValidateApplicationCallback);
}; };
const onSubmit = () => { const onSubmit = () => {
@@ -263,11 +259,19 @@ const BandoApplication = () => {
}); });
} }
if (!isEmpty(saveAndMove) && is(String, saveAndMove)) { if (!isEmpty(saveAndMove) && is(String, saveAndMove)) {
if (['NEXT','PREVIOUS'].includes(saveAndMove)) {
storeSet.main.setAsyncRequest(); storeSet.main.setAsyncRequest();
ApplicationService.getApplicationForm(data.data.id, getApplFormCallback, errGetApplFormCallbacks, [ ApplicationService.getApplicationForm(data.data.id, getApplFormCallback, errGetApplFormCallbacks, [
['formId', formId], ['formId', formId],
['action', saveAndMove] ['action', saveAndMove]
]); ]);
} else if (['VALIDATE'].includes(saveAndMove)) {
const applId = getApplicationId();
storeSet.main.setAsyncRequest();
formMsgs.current.clear();
ApplicationService.validateApplication(applId, {}, validateApplicationCallback, errValidateApplicationCallback);
}
} else { } else {
ApplicationService.getApplicationForm(data.data.id, getStatusCheckCallback, errGetStatusCheckCallbacks); ApplicationService.getApplicationForm(data.data.id, getStatusCheckCallback, errGetStatusCheckCallbacks);
} }

View File

@@ -9,7 +9,9 @@ const BuilderElementProperLabel = ({ id, defaultLabel }) => {
const elements = useStore().main.formElements(); const elements = useStore().main.formElements();
const element = head(elements.filter(o => o.id === id)); const element = head(elements.filter(o => o.id === id));
const [label, setLabel] = useState(''); const [label, setLabel] = useState('');
const isRequired = pathOr(false, ['validators', 'isRequired'], element) const isRequired = pathOr(false, ['validators', 'isRequired'], element);
const customValidation = pathOr(false, ['validators', 'custom'], element);
let maybeNonEmptyTables = customValidation === 'nonEmptyTables';
useEffect(() => { useEffect(() => {
const label = head(element.settings.filter(o => o.name === 'label')); const label = head(element.settings.filter(o => o.name === 'label'));
@@ -26,7 +28,7 @@ const BuilderElementProperLabel = ({ id, defaultLabel }) => {
return <div className="label"> return <div className="label">
{renderHtmlContent(label)} {renderHtmlContent(label)}
{isRequired ? <span className="appForm__field--required">*</span> : null} {isRequired || maybeNonEmptyTables ? <span className="appForm__field--required">*</span> : null}
</div> </div>
} }