- page benficiary domanda/soccorso;
- fixed fetching data in overview tables for beneficiary/pre instructor; - fixed styles;
This commit is contained in:
@@ -36,7 +36,8 @@ const MyLatestSubmissionsTable = () => {
|
||||
useEffect(() => {
|
||||
setLocalAsyncRequest(true);
|
||||
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
|
||||
['companyId', chosenCompanyId]
|
||||
['companyId', chosenCompanyId],
|
||||
['statuses', ['DRAFT', 'SUBMIT', 'AWAITING', 'READY', 'DISCARD']]
|
||||
])
|
||||
}, [chosenCompanyId]);
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@ const PreInstructorDomandeTable = () => {
|
||||
|
||||
useEffect(() => {
|
||||
setLocalAsyncRequest(true);
|
||||
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [['userId', userData.id]]);
|
||||
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [
|
||||
['userId', userData.id]
|
||||
]);
|
||||
}, []);
|
||||
|
||||
const getCallback = (data) => {
|
||||
@@ -132,10 +134,6 @@ const PreInstructorDomandeTable = () => {
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
const createEvaluation = (id) => {
|
||||
console.log('createEvaluation:', id)
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="appPageSection__table">
|
||||
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id"
|
||||
@@ -144,7 +142,7 @@ const PreInstructorDomandeTable = () => {
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column field="callName" header={__('Bando', 'gepafin')}
|
||||
|
||||
391
src/pages/DomandaBeneficiario/index.js
Normal file
391
src/pages/DomandaBeneficiario/index.js
Normal file
@@ -0,0 +1,391 @@
|
||||
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||
import { __, sprintf } from '@wordpress/i18n';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { is, isEmpty, isNil } from 'ramda';
|
||||
import { wrap } from 'object-path-immutable';
|
||||
import { klona } from 'klona';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
|
||||
// api
|
||||
import AmendmentsService from '../../service/amendments-service';
|
||||
import CommunicationService from '../../service/communication-service';
|
||||
|
||||
// tools
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import getBandoLabel from '../../helpers/getBandoLabel';
|
||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import uniqid from '../../helpers/uniqid';
|
||||
|
||||
// components
|
||||
import { Button } from 'primereact/button';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import { classNames } from 'primereact/utils';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { InputTextarea } from 'primereact/inputtextarea';
|
||||
import FormField from '../../components/FormField';
|
||||
import { Editor } from 'primereact/editor';
|
||||
import { InputNumber } from 'primereact/inputnumber';
|
||||
|
||||
const DomandaBeneficiario = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [data, setData] = useState({});
|
||||
const [comms, setComms] = useState([]);
|
||||
const [isVisibleNewCommDialog, setIsVisibleNewCommDialog] = useState(false);
|
||||
const [newCommData, setNewCommData] = useState({});
|
||||
const [isLoadingCommunication, setIsLoadingCommunication] = useState(false);
|
||||
const [isVisibleExtendTimeDialog, setIsVisibleExtendTimeDialog] = useState(false);
|
||||
const [extendedTime, setExtendedTime] = useState(3);
|
||||
const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false);
|
||||
const [isLoadingReminding, setIsLoadingReminding] = useState(false);
|
||||
const toast = useRef(null);
|
||||
const [formInitialData, setFormInitialData] = useState({});
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors, isValid },
|
||||
setValue,
|
||||
register,
|
||||
trigger,
|
||||
getValues,
|
||||
clearErrors
|
||||
} = useForm({
|
||||
defaultValues: useMemo(() => {
|
||||
return formInitialData;
|
||||
}, [formInitialData]), mode: 'onChange'
|
||||
});
|
||||
|
||||
const goToArchivePage = () => {
|
||||
navigate(`/domande`);
|
||||
}
|
||||
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setData(getFormattedData(data.data));
|
||||
//CommunicationService.getCommsByAmendmentId(data.data.id, getCommsCallback, errGetCommsCallback);
|
||||
}
|
||||
//storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errGetCallback = (data) => {
|
||||
if (toast.current && data.message) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getCommsCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setComms(data.data.commentsList.map(o => getFormattedCommsData(o)));
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errGetCommsCallback = (data) => {
|
||||
if (toast.current && data.message) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getFormattedData = (data) => {
|
||||
data.startDate = is(String, data.startDate) ? new Date(data.startDate) : (data.startDate ? data.startDate : '');
|
||||
data.expirationDate = is(String, data.expirationDate) ? new Date(data.expirationDate) : (data.expirationDate ? data.expirationDate : '');
|
||||
return data;
|
||||
};
|
||||
|
||||
const getFormattedCommsData = (data) => {
|
||||
data.id = isNil(data.id) ? uniqid('id') : data.id;
|
||||
data.commentedDate = is(String, data.commentedDate) ? new Date(data.commentedDate) : (data.commentedDate ? data.commentedDate : '');
|
||||
data.createdDate = is(String, data.createdDate) ? new Date(data.createdDate) : (data.createdDate ? data.createdDate : '');
|
||||
data.updatedDate = is(String, data.updatedDate) ? new Date(data.updatedDate) : (data.updatedDate ? data.updatedDate : '');
|
||||
return data;
|
||||
};
|
||||
|
||||
const headerNewComDialog = () => {
|
||||
return <span>{__('Aggiungi comunicazione', 'gepafin')}</span>
|
||||
}
|
||||
|
||||
const hideNewComDialog = () => {
|
||||
setIsVisibleNewCommDialog(false);
|
||||
setNewCommData({
|
||||
title: '',
|
||||
comment: ''
|
||||
});
|
||||
}
|
||||
|
||||
const footerNewComDialog = () => {
|
||||
return <div>
|
||||
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideNewComDialog} outlined/>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={isLoadingCommunication || isEmpty(newCommData.title) || isEmpty(newCommData.comment)}
|
||||
label={__('Invia', 'gepafin')} onClick={createCommunication}/>
|
||||
</div>
|
||||
}
|
||||
|
||||
const openNewCommDialog = () => {
|
||||
setIsVisibleNewCommDialog(true);
|
||||
setNewCommData({
|
||||
title: '',
|
||||
comment: ''
|
||||
});
|
||||
}
|
||||
|
||||
const updateNewCommData = (value, path) => {
|
||||
const newData = wrap(newCommData).set(path.split('.'), value).value();
|
||||
setNewCommData(newData);
|
||||
}
|
||||
|
||||
const renderHeader = () => {
|
||||
return (
|
||||
<span className="ql-formats">
|
||||
<button className="ql-bold" aria-label="Bold"></button>
|
||||
<button className="ql-italic" aria-label="Italic"></button>
|
||||
<button className="ql-underline" aria-label="Underline"></button>
|
||||
<button className="ql-link" aria-label="Link"></button>
|
||||
<button className="ql-list" value="ordered"></button>
|
||||
<button className="ql-header" value="2"></button>
|
||||
<button className="ql-header" value="3"></button>
|
||||
<button className="ql-blockquote"></button>
|
||||
<button className="ql-list" value="bullet"></button>
|
||||
<button className="ql-indent" value="-1"></button>
|
||||
<button className="ql-indent" value="+1"></button>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
const updateNewAmendmentData = (value, path) => {
|
||||
const newData = wrap(data).set(path.split('.'), value).value();
|
||||
setData(newData);
|
||||
}
|
||||
|
||||
const createCommunication = () => {
|
||||
setIsLoadingCommunication(true);
|
||||
const amendmentId = 0
|
||||
CommunicationService.createCommunication(amendmentId, newCommData, createCommunicationCallback, errCreateCommunicationCallback);
|
||||
}
|
||||
|
||||
const createCommunicationCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
setComms([...comms, getFormattedCommsData(data.data)])
|
||||
setIsVisibleNewCommDialog(false);
|
||||
}
|
||||
setIsLoadingCommunication(false);
|
||||
}
|
||||
|
||||
const errCreateCommunicationCallback = (data) => {
|
||||
if (toast.current && data.message) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(data);
|
||||
setIsLoadingCommunication(false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const parsedId = parseInt(id);
|
||||
const entityId = !isNaN(parsedId) ? parsedId : 0;
|
||||
|
||||
AmendmentsService.getSoccorsoByApplId(entityId, getCallback, errGetCallback, [
|
||||
['statuses', 'AWAITING']
|
||||
]);
|
||||
}, [id]);
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{sprintf(__('Soccorso Istruttorio: richiesta integrazione documenti per domanda #%s', 'gepafin'), id)}</h1>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
<Toast ref={toast}/>
|
||||
<BlockingOverlay shouldDisplay={isAsyncRequest}/>
|
||||
|
||||
<div className="appPageSection__row">
|
||||
<Button
|
||||
type="button"
|
||||
outlined
|
||||
onClick={goToArchivePage}
|
||||
label={__('Indietro', 'gepafin')}
|
||||
icon="pi pi-arrow-left" iconPos="left"/>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPage__content">
|
||||
<div className="appPageSection__withBorder columns">
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('ID domanda', 'gepafin')}</span>
|
||||
<span>{data.applicationId}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Bando', 'gepafin')}</span>
|
||||
<span>{data.callName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Beneficiario', 'gepafin')}</span>
|
||||
<span>{data.beneficiaryName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Inizio', 'gepafin')}</span>
|
||||
<span>{getDateFromISOstring(data.startDate)}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Scadenza', 'gepafin')}</span>
|
||||
<span>{getDateFromISOstring(data.expirationDate)}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Stato', 'gepafin')}</span>
|
||||
<span>{getBandoLabel(data.status)}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Dettagli Richiesta', 'gepafin')}</h2>
|
||||
<div className="appPageSection columns">
|
||||
<div>
|
||||
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
||||
<ol className="appPageSection__list">
|
||||
{data.formFields
|
||||
? data.formFields.map((o, i) => <li key={o.fieldId} style={{ flexDirection: 'row' }}>
|
||||
<span>{o.label}</span>
|
||||
</li>) : null}
|
||||
</ol>
|
||||
</div>
|
||||
<div>
|
||||
<h3>{__('Note e spiegazioni', 'gepafin')}</h3>
|
||||
<div className="appPageSection__withBorder grey ql-editor"
|
||||
style={{ minHeight: '200px' }}>
|
||||
{renderHtmlContent(data.note)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
||||
<table className="myTable">
|
||||
<thead className="myThead">
|
||||
<tr>
|
||||
<th style={{ width: 250 }}>{__('Data', 'gepafin')}</th>
|
||||
<th>{__('Comunicazione', 'gepafin')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="myTbody">
|
||||
{!isNil(comms) && !isEmpty(comms)
|
||||
? comms.map((o, i) => <tr key={o.id}>
|
||||
<td valign="top">
|
||||
{getDateFromISOstring(o.commentedDate)}
|
||||
</td>
|
||||
<td>
|
||||
<h3>{o.title}</h3>
|
||||
<p>{o.comment}</p>
|
||||
</td>
|
||||
</tr>)
|
||||
: <tr>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
</tr>}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<Button
|
||||
style={{ marginTop: 30 }}
|
||||
onClick={openNewCommDialog}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
type="button"
|
||||
label={__('Aggiungi Comunicazione', 'gepafin')}
|
||||
icon="pi pi-plus" iconPos="right"/>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection__message warning">
|
||||
<i className="pi pi-exclamation-triangle"></i>
|
||||
<span className="summary">{__('Attenzione', 'gepafin')}</span>
|
||||
<span>{__('Inviare la documentazione richiesta completa delle integrazioni esclusivamente via PEC. In caso contarrio l’integrazione non può essere ritenuta valida.', 'gepafin')}</span>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<div className="appPageSection__actions">
|
||||
<Button
|
||||
type="button"
|
||||
disabled={isAsyncRequest}
|
||||
label={__('Invia documenti via PEC', 'gepafin')}
|
||||
icon="pi pi-envelope" iconPos="right"/>
|
||||
<Button
|
||||
type="button"
|
||||
outlined
|
||||
disabled={isAsyncRequest}
|
||||
label={__('Chiudi', 'gepafin')}
|
||||
icon="pi pi-times" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
visible={isVisibleNewCommDialog}
|
||||
modal
|
||||
header={headerNewComDialog}
|
||||
footer={footerNewComDialog}
|
||||
style={{ maxWidth: '600px', width: '100%' }}
|
||||
onHide={hideNewComDialog}>
|
||||
<div className="appForm__field">
|
||||
<label
|
||||
className={classNames({ 'p-error': isEmpty(newCommData.title) })}>
|
||||
{__('Titolo', 'gepafin')}*
|
||||
</label>
|
||||
<InputText value={newCommData.title}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
invalid={isEmpty(newCommData.title)}
|
||||
onChange={(e) => updateNewCommData(e.target.value, 'title')}/>
|
||||
|
||||
<label
|
||||
className={classNames({ 'p-error': isEmpty(newCommData.comment) })}>
|
||||
{__('Contenuto', 'gepafin')}*
|
||||
</label>
|
||||
<InputTextarea
|
||||
value={newCommData.comment}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
rows={5} cols={30}
|
||||
invalid={isEmpty(newCommData.comment)}
|
||||
onChange={(e) => updateNewCommData(e.target.value, 'comment')}/>
|
||||
</div>
|
||||
</Dialog>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
export default DomandaBeneficiario;
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { __, sprintf } from '@wordpress/i18n';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { is, isEmpty, isNil, sum, pathOr } from 'ramda';
|
||||
import { is, isEmpty, isNil, sum, pathOr, head } from 'ramda';
|
||||
import { klona } from 'klona';
|
||||
import { wrap } from 'object-path-immutable';
|
||||
|
||||
@@ -26,13 +26,16 @@ import { InputNumber } from 'primereact/inputnumber';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import HelpIcon from '../../icons/HelpIcon';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
|
||||
const DomandaEditPreInstructor = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [data, setData] = useState({});
|
||||
const [message, setMessage] = useState('');
|
||||
const [isVisibleCriterionData, setIsVisibleCriterionData] = useState(0);
|
||||
const [criterionDataTitle, setCriterionDataTitle] = useState('');
|
||||
const [criterionDataContent, setCriterionDataContent] = useState('');
|
||||
const [isAdmissible, setIsAdmissible] = useState(false);
|
||||
const toast = useRef(null);
|
||||
|
||||
@@ -107,7 +110,7 @@ const DomandaEditPreInstructor = () => {
|
||||
files: klona(data.files),
|
||||
note: data.note
|
||||
}
|
||||
ApplicationEvaluationService.updateEvaluation(id, formData, updateCallback, errUpdateCallback);
|
||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateCallback, errUpdateCallback);
|
||||
}
|
||||
|
||||
const updateCallback = (data) => {
|
||||
@@ -135,6 +138,66 @@ const DomandaEditPreInstructor = () => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const doApprove = () => {
|
||||
const formData = {
|
||||
status: 'APPROVED'
|
||||
}
|
||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
||||
}
|
||||
|
||||
const doReject = () => {
|
||||
const formData = {
|
||||
status: 'REJECTED'
|
||||
}
|
||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
||||
}
|
||||
|
||||
const updateStatusCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errUpdateStatusCallback = (data) => {
|
||||
if (toast.current && data.message) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const displayCriterionData = (id) => {
|
||||
const criterion = head(data.criteria.filter(o => o.id === id));
|
||||
console.log(id, criterion);
|
||||
setCriterionDataTitle(criterion.label);
|
||||
const content = <div className="criterionRelatedData">
|
||||
<h3>{__('I campi correlati')}</h3>
|
||||
{criterion.criteriaMappedFields.map(o => <div key={o.id} className="criterionRelatedData__item">
|
||||
<strong>{o.fieldLabel}</strong>
|
||||
{o.fieldValue}
|
||||
</div>)}
|
||||
</div>;
|
||||
setCriterionDataContent(content);
|
||||
setIsVisibleCriterionData(id);
|
||||
}
|
||||
|
||||
const hideCriterionData = () => {
|
||||
setIsVisibleCriterionData(0);
|
||||
setCriterionDataTitle('');
|
||||
setCriterionDataContent('');
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const maxScore = pathOr(0, ['minScore'], data);
|
||||
const criteria = pathOr([], ['criteria'], data);
|
||||
@@ -236,7 +299,9 @@ const DomandaEditPreInstructor = () => {
|
||||
<td>
|
||||
<div className="appPageSection__iconActions">
|
||||
{!isEmpty(o.criteriaMappedFields)
|
||||
? <Button icon="pi pi-eye" rounded outlined severity="info"
|
||||
? <Button icon="pi pi-eye"
|
||||
rounded outlined severity="info"
|
||||
onClick={() => displayCriterionData(o.id)}
|
||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||
@@ -280,8 +345,9 @@ const DomandaEditPreInstructor = () => {
|
||||
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
|
||||
<div className="appPageSection columns">
|
||||
<div>
|
||||
|
||||
<h3>{__('Lista', 'gepafin')}</h3>
|
||||
<div className="appPageSection__withBorder grey">
|
||||
<div className="appPageSection__withBorder grey" style={{ marginBottom: '20px' }}>
|
||||
<div className="appPageSection__checklist">
|
||||
{data.checklist.map((o, i) => <div key={o.id}>
|
||||
<Checkbox
|
||||
@@ -305,7 +371,7 @@ const DomandaEditPreInstructor = () => {
|
||||
onTextChange={(e) => updateEvaluationValue(
|
||||
e.htmlValue,
|
||||
'note'
|
||||
)}
|
||||
)}
|
||||
style={{ height: 80 * 3, width: '100%' }}
|
||||
/>
|
||||
</div>
|
||||
@@ -314,28 +380,58 @@ const DomandaEditPreInstructor = () => {
|
||||
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
||||
<ol className="appPageSection__list">
|
||||
{data.files.map((o, i) => <li key={o.id}>
|
||||
<span>{o.label}</span>
|
||||
<div className="appPageSection__iconActions">
|
||||
{o.fileDetail.length === 1
|
||||
? <Button icon="pi pi-eye" rounded
|
||||
onClick={() => window.open(o.fileDetail[0].filePath, '_blank').focus()}
|
||||
outlined severity="info"
|
||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
true,
|
||||
`files.${i}.valid`
|
||||
)}
|
||||
aria-label={__('Su', 'gepafin')}/>
|
||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
false,
|
||||
`files.${i}.valid`
|
||||
)}
|
||||
aria-label={__('Giu', 'gepafin')}/>
|
||||
<div className="appPageSection" style={{
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between'
|
||||
}}>
|
||||
<span>{o.label}</span>
|
||||
<div className="appPageSection__iconActions">
|
||||
{o.fileDetail.length === 1
|
||||
? <Button icon="pi pi-eye" rounded
|
||||
onClick={() => window.open(o.fileDetail[0].filePath, '_blank').focus()}
|
||||
outlined severity="info"
|
||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
true,
|
||||
`files.${i}.valid`
|
||||
)}
|
||||
aria-label={__('Su', 'gepafin')}/>
|
||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
false,
|
||||
`files.${i}.valid`
|
||||
)}
|
||||
aria-label={__('Giu', 'gepafin')}/>
|
||||
</div>
|
||||
</div>
|
||||
{o.fileDetail.length > 1
|
||||
? <ul style={{
|
||||
width: '100%',
|
||||
paddingLeft: '15px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '10px'
|
||||
}}>
|
||||
{o.fileDetail.map((k, i) => <li key={k.id} style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between'
|
||||
}}>
|
||||
<span>{k.name}</span>
|
||||
<div className="appPageSection__iconActions">
|
||||
<Button icon="pi pi-eye" rounded
|
||||
onClick={() => window.open(k.filePath, '_blank').focus()}
|
||||
outlined severity="info"
|
||||
aria-label={__('Mostra', 'gepafin')}/>
|
||||
</div>
|
||||
</li>)}
|
||||
</ul>
|
||||
: null}
|
||||
</li>)}
|
||||
</ol>
|
||||
</div>
|
||||
@@ -370,15 +466,25 @@ const DomandaEditPreInstructor = () => {
|
||||
<Button
|
||||
type="button"
|
||||
disabled={!isAdmissible}
|
||||
onClick={doApprove}
|
||||
label={__('Approva Domanda', 'gepafin')}
|
||||
icon="pi pi-check" iconPos="right"/>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={doReject}
|
||||
label={__('Respingi Domanda', 'gepafin')}
|
||||
icon="pi pi-times" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
header={criterionDataTitle}
|
||||
visible={isVisibleCriterionData !== 0}
|
||||
style={{ width: '50vw' }}
|
||||
onHide={hideCriterionData}>
|
||||
{criterionDataContent}
|
||||
</Dialog>
|
||||
|
||||
</div>
|
||||
: <>
|
||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||
|
||||
@@ -30,7 +30,9 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
||||
|
||||
useEffect(() => {
|
||||
setLocalAsyncRequest(true);
|
||||
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'SUBMIT']]);
|
||||
ApplicationService.getApplications(getCallback, errGetCallbacks, [
|
||||
['statuses', 'SUBMIT']
|
||||
]);
|
||||
}, [updaterString]);
|
||||
|
||||
const getCallback = (data) => {
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { is, uniq } from 'ramda';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
// store
|
||||
import { useStore } from '../../../../store';
|
||||
|
||||
// api
|
||||
import ApplicationService from '../../../../service/application-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 { InputText } from 'primereact/inputtext';
|
||||
import { IconField } from 'primereact/iconfield';
|
||||
import { InputIcon } from 'primereact/inputicon';
|
||||
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';
|
||||
|
||||
|
||||
const BeneficiarioDomandeTable = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const [items, setItems] = useState(null);
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||
const [statuses, setStatuses] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
setLocalAsyncRequest(true);
|
||||
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
|
||||
['companyId', chosenCompanyId],
|
||||
['statuses', ['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION']]
|
||||
])
|
||||
}, [chosenCompanyId]);
|
||||
|
||||
const getApplCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (is(Array, data.data)) {
|
||||
setItems(getFormattedBandiData(data.data));
|
||||
setStatuses(uniq(items.map(o => o.status)))
|
||||
initFilters();
|
||||
}
|
||||
}
|
||||
setLocalAsyncRequest(false);
|
||||
}
|
||||
|
||||
const errGetApplCallback = (data) => {
|
||||
setLocalAsyncRequest(false);
|
||||
}
|
||||
|
||||
const getFormattedBandiData = (data) => {
|
||||
return [...(data || [])].map((d) => {
|
||||
d.callEndDate = new Date(d.callEndDate);
|
||||
d.modifiedDate = new Date(d.modifiedDate);
|
||||
d.submissionDate = new Date(d.submissionDate);
|
||||
|
||||
return d;
|
||||
});
|
||||
};
|
||||
|
||||
const formatDate = (value) => {
|
||||
return value.toLocaleDateString('it-IT', {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric'
|
||||
});
|
||||
};
|
||||
|
||||
const clearFilter = () => {
|
||||
initFilters();
|
||||
};
|
||||
|
||||
const onGlobalFilterChange = (e) => {
|
||||
const value = e.target.value;
|
||||
let _filters = { ...filters };
|
||||
|
||||
_filters['global'].value = value;
|
||||
|
||||
setFilters(_filters);
|
||||
setGlobalFilterValue(value);
|
||||
};
|
||||
|
||||
const initFilters = () => {
|
||||
setFilters({
|
||||
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||
callTitle: {
|
||||
operator: FilterOperator.AND,
|
||||
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||
},
|
||||
modifiedDate: {
|
||||
operator: FilterOperator.AND,
|
||||
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||
},
|
||||
callEndDate: {
|
||||
operator: FilterOperator.AND,
|
||||
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||
}
|
||||
});
|
||||
setGlobalFilterValue('');
|
||||
};
|
||||
|
||||
const renderHeader = () => {
|
||||
return (
|
||||
<div className="appTableHeader">
|
||||
<Button type="button" icon="pi pi-filter-slash" label={__('Pulisci', 'gepafin')} outlined
|
||||
onClick={clearFilter}/>
|
||||
<IconField iconPosition="left">
|
||||
<InputIcon className="pi pi-search"/>
|
||||
<InputText value={globalFilterValue} onChange={onGlobalFilterChange}
|
||||
placeholder={__('Cerca', 'gepafin')}/>
|
||||
</IconField>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const dateSubmissionBodyTemplate = (rowData) => {
|
||||
return formatDate(rowData.submissionDate);
|
||||
};
|
||||
|
||||
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="Select One" className="p-column-filter"
|
||||
showClear/>;
|
||||
};
|
||||
|
||||
const progressBodyTemplate = (options) => {
|
||||
return '-';
|
||||
};
|
||||
|
||||
const statusItemTemplate = (option) => {
|
||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)}/>;
|
||||
};
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return rowData.status === 'SOCCORSO'
|
||||
? <Link to={`/domande/${rowData.id}`}>
|
||||
<Button severity="info" label={__('Dettagli', 'gepafin')} icon="pi pi-eye" size="small"
|
||||
iconPos="right"/>
|
||||
</Link> : null;
|
||||
}
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
return (
|
||||
<div className="appPageSection__table">
|
||||
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id"
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="id" header={__('ID domanda', 'gepafin')} filter
|
||||
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column field="callTitle" header={__('Titolo bando', 'gepafin')} filter
|
||||
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column header={__('Data di invio', 'gepafin')} filterField="submissionDate" dataType="date"
|
||||
style={{ minWidth: '10rem' }}
|
||||
body={dateSubmissionBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||
style={{ width: '120px' }} body={statusBodyTemplate} filter
|
||||
filterElement={statusFilterTemplate}/>
|
||||
<Column header={__('Esito', 'gepafin')}
|
||||
style={{ minWidth: '10rem' }} field="progress" body={progressBodyTemplate}/>
|
||||
<Column header={__('Azioni', 'gepafin')}
|
||||
body={actionsBodyTemplate}/>
|
||||
</DataTable>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default BeneficiarioDomandeTable;
|
||||
23
src/pages/DomandeBeneficiario/index.js
Normal file
23
src/pages/DomandeBeneficiario/index.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
// components
|
||||
import BeneficiarioDomandeTable from './components/BeneficiarioDomandeTable';
|
||||
|
||||
const DomandePreInstructor = () => {
|
||||
return(
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{__('Archivio domande', 'gepafin')}</h1>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<BeneficiarioDomandeTable/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default DomandePreInstructor;
|
||||
@@ -8,7 +8,7 @@ const DomandePreInstructor = () => {
|
||||
return(
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{__('Domande da valutare', 'gepafin')}</h1>
|
||||
<h1>{__('Archivio domande', 'gepafin')}</h1>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
@@ -61,8 +61,8 @@ const SoccorsoEditPreInstructor = () => {
|
||||
newData.formFields = data.formFields;
|
||||
newData.responseDays = 10;
|
||||
newData.note = '';
|
||||
newData.sendNotification = true;
|
||||
newData.sendEmail = true;
|
||||
newData.isSendNotification = true;
|
||||
newData.isSendEmail = true;
|
||||
return newData;
|
||||
};
|
||||
|
||||
@@ -139,7 +139,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
const entityId = !isNaN(parsed) ? parsed : 0;
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
AmendmentsService.getSoccorsoByApplId(entityId, getCallback, errGetCallback);
|
||||
AmendmentsService.getSoccorsoByApplEvalId(entityId, getCallback, errGetCallback);
|
||||
}, [evaluationId]);
|
||||
|
||||
return (
|
||||
@@ -184,7 +184,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
<div className="appPageSection columns">
|
||||
<div>
|
||||
<h3>{__('Note', 'gepafin')}</h3>
|
||||
<div>
|
||||
<div style={{marginBottom: '30px'}}>
|
||||
<Editor
|
||||
value={formData.note}
|
||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||
@@ -198,7 +198,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
</div>
|
||||
|
||||
<h3>{__('Tempo per la Risposta (giorni)', 'gepafin')}</h3>
|
||||
<div>
|
||||
<div style={{marginBottom: '30px'}}>
|
||||
<InputNumber
|
||||
keyfilter="int"
|
||||
value={formData.responseDays}
|
||||
@@ -215,20 +215,20 @@ const SoccorsoEditPreInstructor = () => {
|
||||
<div className="appForm__field row">
|
||||
<InputSwitch
|
||||
inputId="notify_email"
|
||||
checked={formData.sendEmail}
|
||||
checked={formData.isSendEmail}
|
||||
onChange={(e) => updateEvaluationValue(
|
||||
e.value,
|
||||
'sendEmail'
|
||||
'isSendEmail'
|
||||
)}/>
|
||||
<label htmlFor="notify_email">{__('Notifiche Email', 'gepafin')}</label>
|
||||
</div>
|
||||
<div className="appForm__field row">
|
||||
<InputSwitch
|
||||
inputId="notify_push"
|
||||
checked={formData.sendNotification}
|
||||
checked={formData.isSendNotification}
|
||||
onChange={(e) => updateEvaluationValue(
|
||||
e.value,
|
||||
'sendNotification'
|
||||
'isSendNotification'
|
||||
)}/>
|
||||
<label htmlFor="notify_push">{__('Notifiche Push', 'gepafin')}</label>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { head, is, isEmpty, isNil, pathOr } from 'ramda';
|
||||
import { is, isEmpty, isNil } from 'ramda';
|
||||
import { wrap } from 'object-path-immutable';
|
||||
import { klona } from 'klona';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
@@ -16,9 +18,9 @@ import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import getBandoLabel from '../../helpers/getBandoLabel';
|
||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import uniqid from '../../helpers/uniqid';
|
||||
|
||||
// components
|
||||
import { Skeleton } from 'primereact/skeleton';
|
||||
import { Button } from 'primereact/button';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Toast } from 'primereact/toast';
|
||||
@@ -26,12 +28,8 @@ import { classNames } from 'primereact/utils';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { InputTextarea } from 'primereact/inputtextarea';
|
||||
import { klona } from 'klona';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import FormField from '../../components/FormField';
|
||||
import uniqid from '../../helpers/uniqid';
|
||||
import { Editor } from 'primereact/editor';
|
||||
import { TZDate } from '@date-fns/tz';
|
||||
import { InputNumber } from 'primereact/inputnumber';
|
||||
|
||||
const SoccorsoEditPreInstructor = () => {
|
||||
@@ -46,6 +44,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
const [isVisibleExtendTimeDialog, setIsVisibleExtendTimeDialog] = useState(false);
|
||||
const [extendedTime, setExtendedTime] = useState(3);
|
||||
const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false);
|
||||
const [isLoadingReminding, setIsLoadingReminding] = useState(false);
|
||||
const toast = useRef(null);
|
||||
const [formInitialData, setFormInitialData] = useState({});
|
||||
const {
|
||||
@@ -70,6 +69,13 @@ const SoccorsoEditPreInstructor = () => {
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setData(getFormattedData(data.data));
|
||||
const formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
|
||||
if (cur.fieldValue) {
|
||||
acc[cur.fieldId] = cur.fieldValue;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
setFormInitialData(formDataInitial);
|
||||
CommunicationService.getCommsByAmendmentId(data.data.id, getCommsCallback, errGetCommsCallback);
|
||||
}
|
||||
//storeSet.main.unsetAsyncRequest();
|
||||
@@ -234,7 +240,6 @@ const SoccorsoEditPreInstructor = () => {
|
||||
|
||||
const submitData = {
|
||||
updatedFormFields: newFormValues,
|
||||
//note: data.internalNote
|
||||
}
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
@@ -356,6 +361,36 @@ const SoccorsoEditPreInstructor = () => {
|
||||
setIsLoadingExtendingTime(false);
|
||||
}
|
||||
|
||||
const sendReminder = () => {
|
||||
setIsLoadingReminding(true);
|
||||
AmendmentsService.sendReminderForSoccorso(amendmentId, reminderCallback, errReminderCallback)
|
||||
}
|
||||
|
||||
const reminderCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
}
|
||||
setIsLoadingReminding(false);
|
||||
}
|
||||
|
||||
const errReminderCallback = (data) => {
|
||||
if (toast.current && data.message) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(data);
|
||||
setIsLoadingReminding(false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const parsedSoccorsoId = parseInt(amendmentId);
|
||||
const soccorsoEntityId = !isNaN(parsedSoccorsoId) ? parsedSoccorsoId : 0;
|
||||
@@ -384,195 +419,182 @@ const SoccorsoEditPreInstructor = () => {
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
{!isAsyncRequest && !isEmpty(data)
|
||||
? <div className="appPage__content">
|
||||
<div className="appPageSection__withBorder columns">
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('ID domanda', 'gepafin')}</span>
|
||||
<span>{data.applicationId}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Bando', 'gepafin')}</span>
|
||||
<span>{data.callName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Beneficiario', 'gepafin')}</span>
|
||||
<span>{data.beneficiaryName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Inizio', 'gepafin')}</span>
|
||||
<span>{getDateFromISOstring(data.startDate)}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Scadenza', 'gepafin')}</span>
|
||||
<span>{getDateFromISOstring(data.expirationDate)}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Stato', 'gepafin')}</span>
|
||||
<span>{getBandoLabel(data.status)}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Dettagli Richiesta', 'gepafin')}</h2>
|
||||
<div className="appPageSection columns">
|
||||
<div>
|
||||
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
||||
<ol className="appPageSection__list">
|
||||
{data.formFields.map((o, i) => <li key={o.fieldId}>
|
||||
<span>{o.label}</span>
|
||||
</li>)}
|
||||
</ol>
|
||||
</div>
|
||||
<div>
|
||||
<h3>{__('Note e spiegazioni', 'gepafin')}</h3>
|
||||
<div className="appPageSection__withBorder grey ql-editor"
|
||||
style={{ minHeight: '200px' }}>
|
||||
{renderHtmlContent(data.note)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
||||
<table className="myTable">
|
||||
<thead className="myThead">
|
||||
<tr>
|
||||
<th style={{ width: 250 }}>{__('Data', 'gepafin')}</th>
|
||||
<th>{__('Comunicazione', 'gepafin')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="myTbody">
|
||||
{!isNil(comms) && !isEmpty(comms)
|
||||
? comms.map((o, i) => <tr key={o.id}>
|
||||
<td valign="top">
|
||||
{getDateFromISOstring(o.commentedDate)}
|
||||
</td>
|
||||
<td>
|
||||
<h3>{o.title}</h3>
|
||||
<p>{o.comment}</p>
|
||||
</td>
|
||||
</tr>)
|
||||
: <tr>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
</tr>}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<Button
|
||||
style={{ marginTop: 30 }}
|
||||
onClick={openNewCommDialog}
|
||||
type="button"
|
||||
label={__('Aggiungi Comunicazione', 'gepafin')}
|
||||
icon="pi pi-plus" iconPos="right"/>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Documenti Ricevuti', 'gepafin')}</h2>
|
||||
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{data.formFields.map((o, i) => {
|
||||
const test = {
|
||||
'updatedFormFields': [
|
||||
{
|
||||
'fieldId': 'a5867bdceb',
|
||||
'fieldValue': '136'
|
||||
},
|
||||
{
|
||||
'fieldId': 'ab0f00219b',
|
||||
'fieldValue': null
|
||||
}
|
||||
]
|
||||
}
|
||||
const thisField = head(test.updatedFormFields.filter(j => j.fieldId === o.fieldId));
|
||||
const value = pathOr({}, ['fieldValue'], thisField);
|
||||
console.log('value', value, o.fieldId);
|
||||
return <FormField
|
||||
key={o.fieldId}
|
||||
type="fileupload"
|
||||
setDataFn={setValue}
|
||||
fieldName={o.fieldId}
|
||||
label={o.label}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={[]}
|
||||
accept={[]}
|
||||
doctype="document"
|
||||
register={register}
|
||||
sourceId={data.applicationId}
|
||||
source="application"
|
||||
multiple={true}
|
||||
/>
|
||||
})}
|
||||
</form>
|
||||
|
||||
<Button
|
||||
style={{ marginTop: 30 }}
|
||||
type="button"
|
||||
onClick={doUpdateAmendment}
|
||||
label={__('Aggiorna', 'gepafin')}/>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection__hr">
|
||||
<span>{__('Azioni', 'gepafin')}</span>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<div className="appPageSection__actions">
|
||||
<Button
|
||||
type="button"
|
||||
disabled={true}
|
||||
outlined
|
||||
label={__('Invia Sollecito', 'gepafin')}
|
||||
icon="pi pi-send"
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={openExtendResponseTimeDialog}
|
||||
outlined
|
||||
label={__('Estendi Scadenza', 'gepafin')}
|
||||
icon="pi pi-stopwatch"
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={doCloseAmendment}
|
||||
label={__('Chiudi Soccorso Istruttorio', 'gepafin')}
|
||||
icon="pi pi-times" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appForm__field" style={{ marginTop: '-40px' }}>
|
||||
<label>{__('Note Interne', 'gepafin')}</label>
|
||||
<div>
|
||||
<Editor
|
||||
value={data.internalNote}
|
||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||
headerTemplate={header}
|
||||
onTextChange={(e) => updateNewAmendmentData(
|
||||
e.htmlValue,
|
||||
'internalNote'
|
||||
)}
|
||||
style={{ height: 80 * 3, width: '100%' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPage__content">
|
||||
<div className="appPageSection__withBorder columns">
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('ID domanda', 'gepafin')}</span>
|
||||
<span>{data.applicationId}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Bando', 'gepafin')}</span>
|
||||
<span>{data.callName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Beneficiario', 'gepafin')}</span>
|
||||
<span>{data.beneficiaryName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Inizio', 'gepafin')}</span>
|
||||
<span>{getDateFromISOstring(data.startDate)}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Scadenza', 'gepafin')}</span>
|
||||
<span>{getDateFromISOstring(data.expirationDate)}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Stato', 'gepafin')}</span>
|
||||
<span>{getBandoLabel(data.status)}</span>
|
||||
</p>
|
||||
</div>
|
||||
: <>
|
||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||
<Skeleton width="100%" height="2rem" className="mb-8"></Skeleton>
|
||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||
<Skeleton width="100%" height="4rem" className="mb-8"></Skeleton>
|
||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||
<Skeleton width="100%" height="2rem" className="mb-8"></Skeleton>
|
||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||
<Skeleton width="100%" height="4rem"></Skeleton>
|
||||
</>}
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Dettagli Richiesta', 'gepafin')}</h2>
|
||||
<div className="appPageSection columns">
|
||||
<div>
|
||||
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
||||
<ol className="appPageSection__list">
|
||||
{data.formFields
|
||||
? data.formFields.map((o, i) => <li key={o.fieldId} style={{ flexDirection: 'row' }}>
|
||||
<span>{o.label}</span>
|
||||
</li>) : null}
|
||||
</ol>
|
||||
</div>
|
||||
<div>
|
||||
<h3>{__('Note e spiegazioni', 'gepafin')}</h3>
|
||||
<div className="appPageSection__withBorder grey ql-editor"
|
||||
style={{ minHeight: '200px' }}>
|
||||
{renderHtmlContent(data.note)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
||||
<table className="myTable">
|
||||
<thead className="myThead">
|
||||
<tr>
|
||||
<th style={{ width: 250 }}>{__('Data', 'gepafin')}</th>
|
||||
<th>{__('Comunicazione', 'gepafin')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="myTbody">
|
||||
{!isNil(comms) && !isEmpty(comms)
|
||||
? comms.map((o, i) => <tr key={o.id}>
|
||||
<td valign="top">
|
||||
{getDateFromISOstring(o.commentedDate)}
|
||||
</td>
|
||||
<td>
|
||||
<h3>{o.title}</h3>
|
||||
<p>{o.comment}</p>
|
||||
</td>
|
||||
</tr>)
|
||||
: <tr>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
</tr>}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<Button
|
||||
style={{ marginTop: 30 }}
|
||||
onClick={openNewCommDialog}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
type="button"
|
||||
label={__('Aggiungi Comunicazione', 'gepafin')}
|
||||
icon="pi pi-plus" iconPos="right"/>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Documenti Ricevuti', 'gepafin')}</h2>
|
||||
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{data.formFields
|
||||
? data.formFields.map((o, i) => {
|
||||
/*const thisField = head(test.updatedFormFields.filter(j => j.fieldId === o.fieldId));
|
||||
const value = pathOr({}, ['fieldValue'], thisField);
|
||||
console.log('value', value, o.fieldId);*/
|
||||
return <FormField
|
||||
key={o.fieldId}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
type="fileupload"
|
||||
setDataFn={setValue}
|
||||
fieldName={o.fieldId}
|
||||
label={o.label}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={formInitialData[o.fieldId] ? formInitialData[o.fieldId] : []}
|
||||
accept={[]}
|
||||
doctype="document"
|
||||
register={register}
|
||||
sourceId={data.applicationId}
|
||||
source="application"
|
||||
multiple={true}
|
||||
/>
|
||||
}) : null}
|
||||
</form>
|
||||
|
||||
<Button
|
||||
style={{ marginTop: 30 }}
|
||||
type="button"
|
||||
disabled={data.status === 'CLOSE'}
|
||||
onClick={doUpdateAmendment}
|
||||
label={__('Aggiorna', 'gepafin')}/>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection__hr">
|
||||
<span>{__('Azioni', 'gepafin')}</span>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<div className="appPageSection__actions">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={sendReminder}
|
||||
disabled={isLoadingReminding || data.status === 'CLOSE'}
|
||||
outlined
|
||||
label={__('Invia Sollecito', 'gepafin')}
|
||||
icon="pi pi-send"
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={openExtendResponseTimeDialog}
|
||||
disabled={isLoadingExtendingTime || data.status === 'CLOSE'}
|
||||
outlined
|
||||
label={__('Estendi Scadenza', 'gepafin')}
|
||||
icon="pi pi-stopwatch"
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={doCloseAmendment}
|
||||
disabled={isAsyncRequest || data.status === 'CLOSE'}
|
||||
label={__('Chiudi Soccorso Istruttorio', 'gepafin')}
|
||||
icon="pi pi-times" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appForm__field" style={{ marginTop: '-40px' }}>
|
||||
<label>{__('Note Interne', 'gepafin')}</label>
|
||||
<div style={{position: 'relative'}}>
|
||||
<BlockingOverlay shouldDisplay={data.status === 'CLOSE'}/>
|
||||
<Editor
|
||||
value={data.internalNote}
|
||||
readOnly={data.status === 'CLOSE'}
|
||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||
headerTemplate={header}
|
||||
onTextChange={(e) => updateNewAmendmentData(
|
||||
e.htmlValue,
|
||||
'internalNote'
|
||||
)}
|
||||
style={{ height: 80 * 3, width: '100%' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
visible={isVisibleNewCommDialog}
|
||||
@@ -587,6 +609,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
{__('Titolo', 'gepafin')}*
|
||||
</label>
|
||||
<InputText value={newCommData.title}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
invalid={isEmpty(newCommData.title)}
|
||||
onChange={(e) => updateNewCommData(e.target.value, 'title')}/>
|
||||
|
||||
@@ -596,6 +619,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
</label>
|
||||
<InputTextarea
|
||||
value={newCommData.comment}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
rows={5} cols={30}
|
||||
invalid={isEmpty(newCommData.comment)}
|
||||
onChange={(e) => updateNewCommData(e.target.value, 'comment')}/>
|
||||
@@ -616,6 +640,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
</label>
|
||||
<InputNumber
|
||||
keyfilter="int"
|
||||
disabled={data.status === 'CLOSE'}
|
||||
value={extendedTime}
|
||||
showButtons
|
||||
onChange={(e) => setExtendedTime(e.value)}/>
|
||||
|
||||
Reference in New Issue
Block a user