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