- added updating status for initiating evaluation process;
- fixed issues with displaying and calcuating decimals in appl form;
This commit is contained in:
@@ -35,6 +35,10 @@
|
||||
background-color: var(--table-border-color);
|
||||
}
|
||||
|
||||
&.p-tag-tertiary {
|
||||
background-color: var(--card-full-background-color-6);
|
||||
}
|
||||
|
||||
.p-tag-value {
|
||||
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 [isVariable, setIsVariable] = useState('secondary');
|
||||
const [isFormula, setIsFormula] = useState('secondary');
|
||||
const [isRequestedAmount, setIsRequestedAmount] = useState(false);
|
||||
const [isDelegation, setIsDelegation] = useState(false);
|
||||
|
||||
const [{ handlerId }, drop] = useDrop({
|
||||
accept: ItemTypes.FIELD,
|
||||
@@ -105,6 +107,8 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
||||
useEffect(() => {
|
||||
const variable = head(element.settings.filter(o => o.name === 'variable'));
|
||||
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)) {
|
||||
setIsVariable('warning');
|
||||
@@ -113,6 +117,14 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
||||
if (formula && !isEmpty(formula.value)) {
|
||||
setIsFormula('warning');
|
||||
}
|
||||
|
||||
if (isRequestedAmount && !isEmpty(isRequestedAmount.value) && isRequestedAmount.value) {
|
||||
setIsRequestedAmount('tertiary');
|
||||
}
|
||||
|
||||
if (isDelegation && !isEmpty(isDelegation.value) && isDelegation.value) {
|
||||
setIsDelegation('tertiary');
|
||||
}
|
||||
}, [elements]);
|
||||
|
||||
return (
|
||||
@@ -128,6 +140,10 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
||||
? <Tag value="var" severity={isVariable}/> : null}
|
||||
{name === 'numberinput'
|
||||
? <Tag value="f(x)" severity={isFormula}/> : null}
|
||||
{isRequestedAmount
|
||||
? <Tag value="importo" severity={isRequestedAmount}/> : null}
|
||||
{isDelegation
|
||||
? <Tag value="delega" severity={isDelegation}/> : null}
|
||||
</div>
|
||||
<BuilderElementProperLabel id={id} defaultLabel={label}/>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect} from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { is, uniq, isNil } from 'ramda';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { is, uniq, isNil, head } from 'ramda';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
|
||||
// api
|
||||
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||
@@ -22,10 +22,12 @@ import { Tag } from 'primereact/tag';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
import { useStore } from '../../../../store';
|
||||
import { klona } from 'klona';
|
||||
|
||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
|
||||
const InstructorManagerMieDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||
const navigate = useNavigate();
|
||||
const [items, setItems] = useState(null);
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||
@@ -136,7 +138,37 @@ const InstructorManagerMieDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||
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) => {
|
||||
if (rowData.status === 'AWAITING') {
|
||||
return <Button
|
||||
severity="info"
|
||||
onClick={() => handleInitiateEvaluation(rowData.id)}
|
||||
label={__('Valuta', 'gepafin')}
|
||||
icon="pi pi-eye"
|
||||
size="small"
|
||||
iconPos="right"/>
|
||||
} else {
|
||||
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
||||
? __('Valuta', 'gepafin')
|
||||
: __('Mostra', 'gepafin');
|
||||
@@ -144,6 +176,7 @@ const InstructorManagerMieDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||
</Link>
|
||||
}
|
||||
}
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect} from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { is, uniq, isNil } from 'ramda';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { is, uniq, isNil, head } from 'ramda';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
|
||||
// api
|
||||
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||
@@ -22,10 +22,12 @@ import { Tag } from 'primereact/tag';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
import { useStore } from '../../../../store';
|
||||
import { klona } from 'klona';
|
||||
|
||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
|
||||
const PreInstructorDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||
const navigate = useNavigate();
|
||||
const [items, setItems] = useState(null);
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||
@@ -136,7 +138,37 @@ const PreInstructorDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||
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) => {
|
||||
if (rowData.status === 'AWAITING') {
|
||||
return <Button
|
||||
severity="info"
|
||||
onClick={() => handleInitiateEvaluation(rowData.id)}
|
||||
label={__('Valuta', 'gepafin')}
|
||||
icon="pi pi-eye"
|
||||
size="small"
|
||||
iconPos="right"/>
|
||||
} else {
|
||||
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
||||
? __('Valuta', 'gepafin')
|
||||
: __('Mostra', 'gepafin');
|
||||
@@ -144,6 +176,7 @@ const PreInstructorDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||
</Link>
|
||||
}
|
||||
}
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
|
||||
@@ -666,13 +666,15 @@ const DomandaEditPreInstructor = () => {
|
||||
</div>
|
||||
<div>
|
||||
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
||||
<ListOfFiles
|
||||
{!isEmpty(data.files)
|
||||
? <ListOfFiles
|
||||
files={data.files}
|
||||
updateFn={updateEvaluationValue}
|
||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
||||
name="files"
|
||||
ndg={data.ndg}
|
||||
applicationId={id}/>
|
||||
: <p>{__('Nessun documento allegato', 'gepafin')}</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -668,13 +668,15 @@ const DomandaEditPreInstructor = () => {
|
||||
</div>
|
||||
<div>
|
||||
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
||||
<ListOfFiles
|
||||
{!isEmpty(data.files)
|
||||
? <ListOfFiles
|
||||
files={data.files}
|
||||
updateFn={updateEvaluationValue}
|
||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
||||
name="files"
|
||||
ndg={data.ndg}
|
||||
applicationId={id}/>
|
||||
: <p>{__('Nessun documento allegato', 'gepafin')}</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useStore } from '../../store';
|
||||
// components
|
||||
import BeneficiarioDomandeTable from './components/BeneficiarioDomandeTable';
|
||||
|
||||
const DomandePreInstructor = () => {
|
||||
const DomandeBeneficiario = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const companies = useStore().main.companies();
|
||||
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 { __ } from '@wordpress/i18n';
|
||||
import { is, uniq } from 'ramda';
|
||||
import { is, isNil, uniq } from 'ramda';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
// store
|
||||
import { storeGet } from '../../../../store';
|
||||
|
||||
// api
|
||||
import AmendmentsService from '../../../../service/amendments-service';
|
||||
|
||||
@@ -26,17 +23,25 @@ import { Tag } from 'primereact/tag';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
||||
const PreInstructorSoccorsiTable = ({ userId = null }) => {
|
||||
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()
|
||||
if (!isNil(userId)) {
|
||||
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) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { pathOr } from 'ramda';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
|
||||
// store
|
||||
import { useStore } from '../../store';
|
||||
|
||||
// components
|
||||
import PreInstructorSoccorsiTable from './components/PreInstructorSoccorsiTable';
|
||||
import DashboardService from '../../service/dashboard-service';
|
||||
import { pathOr } from 'ramda';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
|
||||
const SoccorsoIstruttorioPreInstructor = () => {
|
||||
const [mainStats, setMainStats] = useState({});
|
||||
const userData = useStore().main.userData()
|
||||
|
||||
const getStats = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
@@ -29,7 +33,7 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
||||
return(
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{__('Soccorso Istruttorio', 'gepafin')}</h1>
|
||||
<h1>{__('Soccorso istruttorio', 'gepafin')}</h1>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
@@ -86,7 +90,7 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<PreInstructorSoccorsiTable/>
|
||||
<PreInstructorSoccorsiTable userId={userData.id}/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -48,6 +48,8 @@ import DashboardInstructorManager from './pages/DashboardInstructorManager';
|
||||
import DomandeMieInstructorManager from './pages/DomandeMieInstructorManager';
|
||||
import SoccorsoAddInstructorManager from './pages/SoccorsoAddInstructorManager';
|
||||
import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager';
|
||||
import SoccorsoIstruttorioInstructorManager from './pages/SoccorsoIstruttorioInstructorManager';
|
||||
import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager';
|
||||
|
||||
const routes = ({ role, chosenCompanyId }) => {
|
||||
|
||||
@@ -160,7 +162,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioInstructorManager/> : null}
|
||||
</DefaultLayout>}/>
|
||||
<Route path="/mie-domande" element={<DefaultLayout>
|
||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||
@@ -190,7 +192,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioMioInstructorManager/> : null}
|
||||
</DefaultLayout>}/>
|
||||
<Route path="/imieibandi" element={<DefaultLayout>
|
||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||
|
||||
@@ -16,8 +16,8 @@ export default class AmendmentsService {
|
||||
NetworkService.get(`${API_BASE_URL}/amendments`, callback, errCallback, queryParams);
|
||||
};
|
||||
|
||||
static getSoccorsoByPreInstructorId = (id, callback, errCallback, queryParams) => {
|
||||
NetworkService.get(`${API_BASE_URL}/amendments/user/${id}`, callback, errCallback, queryParams);
|
||||
static getSoccorsi = (callback, errCallback, queryParams) => {
|
||||
NetworkService.get(`${API_BASE_URL}/amendments/user`, callback, errCallback, queryParams);
|
||||
};
|
||||
|
||||
static createSoccorso = (body, callback, errCallback, queryParams) => {
|
||||
|
||||
@@ -11,4 +11,8 @@ export default class AssignedApplicationService {
|
||||
static assignApplication = (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