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

View File

@@ -9,7 +9,9 @@ const BuilderElementProperLabel = ({ id, defaultLabel }) => {
const elements = useStore().main.formElements();
const element = head(elements.filter(o => o.id === id));
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(() => {
const label = head(element.settings.filter(o => o.name === 'label'));
@@ -26,7 +28,7 @@ const BuilderElementProperLabel = ({ id, defaultLabel }) => {
return <div className="label">
{renderHtmlContent(label)}
{isRequired ? <span className="appForm__field--required">*</span> : null}
{isRequired || maybeNonEmptyTables ? <span className="appForm__field--required">*</span> : null}
</div>
}