- fixed adding company getting data populated;
- reverted to non paginated tables for displaying confidi calls;
This commit is contained in:
@@ -117,19 +117,21 @@ const AddCompany = () => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
const resp = data.data.vatCheckResponse.data;
|
||||
if (!isEmpty(resp)) {
|
||||
const firstItem = resp[0];
|
||||
const {
|
||||
cap, cf, denominazione, piva, indirizzo, comune, dettaglio: { pec }
|
||||
} = resp;
|
||||
taxCode, vatCode, address, companyName, pec
|
||||
} = firstItem;
|
||||
const { streetName, zipCode, town } = address?.registeredOffice;
|
||||
|
||||
const formData = {
|
||||
cap,
|
||||
cap: zipCode,
|
||||
pec,
|
||||
email: pec,
|
||||
city: comune,
|
||||
codiceFiscale: cf ? cf : piva,
|
||||
address: indirizzo,
|
||||
vatNumber: piva,
|
||||
companyName: denominazione
|
||||
city: town,
|
||||
codiceFiscale: taxCode ? taxCode : vatCode,
|
||||
address: streetName,
|
||||
vatNumber: vatCode,
|
||||
companyName
|
||||
}
|
||||
Object.keys(formData).map(k => setValue(k, formData[k]));
|
||||
setVatCheckResponse(data.data.vatCheckResponse);
|
||||
|
||||
@@ -50,11 +50,21 @@ const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
|
||||
|
||||
if (existingCompany && !isAsyncRequest) {
|
||||
storeSet('setAsyncRequest');
|
||||
const role = storeGet('getRole')
|
||||
|
||||
if (role === 'ROLE_CONFIDI') {
|
||||
BandoService.getBandi(getCallback, errGetCallbacks, [
|
||||
['companyId', chosenCompanyId],
|
||||
['onlyPreferredCall', showOnlyPreferred],
|
||||
['onlyConfidiCall', true]
|
||||
]);
|
||||
} else {
|
||||
BandoService.getBandi(getCallback, errGetCallbacks, [
|
||||
['companyId', chosenCompanyId],
|
||||
['onlyPreferredCall', showOnlyPreferred]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}, [chosenCompanyId, companies]);
|
||||
|
||||
const getCallback = (data) => {
|
||||
|
||||
@@ -33,9 +33,18 @@ const LatestBandiTable = () => {
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
const role = storeGet('getRole')
|
||||
|
||||
if (role === 'ROLE_CONFIDI') {
|
||||
BandoService.getBandi(getCallback, errGetCallbacks, [
|
||||
['companyId', chosenCompanyId],
|
||||
['onlyConfidiCall', true]
|
||||
]);
|
||||
} else {
|
||||
BandoService.getBandi(getCallback, errGetCallbacks, [
|
||||
['companyId', chosenCompanyId]
|
||||
]);
|
||||
}
|
||||
}, [chosenCompanyId]);
|
||||
|
||||
const getCallback = (data) => {
|
||||
|
||||
131
src/pages/DashboardBeneficiarioConfidi/index.js
Normal file
131
src/pages/DashboardBeneficiarioConfidi/index.js
Normal file
@@ -0,0 +1,131 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { head, isEmpty, pathOr } from 'ramda';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
|
||||
// store
|
||||
import { useStoreValue } from '../../store';
|
||||
|
||||
// api
|
||||
import DashboardService from '../../service/dashboard-service';
|
||||
|
||||
// components
|
||||
import { Button } from 'primereact/button';
|
||||
import ErrorBoundary from '../../components/ErrorBoundary';
|
||||
import MyLatestSubmissionsTableAsync from '../DashboardBeneficiario/components/MyLatestSubmissionsTableAsync';
|
||||
import LatestBandiTable from '../DashboardBeneficiario/components/LatestBandiTable';
|
||||
|
||||
const DashboardBeneficiarioConfidi = () => {
|
||||
const navigate = useNavigate();
|
||||
const [mainStats, setMainStats] = useState({});
|
||||
const companies = useStoreValue('companies');
|
||||
const chosenCompanyId = useStoreValue('chosenCompanyId');
|
||||
const company = head(companies.filter(o => o.id === chosenCompanyId));
|
||||
|
||||
const goToAllSubmissions = () => {
|
||||
navigate('/bandi');
|
||||
}
|
||||
|
||||
const getStatValue = (key, fallback = '') => {
|
||||
return pathOr(fallback, [key], mainStats);
|
||||
}
|
||||
|
||||
const getStats = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setMainStats(data.data);
|
||||
}
|
||||
}
|
||||
|
||||
const errGetStats = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const existingCompany = head(companies.filter(o => o.id === chosenCompanyId));
|
||||
|
||||
if (existingCompany) {
|
||||
DashboardService.getBeneficiaryStatsForCompany(existingCompany.id, getStats, errGetStats);
|
||||
}
|
||||
}, [companies, chosenCompanyId]);
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{__('Dashboard', 'gepafin')}</h1>
|
||||
{company ? <span className="companyName">{company.companyName}</span> : null}
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection statsBigBadges">
|
||||
<h2>{__('Panoramica di Sistema', 'gepafin')}</h2>
|
||||
<div className="statsBigBadges__grid">
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Domande attive', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfApplications', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Bandi osservati', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfCalls', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Documenti da integrare', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfIntegratedDocuments', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Domande in lavorazione', 'gepafin')}</h2>
|
||||
<ErrorBoundary><MyLatestSubmissionsTableAsync/></ErrorBoundary>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
{isEmpty(chosenCompanyId) || chosenCompanyId === 0
|
||||
? <>
|
||||
<div className="appPageSection__message warning">
|
||||
<i className="pi pi-exclamation-triangle"></i>
|
||||
<span className="summary">{__('Attenzione', 'gepafin')}</span>
|
||||
<span>
|
||||
{__('Per applicare ai bandi devi Registare un Azienda clicca', 'gepafin')}
|
||||
<Link to={`/agguingi-azienda`} style={{marginLeft: '0.5ch'}}>{__('qua', 'gepafin')}</Link>
|
||||
</span>
|
||||
</div>
|
||||
<div className="appPage__spacer"></div>
|
||||
</> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Bandi disponibili', 'gepafin')}</h2>
|
||||
<ErrorBoundary><LatestBandiTable/></ErrorBoundary>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection__hr">
|
||||
<span>{__('Azioni rapide', 'gepafin')}</span>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<div className="appPageSection__actions">
|
||||
<Button
|
||||
onClick={goToAllSubmissions}
|
||||
label={__('Nuova domanda', 'gepafin')} icon="pi pi-plus" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default DashboardBeneficiarioConfidi;
|
||||
@@ -54,6 +54,7 @@ import StatsBeneficiary from './pages/StatsBeneficiary';
|
||||
import DocumentsBeneficiary from './pages/DocumentsBeneficiary';
|
||||
import LoginConfidi from './pages/LoginConfidi';
|
||||
import ResetPasswordAdmin from './pages/ResetPasswordAdmin';
|
||||
import DashboardBeneficiarioConfidi from './pages/DashboardBeneficiarioConfidi';
|
||||
|
||||
const routes = ({ role, chosenCompanyId }) => {
|
||||
|
||||
@@ -63,7 +64,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
||||
<Route path="/" element={<DefaultLayout>
|
||||
{'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null}
|
||||
{'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null}
|
||||
{'ROLE_CONFIDI' === role ? <DashboardBeneficiario/> : null}
|
||||
{'ROLE_CONFIDI' === role ? <DashboardBeneficiarioConfidi/> : null}
|
||||
{'ROLE_PRE_INSTRUCTOR' === role ? <DashboardPreInstructor/> : null}
|
||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DashboardInstructorManager/> : null}
|
||||
</DefaultLayout>}/>
|
||||
|
||||
Reference in New Issue
Block a user