diff --git a/src/helpers/getStrippedHtmlBodyTags.js b/src/helpers/getStrippedHtmlBodyTags.js
new file mode 100644
index 0000000..59c4315
--- /dev/null
+++ b/src/helpers/getStrippedHtmlBodyTags.js
@@ -0,0 +1,28 @@
+import parse from 'html-react-parser';
+import DOMPurify from 'dompurify';
+
+const getEmailTemplateForSoccorso = (content = '', fallback = '') => {
+ const config = {
+ FORBID_TAGS: ['html', 'body'],
+ WHOLE_DOCUMENT: false,
+ RETURN_DOM: false,
+ RETURN_DOM_FRAGMENT: false,
+ RETURN_DOM_IMPORT: false,
+ FORCE_BODY: false,
+ ADD_TAGS: ['*'],
+ ADD_ATTR: ['*']
+ };
+ try {
+ const wrappedHtml = `
${content}
`;
+ const cleaned = DOMPurify.sanitize(wrappedHtml, config);
+
+ const tempDiv = document.createElement('div');
+ tempDiv.innerHTML = cleaned;
+ return parse(tempDiv.innerHTML);
+ } catch (error) {
+ console.error('DOMPurify cleaning error:', error);
+ return fallback;
+ }
+}
+
+export default getEmailTemplateForSoccorso;
\ No newline at end of file
diff --git a/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js b/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js
index d6249d9..36564c5 100644
--- a/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js
+++ b/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js
@@ -138,7 +138,7 @@ const RepeaterFields = ({
className="fieldsRepeater__addNew"
outlined
type="button"
- disabled={watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0 || shouldDisable}
+ disabled={(watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0) || shouldDisable}
onClick={addNew}
label={__('Aggiungi nuovo file', 'gepafin')}
/>
diff --git a/src/pages/SoccorsoEditBeneficiario/index.js b/src/pages/SoccorsoEditBeneficiario/index.js
index 21da492..4a88264 100644
--- a/src/pages/SoccorsoEditBeneficiario/index.js
+++ b/src/pages/SoccorsoEditBeneficiario/index.js
@@ -27,6 +27,7 @@ import { Dialog } from 'primereact/dialog';
import FormField from '../../components/FormField';
import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications';
import { Editor } from 'primereact/editor';
+import getEmailTemplateForSoccorso from '../../helpers/getStrippedHtmlBodyTags';
const SoccorsoEditBeneficiario = () => {
const isAsyncRequest = useStore().main.isAsyncRequest();
@@ -327,10 +328,7 @@ const SoccorsoEditBeneficiario = () => {
?
{__('Dettagli Richiesta', 'gepafin')}
{__('Note e spiegazioni', 'gepafin')}
-
- {renderHtmlContent(data.note)}
-
+
{getEmailTemplateForSoccorso(data.emailTemplate, data.note)}
: null}
{data.id
diff --git a/src/pages/SoccorsoEditPreInstructor/index.js b/src/pages/SoccorsoEditPreInstructor/index.js
index 54922dc..f6aad62 100644
--- a/src/pages/SoccorsoEditPreInstructor/index.js
+++ b/src/pages/SoccorsoEditPreInstructor/index.js
@@ -16,7 +16,7 @@ import AmendmentsService from '../../service/amendments-service';
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
import getBandoLabel from '../../helpers/getBandoLabel';
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
-import renderHtmlContent from '../../helpers/renderHtmlContent';
+import getEmailTemplateForSoccorso from '../../helpers/getStrippedHtmlBodyTags';
// components
import { Button } from 'primereact/button';
@@ -411,26 +411,19 @@ const SoccorsoEditPreInstructor = () => {
{__('Dettagli Richiesta', 'gepafin')}
-
-
-
{__('Documenti Richiesti', 'gepafin')}
-
- {data.formFields
- ? data.formFields.map((o, i) => -
- {o.label}
-
) : null}
-
-
-
-
{__('Note e spiegazioni', 'gepafin')}
-
- {renderHtmlContent(data.note)}
-
-
-
-
+
{__('Note e spiegazioni', 'gepafin')}
+
{getEmailTemplateForSoccorso(data.emailTemplate, data.note)}
+
+
+
{__('Documenti Richiesti', 'gepafin')}
+
+ {data.formFields
+ ? data.formFields.map((o, i) => -
+ {o.label}
+
) : null}
+
diff --git a/src/service/notification-service.js b/src/service/notification-service.js
index cd33e34..c3457b2 100644
--- a/src/service/notification-service.js
+++ b/src/service/notification-service.js
@@ -7,4 +7,16 @@ export default class NotificationService {
static getNotifications = (id, callback, errCallback, queryParams) => {
NetworkService.get(`${API_BASE_URL}/notification/user/${id}`, callback, errCallback, queryParams);
};
+
+ static notificationMakeRead = (id, callback, errCallback) => {
+ NetworkService.put(`${API_BASE_URL}/notification/${id}`, {}, callback, errCallback, [
+ ['status', 'READ']
+ ]);
+ };
+
+ static notificationMakeUnread = (id, callback, errCallback) => {
+ NetworkService.put(`${API_BASE_URL}/notification/${id}`, {}, callback, errCallback, [
+ ['status', 'UNREAD']
+ ]);
+ };
}