- styled asteriks sign;
- fixed issue with validation on registration page; - fixed issue with inputnumber; - fixed issue with editor field;; - added editors for new faq item form; - fixed displaying html as simple text; - fixed saving company data after saving; - added toast for edit bando form; - improved edit forms form; - fixed styles for various elements;
This commit is contained in:
@@ -98,6 +98,10 @@ const AllBandiTable = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const nameBodyTemplate = (rowData) => {
|
||||
return <span>{rowData.name}</span>
|
||||
}
|
||||
|
||||
const dateStartBodyTemplate = (rowData) => {
|
||||
return getDateFromISOstring(rowData.dates[0]);
|
||||
};
|
||||
@@ -137,7 +141,8 @@ const AllBandiTable = () => {
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage="Nothing found." onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="name" header={__('Nome Bando', 'gepafin')} filter filterPlaceholder="Search by name"
|
||||
<Column field="name" header={__('Nome Bando', 'gepafin')}
|
||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column header={__('Data Pubblicazione', 'gepafin')} filterField="start_date" dataType="date"
|
||||
style={{ minWidth: '10rem' }}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React, { useState, useEffect} from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { is, uniq } from 'ramda';
|
||||
import { is, uniq, isNil } from 'ramda';
|
||||
import { wrap } from 'object-path-immutable';
|
||||
|
||||
// store
|
||||
import { storeSet, storeGet } from '../../../../store';
|
||||
import { storeSet, useStore } from '../../../../store';
|
||||
|
||||
// tools
|
||||
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||
@@ -23,12 +24,13 @@ import getNumberWithCurrency from '../../../../helpers/getNumberWithCurrency';
|
||||
import renderHtmlContent from '../../../../helpers/renderHtmlContent';
|
||||
import { Button } from 'primereact/button';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||
|
||||
|
||||
const AllBandiAccordion = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const [items, setItems] = useState(null);
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [expandedRows, setExpandedRows] = useState(null);
|
||||
const [statuses, setStatuses] = useState([]);
|
||||
const navigate = useNavigate();
|
||||
@@ -47,7 +49,7 @@ const AllBandiAccordion = () => {
|
||||
}
|
||||
|
||||
const errGetCallbacks = (data) => {
|
||||
console.log('errGetCallbacks', data)
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
@@ -58,6 +60,22 @@ const AllBandiAccordion = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const nameBodyTemplate = (rowData) => {
|
||||
return <span
|
||||
className="appPageSection__titleClickable"
|
||||
onClick={() => {
|
||||
let newExpandedRows;
|
||||
if (isNil(expandedRows) || isNil(expandedRows[rowData.id])) {
|
||||
newExpandedRows = isNil(expandedRows)
|
||||
? wrap({}).set([rowData.id], true).value()
|
||||
: wrap(expandedRows).set([rowData.id], true).value();
|
||||
} else {
|
||||
newExpandedRows = wrap(expandedRows).del([rowData.id]).value();
|
||||
}
|
||||
setExpandedRows(newExpandedRows);
|
||||
}}>{rowData.name}</span>
|
||||
}
|
||||
|
||||
const amountBodyTemplate = (rowData) => {
|
||||
return getNumberWithCurrency(rowData.amount);
|
||||
};
|
||||
@@ -108,13 +126,16 @@ const AllBandiAccordion = () => {
|
||||
|
||||
return(
|
||||
<div className="appPageSection__table">
|
||||
<DataTable value={items} paginator rows={10} loading={loading} dataKey="id"
|
||||
<DataTable value={items} paginator rows={10} loading={isAsyncRequest} dataKey="id"
|
||||
filters={filters} emptyMessage="Nothing found."
|
||||
expandedRows={expandedRows} onRowToggle={(e) => setExpandedRows(e.data)}
|
||||
expandedRows={expandedRows}
|
||||
onRowToggle={(e) => setExpandedRows(e.data)}
|
||||
rowExpansionTemplate={rowExpansionTemplate}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column expander={allowExpansion} style={{ width: '5rem' }} />
|
||||
<Column field="name" header={__('Bando', 'gepafin')} style={{ minWidth: '12rem' }}/>
|
||||
<Column field="name" header={__('Bando', 'gepafin')}
|
||||
body={nameBodyTemplate}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column header={__('Importo totale', 'gepafin')} filterField="amount"
|
||||
style={{ minWidth: '10rem' }} body={amountBodyTemplate} sortable/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||
|
||||
26
src/pages/BandoApplication/ApplicationSteps/index.js
Normal file
26
src/pages/BandoApplication/ApplicationSteps/index.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import { range } from 'ramda';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
// components
|
||||
import { Steps } from 'primereact/steps';
|
||||
|
||||
const ApplicationSteps = ({ totalSteps = 0, activeStepIndex }) => {
|
||||
const rangeArr = range(1, totalSteps + 1);
|
||||
const items = rangeArr.map(() => ({ label: 'Passo' }));
|
||||
|
||||
// TODO update to using Steps after primereact is updated
|
||||
return(
|
||||
0 !== totalSteps
|
||||
? <span>{__('Passo', 'gepafin')}: {activeStepIndex + 1}</span>
|
||||
: null
|
||||
)
|
||||
|
||||
/*return(
|
||||
0 !== totalSteps
|
||||
? <Steps model={items} activeIndex={activeStepIndex} readOnly/>
|
||||
: null
|
||||
)*/
|
||||
}
|
||||
|
||||
export default ApplicationSteps
|
||||
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
|
||||
import { __, sprintf } from '@wordpress/i18n';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { klona } from 'klona';
|
||||
import { head, range, is, pluck } from 'ramda';
|
||||
import { head, is, pluck, isEmpty } from 'ramda';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { TZDate } from '@date-fns/tz';
|
||||
|
||||
@@ -30,9 +30,9 @@ import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import { Skeleton } from 'primereact/skeleton';
|
||||
import { Button } from 'primereact/button';
|
||||
import FormField from '../../components/FormField';
|
||||
import { Steps } from 'primereact/steps';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import { Messages } from 'primereact/messages';
|
||||
import ApplicationSteps from './ApplicationSteps';
|
||||
|
||||
const BandoApplication = () => {
|
||||
const { id } = useParams();
|
||||
@@ -43,7 +43,6 @@ const BandoApplication = () => {
|
||||
const [totalSteps, setTotalSteps] = useState(0);
|
||||
const [completedSteps, setCompletedSteps] = useState(0);
|
||||
const [activeStep, setActiveStep] = useState(1);
|
||||
const [stepItems, setStepItems] = useState([{ label: 'Passo' }]);
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const toast = useRef(null);
|
||||
const formMsgs = useRef(null);
|
||||
@@ -54,7 +53,7 @@ const BandoApplication = () => {
|
||||
setValue,
|
||||
trigger,
|
||||
register,
|
||||
getValues,
|
||||
getValues
|
||||
} = useForm({ defaultValues: {}, mode: 'onChange' });
|
||||
const values = getValues();
|
||||
const validationFns = {
|
||||
@@ -67,6 +66,7 @@ const BandoApplication = () => {
|
||||
isUrl,
|
||||
isMarcaDaBollo
|
||||
}
|
||||
const activeStepIndex = activeStep - 1;
|
||||
|
||||
const onSubmit = () => {
|
||||
const applId = getApplicationId();
|
||||
@@ -91,7 +91,6 @@ const BandoApplication = () => {
|
||||
}
|
||||
|
||||
const errSubmitApplicationCallback = (data) => {
|
||||
console.log(data)
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
if (data.status === 'VALIDATION_ERROR') {
|
||||
if (formMsgs.current) {
|
||||
@@ -120,7 +119,7 @@ const BandoApplication = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const saveDraft = () => {
|
||||
const saveDraft = (saveAndMove = '') => {
|
||||
trigger();
|
||||
const formValues = getValues();
|
||||
const usedFieldsIds = pluck('id', formData);
|
||||
@@ -157,7 +156,7 @@ const BandoApplication = () => {
|
||||
formMsgs.current.clear();
|
||||
}
|
||||
|
||||
ApplicationService.saveDraft(applId, submitData, saveDraftCallback, errSaveDraftCallback, [
|
||||
ApplicationService.saveDraft(applId, submitData, (data) => saveDraftCallback(data, saveAndMove), errSaveDraftCallback, [
|
||||
['formId', formId]
|
||||
]);
|
||||
}
|
||||
@@ -168,7 +167,7 @@ const BandoApplication = () => {
|
||||
return !isNaN(parsed) ? parsed : 0;
|
||||
}
|
||||
|
||||
const saveDraftCallback = (data) => {
|
||||
const saveDraftCallback = (data, saveAndMove) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
@@ -177,8 +176,16 @@ const BandoApplication = () => {
|
||||
detail: __('Salvato!', 'gepafin')
|
||||
});
|
||||
}
|
||||
// update info about application completeness
|
||||
ApplicationService.getApplicationForm(data.data.id, getStatusCheckCallback, errGetStatusCheckCallbacks);
|
||||
if (!isEmpty(saveAndMove)) {
|
||||
storeSet.main.setAsyncRequest();
|
||||
ApplicationService.getApplicationForm(data.data.id, getApplFormCallback, errGetApplFormCallbacks, [
|
||||
['formId', formId],
|
||||
['action', saveAndMove]
|
||||
]);
|
||||
} else {
|
||||
// update info about application completeness
|
||||
ApplicationService.getApplicationForm(data.data.id, getStatusCheckCallback, errGetStatusCheckCallbacks);
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
@@ -213,31 +220,37 @@ const BandoApplication = () => {
|
||||
}
|
||||
|
||||
const goBackward = () => {
|
||||
if (formId) {
|
||||
saveDraft('PREVIOUS');
|
||||
/*if (formId) {
|
||||
const applId = getApplicationId();
|
||||
storeSet.main.setAsyncRequest();
|
||||
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks, [
|
||||
['formId', formId],
|
||||
['action', 'PREVIOUS']
|
||||
]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
const goForward = () => {
|
||||
if (formId) {
|
||||
saveDraft('NEXT');
|
||||
/*if (formId) {
|
||||
const applId = getApplicationId();
|
||||
storeSet.main.setAsyncRequest();
|
||||
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks, [
|
||||
['formId', formId],
|
||||
['action', 'NEXT']
|
||||
]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
const getApplFormCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setBandoTitle(data.data.callTitle);
|
||||
setFormData(data.data.applicationFormResponse.content);
|
||||
setFormId(data.data.formId);
|
||||
setTotalSteps(data.data.totalFormSteps);
|
||||
setCompletedSteps(data.data.completedSteps);
|
||||
setActiveStep(data.data.currentStep);
|
||||
|
||||
if (data.data.applicationFormResponse.formFields) {
|
||||
const submitData = data.data.applicationFormResponse.formFields.map((o) => ({
|
||||
@@ -246,11 +259,6 @@ const BandoApplication = () => {
|
||||
}));
|
||||
setFormInitialData(submitData)
|
||||
}
|
||||
|
||||
setFormId(data.data.formId);
|
||||
setTotalSteps(data.data.totalFormSteps);
|
||||
setCompletedSteps(data.data.completedSteps);
|
||||
setActiveStep(data.data.currentStep);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
@@ -285,11 +293,6 @@ const BandoApplication = () => {
|
||||
newFormData.map(o => setValue(o.fieldId, o.fieldValue));
|
||||
}, [formInitialData]);
|
||||
|
||||
useEffect(() => {
|
||||
const rangeArr = range(1, totalSteps + 1);
|
||||
setStepItems(rangeArr.map(() => ({ label: 'Passo' })));
|
||||
}, [totalSteps])
|
||||
|
||||
useEffect(() => {
|
||||
const applId = getApplicationId();
|
||||
|
||||
@@ -312,8 +315,7 @@ const BandoApplication = () => {
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
{!isAsyncRequest
|
||||
? <Steps model={stepItems} activeIndex={activeStep - 1}/> : null}
|
||||
<ApplicationSteps totalSteps={totalSteps} activeStepIndex={activeStepIndex}/>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
@@ -327,12 +329,13 @@ const BandoApplication = () => {
|
||||
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||
const placeholder = head(o.settings.filter(o => o.name === 'placeholder'));
|
||||
const options = head(o.settings.filter(o => o.name === 'options'));
|
||||
const tableColumns = head(o.settings.filter(o => o.name === 'table_columns'));
|
||||
const step = head(o.settings.filter(o => o.name === 'step'));
|
||||
const mime = head(o.settings.filter(o => o.name === 'mime'));
|
||||
let mimeValue = '';
|
||||
|
||||
if (mime) {
|
||||
mimeValue = mime.value.map(o => o.code).join(',');
|
||||
mimeValue = mime.value.map(o => o.code);
|
||||
}
|
||||
|
||||
const validations = Object.keys(o.validators).reduce((acc, cur) => {
|
||||
@@ -367,13 +370,14 @@ const BandoApplication = () => {
|
||||
register={register}
|
||||
errors={errors}
|
||||
defaultValue={values[o.id]}
|
||||
maxFractionDigits={step}
|
||||
maxFractionDigits={step ? step.value : 0}
|
||||
accept={mimeValue}
|
||||
config={validations}
|
||||
options={options ? options.value : []}
|
||||
setDataFn={setValue}
|
||||
sourceId={getApplicationId()}
|
||||
useGrouping={false}
|
||||
tableColumns={tableColumns ? tableColumns.value : {}}
|
||||
/>
|
||||
})}
|
||||
|
||||
|
||||
@@ -162,7 +162,6 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
}
|
||||
|
||||
const errLookupdataCallback = (data) => {
|
||||
console.log('errLookupdataCallback', data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
errors={errors}
|
||||
defaultValue={values['docs']}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
accept="application/pdf,application/vnd.ms-excel"
|
||||
accept={["application/pdf", "application/vnd.ms-excel"]}
|
||||
chooseLabel={__('Aggiungi documento', 'gepafin')}
|
||||
multiple={true}
|
||||
doctype='document'
|
||||
|
||||
@@ -22,6 +22,7 @@ import BandoEditFormStep2 from './components/BandoEditFormStep2';
|
||||
import { Messages } from 'primereact/messages';
|
||||
import FormsService from '../../service/forms-service';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Toast } from 'primereact/toast';
|
||||
|
||||
const BandoEdit = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
@@ -32,6 +33,7 @@ const BandoEdit = () => {
|
||||
const [forms, setForms] = useState([]);
|
||||
const formRef = useRef(null);
|
||||
const bandoMsgs = useRef(null);
|
||||
const toast = useRef(null);
|
||||
|
||||
const stepItems = [
|
||||
{
|
||||
@@ -81,11 +83,18 @@ const BandoEdit = () => {
|
||||
bandoMsgs.current.show([
|
||||
{
|
||||
id: '99',
|
||||
sticky: true, severity: 'success', summary: '',
|
||||
sticky: true, severity: 'info', summary: '',
|
||||
detail: __('Potrai pubblicare il tuo Bando.', 'gepafin'),
|
||||
closable: false
|
||||
}
|
||||
]);
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'info',
|
||||
summary: '',
|
||||
detail: __('Potrai pubblicare il tuo Bando.', 'gepafin')
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
@@ -125,6 +134,13 @@ const BandoEdit = () => {
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: '',
|
||||
detail: __('Pubblicato!', 'gepafin')
|
||||
});
|
||||
}
|
||||
setData(data.data);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
@@ -247,6 +263,7 @@ const BandoEdit = () => {
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<Messages ref={bandoMsgs}/>
|
||||
<Toast ref={toast} />
|
||||
|
||||
{!isEmpty(data)
|
||||
? <>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { head } from 'ramda';
|
||||
import { head, pathOr } from 'ramda';
|
||||
|
||||
// store
|
||||
import { useStore } from '../../../../store';
|
||||
@@ -7,10 +7,11 @@ import renderHtmlContent from '../../../../helpers/renderHtmlContent';
|
||||
|
||||
const BuilderElementProperLabel = ({ id, defaultLabel }) => {
|
||||
const elements = useStore().main.formElements();
|
||||
const element = head(elements.filter(o => o.id === id));
|
||||
const [label, setLabel] = useState('');
|
||||
const isRequired = pathOr(false, ['validators', 'isRequired'], element)
|
||||
|
||||
useEffect(() => {
|
||||
const element = head(elements.filter(o => o.id === id));
|
||||
const label = head(element.settings.filter(o => o.name === 'label'));
|
||||
const text = head(element.settings.filter(o => o.name === 'text'));
|
||||
|
||||
@@ -23,7 +24,10 @@ const BuilderElementProperLabel = ({ id, defaultLabel }) => {
|
||||
}
|
||||
}, [elements]);
|
||||
|
||||
return <div className="label">{renderHtmlContent(label)}</div>
|
||||
return <div className="label">
|
||||
{renderHtmlContent(label)}
|
||||
{isRequired ? <span className="appForm__field--required">*</span> : null}
|
||||
</div>
|
||||
}
|
||||
|
||||
export default BuilderElementProperLabel;
|
||||
@@ -23,7 +23,7 @@ import FormsService from '../../service/forms-service';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
|
||||
// TODO temp data
|
||||
import { elementItems } from '../../tempData';
|
||||
//import { elementItems } from '../../tempData';
|
||||
|
||||
const BandoFormsEdit = () => {
|
||||
const { id, formId } = useParams();
|
||||
@@ -168,7 +168,14 @@ const BandoFormsEdit = () => {
|
||||
}
|
||||
|
||||
const openPreview = () => {
|
||||
doSave(true);
|
||||
if ('PUBLISH' !== bandoStatus) {
|
||||
doSave(true);
|
||||
} else {
|
||||
const bandoId = getBandoId();
|
||||
const parsedFormId = parseInt(formId)
|
||||
const bandoFormId = !isNaN(parsedFormId) ? parsedFormId : 0;
|
||||
navigate(`/bandi/${bandoId}/forms/${bandoFormId}/preview`);
|
||||
}
|
||||
}
|
||||
|
||||
const confirmDelete = (event) => {
|
||||
@@ -208,8 +215,8 @@ const BandoFormsEdit = () => {
|
||||
|
||||
const getElementItemsCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||
//storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||
//storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||
storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ const BandoFormsPreview = () => {
|
||||
}, {});
|
||||
|
||||
return ['paragraph'].includes(o.name) && text
|
||||
? <div className="appForm__content">{renderHtmlContent(text.value)}</div>
|
||||
? <div className="appForm__content" key={o.id}>{renderHtmlContent(text.value)}</div>
|
||||
: <FormField
|
||||
key={o.id}
|
||||
type={o.name}
|
||||
@@ -167,6 +167,7 @@ const BandoFormsPreview = () => {
|
||||
options={options ? options.value : []}
|
||||
setDataFn={setValue}
|
||||
sourceId={0}
|
||||
useGrouping={false}
|
||||
tableColumns={tableColumns ? tableColumns.value : {}}
|
||||
/>
|
||||
})}
|
||||
|
||||
@@ -95,10 +95,11 @@ const BandoView = () => {
|
||||
icon="pi pi-arrow-left" iconPos="left"/>
|
||||
</div>
|
||||
|
||||
<picture className="appPageSection__hero">
|
||||
<source srcSet={data.images[0] ? data.images[0].filePath : ''}/>
|
||||
<img src={data.images[0] ? data.images[0].filePath : ''} alt={data.name}/>
|
||||
</picture>
|
||||
{!isEmpty(data.images)
|
||||
? <picture className="appPageSection__hero">
|
||||
<source srcSet={data.images[0] ? data.images[0].filePath : ''}/>
|
||||
<img src={data.images[0] ? data.images[0].filePath : ''} alt={data.name}/>
|
||||
</picture> : null}
|
||||
|
||||
<div className="appPageSection__withBorder">
|
||||
<h2>{__('Descrizione breve', 'gepafin')}</h2>
|
||||
@@ -187,9 +188,9 @@ const BandoView = () => {
|
||||
<Accordion>
|
||||
{data.faq
|
||||
.filter(o => o.isVisible)
|
||||
.map((o, i) => <AccordionTab key={i} header={o.value}>
|
||||
.map((o, i) => <AccordionTab key={i} header={renderHtmlContent(o.value)}>
|
||||
<p>
|
||||
{o.response}
|
||||
{renderHtmlContent(o.response)}
|
||||
</p>
|
||||
</AccordionTab>)}
|
||||
</Accordion>
|
||||
|
||||
@@ -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, pathOr, isNil } from 'ramda';
|
||||
import { is, isEmpty, isNil } from 'ramda';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
@@ -16,7 +16,6 @@ import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import { Skeleton } from 'primereact/skeleton';
|
||||
import { Accordion } from 'primereact/accordion';
|
||||
import { AccordionTab } from 'primereact/accordion';
|
||||
import { InputTextarea } from 'primereact/inputtextarea';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Messages } from 'primereact/messages';
|
||||
import { Message } from 'primereact/message';
|
||||
@@ -29,14 +28,13 @@ import { Editor } from 'primereact/editor';
|
||||
|
||||
const BandoViewBeneficiario = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const companies = useStore().main.companies();
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [data, setData] = useState({});
|
||||
const [newQuestion, setNewQuestion] = useState('');
|
||||
const [applicationObj, setApplicationObj] = useState(true);
|
||||
const bandoMsgs = useRef(null);
|
||||
const chosenCompanyId = pathOr(0, [0, 'id'], companies);
|
||||
|
||||
const scaricaBando = () => {
|
||||
|
||||
@@ -90,12 +88,12 @@ const BandoViewBeneficiario = () => {
|
||||
bandoMsgs.current.clear();
|
||||
}
|
||||
const obj = {
|
||||
"id": null,
|
||||
"lookUpDataId": null,
|
||||
"title": newQuestion,
|
||||
"value": newQuestion,
|
||||
"response": "",
|
||||
"isVisible": false
|
||||
'id': null,
|
||||
'lookUpDataId': null,
|
||||
'title': newQuestion,
|
||||
'value': newQuestion,
|
||||
'response': '',
|
||||
'isVisible': false
|
||||
}
|
||||
storeSet.main.setAsyncRequest();
|
||||
FaqItemService.addQuestion(id, obj, createCallBack, errCreateCallback, [['companyId', chosenCompanyId]])
|
||||
@@ -161,7 +159,7 @@ const BandoViewBeneficiario = () => {
|
||||
|
||||
const getApplCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if(data.data.length) {
|
||||
if (data.data.length) {
|
||||
setApplicationObj(data.data[0]);
|
||||
}
|
||||
}
|
||||
@@ -220,10 +218,11 @@ const BandoViewBeneficiario = () => {
|
||||
|
||||
{!isAsyncRequest && !isEmpty(data)
|
||||
? <div className="appPage__content">
|
||||
<picture className="appPageSection__hero">
|
||||
<source srcSet={data.images[0] ? data.images[0].filePath : ''}/>
|
||||
<img src={data.images[0] ? data.images[0].filePath : ''} alt={data.name}/>
|
||||
</picture>
|
||||
{!isEmpty(data.images)
|
||||
? <picture className="appPageSection__hero">
|
||||
<source srcSet={data.images[0] ? data.images[0].filePath : ''}/>
|
||||
<img src={data.images[0] ? data.images[0].filePath : ''} alt={data.name}/>
|
||||
</picture> : null}
|
||||
|
||||
<div className="appPageSection__withBorder">
|
||||
<h2>{__('Descrizione breve', 'gepafin')}</h2>
|
||||
@@ -312,11 +311,11 @@ const BandoViewBeneficiario = () => {
|
||||
<Accordion>
|
||||
{data.faq
|
||||
.filter(o => o.isVisible)
|
||||
.map((o, i) => <AccordionTab key={i} header={o.value}>
|
||||
<p>
|
||||
{o.response}
|
||||
</p>
|
||||
</AccordionTab>)}
|
||||
.map((o, i) => <AccordionTab key={i} header={renderHtmlContent(o.value)}>
|
||||
<p>
|
||||
{renderHtmlContent(o.response)}
|
||||
</p>
|
||||
</AccordionTab>)}
|
||||
</Accordion>
|
||||
</div>
|
||||
|
||||
@@ -345,7 +344,8 @@ const BandoViewBeneficiario = () => {
|
||||
|
||||
{chosenCompanyId === 0
|
||||
? <>
|
||||
<Message severity="error" text={__("Devi creare un'azienda prima di partecipare nei bandi. Vai nel profilo aziendale.", 'gepafin')} />
|
||||
<Message severity="error"
|
||||
text={__('Devi creare un\'azienda prima di partecipare nei bandi. Vai nel profilo aziendale.', 'gepafin')}/>
|
||||
</>
|
||||
: null}
|
||||
|
||||
@@ -387,7 +387,8 @@ const BandoViewBeneficiario = () => {
|
||||
<h2>{__('Contatti per Assistenza', 'gepafin')}</h2>
|
||||
<div className="row rowContent">
|
||||
<p>Email: {data.email}</p>
|
||||
{!isNil(data.phoneNumber) ? <p>{__('Telefono', 'gepafin')}: +39 {data.phoneNumber}</p> : null}
|
||||
{!isNil(data.phoneNumber) ?
|
||||
<p>{__('Telefono', 'gepafin')}: +39 {data.phoneNumber}</p> : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEmpty, isNil, pathOr } from 'ramda';
|
||||
import { isEmpty, isNil, pathOr, head } from 'ramda';
|
||||
import { klona } from 'klona';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
import { storeSet, useStore, storeGet } from '../../store';
|
||||
|
||||
// components
|
||||
import { Messages } from 'primereact/messages';
|
||||
@@ -18,7 +19,6 @@ import CompanyService from '../../service/company-service';
|
||||
// tools
|
||||
import { isPIVA } from '../../helpers/validators';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import { klona } from 'klona';
|
||||
|
||||
const ProfileCompany = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
@@ -67,7 +67,19 @@ const ProfileCompany = () => {
|
||||
|
||||
const updateCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
//setData(getFormattedBandiData(data.data));
|
||||
const company = klona(data.data);
|
||||
const companies = storeGet.main.companies();
|
||||
const existingCompany = head(companies.filter(o => o.id === company.id));
|
||||
let newCompanies = [];
|
||||
|
||||
if (existingCompany) {
|
||||
newCompanies = companies.map(o => o.id === company.id ? company : o)
|
||||
} else {
|
||||
newCompanies = [...companies, company];
|
||||
storeSet.main.chosenCompanyId(company.id);
|
||||
}
|
||||
|
||||
storeSet.main.companies(newCompanies);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
@@ -129,7 +141,6 @@ const ProfileCompany = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const chosenCompany = pathOr({}, [0], companies);
|
||||
console.log('chosenCompany', chosenCompany, companies)
|
||||
setFormInitialData(chosenCompany);
|
||||
}, [companies]);
|
||||
|
||||
|
||||
@@ -161,10 +161,7 @@ const Registration = () => {
|
||||
control={control}
|
||||
errors={errors}
|
||||
config={{
|
||||
required: __('È obbligatorio', 'gepafin'),
|
||||
validate: {
|
||||
isCodiceFiscale
|
||||
}
|
||||
required: __('È obbligatorio', 'gepafin')
|
||||
}}
|
||||
placeholder="ABC1234"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user