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

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