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

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