- fixed login for confidi users;

- restyled fileselect UI;
This commit is contained in:
Vitalii Kiiko
2025-03-11 15:19:13 +01:00
parent d9aa0b6c23
commit e13e63e1ca
12 changed files with 126 additions and 56 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import { is, uniq } from 'ramda';
import { head, is, uniq } from 'ramda';
// store
import { useStore } from '../../../../store';
@@ -26,13 +26,16 @@ import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup';
const DocumentsTable = ({ type, reload = 0 }) => {
const chosenCompanyId = useStore().main.chosenCompanyId();
const companies = useStore().main.companies();
const [docs, setDocs] = useState([]);
const [filters, setFilters] = useState(null);
const [loading, setLoading] = useState(false);
const [statuses, setStatuses] = useState([]);
useEffect(() => {
if (!loading && chosenCompanyId && chosenCompanyId !== 0 && reload !== 0) {
const existingCompany = head(companies.filter(o => o.id === chosenCompanyId));
if (!loading && existingCompany && reload !== 0) {
setLoading(true);
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, getCallback, errGetCallbacks, [
['documentType', type]
@@ -41,10 +44,14 @@ const DocumentsTable = ({ type, reload = 0 }) => {
}, [chosenCompanyId, reload]);
useEffect(() => {
setLoading(true);
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, getCallback, errGetCallbacks, [
['documentType', type]
]);
const existingCompany = head(companies.filter(o => o.id === chosenCompanyId));
if (existingCompany) {
setLoading(true);
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, getCallback, errGetCallbacks, [
['documentType', type]
]);
}
}, []);
const getCallback = (resp) => {