- added fileselect form field;
- added Documents page;
This commit is contained in:
@@ -135,17 +135,21 @@
|
|||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0 0 20px;
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 7px;
|
gap: 7px;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { isEmpty, pluck } from 'ramda';
|
|||||||
import { ListBox } from 'primereact/listbox';
|
import { ListBox } from 'primereact/listbox';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import CompanyDocumentsService from '../../../../service/company-documents-service';
|
import CompanyDocumentsService from '../../../../service/company-documents-service';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
const FileSelect = ({
|
const FileSelect = ({
|
||||||
fieldName,
|
fieldName,
|
||||||
@@ -35,6 +36,7 @@ const FileSelect = ({
|
|||||||
setSelectedUnconfirmed([]);
|
setSelectedUnconfirmed([]);
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
// eslint-disable-next-line array-callback-return
|
||||||
selectedToBeAdded.map(o => {
|
selectedToBeAdded.map(o => {
|
||||||
CompanyDocumentsService.attachCompanyDocumentToAppl(o.id, callback, errCallback, [
|
CompanyDocumentsService.attachCompanyDocumentToAppl(o.id, callback, errCallback, [
|
||||||
['applicationId', sourceId],
|
['applicationId', sourceId],
|
||||||
@@ -43,6 +45,10 @@ const FileSelect = ({
|
|||||||
});
|
});
|
||||||
}, [selectedUnconfirmed]);
|
}, [selectedUnconfirmed]);
|
||||||
|
|
||||||
|
const removeAttached = (id) => {
|
||||||
|
console.log('stateFieldData', stateFieldData, id)
|
||||||
|
}
|
||||||
|
|
||||||
const callback = (resp) => {
|
const callback = (resp) => {
|
||||||
if (resp.status === 'SUCCESS') {
|
if (resp.status === 'SUCCESS') {
|
||||||
stateFieldData.current = [...stateFieldData.current, resp.data];
|
stateFieldData.current = [...stateFieldData.current, resp.data];
|
||||||
@@ -84,7 +90,6 @@ const FileSelect = ({
|
|||||||
}, [options]);
|
}, [options]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('defaultValue', defaultValue);
|
|
||||||
stateFieldData.current = defaultValue;
|
stateFieldData.current = defaultValue;
|
||||||
}, [defaultValue]);
|
}, [defaultValue]);
|
||||||
|
|
||||||
@@ -105,22 +110,42 @@ const FileSelect = ({
|
|||||||
optionGroupChildren="items"
|
optionGroupChildren="items"
|
||||||
className="w-full md:w-14rem"
|
className="w-full md:w-14rem"
|
||||||
listStyle={{ maxHeight: '130px' }}/>
|
listStyle={{ maxHeight: '130px' }}/>
|
||||||
<Button
|
{!isEmpty(optionsTransformed)
|
||||||
|
? <Button
|
||||||
severity="success"
|
severity="success"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
onClick={attachSelectedFiles}
|
onClick={attachSelectedFiles}
|
||||||
label={__('Conferma i file scelti', 'gepafin')}
|
label={__('Conferma i file scelti', 'gepafin')}
|
||||||
icon="pi pi-arrow-right" size="small" iconPos="right"/>
|
icon="pi pi-arrow-right" size="small" iconPos="right"/> : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="fileselectInner__selectedFiles">
|
{!isEmpty(optionsTransformed)
|
||||||
<p>{__('Selezionati')}</p>
|
? <div className="fileselectInner__selectedFiles">
|
||||||
|
<p>{__('I file selezionati')}</p>
|
||||||
<ul>
|
<ul>
|
||||||
{[...stateFieldData.current].map(o => <li key={o.id}>
|
{[...stateFieldData.current].map(o => <li key={o.id}>
|
||||||
{o.name}
|
{o.name}
|
||||||
|
<div className="appPageSection__iconActions">
|
||||||
|
<Button icon="pi pi-times" rounded
|
||||||
|
type="button"
|
||||||
|
size="small"
|
||||||
|
onClick={() => removeAttached(o.id)}
|
||||||
|
outlined severity="danger"
|
||||||
|
aria-label={__('Cancella', 'gepafin')}/>
|
||||||
|
</div>
|
||||||
</li>)}
|
</li>)}
|
||||||
</ul>
|
</ul>
|
||||||
|
</div> : null}
|
||||||
</div>
|
</div>
|
||||||
|
{isEmpty(optionsTransformed)
|
||||||
|
? <div className="appPageSection__message warning">
|
||||||
|
<span>
|
||||||
|
{__('I file caricati sulla pagina Documenti saranno disponibili qui. ', 'gepafin')}
|
||||||
|
<Link to={`/documenti`}>
|
||||||
|
{__('Vai alla pagina Documenti', 'gepafin')}
|
||||||
|
</Link>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
: null}
|
||||||
{infoText ? <small>{infoText}</small> : null}
|
{infoText ? <small>{infoText}</small> : null}
|
||||||
</>)
|
</>)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||||
import { __, sprintf } from '@wordpress/i18n';
|
import { __, sprintf } from '@wordpress/i18n';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { head, is, pluck, isEmpty, pathOr, isNil, uniq, uniqBy } from 'ramda';
|
import { head, is, pluck, isEmpty, pathOr, isNil, uniqBy } from 'ramda';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import 'quill/dist/quill.core.css';
|
import 'quill/dist/quill.core.css';
|
||||||
import { wrap } from 'object-path-immutable';
|
import { wrap } from 'object-path-immutable';
|
||||||
@@ -545,11 +545,10 @@ const BandoApplication = () => {
|
|||||||
|
|
||||||
const getDocsCallback = (resp, type) => {
|
const getDocsCallback = (resp, type) => {
|
||||||
if (resp.status === 'SUCCESS') {
|
if (resp.status === 'SUCCESS') {
|
||||||
if (type === 'PERSONAL_DOCUMENT') {
|
const filteredPersonal = getFormattedDocsData(resp.data.filter(o => o.type === 'PERSONAL_DOCUMENT'));
|
||||||
setPersonalDocs(uniqBy((o) => o.id, getFormattedDocsData(resp.data)));
|
setPersonalDocs(uniqBy((o) => o.id, filteredPersonal));
|
||||||
} else {
|
const filteredCompany = getFormattedDocsData(resp.data.filter(o => o.type === 'COMPANY_DOCUMENT'));
|
||||||
setCompanyDocs(uniqBy((o) => o.id, getFormattedDocsData(resp.data)));
|
setCompanyDocs(uniqBy((o) => o.id, filteredCompany));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,12 +651,13 @@ const BandoApplication = () => {
|
|||||||
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks, [
|
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks, [
|
||||||
['companyId', chosenCompanyId]
|
['companyId', chosenCompanyId]
|
||||||
]);
|
]);
|
||||||
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, (resp) => getDocsCallback(resp, 'COMPANY_DOCUMENT'), errDocsGetCallbacks, [
|
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, getDocsCallback, errDocsGetCallbacks);
|
||||||
|
/*CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, (resp) => getDocsCallback(resp, 'COMPANY_DOCUMENT'), errDocsGetCallbacks, [
|
||||||
['documentType', 'COMPANY_DOCUMENT']
|
['documentType', 'COMPANY_DOCUMENT']
|
||||||
]);
|
]);
|
||||||
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, (resp) => getDocsCallback(resp, 'PERSONAL_DOCUMENT'), errDocsGetCallbacks, [
|
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, (resp) => getDocsCallback(resp, 'PERSONAL_DOCUMENT'), errDocsGetCallbacks, [
|
||||||
['documentType', 'PERSONAL_DOCUMENT']
|
['documentType', 'PERSONAL_DOCUMENT']
|
||||||
]);
|
]);*/
|
||||||
}
|
}
|
||||||
}, [id, chosenCompanyId]);
|
}, [id, chosenCompanyId]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* data table related */
|
/* data table related */
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { FilterMatchMode } from 'primereact/api';
|
|
||||||
|
|
||||||
const currentPageReportTemplate = '';
|
const currentPageReportTemplate = '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user