- updates and fixes;
This commit is contained in:
@@ -13,6 +13,7 @@ import FormsService from '../../service/forms-service';
|
||||
|
||||
// store
|
||||
import { storeSet } from '../../store';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
|
||||
const BandoForms = () => {
|
||||
const { id } = useParams();
|
||||
@@ -30,6 +31,10 @@ const BandoForms = () => {
|
||||
navigate(`/bandi/${id}`);
|
||||
}
|
||||
|
||||
const openBandoFlowManagement = () => {
|
||||
navigate(`/bandi/${id}/flow`);
|
||||
}
|
||||
|
||||
const goToEditForm = () => {
|
||||
if (selectedForm && selectedForm !== 0) {
|
||||
navigate(`/bandi/${id}/forms/${selectedForm}`);
|
||||
@@ -49,6 +54,11 @@ const BandoForms = () => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errGetFormsCallback = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const parsed = parseInt(id)
|
||||
const bandoId = !isNaN(parsed) ? parsed : 0;
|
||||
@@ -58,7 +68,7 @@ const BandoForms = () => {
|
||||
])
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
FormsService.getFormsForCall(bandoId, getFormsCallback, () => {});
|
||||
FormsService.getFormsForCall(bandoId, getFormsCallback, errGetFormsCallback);
|
||||
}, [id]);
|
||||
|
||||
return (
|
||||
@@ -73,14 +83,6 @@ const BandoForms = () => {
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPage__content">
|
||||
<div className="appPageSection">
|
||||
<Button
|
||||
type="button"
|
||||
outlined
|
||||
onClick={goToEditBando}
|
||||
label={__('Modifica bando', 'gepafin')}
|
||||
icon="pi pi-arrow-left" iconPos="left"/>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection__withBorder disabled">
|
||||
<h2>{__('Usa un template', 'gepafin')}</h2>
|
||||
@@ -136,6 +138,25 @@ const BandoForms = () => {
|
||||
icon="pi pi-cog" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
|
||||
<div className="row">
|
||||
<Button
|
||||
type="button"
|
||||
outlined
|
||||
onClick={goToEditBando}
|
||||
label={__('Indietro', 'gepafin')}
|
||||
icon="pi pi-arrow-left" iconPos="left"/>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
onClick={openBandoFlowManagement}
|
||||
icon="pi pi-sitemap"
|
||||
iconPos="right"
|
||||
label={__('Gestisci flusso dei form', 'gepafin')}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user