- fixed styles for fileupload;
- fixed funcionality of form fields; - added 'submit question' functionality;
This commit is contained in:
@@ -19,6 +19,7 @@ import { Button } from 'primereact/button';
|
||||
import BandoService from '../../service/bando-service';
|
||||
import { Messages } from 'primereact/messages';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import FaqItemService from '../../service/faq-item-service';
|
||||
|
||||
const BandoViewBeneficiario = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
@@ -48,6 +49,57 @@ const BandoViewBeneficiario = () => {
|
||||
|
||||
}
|
||||
|
||||
const submitNewQuestion = () => {
|
||||
if (newQuestion) {
|
||||
if (bandoMsgs.current) {
|
||||
bandoMsgs.current.clear();
|
||||
}
|
||||
const obj = {
|
||||
"id": null,
|
||||
"lookUpDataId": null,
|
||||
"title": newQuestion,
|
||||
"value": newQuestion,
|
||||
"response": "",
|
||||
"isVisible": false
|
||||
}
|
||||
storeSet.main.setAsyncRequest();
|
||||
FaqItemService.addQuestion(id, obj, createCallBack, errCreateCallback)
|
||||
}
|
||||
}
|
||||
|
||||
const createCallBack = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setNewQuestion('');
|
||||
if (bandoMsgs.current && data.message) {
|
||||
bandoMsgs.current.show([
|
||||
{
|
||||
sticky: true, severity: 'success', summary: '',
|
||||
detail: data.message,
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
|
||||
setTimeout(() => {
|
||||
bandoMsgs.current.clear();
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errCreateCallback = (data) => {
|
||||
if (bandoMsgs.current && data.message) {
|
||||
bandoMsgs.current.show([
|
||||
{
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
detail: data.message,
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setData(getFormattedBandiData(data.data));
|
||||
@@ -77,7 +129,7 @@ const BandoViewBeneficiario = () => {
|
||||
useEffect(() => {
|
||||
const parsed = parseInt(id)
|
||||
const bandoId = !isNaN(parsed) ? parsed : 0;
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
BandoService.getBando(bandoId, getCallback, errGetCallback);
|
||||
}, [id]);
|
||||
|
||||
@@ -187,7 +239,9 @@ const BandoViewBeneficiario = () => {
|
||||
<div className="appPageSection">
|
||||
<h2>{__('FAQ', 'gepafin')}</h2>
|
||||
<Accordion>
|
||||
{data.faq.map((o, i) => <AccordionTab key={i} header={o.value}>
|
||||
{data.faq
|
||||
.filter(o => o.isVisible)
|
||||
.map((o, i) => <AccordionTab key={i} header={o.value}>
|
||||
<p>
|
||||
{o.response}
|
||||
</p>
|
||||
@@ -210,6 +264,10 @@ const BandoViewBeneficiario = () => {
|
||||
{__('Riceverai una notifica quando ti risponderemo', 'gepafin')}
|
||||
</small>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={submitNewQuestion}
|
||||
label={__('Salva', 'gepafin')}/>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
|
||||
Reference in New Issue
Block a user