La gestione del rapporto assicurativo e il posizionamento aziendale nei confronti dell’INAIL
L’andamento infortunistico del triennio e i nuovi meccanismi di calcolo del tasso conseguenti al nuovo sistema di classificazione dei rischi introdotto dal 2019 fanno sì che le Imprese possano riscontrare incrementi anche rilevanti del premio assicurativo da versare. Proponiamo alle Aziende un supporto operativo utile a monitorare la propria situazione e ad intervenire per limitarne l'onerosità.
Si è verificato un errore nell'elaborarazione del modello.
The following has evaluated to null or missing:
==> cena  [in template "20097#20123#DETTAGLIO-APPUNTAMENTO" at line 39, column 26]

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign inPersonCheck = cena.getData()  [in template "20097#20123#DETTAGLIO-APPUNTAMENTO" at line 39, column 1]
----
1<!-- DETTAGLIO-APPUNTAMENTO Global Web Content Display Template --> 
2 
3<#include "${templatesPath}/MACRO-DETAIL-PAGE" /> 
4 
5<#assign userLocalService = serviceLocator.findService('com.liferay.portal.kernel.service.UserLocalService') /> 
6 
7<#assign detailURL = aireWidgetTemplateTool.getDetailDisplayPageURL(assetEntry, serviceContext.getThemeDisplay().getDoAsUserId()) /> 
8<#assign downloadIcsURL = "/o/unindustria/ics/calendar?groupId=" + groupId + "&eventId=" + articleid + "&eventUrl=" + detailURL /> 
9<#assign customSvgPath = themeDisplay.getPathThemeImages() + "/assets/images/icons.svg" /> 
10 
11<#assign isLoggedIn = false /> 
12<#if serviceContext.getThemeDisplay().isSignedIn()> 
13	<#assign isLoggedIn = true /> 
14</#if> 
15 
16<#assign userId = serviceContext.getThemeDisplay().getUserId() /> 
17<#assign isSubscribed = aireWidgetTemplateTool.isSubscribedEvent(articleid, userId, themeDisplay) /> 
18<#assign idEventCreation = id.getData() /> 
19<#if viewForm??> 
20	<#assign viewForm = viewForm.getData() /> 
21<#else> 
22	<#assign viewForm = "false" /> 
23</#if> 
24<#if formNotes??> 
25	<#assign formNotes = formNotes.getData() /> 
26<#else> 
27	<#assign formNotes = "" /> 
28</#if> 
29<#if formCompany??> 
30	<#assign formCompany = formCompany.getData() /> 
31<#else> 
32	<#assign formCompany = "" /> 
33</#if> 
34<#assign user = userLocalService.fetchUser(userId) /> 
35<#assign userFirstName = user.getFirstName() /> 
36<#assign userSurname = user.getLastName() /> 
37<#assign userEmail = user.getEmailAddress() /> 
38 
39<#assign inPersonCheck = cena.getData() /> 
40<#assign publicPartCheck = parte_pubblica.getData() /> 
41<#assign privatePartCheck = parte_privata.getData() /> 
42<#assign streamingCheck = streaming.getData() /> 
43 
44<#assign selfCheckboxVisibility = ""/> 
45<#assign selfAutoFlagged = "false" /> 
46<#assign selfFormVisibility = "d-none"/> 
47 
48<#if !isLoggedIn> 
49	<#assign selfCheckboxVisibility = "d-none"/> 
50	<#assign selfAutoFlagged = "true" /> 
51	<#assign selfFormVisibility = ""/> 
52</#if> 
53 
54<div class="webcontent-detail pt-0"> 
55	<div class="webcontent-detail__calendar-info"> 
56		<div class="container"> 
57			<div class="row"> 
58				<div class="col-12"> 
59					<div class="d-flex flex-column flex-md-row justify-content-md-between align-items-md-center"> 
60						<div> 
61							<strong class="text-uppercase">${dateUtil.getDate(data.getData()?date("yyyy-MM-dd"), 'dd MMMM yyyy', locale)}</strong> 
62							- ${languageUtil.get(locale, "aire.hour.from")} ${ora_inizio.getData()} ${languageUtil.get(locale, "aire.hour.to")} ${ora_fine.getData()} 
63						</div> 
64						<div class="d-flex align-items-center justify-content-between"> 
65							<div> 
66								<button type="button" onclick="window.open('${downloadIcsURL}','_self')" target="_self" class="webcontent-detail__calendar d-flex align-items-center"> 
67									<svg class="ico-svg add"> 
68										<use xlink:href="${themeIconsPath}#calendar-alt-light"></use> 
69									</svg> 
70									<span class="add">${languageUtil.get(locale, "aire.mark.calendar")}</span> 
71								</button> 
72							</div> 
73							<#if partecipazione?? && partecipazione.getData()?has_content> 
74								<#if viewForm == "true"> 
75									<#if aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && !isLoggedIn> 
76										<div class="ml-md-4"> 
77											<button type="button" class="cta-link cta-link--icon" data-toggle="modal" data-target="#login"> 
78												<span class="d-none d-lg-inline-block"><@liferay.language key="aire.signing" /></span> 
79												<svg class="ico-svg"> 
80													<use xlink:href="${customSvgPath}#user-light"></use> 
81												</svg> 
82											</button> 
83										</div> 
84									<#elseif aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn && !isSubscribed> 
85										<div class="ml-md-4"> 
86											<a href="#subscribe-event" title="${languageUtil.get(locale, "aire.signing")}" class="cta-link"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
87										</div> 
88									<#elseif !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn && !isSubscribed> 
89										<div class="ml-md-4"> 
90											<a href="#subscribe-event" title="${languageUtil.get(locale, "aire.signing")}" class="btn-cta btn-cta--white"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
91										</div> 
92									<#elseif !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && !isLoggedIn> 
93										<div class="ml-md-4"> 
94											<a href="#subscribe-event" title="${languageUtil.get(locale, "aire.signing")}" class="btn-cta btn-cta--white"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
95										</div> 
96									</#if> 
97								<#elseif link_iscriviti.getData()?has_content> 
98									<#if aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && !isLoggedIn> 
99										<div class="ml-md-4"> 
100											<button type="button" class="cta-link cta-link--icon" data-toggle="modal" data-target="#login"> 
101												<span class="d-none d-lg-inline-block"><@liferay.language key="aire.signing" /></span> 
102												<svg class="ico-svg"> 
103													<use xlink:href="${customSvgPath}#user-light"></use> 
104												</svg> 
105											</button> 
106										</div> 
107									<#elseif aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn> 
108										<div class="ml-md-4"> 
109											<a href="${link_iscriviti.getData()}" target="_blank" title="${languageUtil.get(locale, "aire.signing")}" class="cta-link"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
110										</div> 
111									<#elseif !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData())> 
112										<div class="ml-md-4"> 
113											<a href="${link_iscriviti.getData()}" target="_blank" title="${languageUtil.get(locale, "aire.signing")}" class="cta-link"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
114										</div> 
115									</#if> 
116								</#if> 
117							</#if> 
118						</div> 
119					</div> 
120				</div> 
121			</div> 
122		</div> 
123	</div> 
124	<div class="container"> 
125		<div class="row"> 
126			<nav class="col-md-4"> 
127				<div class="webcontent-detail__nav"> 
128					<ul> 
129    					<#if programma_titolo.getSiblings()[0].getData() != ""> 
130    					    <li><a href="#section-1" title="${languageUtil.get(locale, "aire.program")}">${languageUtil.get(locale, "aire.program")}</a></li> 
131    					</#if> 
132    					<#if logo_sponsor.getSiblings()[0].getData() != ""> 
133	                        <li><a href="#section-2" title="${languageUtil.get(locale, "aire.partner")}">${languageUtil.get(locale, "aire.partner")}</a></li> 
134                        </#if> 
135                        <#if documenti_allegati.getSiblings()[0].getData() != "" && ((aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn) ||  !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()))> 
136                        	<li><a href="#section-3" title="${languageUtil.get(locale, "aire.section.documents")}">${languageUtil.get(locale, "aire.section.documents")}</a></li> 
137                        </#if> 
138					</ul> 
139					<div class="webcontent-detail__box"> 
140						<div class="webcontent-detail__box-title">${languageUtil.get(locale, "aire.information")}</div> 
141						<div class="webcontent-detail__info d-flex"> 
142							<svg class="ico-svg add"> 
143								<use xlink:href="${themeIconsPath}#calendar-alt-light"></use> 
144							</svg> 
145							<div> 
146								<div class="webcontent-detail__info-title">${languageUtil.get(locale, "aire.event.date")}</div> 
147								<div> 
148									<span class="text-uppercase">${dateUtil.getDate(data.getData()?date("yyyy-MM-dd"), 'dd MMMM yyyy', locale)}</span> 
149									<br> 
150									${languageUtil.get(locale, "aire.hour.from")} ${ora_inizio.getData()} ${languageUtil.get(locale, "aire.hour.to")} ${ora_fine.getData()} 
151								</div> 
152							</div> 
153						</div> 
154						<div class="webcontent-detail__info d-flex"> 
155							<svg class="ico-svg add"> 
156								<use xlink:href="${themeIconsPath}#map-marker-alt-light"></use> 
157							</svg> 
158							<div> 
159								<div class="webcontent-detail__info-title">${languageUtil.get(locale, "aire.location")}</div> 
160								<div>${luogo.getData()}</div> 
161							</div> 
162						</div> 
163						<#if categorieEvento?has_content> 
164    						<div class="webcontent-detail__info d-flex"> 
165    							<svg class="ico-svg add"> 
166    								<use xlink:href="${themeIconsPath}#info-light"></use> 
167    							</svg> 
168    							<div> 
169    								<div class="webcontent-detail__info-title">${languageUtil.get(locale, "aire.typology")}</div> 
170    								<#list categorieEvento as tipoEvento> 
171    								    <div>${tipoEvento.getName()}</div> 
172    								</#list> 
173    							</div> 
174    						</div> 
175						</#if> 
176					</div> 
177					<div class="webcontent-detail__box"> 
178						<div class="webcontent-detail__box-title">${languageUtil.get(locale, "aire.signing")}</div> 
179						<div> 
180							<button type="button" onclick="window.open('${downloadIcsURL}','_self')" target="_self" class="webcontent-detail__calendar d-flex align-items-center"> 
181								<svg class="ico-svg add"> 
182									<use xlink:href="${themeIconsPath}#calendar-alt-light"></use> 
183								</svg> 
184								<span class="add">${languageUtil.get(locale, "aire.mark.calendar")}</span> 
185							</button> 
186							<#if partecipazione?? && partecipazione.getData()?has_content> 
187								<#if viewForm == "true"> 
188									<#if aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && !isLoggedIn> 
189											<button type="button" class="cta-link cta-link--icon" data-toggle="modal" data-target="#login"> 
190												<span class="d-none d-lg-inline-block"><@liferay.language key="aire.signing" /></span> 
191												<svg class="ico-svg"> 
192													<use xlink:href="${customSvgPath}#user-light"></use> 
193												</svg> 
194											</button> 
195									<#elseif aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn && !isSubscribed> 
196											<a href="#subscribe-event" title="${languageUtil.get(locale, "aire.signing")}" class="cta-link"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
197									<#elseif !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn && !isSubscribed> 
198											<a href="#subscribe-event" title="${languageUtil.get(locale, "aire.signing")}" class="btn-cta btn-cta--white"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
199									<#elseif !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && !isLoggedIn> 
200											<a href="#subscribe-event" title="${languageUtil.get(locale, "aire.signing")}" class="btn-cta btn-cta--white"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
201									</#if> 
202								<#elseif link_iscriviti.getData()?has_content> 
203									<#if aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && !isLoggedIn> 
204										<button type="button" class="cta-link cta-link--icon" data-toggle="modal" data-target="#login"> 
205											<span class="d-none d-lg-inline-block"><@liferay.language key="aire.signing" /></span> 
206											<svg class="ico-svg"> 
207												<use xlink:href="${customSvgPath}#user-light"></use> 
208											</svg> 
209										</button> 
210									<#elseif aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn> 
211										<a href="${link_iscriviti.getData()}" target="_blank" title="${languageUtil.get(locale, "aire.signing")}" class="cta-link"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
212									<#elseif !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData())> 
213										<a href="${link_iscriviti.getData()}" target="_blank" title="${languageUtil.get(locale, "aire.signing")}" class="cta-link"><span>${languageUtil.get(locale, "aire.signing")}</span></a> 
214									</#if> 
215								</#if> 
216							</#if> 
217						</div> 
218					</div> 
219					<#if partecipazione.getData() != ""> 
220    					<div class="webcontent-detail__box"> 
221    						<div class="webcontent-detail__box-title">${languageUtil.get(locale, "aire.participation")}</div> 
222							<div> 
223								${partecipazione.getData()} 
224							</div> 
225    					</div> 
226    				</#if> 
227					<#if tags?has_content> 
228						<div class="webcontent-detail__box"> 
229							<div class="webcontent-detail__box-title">${languageUtil.get(locale, "aire.section.tag")}</div> 
230							<div> 
231								<#list tags as tag> 
232									<a href="/ricerca?tag=${tag.getTagId()}" title="${tag.getName()}" class="webcontent-detail__tag">#${tag.getName()}</a> 
233								</#list> 
234							</div> 
235						</div> 
236					</#if> 
237				</div> 
238			</nav> 
239			<div class="col-md-8"> 
240				<div class="webcontent-detail__main"> 
241					<div class="d-flex justify-content-between"> 
242						<div class="d-flex"> 
243							<div class="webcontent-detail__category"> 
244								<#list categorieTema as categoria> 
245									<span>${categoria.getName()?upper_case}</span> 
246								</#list> 
247							</div> 
248							<#if categorieGruppo?has_content> 
249								<div class="webcontent-detail__category_group"><#list categorieGruppo as categoriaG><span>${categoriaG.getName()?upper_case}</span></#list></div> 
250							</#if> 
251						</div> 
252						<div class="bookmark position-relative"> 
253							<@bookmarkCheck className=className classPK=classPK structureId=structureId /> 
254						</div> 
255					</div> 
256                    <#if video?? && video.getSiblings()[0].getData() != ""> 
257                        <section id="section-video" class="webcontent-detail__img"> 
258                            <#list video.getSiblings() as cur_video> 
259                                <#if cur_video.getData()?? && cur_video.getData() != ""> 
260                                    <div class="article-detail__video iframe-responsive"> 
261                                        <iframe src="${cur_video.getData()}" width="640" height="362" frameborder="0" allow="autoplay; fullscreen" allowfullscreen="allowfullscreen" loading="lazy">..</iframe> 
262                                    </div> 
263                                </#if> 
264                            </#list> 
265                        </section> 
266                    <#elseif immagine.getData()?has_content> 
267                        <img src="${immagine.getData()}" alt="${titolo.getData()}" class="webcontent-detail__img" /> 
268                    </#if> 
269 
270					<#if descrizione.getData()?has_content> 
271						${descrizione.getData()} 
272					</#if> 
273					<#if programma_titolo.getSiblings()[0].getData() != ""> 
274						<section id="section-1" class="webcontent-detail__section"> 
275							<h2 class="webcontent-detail__section-title">${languageUtil.get(locale, "aire.program")}</h2> 
276								<#if programma_titolo.getSiblings()?has_content> 
277									<#list programma_titolo.getSiblings() as cur_programma_titolo> 
278										<p> 
279											<strong>${cur_programma_titolo.programma_ora.getData()} - ${cur_programma_titolo.getData()}</strong> 
280										</p> 
281										${cur_programma_titolo.programma_descrizione.getData()} 
282									</#list> 
283								</#if> 
284						</section> 
285					</#if> 
286					<#if logo_sponsor.getSiblings()[0].getData() != ""> 
287						<section id="section-2" class="webcontent-detail__section"> 
288							<h2 class="webcontent-detail__section-title">${languageUtil.get(locale, "aire.partner")}</h2> 
289						    <div class="row"> 
290    							<#list logo_sponsor.getSiblings() as logo> 
291    							    <div class="col-md-3 mb-2"> 
292    							        <img alt="${logo.getAttribute('alt')}" src="${logo.getData()}" /> 
293    							    </div> 
294    							</#list> 
295						    </div> 
296						</section> 
297					</#if> 
298					<#if documenti_allegati.getSiblings()[0].getData() != "" && ((aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && isLoggedIn) || !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()))> 
299						<section id="section-3" class="webcontent-detail__section"> 
300							<h2 class="webcontent-detail__section-title">${languageUtil.get(locale, "aire.section.documents")}</h2> 
301							<#list documenti_allegati.getSiblings() as allegato> 
302								<#if allegato.getData() != ""> 
303									<@mostraAllegato allegato /> 
304									<#if allegato.titolo_doc.getData() != ""> 
305										<#assign titoloAllegato = allegato.titolo_doc.getData()> 
306									<#else> 
307										<#assign titoloAllegato = allegatoTitle> 
308									</#if> 
309									<a href="${fileEntryDownloadURL}" title="${titoloAllegato}" class="webcontent-detail__attachment d-flex align-items-end w-100"> 
310										<svg class="ico-svg"> 
311											<use xlink:href="${themeIconsPath}#arrow-to-bottom-light"></use> 
312										</svg> 
313										</svg> 
314										<span>${titoloAllegato}</span> 
315									</a> 
316								</#if> 
317							</#list> 
318						</section> 
319					</#if> 
320				</div> 
321			</div> 
322		</div> 
323	</div> 
324</div> 
325 
326<#assign formVisible = "false" /> 
327<#if partecipazione?? && partecipazione.getData()?has_content && viewForm == "true"> 
328    <#if isLoggedIn && !isSubscribed> 
329        <#assign formVisible = "true" /> 
330    <#elseif !isLoggedIn && !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData())> 
331        <#assign formVisible = "true" /> 
332    </#if> 
333</#if> 
334 
335<#if formVisible == "true"> 
336	<div class="container"> 
337		<div class="row"> 
338			<div class="col-12"> 
339				<form action="javascript:void(0);" method="post" id="subscribe-event" class="form" aria-label="<@liferay.language key='aire.subscribe.event' />"> 
340					<div class="row"> 
341						<div class="col-12"> 
342							<h2 style="margin-bottom: 10px;"><@liferay.language key="aire.subscribe.event" /></h2> 
343						</div> 
344					</div> 
345					<#if isLoggedIn> 
346                        <div class="row" id="detail-appointment-text"> 
347                            <div class="col-12"> 
348                                <h5 style="margin-bottom: 20px;font-weight: 400;"><@liferay.language key="aire.text.detail.appointment" /></h5> 
349                            </div> 
350                        </div> 
351					</#if> 
352					<div class="row"> 
353						<div class="col-12"> 
354							<div class="d-flex flex-wrap"> 
355								<div class="mr-5" style="min-width: 150px; max-width: 500px;"> 
356									<fieldset> 
357 
358										<div class="row" id="form-event-subscribe-self"> 
359 
360											<div class="col-12 ${selfCheckboxVisibility}"> 
361												<div class="d-flex align-items-center"> 
362													<div class="form__group d-flex flex-column align-content-center mr-2"> 
363														<input type="checkbox" name="subscribeSelf" id="subscribeSelf" class="form__input-text align-self-center checkbox-change" value="${selfAutoFlagged}"/> 
364													</div> 
365												    <div class="d-flex py-2 mr-3"> 
366														<label class="form__label m-0" for="subscribeSelf" style="width: 220px;"><@liferay.language key="aire.subscribe.self" /></label> 
367													</div> 
368												</div> 
369											</div> 
370 
371											<div class="col-12"> 
372												<div class="form__group subscribe-self mt-3 ${selfFormVisibility}"> 
373													<label class="form__label" for="nameSelf" style="width: 200px;"> 
374														<@liferay.language key="aire.name" /> 
375														<span class="reference-mark text-warning" id="fehs____"> 
376                                                            <svg aria-hidden="true" class="lexicon-icon lexicon-icon-asterisk" focusable="false"> 
377                                                                <use href="${htmlUtil.escape(themeDisplay.getPathThemeImages())}/clay/icons.svg#asterisk"></use> 
378                                                            </svg> 
379                                                        </span> 
380													</label> 
381													<#if isLoggedIn> 
382														<input type="text" name="nameSelf" id="nameSelf" class="form__input-text w-100 required" readonly value="${userFirstName}" style="min-width: 100px; max-width: 500px;background-color: rgba(18,80,149,.1);border: 0px;"/> 
383													<#else> 
384														<input type="text" name="nameSelf" id="nameSelf" class="form__input-text w-100 required" style="min-width: 100px; max-width: 500px;"/> 
385													</#if> 
386												</div> 
387											</div> 
388											<div class="col-12"> 
389												<div class="form__group subscribe-self ${selfFormVisibility}"> 
390													<label class="form__label" for="surnameSelf" style="width: 200px;"> 
391														<@liferay.language key="aire.surname" /> 
392														<span class="reference-mark text-warning" id="fehs____"> 
393                                                            <svg aria-hidden="true" class="lexicon-icon lexicon-icon-asterisk" focusable="false"> 
394                                                                <use href="${htmlUtil.escape(themeDisplay.getPathThemeImages())}/clay/icons.svg#asterisk"></use> 
395                                                            </svg> 
396                                                        </span> 
397													</label> 
398													<#if isLoggedIn> 
399														<input type="text" name="surnameSelf" id="surnameSelf" class="form__input-text w-100 required" readonly value="${userSurname}" style="min-width: 100px; max-width: 500px;background-color: rgba(18,80,149,.1);border: 0px;"/> 
400													<#else> 
401														<input type="text" name="surnameSelf" id="surnameSelf" class="form__input-text w-100 required" style="min-width: 100px; max-width: 500px;"/> 
402													</#if> 
403												</div> 
404											</div> 
405											<div class="col-12"> 
406												<div class="form__group subscribe-self ${selfFormVisibility}"> 
407													<label class="form__label" for="emailSelf" style="width: 200px;"> 
408														<@liferay.language key="aire.email" /> 
409														<span class="reference-mark text-warning" id="fehs____"> 
410                                                            <svg aria-hidden="true" class="lexicon-icon lexicon-icon-asterisk" focusable="false"> 
411                                                                <use href="${htmlUtil.escape(themeDisplay.getPathThemeImages())}/clay/icons.svg#asterisk"></use> 
412                                                            </svg> 
413                                                        </span> 
414													</label> 
415													<#if isLoggedIn> 
416														<input type="text" name="emailSelf" id="emailSelf" class="form__input-text w-100 required" readonly value="${userEmail}" style="min-width: 100px; max-width: 500px;background-color: rgba(18,80,149,.1);border: 0px;"/> 
417													<#else> 
418														<input type="text" name="emailSelf" id="emailSelf" class="form__input-text w-100 required" style="min-width: 100px; max-width: 500px;"/> 
419													</#if> 
420                                                    <span class="d-none text-danger" id="subscription-duplicate-email-self"><@liferay.language key="aire.subscribe.event.duplicated.mail" /></span> 
421		                                            <span class="d-none text-danger" id="subscription-already-registered-self"><@liferay.language key="aire.subscribe.event.already.registered" /></span> 
422												</div> 
423											</div> 
424											<#if formCompany == "true"> 
425												<div class="col-12"> 
426													<div class="form__group  ${selfFormVisibility} subscribe-self"> 
427														<label class="form__label" for="companySelf" style="width: 200px;"><@liferay.language key="aire.company" /></label> 
428														<textarea type="text" name="companySelf" id="companySelf" class="form__input-text w-100" style="min-width: 100px; max-width: 500px;"></textarea> 
429													</div> 
430												</div> 
431											</#if> 
432											<#if formNotes == "true"> 
433												<div class="col-12"> 
434													<div class="form__group ${selfFormVisibility} subscribe-self"> 
435														<label class="form__label" for="notesSelf" style="width: 200px;"><@liferay.language key="aire.notes" /></label> 
436														<textarea type="text" name="notesSelf" id="notesSelf" class="form__input-text w-100" style="min-width: 100px; max-width: 500px;"></textarea> 
437													</div> 
438												</div> 
439											</#if> 
440 
441                                            <#if privatePartCheck == "true"> 
442                                                <div class="col-12"> 
443                                                    <div class="subscribe-self ${selfFormVisibility}"> 
444                                                        <div class="d-flex align-items-center"> 
445                                                            <div class="form__group d-flex flex-column align-content-center mr-2"> 
446                                                                <input type="checkbox" name="privatePartSelf" id="privatePartSelf" class="form__input-text align-self-center checkbox-change" value="false"/> 
447                                                            </div> 
448                                                            <div class="d-flex py-2"> 
449                                                                <label class="form__label m-0" for="privatePartSelf" style="width: 220px;"><@liferay.language key="aire.private.part" /></label> 
450                                                            </div> 
451                                                        </div> 
452                                                    </div> 
453                                                </div> 
454                                            </#if> 
455 
456											<#if publicPartCheck == "true"> 
457												<div class="col-12"> 
458													<div class="subscribe-self ${selfFormVisibility}"> 
459														<div class="d-flex align-items-center"> 
460															<div class="form__group d-flex flex-column align-content-center mr-2"> 
461																<input type="checkbox" name="publicPartSelf" id="publicPartSelf" class="form__input-text align-self-center checkbox-change" value="false"/> 
462															</div> 
463                                                            <div class="d-flex py-2"> 
464																<label class="form__label m-0" for="publicPartSelf" style="width: 220px;"><@liferay.language key="aire.public.part" /></label> 
465															</div> 
466														</div> 
467													</div> 
468												</div> 
469											</#if> 
470 
471											<#if inPersonCheck == "true"> 
472                                                <div class="col-12"> 
473                                                    <div class="subscribe-self ${selfFormVisibility}"> 
474                                                        <div class="d-flex align-items-center"> 
475                                                            <div class="form__group d-flex flex-column align-content-center mr-2"> 
476                                                                <input type="checkbox" name="inPersonSelf" id="inPersonSelf" class="form__input-text align-self-center checkbox-change" value="false"/> 
477                                                            </div> 
478                                                            <div class="d-flex py-2 mr-3"> 
479                                                                <label class="form__label m-0" for="inPersonSelf" style="width: 220px;"> 
480                                                                    <#if cenaLabel?? && cenaLabel?has_content && cenaLabel.getData()?trim != ""> 
481                                                                        ${languageUtil.format(locale, "aire.in.person", cenaLabel.getData()?trim, false)} 
482                                                                    <#else> 
483                                                                        <@liferay.language key="aire.live" /> 
484                                                                    </#if> 
485                                                                </label> 
486                                                            </div> 
487                                                        </div> 
488                                                    </div> 
489                                                </div> 
490											</#if> 
491 
492											<#if streamingCheck == "true"> 
493												<div class="col-12"> 
494													<div class="subscribe-self ${selfFormVisibility}"> 
495														<div class="d-flex align-items-center"> 
496															<div class="form__group d-flex flex-column align-content-center mr-2"> 
497																<input type="checkbox" name="streamingSelf" id="streamingSelf" class="form__input-text align-self-center checkbox-change" value="false"/> 
498															</div> 
499															<div class="d-flex py-2 mr-3"> 
500																<label class="form__label m-0" for="streamingSelf" style="width: 220px;"><@liferay.language key="aire.remote" /></label> 
501															</div> 
502														</div> 
503													</div> 
504												</div> 
505											</#if> 
506											<#if !aireWidgetTemplateTool.isPrivateAppointment(partecipazione.getData()) && !isLoggedIn> 
507												<div class="col-12"> 
508													<@liferay_captcha["captcha"]/> 
509												</div> 
510											</#if> 
511										</div> 
512 
513									</fieldset> 
514								</div> 
515								<#if isLoggedIn> 
516									<div class="mr-5" style="min-width: 150px; max-width: 500px;"> 
517 
518										<fieldset> 
519											<div class="row" id="form-event-subscribe-other"> 
520 
521												<div class="col-12"> 
522													<div class="d-flex align-items-center"> 
523														<div class="form__group d-flex flex-column align-content-center mr-2"> 
524															<input type="checkbox" name="subscribeOther" id="subscribeOther" class="form__input-text align-self-center checkbox-change" value="false"/> 
525														</div> 
526														<div class="d-flex py-2 mr-3"> 
527															<label class="form__label m-0" for="subscribeOther" style="width: 220px;"><@liferay.language key="aire.subscribe.other" /></label> 
528														</div> 
529													</div> 
530												</div> 
531												<div class="col-12"> 
532													<div class="form__group subscribe-other d-none mt-3"> 
533														<label class="form__label" for="nameOther" style="width: 200px;"> 
534															<@liferay.language key="aire.name" /> 
535															<span class="reference-mark text-warning" id="fehs____"> 
536                                                                <svg aria-hidden="true" class="lexicon-icon lexicon-icon-asterisk" focusable="false"> 
537                                                                    <use href="${htmlUtil.escape(themeDisplay.getPathThemeImages())}/clay/icons.svg#asterisk"></use> 
538                                                                </svg> 
539                                                            </span> 
540														</label> 
541															<input type="text" name="nameOther" id="nameOther" class="form__input-text w-100 required" style="min-width: 100px; max-width: 500px;"/> 
542													</div> 
543												</div> 
544												<div class="col-12"> 
545													<div class="form__group subscribe-other d-none"> 
546														<label class="form__label" for="surnameOther" style="width: 200px;"> 
547															<@liferay.language key="aire.surname" /> 
548															<span class="reference-mark text-warning" id="fehs____"> 
549                                                                <svg aria-hidden="true" class="lexicon-icon lexicon-icon-asterisk" focusable="false"> 
550                                                                    <use href="${htmlUtil.escape(themeDisplay.getPathThemeImages())}/clay/icons.svg#asterisk"></use> 
551                                                                </svg> 
552                                                            </span> 
553														</label> 
554														<input type="text" name="surnameOther" id="surnameOther" class="form__input-text w-100 required" style="min-width: 100px; max-width: 500px;"/> 
555													</div> 
556												</div> 
557												<div class="col-12"> 
558													<div class="form__group subscribe-other d-none"> 
559														<label class="form__label" for="emailOther" style="width: 200px;"> 
560															<@liferay.language key="aire.email" /> 
561															<span class="reference-mark text-warning" id="fehs____"> 
562                                                                <svg aria-hidden="true" class="lexicon-icon lexicon-icon-asterisk" focusable="false"> 
563                                                                    <use href="${htmlUtil.escape(themeDisplay.getPathThemeImages())}/clay/icons.svg#asterisk"></use> 
564                                                                </svg> 
565                                                            </span> 
566														</label> 
567														<input type="text" name="emailOther" id="emailOther" class="form__input-text w-100 required" style="min-width: 100px; max-width: 500px;"/> 
568                                                        <span class="d-none text-danger" id="subscription-duplicate-email-other"><@liferay.language key="aire.subscribe.event.duplicated.mail" /></span> 
569                                                        <span class="d-none text-danger" id="subscription-already-registered-other"><@liferay.language key="aire.subscribe.event.already.registered" /></span> 
570													</div> 
571												</div> 
572												<#if formCompany == "true"> 
573													<div class="col-12"> 
574														<div class="form__group subscribe-other d-none"> 
575															<label class="form__label" for="companyOther" style="width: 200px;"><@liferay.language key="aire.company" /></label> 
576															<textarea type="text" name="companyOther" id="companyOther" class="form__input-text w-100" style="min-width: 100px; max-width: 500px;"></textarea> 
577														</div> 
578													</div> 
579												</#if> 
580												<#if formNotes == "true"> 
581													<div class="col-12"> 
582														<div class="form__group subscribe-other d-none"> 
583															<label class="form__label" for="notesOther" style="width: 200px;"><@liferay.language key="aire.notes" /></label> 
584															<textarea type="text" name="notesOther" id="notesOther" class="form__input-text w-100" style="min-width: 100px; max-width: 500px;"></textarea> 
585														</div> 
586													</div> 
587												</#if> 
588 
589                                                <#if privatePartCheck == "true"> 
590                                                    <div class="col-12"> 
591                                                        <div class="subscribe-other d-none"> 
592                                                            <div class="d-flex align-items-center"> 
593                                                                <div class="form__group d-flex flex-column align-content-center mr-2"> 
594                                                                    <input type="checkbox" name="privatePartOther" id="privatePartOther" class="form__input-text align-self-center checkbox-change" value="false"/> 
595                                                                </div> 
596                                                                <div class="d-flex py-2 mr-3"> 
597                                                                    <label class="form__label m-0" for="privatePartOther" style="width: 220px;"><@liferay.language key="aire.private.part" /></label> 
598                                                                </div> 
599                                                            </div> 
600                                                        </div> 
601                                                    </div> 
602                                                </#if> 
603 
604												<#if publicPartCheck == "true"> 
605													<div class="col-12"> 
606														<div class="subscribe-other d-none"> 
607															<div class="d-flex align-items-center"> 
608																<div class="form__group d-flex flex-column align-content-center mr-2"> 
609																	<input type="checkbox" name="publicPartOther" id="publicPartOther" class="form__input-text align-self-center checkbox-change" value="false"/> 
610																</div> 
611																<div class="d-flex py-2 mr-3"> 
612																	<label class="form__label m-0" for="publicPartOther" style="width: 220px;"><@liferay.language key="aire.public.part" /></label> 
613																</div> 
614															</div> 
615														</div> 
616													</div> 
617												</#if> 
618 
619												<#if inPersonCheck == "true"> 
620													<div class="col-12"> 
621														<div class="subscribe-other d-none"> 
622															<div class="d-flex align-items-center"> 
623                                                                <div class="form__group d-flex flex-column align-content-center mr-2"> 
624                                                                    <input type="checkbox" name="inPersonOther" id="inPersonOther" class="form__input-text align-self-center checkbox-change" value="false"/> 
625                                                                </div> 
626																<div class="d-flex py-2"> 
627																	<label class="form__label m-0" for="inPersonOther" style="width: 220px;"> 
628                                                                        <#if cenaLabel?? && cenaLabel?has_content && cenaLabel.getData()?trim != ""> 
629                                                                            ${languageUtil.format(locale, "aire.in.person", cenaLabel.getData()?trim, false)} 
630                                                                        <#else> 
631                                                                            <@liferay.language key="aire.live" /> 
632                                                                        </#if> 
633                                                                    </label> 
634																</div> 
635															</div> 
636														</div> 
637													</div> 
638												</#if> 
639 
640												<#if streamingCheck == "true"> 
641													<div class="col-12"> 
642														<div class="subscribe-other d-none align-items-center"> 
643															<div class="d-flex align-items-center"> 
644																<div class="form__group d-flex flex-column align-content-center mr-2"> 
645																	<input type="checkbox" name="streamingOther" id="streamingOther" class="form__input-text align-self-center checkbox-change" value="false"/> 
646																</div> 
647																<div class="d-flex py-2"> 
648																	<label class="form__label m-0" for="streamingOther" style="width: 220px;"><@liferay.language key="aire.remote" /></label> 
649																</div> 
650															</div> 
651														</div> 
652													</div> 
653												</#if> 
654 
655											</div> 
656										</fieldset> 
657									</div> 
658								</#if> 
659								<div id="privacy-element" class="col-12 pl-0 ${selfFormVisibility}"> 
660									<div> 
661										<div class="d-flex align-items-center"> 
662											<div class="form__group d-flex flex-column align-content-center mr-2"> 
663												<input type="checkbox" name="privacy" id="privacy" class="form__input-text align-self-center" value="false"/> 
664											</div> 
665											<div class="d-flex py-2"> 
666												<label class="form__label m-0" for="privacy"><i><@liferay.language key='aire.privacy.condition' /></i> 
667												    <span class="reference-mark text-warning" id="fehs____"> 
668                                                        <svg aria-hidden="true" class="lexicon-icon lexicon-icon-asterisk" focusable="false"> 
669                                                            <use href="${htmlUtil.escape(themeDisplay.getPathThemeImages())}/clay/icons.svg#asterisk"></use> 
670                                                        </svg> 
671                                                    </span> 
672												</label> 
673 
674											</div> 
675										</div> 
676									</div> 
677								</div> 
678							</div> 
679						</div> 
680					</div> 
681					<div class="row"> 
682						<div class="col-12"> 
683							<div class="form__group" id="submit-form-event"> 
684								<input id="submitInput" type="submit" value="<@liferay.language key='aire.signing' />" aria-label="<@liferay.language key='aire.signing'/>" title="<@liferay.language key='aire.signing' />" class="form__submit cta-link text-white" style="margin-bottom: 20px;margin-top: 10px;padding: 0 10px"/> 
685							</div> 
686						</div> 
687					</div> 
688					<div class="row"> 
689						<div class="col-12"> 
690							<span class="d-none text-danger" id="subscription-required"><@liferay.language key="aire.subscribe.event.required" /></span> 
691							<span class="d-none" id="subscription-successful"><@liferay.language key="aire.subscribe.event.success" /></span> 
692							<span class="d-none" id="subscription-error"><@liferay.language key="aire.subscribe.event.error" /></span> 
693						</div> 
694					</div> 
695				</form> 
696			</div> 
697		</div> 
698	</div> 
699</#if> 
700 
701<#if isSubscribed> 
702  <div class="container"> 
703    <div class="row"> 
704      <div class="col-12"> 
705          <div class="row"> 
706            <div class="col-12"> 
707            	<h4 style="margin-bottom: 10px;"><@liferay.language key="aire.appointment.already.subscribed" /></h4> 
708            </div> 
709          </div> 
710      </div> 
711    </div> 
712  </div> 
713</#if> 
714 
715<div> 
716	<#if id?? && id.getData()?has_content> 
717		<input type="hidden" id="field-id" value="${id.getData()}"> 
718	</#if> 
719	<#if partecipazione?? && partecipazione.getData()?has_content> 
720		<input type="hidden" id="field-hidden-partecipazione" value="${partecipazione.getData()}"> 
721	</#if> 
722	<#if cena?? && cena.getData()?has_content> 
723		<input type="hidden" id="field-hidden-cena" value="${cena.getData()}"> 
724	</#if> 
725	<#if presenza?? && presenza.getData()?has_content> 
726		<input type="hidden" id="field-hidden-presenza" value="${presenza.getData()}"> 
727	</#if> 
728	<#if streaming?? && streaming.getData()?has_content> 
729		<input type="hidden" id="field-hidden-streaming" value="${streaming.getData()}"> 
730	</#if> 
731	<#if parte_pubblica?? && parte_pubblica.getData()?has_content> 
732		<input type="hidden" id="field-hidden-parte-pubblica" value="${parte_pubblica.getData()}"> 
733	</#if> 
734	<#if parte_privata?? && parte_privata.getData()?has_content> 
735		<input type="hidden" id="field-hidden-parte-privata" value="${parte_privata.getData()}"> 
736	</#if> 
737</div> 
738 
739<#include "${templatesPath}/A-CHI-RIVOLGERSI" /> 
740 
741<#assign isLoggedIn = isLoggedIn?string('true', 'false') /> 
742 
743<script> 
744 
745	$(document).ready(function() { 
746		$("#subscribeOther").click(function() { 
747 
748			if ($(this).is(":checked") || $("#subscribeSelf").is(":checked")) { 
749				document.getElementById("privacy-element").classList.remove('d-none'); 
750				document.getElementById("privacy-element").classList.remove('d-block'); 
751				document.getElementById("privacy-element").classList.add('d-block'); 
752			} else { 
753				document.getElementById("privacy-element").classList.remove('d-none'); 
754				document.getElementById("privacy-element").classList.remove('d-block'); 
755				document.getElementById("privacy-element").classList.add('d-none'); 
756
757		}); 
758 
759		$("#subscribeSelf").click(function() { 
760			if ($(this).is(":checked") || $("#subscribeOther").is(":checked")) { 
761				document.getElementById("privacy-element").classList.remove('d-none'); 
762				document.getElementById("privacy-element").classList.remove('d-block'); 
763				document.getElementById("privacy-element").classList.add('d-block'); 
764			} else { 
765				document.getElementById("privacy-element").classList.remove('d-none'); 
766				document.getElementById("privacy-element").classList.remove('d-block'); 
767				document.getElementById("privacy-element").classList.add('d-none'); 
768
769		}); 
770	}); 
771 
772	$(".checkbox-change").on('change', function() { 
773		$(this).attr('value', $(this).is(':checked') ? 'true' : 'false'); 
774	}); 
775 
776	function setupSubscriptionHandler(checkboxId, containerClass) { 
777 
778		let subscribeCheckbox = document.getElementById(checkboxId); 
779		let dependentContainers = document.querySelectorAll("." + containerClass); 
780		let dependentFields = document.querySelectorAll("." + containerClass + " > input"); 
781 
782		if (!subscribeCheckbox) { 
783			return; 
784
785 
786		subscribeCheckbox.addEventListener('change', function () { 
787			let isChecked = subscribeCheckbox.checked; 
788 
789			dependentContainers.forEach(container => { 
790				if (isChecked) { 
791					container.classList.remove('d-none'); 
792					container.classList.add('d-block'); 
793				} else { 
794					container.classList.remove('d-block'); 
795					container.classList.add('d-none'); 
796
797			}); 
798 
799			dependentFields.forEach(field => { 
800				if (isChecked) { 
801					field.setAttribute('required', 'required'); 
802					field.classList.add('required'); 
803				} else { 
804					field.removeAttribute('required'); 
805					field.classList.remove('required'); 
806
807			}); 
808		}); 
809
810 
811	setupSubscriptionHandler('subscribeSelf', 'subscribe-self'); 
812	setupSubscriptionHandler('subscribeOther', 'subscribe-other'); 
813 
814	let selfEmailAlreadyRegistered = false; 
815	let otherEmailAlreadyRegistered = false; 
816 
817	function normalizeEmail(email) { 
818		return (email || "").toLowerCase().trim(); 
819
820 
821	function validateEmail(email) { 
822		return String(email || "") 
823			.toLowerCase() 
824			.trim() 
825			.match( 
826				/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 
827			); 
828
829 
830    function clearSubscriptionMessages() { 
831        $("#subscription-required").addClass("d-none"); 
832        $("#subscription-error").addClass("d-none"); 
833 
834        $("#subscription-duplicate-email-self").addClass("d-none"); 
835        $("#subscription-duplicate-email-other").addClass("d-none"); 
836        $("#subscription-already-registered-self").addClass("d-none"); 
837        $("#subscription-already-registered-other").addClass("d-none"); 
838
839 
840    function updateAlreadyRegisteredMessageVisibility() { 
841        $("#subscription-already-registered-self").addClass("d-none"); 
842        $("#subscription-already-registered-other").addClass("d-none"); 
843 
844        if (selfEmailAlreadyRegistered) { 
845            $("#subscription-already-registered-self").removeClass("d-none"); 
846
847 
848        if (otherEmailAlreadyRegistered) { 
849            $("#subscription-already-registered-other").removeClass("d-none"); 
850
851
852 
853    function validateDuplicateEmailsInForm() { 
854        let selfEmail = normalizeEmail($("#emailSelf").val()); 
855        let otherEmail = normalizeEmail($("#emailOther").val()); 
856 
857        $("#subscription-duplicate-email-self").addClass("d-none"); 
858        $("#subscription-duplicate-email-other").addClass("d-none"); 
859 
860        if ( 
861            $("#subscribeSelf").val() === "true" && 
862            $("#subscribeOther").is(":checked") && 
863            selfEmail !== "" && 
864            otherEmail !== "" && 
865            selfEmail === otherEmail 
866        ) { 
867            $("#subscription-duplicate-email-self").removeClass("d-none"); 
868            $("#subscription-duplicate-email-other").removeClass("d-none"); 
869            return true; 
870
871 
872        return false; 
873
874 
875	function checkEmailAlreadyRegistered(email, onSuccess, onError) { 
876		$.ajax({ 
877			type: "GET", 
878			url: "/o/unindustria/form/event/check-email", 
879			dataType: "json", 
880			data: { 
881				eventId: "${articleid}", 
882				email: email 
883			}, 
884			success: function(data) { 
885				onSuccess(!!data.already-registered); 
886			}, 
887			error: function() { 
888				if (onError) { 
889					onError(); 
890
891
892		}); 
893
894 
895	function checkParticipantEmail(fieldId, participantType) { 
896		let email = normalizeEmail($("#" + fieldId).val()); 
897 
898		if (!email || !validateEmail(email)) { 
899			if (participantType === "self") { 
900				selfEmailAlreadyRegistered = false; 
901			} else { 
902				otherEmailAlreadyRegistered = false; 
903
904 
905			updateAlreadyRegisteredMessageVisibility(); 
906			return; 
907
908 
909		checkEmailAlreadyRegistered(email, function(alreadyRegistered) { 
910			if (participantType === "self") { 
911				selfEmailAlreadyRegistered = alreadyRegistered; 
912			} else { 
913				otherEmailAlreadyRegistered = alreadyRegistered; 
914
915 
916			updateAlreadyRegisteredMessageVisibility(); 
917		}); 
918
919 
920	$("#emailSelf").on("blur", function() { 
921		validateDuplicateEmailsInForm(); 
922		checkParticipantEmail("emailSelf", "self"); 
923	}); 
924 
925	$("#emailOther").on("blur", function() { 
926		validateDuplicateEmailsInForm(); 
927		checkParticipantEmail("emailOther", "other"); 
928	}); 
929 
930	$("#emailSelf, #emailOther").on("input", function() { 
931		if (this.id === "emailSelf") { 
932			selfEmailAlreadyRegistered = false; 
933		} else if (this.id === "emailOther") { 
934			otherEmailAlreadyRegistered = false; 
935
936 
937		updateAlreadyRegisteredMessageVisibility(); 
938		validateDuplicateEmailsInForm(); 
939	}); 
940 
941	$(document).on("click", "#submitInput", function(e){ 
942		e.preventDefault(); 
943 
944		function gatherValues(fields, permission) { 
945			if (!permission) { 
946				return ""; 
947
948 
949			let values = {}; 
950			fields.forEach(function(id) { 
951				let element = $("#" + id); 
952				if (element.length) { 
953					values[id] = element.val(); 
954
955			}); 
956			return values; 
957
958 
959		function generateUrl(values, suffix) { 
960 
961			let captchaInput = ($("[id$='captchaText']").length)? $("[id$='captchaText']").val() : ""; 
962 
963			return "/o/unindustria/form/event/subscribe?eventId=" + "${articleid}" 
964				+ "&userId=" + ${userId} 
965				+ "&userName=" + encodeURIComponent(values["name" + suffix] || "") 
966				+ "&userSurname=" + encodeURIComponent(values["surname" + suffix] || "") 
967				+ "&userEmail=" + encodeURIComponent(values["email" + suffix] || "") 
968				+ "&inPerson=" + encodeURIComponent(values["inPerson" + suffix] || "") 
969				+ "&userNotes=" + encodeURIComponent(values["notes" + suffix] || "") 
970				+ "&company=" + encodeURIComponent(values["company" + suffix] || "") 
971				+ "&captchaInput=" + encodeURIComponent(captchaInput || "") 
972				+ "&eventIdCreation=" + "${idEventCreation}" 
973				+ "&publicPart=" + encodeURIComponent(values["publicPart" + suffix] || "") 
974				+ "&privatePart=" + encodeURIComponent(values["privatePart" + suffix] || "") 
975				+ "&streaming=" + encodeURIComponent(values["streaming" + suffix] || "") 
976				+ "&isLoggedIn=" + "${isLoggedIn}"; 
977
978 
979        let isSelfActive = $("#subscribeSelf").val() === "true"; 
980        let isOtherActive = $("#subscribeOther").is(":checked"); 
981 
982        let valuesSelf = gatherValues([ 
983            "notesSelf", "companySelf", "nameSelf", "surnameSelf", "emailSelf", 
984            "inPersonSelf", "streamingSelf", "publicPartSelf", "privatePartSelf" 
985        ], isSelfActive); 
986 
987        let valuesOther = gatherValues([ 
988            "notesOther", "companyOther", "nameOther", "surnameOther", "emailOther", 
989            "inPersonOther", "streamingOther", "publicPartOther", "privatePartOther" 
990        ], isOtherActive); 
991 
992        let isSelfInputValid = ( 
993            (!isSelfActive) || 
994
995                (valuesSelf.nameSelf || "").trim().length > 0 && 
996                (valuesSelf.surnameSelf || "").trim().length > 0 && 
997                validateEmail((valuesSelf.emailSelf || "").trim()) && 
998                $("#privacy").is(":checked") 
999
1000        ); 
1001 
1002        let isOtherInputValid = ( 
1003            (!isOtherActive) || 
1004
1005                (valuesOther.nameOther || "").trim().length > 0 && 
1006                (valuesOther.surnameOther || "").trim().length > 0 && 
1007                validateEmail((valuesOther.emailOther || "").trim()) && 
1008                $("#privacy").is(":checked") 
1009
1010        ); 
1011 
1012		let selfEmail = normalizeEmail(valuesSelf.emailSelf || ""); 
1013		let otherEmail = normalizeEmail(valuesOther.emailOther || ""); 
1014 
1015		clearSubscriptionMessages(); 
1016 
1017        if ( 
1018            isSelfActive && 
1019            isOtherActive && 
1020            selfEmail !== "" && 
1021            otherEmail !== "" && 
1022            selfEmail === otherEmail 
1023        ) { 
1024            $("#subscription-duplicate-email-self").removeClass("d-none"); 
1025            $("#subscription-duplicate-email-other").removeClass("d-none"); 
1026            $("#submitInput") 
1027				.removeAttr("disabled") 
1028				.css({ 
1029					"background-color": "", 
1030					"color": "", 
1031					"opacity": "" 
1032				}); 
1033			return; 
1034
1035 
1036		if (selfEmailAlreadyRegistered || otherEmailAlreadyRegistered) { 
1037			updateAlreadyRegisteredMessageVisibility(); 
1038			$("#submitInput") 
1039				.removeAttr("disabled") 
1040				.css({ 
1041					"background-color": "", 
1042					"color": "", 
1043					"opacity": "" 
1044				}); 
1045			return; 
1046
1047 
1048        if ( 
1049            (!isSelfActive && !isOtherActive) || 
1050            (isSelfActive && !isSelfInputValid) || 
1051            (isOtherActive && !isOtherInputValid) 
1052        ) { 
1053			$("#subscription-required").removeClass("d-none"); 
1054			$("#submitInput") 
1055				.removeAttr("disabled") 
1056				.css({ 
1057					"background-color": "", 
1058					"color": "", 
1059					"opacity": "" 
1060        	}); 
1061			return; 
1062
1063 
1064		$("#subscription-required").addClass("d-none"); 
1065		$("#submitInput") 
1066			.attr("disabled", true) 
1067			.css({ 
1068			"background-color": "dimgrey", 
1069			"color": "linen", 
1070			"opacity": "1" 
1071			}); 
1072 
1073		function subscribe(urlSubscribe, callback) { 
1074			$.ajax({ 
1075				type: "GET", 
1076				url: urlSubscribe, 
1077				dataType: 'json', 
1078				success: function (data) { 
1079					if (data.results == "ok") { 
1080						$("#subscription-successful").removeClass("d-none"); 
1081						$("#subscription-error").addClass("d-none"); 
1082						$("#subscription-already-registered-self").addClass("d-none"); 
1083                        $("#subscription-already-registered-other").addClass("d-none"); 
1084 
1085						$("#form-event-subscribe-self").hide(); 
1086						$("#form-event-subscribe-other").hide(); 
1087						$("#submit-form-event").hide(); 
1088						$("#privacy-element").removeClass("d-block"); 
1089						$("#privacy-element").addClass("d-none"); 
1090						$("#detail-appointment-text").addClass("d-none"); 
1091					} else if (data.results == "already-registered") { 
1092						if ((urlSubscribe || "").indexOf("userEmail=" + encodeURIComponent($("#emailSelf").val() || "")) !== -1) { 
1093                        	$("#subscription-already-registered-self").removeClass("d-none"); 
1094                        } else { 
1095                        	$("#subscription-already-registered-other").removeClass("d-none"); 
1096
1097						$("#subscription-error").addClass("d-none"); 
1098						$("#subscription-successful").addClass("d-none"); 
1099					} else { 
1100						$("#subscription-error").removeClass("d-none"); 
1101						$("#subscription-already-registered-self").addClass("d-none"); 
1102                        $("#subscription-already-registered-other").addClass("d-none"); 
1103						$("#submitInput") 
1104							.removeAttr("disabled") 
1105							.css({ 
1106							"background-color": "", 
1107							"color": "", 
1108							"opacity": "" 
1109						}); 
1110
1111				}, 
1112				error: function() { 
1113					$("#subscription-error").removeClass("d-none"); 
1114				}, 
1115				complete: function () { 
1116					if (callback) { 
1117						callback(); 
1118
1119					$("#submitInput") 
1120						.removeAttr("disabled") 
1121						.css({ 
1122							"background-color": "", 
1123							"color": "", 
1124							"opacity": "" 
1125        			}); 
1126
1127			}); 
1128
1129 
1130		if (isSelfActive && isSelfInputValid) { 
1131			subscribe(generateUrl(valuesSelf, "Self"), function() { 
1132				if (isOtherActive && isOtherInputValid) { 
1133					subscribe(generateUrl(valuesOther, "Other"), null); 
1134
1135			}); 
1136		} else if (isOtherActive && isOtherInputValid) { 
1137			subscribe(generateUrl(valuesOther, "Other"), null); 
1138
1139	}); 
1140 
1141</script>