Si è verificato un errore nell'elaborarazione del modello.
The following has evaluated to null or missing:
==> programs.getJSONObject('data').getJSONArray('items')  [in template "383767#383802#1838824" at line 1478, column 29]

----
Tip: If the failing expression is known to be 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: ${programs.getJSONObject("data").getJ...  [in template "383767#383802#1838824" at line 1478, column 27]
----
1<#import "${templatesPath}/1724005" as d40> 
2 
3<#assign 
4    JALS = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") 
5    JSONFactoryUtil = staticUtil["com.liferay.portal.kernel.json.JSONFactoryUtil"] 
6 
7    articleId = "1221309" 
8    article = JALS.fetchArticle(groupId, articleId) 
9    document = saxReaderUtil.read(article.getContent()) 
10    rootElement = document.getRootElement() 
11    allegati = [] 
12     
13    stringSelector = "dynamic-element[@name='allegato']" 
14    xPathSelector = saxReaderUtil.createXPath(stringSelector) 
15/> 
16 
17<#if xPathSelector.selectNodes(rootElement)??> 
18    <#assign allegati = xPathSelector.selectNodes(rootElement)> 
19</#if> 
20 
21<style> 
22    .card.border-aqua{ 
23        border: 2px solid #43A08E !important; 
24
25    .bg-aqua{ 
26        background-color: #43A08E !important; 
27
28</style> 
29 
30<#macro printContent> 
31    <div id="pay" class="p-3" v-cloak> 
32        <div v-show="loading"> 
33            <div class="d-flex align-items-center justify-content-center h-full"> 
34                <div class="loading-animation"></div> 
35            </div> 
36        </div> 
37         
38        <div class="container" v-show="!loading"> 
39            <div class="text-center" v-if="name == 'Placeholder'"> 
40                <p class="text-dark">Errore interno.</p> 
41                <p class="text-dark">Ricarica la pagina per continuare.</p> 
42            </div> 
43            <div class="row" v-else> 
44                <div class="col-12"> 
45                    <ol class="d-none d-lg-flex nav multi-step-nav multi-step-nav-collapse-sm flex-row" role="tablist"> 
46                    	<li v-for="(num, index) in totalSteps" class="multi-step-item" :class="{'complete': currentStep >= num, 'multi-step-item-expand': index != totalSteps-1}"> 
47                    		<div class="multi-step-divider"></div> 
48                    		<div class="multi-step-indicator"> 
49                    			<button v-if="isDev" @click="currentStep = num" class="multi-step-icon bg-image-none" data-toggle="tab"> 
50                    			    <span class="text-white font-weight-bold">{{ num }}</span> 
51                    			</button> 
52                    			<div v-else class="multi-step-icon bg-image-none" data-toggle="tab"> 
53                    			    <span class="text-white font-weight-bold">{{ num }}</span> 
54                    			</div> 
55                    		</div> 
56                    	</li> 
57                    </ol> 
58                     
59                    <div class="tbar subnav-tbar subnav-tbar-light d-lg-none"> 
60                    	<div class="container-fluid container-fluid-max-xl"> 
61                    		<div class="tbar-nav"> 
62                    			<div class="tbar-item tbar-item-expand"> 
63                    				<div class="tbar-section"> 
64                    					<span class="component-text text-truncate-inline"> 
65                    						<span class="text-truncate">Acquisto</span> 
66                    					</span> 
67                    				</div> 
68                    			</div> 
69                    			<div class="tbar-item"> 
70                    				<span class="component-text">Pagina {{ currentStep }} di {{ totalSteps }}</span> 
71                    			</div> 
72                    		</div> 
73                    	</div> 
74                    </div> 
75                     
76                    <div class="tab-content mt-lg-5"> 
77                     
78                        <#-- SELEZIONE PROGRAMMA --> 
79                        <div class="tab-pane fade" :class="{'show active': currentStep == 1}" role="tabpanel"> 
80                            <div class="row justify-content-between"> 
81                                <div class="d-none d-lg-block col-12 mb-4"> 
82                                    <p class="text-dark display-5 font-weight-light">Scegli il periodo</p> 
83                                </div> 
84                                 
85                                <div class="col-12 col-lg-5"> 
86                                    <div class="card void mt-4 mt-lg-0"> 
87                                        <div class="card-row flex-column flex-md-row"> 
88                                            <div class="autofit-col autofit-col-expand"> 
89                                                <section class="autofit-section"> 
90                                                    <p class="text-dark text-center text-md-left mb-lg-0">Personalizza il tuo preventivo</p> 
91                                                </section> 
92                                            </div> 
93                                            <div class="autofit-col"> 
94                                                <section class="autofit-section"> 
95                                                    <button @click="openParentModal('#requestinfo-payment-modal')" class="btn btn-outline-dark btn-block py-2 px-3">Contattaci</button> 
96                                                </section> 
97                                            </div> 
98                                        </div> 
99                                    </div> 
100                                     
101                                    <div class="mb-4 mt-5 mt-lg-0"> 
102                                        <p class="h4 text-dark mb-0">Scegli il periodo</p> 
103                                    </div> 
104                                     
105                                    <div id="results"> 
106                                        <template v-for="(program, index) in programs"> 
107                                            <div v-if="program.sd != ''" :key="program._id.$oid" class="card void"> 
108                                                <div class="card-row"> 
109                                                    <div class="autofit-col autofit-col-expand"> 
110                                                        <section class="autofit-section"> 
111                                                        <#-- 
112                                                            <p class="text-muted mb-0">dal {{ program.sd | moment("DD/MM/YYYY").format("DD MMMM YYYY") }} al {{ program.ed | moment("DD/MM/YYYY").format("DD MMMM YYYY") }}</p> 
113                                                        --> 
114                                                            <p class="text-muted mb-0">{{ program.nomeTariffa }}</p> 
115                                                            <p class="mb-0"> 
116                                                                <span class="badge badge-pill badge-primary bg-gradient-h" v-if="program.forGroup"> 
117                                                                	<span class="badge-item badge-item-expand">Per gruppi</span> 
118                                                                </span> 
119                                                                <template v-if="program.marketingGroups"> 
120                                                                    <span v-for="(item, index) in program.marketingGroups" :key="'mg-' + index" class="badge badge-pill badge-primary bg-gradient-h"> 
121                                                                    	<span class="badge-item badge-item-expand">{{ labels[item] }}</span> 
122                                                                    </span> 
123                                                                </template> 
124                                                            </p> 
125                                                            <p class="text-dark mb-0" v-if="program.basePrice!='' && program.basePrice!='0'">A partire da {{ program.basePrice | money }}</p> 
126                                                             
127                                                            <template v-for="(sconto, index) in program.purchaseBeforeDiscount"> 
128                                                                <p v-if="isDiscountValid(sconto) && sconto.discount != 0" :key="'discount-' + index + '-' + program._id.$oid" class="text-muted small mb-0"> 
129                                                                    Acquista prima del {{ sconto.dateEnd | moment().format("DD MMMM YYYY") }}: 
130                                                                    <span class="label label-success"> 
131                                                    					<span class="label-item label-item-expand">Sconto di {{ sconto.discount | money }}</span> 
132                                                    				</span> 
133                                                				</p> 
134                                                            </template> 
135                                                        </section> 
136                                                    </div> 
137                                                    <div class="autofit-col"> 
138                                                        <section class="autofit-section"> 
139                                                            <button v-if="selectedProgram?._id?.$oid == program._id.$oid" class="btn btn-dark py-2 px-3 px-lg-4"> 
140                                                                Scelto 
141                                                                <i class="fas fa-check ml-2"></i> 
142                                                            </button> 
143                                                             
144                                                            <button v-else @click="selectProgram(program)" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
145                                                                Scegli 
146                                                            </button> 
147                                                        </section> 
148                                                    </div> 
149                                                </div> 
150                                                 
151                                                <div v-if="index < programs.length - 1" class="dropdown-divider w-75 mx-auto my-3"></div> 
152                                            </div> 
153                                        </template> 
154                                    </div> 
155                                </div> 
156                                 
157                                <div class="col-12 col-lg-7"> 
158                                    <div v-if="selectedProgram != null" class="mb-4 mt-5 mt-lg-0"> 
159                                        <div class="card no-shadow border-aqua rounded"> 
160                                            <div class="card-body p-3"> 
161                                                <div class="card-row flex-column flex-lg-row"> 
162                                                    <div class="autofit-col autofit-col-gutters"> 
163                                                        <div class="flex-column text-lg-center"> 
164                                                            <template v-for="(block, bIndex) in selectedProgram?.nomeTariffa.split(' ')"> 
165                                                                <p v-if="block.trim() != ''" :key="'block-' + bIndex" class="text-aqua font-weight-bold text-uppercase mb-0 mb-lg-3"> 
166                                                                    {{ block }} 
167                                                                </p> 
168                                                            </template> 
169                                                        </div> 
170                                                    </div> 
171                                                    <div class="autofit-col autofit-col-expand autofit-col-gutters border-lg-left"> 
172                                                        <div class="autofit-section"> 
173                                                            <template v-if="selectedProgram.marketingGroups"> 
174                                                                <button v-for="(item, index) in selectedProgram.marketingGroups" :key="'smg-' + index" class="btn btn-secondary active no-events mr-2"> 
175                                                                    {{ labels[item] }} 
176                                                                </button> 
177                                                            </template> 
178                                                            <p class="text-aqua font-weight-bold mt-3"> 
179                                                                <span class="component-text"> {{getScontiDisponibili(selectedProgram)}}</span> 
180                                                            </p> 
181                                                             
182                                                            <p class="text-dark mb-0 mt-3"> 
183                                                                <i class="fas fa-plane fa-lg mr-2"></i> 
184                                                                <span class="font-weight-bold"> 
185                                                                    Partenza:  
186                                                                     
187                                                                    <template v-for="(part, pIndex) in selectedProgram.airportsAndPrices"> 
188                                                                        <span :key="'part-' + pIndex"> 
189                                                                            {{ labels[part.airport] }} 
190                                                                        </span> 
191                                                                    </template> 
192                                                                </span> 
193                                                            </p> 
194                                                             
195                                                            <p v-if="selectedProgram.marketingText != ''" class="text-aqua font-weight-bold mt-3"> 
196                                                                {{ selectedProgram.marketingText }} 
197                                                            </p> 
198                                                        </div> 
199                                                    </div> 
200                                                    <div class="autofit-col"> 
201                                                        <div class="autofit-section"> 
202                                                            <p  v-if="selectedProgram.basePrice!='' && selectedProgram.basePrice!='0'" class="text-dark text-right">A partire da</p> 
203                                                            <p  v-if="selectedProgram.basePrice!='' && selectedProgram.basePrice!='0'" class="text-aqua font-weight-bold text-right">{{ selectedProgram.basePrice | money }}</p> 
204                                                             
205                                                            <button type="button" @click="gotoStep('next')" class="btn bg-aqua text-white font-weight-bold px-4 py-3"> 
206                                                                Personalizza 
207                                                            </button> 
208                                                        </div> 
209                                                    </div> 
210                                                </div> 
211                                            </div> 
212                                        </div> 
213                                    </div> 
214                                </div> 
215                                 
216                                <div class="col-12"> 
217                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
218                                        <div class="card-row"> 
219                                            <div class="autofit-col autofit-col-expand"> 
220                                                <section class="autofit-section text-right"> 
221                                                    <button @click="selectedProgram != null ? gotoStep('next') : ''" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="selectedProgram == null"> 
222                                                        Avanti 
223                                                    </button> 
224                                                </section> 
225                                            </div> 
226                                        </div> 
227                                    </div> 
228                                </div> 
229                            </div> 
230                        </div> 
231                         
232                        <#-- STEP 2: AREA E SCUOLA --> 
233                        <div class="tab-pane fade" :class="{'show active': currentStep == 2}" role="tabpanel"> 
234                            <div class="row justify-content-between"> 
235                                <div class="d-none d-lg-block col-12 mb-4"> 
236                                    <p class="text-dark display-5 font-weight-light">Procedi alla tua scelta</p> 
237                                </div> 
238                                 
239                                <div class="col-12 col-lg-6" v-if="selectedProgram != null"> 
240                                    <div class="dropdown"> 
241                                    	<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown"> 
242                                            Scegli 
243                                            <i class="fas fa-chevron-down ml-2 fa-lg"></i> 
244                                    	</button> 
245                                    	<div class="dropdown-menu"> 
246                                			<div class="dropdown-section"> 
247                                				<div class="input-group input-group-sm"> 
248                                					<div class="input-group-item"> 
249                                						<input type="text" v-model="searchTerm" class="form-control input-group-inset input-group-inset-after" placeholder="Cerca..."> 
250                                						<span class="input-group-inset-item input-group-inset-item-after"> 
251                                							<button class="btn btn-unstyled" type="button"> 
252                                								<i class="fal fa-search fa-lg"></i> 
253                                							</button> 
254                                						</span> 
255                                					</div> 
256                                				</div> 
257                                			</div> 
258                                    		<ul class="list-unstyled"> 
259                                    			<li v-for="(item, index) in computedResults" :key="'computedItem-'+ index"> 
260                                    			    <a href="javascript:void(0);" @click="selectedArea = item; selectedSchool = null;" class="dropdown-item" :class="{'active': selectedArea?.id == item?.id}"> 
261                                    			        {{ item?.name }}{{getAreaPriceIfSet(item)}} 
262                                    			    </a> 
263                                    			</li> 
264                                    		</ul> 
265                                    	</div> 
266                                    </div> 
267                                     
268                                    <div v-if="selectedArea != null" class="mt-4"> 
269                                        <p class="text-dark"> 
270                                            La tua scelta:  
271                                            <strong>{{ selectedArea.name }}</strong> 
272                                        </p> 
273                                    </div> 
274                                </div> 
275                                <div class="col-12 col-lg-6" v-if="selectedArea != null && hasSchools(selectedArea)"> 
276                                    <div class="dropdown"> 
277                                    	<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown"> 
278                                            Scegli 
279                                            <i class="fas fa-chevron-down ml-2 fa-lg"></i> 
280                                    	</button> 
281                                        <div class="dropdown-menu"> 
282                                    		<ul class="list-unstyled"> 
283                                                <li v-for="(school, index) in selectedArea.children" :key="'school-' + index"  v-if="school!== null"> 
284                                                    <a href="javascript:void(0);" @click="selectedSchool = school" class="dropdown-item" :class="{'active': selectedSchool?.id == school?.id}"> 
285                                                        {{ school?.name }} - {{ school?.price | money }} 
286                                                    </a> 
287                                                </li> 
288                                            </ul> 
289                                    	</div> 
290                                    </div> 
291                                     
292                                    <div v-if="selectedSchool != null" class="mt-4"> 
293                                        <p class="text-dark"> 
294                                            La tua scelta:  
295                                            <strong>{{ selectedSchool.name }}</strong> 
296                                        </p> 
297                                    </div> 
298                                </div> 
299                                 
300                                <div class="col-12"> 
301                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
302                                        <div class="card-row"> 
303                                            <div class="autofit-col autofit-col-expand"> 
304                                                <section class="autofit-section text-left"> 
305                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
306                                                        Indietro 
307                                                    </button> 
308                                                </section> 
309                                            </div> 
310                                            <div class="autofit-col autofit-col-expand"> 
311                                                <section class="autofit-section text-right"> 
312                                                    <button @click="gotoStep('next')" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="selectedSchool == null && ( selectedArea==null || hasSchools(selectedArea))"> 
313                                                        Avanti 
314                                                    </button> 
315                                                </section> 
316                                            </div> 
317                                        </div> 
318                                    </div> 
319                                </div> 
320                            </div> 
321                        </div> 
322 
323                        <#-- SERVIZI --> 
324                        <div class="tab-pane fade" :class="{'show active': currentStep == 3}" role="tabpanel"> 
325                            <div class="row"> 
326                                <div class="d-none d-lg-block col-12 mb-4"> 
327                                    <p class="text-dark display-5 font-weight-light">Scegli I servizi</p> 
328                                </div> 
329                                 
330                                <div class="col-12 col-lg-7" v-if="selectedProgram != null"> 
331                                    <ul class="list-group mb-lg-0"> 
332                                    	<li v-for="(service, index) in selectedProgram?.servicesAndPrices" :key="'service-' + index" class="list-group-item"> 
333                                    	    <div class="card-row flex-column flex-lg-row"> 
334                                    	        <div class="autofit-col autofit-col-expand"> 
335                                    	            <section class="autofit-section my-auto"> 
336                                    	                <span class="label label-danger" v-if="service.mandatory"> 
337                                        					<span class="label-item label-item-expand">Obbligatorio</span> 
338                                        				</span> 
339                                        				 
340                                            			<div class="custom-control custom-checkbox"> 
341                                            				<label class="{'no-events': service.mandatory}"> 
342                                            					<input class="custom-control-input" :class="{'no-events': service.mandatory}" type="checkbox" v-model="selectedServices" :value="service" :checked="service.mandatory" :disabled="service.mandatory" /> 
343                                            					<span class="custom-control-label"> 
344                                            					    <span class="custom-control-label-text">{{ labels[service.service] }}</span> 
345                                            					</span> 
346                                            				</label> 
347                                            			</div> 
348                                            		</section> 
349                                        		</div> 
350                                        		<div class="autofit-col autofit-col-expand" style="min-width: 15%;"> 
351                                    				<section class="autofit-section my-auto"> 
352                                    				    <p class="text-dark text-right h3 mb-0 mr-3">{{ service.price | money }}</p> 
353                                    				</section> 
354                                        		</div> 
355                                    	    </div> 
356                                    	</li> 
357                                    </ul> 
358                                </div> 
359                                <div class="col-12" v-else> 
360                                    <p class="text-dark display-5 font-weight-light">Per continuare, seleziona un periodo dalla prima pagina.</p> 
361                                </div> 
362                                 
363                                <div class="col-12"> 
364                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
365                                        <div class="card-row"> 
366                                            <div class="autofit-col autofit-col-expand"> 
367                                                <section class="autofit-section text-left"> 
368                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
369                                                        Indietro 
370                                                    </button> 
371                                                </section> 
372                                            </div> 
373                                            <div class="autofit-col autofit-col-expand"> 
374                                                <section class="autofit-section text-right"> 
375                                                    <button @click="gotoStep('next')" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="selectedServices.length == 0 && areServicesMandatory()"> 
376                                                        Avanti 
377                                                    </button> 
378                                                </section> 
379                                            </div> 
380                                        </div> 
381                                    </div> 
382                                </div> 
383                            </div> 
384                        </div> 
385                         
386                        <#-- STEP 4: TRASPORTO --> 
387                        <div class="tab-pane fade" :class="{'show active': currentStep == 4}" role="tabpanel"> 
388                            <div class="row justify-content-between"> 
389                                <div class="d-none d-lg-block col-12 mb-4"> 
390                                    <p class="text-dark display-5 font-weight-light">Scegli il tuo trasferimento</p> 
391                                </div> 
392                                 
393                                <div class="col-12 col-lg-6" v-if="selectedProgram != null"> 
394                                    <ul class="list-group mb-lg-0"> 
395                                    	<li v-for="(partenza, index) in selectedProgram?.airportsAndPrices" :key="'airport-' + index" class="list-group-item"> 
396                                    	    <div class="card-row flex-column flex-lg-row"> 
397                                    	        <div class="autofit-col autofit-col-expand"> 
398                                    	            <section class="autofit-section my-auto"> 
399                                    	                <span class="label label-success" v-if="partenza.price == 0"> 
400                                        					<span class="label-item label-item-expand">Volo incluso</span> 
401                                        				</span> 
402                                                				 
403                                            			<div class="custom-control custom-radio"> 
404                                            				<label> 
405                                            				    <input class="custom-control-input" type="radio" name="airportsAndPrices" v-model="selectedAirport" :value="partenza" /> 
406                                            					<span class="custom-control-label"> 
407                                                                    <div class="d-none">{{ getCategoryName(partenza.airport) }}</div> 
408                                            					    <span class="custom-control-label-text">{{ labels[partenza.airport] }}</span> 
409                                            					</span> 
410                                            				</label> 
411                                            			</div> 
412                                            		</section> 
413                                        		</div> 
414                                        		<div class="autofit-col autofit-col-expand"> 
415                                    				<section class="autofit-section my-auto"> 
416                                    				    <p class="text-dark text-right h3 mb-0 mr-3">{{ partenza.price | money }}</p> 
417                                    				</section> 
418                                        		</div> 
419                                    	    </div> 
420                                    	</li> 
421                                    </ul> 
422                                </div> 
423                                <div class="col-12 col-lg-6" v-else> 
424                                    <p class="text-dark display-5 font-weight-light">Per continuare, seleziona un periodo dalla prima pagina.</p> 
425                                </div> 
426                                 
427                                <div class="col-12"> 
428                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
429                                        <div class="card-row"> 
430                                            <div class="autofit-col autofit-col-expand"> 
431                                                <section class="autofit-section text-left"> 
432                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
433                                                        Indietro 
434                                                    </button> 
435                                                </section> 
436                                            </div> 
437                                            <div class="autofit-col autofit-col-expand"> 
438                                                <section class="autofit-section text-right"> 
439                                                    <button @click="selectedAirport != null ? gotoStep('next') : ''" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="_.isEmpty(selectedAirport)"> 
440                                                        Avanti 
441                                                    </button> 
442                                                </section> 
443                                            </div> 
444                                        </div> 
445                                    </div> 
446                                </div> 
447                            </div> 
448                        </div> 
449                         
450                        <#-- STEP 5: SCONTI --> 
451                        <div class="tab-pane fade" :class="{'show active': currentStep == 5}" role="tabpanel"> 
452                            <div class="row justify-content-between"> 
453                                <div class="d-none d-lg-block col-12 mb-4"> 
454                                    <p class="text-dark display-5 font-weight-light">Scegli gli sconti</p> 
455                                </div> 
456                                 
457                                <div class="col-12 col-lg-6" v-if="selectedProgram != null"> 
458                                    <ul class="list-group mb-lg-0"> 
459                                    	<li v-for="(discount, index) in selectedProgram?.otherDiscounts" :key="'discount-' + index" class="list-group-item"> 
460                                    	    <div class="card-row flex-column flex-lg-row"> 
461                                    	        <div class="autofit-col autofit-col-expand"> 
462                                    	            <section class="autofit-section my-auto"> 
463                                            			<div class="custom-control custom-checkbox"> 
464                                            				<label> 
465                                            					<input class="custom-control-input" type="checkbox" v-model="selectedDiscounts" :value="discount" /> 
466                                            					<span class="custom-control-label"> 
467                                            					    <span class="custom-control-label-text">{{ labels[discount.description] }}</span> 
468                                            					</span> 
469                                            				</label> 
470                                            			</div> 
471                                            		</section> 
472                                        		</div> 
473                                        		<div class="autofit-col autofit-col-expand" style="min-width: 15%;"> 
474                                    				<section class="autofit-section my-auto"> 
475                                    				    <p class="text-dark text-right h3 mb-0 mr-3">{{ discount.discount | money }}</p> 
476                                    				</section> 
477                                        		</div> 
478                                    	    </div> 
479                                    	</li> 
480                                    </ul> 
481                                </div> 
482                                <div class="col-12 col-lg-6" v-else> 
483                                    <p class="text-dark display-5 font-weight-light">Per continuare, seleziona un periodo dalla prima pagina.</p> 
484                                </div> 
485                                 
486                                <div class="col-12"> 
487                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
488                                        <div class="card-row"> 
489                                            <div class="autofit-col autofit-col-expand"> 
490                                                <section class="autofit-section text-left"> 
491                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
492                                                        Indietro 
493                                                    </button> 
494                                                </section> 
495                                            </div> 
496                                            <div class="autofit-col autofit-col-expand"> 
497                                                <section class="autofit-section text-right"> 
498                                                    <button @click="gotoStep('next')" class="btn btn-gradient py-2 px-3 px-lg-4"> 
499                                                        Avanti 
500                                                    </button> 
501                                                </section> 
502                                            </div> 
503                                        </div> 
504                                    </div> 
505                                </div> 
506                            </div> 
507                        </div> 
508                         
509                        <#-- FORM DATI MINIMAL --> 
510                        <div class="tab-pane fade" :class="{'show active': currentStep == 6}" role="tabpanel"> 
511                            <div class="row justify-content-center"> 
512                                <div class="d-none d-lg-block col-12 mb-4"> 
513                                    <p class="text-dark display-5 font-weight-light">Inserisci i tuoi dati</p> 
514                                </div> 
515                                 
516                                <div class="col-12 col-lg-9" v-if="selectedProgram != null"> 
517                                    <div class="sheet sheet-lg"> 
518                                        <div class="sheet-header"> 
519                                    		<div class="sheet-text"> 
520                                    		    Inserisci i tuoi dati per poter calcolare, senza impegno, il preventivo.  
521                                    		    Impostali nel <a href="javascript:void(0);" @click="redirectParent('/profilo')" class="text-aqua font-weight-bold">tuo profilo</a> per non doverli inserire la prossima volta 
522                                    		</div> 
523                                    	</div> 
524                                    	<div class="sheet-section"> 
525                                    		<div class="form-group-autofit"> 
526                                    			<div class="form-group-item"> 
527                                    				<label for="userName">Nome *</label> 
528                                    				<input class="form-control" id="userName" v-model="userData.firstName" type="text"/> 
529                                    			</div> 
530                                    			<div class="form-group-item"> 
531                                    				<label for="userSurname">Cognome *</label> 
532                                    				<input class="form-control" id="userSurname" v-model="userData.lastName" type="text"/> 
533                                    			</div> 
534                                    		</div> 
535                                    		<div class="form-group-autofit"> 
536                                    			<div class="form-group-item"> 
537                                    				<label for="billingEmail">Email *</label> 
538                                    				<input class="form-control" id="billingEmail" v-model="userMail" type="email"/> 
539                                    			</div> 
540                                    			<div class="form-group-item"> 
541                                    				<label for="phone">Telefono</label> 
542                                    				<input class="form-control" id="phone" v-model="userData.phone" type="text"/> 
543                                    			</div> 
544                                    		</div> 
545                                    		 
546                                    		<div class="form-group-autofit"> 
547                                            	<div class="form-group-item"> 
548                                            		<div class="form-text">I campi contrassegnati con * sono obbligatori.</div> 
549                                            	</div> 
550                                            </div> 
551                                    	</div> 
552                                    </div> 
553                                </div> 
554                                <div class="col-12" v-else> 
555                                    <p class="text-dark display-5 font-weight-light">Per continuare, seleziona un periodo dalla prima pagina.</p> 
556                                </div> 
557                                 
558                                <div class="col-12"> 
559                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
560                                        <div class="card-row"> 
561                                            <div class="autofit-col autofit-col-expand"> 
562                                                <section class="autofit-section text-left"> 
563                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
564                                                        Indietro 
565                                                    </button> 
566                                                </section> 
567                                            </div> 
568                                            <div class="autofit-col autofit-col-expand"> 
569                                                <section class="autofit-section text-right"> 
570                                                    <button @click="gotoStep('next')" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="!minimumValid"> 
571                                                        Avanti 
572                                                    </button> 
573                                                </section> 
574                                            </div> 
575                                        </div> 
576                                    </div> 
577                                </div> 
578                            </div> 
579                        </div> 
580                         
581                        <#-- RIEPILOGO --> 
582                        <div class="tab-pane fade" :class="{'show active': currentStep == 7}" role="tabpanel"> 
583                         
584                            <div class="sheet border-0 p-0 p-lg-4"> 
585                                <div class="row"> 
586                                    <div class="d-none d-lg-block col-12 mb-4"> 
587                                        <p class="text-dark display-5 font-weight-light">Riepilogo</p> 
588                                    </div> 
589                                     
590                                    <div class="col-12"> 
591                                        <div class="card void"> 
592                                    	    <div class="card-row flex-column flex-lg-row mb-4 mb-lg-0"> 
593                                    	        <div class="autofit-col autofit-col-expand"> 
594                                    	            <section class="autofit-section mb-auto"> 
595                                            			<p class="h1 display-5 title-large">{{ name }}</p> 
596                                            			<p class="text-dark"> 
597<#--                                    	                    Dal {{ selectedProgram?.sd | moment("DD/MM/YYYY").format("DD MMMM YYYY") }} al {{ selectedProgram?.ed | moment("DD/MM/YYYY").format("DD MMMM YYYY") }} --> 
598                                                    {{ selectedProgram?.nomeTariffa}} 
599                                                        </p> 
600                                                    </section> 
601                                                </div> 
602                                            </div> 
603                                        </div> 
604                                    </div> 
605                                </div> 
606                                 
607                                <div class="row"> 
608                                    <div class="col-12 col-lg-6 order-2 order-lg-1"> 
609                                        <div class="panel panel-secondary"> 
610                                            <div class="panel-header"> 
611                                                <div class="panel-title"> 
612                                                    Informazioni di base: 
613                                                </div> 
614                                            </div> 
615                                            <div class="panel-body"> 
616                                                <p class="mb-0"> 
617                                                    Prezzo del viaggio: <span class="font-weight-bold">{{ programPrice | money }}</span> 
618                                                </p> 
619                                                <p class="mb-0" v-if="programDiscount != 0"> 
620                                                    Sconto applicato: <span class="font-weight-bold">{{ programDiscount | money }}</span> 
621                                                </p> 
622                                            </div> 
623                                        </div> 
624                                         
625                                        <div class="panel panel-secondary"> 
626                                            <div class="panel-header"> 
627                                                <div class="panel-title"> 
628                                                    La tua scelta: 
629                                                </div> 
630                                            </div> 
631                                            <div class="panel-body"> 
632                                                <p class="mb-0"> 
633                                                    {{getSelectedAreaAndSchoolLabel()}} <span class="font-weight-bold">({{getSelectedAreaAndSchoolPrice() }})</span> 
634<#--                                                    {{ selectedArea?.name }}, {{ selectedSchool?.name }} <span class="font-weight-bold">({{ selectedSchool?.price | money }})</span> --> 
635                                                </p> 
636                                            </div> 
637                                        </div> 
638                                         
639                                        <div class="panel panel-secondary"> 
640                                            <div class="panel-header"> 
641                                                <div class="panel-title"> 
642                                                    Servizi scelti: 
643                                                </div> 
644                                            </div> 
645                                            <div class="panel-body"> 
646                                                <template v-if="selectedServices.length > 0"> 
647                                                    <p v-for="(service, index) in selectedServices" :key="'selectedService-' + index" class="mb-0"> 
648                                                        {{ labels[service.service] }} <span class="font-weight-bold">({{ service.price | money }})</span> 
649                                                    </p> 
650                                                </template> 
651                                                <template v-else> 
652                                                    <p class="mb-0">Nessun servizio scelto</p> 
653                                                </template> 
654                                            </div> 
655                                        </div> 
656                                         
657                                        <div class="panel panel-secondary"> 
658                                            <div class="panel-header"> 
659                                                <div class="panel-title"> 
660                                                    Trasporto scelto: 
661                                                </div> 
662                                            </div> 
663                                            <div class="panel-body"> 
664                                                <p class="mb-0"> 
665                                                    {{ labels[selectedAirport?.airport] }} <span class="font-weight-bold">({{ selectedAirport?.price | money }})</span> 
666                                                </p> 
667                                            </div> 
668                                        </div> 
669                                         
670                                        <div class="panel panel-secondary"> 
671                                            <div class="panel-header"> 
672                                                <div class="panel-title"> 
673                                                    Sconti scelti: 
674                                                </div> 
675                                            </div> 
676                                            <div class="panel-body"> 
677                                                <template v-if="selectedDiscounts.length > 0"> 
678                                                    <p v-for="(discount, index) in selectedDiscounts" :key="'selectedDiscount-' + index" class="mb-0"> 
679                                                        {{ labels[discount.description] }} <span class="font-weight-bold">(-{{ discount.discount | money }})</span> 
680                                                    </p> 
681                                                </template> 
682                                                <template v-else> 
683                                                    <p class="mb-0">Nessuno sconto scelto</p> 
684                                                </template> 
685                                            </div> 
686                                        </div> 
687                                         
688                                        <div class="panel panel-secondary" v-if="isDev"> 
689                                            <div class="panel-header"> 
690                                                <div class="panel-title"> 
691                                                    Tipo di pagamento scelto: 
692                                                </div> 
693                                            </div> 
694                                            <div class="panel-body"> 
695                                                <div class="card void m-0 p-0"> 
696                                                    <div class="card-row"> 
697                                                        <div class="autofit-col autofit-col-expand my-auto"> 
698                                                            <section class="autofit-section"> 
699                                                                <p class="mb-0"> 
700                                                                    {{ getPaymentLabel(selectedPayment)}} <span class="font-weight-bold" v-if="selectedPayment=='cartaCreditoAcconto' && selectedProgram.depositAmount != 0">( Acconto: {{ selectedProgram.depositAmount | money }})</span> 
701                                                                </p> 
702                                                            </section> 
703                                                        </div> 
704                                                    </div> 
705                                                </div> 
706                                            </div> 
707                                        </div> 
708                                         
709                                        <div class="panel panel-secondary"> 
710                                            <div class="panel-header"> 
711                                                <div class="panel-title"> 
712                                                    Voucher: 
713                                                </div> 
714                                            </div> 
715                                            <div class="panel-body"> 
716                                                <p v-if="voucherDiscount > 0"> 
717                                                    Sconto applicato: <span class="font-weight-bold">{{ voucherDiscount | money }}</span> 
718                                                </p> 
719                                                 
720                                                <div class="card void m-0 p-0"> 
721                                                    <div class="card-row"> 
722                                                        <div class="autofit-col autofit-col-expand my-auto"> 
723                                                            <section class="autofit-section"> 
724                                                                <div class="form-group"> 
725                                                                	<div class="input-group"> 
726                                                                		<div class="input-group-item input-group-prepend"> 
727                                                                			<input type="text" v-model="voucher" class="form-control" placeholder="Inserisci il codice" :disabled="voucherValid" /> 
728                                                                		</div> 
729                                                                		<span class="input-group-append input-group-item input-group-item-shrink"> 
730                                                                			<button @click="checkVoucher()" class="btn btn-secondary" :disabled="voucher == '' || voucherValid"> 
731                                                                			    <span v-if="voucherValid"> 
732                                                                			        Valido 
733                                                                			        <i class="fas fa-check ml-2"></i> 
734                                                                			    </span> 
735                                                                			    <span v-else> 
736                                                                			        Verifica 
737                                                                			    </span> 
738                                                                			</button> 
739                                                                		</span> 
740                                                                	</div> 
741                                                                </div> 
742                                                            </section> 
743                                                        </div> 
744                                                    </div> 
745                                                </div> 
746                                            </div> 
747                                        </div> 
748                                    </div> 
749                                    <div class="col-12 col-lg-6 order-1 order-lg-2"> 
750                                        <div class="panel panel-secondary"> 
751                                            <div class="panel-body"> 
752                                                <div class="card void my-3"> 
753                                                    <div class="d-flex justify-content-center"> 
754                                                        <div class="d-flex flex-column text-center mx-auto"> 
755                                        				    <span class="sticker sticker-xl sticker-person rounded-circle mb-4"> 
756                                                            	<span class="sticker-overlay"> 
757                                                            		<img :src="image" class="img-fluid" :alt="name"> 
758                                                            	</span> 
759                                                            </span> 
760                                                             
761                                                            <#-- 
762                                                            <button class="btn btn-outline-dark px-3" @click="favourite ? removeFavourite() : setFavourite()" v-if="signedIn"> 
763                                                                {{ favourite ? 'Salvato' : 'Salva' }} 
764                                                                 
765                                                                <i class="fa-heart fa-lg ml-3" :class="favourite ? 'fas' : 'far'"></i> 
766                                                            </button> 
767                                                            --> 
768                                                        </div> 
769                                                    </div> 
770                                                </div> 
771                                                 
772                                                <div class="card void my-3"> 
773                                                    <div class="card-row flex-column"> 
774                                                        <div class="autofit-col autofit-col-expand"> 
775                                                            <section v-if="voucherDiscount > 0" class="autofit-section"> 
776                                                                <div class="d-flex flex-row text-dark text-center my-4 justify-content-center"> 
777                                                                    <p class="my-auto">Totale importo: </p> 
778                                                                    <span class="text-left d-flex flex-column"> 
779                                                                        <span class="ml-3" style="text-decoration: line-through;">{{ totalPrice | money }}</span> 
780                                                                        <span class="display-5 ml-3">{{ totalPriceWithVoucher | money }}</span> 
781                                                                    </span> 
782                                                                </div> 
783                                                                <p v-if="selectedPayment == 'cartaCreditoAcconto'" class="text-dark text-center my-4"> 
784                                                                    Acconto da pagare: 
785                                                                    <span class="display-5 ml-3">{{ selectedProgram.depositAmount | money }}</span> 
786                                                                </p> 
787                                                            </section> 
788 
789                                                            <section v-else class="autofit-section"> 
790                                                                <p class="text-dark text-center my-4"> 
791                                                                    Totale importo: 
792                                                                    <span class="display-5 ml-3">{{ totalPrice | money }}</span> 
793                                                                </p> 
794                                                                <p class="text-dark text-center my-4" v-if="selectedPayment == 'cartaCreditoAcconto'"> 
795                                                                    Acconto da pagare: 
796                                                                    <span class="display-5 ml-3">{{ selectedProgram.depositAmount | money }}</span> 
797                                                                </p> 
798                                                            </section> 
799                                                        </div> 
800                                                        <div class="autofit-col autofit-col-expand"> 
801                                                            <section class="autofit-section"> 
802                                                                <button @click="setProgressData();openParentModal('#requestinfo-payment-modal')" class="btn btn-gradient btn-block py-2 mb-3"> 
803                                                                    Richiedi informazioni 
804                                                                </button> 
805                                                                 
806                                                                <button v-if="signedIn" @click="gotoStep('next')" class="btn btn-gradient btn-block py-2"> 
807                                                                    Procedi al pagamento 
808                                                                </button> 
809                                                                <button v-else @click="setProgressData();redirectParent('/login')" class="btn btn-outline-dark btn-block py-2"> 
810                                                                    Accedi per procedere al pagamento 
811                                                                </button> 
812                                                            </section> 
813                                                        </div> 
814                                                    </div> 
815                                                </div> 
816                                            </div> 
817                                        </div> 
818                                    </div> 
819                                </div> 
820                                 
821                                <div class="row"> 
822                                    <div class="col-12"> 
823                                        <div class="card void mt-3 mt-lg-5 mb-0"> 
824                                            <div class="card-row"> 
825                                                <div class="autofit-col autofit-col-expand"> 
826                                                    <section class="autofit-section text-left"> 
827                                                        <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
828                                                            Indietro 
829                                                        </button> 
830                                                    </section> 
831                                                </div> 
832                                            </div> 
833                                        </div> 
834                                    </div> 
835                                </div> 
836                            </div> 
837                        </div> 
838                         
839                        <#-- FORM DATI ESTESO --> 
840                        <div class="tab-pane fade" :class="{'show active': currentStep == 8}" role="tabpanel"> 
841                            <div class="row justify-content-center"> 
842                                <div class="d-none d-lg-block col-12 mb-4"> 
843                                    <p class="text-dark display-5 font-weight-light">Completa il modulo di iscrizione</p> 
844                                </div> 
845                                 
846                                <div class="col-12 col-lg-9" v-if="selectedProgram != null && userData != null && signedIn"> 
847                                    <div class="sheet sheet-lg"> 
848                                        <div class="sheet-header"> 
849                                    		<div class="sheet-text"> 
850                                    		    <span class="text-aqua font-weight-bold">IMPORTANTE:</span> per poter impostare correttamente la pratica, è indispensabile compilare <u>tutti i campi</u> del presente modulo 
851                                    		</div> 
852                                    	</div> 
853                                    	<div class="sheet-section"> 
854                                    	    <p class="sheet-title">Dati del genitore o del tutore</p> 
855                                    	     
856                                    		<div class="form-group-autofit"> 
857                                    			<div class="form-group-item"> 
858                                    				<label for="tutoreFirstName">Nome</label> 
859                                    				<input class="form-control" id="tutoreFirstName" v-model="userData.tutore.firstName" type="text"/> 
860                                    			</div> 
861                                    			<div class="form-group-item"> 
862                                    				<label for="tutoreLastName">Cognome</label> 
863                                    				<input class="form-control" id="tutoreLastName" v-model="userData.tutore.lastName" type="text"/> 
864                                    			</div> 
865                                    		</div> 
866                                    		<div class="form-group-autofit"> 
867                                    			<div class="form-group-item"> 
868                                    				<label for="tutoreAddress">Indirizzo</label> 
869                                    				<input class="form-control" id="tutoreAddress" v-model="userData.tutore.address" type="text"/> 
870                                    			</div> 
871                                    		</div> 
872                                    		<div class="form-group-autofit"> 
873                                    			<div class="form-group-item"> 
874                                    				<label for="tutoreCitta">Città</label> 
875                                    				<input class="form-control" id="tutoreCitta" v-model="userData.tutore.citta" type="text"/> 
876                                    			</div> 
877                                    			<div class="form-group-item"> 
878                                    				<label for="tutoreCap">CAP</label> 
879                                    				<input class="form-control" id="tutoreCap" v-model="userData.tutore.cap" type="text"/> 
880                                    			</div> 
881                                    			<div class="form-group-item"> 
882                                    				<label for="tutoreProvincia">Provincia</label> 
883                                    				<input class="form-control" id="tutoreProvincia" v-model="userData.tutore.provincia" type="text"/> 
884                                    			</div> 
885                                    		</div> 
886                                    		<div class="form-group-autofit"> 
887                                    			<div class="form-group-item"> 
888                                    				<label for="tutoreCellulare">Cellulare</label> 
889                                    				<input class="form-control" id="tutoreCellulare" v-model="userData.tutore.cellulare" type="text"/> 
890                                    			</div> 
891                                    			<div class="form-group-item"> 
892                                    				<label for="tutoreEmail">Email</label> 
893                                    				<input class="form-control" id="tutoreEmail" v-model="userData.tutore.email" type="email"/> 
894                                    			</div> 
895                                    		</div> 
896                                    		<div class="form-group-autofit"> 
897                                    			<div class="form-group-item"> 
898                                    				<label for="tutoreTelefono">Telefono casa/ufficio</label> 
899                                    				<input class="form-control" id="tutoreTelefono" v-model="userData.tutore.telefono" type="text"/> 
900                                    			</div> 
901                                    			<div class="form-group-item"> 
902                                    				<label for="tutoreCodiceFiscale">Codice fiscale</label> 
903                                    				<input class="form-control" id="tutoreCodiceFiscale" v-model="userData.tutore.codiceFiscale" type="text"/> 
904                                    			</div> 
905                                    		</div> 
906                                    		 
907                                    		<div class="form-group-autofit"> 
908                                    			<div class="form-group-item"> 
909                                    				<label for="tutore2Cellulare">Cellulare secondo genitore</label> 
910                                    				<input class="form-control" id="tutore2Cellulare" v-model="userData.tutore2.cellulare" type="text"/> 
911                                    			</div> 
912                                    			<div class="form-group-item"> 
913                                    				<label for="tutore2Email">Email secondo genitore</label> 
914                                    				<input class="form-control" id="tutore2Email" v-model="userData.tutore2.email" type="email"/> 
915                                    			</div> 
916                                    		</div> 
917                                    		<div class="form-group-autofit"> 
918                                    			<div class="form-group-item"> 
919                                    				<label for="tutore2Telefono">Telefono casa/ufficio secondo genitore</label> 
920                                    				<input class="form-control" id="tutore2Telefono" v-model="userData.tutore2.telefono" type="text"/> 
921                                    			</div> 
922                                    		</div> 
923                                    	</div> 
924                                    	<div class="sheet-section"> 
925                                    	    <p class="sheet-title">Dati dello studente</p> 
926                                    	     
927                                    		<div class="form-group-autofit"> 
928                                    			<div class="form-group-item"> 
929                                    				<label for="firstName">Nome</label> 
930                                    				<input class="form-control" id="firstName" v-model="userData.firstName" type="text"/> 
931                                    			</div> 
932                                    			<div class="form-group-item"> 
933                                    				<label for="lastName">Cognome</label> 
934                                    				<input class="form-control" id="lastName" v-model="userData.lastName" type="text"/> 
935                                    			</div> 
936                                    		</div> 
937                                    		<div class="form-group-autofit"> 
938                                    			<div class="form-group-item"> 
939                                    				<label for="birthPlace">Nato a</label> 
940                                    				<input class="form-control" id="birthPlace" v-model="userData.birthPlace" type="text"/> 
941                                    			</div> 
942                                    			<div class="form-group-item"> 
943                                    				<label for="provincia">Provincia</label> 
944                                    				<input class="form-control" id="provincia" v-model="userData.provincia" type="text"/> 
945                                    			</div> 
946                                    			<div class="form-group-item"> 
947                                    				<label for="birthday">Il</label> 
948                                    				<input class="form-control" id="birthday" v-model="userData.birthday" type="text"/> 
949                                    			</div> 
950                                    			<div class="form-group-item"> 
951                                    				<label>Sesso</label> 
952                                    				<div> 
953                                        				<div class="custom-control custom-radio custom-control-inline"> 
954                                                        	<label> 
955                                                        		<input class="custom-control-input" name="gender" type="radio" value="male" v-model="userData.gender"/> 
956                                                        		<span class="custom-control-label"> 
957                                                        			<span class="custom-control-label-text">M</span> 
958                                                        		</span> 
959                                                        	</label> 
960                                                        </div> 
961                                                        <div class="custom-control custom-radio custom-control-inline"> 
962                                                        	<label> 
963                                                        		<input class="custom-control-input" name="gender" type="radio" value="female" v-model="userData.gender"/> 
964                                                        		<span class="custom-control-label"> 
965                                                        			<span class="custom-control-label-text">F</span> 
966                                                        		</span> 
967                                                        	</label> 
968                                                        </div> 
969                                                    </div> 
970                                    			</div> 
971                                    		</div> 
972                                    		<div class="form-group-autofit"> 
973                                    			<div class="form-group-item"> 
974                                    				<label for="address">Indirizzo</label> 
975                                    				<input class="form-control" id="address" v-model="userData.billingStreetAddress" type="text"/> 
976                                    			</div> 
977                                    		</div> 
978                                    		<div class="form-group-autofit"> 
979                                    			<div class="form-group-item"> 
980                                    				<label for="citta">Città</label> 
981                                    				<input class="form-control" id="citta" v-model="userData.billingCity" type="text"/> 
982                                    			</div> 
983                                    			<div class="form-group-item"> 
984                                    				<label for="cap">CAP</label> 
985                                    				<input class="form-control" id="cap" v-model="userData.billingPostalCode" type="text"/> 
986                                    			</div> 
987                                    			<div class="form-group-item"> 
988                                    				<label for="provincia">Provincia</label> 
989                                    				<input class="form-control" id="provincia" v-model="userData.billingRegionCode" type="text"/> 
990                                    			</div> 
991                                    		</div> 
992                                    		<div class="form-group-autofit"> 
993                                    			<div class="form-group-item"> 
994                                    				<label for="cellulare">Cellulare</label> 
995                                    				<input class="form-control" id="cellulare" v-model="userData.phone" type="text"/> 
996                                    			</div> 
997                                    			<div class="form-group-item"> 
998                                    				<label for="email">Email</label> 
999                                    				<input class="form-control" id="email" v-model="userData.studenteMail" type="email"/> 
1000                                    			</div> 
1001                                    		</div> 
1002                                    		<div class="form-group-autofit"> 
1003                                    			<div class="form-group-item"> 
1004                                    				<label for="nazionalita">Nazionalità</label> 
1005                                    				<input class="form-control" id="nazionalita" v-model="userData.nazionalita" type="text"/> 
1006                                    			</div> 
1007                                    			<div class="form-group-item"> 
1008                                    				<label for="codiceFiscale">Codice fiscale</label> 
1009                                    				<input class="form-control" id="codiceFiscale" v-model="userData.fiscalCode" type="text"/> 
1010                                    			</div> 
1011                                    		</div> 
1012                                    		<div class="form-group-autofit"> 
1013                                    			<div class="form-group-item"> 
1014                                    				<label for="tipoDocumento">Tipo documento valido per l'espatrio</label> 
1015                                    				<input class="form-control" id="tipoDocumento" v-model="userData.tipoDocumento" type="text"/> 
1016                                    			</div> 
1017                                    			<div class="form-group-item"> 
1018                                    				<label for="numeroDocumento">Numero</label> 
1019                                    				<input class="form-control" id="numeroDocumento" v-model="userData.numeroDocumento" type="text"/> 
1020                                    			</div> 
1021                                    		</div> 
1022                                    		<div class="form-group-autofit"> 
1023                                    			<div class="form-group-item"> 
1024                                    				<label for="enteRilascioDocumento">Rilasciato da</label> 
1025                                    				<input class="form-control" id="enteRilascioDocumento" v-model="userData.enteRilascioDocumento" type="text"/> 
1026                                    			</div> 
1027                                    			<div class="form-group-item"> 
1028                                    				<label for="paeseEmissioneDocumento">Paese di emissione</label> 
1029                                    				<input class="form-control" id="paeseEmissioneDocumento" v-model="userData.paeseEmissioneDocumento" type="text"/> 
1030                                    			</div> 
1031                                    		</div> 
1032                                    		<div class="form-group-autofit"> 
1033                                    			<div class="form-group-item"> 
1034                                    				<label for="dataRilascioDocumento">Data rilascio</label> 
1035                                    				<input class="form-control" id="dataRilascioDocumento" v-model="userData.dataRilascioDocumento" type="text"/> 
1036                                    			</div> 
1037                                    			<div class="form-group-item"> 
1038                                    				<label for="dataScadenzaDocumento">Data di scadenza</label> 
1039                                    				<input class="form-control" id="dataScadenzaDocumento" v-model="userData.dataScadenzaDocumento" type="text"/> 
1040                                    			</div> 
1041                                    		</div> 
1042                                    		<div class="form-group-autofit"> 
1043                                    			<div class="form-group-item"> 
1044                                    				<label for="documentoViaggio">Documento necessario per poter effettuare il viaggio</label> 
1045                                    				<input class="form-control" id="documentoViaggio" v-model="userData.documentoViaggio" type="text"/> 
1046                                    			</div> 
1047                                    		</div> 
1048                                    		<div class="form-group-autofit"> 
1049                                    			<div class="form-group-item"> 
1050                                    				<label>Fumatore</label> 
1051                                    				<div> 
1052                                        				<div class="custom-control custom-radio custom-control-inline"> 
1053                                                        	<label> 
1054                                                        		<input class="custom-control-input" name="fumatore" type="radio" value="true" v-model="userData.fumatore"/> 
1055                                                        		<span class="custom-control-label"> 
1056                                                        			<span class="custom-control-label-text">Si</span> 
1057                                                        		</span> 
1058                                                        	</label> 
1059                                                        </div> 
1060                                                        <div class="custom-control custom-radio custom-control-inline"> 
1061                                                        	<label> 
1062                                                        		<input class="custom-control-input" name="fumatore" type="radio" value="false" v-model="userData.fumatore"/> 
1063                                                        		<span class="custom-control-label"> 
1064                                                        			<span class="custom-control-label-text">No</span> 
1065                                                        		</span> 
1066                                                        	</label> 
1067                                                        </div> 
1068                                                    </div> 
1069                                    			</div> 
1070                                    		</div> 
1071                                    		<div class="form-group-autofit"> 
1072                                    			<div class="form-group-item"> 
1073                                    				<label>Problemi di salute dello studente da segnalare (allergie/intolleranze alimentari o disturbi di altro genere)</label> 
1074                                    				<div class="custom-control custom-radio"> 
1075                                                    	<label> 
1076                                                    		<input class="custom-control-input" name="problemiSalute" type="radio" value="true" v-model="userData.problemiSalute"/> 
1077                                                    		<span class="custom-control-label"> 
1078                                                    			<span class="custom-control-label-text">Si, come da certificato medico che sarà inviato</span> 
1079                                                    		</span> 
1080                                                    	</label> 
1081                                                    </div> 
1082                                                    <div class="custom-control custom-radio"> 
1083                                                    	<label> 
1084                                                    		<input class="custom-control-input" name="problemiSalute" type="radio" value="false" v-model="userData.problemiSalute"/> 
1085                                                    		<span class="custom-control-label"> 
1086                                                    			<span class="custom-control-label-text">No</span> 
1087                                                    		</span> 
1088                                                    	</label> 
1089                                                    </div> 
1090                                    			</div> 
1091                                    		</div> 
1092                                    	</div> 
1093                                    	 
1094                                    	<div class="sheet-section"> 
1095                                    		<p class="sheet-title">Dati della scuola frequentata dal/dalla proprio/a figlio/a</p> 
1096                                    	     
1097                                    		<div class="form-group-autofit"> 
1098                                    			<div class="form-group-item"> 
1099                                    				<label for="nomeScuola">Nome scuola</label> 
1100                                    				<input class="form-control" id="nomeScuola" v-model="userData.nomeScuola" type="text"/> 
1101                                    			</div> 
1102                                    			<div class="form-group-item"> 
1103                                    				<label for="codiceMeccanografico">Codice meccanografico</label> 
1104                                    				<input class="form-control" id="codiceMeccanografico" v-model="userData.codiceMeccanografico" type="text"/> 
1105                                    			</div> 
1106                                    		</div> 
1107                                    		<div class="form-group-autofit"> 
1108                                    			<div class="form-group-item"> 
1109                                    				<label for="indirizzoScuola">Indirizzo</label> 
1110                                    				<input class="form-control" id="indirizzoScuola" v-model="userData.indirizzoScuola" type="text"/> 
1111                                    			</div> 
1112                                    		</div> 
1113                                    		<div class="form-group-autofit"> 
1114                                    			<div class="form-group-item"> 
1115                                    				<label for="cittaScuola">Città</label> 
1116                                    				<input class="form-control" id="cittaScuola" v-model="userData.cittaScuola" type="text"/> 
1117                                    			</div> 
1118                                    			<div class="form-group-item"> 
1119                                    				<label for="provinciaScuola">Provincia</label> 
1120                                    				<input class="form-control" id="provinciaScuola" v-model="userData.provinciaScuola" type="text"/> 
1121                                    			</div> 
1122                                    		</div> 
1123                                    		<div class="form-group-autofit"> 
1124                                    			<div class="form-group-item"> 
1125                                    				<label for="telefonoScuola">Telefono</label> 
1126                                    				<input class="form-control" id="telefonoScuola" v-model="userData.telefonoScuola" type="text"/> 
1127                                    			</div> 
1128                                    			<div class="form-group-item"> 
1129                                    				<label for="emailScuola">Email</label> 
1130                                    				<input class="form-control" id="emailScuola" v-model="userData.emailScuola" type="email"/> 
1131                                    			</div> 
1132                                    		</div> 
1133                                    		<div class="form-group-autofit"> 
1134                                    			<div class="form-group-item"> 
1135                                    				<label for="nomeCognomeDirigenteScolastico">Nome e cognome del dirigente scolastico</label> 
1136                                    				<input class="form-control" id="nomeCognomeDirigenteScolastico" v-model="userData.nomeCognomeDirigenteScolastico" type="text"/> 
1137                                    			</div> 
1138                                    		</div> 
1139                                    		<div class="form-group-autofit"> 
1140                                    			<div class="form-group-item"> 
1141                                    				<label for="nomeCognomeTutorMobilta">Nome e cognome del tutor mobilità studentesca</label> 
1142                                    				<input class="form-control" id="nomeCognomeTutorMobilita" v-model="userData.nomeCognomeTutorMobilita" type="text"/> 
1143                                    			</div> 
1144                                    			<div class="form-group-item"> 
1145                                    				<label for="emailTutorMobilita">Email</label> 
1146                                    				<input class="form-control" id="emailTutorMobilita" v-model="userData.emailTutorMobilita" type="email"/> 
1147                                    			</div> 
1148                                    		</div> 
1149                                    		<div class="form-group-autofit"> 
1150                                    			<div class="form-group-item"> 
1151                                    				<label for="nomeCognomeDocenteLinguaStraniera">Nome e cognome del docente di lingua straniera</label> 
1152                                    				<input class="form-control" id="nomeCognomeDocenteLinguaStraniera" v-model="userData.nomeCognomeDocenteLinguaStraniera" type="text"/> 
1153                                    			</div> 
1154                                    			<div class="form-group-item"> 
1155                                    				<label for="emailDocenteLinguaStraniera">Email</label> 
1156                                    				<input class="form-control" id="emailDocenteLinguaStraniera" v-model="userData.emailDocenteLinguaStraniera" type="email"/> 
1157                                    			</div> 
1158                                    		</div> 
1159                                    	</div> 
1160                                    </div> 
1161                                </div> 
1162                                <div class="col-12" v-else> 
1163                                    <p class="text-dark display-5 font-weight-light">Per continuare, seleziona un periodo dalla prima pagina.</p> 
1164                                </div> 
1165                                 
1166                                <div class="col-12"> 
1167                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
1168                                        <div class="card-row"> 
1169                                            <div class="autofit-col autofit-col-expand"> 
1170                                                <section class="autofit-section text-left"> 
1171                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
1172                                                        Indietro 
1173                                                    </button> 
1174                                                </section> 
1175                                            </div> 
1176                                            <div class="autofit-col autofit-col-expand"> 
1177                                                <section class="autofit-section text-right"> 
1178                                                    <button @click="gotoStep('next')" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="!moduloValid"> 
1179                                                        Avanti 
1180                                                    </button> 
1181                                                </section> 
1182                                            </div> 
1183                                        </div> 
1184                                    </div> 
1185                                </div> 
1186                            </div> 
1187                        </div> 
1188                         
1189                        <#-- PAGAMENTO --> 
1190                        <div class="tab-pane fade" :class="{'show active': currentStep == 9}" v-if="signedIn" role="tabpanel"> 
1191                            <div class="row"> 
1192                                <div class="d-none d-lg-block col-12 mb-4"> 
1193                                    <p class="text-dark display-5 font-weight-light">Scegli il metodo di pagamento</p> 
1194                                </div> 
1195                                 
1196                                <div class="col-12 col-lg-7" v-if="selectedProgram != null"> 
1197                                    <ul class="list-group mb-lg-0"> 
1198                                    	<li v-for="(type, index) in selectedProgram.paymentType" :key="'type-' + index" class="list-group-item" v-if="type=='cartaCredito' || type == 'bonifico' || type =='cartaCreditoAcconto'"> 
1199                                    	    <div class="card-row flex-column flex-lg-row"> 
1200                                    	        <div class="autofit-col autofit-col-expand"> 
1201                                    	            <section class="autofit-section my-auto"> 
1202                                            			<div class="custom-control custom-radio"> 
1203                                            				<label> 
1204                                            				    <input class="custom-control-input" type="radio" name="paymentMethod" v-model="selectedPayment" :value="type" /> 
1205                                            					<span class="custom-control-label"> 
1206                                            					    <span class="custom-control-label-text"> 
1207                                            					        {{ getPaymentLabel(type) }} 
1208                                            					    </span> 
1209                                            					</span> 
1210                                            				</label> 
1211                                            			</div> 
1212                                            		</section> 
1213                                        		</div> 
1214                                        		<div class="autofit-col autofit-col-expand" v-if="type=='cartaCreditoAcconto' || type == 'bonifico' "> 
1215                                    				<section class="autofit-section my-auto"> 
1216                                    				    <p class="text-dark text-right h3 mb-0 mr-3">Acconto: {{ selectedProgram.depositAmount | money }}</p> 
1217                                    				</section> 
1218                                        		</div> 
1219                                        		<div class="autofit-col autofit-col-expand"> 
1220                                    				<section class="autofit-section text-right my-auto"> 
1221                                    				    <img src="${images_folder}/bonifico.png" height="60" alt="bonifico" v-if="type == 'bonifico'"> 
1222                                    				    <img src="${images_folder}/visa-mastercard.png" height="60" alt="visa-mastercard" v-if="type == 'cartaCredito'"> 
1223                                    				    <img src="${images_folder}/visa-mastercard.png" height="60" alt="visa-mastercard" v-if="type == 'cartaCreditoAcconto'"> 
1224                                    				</section> 
1225                                        		</div> 
1226                                    	    </div> 
1227                                    	     
1228                                    	    <p v-if="type == 'bonifico'" class="card-subtitle px-1"> 
1229                                    	        Intestato a Zainetto Verde srl - IBAN IT42L0100513700000000002639 
1230                                    	    </p> 
1231                                    	</li> 
1232                                    </ul> 
1233                                </div> 
1234                                <div class="col-12 col-lg-5"> 
1235                                    <div class="autofit-section"> 
1236                                        <div v-for="(attachment, index) in attachments" :key="'attachment-' + index" class="card-row mb-4 mb-lg-2"> 
1237                                            <div class="autofit-col autofit-col-expand"> 
1238                                                <section class="autofit-section"> 
1239                                                    <div class="custom-control custom-checkbox"> 
1240                                            			<label> 
1241                                            				<input v-model="policyContent['condition' + sum(index, 1)]" class="custom-control-input" type="checkbox"> 
1242                                            				<span class="custom-control-label"> 
1243                                            					<span class="custom-control-label-text"> 
1244                                            					    {{ attachment.title }} 
1245                                            					    <template v-if="attachment.mandatory">*</template> 
1246                                            					</span> 
1247                                            				</span> 
1248                                            			</label> 
1249                                            		</div> 
1250                                                </section> 
1251                                            </div> 
1252                                            <div class="autofit-col"> 
1253                                                <section class="autofit-section"> 
1254                                                    <a :href="attachment.file" class="text-aqua mb-0" download> 
1255                                                        Scarica il documento 
1256                                                        <i class="fas fa-download ml-1"></i> 
1257                                                    </a> 
1258                                                </section> 
1259                                            </div> 
1260                                        </div> 
1261                                    </div> 
1262                                     
1263                                    <p v-if="selectedProgram != null && orderResult != ''" class="h4">{{ orderResult }}</p> 
1264                                </div> 
1265                                 
1266                                <div class="col-12"> 
1267                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
1268                                        <div class="card-row"> 
1269                                            <div class="autofit-col autofit-col-expand"> 
1270                                                <section class="autofit-section text-left"> 
1271                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
1272                                                        Indietro 
1273                                                    </button> 
1274                                                </section> 
1275                                            </div> 
1276                                            <div class="autofit-col autofit-col-expand"> 
1277                                                <section class="autofit-section text-right"> 
1278                                                    <button @click="createOrderAndPaymentUrl()" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="selectedPayment == null || !validPolicyContent"> 
1279                                                        Termina 
1280                                                    </button> 
1281                                                </section> 
1282                                            </div> 
1283                                        </div> 
1284                                    </div> 
1285                                </div> 
1286                            </div> 
1287                        </div> 
1288                         
1289                        <#-- RINGRAZIAMENTO --> 
1290                        <div class="tab-pane fade" :class="{'show active': currentStep == 10}" v-if="signedIn" role="tabpanel"> 
1291                            <div class="row"> 
1292                                <div class="d-none d-lg-block col-12 mb-4"> 
1293                                    <p class="text-dark display-5 font-weight-light">Grazie per la tua prenotazione</p> 
1294                                </div> 
1295                                 
1296                                <div class="col-12 col-lg-7"> 
1297                                    <p class="h4 text-dark font-weight-regular mt-5"> 
1298                                        Grazie per aver prenotato un programma Zainetto Verde!<br> 
1299                                        Ti è stata inviata una mail di riepilogo e potrai trovare il riepilogo del tuo acquisto anche nella sezione dei tuoi viaggi. 
1300                                    </p> 
1301                                </div> 
1302                                 
1303                                <div class="col-12 col-lg-5"> 
1304                                    <div class="d-flex h-100 align-items-end justify-content-center"> 
1305                                        <button @click="redirectParent('/i-miei-viaggi')" class="btn btn-gradient btn-lg mt-4 mt-lg-0">Vai ai tuoi viaggi</button> 
1306                                    </div> 
1307                                </div> 
1308                            </div> 
1309                        </div> 
1310                    </div> 
1311                </div> 
1312            </div> 
1313        </div> 
1314    </div> 
1315</#macro> 
1316 
1317<#assign 
1318    RILS = serviceLocator.findService("eu.suggesto.d40.builder.d40.service.RateItemLocalService") 
1319    DLAppLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppLocalService") 
1320    JALS = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") 
1321    suggestoMkspAPI = serviceLocator.findService("eu.suggesto.suggestogui.service.SuggestoGuiLocalService") 
1322    productServiceAPI = serviceLocator.findService("eu.suggesto.d40.builder.d40.service.ProductLocalService") 
1323    saxReaderUtil = staticUtil["com.liferay.portal.kernel.xml.SAXReaderUtil"] 
1324     
1325    images_folder = themeDisplay.getPathThemeImages() 
1326    icons_folder = images_folder + "/icons" 
1327    contentId = result.getRequestStringParameter("contentId") 
1328    defLocale = localeUtil.fromLanguageId("it_IT") 
1329    image = "https://via.placeholder.com/300" 
1330    dateSoggiorno = [] 
1331    programs = [] 
1332    name = "Placeholder" 
1333    prezzo_base = 0 
1334    sCatSistemazione = "" 
1335    gruppiDiMarketing=JSONFactoryUtil.createJSONArray() 
1336/> 
1337 
1338<#if contentId?has_content> 
1339    <#assign 
1340        programs = RILS.getAvailRatesByItemId(groupId, "", groupId, contentId, '{"validDates.start":1}', 0, 10) 
1341        article = JALS.getArticle(themeDisplay.getSiteGroupId(), contentId) 
1342        docTitle=article.getTitle(defLocale) 
1343        document = saxReaderUtil.read(article.getContent()) 
1344        rootElement = document.getRootElement() 
1345        groupedCategories = suggestoMkspAPI.getGroupedArticleCategories(groupId, contentId, locale, defLocale) 
1346         
1347        xPathDate = saxReaderUtil.createXPath("dynamic-element[@name='data_inizio']") 
1348        xPathImage = saxReaderUtil.createXPath("dynamic-element[@name='anteprima']") 
1349        xPathName = saxReaderUtil.createXPath("dynamic-element[@name='nome_scuola']/dynamic-content[@language-id='" + themeDisplay.getLocale() + "']") 
1350        xPathPrezzo = saxReaderUtil.createXPath("dynamic-element[@name='prezzo_base']/dynamic-content[@language-id='" + themeDisplay.getLocale() + "']") 
1351        allegatiContent = [] 
1352        stringSelectorContent = "dynamic-element[@name='documentoContrattuale']" 
1353        xPathSelectorContent = saxReaderUtil.createXPath(stringSelectorContent) 
1354    /> 
1355    <#if xPathSelector.selectNodes(rootElement)??> 
1356        <#assign allegatiContent = xPathSelectorContent.selectNodes(rootElement)> 
1357    </#if> 
1358 
1359 
1360    <#if (groupedCategories.length() > 0) > 
1361        <#list 0..groupedCategories.length()-1 as i> 
1362            <#assign 
1363                gc = groupedCategories.getJSONObject(i) 
1364                gcCat = gc.getJSONArray("categories") 
1365                vacabularyName = gc.getString("vocabularyName") 
1366            /> 
1367             
1368            <#if vacabularyName == "Tipo di sistemazione"> 
1369                <#list 0..gcCat.length()-1 as y> 
1370                    <#assign 
1371                        sCat = gcCat.getJSONObject(y) 
1372                        sCatId = sCat.getString("categoryId") 
1373                        sCatSistemazione = sCat.getString("name") 
1374                        sCatIcon = sCat.getString("icon") 
1375                    /> 
1376                </#list> 
1377            </#if> 
1378            <#if vacabularyName == "Gruppi di Marketing"> 
1379                <#list 0..gcCat.length()-1 as y> 
1380                    <#assign 
1381                        z = gcCat.getJSONObject(y) 
1382                        a =gruppiDiMarketing.put(z.getString("name")) 
1383                    /> 
1384                </#list> 
1385            </#if> 
1386 
1387        </#list> 
1388    </#if> 
1389     
1390    <#if xPathDate.selectNodes(rootElement)??> 
1391        <#list xPathDate.selectNodes(rootElement) as node> 
1392            <#assign 
1393                dataInizio = node.selectSingleNode("dynamic-content[@language-id='" + themeDisplay.getLocale() + "']").getStringValue()?replace("-", "/") 
1394                dataFine = node.selectSingleNode("dynamic-element[@name='data_fine']/dynamic-content[@language-id='" + themeDisplay.getLocale() + "']").getStringValue()?replace("-", "/") 
1395                dateSoggiorno += [ 
1396
1397                        "dataInizio": "${dataInizio}", 
1398                        "dataFine": "${dataFine}" 
1399
1400
1401            /> 
1402        </#list> 
1403    </#if> 
1404     
1405    <#if xPathImage.selectSingleNode(rootElement)??> 
1406        <#compress> 
1407            <#assign tmpImage = xPathImage.selectSingleNode(rootElement).getStringValue()?trim> 
1408        </#compress> 
1409         
1410        <#if tmpImage?has_content> 
1411            <#assign 
1412                image = tmpImage 
1413                jsonField = jsonFactoryUtil.createJSONObject(image) 
1414                fileEntry = DLAppLocalService.getFileEntryByUuidAndGroupId(jsonField.uuid, groupId) 
1415                image = "/documents/" + jsonField.groupId + "/" + fileEntry.folderId + "/" + jsonField.title + "/" + jsonField.uuid 
1416            /> 
1417        </#if> 
1418    </#if> 
1419     
1420    <#if xPathName.selectSingleNode(rootElement)??> 
1421        <#assign name = xPathName.selectSingleNode(rootElement).getStringValue()?trim?capitalize> 
1422    </#if> 
1423     
1424    <#if xPathPrezzo.selectSingleNode(rootElement)??> 
1425        <#assign prezzo_base = xPathPrezzo.selectSingleNode(rootElement).getStringValue()?trim> 
1426    </#if> 
1427</#if> 
1428 
1429<@printContent /> 
1430 
1431<script src="https://s3-eu-west-1.amazonaws.com/mkspresstage.suggesto.eu/components/securityV2.js"></script> 
1432 
1433<script> 
1434    document.addEventListener("DOMContentLoaded", function (){ 
1435        Vue.filter("money", function(value){ 
1436            if(typeof value!="undefined" && value!="") 
1437            return parseFloat(value).toFixed(2).toString().replace(".", ",") + "€"; 
1438            else 
1439            return ""; 
1440        }); 
1441         
1442        var pay = new Vue({ 
1443            el: "#pay", 
1444            data: { 
1445                /* 
1446                isDev: Liferay.ThemeDisplay.getUserEmailAddress().includes("@suggesto") && !Liferay.ThemeDisplay.getUserEmailAddress().includes("studente"), 
1447                */ 
1448                 
1449                isDev: false, 
1450                loading: true, 
1451                favourite: false, 
1452                contentId: "${contentId}", 
1453                image: "${htmlUtil.escape(image)}", 
1454                currentStep: 1, 
1455                totalSteps: 0, 
1456                name: "${name}", 
1457                signedIn: Liferay.ThemeDisplay.isSignedIn(), 
1458                groupId: Liferay.ThemeDisplay.getScopeGroupId(), 
1459                userMail: Liferay.ThemeDisplay.getUserEmailAddress(), 
1460                defaultLanguage: "it", 
1461                defaultCountryId: "8", 
1462                programPrice: 0, 
1463                programDiscount: 0, 
1464                selectedProgram: null, 
1465                selectedAirport: null, 
1466                selectedAccomodation: null, 
1467                selectedServices: [], 
1468                selectedDiscounts: [], 
1469                selectedPayment: null, 
1470                selectedArea: null, 
1471                selectedSchool: null, 
1472                paymentLink: "#", 
1473                oid: "", 
1474                voucher: "", 
1475                voucherDiscount: 0, 
1476                voucherValid: false, 
1477                searchTerm: "", 
1478                programs: ${programs.getJSONObject('data').getJSONArray('items')}, 
1479                attachments: [], 
1480                labels: {}, 
1481                policy: { 
1482                    <#list allegati as allegato> 
1483                        condition${allegato?counter}: false, 
1484                    </#list> 
1485                }, 
1486                policyContent: { 
1487                    <#list allegatiContent as allegato> 
1488                        conditionContent${allegato?counter}: false, 
1489                    </#list> 
1490                }, 
1491                countryList: [], 
1492                regionList: [], 
1493                userData: {}, 
1494                orderResult: "" 
1495            }, 
1496            created(){ 
1497                var that = this; 
1498                 
1499                moment.locale(navigator.language.split("-")[0]); 
1500                 
1501                window.addEventListener("keyup", function(e){  
1502                    if(e.which == 27){ 
1503                        that.closeParentModal("#pay-modal"); 
1504
1505                }); 
1506                 
1507/*                this.setAttachments(); */ 
1508                this.setAttachmentsContent();  
1509 
1510            }, 
1511            mounted(){ 
1512                window.addEventListener("message", this.getExternalData.bind(this)); 
1513                 
1514                if(this.signedIn){ 
1515                    this.userId = Liferay.ThemeDisplay.getUserId(); 
1516                    this.checkFavourite(); 
1517                    this.getUserData(); 
1518                     
1519                    this.totalSteps = 9; 
1520                }else{ 
1521                    this.userData.firstName = ""; 
1522                    this.userData.lastName = ""; 
1523                    this.userData.phone = ""; 
1524                    this.totalSteps = 8; 
1525
1526                 
1527                console.log("total steps: " + this.totalSteps); 
1528                 
1529                this.getVocabularyLabels(); 
1530                this.getProgressData(); 
1531 
1532                this.loading = false; 
1533            }, 
1534            computed: { 
1535                computedResults: function(){ 
1536                    var that = this, 
1537                        zones = []; 
1538                     
1539                    this.selectedProgram.statoZonaScuolaTree.forEach(function(zone){ 
1540//                        if(that.selectedProgram.title.toLowerCase().includes("classic") || that.selectedProgram.title.toLowerCase().includes("combo")){ 
1541                        if(that.isClassic()){     
1542                            if(zone.name?.toLowerCase().includes(that.searchTerm)){ 
1543                                zones.push(zone); 
1544
1545                        }else{ 
1546                            if(_.has(zone, "children") && zone.name?.toLowerCase().includes(that.searchTerm)){ 
1547                                zones.push(zone); 
1548
1549
1550                    }); 
1551                     
1552                    return zones; 
1553                }, 
1554                totalPrice: function(){ 
1555                    return this.selectedServices.reduce(function(total, item){ 
1556                        return Number(total) + Number(item.price); 
1557                    }, Number(this.programPrice) - Number(this.programDiscount) + Number(this.selectedArea?.price || 0) + Number(this.selectedSchool?.price || 0) + Number(this.selectedAirport?.price || 0) + Number(this.selectedAccomodation?.price || 0) - Number(this.totalDiscounts || 0)); 
1558                }, 
1559                totalPriceWithVoucher: function(){ 
1560                    return this.selectedServices.reduce(function(total, item){ 
1561                        return Number(total) + Number(item.price); 
1562                    }, Number(this.programPrice) - Number(this.programDiscount) + Number(this.selectedArea?.price || 0) + Number(this.selectedSchool?.price || 0) + Number(this.selectedAirport?.price || 0) + Number(this.selectedAccomodation?.price || 0) - Number(this.totalDiscounts || 0) - Number(this.voucherDiscount || 0)); 
1563                }, 
1564                totalDiscounts: function(){ 
1565                    return this.selectedDiscounts.reduce(function(total, item){ 
1566                        return Number(total) + Number(item.discount); 
1567                    }, 0) 
1568                }, 
1569                validPolicy: function(){ 
1570                    var valid = false; 
1571                     
1572                    <#if ! allegati?has_content> 
1573                        valid=true; 
1574                    </#if> 
1575                     
1576                    if( 
1577                        <#list allegati as allegato> 
1578                            <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
1579                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
1580                            <#if xPathSelector.selectSingleNode(allegato)??> 
1581                                <#assign mandatory = xPathSelector.selectSingleNode(allegato).getData()> 
1582                            </#if> 
1583                             
1584                            <#if mandatory == "true">  
1585                                <#if !allegato?is_first> && </#if> 
1586                                this.policy.condition${allegato?counter} 
1587                            </#if> 
1588                        </#list> 
1589                    ){ 
1590                        valid = true; 
1591
1592                     
1593                    return valid; 
1594                }, 
1595                validPolicyContent: function(){ 
1596                    var valid = false; 
1597                     
1598                    if( 
1599                        <#assign listEmpty = "true"> 
1600                        <#list allegatiContent as allegato> 
1601                            <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
1602                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
1603                            <#assign mandatoryContent="false"> 
1604                            <#if xPathSelector.selectSingleNode(allegato)??> 
1605                                <#assign mandatoryContent = xPathSelector.selectSingleNode(allegato).getData()> 
1606                            </#if> 
1607                            <#if mandatoryContent == "true">  
1608                                <#if !allegato?is_first> && </#if> 
1609                                <#assign listEmpty="false"> 
1610                                this.policyContent.condition${allegato?counter} 
1611                            </#if> 
1612                        </#list> 
1613                        <#if listEmpty == "true"> 
1614                            false 
1615                        </#if> 
1616                    ){ 
1617                        valid = true; 
1618
1619                    return valid; 
1620                }, 
1621                minimumValid: function(){ 
1622                    var valid = true; 
1623                     
1624                    if(this.userData != null){ 
1625                        if(!this.userData.hasOwnProperty("firstName") || typeof this.userData["firstName"] !== "string" || this.userData["firstName"].length == 0){ 
1626                            valid = false; 
1627
1628                        if(!this.userData.hasOwnProperty("lastName") || typeof this.userData["lastName"] !== "string" || this.userData["lastName"].length == 0){ 
1629                            valid = false; 
1630
1631                        if(this.userMail == ""){ 
1632                            valid = false; 
1633
1634                    }else{ 
1635                        valid = false; 
1636
1637                         
1638                    return valid; 
1639                }, 
1640                moduloValid: function(){ 
1641                    var valid = true; 
1642                     
1643                    if(this.userData != null){ 
1644                        // Tutore/i 
1645                        if(_.has(this.userData, "tutore.firstName")){ 
1646                            if(typeof this.userData.tutore.firstName !== "string" || this.userData.tutore.firstName.length == 0){ 
1647                                valid = false 
1648
1649                        }else{ 
1650                            valid = false; 
1651
1652                         
1653                        if(_.has(this.userData, "tutore.lastName")){ 
1654                            if(typeof this.userData.tutore.lastName !== "string" || this.userData.tutore.lastName.length == 0){ 
1655                                valid = false 
1656
1657                        }else{ 
1658                            valid = false; 
1659
1660                         
1661                        if(_.has(this.userData, "tutore.address")){ 
1662                            if(typeof this.userData.tutore.address !== "string" || this.userData.tutore.address.length == 0){ 
1663                                valid = false 
1664
1665                        }else{ 
1666                            valid = false; 
1667
1668                         
1669                        if(_.has(this.userData, "tutore.citta")){ 
1670                            if(typeof this.userData.tutore.citta !== "string" || this.userData.tutore.citta.length == 0){ 
1671                                valid = false 
1672
1673                        }else{ 
1674                            valid = false; 
1675
1676                         
1677                        if(_.has(this.userData, "tutore.cap")){ 
1678                            if(typeof this.userData.tutore.cap !== "string" || this.userData.tutore.cap.length == 0){ 
1679                                valid = false 
1680
1681                        }else{ 
1682                            valid = false; 
1683
1684                         
1685                        if(_.has(this.userData, "tutore.provincia")){ 
1686                            if(typeof this.userData.tutore.provincia !== "string" || this.userData.tutore.provincia.length == 0){ 
1687                                valid = false 
1688
1689                        }else{ 
1690                            valid = false; 
1691
1692                         
1693                        if(_.has(this.userData, "tutore.cellulare")){ 
1694                            if(typeof this.userData.tutore.cellulare !== "string" || this.userData.tutore.cellulare.length == 0){ 
1695                                valid = false 
1696
1697                        }else{ 
1698                            valid = false; 
1699
1700                         
1701                        if(_.has(this.userData, "tutore.email")){ 
1702                            if(typeof this.userData.tutore.email !== "string" || this.userData.tutore.email.length == 0){ 
1703                                valid = false 
1704
1705                        }else{ 
1706                            valid = false; 
1707
1708                         
1709                        if(_.has(this.userData, "tutore.telefono")){ 
1710                            if(typeof this.userData.tutore.telefono !== "string" || this.userData.tutore.telefono.length == 0){ 
1711                                valid = false 
1712
1713                        }else{ 
1714                            valid = false; 
1715
1716                         
1717                        if(_.has(this.userData, "tutore.codiceFiscale")){ 
1718                            if(typeof this.userData.tutore.codiceFiscale !== "string" || this.userData.tutore.codiceFiscale.length == 0){ 
1719                                valid = false 
1720
1721                        }else{ 
1722                            valid = false; 
1723
1724                         
1725                        //Tutore2 
1726                        if(_.has(this.userData, "tutore2.cellulare")){ 
1727                            if(typeof this.userData.tutore2.cellulare !== "string" || this.userData.tutore2.cellulare.length == 0){ 
1728                                valid = false 
1729
1730                        }else{ 
1731                            valid = false; 
1732
1733                         
1734                        if(_.has(this.userData, "tutore2.email")){ 
1735                            if(typeof this.userData.tutore2.email !== "string" || this.userData.tutore2.email.length == 0){ 
1736                                valid = false 
1737
1738                        }else{ 
1739                            valid = false; 
1740
1741                         
1742                        if(_.has(this.userData, "tutore2.telefono")){ 
1743                            if(typeof this.userData.tutore2.telefono !== "string" || this.userData.tutore2.telefono.length == 0){ 
1744                                valid = false 
1745
1746                        }else{ 
1747                            valid = false; 
1748
1749                         
1750                        //Studente 
1751                        if(_.has(this.userData, "firstName")){ 
1752                            if(typeof this.userData.firstName !== "string" || this.userData.firstName.length == 0){ 
1753                                valid = false 
1754
1755                        }else{ 
1756                            valid = false; 
1757
1758                         
1759                        if(_.has(this.userData, "lastName")){ 
1760                            if(typeof this.userData.lastName !== "string" || this.userData.lastName.length == 0){ 
1761                                valid = false 
1762
1763                        }else{ 
1764                            valid = false; 
1765
1766                         
1767                        if(_.has(this.userData, "birthPlace")){ 
1768                            if(typeof this.userData.birthPlace !== "string" || this.userData.birthPlace.length == 0){ 
1769                                valid = false 
1770
1771                        }else{ 
1772                            valid = false; 
1773
1774                         
1775                        if(_.has(this.userData, "provincia")){ 
1776                            if(typeof this.userData.provincia !== "string" || this.userData.provincia.length == 0){ 
1777                                valid = false 
1778
1779                        }else{ 
1780                            valid = false; 
1781
1782                         
1783                        if(_.has(this.userData, "birthday")){ 
1784                            if(typeof this.userData.birthday !== "string" || this.userData.birthday.length == 0){ 
1785                                valid = false 
1786
1787                        }else{ 
1788                            valid = false; 
1789
1790                         
1791                        if(_.has(this.userData, "gender")){ 
1792                            if(typeof this.userData.gender !== "string" || this.userData.gender.length == 0){ 
1793                                valid = false 
1794
1795                        }else{ 
1796                            valid = false; 
1797
1798                         
1799                        if(_.has(this.userData, "billingStreetAddress")){ 
1800                            if(typeof this.userData.billingStreetAddress !== "string" || this.userData.billingStreetAddress.length == 0){ 
1801                                valid = false 
1802
1803                        }else{ 
1804                            valid = false; 
1805
1806                         
1807                        if(_.has(this.userData, "billingCity")){ 
1808                            if(typeof this.userData.billingCity !== "string" || this.userData.billingCity.length == 0){ 
1809                                valid = false 
1810
1811                        }else{ 
1812                            valid = false; 
1813
1814                         
1815                        if(_.has(this.userData, "billingPostalCode")){ 
1816                            if(typeof this.userData.billingPostalCode !== "string" || this.userData.billingPostalCode.length == 0){ 
1817                                valid = false 
1818
1819                        }else{ 
1820                            valid = false; 
1821
1822                         
1823                        if(_.has(this.userData, "billingRegionCode")){ 
1824                            if(typeof this.userData.billingRegionCode !== "string" || this.userData.billingRegionCode.length == 0){ 
1825                                valid = false 
1826
1827                        }else{ 
1828                            valid = false; 
1829
1830                         
1831                        if(_.has(this.userData, "phone")){ 
1832                            if(typeof this.userData.phone !== "string" || this.userData.phone.length == 0){ 
1833                                valid = false 
1834
1835                        }else{ 
1836                            valid = false; 
1837
1838                         
1839                        if(typeof this.userMail !== "string" || this.userMail.length == 0){ 
1840                            valid = false 
1841
1842                         
1843                        if(_.has(this.userData, "nazionalita")){ 
1844                            if(typeof this.userData.nazionalita !== "string" || this.userData.nazionalita.length == 0){ 
1845                                valid = false 
1846
1847                        }else{ 
1848                            valid = false; 
1849
1850                         
1851                        if(_.has(this.userData, "fiscalCode")){ 
1852                            if(typeof this.userData.fiscalCode !== "string" || this.userData.fiscalCode.length == 0){ 
1853                                valid = false 
1854
1855                        }else{ 
1856                            valid = false; 
1857
1858                         
1859                        if(_.has(this.userData, "tipoDocumento")){ 
1860                            if(typeof this.userData.tipoDocumento !== "string" || this.userData.tipoDocumento.length == 0){ 
1861                                valid = false 
1862
1863                        }else{ 
1864                            valid = false; 
1865
1866                         
1867                        if(_.has(this.userData, "numeroDocumento")){ 
1868                            if(typeof this.userData.numeroDocumento !== "string" || this.userData.numeroDocumento.length == 0){ 
1869                                valid = false 
1870
1871                        }else{ 
1872                            valid = false; 
1873
1874                         
1875                        if(_.has(this.userData, "enteRilascioDocumento")){ 
1876                            if(typeof this.userData.enteRilascioDocumento !== "string" || this.userData.enteRilascioDocumento.length == 0){ 
1877                                valid = false 
1878
1879                        }else{ 
1880                            valid = false; 
1881
1882                         
1883                        if(_.has(this.userData, "dataScadenzaDocumento")){ 
1884                            if(typeof this.userData.dataScadenzaDocumento !== "string" || this.userData.dataScadenzaDocumento.length == 0){ 
1885                                valid = false 
1886
1887                        }else{ 
1888                            valid = false; 
1889
1890                         
1891                        if(_.has(this.userData, "documentoViaggio")){ 
1892                            if(typeof this.userData.documentoViaggio !== "string" || this.userData.documentoViaggio.length == 0){ 
1893                                valid = false 
1894
1895                        }else{ 
1896                            valid = false; 
1897
1898                         
1899                        if(_.has(this.userData, "fumatore")){ 
1900                            if(typeof this.userData.fumatore !== "string" || this.userData.fumatore.length == 0){ 
1901                                valid = false 
1902
1903                        }else{ 
1904                            valid = false; 
1905
1906                         
1907                        if(_.has(this.userData, "problemiSalute")){ 
1908                            if(typeof this.userData.problemiSalute !== "string" || this.userData.problemiSalute.length == 0){ 
1909                                valid = false 
1910
1911                        }else{ 
1912                            valid = false; 
1913
1914                         
1915                        //Scuola 
1916                        if(_.has(this.userData, "nomeScuola")){ 
1917                            if(typeof this.userData.nomeScuola !== "string" || this.userData.nomeScuola.length == 0){ 
1918                                valid = false 
1919
1920                        }else{ 
1921                            valid = false; 
1922
1923                         
1924                        if(_.has(this.userData, "codiceMeccanografico")){ 
1925                            if(typeof this.userData.codiceMeccanografico !== "string" || this.userData.codiceMeccanografico.length == 0){ 
1926                                valid = false 
1927
1928                        }else{ 
1929                            valid = false; 
1930
1931                         
1932                        if(_.has(this.userData, "indirizzoScuola")){ 
1933                            if(typeof this.userData.indirizzoScuola !== "string" || this.userData.indirizzoScuola.length == 0){ 
1934                                valid = false 
1935
1936                        }else{ 
1937                            valid = false; 
1938
1939                         
1940                        if(_.has(this.userData, "cittaScuola")){ 
1941                            if(typeof this.userData.cittaScuola !== "string" || this.userData.cittaScuola.length == 0){ 
1942                                valid = false 
1943
1944                        }else{ 
1945                            valid = false; 
1946
1947                         
1948                        if(_.has(this.userData, "provinciaScuola")){ 
1949                            if(typeof this.userData.provinciaScuola !== "string" || this.userData.provinciaScuola.length == 0){ 
1950                                valid = false 
1951
1952                        }else{ 
1953                            valid = false; 
1954
1955                         
1956                        if(_.has(this.userData, "telefonoScuola")){ 
1957                            if(typeof this.userData.telefonoScuola !== "string" || this.userData.telefonoScuola.length == 0){ 
1958                                valid = false 
1959
1960                        }else{ 
1961                            valid = false; 
1962
1963                         
1964                        if(_.has(this.userData, "emailScuola")){ 
1965                            if(typeof this.userData.emailScuola !== "string" || this.userData.emailScuola.length == 0){ 
1966                                valid = false 
1967
1968                        }else{ 
1969                            valid = false; 
1970
1971                         
1972                        if(_.has(this.userData, "nomeCognomeDirigenteScolastico")){ 
1973                            if(typeof this.userData.nomeCognomeDirigenteScolastico !== "string" || this.userData.nomeCognomeDirigenteScolastico.length == 0){ 
1974                                valid = false 
1975
1976                        }else{ 
1977                            valid = false; 
1978
1979                         
1980                        if(_.has(this.userData, "nomeCognomeTutorMobilita")){ 
1981                            if(typeof this.userData.nomeCognomeTutorMobilita !== "string" || this.userData.nomeCognomeTutorMobilita.length == 0){ 
1982                                valid = false 
1983
1984                        }else{ 
1985                            valid = false; 
1986
1987                         
1988                        if(_.has(this.userData, "emailTutorMobilita")){ 
1989                            if(typeof this.userData.emailTutorMobilita !== "string" || this.userData.emailTutorMobilita.length == 0){ 
1990                                valid = false 
1991
1992                        }else{ 
1993                            valid = false; 
1994
1995                         
1996                        if(_.has(this.userData, "nomeCognomeDocenteLinguaStraniera")){ 
1997                            if(typeof this.userData.nomeCognomeDocenteLinguaStraniera !== "string" || this.userData.nomeCognomeDocenteLinguaStraniera.length == 0){ 
1998                                valid = false 
1999
2000                        }else{ 
2001                            valid = false; 
2002
2003                         
2004                        if(_.has(this.userData, "emailDocenteLinguaStraniera")){ 
2005                            if(typeof this.userData.emailDocenteLinguaStraniera !== "string" || this.userData.emailDocenteLinguaStraniera.length == 0){ 
2006                                valid = false 
2007
2008                        }else{ 
2009                            valid = false; 
2010
2011                    }else{ 
2012                        valid = false; 
2013
2014                     
2015                    return valid; 
2016
2017            }, 
2018            methods: { 
2019                areServicesMandatory: function(){ 
2020                    return this.selectedProgram?.servicesAndPrices.some(function(serv){ 
2021                        return serv.mandatory; 
2022                    }); 
2023                }, 
2024                isClassic: function() { 
2025                    var classic=true; 
2026                    this.selectedProgram.statoZonaScuolaTree.forEach(function(zone){ 
2027                        if(_.has(zone, "children") && zone.children.length>0){  
2028                            classic=false; 
2029
2030                    }); 
2031                    console.log(this.selectedProgram.statoZonaScuolaTree); 
2032                    console.log("isClassic:"+classic) 
2033                     
2034                    return classic; 
2035                }, 
2036 
2037                getCategoryName: function(catId){ 
2038                    var that = this; 
2039                    return this.labels[catId]; 
2040                }, 
2041                getVocabularyLabels: function(){ 
2042                    var that = this; 
2043                     
2044                    return axios.get("${d40.serviceEndpoint}{'fn':'getProgrammiLabels'}").then(function(res){ 
2045                        that.labels = res.data.result; 
2046                        console.log(that.labels); 
2047                    }).catch(function(err){ 
2048                        console.error("err: ", err); 
2049                    }); 
2050                }, 
2051                hasSchools: function(area)  { 
2052                    if(typeof area.children !== "undefined" && area.children.length > 0){ 
2053                        return true; 
2054
2055                     
2056                    return false; 
2057                }, 
2058                getScontiDisponibili: function(prg) { 
2059                    var sret=""; 
2060                    var that = this; 
2061                    prg.otherDiscounts.forEach(function(item){ 
2062                        if(sret.length > 0){ 
2063                            sret += ", "; 
2064
2065                         
2066                        sret += that.labels[item.description]; 
2067                    }); 
2068/*                     
2069                    return sret; 
2070*/                    
2071                    return "Procedi e scopri gli sconti e le borse di studio"; 
2072                }, 
2073                getAreaPriceIfSet: function(item){ 
2074                    if(typeof item.price != "undefined" && item.price != ""){ 
2075                        var formatter = new Intl.NumberFormat('it-IT', { 
2076                            style: 'currency', 
2077                            currency: 'EUR', 
2078                        }); 
2079                         
2080                        return " -" + formatter.format(parseFloat(item.price)); 
2081
2082                }, 
2083                getSelectedAreaAndSchoolLabel: function() { 
2084                    if(this.selectedArea != null) { 
2085                        var szret = this.selectedArea.name; 
2086                         
2087                        if(this.selectedSchool !=null && typeof this.selectedSchool !== "undefined" && typeof this.selectedSchool.name !== "undefined"){ 
2088                            szret += ", " + this.selectedSchool.name; 
2089
2090                         
2091                        return szret; 
2092
2093                     
2094                    return ""; 
2095                }, 
2096                getSelectedAreaAndSchoolPrice: function() { 
2097                    var pret = 0; 
2098                     
2099                    if(this.selectedArea != null) { 
2100                        if(this.selectedArea.price != null && this.selectedArea.price !== "undefined" && this.selectedArea.price != ""){ 
2101                            pret = parseFloat(this.selectedArea.price); 
2102
2103                         
2104                        if(this.selectedSchool != null && typeof this.selectedSchool !== "undefined" && this.selectedSchool.price != ""){ 
2105                            pret +=  parseFloat(this.selectedSchool.price); 
2106
2107                         
2108                        var formatter = new Intl.NumberFormat('it-IT', { 
2109                            style: 'currency', 
2110                            currency: 'EUR', 
2111                        }); 
2112                         
2113                        return formatter.format(pret); 
2114
2115                     
2116                    return ""; 
2117                }, 
2118                sum: function(num1, num2){ 
2119                    return Number(num1 + num2); 
2120                }, 
2121                openParentModal: function(id){ 
2122                    window.parent.$(id).modal("show"); 
2123                }, 
2124                closeParentModal: function(id){ 
2125                    window.parent.$(id).modal("hide"); 
2126                }, 
2127                redirectParent: function(url){ 
2128                    window.top.location = "${themeDisplay.getPortalURL()}" + url; 
2129                }, 
2130                gotoStep: function(step){ 
2131                    if(typeof(step) == "number"){ 
2132                        this.currentStep = step; 
2133                    }else{ 
2134                        if(step == "next"){ 
2135                            this.currentStep++; 
2136
2137                        if(step == "prev"){ 
2138                            this.currentStep--; 
2139
2140
2141                }, 
2142                getCity: function(fullString){ 
2143                    return fullString.substr(0, fullString.indexOf('(') === -1 ? fullString.length : fullString.indexOf('(')); 
2144                }, 
2145                isBefore: function(data){ 
2146                    return moment(data).isBefore(new Date()); 
2147                }, 
2148                isAfter: function(data){ 
2149                    return moment(data).isAfter(new Date()); 
2150                }, 
2151                getExternalData: function(message){ 
2152                    var strExtData = JSON.parse(JSON.stringify(message.data)); 
2153                     
2154                    if(strExtData.source == null){ 
2155                        var extData = JSON.parse(strExtData); 
2156                        console.log("dati ricevuti da iframe: ", extData); 
2157                         
2158                        if(extData.key == "programIndex"){ 
2159                            if(this.selectedProgram != extData){ 
2160                                this.selectProgram(extData.data); 
2161                                console.log("selected program: ", extData.data); 
2162                            }else{ 
2163                                console.log("program already selected"); 
2164
2165
2166
2167                }, 
2168                setAttachments: function(){ 
2169                    <#list allegati as allegato> 
2170                        <#assign stringSelector = "dynamic-element[@name='testo']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2171                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2172                        <#if xPathSelector.selectSingleNode(allegato)??> 
2173                            <#assign text = xPathSelector.selectSingleNode(allegato).getData()> 
2174                        </#if> 
2175             
2176                        <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2177                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2178                        <#if xPathSelector.selectSingleNode(allegato)??> 
2179                            <#assign mandatory = xPathSelector.selectSingleNode(allegato).getData()> 
2180                        </#if> 
2181                         
2182                        <#assign stringSelector = "dynamic-element[@name='documento']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2183                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2184                        <#if xPathSelector.selectSingleNode(allegato)??> 
2185                            <#assign document = jsonFactoryUtil.createJSONObject(xPathSelector.selectSingleNode(allegato).getData())> 
2186                        </#if> 
2187                         
2188                        var newAttachment = { 
2189                            title: "${text}", 
2190                            mandatory: ${mandatory}, 
2191                            file: "${'/documents/' + document.getString('groupId') + '/0/' + document.getString('title') + '/' + document.getString('uuid')}" 
2192
2193                         
2194                        this.attachments.push(newAttachment); 
2195                    </#list> 
2196                }, 
2197                setAttachmentsContent: function(){ 
2198                    <#list allegatiContent as allegato> 
2199                        <#assign stringSelector = "dynamic-element[@name='titoloDocContrattuale']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2200                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2201                        <#assign text=""> 
2202                        <#if xPathSelector.selectSingleNode(allegato)??> 
2203                            <#assign text = xPathSelector.selectSingleNode(allegato).getData()> 
2204                        </#if> 
2205                        <#if text?has_content> 
2206                            <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2207                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2208                            <#if xPathSelector.selectSingleNode(allegato)??> 
2209                                <#assign mandatory = xPathSelector.selectSingleNode(allegato).getData()> 
2210                            </#if> 
2211                            <#if ! mandatory?has_content> 
2212                                <#assign mandatory ="false"> 
2213                            </#if> 
2214                             
2215                            <#assign stringSelector = "dynamic-element[@name='docContrattuale']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2216                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2217                            <#if xPathSelector.selectSingleNode(allegato)??> 
2218                                <#assign document = jsonFactoryUtil.createJSONObject(xPathSelector.selectSingleNode(allegato).getData())> 
2219                            </#if> 
2220                             
2221                            var newAttachment = { 
2222                                title: "${text}", 
2223                                mandatory: ${mandatory}, 
2224                                file: "${'/documents/' + document.getString('groupId') + '/0/' + document.getString('title') + '/' + document.getString('uuid')}" 
2225
2226                             
2227                            this.attachments.push(newAttachment); 
2228                        </#if> 
2229                    </#list> 
2230                }, 
2231                getUserData: function(){ 
2232                    var that = this; 
2233                     
2234                    Liferay.Service("/destinazione.d40user/get-user-data", { 
2235                        groupId: this.groupId, 
2236                        userId: this.userId 
2237                    }, function(res){ 
2238                        console.log("Get user data: ", res); 
2239                         
2240                        if(res.success){ 
2241                            that.userData = { 
2242                                tutore: {}, 
2243                                tutore2: {}, 
2244                                ...res.data 
2245                            }; 
2246                             
2247                            that.getCountryList(); 
2248                        }else{ 
2249                            console.log("Error getting user data"); 
2250
2251                    }).catch(function(err){ 
2252                        console.error("Error getting userData: ", err); 
2253                    }); 
2254                }, 
2255                getCountryList: function(){ 
2256                    var that = this; 
2257                     
2258                    Liferay.Service("/destinazione.d40user/get-country-list", { 
2259                        language: this.defaultLanguage 
2260                    }, function(res){ 
2261                        console.log("Get country list: ", res); 
2262                         
2263                        if(res.success){ 
2264                            that.countryList = res.data; 
2265                             
2266                            if(that.userData.billingCountryId == "0" || that.userData.billingCountryId == null){ 
2267                                that.userData.billingCountryId = that.countryList.find(country => country.ID === that.defaultCountryId).ID; 
2268                            }else{ 
2269                                that.userData.billingCountryId = that.defaultCountryId; 
2270
2271                             
2272                            that.getRegionList(); 
2273
2274                    }).catch(function(err){ 
2275                        console.error("Error getting countryList: ", err); 
2276                    }); 
2277                }, 
2278                getRegionList: function(){ 
2279                    var that = this, 
2280                        idToUse = this.defaultCountryId; 
2281                     
2282                    if(this.userData.hasOwnProperty("billingCountryId") && typeof this.userData["billingCountryId"] === "string" && this.userData["billingCountryId"].length){ 
2283                        idToUse = this.userData.billingCountryId; 
2284
2285                     
2286                    Liferay.Service("/destinazione.d40user/get-region-list", { 
2287                        countryId: idToUse 
2288                    }, function(res){ 
2289                        console.log("Get region list: ", res); 
2290                         
2291                        if(res.success){ 
2292                            that.regionList = res.data; 
2293                             
2294                            if(that.userData.billingRegionId == "0" || that.userData.billingRegionId == null){ 
2295                                 
2296
2297
2298                    }).catch(function(err){ 
2299                        console.error("Error getting regionList: ", err); 
2300                    }); 
2301                }, 
2302                selectProgram: function(program){ 
2303                    var that = this; 
2304                     
2305                    console.log("select program with id " + program._id.$oid); 
2306                     
2307                    this.resetSelections(); 
2308                     
2309                    this.selectedProgram = program; 
2310                    if(typeof this.selectedProgram.basePrice!=="undefined" && this.selectedProgram.basePrice != ""){ 
2311                        this.programPrice = this.selectedProgram?.basePrice; 
2312                    }else{ 
2313                        this.programPrice = 0; 
2314
2315                     
2316                    this.programDiscount = 0; 
2317                    console.log("programPrice: " + this.programPrice); 
2318                     
2319                    this.selectedProgram?.purchaseBeforeDiscount.forEach(function(sconto){ 
2320                        if(that.isDiscountValid(sconto) && sconto.discount != 0){ 
2321                            that.programDiscount = Number(sconto.discount); 
2322
2323                    }); 
2324                     
2325                    this.setMandatoryServices(); 
2326                     
2327                    setTimeout(function(){ 
2328                        console.log("updating"); 
2329                        that.$forceUpdate(); 
2330                    }, 250); 
2331                }, 
2332                getPaymentLabel: function(type){ 
2333                    if(type == "bonifico") 
2334                        return "Bonifico bancario"; 
2335                    if(type == "cartaCredito") 
2336                        return "Carta di credito"; 
2337                    if(type == "cartaCreditoAcconto") 
2338                        return "Acconto con carta di credito"; 
2339                }, 
2340                resetSelections: function(){ 
2341                    this.selectedAccomodation = null; 
2342                    this.selectedAirport = null; 
2343                    this.selectedArea = null; 
2344                    this.selectedPayment = null; 
2345                    this.selectedProgram = null; 
2346                    this.selectedSchool = null; 
2347                    this.selectedServices = []; 
2348                    this.paymentLink = "#"; 
2349                    this.voucher = ""; 
2350                    this.programPrice = 0; 
2351                    this.currentStep = 1; 
2352                }, 
2353                select: function(name, obj){ 
2354                    if(name == "airport"){ 
2355                        this.selectedAirport = obj; 
2356
2357                    if(name == "accomodation"){ 
2358                        this.selectedAccomodation = obj; 
2359
2360                }, 
2361                checkFavourite: function(){ 
2362                    var that = this; 
2363                     
2364                    Liferay.Service('/destinazione.favorite/get-wish-list', { 
2365                        groupId: Liferay.ThemeDisplay.getScopeGroupId(), 
2366                        sessionId: String(Liferay.ThemeDisplay.getSessionId()), 
2367                        userId: String(Liferay.ThemeDisplay.getUserId()), 
2368                    }, function(res){ 
2369                        console.log("getWishList response: ", res); 
2370                        if(res.success){ 
2371                            res.data.forEach(function(obj){ 
2372                                if(obj.itemId == that.contentId){ 
2373                                    that.favourite = true; 
2374                                    that.oid = obj._id.$oid; 
2375
2376                            }); 
2377
2378                    }).catch(function(err){ 
2379                        console.error("Error getting wishlist: ", err); 
2380                    }); 
2381                }, 
2382                checkVoucher: function(){ 
2383                    var that = this, 
2384                        endPoint = "/servicefeed?p_p_id=Configurable&p_p_lifecycle=2&p_p_resource_id=json&_Configurable_jsonParams=", 
2385                        params = { 
2386                            "fn": "validate", 
2387                            "email": this.userMail, 
2388                            "articleId": this.contentId, 
2389                            "nomeTariffa": this.selectedProgram.nomeTariffa, 
2390                            "vc": this.voucher, 
2391                            "packageId" : this.selectedProgram._id.$oid, 
2392                            "amount": this.totalPrice * 100 
2393
2394                     
2395                    axios.get(endPoint + JSON.stringify(params)).then(function(res){ 
2396                        if(res.data.result.data.valid && res.data.result.data.order.total_discount_amount){ 
2397                            console.log("Voucher res: ", res.data.result.data); 
2398                            that.voucherValid = true; 
2399                            that.voucherDiscount = res.data.result.data.order.total_discount_amount / 100; 
2400                        }else{ 
2401                            console.error("Something went wrong with voucher: ", res.data); 
2402                            alert("Voucher non valido"); 
2403
2404                    }).catch(function(err){ 
2405                        console.error("Error validating voucher: ", err); 
2406                    }); 
2407                }, 
2408                createOrderAndPaymentUrl: function(){ 
2409                    var that = this, 
2410                        orderPrice = 0, 
2411                        orderParams = { 
2412                            selectedProgram: this.selectedProgram, 
2413                            selectedArea: this.selectedArea, 
2414                            selectedSchool: this.selectedSchool, 
2415                            selectedAccomodation: this.selectedAccomodation, 
2416                            selectedAirport: this.selectedAirport, 
2417                            selectedServices: this.selectedServices, 
2418                            selectedPayment: this.selectedPayment, 
2419                            selectedDiscounts: this.selectedDiscounts, 
2420                            programPrice: this.programPrice, 
2421                            programDiscount: this.programDiscount, 
2422                            voucherDiscount: this.voucherDiscount, 
2423                            userData: this.userData 
2424                        }; 
2425/*                         
2426                    if(this.selectedPayment?.amount == 0 || this.selectedPayment?.amount === undefined){ 
2427                        orderPrice = this.totalPrice; 
2428                    }else{ 
2429                        orderPrice = this.selectedPayment?.amount; 
2430
2431*/ 
2432/*                    this.selectedPayment == "cartaCreditoAcconto" ? orderPrice = this.selectedProgram.depositAmount : orderPrice = this.totalPrice; */ 
2433                    orderPrice = this.selectedProgram.depositAmount; 
2434                    console.log(this.selectedPayment); 
2435                    console.log(orderPrice); 
2436                    console.log(this.totalPrice); 
2437                    console.log(JSON.stringify(orderParams)); 
2438                     
2439                    if(this.selectedPayment != "bonifico"){ 
2440                        var iframe = window.open("/", "_blank"); 
2441
2442                     
2443                    Liferay.Service("/destinazione.order/add-order-and-get-payment-url", { 
2444                        groupId: this.groupId, 
2445                        userId: this.userId, 
2446                        itemGroupId: Liferay.ThemeDisplay.getScopeGroupId(), 
2447                        itemId: this.contentId, 
2448                        totalPrice: this.totalPriceWithVoucher, 
2449                        params: JSON.stringify(orderParams), 
2450                        currency: "EUR", 
2451                        priceToPay: orderPrice, 
2452                        userEmail: this.userMail, 
2453                        languageId: "ITA", 
2454                        description: this.name, 
2455                        session_id: String(Liferay.ThemeDisplay.getSessionId()), 
2456                        cart_id: "12", 
2457                        baseUrl: Liferay.ThemeDisplay.getURLHome().split("/web/")[0], 
2458                        locsz: "" 
2459                    }, function(res){ 
2460                        console.log("add order and get payment url res: ", res); 
2461                         
2462                        // Sezione redemption voucher 
2463                        if(that.voucherValid){ 
2464                            var endPoint = "/servicefeed?p_p_id=Configurable&p_p_lifecycle=2&p_p_resource_id=json&_Configurable_jsonParams=", 
2465                                params = { 
2466                                    "fn": "redemption", 
2467                                    "email": that.userMail, 
2468                                    "articleId": that.contentId, 
2469                                    "nomeTariffa": that.selectedProgram.nomeTariffa, 
2470                                    "vc": that.voucher, 
2471                                    "packageId" : that.selectedProgram._id.$oid, 
2472                                    "amount": that.totalPrice * 100 
2473
2474                                 
2475                            axios.get(endPoint + JSON.stringify(params)).then(function(vRes){ 
2476                                console.log("vRes is ", vRes); 
2477                            }).catch(function(vErr){ 
2478                                 console.error("Error during voucher redemption: ", vErr); 
2479                            }); 
2480
2481                         
2482                        if(res.success){ 
2483                            if(that.selectedPayment != "bonifico"){ 
2484                                console.log("redirecting..."); 
2485                                iframe.location = res.data.url; 
2486                                that.closeParentModal("#pay-modal"); 
2487                            }else{ 
2488                                that.currentStep++; 
2489                                console.log("ordine immesso con bonifico, non ridireziono l'utente"); 
2490
2491                             
2492                            that.orderResult = "Ordine inserito con successo"; 
2493                        }else{ 
2494                            that.orderResult = "C'è stato un problema con l'inserimento dell'ordine. Contattare Zainetto Verde se il problema persiste."; 
2495
2496                    }).catch(function(err){ 
2497                        console.error("Error: ", err); 
2498                         
2499                        that.orderResult = "C'è stato un problema con l'inserimento dell'ordine. Contattare Zainetto Verde se il problema persiste."; 
2500                    }); 
2501                }, 
2502                setFavourite: function(){ 
2503                    var that = this; 
2504                     
2505                    if(this.signedIn){ 
2506                        Liferay.Service('/destinazione.favorite/add-to-wish-list', { 
2507                            groupId: Liferay.ThemeDisplay.getScopeGroupId(), 
2508                            sessionId: String(Liferay.ThemeDisplay.getSessionId()), 
2509                            userId: String(Liferay.ThemeDisplay.getUserId()), 
2510                            itemGroupId: 11, 
2511                            itemId: this.contentId 
2512                        }, function(res){ 
2513                            if(res.success){ 
2514                                console.log("addToWishList response: ", res); 
2515                                that.favourite = true; 
2516
2517                        }).catch(function(err){ 
2518                            console.error("Error adding to wishlist: ", err); 
2519                        }); 
2520                    }else{ 
2521                        this.redirect("login?contentId=${contentId}"); 
2522
2523                }, 
2524                removeFavourite: function(){ 
2525                    var that = this; 
2526                     
2527                    Liferay.Service('/destinazione.favorite/delete-item-from-wish-list', { 
2528                        oid: this.oid 
2529                    }, function(res) { 
2530                        console.log("deleteFromWishList response: ", res); 
2531                        that.favourite = false; 
2532                        that.checkFavourite(); 
2533                    }).catch(function(err){ 
2534                        console.error("Error removing from wishlist: ", err); 
2535                    }); 
2536                }, 
2537                selectDate: function(value){ 
2538                    var that = this; 
2539                     
2540                    console.log("Data scelta: ", value) 
2541                    this.calendar.dataSelected = value.date; 
2542                     
2543                    this.programs.forEach(function(program){ 
2544                        if(moment(value.date).isBetween(program.startDate, program.endDate)){ 
2545                            console.log(value.date + " è compresa"); 
2546                            program.show = true; 
2547
2548                    }); 
2549                }, 
2550                resetDates: function(){ 
2551                    this.calendar.dataSelected = null; 
2552                    this.programs.forEach(function(program){ 
2553                        program.show = true; 
2554                    }); 
2555                }, 
2556                showResults: function(data){ 
2557                    var that = this; 
2558                     
2559                    this.programs.forEach(function(program){ 
2560                        program.show = false; 
2561                         
2562                        if(moment(data).isBetween(program.startDate, program.endDate)){ 
2563                            console.log(data + " è compresa"); 
2564                            program.show = true; 
2565
2566                    }); 
2567                }, 
2568                setMandatoryServices: function(){ 
2569                    var that = this; 
2570                     
2571                    this.selectedServices = []; 
2572                     
2573                    this.selectedProgram?.servicesAndPrices?.forEach(function(service){ 
2574                        if(service.mandatory){ 
2575                            that.selectedServices.push(service); 
2576
2577                    }); 
2578                }, 
2579                setRequestMessage: function(){ 
2580                    sessionStorage.removeItem("requestMesaage"); 
2581                    console.log("removed old requestMesaage"); 
2582                     
2583                    var requestMessage = { 
2584                        message: "testo preventivo da mostrare" 
2585
2586                     
2587                    sessionStorage.setItem("requestMesaage", JSON.stringify(requestMesaage)); 
2588                    console.log("requestMesaage saved"); 
2589                }, 
2590                setProgressData: function(){ 
2591                    var that = this, 
2592                        depositAmount = ""; 
2593                     
2594                    localStorage.removeItem("progressProgramData"); 
2595                    console.log("removed old progressProgramData data"); 
2596                     
2597                    if(this.selectedPayment == "cartaCreditoAcconto"){ 
2598                        depositAmount = this.selectedProgram.depositAmount; 
2599
2600                     
2601                    var progressData = { 
2602                        url: window.top.location.href, 
2603                        docTitle: "${docTitle?js_string}", 
2604                        selectedProgram: this.selectedProgram, 
2605                        selectedArea: this.selectedArea, 
2606                        selectedSchool: this.selectedSchool, 
2607                        selectedServices: this.selectedServices, 
2608                        selectedDiscounts: this.selectedDiscounts, 
2609                        selectedAirport: this.selectedAirport, 
2610                        selectedPayment: this.selectedPayment, 
2611                        programPrice: this.programPrice, 
2612                        programDiscount: this.programDiscount, 
2613                        userData: this.userData, 
2614                        userMail: this.userMail, 
2615                        totalPrice: this.totalPrice, 
2616                        depositAmount: depositAmount 
2617
2618                     
2619                    progressData.selectedServices.forEach(function(serv){ 
2620                        serv.label = that.labels[serv.service]; 
2621                    }); 
2622                    progressData.selectedDiscounts.forEach(function(dsc){ 
2623                        dsc.label = that.labels[dsc.description]; 
2624                    }); 
2625                     
2626                    progressData.selectedAirport.label = this.labels[progressData.selectedAirport.airport]; 
2627                     
2628                    localStorage.setItem("progressProgramData", JSON.stringify(progressData)); 
2629                    console.log("progressProgramData saved"); 
2630                }, 
2631                getProgressData: function(){ 
2632                    if(localStorage.getItem("progressProgramData") !== null){ 
2633                        console.log("previous data exists, getting it"); 
2634                         
2635                        if(JSON.parse(localStorage.getItem("progressProgramData")).url == window.top.location.href){ 
2636                            console.log("previous data is form actual page, restoring it..."); 
2637                             
2638                            var previousData = JSON.parse(localStorage.getItem("progressProgramData")); 
2639                             
2640                            this.selectedProgram=previousData.selectedProgram, 
2641                            this.selectedArea=previousData.selectedArea, 
2642                            this.selectedSchool=previousData.selectedSchool, 
2643                            this.selectedAirport = previousData.selectedAirport; 
2644                            this.selectedProgram = previousData.selectedProgram; 
2645                            this.selectedPayment = previousData.selectedPayment; 
2646                            this.selectedServices = previousData.selectedServices; 
2647                            this.selectedDiscounts = previousData.selectedDiscounts; 
2648                            this.programPrice = previousData.programPrice; 
2649                            this.programDiscount = previousData.programDiscount; 
2650                            this.userData=previousData.userData; 
2651                            this.userMail=previousData.userMail; 
2652                             
2653                            console.log("previous data restored"); 
2654                             
2655                            localStorage.removeItem("progressProgramData"); 
2656                            this.currentStep = 7; 
2657                            this.openParentModal("#pay-modal"); 
2658                        }else{ 
2659                            console.log("progressProgramData is from a different page"); 
2660
2661                    }else{ 
2662                        console.log("no previous data exists"); 
2663
2664                }, 
2665                isDiscountValid: function(sconto){ 
2666                    var today = new Date(), 
2667                        valid = false; 
2668                     
2669                    if(moment(today).isSameOrAfter(sconto.date) && moment(today).isSameOrBefore(sconto.dateEnd)){ 
2670                        valid = true; 
2671
2672                     
2673                    return valid; 
2674
2675
2676        }); 
2677    }); 
2678</script>