- added updating status for initiating evaluation process;
- fixed issues with displaying and calcuating decimals in appl form;
This commit is contained in:
@@ -34,7 +34,11 @@
|
|||||||
&.p-tag-secondary {
|
&.p-tag-secondary {
|
||||||
background-color: var(--table-border-color);
|
background-color: var(--table-border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.p-tag-tertiary {
|
||||||
|
background-color: var(--card-full-background-color-6);
|
||||||
|
}
|
||||||
|
|
||||||
.p-tag-value {
|
.p-tag-value {
|
||||||
color: var(--menuitem-active-color);
|
color: var(--menuitem-active-color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
const element = head(elements.filter(o => o.id === id));
|
const element = head(elements.filter(o => o.id === id));
|
||||||
const [isVariable, setIsVariable] = useState('secondary');
|
const [isVariable, setIsVariable] = useState('secondary');
|
||||||
const [isFormula, setIsFormula] = useState('secondary');
|
const [isFormula, setIsFormula] = useState('secondary');
|
||||||
|
const [isRequestedAmount, setIsRequestedAmount] = useState(false);
|
||||||
|
const [isDelegation, setIsDelegation] = useState(false);
|
||||||
|
|
||||||
const [{ handlerId }, drop] = useDrop({
|
const [{ handlerId }, drop] = useDrop({
|
||||||
accept: ItemTypes.FIELD,
|
accept: ItemTypes.FIELD,
|
||||||
@@ -105,6 +107,8 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const variable = head(element.settings.filter(o => o.name === 'variable'));
|
const variable = head(element.settings.filter(o => o.name === 'variable'));
|
||||||
const formula = head(element.settings.filter(o => o.name === 'formula'));
|
const formula = head(element.settings.filter(o => o.name === 'formula'));
|
||||||
|
const isRequestedAmount = head(element.settings.filter(o => o.name === 'isRequestedAmount'));
|
||||||
|
const isDelegation = head(element.settings.filter(o => o.name === 'isDelegation'));
|
||||||
|
|
||||||
if (variable && !isEmpty(variable.value)) {
|
if (variable && !isEmpty(variable.value)) {
|
||||||
setIsVariable('warning');
|
setIsVariable('warning');
|
||||||
@@ -113,6 +117,14 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
if (formula && !isEmpty(formula.value)) {
|
if (formula && !isEmpty(formula.value)) {
|
||||||
setIsFormula('warning');
|
setIsFormula('warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isRequestedAmount && !isEmpty(isRequestedAmount.value) && isRequestedAmount.value) {
|
||||||
|
setIsRequestedAmount('tertiary');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDelegation && !isEmpty(isDelegation.value) && isDelegation.value) {
|
||||||
|
setIsDelegation('tertiary');
|
||||||
|
}
|
||||||
}, [elements]);
|
}, [elements]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -128,6 +140,10 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
? <Tag value="var" severity={isVariable}/> : null}
|
? <Tag value="var" severity={isVariable}/> : null}
|
||||||
{name === 'numberinput'
|
{name === 'numberinput'
|
||||||
? <Tag value="f(x)" severity={isFormula}/> : null}
|
? <Tag value="f(x)" severity={isFormula}/> : null}
|
||||||
|
{isRequestedAmount
|
||||||
|
? <Tag value="importo" severity={isRequestedAmount}/> : null}
|
||||||
|
{isDelegation
|
||||||
|
? <Tag value="delega" severity={isDelegation}/> : null}
|
||||||
</div>
|
</div>
|
||||||
<BuilderElementProperLabel id={id} defaultLabel={label}/>
|
<BuilderElementProperLabel id={id} defaultLabel={label}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect} from 'react';
|
import React, { useState, useEffect} from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { is, uniq, isNil } from 'ramda';
|
import { is, uniq, isNil, head } from 'ramda';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||||
@@ -22,10 +22,12 @@ import { Tag } from 'primereact/tag';
|
|||||||
|
|
||||||
import translationStrings from '../../../../translationStringsForComponents';
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
import { useStore } from '../../../../store';
|
import { useStore } from '../../../../store';
|
||||||
|
import { klona } from 'klona';
|
||||||
|
|
||||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
const InstructorManagerMieDomandeTable = ({ userId = null, statuses = [] }) => {
|
const InstructorManagerMieDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [items, setItems] = useState(null);
|
const [items, setItems] = useState(null);
|
||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
@@ -136,13 +138,44 @@ const InstructorManagerMieDomandeTable = ({ userId = null, statuses = [] }) => {
|
|||||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleInitiateEvaluation = (id) => {
|
||||||
|
setLocalAsyncRequest(true);
|
||||||
|
AssignedApplicationService.updateStatusAssignedApplication(id, getInitEvalCallback, errInitEvalCallbacks, [
|
||||||
|
['status', 'OPEN']
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
const getInitEvalCallback = (resp) => {
|
||||||
|
if (resp.status === 'SUCCESS') {
|
||||||
|
const evaluation = klona(head(getFormattedData([resp.data])));
|
||||||
|
const newItems = items.map(o => o.id === evaluation.id ? evaluation : o);
|
||||||
|
setItems(newItems);
|
||||||
|
navigate(`/mie-domande/${evaluation.applicationId}`);
|
||||||
|
}
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errInitEvalCallbacks = (resp) => {
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
const actionsBodyTemplate = (rowData) => {
|
const actionsBodyTemplate = (rowData) => {
|
||||||
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
if (rowData.status === 'AWAITING') {
|
||||||
? __('Valuta', 'gepafin')
|
return <Button
|
||||||
: __('Mostra', 'gepafin');
|
severity="info"
|
||||||
return <Link to={`/mie-domande/${rowData.applicationId}`}>
|
onClick={() => handleInitiateEvaluation(rowData.id)}
|
||||||
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
label={__('Valuta', 'gepafin')}
|
||||||
</Link>
|
icon="pi pi-eye"
|
||||||
|
size="small"
|
||||||
|
iconPos="right"/>
|
||||||
|
} else {
|
||||||
|
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
||||||
|
? __('Valuta', 'gepafin')
|
||||||
|
: __('Mostra', 'gepafin');
|
||||||
|
return <Link to={`/mie-domande/${rowData.applicationId}`}>
|
||||||
|
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const header = renderHeader();
|
const header = renderHeader();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect} from 'react';
|
import React, { useState, useEffect} from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { is, uniq, isNil } from 'ramda';
|
import { is, uniq, isNil, head } from 'ramda';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||||
@@ -22,10 +22,12 @@ import { Tag } from 'primereact/tag';
|
|||||||
|
|
||||||
import translationStrings from '../../../../translationStringsForComponents';
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
import { useStore } from '../../../../store';
|
import { useStore } from '../../../../store';
|
||||||
|
import { klona } from 'klona';
|
||||||
|
|
||||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
const PreInstructorDomandeTable = ({ userId = null, statuses = [] }) => {
|
const PreInstructorDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [items, setItems] = useState(null);
|
const [items, setItems] = useState(null);
|
||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
@@ -136,13 +138,44 @@ const PreInstructorDomandeTable = ({ userId = null, statuses = [] }) => {
|
|||||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleInitiateEvaluation = (id) => {
|
||||||
|
setLocalAsyncRequest(true);
|
||||||
|
AssignedApplicationService.updateStatusAssignedApplication(id, getInitEvalCallback, errInitEvalCallbacks, [
|
||||||
|
['status', 'OPEN']
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
const getInitEvalCallback = (resp) => {
|
||||||
|
if (resp.status === 'SUCCESS') {
|
||||||
|
const evaluation = klona(head(getFormattedData([resp.data])));
|
||||||
|
const newItems = items.map(o => o.id === evaluation.id ? evaluation : o);
|
||||||
|
setItems(newItems);
|
||||||
|
navigate(`/domande/${evaluation.applicationId}`);
|
||||||
|
}
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errInitEvalCallbacks = (resp) => {
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
const actionsBodyTemplate = (rowData) => {
|
const actionsBodyTemplate = (rowData) => {
|
||||||
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
if (rowData.status === 'AWAITING') {
|
||||||
? __('Valuta', 'gepafin')
|
return <Button
|
||||||
: __('Mostra', 'gepafin');
|
severity="info"
|
||||||
return <Link to={`/domande/${rowData.applicationId}`}>
|
onClick={() => handleInitiateEvaluation(rowData.id)}
|
||||||
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
label={__('Valuta', 'gepafin')}
|
||||||
</Link>
|
icon="pi pi-eye"
|
||||||
|
size="small"
|
||||||
|
iconPos="right"/>
|
||||||
|
} else {
|
||||||
|
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
||||||
|
? __('Valuta', 'gepafin')
|
||||||
|
: __('Mostra', 'gepafin');
|
||||||
|
return <Link to={`/domande/${rowData.applicationId}`}>
|
||||||
|
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const header = renderHeader();
|
const header = renderHeader();
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
|
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
|
||||||
<div className="appPageSection__row autoFlow">
|
<div className="appPageSection__row autoFlow">
|
||||||
<DownloadApplicationArchive applicationId={id}/>
|
<DownloadApplicationArchive applicationId={id}/>
|
||||||
<DownloadSignedApplication applicationId={id}/>
|
<DownloadSignedApplication applicationId={id}/>
|
||||||
<DownloadCompanyDelegation applicationId={id}/>
|
<DownloadCompanyDelegation applicationId={id}/>
|
||||||
</div>
|
</div>
|
||||||
@@ -666,13 +666,15 @@ const DomandaEditPreInstructor = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
||||||
<ListOfFiles
|
{!isEmpty(data.files)
|
||||||
files={data.files}
|
? <ListOfFiles
|
||||||
updateFn={updateEvaluationValue}
|
files={data.files}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
updateFn={updateEvaluationValue}
|
||||||
name="files"
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
||||||
ndg={data.ndg}
|
name="files"
|
||||||
applicationId={id}/>
|
ndg={data.ndg}
|
||||||
|
applicationId={id}/>
|
||||||
|
: <p>{__('Nessun documento allegato', 'gepafin')}</p>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -668,13 +668,15 @@ const DomandaEditPreInstructor = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
||||||
<ListOfFiles
|
{!isEmpty(data.files)
|
||||||
files={data.files}
|
? <ListOfFiles
|
||||||
updateFn={updateEvaluationValue}
|
files={data.files}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
updateFn={updateEvaluationValue}
|
||||||
name="files"
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
||||||
ndg={data.ndg}
|
name="files"
|
||||||
applicationId={id}/>
|
ndg={data.ndg}
|
||||||
|
applicationId={id}/>
|
||||||
|
: <p>{__('Nessun documento allegato', 'gepafin')}</p>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useStore } from '../../store';
|
|||||||
// components
|
// components
|
||||||
import BeneficiarioDomandeTable from './components/BeneficiarioDomandeTable';
|
import BeneficiarioDomandeTable from './components/BeneficiarioDomandeTable';
|
||||||
|
|
||||||
const DomandePreInstructor = () => {
|
const DomandeBeneficiario = () => {
|
||||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
const companies = useStore().main.companies();
|
const companies = useStore().main.companies();
|
||||||
const company = head(companies.filter(o => o.id === chosenCompanyId));
|
const company = head(companies.filter(o => o.id === chosenCompanyId));
|
||||||
@@ -29,4 +29,4 @@ const DomandePreInstructor = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DomandePreInstructor;
|
export default DomandeBeneficiario;
|
||||||
95
src/pages/SoccorsoIstruttorioInstructorManager/index.js
Normal file
95
src/pages/SoccorsoIstruttorioInstructorManager/index.js
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import DashboardService from '../../service/dashboard-service';
|
||||||
|
import { pathOr } from 'ramda';
|
||||||
|
import NumberFlow from '@number-flow/react';
|
||||||
|
import PreInstructorSoccorsiTable from '../SoccorsoIstruttorioPreInstructor/components/PreInstructorSoccorsiTable';
|
||||||
|
|
||||||
|
const SoccorsoIstruttorioInstructorManager = () => {
|
||||||
|
const [mainStats, setMainStats] = useState({});
|
||||||
|
|
||||||
|
const getStats = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setMainStats(data.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetStats = () => {}
|
||||||
|
|
||||||
|
const getStatValue = (key, fallback = '') => {
|
||||||
|
return pathOr(fallback, [key], mainStats);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
DashboardService.getAmendmentsStats(getStats, errGetStats);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Soccorso istruttorio panoramica', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection statsBigBadges">
|
||||||
|
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||||
|
<div className="statsBigBadges__grid applStats">
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Totale richieste', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('totalAmendments', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('In attesa risposta', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('waitingForResponseAmendments', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Risposte ricevute', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('responseReceivedAmendments', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Tempo medio di risposta', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('averageResponseDays', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
suffix={` ${__('giorni', 'gepafin')}`}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Scadute', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('expiredAmendments', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Richieste in scadenza (48h)', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('expiringRequestsIn48Hours', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="en-US"/></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<PreInstructorSoccorsiTable userId={0}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SoccorsoIstruttorioInstructorManager;
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
import React, { useState, useEffect} from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { is, uniq } from 'ramda';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { storeGet } from '../../../../store';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import AmendmentsService from '../../../../service/amendments-service';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
|
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
|
import { DataTable } from 'primereact/datatable';
|
||||||
|
import { Column } from 'primereact/column';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { Calendar } from 'primereact/calendar';
|
||||||
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
|
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
|
const InstructorManagerSoccorsiTable = () => {
|
||||||
|
const [items, setItems] = useState(null);
|
||||||
|
const [filters, setFilters] = useState(null);
|
||||||
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
|
const [statuses, setStatuses] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const userData = storeGet.main.userData();
|
||||||
|
setLocalAsyncRequest(true);
|
||||||
|
AmendmentsService.getSoccorsi(getCallback, errGetCallbacks, [
|
||||||
|
['userId', userData.id]
|
||||||
|
]);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setItems(getFormattedData(data.data));
|
||||||
|
setStatuses(uniq(data.data.map(o => o.status)))
|
||||||
|
initFilters();
|
||||||
|
}
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallbacks = (data) => {
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedData = (data) => {
|
||||||
|
return data.map((d) => {
|
||||||
|
d.startDate = is(String, d.startDate) ? new Date(d.startDate) : (d.startDate ? d.startDate : '');
|
||||||
|
d.evaluationEndDate = is(String, d.evaluationEndDate) ? new Date(d.evaluationEndDate) : (d.evaluationEndDate ? d.evaluationEndDate : '');
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatDate = (value) => {
|
||||||
|
return value.toLocaleDateString('it-IT', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
year: 'numeric'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearFilter = () => {
|
||||||
|
initFilters();
|
||||||
|
};
|
||||||
|
|
||||||
|
const initFilters = () => {
|
||||||
|
setFilters({
|
||||||
|
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||||
|
callName: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||||
|
},
|
||||||
|
companyName: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||||
|
},
|
||||||
|
startDate: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
|
},
|
||||||
|
evaluationEndDate: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderHeader = () => {
|
||||||
|
return (
|
||||||
|
<div className="appTableHeader">
|
||||||
|
<Button type="button" icon="pi pi-filter-slash" label={__('Pulisci', 'gepafin')} outlined onClick={clearFilter} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateStartBodyTemplate = (rowData) => {
|
||||||
|
return formatDate(rowData.startDate);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateExpirationBodyTemplate = (rowData) => {
|
||||||
|
return rowData.evaluationEndDate ? formatDate(rowData.evaluationEndDate) : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateFilterTemplate = (options) => {
|
||||||
|
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusBodyTemplate = (rowData) => {
|
||||||
|
return <ProperBandoLabel status={rowData.status}/>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusFilterTemplate = (options) => {
|
||||||
|
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusItemTemplate = (option) => {
|
||||||
|
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const actionsBodyTemplate = (rowData) => {
|
||||||
|
return <Link to={`/mie-domande/${rowData.applicationId}/soccorso/${rowData.id}`}>
|
||||||
|
<Button severity="info" label={__('Dettagli', 'gepafin')} size="small" />
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
|
||||||
|
const header = renderHeader();
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPageSection__table">
|
||||||
|
<DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
|
||||||
|
filters={filters} stripedRows removableSort
|
||||||
|
header={header}
|
||||||
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
|
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||||
|
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '6rem' }}/>
|
||||||
|
<Column field="protocolNumber" header={__('Protocollo', 'gepafin')}
|
||||||
|
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '6rem' }}/>
|
||||||
|
<Column field="callName" header={__('Bando', 'gepafin')}
|
||||||
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column field="companyName" header={__('Azienda Beneficiaria', 'gepafin')}
|
||||||
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column header={__('Data richiesta', 'gepafin')}
|
||||||
|
filterField="startDate" dataType="date"
|
||||||
|
style={{ minWidth: '8rem' }}
|
||||||
|
body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column header={__('Scadenza', 'gepafin')}
|
||||||
|
filterField="evaluationEndDate" dataType="date"
|
||||||
|
style={{ minWidth: '8rem' }}
|
||||||
|
body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column field="status" header={__('Stato', 'gepafin')}
|
||||||
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
||||||
|
filterElement={statusFilterTemplate} />
|
||||||
|
<Column header={__('Azioni', 'gepafin')}
|
||||||
|
body={actionsBodyTemplate}/>
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default InstructorManagerSoccorsiTable;
|
||||||
23
src/pages/SoccorsoIstruttorioMioInstructorManager/index.js
Normal file
23
src/pages/SoccorsoIstruttorioMioInstructorManager/index.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import InstructorManagerSoccorsiTable from './components/InstructorManagerSoccorsiTable';
|
||||||
|
|
||||||
|
const SoccorsoIstruttorioMioInstructorManager = () => {
|
||||||
|
return(
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Soccorso istruttorio', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<InstructorManagerSoccorsiTable/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SoccorsoIstruttorioMioInstructorManager;
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
import React, { useState, useEffect} from 'react';
|
import React, { useState, useEffect} from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { is, uniq } from 'ramda';
|
import { is, isNil, uniq } from 'ramda';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
// store
|
|
||||||
import { storeGet } from '../../../../store';
|
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import AmendmentsService from '../../../../service/amendments-service';
|
import AmendmentsService from '../../../../service/amendments-service';
|
||||||
|
|
||||||
@@ -26,17 +23,25 @@ import { Tag } from 'primereact/tag';
|
|||||||
import translationStrings from '../../../../translationStringsForComponents';
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
const PreInstructorSoccorsiTable = ({ userId = null }) => {
|
||||||
const [items, setItems] = useState(null);
|
const [items, setItems] = useState(null);
|
||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
const [statuses, setStatuses] = useState([]);
|
const [statuses, setStatuses] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const userData = storeGet.main.userData()
|
if (!isNil(userId)) {
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
AmendmentsService.getSoccorsoByPreInstructorId(userData.id, getCallback, errGetCallbacks);
|
|
||||||
}, []);
|
if (userId === 0) {
|
||||||
|
AmendmentsService.getSoccorsi(getCallback, errGetCallbacks);
|
||||||
|
} else {
|
||||||
|
AmendmentsService.getSoccorsi(getCallback, errGetCallbacks, [
|
||||||
|
['userId', userId]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [userId]);
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { pathOr } from 'ramda';
|
||||||
|
import NumberFlow from '@number-flow/react';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { useStore } from '../../store';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import PreInstructorSoccorsiTable from './components/PreInstructorSoccorsiTable';
|
import PreInstructorSoccorsiTable from './components/PreInstructorSoccorsiTable';
|
||||||
import DashboardService from '../../service/dashboard-service';
|
import DashboardService from '../../service/dashboard-service';
|
||||||
import { pathOr } from 'ramda';
|
|
||||||
import NumberFlow from '@number-flow/react';
|
|
||||||
|
|
||||||
const SoccorsoIstruttorioPreInstructor = () => {
|
const SoccorsoIstruttorioPreInstructor = () => {
|
||||||
const [mainStats, setMainStats] = useState({});
|
const [mainStats, setMainStats] = useState({});
|
||||||
|
const userData = useStore().main.userData()
|
||||||
|
|
||||||
const getStats = (data) => {
|
const getStats = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
@@ -29,7 +33,7 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
|||||||
return(
|
return(
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
<div className="appPage__pageHeader">
|
<div className="appPage__pageHeader">
|
||||||
<h1>{__('Soccorso Istruttorio', 'gepafin')}</h1>
|
<h1>{__('Soccorso istruttorio', 'gepafin')}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
@@ -86,7 +90,7 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
|||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<PreInstructorSoccorsiTable/>
|
<PreInstructorSoccorsiTable userId={userData.id}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ import DashboardInstructorManager from './pages/DashboardInstructorManager';
|
|||||||
import DomandeMieInstructorManager from './pages/DomandeMieInstructorManager';
|
import DomandeMieInstructorManager from './pages/DomandeMieInstructorManager';
|
||||||
import SoccorsoAddInstructorManager from './pages/SoccorsoAddInstructorManager';
|
import SoccorsoAddInstructorManager from './pages/SoccorsoAddInstructorManager';
|
||||||
import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager';
|
import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager';
|
||||||
|
import SoccorsoIstruttorioInstructorManager from './pages/SoccorsoIstruttorioInstructorManager';
|
||||||
|
import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager';
|
||||||
|
|
||||||
const routes = ({ role, chosenCompanyId }) => {
|
const routes = ({ role, chosenCompanyId }) => {
|
||||||
|
|
||||||
@@ -160,7 +162,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
||||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioInstructorManager/> : null}
|
||||||
</DefaultLayout>}/>
|
</DefaultLayout>}/>
|
||||||
<Route path="/mie-domande" element={<DefaultLayout>
|
<Route path="/mie-domande" element={<DefaultLayout>
|
||||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
@@ -190,7 +192,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioMioInstructorManager/> : null}
|
||||||
</DefaultLayout>}/>
|
</DefaultLayout>}/>
|
||||||
<Route path="/imieibandi" element={<DefaultLayout>
|
<Route path="/imieibandi" element={<DefaultLayout>
|
||||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ export default class AmendmentsService {
|
|||||||
NetworkService.get(`${API_BASE_URL}/amendments`, callback, errCallback, queryParams);
|
NetworkService.get(`${API_BASE_URL}/amendments`, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
static getSoccorsoByPreInstructorId = (id, callback, errCallback, queryParams) => {
|
static getSoccorsi = (callback, errCallback, queryParams) => {
|
||||||
NetworkService.get(`${API_BASE_URL}/amendments/user/${id}`, callback, errCallback, queryParams);
|
NetworkService.get(`${API_BASE_URL}/amendments/user`, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
static createSoccorso = (body, callback, errCallback, queryParams) => {
|
static createSoccorso = (body, callback, errCallback, queryParams) => {
|
||||||
|
|||||||
@@ -11,4 +11,8 @@ export default class AssignedApplicationService {
|
|||||||
static assignApplication = (id, callback, errCallback, queryParams) => {
|
static assignApplication = (id, callback, errCallback, queryParams) => {
|
||||||
NetworkService.post(`${API_BASE_URL}/assignedApplication/application/${id}`, {}, callback, errCallback, queryParams);
|
NetworkService.post(`${API_BASE_URL}/assignedApplication/application/${id}`, {}, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static updateStatusAssignedApplication = (id, callback, errCallback, queryParams) => {
|
||||||
|
NetworkService.put(`${API_BASE_URL}/assignedApplication/${id}/status`, {}, callback, errCallback, queryParams);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user