diff --git a/src/components/FormFieldRepeaterFaq/index.js b/src/components/FormFieldRepeaterFaq/index.js index 0d16fa3..2420943 100644 --- a/src/components/FormFieldRepeaterFaq/index.js +++ b/src/components/FormFieldRepeaterFaq/index.js @@ -12,6 +12,7 @@ import { Dialog } from 'primereact/dialog'; import { InputSwitch } from 'primereact/inputswitch'; import renderHtmlContent from '../../helpers/renderHtmlContent'; import { Editor } from 'primereact/editor'; +import DOMPurify from 'dompurify'; const FormFieldRepeaterFaq = ({ data, @@ -143,6 +144,10 @@ const FormFieldRepeaterFaq = ({ const header = renderHeader(); + const faqOptionTemplate = (option) => { + return DOMPurify.sanitize(option.title, {ALLOWED_TAGS: ['#text']}); + } + useEffect(() => { const storeFieldData = data ?? []; setStateFieldData(storeFieldData); @@ -180,6 +185,7 @@ const FormFieldRepeaterFaq = ({ disabled={disabled} optionDisabled={(opt) => usedExistingValues().includes(opt.title)} options={stateOptionsData} + itemTemplate={faqOptionTemplate} placeholder={__('Scegli tra quelli pre-creati', 'gepafin')} optionLabel="title"/> @@ -216,9 +222,9 @@ const FormFieldRepeaterFaq = ({ } > -

+ {renderHtmlContent(o.response)} -

+ )} { return !isNaN(parsed) ? parsed : 0; } + const submitBtnLabel = () => { + if (applicationObj && applicationObj.id) { + return __('Vai alla domanda', 'gepafin'); + } else { + return __('Presenta domanda', 'gepafin'); + } + } + + const submitBtnIcon = () => { + if (applicationObj && applicationObj.id) { + return 'pi pi-arrow-right'; + } else { + return 'pi pi-save'; + } + } + const submitApplication = () => { if (data.confidi) { displayConfidiPopup(); @@ -425,8 +441,8 @@ const BandoViewBeneficiario = () => { type="button" disabled={isAsyncRequest || chosenCompanyId === 0} onClick={submitApplication} - label={__('Presenta Domanda', 'gepafin')} - icon="pi pi-save" iconPos="right"/> + label={submitBtnLabel()} + icon={submitBtnIcon()} iconPos="right"/> {/*