- updated dependencies;

- fixed displaying delega;
- fixed switching companies;
- added toast for profile and company profile;
- fixed registration 'deby/allow all' func;
This commit is contained in:
Vitalii Kiiko
2024-10-10 10:33:21 +02:00
parent 8cac4ea23e
commit cc8597b529
14 changed files with 18215 additions and 15834 deletions

View File

@@ -47,7 +47,6 @@ const FileuploadDelega = ({
}
const itemTemplate = (file) => {
console.log('file', file)
return (
<div className="appForm__fileUploadItem">
<div>
@@ -128,8 +127,10 @@ const FileuploadDelega = ({
useEffect(() => {
if (inputRef.current) {
inputRef.current.setUploadedFiles(multiple ? defaultValue : [defaultValue]);
console.log('inputRef.current', inputRef.current, multiple ? defaultValue : [defaultValue])
const properValue = multiple
? defaultValue
: !isEmpty(defaultValue) ? [defaultValue] : [];
inputRef.current.setUploadedFiles(properValue);
}
}, [defaultValue]);

View File

@@ -152,6 +152,15 @@ const Fileupload = ({
register(fieldName, config)
}, []);
useEffect(() => {
if (inputRef.current) {
const properValue = multiple
? defaultValue
: !isEmpty(defaultValue) ? [defaultValue] : [];
inputRef.current.setUploadedFiles(properValue);
}
}, [defaultValue]);
useEffect(() => {
// eslint-disable-next-line no-useless-escape
setAcceptFormats(accept.join(',').replace(/\*/g, '.\*').replace(/,/g, '|'));

View File

@@ -153,6 +153,15 @@ const FileuploadAsync = ({
register(fieldName, config)
}, []);
useEffect(() => {
if (inputRef.current) {
const properValue = multiple
? defaultValue
: !isEmpty(defaultValue) ? [defaultValue] : [];
inputRef.current.setUploadedFiles(properValue);
}
}, [defaultValue]);
useEffect(() => {
// eslint-disable-next-line no-useless-escape
setAcceptFormats(accept.join(',').replace(/\*/g, '.\*').replace(/,/g, '|'));

View File

@@ -19,8 +19,7 @@ const TopBarProfileMenu = ({ menuLeftRef }) => {
const [companyItems, setCompanyItems] = useState([]);
const renderCompanyItem = (item) => (
<span className="topBar__menuCompanyItem"
onClick={chosenCompanyId === item.companyId ? () => {
} : () => switchCompany(item.companyId)}
onClick={() => switchCompany(item.companyId)}
data-id={item.companyId}
data-active={chosenCompanyId === item.companyId}>
<i className="pi pi-building-columns"></i>
@@ -83,7 +82,9 @@ const TopBarProfileMenu = ({ menuLeftRef }) => {
].filter(o => o.enable);
const switchCompany = (id) => {
console.log('switchCompany');
if (chosenCompanyId !== id) {
storeSet.main.chosenCompanyId(id);
}
}
useEffect(() => {
@@ -93,7 +94,7 @@ const TopBarProfileMenu = ({ menuLeftRef }) => {
template: renderCompanyItem
}));
setCompanyItems(items)
}, [companies])
}, [companies, chosenCompanyId])
return <>
<Menu model={items} popup ref={menuLeftRef} id="topBar_profileMenu" className="topBar__menuProfile"/>