- updated flow of appl submission;
- updated max file size across the app;
This commit is contained in:
@@ -14,7 +14,8 @@ import { FileUpload } from 'primereact/fileupload';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import { Button } from 'primereact/button';
|
||||
|
||||
import { mimeTypes } from '../../../../configData';
|
||||
import { defaultMaxFileSize, mimeTypes } from '../../../../configData';
|
||||
import getFormatedFileSizeText from '../../../../helpers/getFormatedFileSizeText';
|
||||
|
||||
const Fileupload = ({
|
||||
fieldName,
|
||||
@@ -27,7 +28,7 @@ const Fileupload = ({
|
||||
infoText = null,
|
||||
accept = ['image/*'],
|
||||
doctype = 'document',
|
||||
maxSize = 100000000,
|
||||
maxSize = defaultMaxFileSize,
|
||||
emptyText = __('Trascina qui il tuo file', 'gepafin'),
|
||||
chooseLabel = __('Aggiungi file', 'gepafin'),
|
||||
uploadLabel = __('Salva documento', 'gepafin'),
|
||||
@@ -162,19 +163,19 @@ const Fileupload = ({
|
||||
useEffect(() => {
|
||||
const properMime = accept.map
|
||||
? accept
|
||||
.map(v => {
|
||||
const found = head(mimeTypes.filter(o => o.code.includes(v)));
|
||||
let res = v;
|
||||
.map(v => {
|
||||
const found = head(mimeTypes.filter(o => o.code.includes(v)));
|
||||
let res = v;
|
||||
|
||||
if (found) {
|
||||
res = found.code;
|
||||
}
|
||||
if (found) {
|
||||
res = found.code;
|
||||
}
|
||||
|
||||
return res;
|
||||
}) : [];
|
||||
return res;
|
||||
}) : [];
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
setAcceptFormats(properMime.join(',').replace(/\*/g, '.\*').replace(/,/g, '|'));
|
||||
setFormatsForInput(properMime.join(','))
|
||||
setFormatsForInput(properMime.join(','));
|
||||
}, [accept]);
|
||||
|
||||
return (
|
||||
@@ -184,6 +185,7 @@ const Fileupload = ({
|
||||
{label}{config.required || config.isRequired ?
|
||||
<span className="appForm__field--required">*</span> : null}
|
||||
{acceptFormats ? ' (' + getPropeMimeLabels(accept) + ')' : null}
|
||||
{` (max ${getFormatedFileSizeText(maxSize)})`}
|
||||
</label>
|
||||
<FileUpload
|
||||
ref={inputRef}
|
||||
|
||||
@@ -14,7 +14,8 @@ import { Tag } from 'primereact/tag';
|
||||
import { Button } from 'primereact/button';
|
||||
import { head, isEmpty } from 'ramda';
|
||||
|
||||
import { mimeTypes } from '../../../../configData';
|
||||
import { defaultMaxFileSize, mimeTypes } from '../../../../configData';
|
||||
import getFormatedFileSizeText from '../../../../helpers/getFormatedFileSizeText';
|
||||
|
||||
const FileuploadAsync = ({
|
||||
fieldName,
|
||||
@@ -27,7 +28,7 @@ const FileuploadAsync = ({
|
||||
infoText = null,
|
||||
accept = ['image/*'],
|
||||
doctype = 'images',
|
||||
maxSize = 100000000,
|
||||
maxSize = defaultMaxFileSize,
|
||||
emptyText = __('Trascina qui il tuo file', 'gepafin'),
|
||||
chooseLabel = __('Aggiungi immagine', 'gepafin'),
|
||||
multiple = false,
|
||||
@@ -184,6 +185,7 @@ const FileuploadAsync = ({
|
||||
<label htmlFor={fieldName} className={classNames({ 'p-error': errors[fieldName] })}>
|
||||
{label}{config.required ? '*' : null}
|
||||
{acceptFormats ? ' (' + getPropeMimeLabels(accept) + ')' : null}
|
||||
{` (max ${getFormatedFileSizeText(maxSize)})`}
|
||||
</label>
|
||||
<FileUpload
|
||||
ref={inputRef}
|
||||
|
||||
Reference in New Issue
Block a user