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

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

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