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

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