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

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

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