Si è verificato un errore nell'elaborarazione del modello.
For "." left-hand operand: Expected a hash, but this has evaluated to a sequence (wrapper: f.t.SimpleSequence):
==> programs  [in template "383767#383802#1838824" at line 1450, column 29]

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${programs.getJSONObject("data").getJ...  [in template "383767#383802#1838824" at line 1450, 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!=''">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!=''" class="text-dark text-right">A partire da</p> 
203                                                            <p  v-if="selectedProgram.basePrice!=''" 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">Scegli l'area</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 l'area 
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                                            Area 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 la scuola o distretto 
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                                            Scuola o distretto scelto:  
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                                                    Area e scuola o distretto: 
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                                                <div class="card void m-0 p-0"> 
717                                                    <div class="card-row"> 
718                                                        <div class="autofit-col autofit-col-expand my-auto"> 
719                                                            <section class="autofit-section"> 
720                                                                <div class="form-group"> 
721                                                                	<div class="input-group"> 
722                                                                		<div class="input-group-item input-group-prepend"> 
723                                                                			<input type="text" v-model="voucher" class="form-control" placeholder="Inserisci il codice" /> 
724                                                                		</div> 
725                                                                		<span class="input-group-append input-group-item input-group-item-shrink"> 
726                                                                			<button @click="" class="btn btn-secondary">Verifica</button> 
727                                                                		</span> 
728                                                                	</div> 
729                                                                </div> 
730                                                            </section> 
731                                                        </div> 
732                                                    </div> 
733                                                </div> 
734                                            </div> 
735                                        </div> 
736                                    </div> 
737                                    <div class="col-12 col-lg-6 order-1 order-lg-2"> 
738                                        <div class="panel panel-secondary"> 
739                                            <div class="panel-body"> 
740                                                <div class="card void my-3"> 
741                                                    <div class="d-flex justify-content-center"> 
742                                                        <div class="d-flex flex-column text-center mx-auto"> 
743                                        				    <span class="sticker sticker-xl sticker-person rounded-circle mb-4"> 
744                                                            	<span class="sticker-overlay"> 
745                                                            		<img :src="image" class="img-fluid" :alt="name"> 
746                                                            	</span> 
747                                                            </span> 
748                                                             
749                                                            <#-- 
750                                                            <button class="btn btn-outline-dark px-3" @click="favourite ? removeFavourite() : setFavourite()" v-if="signedIn"> 
751                                                                {{ favourite ? 'Salvato' : 'Salva' }} 
752                                                                 
753                                                                <i class="fa-heart fa-lg ml-3" :class="favourite ? 'fas' : 'far'"></i> 
754                                                            </button> 
755                                                            --> 
756                                                        </div> 
757                                                    </div> 
758                                                </div> 
759                                                 
760                                                <div class="card void my-3"> 
761                                                    <div class="card-row flex-column"> 
762                                                        <div class="autofit-col autofit-col-expand"> 
763                                                            <section class="autofit-section"> 
764                                                                <p class="text-dark text-center my-4"> 
765                                                                    Totale importo: 
766                                                                    <span class="display-5 ml-3">{{ totalPrice | money }}</span> 
767                                                                </p> 
768                                                                <p class="text-dark text-center my-4" v-if="selectedPayment == 'cartaCreditoAcconto'"> 
769                                                                    Acconto da pagare: 
770                                                                    <span class="display-5 ml-3">{{ selectedProgram.depositAmount | money }}</span> 
771                                                                </p> 
772                                                            </section> 
773                                                        </div> 
774                                                        <div class="autofit-col autofit-col-expand"> 
775                                                            <section class="autofit-section"> 
776                                                                <button @click="setProgressData();openParentModal('#requestinfo-payment-modal')" class="btn btn-gradient btn-block py-2 mb-3"> 
777                                                                    Richiedi informazioni 
778                                                                </button> 
779                                                                 
780                                                                <button v-if="signedIn" @click="gotoStep('next')" class="btn btn-gradient btn-block py-2"> 
781                                                                    Procedi al pagamento 
782                                                                </button> 
783                                                                <button v-else @click="setProgressData();redirectParent('/login')" class="btn btn-outline-dark btn-block py-2"> 
784                                                                    Accedi per procedere al pagamento 
785                                                                </button> 
786                                                            </section> 
787                                                        </div> 
788                                                    </div> 
789                                                </div> 
790                                            </div> 
791                                        </div> 
792                                    </div> 
793                                </div> 
794                                 
795                                <div class="row"> 
796                                    <div class="col-12"> 
797                                        <div class="card void mt-3 mt-lg-5 mb-0"> 
798                                            <div class="card-row"> 
799                                                <div class="autofit-col autofit-col-expand"> 
800                                                    <section class="autofit-section text-left"> 
801                                                        <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
802                                                            Indietro 
803                                                        </button> 
804                                                    </section> 
805                                                </div> 
806                                            </div> 
807                                        </div> 
808                                    </div> 
809                                </div> 
810                            </div> 
811                        </div> 
812                         
813                        <#-- FORM DATI ESTESO --> 
814                        <div class="tab-pane fade" :class="{'show active': currentStep == 8}" role="tabpanel"> 
815                            <div class="row justify-content-center"> 
816                                <div class="d-none d-lg-block col-12 mb-4"> 
817                                    <p class="text-dark display-5 font-weight-light">Completa il modulo di iscrizione</p> 
818                                </div> 
819                                 
820                                <div class="col-12 col-lg-9" v-if="selectedProgram != null && userData != null && signedIn"> 
821                                    <div class="sheet sheet-lg"> 
822                                        <div class="sheet-header"> 
823                                    		<div class="sheet-text"> 
824                                    		    <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 
825                                    		</div> 
826                                    	</div> 
827                                    	<div class="sheet-section"> 
828                                    	    <p class="sheet-title">Dati del genitore o del tutore</p> 
829                                    	     
830                                    		<div class="form-group-autofit"> 
831                                    			<div class="form-group-item"> 
832                                    				<label for="tutoreFirstName">Nome</label> 
833                                    				<input class="form-control" id="tutoreFirstName" v-model="userData.tutore.firstName" type="text"/> 
834                                    			</div> 
835                                    			<div class="form-group-item"> 
836                                    				<label for="tutoreLastName">Cognome</label> 
837                                    				<input class="form-control" id="tutoreLastName" v-model="userData.tutore.lastName" type="text"/> 
838                                    			</div> 
839                                    		</div> 
840                                    		<div class="form-group-autofit"> 
841                                    			<div class="form-group-item"> 
842                                    				<label for="tutoreAddress">Indirizzo</label> 
843                                    				<input class="form-control" id="tutoreAddress" v-model="userData.tutore.address" type="text"/> 
844                                    			</div> 
845                                    		</div> 
846                                    		<div class="form-group-autofit"> 
847                                    			<div class="form-group-item"> 
848                                    				<label for="tutoreCitta">Città</label> 
849                                    				<input class="form-control" id="tutoreCitta" v-model="userData.tutore.citta" type="text"/> 
850                                    			</div> 
851                                    			<div class="form-group-item"> 
852                                    				<label for="tutoreCap">CAP</label> 
853                                    				<input class="form-control" id="tutoreCap" v-model="userData.tutore.cap" type="text"/> 
854                                    			</div> 
855                                    			<div class="form-group-item"> 
856                                    				<label for="tutoreProvincia">Provincia</label> 
857                                    				<input class="form-control" id="tutoreProvincia" v-model="userData.tutore.provincia" type="text"/> 
858                                    			</div> 
859                                    		</div> 
860                                    		<div class="form-group-autofit"> 
861                                    			<div class="form-group-item"> 
862                                    				<label for="tutoreCellulare">Cellulare</label> 
863                                    				<input class="form-control" id="tutoreCellulare" v-model="userData.tutore.cellulare" type="text"/> 
864                                    			</div> 
865                                    			<div class="form-group-item"> 
866                                    				<label for="tutoreEmail">Email</label> 
867                                    				<input class="form-control" id="tutoreEmail" v-model="userData.tutore.email" type="email"/> 
868                                    			</div> 
869                                    		</div> 
870                                    		<div class="form-group-autofit"> 
871                                    			<div class="form-group-item"> 
872                                    				<label for="tutoreTelefono">Telefono casa/ufficio</label> 
873                                    				<input class="form-control" id="tutoreTelefono" v-model="userData.tutore.telefono" type="text"/> 
874                                    			</div> 
875                                    			<div class="form-group-item"> 
876                                    				<label for="tutoreCodiceFiscale">Codice fiscale</label> 
877                                    				<input class="form-control" id="tutoreCodiceFiscale" v-model="userData.tutore.codiceFiscale" type="text"/> 
878                                    			</div> 
879                                    		</div> 
880                                    		 
881                                    		<div class="form-group-autofit"> 
882                                    			<div class="form-group-item"> 
883                                    				<label for="tutore2Cellulare">Cellulare secondo genitore</label> 
884                                    				<input class="form-control" id="tutore2Cellulare" v-model="userData.tutore2.cellulare" type="text"/> 
885                                    			</div> 
886                                    			<div class="form-group-item"> 
887                                    				<label for="tutore2Email">Email secondo genitore</label> 
888                                    				<input class="form-control" id="tutore2Email" v-model="userData.tutore2.email" type="email"/> 
889                                    			</div> 
890                                    		</div> 
891                                    		<div class="form-group-autofit"> 
892                                    			<div class="form-group-item"> 
893                                    				<label for="tutore2Telefono">Telefono casa/ufficio secondo genitore</label> 
894                                    				<input class="form-control" id="tutore2Telefono" v-model="userData.tutore2.telefono" type="text"/> 
895                                    			</div> 
896                                    		</div> 
897                                    	</div> 
898                                    	<div class="sheet-section"> 
899                                    	    <p class="sheet-title">Dati dello studente</p> 
900                                    	     
901                                    		<div class="form-group-autofit"> 
902                                    			<div class="form-group-item"> 
903                                    				<label for="firstName">Nome</label> 
904                                    				<input class="form-control" id="firstName" v-model="userData.firstName" type="text"/> 
905                                    			</div> 
906                                    			<div class="form-group-item"> 
907                                    				<label for="lastName">Cognome</label> 
908                                    				<input class="form-control" id="lastName" v-model="userData.lastName" type="text"/> 
909                                    			</div> 
910                                    		</div> 
911                                    		<div class="form-group-autofit"> 
912                                    			<div class="form-group-item"> 
913                                    				<label for="birthPlace">Nato a</label> 
914                                    				<input class="form-control" id="birthPlace" v-model="userData.birthPlace" type="text"/> 
915                                    			</div> 
916                                    			<div class="form-group-item"> 
917                                    				<label for="provincia">Provincia</label> 
918                                    				<input class="form-control" id="provincia" v-model="userData.provincia" type="text"/> 
919                                    			</div> 
920                                    			<div class="form-group-item"> 
921                                    				<label for="birthday">Il</label> 
922                                    				<input class="form-control" id="birthday" v-model="userData.birthday" type="text"/> 
923                                    			</div> 
924                                    			<div class="form-group-item"> 
925                                    				<label>Sesso</label> 
926                                    				<div> 
927                                        				<div class="custom-control custom-radio custom-control-inline"> 
928                                                        	<label> 
929                                                        		<input class="custom-control-input" name="gender" type="radio" value="male" v-model="userData.gender"/> 
930                                                        		<span class="custom-control-label"> 
931                                                        			<span class="custom-control-label-text">M</span> 
932                                                        		</span> 
933                                                        	</label> 
934                                                        </div> 
935                                                        <div class="custom-control custom-radio custom-control-inline"> 
936                                                        	<label> 
937                                                        		<input class="custom-control-input" name="gender" type="radio" value="female" v-model="userData.gender"/> 
938                                                        		<span class="custom-control-label"> 
939                                                        			<span class="custom-control-label-text">F</span> 
940                                                        		</span> 
941                                                        	</label> 
942                                                        </div> 
943                                                    </div> 
944                                    			</div> 
945                                    		</div> 
946                                    		<div class="form-group-autofit"> 
947                                    			<div class="form-group-item"> 
948                                    				<label for="address">Indirizzo</label> 
949                                    				<input class="form-control" id="address" v-model="userData.billingStreetAddress" type="text"/> 
950                                    			</div> 
951                                    		</div> 
952                                    		<div class="form-group-autofit"> 
953                                    			<div class="form-group-item"> 
954                                    				<label for="citta">Città</label> 
955                                    				<input class="form-control" id="citta" v-model="userData.billingCity" type="text"/> 
956                                    			</div> 
957                                    			<div class="form-group-item"> 
958                                    				<label for="cap">CAP</label> 
959                                    				<input class="form-control" id="cap" v-model="userData.billingPostalCode" type="text"/> 
960                                    			</div> 
961                                    			<div class="form-group-item"> 
962                                    				<label for="provincia">Provincia</label> 
963                                    				<input class="form-control" id="provincia" v-model="userData.billingRegionCode" type="text"/> 
964                                    			</div> 
965                                    		</div> 
966                                    		<div class="form-group-autofit"> 
967                                    			<div class="form-group-item"> 
968                                    				<label for="cellulare">Cellulare</label> 
969                                    				<input class="form-control" id="cellulare" v-model="userData.phone" type="text"/> 
970                                    			</div> 
971                                    			<div class="form-group-item"> 
972                                    				<label for="email">Email</label> 
973                                    				<input class="form-control" id="email" v-model="userMail" type="email"/> 
974                                    			</div> 
975                                    		</div> 
976                                    		<div class="form-group-autofit"> 
977                                    			<div class="form-group-item"> 
978                                    				<label for="nazionalita">Nazionalità</label> 
979                                    				<input class="form-control" id="nazionalita" v-model="userData.nazionalita" type="text"/> 
980                                    			</div> 
981                                    			<div class="form-group-item"> 
982                                    				<label for="codiceFiscale">Codice fiscale</label> 
983                                    				<input class="form-control" id="codiceFiscale" v-model="userData.fiscalCode" type="text"/> 
984                                    			</div> 
985                                    		</div> 
986                                    		<div class="form-group-autofit"> 
987                                    			<div class="form-group-item"> 
988                                    				<label for="tipoDocumento">Tipo documento valido per l'espatrio</label> 
989                                    				<input class="form-control" id="tipoDocumento" v-model="userData.tipoDocumento" type="text"/> 
990                                    			</div> 
991                                    			<div class="form-group-item"> 
992                                    				<label for="numeroDocumento">Numero</label> 
993                                    				<input class="form-control" id="numeroDocumento" v-model="userData.numeroDocumento" type="text"/> 
994                                    			</div> 
995                                    		</div> 
996                                    		<div class="form-group-autofit"> 
997                                    			<div class="form-group-item"> 
998                                    				<label for="enteRilascioDocumento">Rilasciato da</label> 
999                                    				<input class="form-control" id="enteRilascioDocumento" v-model="userData.enteRilascioDocumento" type="text"/> 
1000                                    			</div> 
1001                                    			<div class="form-group-item"> 
1002                                    				<label for="paeseEmissioneDocumento">Paese di emissione</label> 
1003                                    				<input class="form-control" id="paeseEmissioneDocumento" v-model="userData.paeseEmissioneDocumento" type="text"/> 
1004                                    			</div> 
1005                                    		</div> 
1006                                    		<div class="form-group-autofit"> 
1007                                    			<div class="form-group-item"> 
1008                                    				<label for="dataRilascioDocumento">Data rilascio</label> 
1009                                    				<input class="form-control" id="dataRilascioDocumento" v-model="userData.dataRilascioDocumento" type="text"/> 
1010                                    			</div> 
1011                                    			<div class="form-group-item"> 
1012                                    				<label for="dataScadenzaDocumento">Data di scadenza</label> 
1013                                    				<input class="form-control" id="dataScadenzaDocumento" v-model="userData.dataScadenzaDocumento" type="text"/> 
1014                                    			</div> 
1015                                    		</div> 
1016                                    		<div class="form-group-autofit"> 
1017                                    			<div class="form-group-item"> 
1018                                    				<label for="documentoViaggio">Documento necessario per poter effettuare il viaggio</label> 
1019                                    				<input class="form-control" id="documentoViaggio" v-model="userData.documentoViaggio" type="text"/> 
1020                                    			</div> 
1021                                    		</div> 
1022                                    		<div class="form-group-autofit"> 
1023                                    			<div class="form-group-item"> 
1024                                    				<label>Fumatore</label> 
1025                                    				<div> 
1026                                        				<div class="custom-control custom-radio custom-control-inline"> 
1027                                                        	<label> 
1028                                                        		<input class="custom-control-input" name="fumatore" type="radio" value="true" v-model="userData.fumatore"/> 
1029                                                        		<span class="custom-control-label"> 
1030                                                        			<span class="custom-control-label-text">Si</span> 
1031                                                        		</span> 
1032                                                        	</label> 
1033                                                        </div> 
1034                                                        <div class="custom-control custom-radio custom-control-inline"> 
1035                                                        	<label> 
1036                                                        		<input class="custom-control-input" name="fumatore" type="radio" value="false" v-model="userData.fumatore"/> 
1037                                                        		<span class="custom-control-label"> 
1038                                                        			<span class="custom-control-label-text">No</span> 
1039                                                        		</span> 
1040                                                        	</label> 
1041                                                        </div> 
1042                                                    </div> 
1043                                    			</div> 
1044                                    		</div> 
1045                                    		<div class="form-group-autofit"> 
1046                                    			<div class="form-group-item"> 
1047                                    				<label>Problemi di salute dello studente da segnalare (allergie/intolleranze alimentari o disturbi di altro genere)</label> 
1048                                    				<div class="custom-control custom-radio"> 
1049                                                    	<label> 
1050                                                    		<input class="custom-control-input" name="problemiSalute" type="radio" value="true" v-model="userData.problemiSalute"/> 
1051                                                    		<span class="custom-control-label"> 
1052                                                    			<span class="custom-control-label-text">Si, come da certificato medico che sarà inviato</span> 
1053                                                    		</span> 
1054                                                    	</label> 
1055                                                    </div> 
1056                                                    <div class="custom-control custom-radio"> 
1057                                                    	<label> 
1058                                                    		<input class="custom-control-input" name="problemiSalute" type="radio" value="false" v-model="userData.problemiSalute"/> 
1059                                                    		<span class="custom-control-label"> 
1060                                                    			<span class="custom-control-label-text">No</span> 
1061                                                    		</span> 
1062                                                    	</label> 
1063                                                    </div> 
1064                                    			</div> 
1065                                    		</div> 
1066                                    	</div> 
1067                                    	 
1068                                    	<div class="sheet-section"> 
1069                                    		<p class="sheet-title">Dati della scuola frequentata dal/dalla proprio/a figlio/a</p> 
1070                                    	     
1071                                    		<div class="form-group-autofit"> 
1072                                    			<div class="form-group-item"> 
1073                                    				<label for="nomeScuola">Nome scuola</label> 
1074                                    				<input class="form-control" id="nomeScuola" v-model="userData.nomeScuola" type="text"/> 
1075                                    			</div> 
1076                                    			<div class="form-group-item"> 
1077                                    				<label for="codiceMeccanografico">Codice meccanografico</label> 
1078                                    				<input class="form-control" id="codiceMeccanografico" v-model="userData.codiceMeccanografico" type="text"/> 
1079                                    			</div> 
1080                                    		</div> 
1081                                    		<div class="form-group-autofit"> 
1082                                    			<div class="form-group-item"> 
1083                                    				<label for="indirizzoScuola">Indirizzo</label> 
1084                                    				<input class="form-control" id="indirizzoScuola" v-model="userData.indirizzoScuola" type="text"/> 
1085                                    			</div> 
1086                                    		</div> 
1087                                    		<div class="form-group-autofit"> 
1088                                    			<div class="form-group-item"> 
1089                                    				<label for="cittaScuola">Città</label> 
1090                                    				<input class="form-control" id="cittaScuola" v-model="userData.cittaScuola" type="text"/> 
1091                                    			</div> 
1092                                    			<div class="form-group-item"> 
1093                                    				<label for="provinciaScuola">Provincia</label> 
1094                                    				<input class="form-control" id="provinciaScuola" v-model="userData.provinciaScuola" type="text"/> 
1095                                    			</div> 
1096                                    		</div> 
1097                                    		<div class="form-group-autofit"> 
1098                                    			<div class="form-group-item"> 
1099                                    				<label for="telefonoScuola">Telefono</label> 
1100                                    				<input class="form-control" id="telefonoScuola" v-model="userData.telefonoScuola" type="text"/> 
1101                                    			</div> 
1102                                    			<div class="form-group-item"> 
1103                                    				<label for="emailScuola">Email</label> 
1104                                    				<input class="form-control" id="emailScuola" v-model="userData.emailScuola" type="email"/> 
1105                                    			</div> 
1106                                    		</div> 
1107                                    		<div class="form-group-autofit"> 
1108                                    			<div class="form-group-item"> 
1109                                    				<label for="nomeCognomeDirigenteScolastico">Nome e cognome del dirigente scolastico</label> 
1110                                    				<input class="form-control" id="nomeCognomeDirigenteScolastico" v-model="userData.nomeCognomeDirigenteScolastico" type="text"/> 
1111                                    			</div> 
1112                                    		</div> 
1113                                    		<div class="form-group-autofit"> 
1114                                    			<div class="form-group-item"> 
1115                                    				<label for="nomeCognomeTutorMobilta">Nome e cognome del tutor mobilità studentesca</label> 
1116                                    				<input class="form-control" id="nomeCognomeTutorMobilita" v-model="userData.nomeCognomeTutorMobilita" type="text"/> 
1117                                    			</div> 
1118                                    			<div class="form-group-item"> 
1119                                    				<label for="emailTutorMobilita">Email</label> 
1120                                    				<input class="form-control" id="emailTutorMobilita" v-model="userData.emailTutorMobilita" type="email"/> 
1121                                    			</div> 
1122                                    		</div> 
1123                                    		<div class="form-group-autofit"> 
1124                                    			<div class="form-group-item"> 
1125                                    				<label for="nomeCognomeDocenteLinguaStraniera">Nome e cognome del docente di lingua straniera</label> 
1126                                    				<input class="form-control" id="nomeCognomeDocenteLinguaStraniera" v-model="userData.nomeCognomeDocenteLinguaStraniera" type="text"/> 
1127                                    			</div> 
1128                                    			<div class="form-group-item"> 
1129                                    				<label for="emailDocenteLinguaStraniera">Email</label> 
1130                                    				<input class="form-control" id="emailDocenteLinguaStraniera" v-model="userData.emailDocenteLinguaStraniera" type="email"/> 
1131                                    			</div> 
1132                                    		</div> 
1133                                    	</div> 
1134                                    </div> 
1135                                </div> 
1136                                <div class="col-12" v-else> 
1137                                    <p class="text-dark display-5 font-weight-light">Per continuare, seleziona un periodo dalla prima pagina.</p> 
1138                                </div> 
1139                                 
1140                                <div class="col-12"> 
1141                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
1142                                        <div class="card-row"> 
1143                                            <div class="autofit-col autofit-col-expand"> 
1144                                                <section class="autofit-section text-left"> 
1145                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
1146                                                        Indietro 
1147                                                    </button> 
1148                                                </section> 
1149                                            </div> 
1150                                            <div class="autofit-col autofit-col-expand"> 
1151                                                <section class="autofit-section text-right"> 
1152                                                    <button @click="gotoStep('next')" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="!moduloValid"> 
1153                                                        Avanti 
1154                                                    </button> 
1155                                                </section> 
1156                                            </div> 
1157                                        </div> 
1158                                    </div> 
1159                                </div> 
1160                            </div> 
1161                        </div> 
1162                         
1163                        <#-- PAGAMENTO --> 
1164                        <div class="tab-pane fade" :class="{'show active': currentStep == 9}" v-if="signedIn" role="tabpanel"> 
1165                            <div class="row"> 
1166                                <div class="d-none d-lg-block col-12 mb-4"> 
1167                                    <p class="text-dark display-5 font-weight-light">Scegli il metodo di pagamento</p> 
1168                                </div> 
1169                                 
1170                                <div class="col-12 col-lg-7" v-if="selectedProgram != null"> 
1171                                    <ul class="list-group mb-lg-0"> 
1172                                    	<li v-for="(type, index) in selectedProgram.paymentType" :key="'type-' + index" class="list-group-item" v-if="type=='cartaCredito' || type == 'bonifico' || type =='cartaCreditoAcconto'"> 
1173                                    	    <div class="card-row flex-column flex-lg-row"> 
1174                                    	        <div class="autofit-col autofit-col-expand"> 
1175                                    	            <section class="autofit-section my-auto"> 
1176                                            			<div class="custom-control custom-radio"> 
1177                                            				<label> 
1178                                            				    <input class="custom-control-input" type="radio" name="paymentMethod" v-model="selectedPayment" :value="type" /> 
1179                                            					<span class="custom-control-label"> 
1180                                            					    <span class="custom-control-label-text"> 
1181                                            					        {{ getPaymentLabel(type) }} 
1182                                            					    </span> 
1183                                            					</span> 
1184                                            				</label> 
1185                                            			</div> 
1186                                            		</section> 
1187                                        		</div> 
1188                                        		<div class="autofit-col autofit-col-expand" v-if="type=='cartaCreditoAcconto' || type == 'bonifico' "> 
1189                                    				<section class="autofit-section my-auto"> 
1190                                    				    <p class="text-dark text-right h3 mb-0 mr-3">Acconto: {{ selectedProgram.depositAmount | money }}</p> 
1191                                    				</section> 
1192                                        		</div> 
1193                                        		<div class="autofit-col autofit-col-expand"> 
1194                                    				<section class="autofit-section text-right my-auto"> 
1195                                    				    <img src="${images_folder}/bonifico.png" height="60" alt="bonifico" v-if="type == 'bonifico'"> 
1196                                    				    <img src="${images_folder}/visa-mastercard.png" height="60" alt="visa-mastercard" v-if="type == 'cartaCredito'"> 
1197                                    				    <img src="${images_folder}/visa-mastercard.png" height="60" alt="visa-mastercard" v-if="type == 'cartaCreditoAcconto'"> 
1198                                    				</section> 
1199                                        		</div> 
1200                                    	    </div> 
1201                                    	     
1202                                    	    <p v-if="type == 'bonifico'" class="card-subtitle px-1"> 
1203                                    	        Intestato a Zainetto Verde srl - IBAN IT42L0100513700000000002639 
1204                                    	    </p> 
1205                                    	</li> 
1206                                    </ul> 
1207                                </div> 
1208                                <div class="col-12 col-lg-5"> 
1209                                    <div class="autofit-section"> 
1210                                        <div v-for="(attachment, index) in attachments" :key="'attachment-' + index" class="card-row mb-4 mb-lg-2"> 
1211                                            <div class="autofit-col autofit-col-expand"> 
1212                                                <section class="autofit-section"> 
1213                                                    <div class="custom-control custom-checkbox"> 
1214                                            			<label> 
1215                                            				<input v-model="policyContent['condition' + sum(index, 1)]" class="custom-control-input" type="checkbox"> 
1216                                            				<span class="custom-control-label"> 
1217                                            					<span class="custom-control-label-text"> 
1218                                            					    {{ attachment.title }} 
1219                                            					    <template v-if="attachment.mandatory">*</template> 
1220                                            					</span> 
1221                                            				</span> 
1222                                            			</label> 
1223                                            		</div> 
1224                                                </section> 
1225                                            </div> 
1226                                            <div class="autofit-col"> 
1227                                                <section class="autofit-section"> 
1228                                                    <a :href="attachment.file" class="text-aqua mb-0" download> 
1229                                                        Scarica il documento 
1230                                                        <i class="fas fa-download ml-1"></i> 
1231                                                    </a> 
1232                                                </section> 
1233                                            </div> 
1234                                        </div> 
1235                                    </div> 
1236                                     
1237                                    <p v-if="selectedProgram != null && orderResult != ''" class="h4">{{ orderResult }}</p> 
1238                                </div> 
1239                                 
1240                                <div class="col-12"> 
1241                                    <div class="card void mt-3 mt-lg-5 mb-0"> 
1242                                        <div class="card-row"> 
1243                                            <div class="autofit-col autofit-col-expand"> 
1244                                                <section class="autofit-section text-left"> 
1245                                                    <button @click="gotoStep('prev')" class="btn btn-outline-dark py-2 px-3 px-lg-4"> 
1246                                                        Indietro 
1247                                                    </button> 
1248                                                </section> 
1249                                            </div> 
1250                                            <div class="autofit-col autofit-col-expand"> 
1251                                                <section class="autofit-section text-right"> 
1252                                                    <button @click="createOrderAndPaymentUrl()" class="btn btn-gradient py-2 px-3 px-lg-4" :disabled="selectedPayment == null || !validPolicyContent"> 
1253                                                        Termina 
1254                                                    </button> 
1255                                                </section> 
1256                                            </div> 
1257                                        </div> 
1258                                    </div> 
1259                                </div> 
1260                            </div> 
1261                        </div> 
1262                         
1263                        <#-- RINGRAZIAMENTO --> 
1264                        <div class="tab-pane fade" :class="{'show active': currentStep == 10}" v-if="signedIn" role="tabpanel"> 
1265                            <div class="row"> 
1266                                <div class="d-none d-lg-block col-12 mb-4"> 
1267                                    <p class="text-dark display-5 font-weight-light">Grazie per la tua prenotazione</p> 
1268                                </div> 
1269                                 
1270                                <div class="col-12 col-lg-7"> 
1271                                    <p class="h4 text-dark font-weight-regular mt-5"> 
1272                                        Grazie per aver prenotato un programma Zainetto Verde!<br> 
1273                                        Ti è stata inviata una mail di riepilogo e potrai trovare il riepilogo del tuo acquisto anche nella sezione dei tuoi viaggi. 
1274                                    </p> 
1275                                </div> 
1276                                 
1277                                <div class="col-12 col-lg-5"> 
1278                                    <div class="d-flex h-100 align-items-end justify-content-center"> 
1279                                        <button @click="redirectParent('/i-miei-viaggi')" class="btn btn-gradient btn-lg mt-4 mt-lg-0">Vai ai tuoi viaggi</button> 
1280                                    </div> 
1281                                </div> 
1282                            </div> 
1283                        </div> 
1284                    </div> 
1285                </div> 
1286            </div> 
1287        </div> 
1288    </div> 
1289</#macro> 
1290 
1291<#assign 
1292    RILS = serviceLocator.findService("eu.suggesto.d40.builder.d40.service.RateItemLocalService") 
1293    DLAppLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppLocalService") 
1294    JALS = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") 
1295    suggestoMkspAPI = serviceLocator.findService("eu.suggesto.suggestogui.service.SuggestoGuiLocalService") 
1296    productServiceAPI = serviceLocator.findService("eu.suggesto.d40.builder.d40.service.ProductLocalService") 
1297    saxReaderUtil = staticUtil["com.liferay.portal.kernel.xml.SAXReaderUtil"] 
1298     
1299    images_folder = themeDisplay.getPathThemeImages() 
1300    icons_folder = images_folder + "/icons" 
1301    contentId = result.getRequestStringParameter("contentId") 
1302    defLocale = localeUtil.fromLanguageId("it_IT") 
1303    image = "https://via.placeholder.com/300" 
1304    dateSoggiorno = [] 
1305    programs = [] 
1306    name = "Placeholder" 
1307    prezzo_base = 0 
1308    sCatSistemazione = "" 
1309    gruppiDiMarketing=JSONFactoryUtil.createJSONArray() 
1310/> 
1311 
1312<#if contentId?has_content> 
1313    <#assign 
1314        programs = RILS.getRatesByItemId(groupId, "", groupId, contentId, "", 0, 10) 
1315        article = JALS.getArticle(themeDisplay.getSiteGroupId(), contentId) 
1316        docTitle=article.getTitle(defLocale) 
1317        document = saxReaderUtil.read(article.getContent()) 
1318        rootElement = document.getRootElement() 
1319        groupedCategories = suggestoMkspAPI.getGroupedArticleCategories(groupId, contentId, locale, defLocale) 
1320         
1321        xPathDate = saxReaderUtil.createXPath("dynamic-element[@name='data_inizio']") 
1322        xPathImage = saxReaderUtil.createXPath("dynamic-element[@name='anteprima']") 
1323        xPathName = saxReaderUtil.createXPath("dynamic-element[@name='nome_scuola']/dynamic-content[@language-id='" + themeDisplay.getLocale() + "']") 
1324        xPathPrezzo = saxReaderUtil.createXPath("dynamic-element[@name='prezzo_base']/dynamic-content[@language-id='" + themeDisplay.getLocale() + "']") 
1325        allegatiContent = [] 
1326        stringSelectorContent = "dynamic-element[@name='documentoContrattuale']" 
1327        xPathSelectorContent = saxReaderUtil.createXPath(stringSelectorContent) 
1328    /> 
1329    <#if xPathSelector.selectNodes(rootElement)??> 
1330        <#assign allegatiContent = xPathSelectorContent.selectNodes(rootElement)> 
1331    </#if> 
1332 
1333 
1334    <#if (groupedCategories.length() > 0) > 
1335        <#list 0..groupedCategories.length()-1 as i> 
1336            <#assign 
1337                gc = groupedCategories.getJSONObject(i) 
1338                gcCat = gc.getJSONArray("categories") 
1339                vacabularyName = gc.getString("vocabularyName") 
1340            /> 
1341             
1342            <#if vacabularyName == "Tipo di sistemazione"> 
1343                <#list 0..gcCat.length()-1 as y> 
1344                    <#assign 
1345                        sCat = gcCat.getJSONObject(y) 
1346                        sCatId = sCat.getString("categoryId") 
1347                        sCatSistemazione = sCat.getString("name") 
1348                        sCatIcon = sCat.getString("icon") 
1349                    /> 
1350                </#list> 
1351            </#if> 
1352            <#if vacabularyName == "Gruppi di Marketing"> 
1353                <#list 0..gcCat.length()-1 as y> 
1354                    <#assign 
1355                        z = gcCat.getJSONObject(y) 
1356                        a =gruppiDiMarketing.put(z.getString("name")) 
1357                    /> 
1358                </#list> 
1359            </#if> 
1360 
1361        </#list> 
1362    </#if> 
1363     
1364    <#if xPathDate.selectNodes(rootElement)??> 
1365        <#list xPathDate.selectNodes(rootElement) as node> 
1366            <#assign 
1367                dataInizio = node.selectSingleNode("dynamic-content[@language-id='" + themeDisplay.getLocale() + "']").getStringValue()?replace("-", "/") 
1368                dataFine = node.selectSingleNode("dynamic-element[@name='data_fine']/dynamic-content[@language-id='" + themeDisplay.getLocale() + "']").getStringValue()?replace("-", "/") 
1369                dateSoggiorno += [ 
1370
1371                        "dataInizio": "${dataInizio}", 
1372                        "dataFine": "${dataFine}" 
1373
1374
1375            /> 
1376        </#list> 
1377    </#if> 
1378     
1379    <#if xPathImage.selectSingleNode(rootElement)??> 
1380        <#compress> 
1381            <#assign tmpImage = xPathImage.selectSingleNode(rootElement).getStringValue()?trim> 
1382        </#compress> 
1383         
1384        <#if tmpImage?has_content> 
1385            <#assign 
1386                image = tmpImage 
1387                jsonField = jsonFactoryUtil.createJSONObject(image) 
1388                fileEntry = DLAppLocalService.getFileEntryByUuidAndGroupId(jsonField.uuid, groupId) 
1389                image = "/documents/" + jsonField.groupId + "/" + fileEntry.folderId + "/" + jsonField.title + "/" + jsonField.uuid 
1390            /> 
1391        </#if> 
1392    </#if> 
1393     
1394    <#if xPathName.selectSingleNode(rootElement)??> 
1395        <#assign name = xPathName.selectSingleNode(rootElement).getStringValue()?trim?capitalize> 
1396    </#if> 
1397     
1398    <#if xPathPrezzo.selectSingleNode(rootElement)??> 
1399        <#assign prezzo_base = xPathPrezzo.selectSingleNode(rootElement).getStringValue()?trim> 
1400    </#if> 
1401</#if> 
1402 
1403<@printContent /> 
1404 
1405<script src="https://s3-eu-west-1.amazonaws.com/mkspresstage.suggesto.eu/components/securityV2.js"></script> 
1406 
1407<script> 
1408    document.addEventListener("DOMContentLoaded", function (){ 
1409        Vue.filter("money", function(value){ 
1410            if(typeof value!="undefined" && value!="") 
1411            return parseFloat(value).toFixed(2).toString().replace(".", ",") + "€"; 
1412            else 
1413            return ""; 
1414        }); 
1415         
1416        var pay = new Vue({ 
1417            el: "#pay", 
1418            data: { 
1419                /* 
1420                isDev: Liferay.ThemeDisplay.getUserEmailAddress().includes("@suggesto") && !Liferay.ThemeDisplay.getUserEmailAddress().includes("studente"), 
1421                */ 
1422                 
1423                isDev: false, 
1424                loading: true, 
1425                favourite: false, 
1426                contentId: "${contentId}", 
1427                image: "${htmlUtil.escape(image)}", 
1428                currentStep: 1, 
1429                totalSteps: 0, 
1430                name: "${name}", 
1431                signedIn: Liferay.ThemeDisplay.isSignedIn(), 
1432                groupId: Liferay.ThemeDisplay.getScopeGroupId(), 
1433                userMail: Liferay.ThemeDisplay.getUserEmailAddress(), 
1434                defaultLanguage: "it", 
1435                defaultCountryId: "8", 
1436                programPrice: 0, 
1437                programDiscount: 0, 
1438                selectedProgram: null, 
1439                selectedAirport: null, 
1440                selectedAccomodation: null, 
1441                selectedServices: [], 
1442                selectedDiscounts: [], 
1443                selectedPayment: null, 
1444                selectedArea: null, 
1445                selectedSchool: null, 
1446                paymentLink: "#", 
1447                oid: "", 
1448                voucher: "", 
1449                searchTerm: "", 
1450                programs: ${programs.getJSONObject('data').getJSONArray('items')}, 
1451                attachments: [], 
1452                labels: {}, 
1453                policy: { 
1454                    <#list allegati as allegato> 
1455                        condition${allegato?counter}: false, 
1456                    </#list> 
1457                }, 
1458                policyContent: { 
1459                    <#list allegatiContent as allegato> 
1460                        conditionContent${allegato?counter}: false, 
1461                    </#list> 
1462                }, 
1463                countryList: [], 
1464                regionList: [], 
1465                userData: {}, 
1466                orderResult: "" 
1467            }, 
1468            created(){ 
1469                var that = this; 
1470                 
1471                moment.locale(navigator.language.split("-")[0]); 
1472                 
1473                window.addEventListener("keyup", function(e){  
1474                    if(e.which == 27){ 
1475                        that.closeParentModal("#pay-modal"); 
1476
1477                }); 
1478                 
1479/*                this.setAttachments(); */ 
1480                this.setAttachmentsContent();  
1481 
1482            }, 
1483            mounted(){ 
1484                window.addEventListener("message", this.getExternalData.bind(this)); 
1485                 
1486                if(this.signedIn){ 
1487                    this.userId = Liferay.ThemeDisplay.getUserId(); 
1488                    this.checkFavourite(); 
1489                    this.getUserData(); 
1490                     
1491                    this.totalSteps = 9; 
1492                }else{ 
1493                    this.userData.firstName = ""; 
1494                    this.userData.lastName = ""; 
1495                    this.userData.phone = ""; 
1496                    this.totalSteps = 8; 
1497
1498                 
1499                console.log("total steps: " + this.totalSteps); 
1500                 
1501                this.getVocabularyLabels(); 
1502                this.getProgressData(); 
1503 
1504                this.loading = false; 
1505            }, 
1506            computed: { 
1507                computedResults: function(){ 
1508                    var that = this, 
1509                        zones = []; 
1510                     
1511                    this.selectedProgram.statoZonaScuolaTree.forEach(function(zone){ 
1512                        if(that.selectedProgram.title.toLowerCase().includes("classic")){ 
1513                            if(zone.name?.toLowerCase().includes(that.searchTerm)){ 
1514                                zones.push(zone); 
1515
1516                        }else{ 
1517                            if(_.has(zone, "children") && zone.name?.toLowerCase().includes(that.searchTerm)){ 
1518                                zones.push(zone); 
1519
1520
1521                    }); 
1522                     
1523                    return zones; 
1524                }, 
1525                computedResultsOld: function(){ 
1526                    var that = this, 
1527                        areas = a = []; 
1528                         
1529                    console.log("Tree is ", this.selectedProgram?.statoZonaScuolaTree); 
1530                     
1531                    this.selectedProgram.statoZonaScuolaTree.forEach(function(zone){ 
1532                        if(_.has(zone, "children")){ //zone.hasOwnProperty(children) 
1533                            a = zone.children.filter(function(area){ 
1534                                return area?.name?.toLowerCase().includes(that.searchTerm);  
1535                            }); 
1536
1537                         
1538                        console.log("a is ", a); 
1539                         
1540                        a.forEach(function(z){ 
1541                            areas.push(z);  
1542                        }); 
1543                    }); 
1544                     
1545                    return areas; 
1546                }, 
1547                totalPrice: function(){ 
1548                    return this.selectedServices.reduce(function(total, item){ 
1549                        return Number(total) + Number(item.price); 
1550                    }, 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)); 
1551                }, 
1552                totalDiscounts: function(){ 
1553                    return this.selectedDiscounts.reduce(function(total, item){ 
1554                        return Number(total) + Number(item.discount); 
1555                    }, 0) 
1556                }, 
1557                validPolicy: function(){ 
1558                    var valid = false; 
1559                     
1560                    <#if ! allegati?has_content> 
1561                        valid=true; 
1562                    </#if> 
1563                     
1564                    if( 
1565                        <#list allegati as allegato> 
1566                            <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
1567                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
1568                            <#if xPathSelector.selectSingleNode(allegato)??> 
1569                                <#assign mandatory = xPathSelector.selectSingleNode(allegato).getData()> 
1570                            </#if> 
1571                             
1572                            <#if mandatory == "true">  
1573                                <#if !allegato?is_first> && </#if> 
1574                                this.policy.condition${allegato?counter} 
1575                            </#if> 
1576                        </#list> 
1577                    ){ 
1578                        valid = true; 
1579
1580                     
1581                    return valid; 
1582                }, 
1583                validPolicyContent: function(){ 
1584                    var valid = false; 
1585                     
1586                    if( 
1587                        <#assign listEmpty = "true"> 
1588                        <#list allegatiContent as allegato> 
1589                            <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
1590                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
1591                            <#assign mandatoryContent="false"> 
1592                            <#if xPathSelector.selectSingleNode(allegato)??> 
1593                                <#assign mandatoryContent = xPathSelector.selectSingleNode(allegato).getData()> 
1594                            </#if> 
1595                            <#if mandatoryContent == "true">  
1596                                <#if !allegato?is_first> && </#if> 
1597                                <#assign listEmpty="false"> 
1598                                this.policyContent.condition${allegato?counter} 
1599                            </#if> 
1600                        </#list> 
1601                        <#if listEmpty == "true"> 
1602                            false 
1603                        </#if> 
1604                    ){ 
1605                        valid = true; 
1606
1607                    return valid; 
1608                }, 
1609                minimumValid: function(){ 
1610                    var valid = true; 
1611                     
1612                    if(this.userData != null){ 
1613                        if(!this.userData.hasOwnProperty("firstName") || typeof this.userData["firstName"] !== "string" || this.userData["firstName"].length == 0){ 
1614                            valid = false; 
1615
1616                        if(!this.userData.hasOwnProperty("lastName") || typeof this.userData["lastName"] !== "string" || this.userData["lastName"].length == 0){ 
1617                            valid = false; 
1618
1619                        if(this.userMail == ""){ 
1620                            valid = false; 
1621
1622                    }else{ 
1623                        valid = false; 
1624
1625                         
1626                    return valid; 
1627                }, 
1628                moduloValid: function(){ 
1629                    var valid = true; 
1630                     
1631                    if(this.userData != null){ 
1632                        // Tutore/i 
1633                        if(_.has(this.userData, "tutore.firstName")){ 
1634                            if(typeof this.userData.tutore.firstName !== "string" || this.userData.tutore.firstName.length == 0){ 
1635                                valid = false 
1636
1637                        }else{ 
1638                            valid = false; 
1639
1640                         
1641                        if(_.has(this.userData, "tutore.lastName")){ 
1642                            if(typeof this.userData.tutore.lastName !== "string" || this.userData.tutore.lastName.length == 0){ 
1643                                valid = false 
1644
1645                        }else{ 
1646                            valid = false; 
1647
1648                         
1649                        if(_.has(this.userData, "tutore.address")){ 
1650                            if(typeof this.userData.tutore.address !== "string" || this.userData.tutore.address.length == 0){ 
1651                                valid = false 
1652
1653                        }else{ 
1654                            valid = false; 
1655
1656                         
1657                        if(_.has(this.userData, "tutore.citta")){ 
1658                            if(typeof this.userData.tutore.citta !== "string" || this.userData.tutore.citta.length == 0){ 
1659                                valid = false 
1660
1661                        }else{ 
1662                            valid = false; 
1663
1664                         
1665                        if(_.has(this.userData, "tutore.cap")){ 
1666                            if(typeof this.userData.tutore.cap !== "string" || this.userData.tutore.cap.length == 0){ 
1667                                valid = false 
1668
1669                        }else{ 
1670                            valid = false; 
1671
1672                         
1673                        if(_.has(this.userData, "tutore.provincia")){ 
1674                            if(typeof this.userData.tutore.provincia !== "string" || this.userData.tutore.provincia.length == 0){ 
1675                                valid = false 
1676
1677                        }else{ 
1678                            valid = false; 
1679
1680                         
1681                        if(_.has(this.userData, "tutore.cellulare")){ 
1682                            if(typeof this.userData.tutore.cellulare !== "string" || this.userData.tutore.cellulare.length == 0){ 
1683                                valid = false 
1684
1685                        }else{ 
1686                            valid = false; 
1687
1688                         
1689                        if(_.has(this.userData, "tutore.email")){ 
1690                            if(typeof this.userData.tutore.email !== "string" || this.userData.tutore.email.length == 0){ 
1691                                valid = false 
1692
1693                        }else{ 
1694                            valid = false; 
1695
1696                         
1697                        if(_.has(this.userData, "tutore.telefono")){ 
1698                            if(typeof this.userData.tutore.telefono !== "string" || this.userData.tutore.telefono.length == 0){ 
1699                                valid = false 
1700
1701                        }else{ 
1702                            valid = false; 
1703
1704                         
1705                        if(_.has(this.userData, "tutore.codiceFiscale")){ 
1706                            if(typeof this.userData.tutore.codiceFiscale !== "string" || this.userData.tutore.codiceFiscale.length == 0){ 
1707                                valid = false 
1708
1709                        }else{ 
1710                            valid = false; 
1711
1712                         
1713                        //Tutore2 
1714                        if(_.has(this.userData, "tutore2.cellulare")){ 
1715                            if(typeof this.userData.tutore2.cellulare !== "string" || this.userData.tutore2.cellulare.length == 0){ 
1716                                valid = false 
1717
1718                        }else{ 
1719                            valid = false; 
1720
1721                         
1722                        if(_.has(this.userData, "tutore2.email")){ 
1723                            if(typeof this.userData.tutore2.email !== "string" || this.userData.tutore2.email.length == 0){ 
1724                                valid = false 
1725
1726                        }else{ 
1727                            valid = false; 
1728
1729                         
1730                        if(_.has(this.userData, "tutore2.telefono")){ 
1731                            if(typeof this.userData.tutore2.telefono !== "string" || this.userData.tutore2.telefono.length == 0){ 
1732                                valid = false 
1733
1734                        }else{ 
1735                            valid = false; 
1736
1737                         
1738                        //Studente 
1739                        if(_.has(this.userData, "firstName")){ 
1740                            if(typeof this.userData.firstName !== "string" || this.userData.firstName.length == 0){ 
1741                                valid = false 
1742
1743                        }else{ 
1744                            valid = false; 
1745
1746                         
1747                        if(_.has(this.userData, "lastName")){ 
1748                            if(typeof this.userData.lastName !== "string" || this.userData.lastName.length == 0){ 
1749                                valid = false 
1750
1751                        }else{ 
1752                            valid = false; 
1753
1754                         
1755                        if(_.has(this.userData, "birthPlace")){ 
1756                            if(typeof this.userData.birthPlace !== "string" || this.userData.birthPlace.length == 0){ 
1757                                valid = false 
1758
1759                        }else{ 
1760                            valid = false; 
1761
1762                         
1763                        if(_.has(this.userData, "provincia")){ 
1764                            if(typeof this.userData.provincia !== "string" || this.userData.provincia.length == 0){ 
1765                                valid = false 
1766
1767                        }else{ 
1768                            valid = false; 
1769
1770                         
1771                        if(_.has(this.userData, "birthday")){ 
1772                            if(typeof this.userData.birthday !== "string" || this.userData.birthday.length == 0){ 
1773                                valid = false 
1774
1775                        }else{ 
1776                            valid = false; 
1777
1778                         
1779                        if(_.has(this.userData, "gender")){ 
1780                            if(typeof this.userData.gender !== "string" || this.userData.gender.length == 0){ 
1781                                valid = false 
1782
1783                        }else{ 
1784                            valid = false; 
1785
1786                         
1787                        if(_.has(this.userData, "billingStreetAddress")){ 
1788                            if(typeof this.userData.billingStreetAddress !== "string" || this.userData.billingStreetAddress.length == 0){ 
1789                                valid = false 
1790
1791                        }else{ 
1792                            valid = false; 
1793
1794                         
1795                        if(_.has(this.userData, "billingCity")){ 
1796                            if(typeof this.userData.billingCity !== "string" || this.userData.billingCity.length == 0){ 
1797                                valid = false 
1798
1799                        }else{ 
1800                            valid = false; 
1801
1802                         
1803                        if(_.has(this.userData, "billingPostalCode")){ 
1804                            if(typeof this.userData.billingPostalCode !== "string" || this.userData.billingPostalCode.length == 0){ 
1805                                valid = false 
1806
1807                        }else{ 
1808                            valid = false; 
1809
1810                         
1811                        if(_.has(this.userData, "billingRegionCode")){ 
1812                            if(typeof this.userData.billingRegionCode !== "string" || this.userData.billingRegionCode.length == 0){ 
1813                                valid = false 
1814
1815                        }else{ 
1816                            valid = false; 
1817
1818                         
1819                        if(_.has(this.userData, "phone")){ 
1820                            if(typeof this.userData.phone !== "string" || this.userData.phone.length == 0){ 
1821                                valid = false 
1822
1823                        }else{ 
1824                            valid = false; 
1825
1826                         
1827                        if(typeof this.userMail !== "string" || this.userMail.length == 0){ 
1828                            valid = false 
1829
1830                         
1831                        if(_.has(this.userData, "nazionalita")){ 
1832                            if(typeof this.userData.nazionalita !== "string" || this.userData.nazionalita.length == 0){ 
1833                                valid = false 
1834
1835                        }else{ 
1836                            valid = false; 
1837
1838                         
1839                        if(_.has(this.userData, "fiscalCode")){ 
1840                            if(typeof this.userData.fiscalCode !== "string" || this.userData.fiscalCode.length == 0){ 
1841                                valid = false 
1842
1843                        }else{ 
1844                            valid = false; 
1845
1846                         
1847                        if(_.has(this.userData, "tipoDocumento")){ 
1848                            if(typeof this.userData.tipoDocumento !== "string" || this.userData.tipoDocumento.length == 0){ 
1849                                valid = false 
1850
1851                        }else{ 
1852                            valid = false; 
1853
1854                         
1855                        if(_.has(this.userData, "numeroDocumento")){ 
1856                            if(typeof this.userData.numeroDocumento !== "string" || this.userData.numeroDocumento.length == 0){ 
1857                                valid = false 
1858
1859                        }else{ 
1860                            valid = false; 
1861
1862                         
1863                        if(_.has(this.userData, "enteRilascioDocumento")){ 
1864                            if(typeof this.userData.enteRilascioDocumento !== "string" || this.userData.enteRilascioDocumento.length == 0){ 
1865                                valid = false 
1866
1867                        }else{ 
1868                            valid = false; 
1869
1870                         
1871                        if(_.has(this.userData, "dataScadenzaDocumento")){ 
1872                            if(typeof this.userData.dataScadenzaDocumento !== "string" || this.userData.dataScadenzaDocumento.length == 0){ 
1873                                valid = false 
1874
1875                        }else{ 
1876                            valid = false; 
1877
1878                         
1879                        if(_.has(this.userData, "documentoViaggio")){ 
1880                            if(typeof this.userData.documentoViaggio !== "string" || this.userData.documentoViaggio.length == 0){ 
1881                                valid = false 
1882
1883                        }else{ 
1884                            valid = false; 
1885
1886                         
1887                        if(_.has(this.userData, "fumatore")){ 
1888                            if(typeof this.userData.fumatore !== "string" || this.userData.fumatore.length == 0){ 
1889                                valid = false 
1890
1891                        }else{ 
1892                            valid = false; 
1893
1894                         
1895                        if(_.has(this.userData, "problemiSalute")){ 
1896                            if(typeof this.userData.problemiSalute !== "string" || this.userData.problemiSalute.length == 0){ 
1897                                valid = false 
1898
1899                        }else{ 
1900                            valid = false; 
1901
1902                         
1903                        //Scuola 
1904                        if(_.has(this.userData, "nomeScuola")){ 
1905                            if(typeof this.userData.nomeScuola !== "string" || this.userData.nomeScuola.length == 0){ 
1906                                valid = false 
1907
1908                        }else{ 
1909                            valid = false; 
1910
1911                         
1912                        if(_.has(this.userData, "codiceMeccanografico")){ 
1913                            if(typeof this.userData.codiceMeccanografico !== "string" || this.userData.codiceMeccanografico.length == 0){ 
1914                                valid = false 
1915
1916                        }else{ 
1917                            valid = false; 
1918
1919                         
1920                        if(_.has(this.userData, "indirizzoScuola")){ 
1921                            if(typeof this.userData.indirizzoScuola !== "string" || this.userData.indirizzoScuola.length == 0){ 
1922                                valid = false 
1923
1924                        }else{ 
1925                            valid = false; 
1926
1927                         
1928                        if(_.has(this.userData, "cittaScuola")){ 
1929                            if(typeof this.userData.cittaScuola !== "string" || this.userData.cittaScuola.length == 0){ 
1930                                valid = false 
1931
1932                        }else{ 
1933                            valid = false; 
1934
1935                         
1936                        if(_.has(this.userData, "provinciaScuola")){ 
1937                            if(typeof this.userData.provinciaScuola !== "string" || this.userData.provinciaScuola.length == 0){ 
1938                                valid = false 
1939
1940                        }else{ 
1941                            valid = false; 
1942
1943                         
1944                        if(_.has(this.userData, "telefonoScuola")){ 
1945                            if(typeof this.userData.telefonoScuola !== "string" || this.userData.telefonoScuola.length == 0){ 
1946                                valid = false 
1947
1948                        }else{ 
1949                            valid = false; 
1950
1951                         
1952                        if(_.has(this.userData, "emailScuola")){ 
1953                            if(typeof this.userData.emailScuola !== "string" || this.userData.emailScuola.length == 0){ 
1954                                valid = false 
1955
1956                        }else{ 
1957                            valid = false; 
1958
1959                         
1960                        if(_.has(this.userData, "nomeCognomeDirigenteScolastico")){ 
1961                            if(typeof this.userData.nomeCognomeDirigenteScolastico !== "string" || this.userData.nomeCognomeDirigenteScolastico.length == 0){ 
1962                                valid = false 
1963
1964                        }else{ 
1965                            valid = false; 
1966
1967                         
1968                        if(_.has(this.userData, "nomeCognomeTutorMobilita")){ 
1969                            if(typeof this.userData.nomeCognomeTutorMobilita !== "string" || this.userData.nomeCognomeTutorMobilita.length == 0){ 
1970                                valid = false 
1971
1972                        }else{ 
1973                            valid = false; 
1974
1975                         
1976                        if(_.has(this.userData, "emailTutorMobilita")){ 
1977                            if(typeof this.userData.emailTutorMobilita !== "string" || this.userData.emailTutorMobilita.length == 0){ 
1978                                valid = false 
1979
1980                        }else{ 
1981                            valid = false; 
1982
1983                         
1984                        if(_.has(this.userData, "nomeCognomeDocenteLinguaStraniera")){ 
1985                            if(typeof this.userData.nomeCognomeDocenteLinguaStraniera !== "string" || this.userData.nomeCognomeDocenteLinguaStraniera.length == 0){ 
1986                                valid = false 
1987
1988                        }else{ 
1989                            valid = false; 
1990
1991                         
1992                        if(_.has(this.userData, "emailDocenteLinguaStraniera")){ 
1993                            if(typeof this.userData.emailDocenteLinguaStraniera !== "string" || this.userData.emailDocenteLinguaStraniera.length == 0){ 
1994                                valid = false 
1995
1996                        }else{ 
1997                            valid = false; 
1998
1999                    }else{ 
2000                        valid = false; 
2001
2002                     
2003                    return valid; 
2004
2005            }, 
2006            methods: { 
2007                areServicesMandatory: function(){ 
2008                    return this.selectedProgram?.servicesAndPrices.some(function(serv){ 
2009                        return serv.mandatory; 
2010                    }); 
2011                }, 
2012                getCategoryName: function(catId){ 
2013                    var that = this; 
2014                    return this.labels[catId]; 
2015                }, 
2016                getVocabularyLabels: function(){ 
2017                    var that = this; 
2018                     
2019                    return axios.get("${d40.serviceEndpoint}{'fn':'getProgrammiLabels'}").then(function(res){ 
2020                        that.labels = res.data.result; 
2021                        console.log(that.labels); 
2022                    }).catch(function(err){ 
2023                        console.error("err: ", err); 
2024                    }); 
2025                }, 
2026                hasSchools: function(area)  { 
2027                    if(typeof area.children !== "undefined" && area.children.length > 0){ 
2028                        return true; 
2029
2030                     
2031                    return false; 
2032                }, 
2033                getScontiDisponibili: function(prg) { 
2034                    var sret=""; 
2035                    var that = this; 
2036                    prg.otherDiscounts.forEach(function(item){ 
2037                        if(sret.length > 0){ 
2038                            sret += ", "; 
2039
2040                         
2041                        sret += that.labels[item.description]; 
2042                    }); 
2043/*                     
2044                    return sret; 
2045*/                    
2046                    return "Procedi e scopri gli sconti e le borse di studio"; 
2047                }, 
2048                getAreaPriceIfSet: function(item){ 
2049                    if(typeof item.price != "undefined" && item.price != ""){ 
2050                        var formatter = new Intl.NumberFormat('it-IT', { 
2051                            style: 'currency', 
2052                            currency: 'EUR', 
2053                        }); 
2054                         
2055                        return " -" + formatter.format(parseFloat(item.price)); 
2056
2057                }, 
2058                getSelectedAreaAndSchoolLabel: function() { 
2059                    if(this.selectedArea != null) { 
2060                        var szret = this.selectedArea.name; 
2061                         
2062                        if(this.selectedSchool !=null && typeof this.selectedSchool !== "undefined" && typeof this.selectedSchool.name !== "undefined"){ 
2063                            szret += ", " + this.selectedSchool.name; 
2064
2065                         
2066                        return szret; 
2067
2068                     
2069                    return ""; 
2070                }, 
2071                getSelectedAreaAndSchoolPrice: function() { 
2072                    var pret = 0; 
2073                     
2074                    if(this.selectedArea != null) { 
2075                        if(this.selectedArea.price != null && this.selectedArea.price !== "undefined" && this.selectedArea.price != ""){ 
2076                            pret = parseFloat(this.selectedArea.price); 
2077
2078                         
2079                        if(this.selectedSchool != null && typeof this.selectedSchool !== "undefined" && this.selectedSchool.price != ""){ 
2080                            pret +=  parseFloat(this.selectedSchool.price); 
2081
2082                         
2083                        var formatter = new Intl.NumberFormat('it-IT', { 
2084                            style: 'currency', 
2085                            currency: 'EUR', 
2086                        }); 
2087                         
2088                        return formatter.format(pret); 
2089
2090                     
2091                    return ""; 
2092                }, 
2093                sum: function(num1, num2){ 
2094                    return Number(num1 + num2); 
2095                }, 
2096                openParentModal: function(id){ 
2097                    window.parent.$(id).modal("show"); 
2098                }, 
2099                closeParentModal: function(id){ 
2100                    window.parent.$(id).modal("hide"); 
2101                }, 
2102                redirectParent: function(url){ 
2103                    window.top.location = "${themeDisplay.getPortalURL()}" + url + "?from=" + window.top.location.href; 
2104                }, 
2105                gotoStep: function(step){ 
2106                    if(typeof(step) == "number"){ 
2107                        this.currentStep = step; 
2108                    }else{ 
2109                        if(step == "next"){ 
2110                            this.currentStep++; 
2111
2112                        if(step == "prev"){ 
2113                            this.currentStep--; 
2114
2115
2116                }, 
2117                getCity: function(fullString){ 
2118                    return fullString.substr(0, fullString.indexOf('(') === -1 ? fullString.length : fullString.indexOf('(')); 
2119                }, 
2120                isBefore: function(data){ 
2121                    return moment(data).isBefore(new Date()); 
2122                }, 
2123                isAfter: function(data){ 
2124                    return moment(data).isAfter(new Date()); 
2125                }, 
2126                getExternalData: function(message){ 
2127                    var strExtData = JSON.parse(JSON.stringify(message.data)); 
2128                     
2129                    if(strExtData.source == null){ 
2130                        var extData = JSON.parse(strExtData); 
2131                        console.log("dati ricevuti da iframe: ", extData); 
2132                         
2133                        if(extData.key == "programIndex"){ 
2134                            if(this.selectedProgram != extData){ 
2135                                this.selectProgram(extData.data); 
2136                                console.log("selected program: ", extData.data); 
2137                            }else{ 
2138                                console.log("program already selected"); 
2139
2140
2141
2142                }, 
2143                setAttachments: function(){ 
2144                    <#list allegati as allegato> 
2145                        <#assign stringSelector = "dynamic-element[@name='testo']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2146                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2147                        <#if xPathSelector.selectSingleNode(allegato)??> 
2148                            <#assign text = xPathSelector.selectSingleNode(allegato).getData()> 
2149                        </#if> 
2150             
2151                        <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2152                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2153                        <#if xPathSelector.selectSingleNode(allegato)??> 
2154                            <#assign mandatory = xPathSelector.selectSingleNode(allegato).getData()> 
2155                        </#if> 
2156                         
2157                        <#assign stringSelector = "dynamic-element[@name='documento']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2158                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2159                        <#if xPathSelector.selectSingleNode(allegato)??> 
2160                            <#assign document = jsonFactoryUtil.createJSONObject(xPathSelector.selectSingleNode(allegato).getData())> 
2161                        </#if> 
2162                         
2163                        var newAttachment = { 
2164                            title: "${text}", 
2165                            mandatory: ${mandatory}, 
2166                            file: "${'/documents/' + document.getString('groupId') + '/0/' + document.getString('title') + '/' + document.getString('uuid')}" 
2167
2168                         
2169                        this.attachments.push(newAttachment); 
2170                    </#list> 
2171                }, 
2172                setAttachmentsContent: function(){ 
2173                    <#list allegatiContent as allegato> 
2174                        <#assign stringSelector = "dynamic-element[@name='titoloDocContrattuale']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2175                        <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2176                        <#assign text=""> 
2177                        <#if xPathSelector.selectSingleNode(allegato)??> 
2178                            <#assign text = xPathSelector.selectSingleNode(allegato).getData()> 
2179                        </#if> 
2180                        <#if text?has_content> 
2181                            <#assign stringSelector = "dynamic-element[@name='mandatory']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2182                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2183                            <#if xPathSelector.selectSingleNode(allegato)??> 
2184                                <#assign mandatory = xPathSelector.selectSingleNode(allegato).getData()> 
2185                            </#if> 
2186                            <#if ! mandatory?has_content> 
2187                                <#assign mandatory ="false"> 
2188                            </#if> 
2189                             
2190                            <#assign stringSelector = "dynamic-element[@name='docContrattuale']/dynamic-content[@language-id = '" + themeDisplay.getLocale() + "']"> 
2191                            <#assign xPathSelector = saxReaderUtil.createXPath(stringSelector)> 
2192                            <#if xPathSelector.selectSingleNode(allegato)??> 
2193                                <#assign document = jsonFactoryUtil.createJSONObject(xPathSelector.selectSingleNode(allegato).getData())> 
2194                            </#if> 
2195                             
2196                            var newAttachment = { 
2197                                title: "${text}", 
2198                                mandatory: ${mandatory}, 
2199                                file: "${'/documents/' + document.getString('groupId') + '/0/' + document.getString('title') + '/' + document.getString('uuid')}" 
2200
2201                             
2202                            this.attachments.push(newAttachment); 
2203                        </#if> 
2204                    </#list> 
2205                }, 
2206                getUserData: function(){ 
2207                    var that = this; 
2208                     
2209                    Liferay.Service("/destinazione.d40user/get-user-data", { 
2210                        groupId: this.groupId, 
2211                        userId: this.userId 
2212                    }, function(res){ 
2213                        console.log("Get user data: ", res); 
2214                         
2215                        if(res.success){ 
2216                            that.userData = { 
2217                                tutore: {}, 
2218                                tutore2: {}, 
2219                                ...res.data 
2220                            }; 
2221                             
2222                            that.getCountryList(); 
2223                        }else{ 
2224                            console.log("Error getting user data"); 
2225
2226                    }).catch(function(err){ 
2227                        console.error("Error getting userData: ", err); 
2228                    }); 
2229                }, 
2230                getCountryList: function(){ 
2231                    var that = this; 
2232                     
2233                    Liferay.Service("/destinazione.d40user/get-country-list", { 
2234                        language: this.defaultLanguage 
2235                    }, function(res){ 
2236                        console.log("Get country list: ", res); 
2237                         
2238                        if(res.success){ 
2239                            that.countryList = res.data; 
2240                             
2241                            if(that.userData.billingCountryId == "0" || that.userData.billingCountryId == null){ 
2242                                that.userData.billingCountryId = that.countryList.find(country => country.ID === that.defaultCountryId).ID; 
2243                            }else{ 
2244                                that.userData.billingCountryId = that.defaultCountryId; 
2245
2246                             
2247                            that.getRegionList(); 
2248
2249                    }).catch(function(err){ 
2250                        console.error("Error getting countryList: ", err); 
2251                    }); 
2252                }, 
2253                getRegionList: function(){ 
2254                    var that = this, 
2255                        idToUse = this.defaultCountryId; 
2256                     
2257                    if(this.userData.hasOwnProperty("billingCountryId") && typeof this.userData["billingCountryId"] === "string" && this.userData["billingCountryId"].length){ 
2258                        idToUse = this.userData.billingCountryId; 
2259
2260                     
2261                    Liferay.Service("/destinazione.d40user/get-region-list", { 
2262                        countryId: idToUse 
2263                    }, function(res){ 
2264                        console.log("Get region list: ", res); 
2265                         
2266                        if(res.success){ 
2267                            that.regionList = res.data; 
2268                             
2269                            if(that.userData.billingRegionId == "0" || that.userData.billingRegionId == null){ 
2270                                 
2271
2272
2273                    }).catch(function(err){ 
2274                        console.error("Error getting regionList: ", err); 
2275                    }); 
2276                }, 
2277                selectProgram: function(program){ 
2278                    var that = this; 
2279                     
2280                    console.log("select program with id " + program._id.$oid); 
2281                     
2282                    this.resetSelections(); 
2283                     
2284                    this.selectedProgram = program; 
2285                    if(typeof this.selectedProgram.basePrice!=="undefined" && this.selectedProgram.basePrice != ""){ 
2286                        this.programPrice = this.selectedProgram?.basePrice; 
2287                    }else{ 
2288                        this.programPrice = 0; 
2289
2290                     
2291                    this.programDiscount = 0; 
2292                    console.log("programPrice: " + this.programPrice); 
2293                     
2294                    this.selectedProgram?.purchaseBeforeDiscount.forEach(function(sconto){ 
2295                        if(that.isDiscountValid(sconto) && sconto.discount != 0){ 
2296                            that.programDiscount = Number(sconto.discount); 
2297
2298                    }); 
2299                     
2300                    this.setMandatoryServices(); 
2301                     
2302                    setTimeout(function(){ 
2303                        console.log("updating"); 
2304                        that.$forceUpdate(); 
2305                    }, 250); 
2306                }, 
2307                getPaymentLabel: function(type){ 
2308                    if(type == "bonifico") 
2309                        return "Bonifico bancario"; 
2310                    if(type == "cartaCredito") 
2311                        return "Carta di credito"; 
2312                    if(type == "cartaCreditoAcconto") 
2313                        return "Acconto con carta di credito"; 
2314                }, 
2315                resetSelections: function(){ 
2316                    this.selectedAccomodation = null; 
2317                    this.selectedAirport = null; 
2318                    this.selectedArea = null; 
2319                    this.selectedPayment = null; 
2320                    this.selectedProgram = null; 
2321                    this.selectedSchool = null; 
2322                    this.selectedServices = []; 
2323                    this.paymentLink = "#"; 
2324                    this.voucher = ""; 
2325                    this.programPrice = 0; 
2326                    this.currentStep = 1; 
2327                }, 
2328                select: function(name, obj){ 
2329                    if(name == "airport"){ 
2330                        this.selectedAirport = obj; 
2331
2332                    if(name == "accomodation"){ 
2333                        this.selectedAccomodation = obj; 
2334
2335                }, 
2336                checkFavourite: function(){ 
2337                    var that = this; 
2338                     
2339                    Liferay.Service('/destinazione.favorite/get-wish-list', { 
2340                        groupId: Liferay.ThemeDisplay.getScopeGroupId(), 
2341                        sessionId: String(Liferay.ThemeDisplay.getSessionId()), 
2342                        userId: String(Liferay.ThemeDisplay.getUserId()), 
2343                    }, function(res){ 
2344                        console.log("getWishList response: ", res); 
2345                        if(res.success){ 
2346                            res.data.forEach(function(obj){ 
2347                                if(obj.itemId == that.contentId){ 
2348                                    that.favourite = true; 
2349                                    that.oid = obj._id.$oid; 
2350
2351                            }); 
2352
2353                    }).catch(function(err){ 
2354                        console.error("Error getting wishlist: ", err); 
2355                    }); 
2356                }, 
2357                createOrderAndPaymentUrl: function(){ 
2358                    var that = this, 
2359                        orderPrice = 0, 
2360                        orderParams = { 
2361                            selectedProgram: this.selectedProgram, 
2362                            selectedArea: this.selectedArea, 
2363                            selectedSchool: this.selectedSchool, 
2364                            selectedAccomodation: this.selectedAccomodation, 
2365                            selectedAirport: this.selectedAirport, 
2366                            selectedServices: this.selectedServices, 
2367                            selectedPayment: this.selectedPayment, 
2368                            selectedDiscounts: this.selectedDiscounts, 
2369                            userData: this.userData 
2370                        }; 
2371/*                         
2372                    if(this.selectedPayment?.amount == 0 || this.selectedPayment?.amount === undefined){ 
2373                        orderPrice = this.totalPrice; 
2374                    }else{ 
2375                        orderPrice = this.selectedPayment?.amount; 
2376
2377*/ 
2378                    this.selectedPayment == "cartaCreditoAcconto" ? orderPrice = this.selectedProgram.depositAmount : orderPrice = this.totalPrice; 
2379                     
2380                    console.log(this.selectedPayment); 
2381                    console.log(orderPrice); 
2382                    console.log(this.totalPrice); 
2383                    console.log(JSON.stringify(orderParams)); 
2384                     
2385                    if(this.selectedPayment != "bonifico"){ 
2386                        var iframe = window.open("/", "_blank"); 
2387
2388                     
2389                    Liferay.Service("/destinazione.order/add-order-and-get-payment-url", { 
2390                        groupId: this.groupId, 
2391                        userId: this.userId, 
2392                        itemGroupId: Liferay.ThemeDisplay.getScopeGroupId(), 
2393                        itemId: this.contentId, 
2394                        totalPrice: this.totalPrice, 
2395                        params: JSON.stringify(orderParams), 
2396                        currency: "EUR", 
2397                        priceToPay: orderPrice, 
2398                        userEmail: this.userMail, 
2399                        languageId: "ITA", 
2400                        description: this.name, 
2401                        session_id: String(Liferay.ThemeDisplay.getSessionId()), 
2402                        cart_id: "12", 
2403                        baseUrl: Liferay.ThemeDisplay.getURLHome().split("/web/")[0], 
2404                        locsz: "" 
2405                    }, function(res){ 
2406                        console.log("add order and get payment url res: ", res); 
2407                         
2408                        if(res.success){ 
2409                            if(that.selectedPayment != "bonifico"){ 
2410                                console.log("redirecting..."); 
2411                                iframe.location = res.data.url; 
2412                                that.closeParentModal("#pay-modal"); 
2413                            }else{ 
2414                                that.currentStep++; 
2415                                console.log("ordine immesso con bonifico, non ridireziono l'utente"); 
2416
2417                             
2418                            that.orderResult = "Ordine inserito con successo"; 
2419                        }else{ 
2420                            that.orderResult = "C'è stato un problema con l'inserimento dell'ordine. Contattare Zainetto Verde se il problema persiste."; 
2421
2422                    }).catch(function(err){ 
2423                        console.error("Error: ", err); 
2424                         
2425                        that.orderResult = "C'è stato un problema con l'inserimento dell'ordine. Contattare Zainetto Verde se il problema persiste."; 
2426                    }); 
2427                }, 
2428                setFavourite: function(){ 
2429                    var that = this; 
2430                     
2431                    if(this.signedIn){ 
2432                        Liferay.Service('/destinazione.favorite/add-to-wish-list', { 
2433                            groupId: Liferay.ThemeDisplay.getScopeGroupId(), 
2434                            sessionId: String(Liferay.ThemeDisplay.getSessionId()), 
2435                            userId: String(Liferay.ThemeDisplay.getUserId()), 
2436                            itemGroupId: 11, 
2437                            itemId: this.contentId 
2438                        }, function(res){ 
2439                            if(res.success){ 
2440                                console.log("addToWishList response: ", res); 
2441                                that.favourite = true; 
2442
2443                        }).catch(function(err){ 
2444                            console.error("Error adding to wishlist: ", err); 
2445                        }); 
2446                    }else{ 
2447                        this.redirect("login?contentId=${contentId}"); 
2448
2449                }, 
2450                removeFavourite: function(){ 
2451                    var that = this; 
2452                     
2453                    Liferay.Service('/destinazione.favorite/delete-item-from-wish-list', { 
2454                        oid: this.oid 
2455                    }, function(res) { 
2456                        console.log("deleteFromWishList response: ", res); 
2457                        that.favourite = false; 
2458                        that.checkFavourite(); 
2459                    }).catch(function(err){ 
2460                        console.error("Error removing from wishlist: ", err); 
2461                    }); 
2462                }, 
2463                selectDate: function(value){ 
2464                    var that = this; 
2465                     
2466                    console.log("Data scelta: ", value) 
2467                    this.calendar.dataSelected = value.date; 
2468                     
2469                    this.programs.forEach(function(program){ 
2470                        if(moment(value.date).isBetween(program.startDate, program.endDate)){ 
2471                            console.log(value.date + " è compresa"); 
2472                            program.show = true; 
2473
2474                    }); 
2475                }, 
2476                resetDates: function(){ 
2477                    this.calendar.dataSelected = null; 
2478                    this.programs.forEach(function(program){ 
2479                        program.show = true; 
2480                    }); 
2481                }, 
2482                showResults: function(data){ 
2483                    var that = this; 
2484                     
2485                    this.programs.forEach(function(program){ 
2486                        program.show = false; 
2487                         
2488                        if(moment(data).isBetween(program.startDate, program.endDate)){ 
2489                            console.log(data + " è compresa"); 
2490                            program.show = true; 
2491
2492                    }); 
2493                }, 
2494                setMandatoryServices: function(){ 
2495                    var that = this; 
2496                     
2497                    this.selectedServices = []; 
2498                     
2499                    this.selectedProgram?.servicesAndPrices?.forEach(function(service){ 
2500                        if(service.mandatory){ 
2501                            that.selectedServices.push(service); 
2502
2503                    }); 
2504                }, 
2505                setRequestMessage: function(){ 
2506                    sessionStorage.removeItem("requestMesaage"); 
2507                    console.log("removed old requestMesaage"); 
2508                     
2509                    var requestMessage = { 
2510                        message: "testo preventivo da mostrare" 
2511
2512                     
2513                    sessionStorage.setItem("requestMesaage", JSON.stringify(requestMesaage)); 
2514                    console.log("requestMesaage saved"); 
2515                }, 
2516                setProgressData: function(){ 
2517                    var that = this, 
2518                        depositAmount = ""; 
2519                     
2520                    localStorage.removeItem("progressProgramData"); 
2521                    console.log("removed old progressProgramData data"); 
2522                     
2523                    if(this.selectedPayment == "cartaCreditoAcconto"){ 
2524                        depositAmount = this.selectedProgram.depositAmount; 
2525
2526                     
2527                    var progressData = { 
2528                        docTitle: "${docTitle?js_string}", 
2529                        selectedProgram: this.selectedProgram, 
2530                        selectedArea: this.selectedArea, 
2531                        selectedSchool: this.selectedSchool, 
2532                        selectedServices: this.selectedServices, 
2533                        selectedDiscounts: this.selectedDiscounts, 
2534                        selectedAirport: this.selectedAirport, 
2535                        selectedPayment: this.selectedPayment, 
2536                        programPrice: this.programPrice, 
2537                        programDiscount: this.programDiscount, 
2538                        userData: this.userData, 
2539                        userMail: this.userMail, 
2540                        totalPrice: this.totalPrice, 
2541                        depositAmount: depositAmount 
2542
2543                     
2544                    progressData.selectedServices.forEach(function(serv){ 
2545                        serv.label = that.labels[serv.service]; 
2546                    }); 
2547                    progressData.selectedDiscounts.forEach(function(dsc){ 
2548                        dsc.label = that.labels[dsc.description]; 
2549                    }); 
2550                     
2551                    progressData.selectedAirport.label = this.labels[progressData.selectedAirport.airport]; 
2552                     
2553                    localStorage.setItem("progressProgramData", JSON.stringify(progressData)); 
2554                    console.log("progressProgramData saved"); 
2555                }, 
2556                getProgressData: function(){ 
2557                    if(localStorage.getItem("progressProgramData") !== null){ 
2558                        console.log("previous data exists, get..."); 
2559                        var previousData = JSON.parse(localStorage.getItem("progressProgramData")); 
2560                         
2561                        this.selectedProgram=previousData.selectedProgram, 
2562                        this.selectedArea=previousData.selectedArea, 
2563                        this.selectedSchool=previousData.selectedSchool, 
2564                        this.selectedAirport = previousData.selectedAirport; 
2565                        this.selectedProgram = previousData.selectedProgram; 
2566                        this.selectedPayment = previousData.selectedPayment; 
2567                        this.selectedServices = previousData.selectedServices; 
2568                        this.selectedDiscounts = previousData.selectedDiscounts; 
2569                        this.programPrice = previousData.programPrice; 
2570                        this.programDiscount = previousData.programDiscount; 
2571                        this.userData=previousData.userData; 
2572                        this.userMail=previousData.userMail; 
2573                         
2574                        console.log("previous data restored"); 
2575                         
2576                        localStorage.removeItem("progressProgramData"); 
2577                        this.currentStep = 5; 
2578                        this.openParentModal("#requestinfo-payment-modal"); 
2579                    }else{ 
2580                        console.log("no previous data exists"); 
2581
2582                }, 
2583                isDiscountValid: function(sconto){ 
2584                    var today = new Date(), 
2585                        valid = false; 
2586                     
2587                    if(moment(today).isSameOrAfter(sconto.date) && moment(today).isSameOrBefore(sconto.dateEnd)){ 
2588                        valid = true; 
2589
2590                     
2591                    return valid; 
2592
2593
2594        }); 
2595    }); 
2596</script>