- updated flow of appl submission;
- updated max file size across the app;
This commit is contained in:
@@ -35,6 +35,8 @@ import ApplicationSteps from './ApplicationSteps';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import FileuploadApplicationSignedPdf from '../../components/FileuploadApplicationSignedPdf';
|
||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
import { defaultMaxFileSize } from '../../configData';
|
||||
|
||||
const BandoApplication = () => {
|
||||
const { id } = useParams();
|
||||
@@ -94,17 +96,9 @@ const BandoApplication = () => {
|
||||
|
||||
const submitApplicationCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
/*if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: '',
|
||||
detail: __('La domanda è stata presentata!', 'gepafin')
|
||||
});
|
||||
}*/
|
||||
if (data.data.applicationStatus) {
|
||||
setApplicationStatus(data.data.status);
|
||||
setApplicationStatus(data.data.status); // ask why not 'applicationStatus'?
|
||||
}
|
||||
setVisibleConfirmation(true);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
@@ -380,6 +374,13 @@ const BandoApplication = () => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const handleSetSignedDocumentFromFileupload = (fieldName, stateFieldData) => {
|
||||
setSignedPdfFile(stateFieldData);
|
||||
if (!isEmpty(stateFieldData)) {
|
||||
setVisibleConfirmation(true);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if ('SUBMIT' === applicationStatus) {
|
||||
const applId = getApplicationId();
|
||||
@@ -389,7 +390,7 @@ const BandoApplication = () => {
|
||||
ApplicationService.getApplicationSignedPdf(applId, getSignedPdfCallback, errSignedPdfCallbacks);
|
||||
}
|
||||
}
|
||||
}, [applicationStatus])
|
||||
}, [applicationStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
if (formInitialData) {
|
||||
@@ -483,14 +484,6 @@ const BandoApplication = () => {
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
/*if (o.name === 'table') {
|
||||
validations.required = true;
|
||||
validations.validate = {
|
||||
nonEmptyTables: (v) => nonEmptyTables(v)
|
||||
};
|
||||
}*/
|
||||
//console.log('validations', validations, o.name)
|
||||
|
||||
return ['paragraph'].includes(o.name) && text
|
||||
? <div className="appForm__content" key={o.id}>{renderHtmlContent(text.value)}</div>
|
||||
: <FormField
|
||||
@@ -537,13 +530,15 @@ const BandoApplication = () => {
|
||||
<div className="appForm__field">
|
||||
<label htmlFor="signedPdfFile">
|
||||
{__('Carica documento della domanda firmato', 'gepafin')}
|
||||
(.p7m)
|
||||
{' (.p7m) '}
|
||||
{`(max ${getFormatedFileSizeText(defaultMaxFileSize)})`}
|
||||
</label>
|
||||
<FileuploadApplicationSignedPdf
|
||||
setDataFn={setSignedPdfFile}
|
||||
setDataFn={handleSetSignedDocumentFromFileupload}
|
||||
fieldName="signedPdfFile"
|
||||
disabled={is(Array, signedPdfFile) ? !isEmpty(signedPdfFile) : false}
|
||||
defaultValue={is(Array, signedPdfFile) ? signedPdfFile : []}
|
||||
accept={['.p7m,application/pkcs7-mime,application/x-pkcs7-mime']}
|
||||
accept={['.p7m,application/pkcs7-mime,application/x-pkcs7-mime,.zip']}
|
||||
chooseLabel={__('Aggiungi documento', 'gepafin')}
|
||||
multiple={false}
|
||||
doctype="document"
|
||||
|
||||
@@ -121,62 +121,60 @@ const BandoFormsPreview = () => {
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{!isNil(formName)
|
||||
? formData.map(o => {
|
||||
const label = head(o.settings.filter(o => o.name === 'label'));
|
||||
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||
const placeholder = head(o.settings.filter(o => o.name === 'placeholder'));
|
||||
const options = head(o.settings.filter(o => o.name === 'options'));
|
||||
const tableColumns = head(o.settings.filter(o => o.name === 'table_columns'));
|
||||
const step = head(o.settings.filter(o => o.name === 'step'));
|
||||
const mime = head(o.settings.filter(o => o.name === 'mime'));
|
||||
let mimeValue = '';
|
||||
const label = head(o.settings.filter(o => o.name === 'label'));
|
||||
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||
const placeholder = head(o.settings.filter(o => o.name === 'placeholder'));
|
||||
const options = head(o.settings.filter(o => o.name === 'options'));
|
||||
const tableColumns = head(o.settings.filter(o => o.name === 'table_columns'));
|
||||
const step = head(o.settings.filter(o => o.name === 'step'));
|
||||
const mime = head(o.settings.filter(o => o.name === 'mime'));
|
||||
let mimeValue = '';
|
||||
|
||||
if (mime) {
|
||||
mimeValue = mime.value.map(o => o.code).join(',');
|
||||
}
|
||||
|
||||
const validations = Object.keys(o.validators).reduce((acc, cur) => {
|
||||
if (o.validators[cur]) {
|
||||
if (['min', 'max', 'minLength', 'maxLength', 'maxSize'].includes(cur)) {
|
||||
acc[cur] = parseInt(o.validators[cur]);
|
||||
} else if ('pattern' === cur) {
|
||||
acc[cur] = new RegExp(o.validators[cur])
|
||||
} else if ('isRequired' === cur) {
|
||||
acc[cur] = o.validators[cur]
|
||||
} else if ('custom' === cur && validationFns[o.validators[cur]]) {
|
||||
if (!acc.validate) {
|
||||
acc.validate = {}
|
||||
}
|
||||
acc.validate[cur] = validationFns[o.validators[cur]]
|
||||
}
|
||||
if (mime) {
|
||||
mimeValue = mime.value.map(o => o.code ? o.code : o.ext);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
const validations = Object.keys(o.validators).reduce((acc, cur) => {
|
||||
if (o.validators[cur]) {
|
||||
if (['min', 'max', 'minLength', 'maxLength', 'maxSize'].includes(cur)) {
|
||||
acc[cur] = parseInt(o.validators[cur]);
|
||||
} else if ('pattern' === cur) {
|
||||
acc[cur] = new RegExp(o.validators[cur])
|
||||
} else if ('isRequired' === cur) {
|
||||
acc[cur] = o.validators[cur]
|
||||
} else if ('custom' === cur && validationFns[o.validators[cur]]) {
|
||||
if (!acc.validate) {
|
||||
acc.validate = {}
|
||||
}
|
||||
acc.validate[cur] = validationFns[o.validators[cur]]
|
||||
}
|
||||
}
|
||||
|
||||
//console.log('mime', mime)
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return ['paragraph'].includes(o.name) && text
|
||||
? <div className="appForm__content" key={o.id}>{renderHtmlContent(text.value)}</div>
|
||||
: <FormField
|
||||
key={o.id}
|
||||
type={o.name}
|
||||
fieldName={o.id}
|
||||
label={label ? label.value : ''}
|
||||
placeholder={placeholder ? placeholder.value : ''}
|
||||
control={control}
|
||||
register={register}
|
||||
errors={errors}
|
||||
defaultValue={values[o.id] ? values[o.id] : ''}
|
||||
maxFractionDigits={step ? step.value : 0}
|
||||
accept={mimeValue}
|
||||
config={validations}
|
||||
options={options ? options.value : []}
|
||||
setDataFn={setValue}
|
||||
sourceId={0}
|
||||
useGrouping={false}
|
||||
tableColumns={tableColumns ? tableColumns.value : {}}
|
||||
/>
|
||||
}) : null}
|
||||
return ['paragraph'].includes(o.name) && text
|
||||
? <div className="appForm__content" key={o.id}>{renderHtmlContent(text.value)}</div>
|
||||
: <FormField
|
||||
key={o.id}
|
||||
type={o.name}
|
||||
fieldName={o.id}
|
||||
label={label ? label.value : ''}
|
||||
placeholder={placeholder ? placeholder.value : ''}
|
||||
control={control}
|
||||
register={register}
|
||||
errors={errors}
|
||||
defaultValue={values[o.id] ? values[o.id] : ''}
|
||||
maxFractionDigits={step ? step.value : 0}
|
||||
accept={mimeValue}
|
||||
config={validations}
|
||||
options={options ? options.value : []}
|
||||
setDataFn={setValue}
|
||||
sourceId={0}
|
||||
useGrouping={false}
|
||||
tableColumns={tableColumns ? tableColumns.value : {}}
|
||||
/>
|
||||
}) : null}
|
||||
</form>
|
||||
|
||||
<div className="appPageSection__preview">
|
||||
|
||||
@@ -23,6 +23,8 @@ import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import FileuploadDelega from '../../components/FileuploadDelega';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
import { defaultMaxFileSize } from '../../configData';
|
||||
|
||||
const ProfileCompany = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
@@ -461,7 +463,8 @@ const ProfileCompany = () => {
|
||||
<label htmlFor="delega">
|
||||
{__('Carica documento Delega Firmato', 'gepafin')}
|
||||
<span className="appForm__field--required">*</span>
|
||||
(.p7m)
|
||||
{' (.p7m) '}
|
||||
{`(max ${getFormatedFileSizeText(defaultMaxFileSize)})`}
|
||||
</label>
|
||||
<FileuploadDelega
|
||||
setDataFn={setDelegaFile}
|
||||
|
||||
Reference in New Issue
Block a user