- fixed displaying data in table form field;

- updated labels for fileupload fields;
This commit is contained in:
Vitalii Kiiko
2024-10-10 17:26:29 +02:00
parent f23de10ab8
commit 8fb1551880
6 changed files with 26 additions and 13 deletions

View File

@@ -17,6 +17,8 @@ const FileuploadDelega = ({
maxSize = 100000000,
emptyText = __('Trascina qui il tuo file', 'gepafin'),
chooseLabel = __('Aggiungi delega', 'gepafin'),
uploadLabel = __('Salva documento', 'gepafin'),
cancelLabel = __('Cancella documento', 'gepafin'),
multiple = false,
companyId = 0,
disabled = false
@@ -163,8 +165,8 @@ const FileuploadDelega = ({
maxFileSize={maxSize}
emptyTemplate={<p>{emptyText}</p>}
chooseLabel={chooseLabel}
cancelLabel={__('Cancella', 'gepafin')}
uploadLabel={__('Carica', 'gepafin')}
cancelLabel={cancelLabel}
uploadLabel={uploadLabel}
itemTemplate={itemTemplate}
customUpload
onBeforeDrop={onBeforeDrop}

View File

@@ -26,11 +26,14 @@ const Fileupload = ({
maxSize = 100000000,
emptyText = __('Trascina qui il tuo file', 'gepafin'),
chooseLabel = __('Aggiungi file', 'gepafin'),
uploadLabel = __('Salva documento', 'gepafin'),
cancelLabel = __('Cancella documento', 'gepafin'),
multiple = false,
sourceId = 0,
source = 'application',
disabled = false,
saveFormCallback = () => {}
saveFormCallback = () => {
}
}) => {
const [stateFieldData, setStateFieldData] = useState([]);
const [acceptFormats, setAcceptFormats] = useState('');
@@ -191,8 +194,8 @@ const Fileupload = ({
maxFileSize={maxSize}
emptyTemplate={<p>{emptyText}</p>}
chooseLabel={chooseLabel}
cancelLabel={__('Cancella', 'gepafin')}
uploadLabel={__('Carica', 'gepafin')}
cancelLabel={cancelLabel}
uploadLabel={uploadLabel}
className={classNames({ 'p-invalid': errors[fieldName] })}
itemTemplate={itemTemplate}
customUpload

View File

@@ -40,6 +40,11 @@ const Table = ({
rowRowIndexToDelete(index);
}
const updateRows = (data) => {
setRows(data);
setDataFn(fieldName, data, { shouldValidate: true });
}
useEffect(() => {
if (!isNil(rowIndexToDelete)) {
const newRowsData = wrap(rows).del([rowIndexToDelete]).value();
@@ -49,11 +54,6 @@ const Table = ({
rowRowIndexToDelete(null);
}, [rowIndexToDelete]);
const updateRows = (data) => {
setRows(data);
setDataFn(fieldName, data, { shouldValidate: true });
}
useEffect(() => {
let shouldDisableNewRows = false;
@@ -110,6 +110,10 @@ const Table = ({
setRowsCfg(rowsData);
}, [tableColumns]);
useEffect(() => {
setRows(defaultValue)
}, [defaultValue]);
useEffect(() => {
register(fieldName, config);
}, []);

View File

@@ -5,6 +5,7 @@ import { Navigate, Outlet } from 'react-router-dom';
import AuthenticationService from '../../service/authentication-service';
const ProtectedRoute = () => {
if (!AuthenticationService.wasLoggedIn()) {
return (<Navigate to={'/login'} replace/>);
}