- added registartion page;
- implemented validation helper-functions; - fixed form fields datepicker and datepicker range; - updated routes logic; - fixed FAQ items editing/submission;
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { is, isNil } from 'ramda';
|
||||
import { is, isNil, isEmpty } from 'ramda';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
@@ -93,11 +93,11 @@ const BandoEdit = () => {
|
||||
}
|
||||
|
||||
const openBandoFormManagement = () => {
|
||||
navigate(`/tenders/${id}/forms`);
|
||||
navigate(`/bandi/${id}/forms`);
|
||||
}
|
||||
|
||||
const openBandoFlowManagement = () => {
|
||||
navigate(`/tenders/${id}/flow`);
|
||||
navigate(`/bandi/${id}/flow`);
|
||||
}
|
||||
|
||||
const validateBando = () => {
|
||||
@@ -108,6 +108,7 @@ const BandoEdit = () => {
|
||||
|
||||
const validateCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setData({...data, status: data.data.status});
|
||||
if (bandoMsgs.current) {
|
||||
bandoMsgs.current.show([
|
||||
{
|
||||
@@ -123,7 +124,19 @@ const BandoEdit = () => {
|
||||
}
|
||||
|
||||
const errValidateCallback = (data) => {
|
||||
standardErrCallback(data);
|
||||
if (data.status === 'VALIDATION_ERROR') {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
if (bandoMsgs.current) {
|
||||
bandoMsgs.current.show(data.data.map((v, i) => ({
|
||||
id: i,
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
detail: v,
|
||||
closable: false
|
||||
})));
|
||||
}
|
||||
} else {
|
||||
standardErrCallback(data);
|
||||
}
|
||||
}
|
||||
|
||||
const publishBando = () => {
|
||||
@@ -144,6 +157,7 @@ const BandoEdit = () => {
|
||||
}
|
||||
]);
|
||||
}
|
||||
setData(data.data);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
@@ -276,23 +290,24 @@ const BandoEdit = () => {
|
||||
icon="pi pi-check"
|
||||
iconPos="right"/>
|
||||
</div> : null*/}
|
||||
{!isAsyncRequest
|
||||
{!isEmpty(data)
|
||||
? <Steps
|
||||
model={stepItems}
|
||||
activeIndex={activeStep}
|
||||
readOnly={false}/>
|
||||
: <BlockingOverlay shouldDisplay={isAsyncRequest}/>}
|
||||
: null}
|
||||
<BlockingOverlay shouldDisplay={isAsyncRequest}/>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<Messages ref={bandoMsgs}/>
|
||||
|
||||
{!isAsyncRequest
|
||||
{!isEmpty(data)
|
||||
? <>
|
||||
{activeStep === 0
|
||||
? <BandoEditFormStep1 initialData={data} ref={formRef}/> : null}
|
||||
? <BandoEditFormStep1 initialData={data} ref={formRef} status={data.status}/> : null}
|
||||
{activeStep === 1
|
||||
? <BandoEditFormStep2 initialData={data} ref={formRef}/> : null}
|
||||
? <BandoEditFormStep2 initialData={data} ref={formRef} status={data.status}/> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Crea o modifica il Form compilabile dal Beneficiario', 'gepafin')}</h2>
|
||||
@@ -300,11 +315,13 @@ const BandoEdit = () => {
|
||||
<div className="row">
|
||||
<Button
|
||||
type="button"
|
||||
outlined={data.status === 'PUBLISH'}
|
||||
onClick={openBandoFormManagement}
|
||||
label={__('Crea/modifica form', 'gepafin')}/>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
outlined={data.status === 'PUBLISH'}
|
||||
onClick={openBandoFlowManagement}
|
||||
icon="pi pi-sitemap"
|
||||
iconPos="right"
|
||||
|
||||
Reference in New Issue
Block a user