1var shortDescription; 2var longDescription; 3var shortHighlights; 4var longHighlights; 5var packageSeasons; 6 7$(document).ready(function(){ 8 //listPackages(); 9}); 10 11function listPackages() 12{ 13 loading('id','servicesContainer'); 14 15 $.ajax({ 16 url : "?controller=services&action=getPackages", 17 type: "GET", 18 dataType: "JSON", 19 success: function(response) 20 { 21 if(response.status) 22 { 23 var section = $('#services'); 24 var container = $('#servicesContainer'); 25 var item = ''; 26 /*var currency = 'USD'; 27 var exchange = 1; 28 29 if(sessionStorage.getItem('currency') != '' && sessionStorage.getItem('currency') != null && sessionStorage.getItem('currency') != undefined) 30 { 31 currency = sessionStorage.getItem('currency'); 32 } 33 34 if(sessionStorage.getItem('exchange') != '' && sessionStorage.getItem('exchange') != null && sessionStorage.getItem('exchange') != undefined) 35 { 36 exchange = sessionStorage.getItem('exchange'); 37 }*/ 38 39 if(response.packages != null) 40 { 41 for(i=0; i<response.packages.length; i++) 42 { 43 if(response.packages[i].title.length > 60) 44 { 45 var smallClass = ' text-small'; 46 } 47 else 48 { 49 var smallClass = ''; 50 } 51 52 item += '<div class="col-lg-3 col-md-6 mb-3 ">'; 53 item += '<a href="javascript:;" onclick="checkNationality('+response.packages[i].id+')" class="movi-card comunicado-card vertical-half-card blue-card" id="loadContent_2" style="background-image: url('+response.packages[i].thumb+');">'; 54 item += '<div class="card-body">'; 55 item += '<h3>'+response.packages[i].title+'</h3>'; 56 item += '</div>'; 57 item += '<div class="movi-card-footer">'; 58 item += '<ul class="data-card">'; 59 item += '<li class="data-card-row tooltips" data-original-title="Duración total del comunicado" data-bs-toggle="tooltip" data-placement="top">'; 60 item += '<i class="fas fa-hourglass-start"></i>'; 61 item += '<span>24 '+traslation.time.hours+'</span>'; 62 item += '</li>'; 63 item += '</ul>'; 64 item += '<div class="button">'+traslation.promotions.seeDetails+' <i class="fas fa-arrow-right"></i></div>'; 65 item += '</div> '; 66 item += '</a>'; 67 item += '</div>'; 68 } 69 70 container.html(''); 71 container.removeClass('justify-content-center align-items-center loading'); 72 container.append(item); 73 } 74 } 75 }, 76 error: function (jqXHR, textStatus, errorThrown) 77 { 78 Swal.fire({ 79 icon: traslation.swal.error.icon, 80 title: traslation.swal.error.title, 81 text: traslation.swal.error.text, 82 }); 83 } 84 }); 85} 86 87function reloadPackagesList() 88{ 89 var items = $('.packageItem'); 90 91 items.remove(); 92 93 listPackages(); 94} 95 96function getPackageDetails(id, assignedDate = '', promotion = null) 97{ 98 Swal.fire({ 99 title: traslation.swal.loading.text, 100 }); 101 Swal.showLoading(); 102 103 $.ajax({
104 url : "?controller=services&action=getPackage&id="+id, 105 type: "GET", 106 dataType: "JSON", 107 success: function(response) 108 { 109 if(response.status) 110 { 111 var active = ''; 112 var description = $('#description'); 113 var exclusion = ''; 114 var exclusions = $('#exclusions'); 115 var highlight = ''; 116 var highlights = $('#highlights'); 117 var images = response.package.gallery.images; 118 var inclusion = ''; 119 var inclusions = $('#inclusions'); 120 var indicator =''; 121 var indicators = $('#carouselIndicators'); 122 var inner = ''; 123 var inners = $('#carouselInners'); 124 var modal = $('#packageModal'); 125 var modalities = $('#modalities'); 126 var notes = $('#notes'); 127 var currencys = $('.currency'); 128 var priceAdults = $('.priceAdults'); 129 var priceChilds = $('.priceChilds'); 130 var priceInfants = $('.priceInfants'); 131 var tab = $('#myTab'); 132 var title = $('#modalTitle'); 133 var firstOptionTitle = $('#title'); 134 var firstOptionButton = $('#button'); 135 var firstOptionInput = $('#input'); 136 var currency = 'USD'; 137 var exchange = 1; 138 var param = ''; 139 var form = $('#baseForm'); 140 141 form.empty(); 142 143 form.append('<input type="hidden" name="package" id="input"><div class="row"> <div class="col-lg-3"> <div class="form-group"> <label><span class="detailFormActivityDate"></span></label> <input class="form-control activityDate datepicker" type="text" name="activityDate" onchange="switchPrice(this.value, \'season\');"/> <div id="activityDateFeedback" class="input-feedback" style="display:none"></div> </div> </div> <div class="col-lg-9"> <div class="row"> <div class="col-lg-3"> <div class="form-group"> <label><span class="detailFormAdults"></span> (12+)</label> <input class="form-control adults" type="number" name="adults" value="0"/> <div id="adultsFeedback" class="input-feedback" style="display:none"></div> </div> </div> <div class="col-lg-3"> <div class="form-group"> <label><span class="detailFormChilds"></span> (4 - 11)</label> <input class="form-control childs" type="number" name="childs" value="0"/> <div id="childsFeedback" class="input-feedback" style="display:none"></div> </div> </div> <div class="col-lg-3"> <div class="form-group"> <label><span class="detailFormInfants"></span> (0 - 3)</label> <input class="form-control infants" type="number" name="infants" value="0"/> <div id="infantsFeedback" class="input-feedback" style="display:none"></div> </div> </div> <div class="col-lg-3" id="retirees"> <div class="form-group"> <label><span class="detailFormJubilados"></span></label> <input class="form-control jubilados" type="number" name="jubilados" value="0"/> <div id="infantsFeedback" class="input-feedback" style="display:none"></div> </div> </div> </div> </div> </div>'); 144 145 if(window.lockNonInfants) 146 { 147 form.find('input[name="adults"], input[name="childs"], input[name="jubilados"]').val(0).prop('disabled', true); 148 form.append('<input type="hidden" name="adults" value="0"><input type="hidden" name="childs" value="0"><input type="hidden" name="jubilados" value="0">'); 149 } 150 151 $('input[name=package]').val(id); 152 153 setLang(); 154 155 var retirees = $('#retirees'); 156 157 const tickets = [ 158 17567, 159 17169, 160 17170 161 ]; 162 163 if(jQuery.inArray(id, tickets) != -1) 164 { 165 retirees.show(); 166 } 167 else 168 { 169 retirees.hide(); 170 } 171 172 if(sessionStorage.getItem('currency') != '' && sessionStorage.getItem('currency') != null && sessionStorage.getItem('currency') != undefined) 173 { 174 currency = sessionStorage.getItem('currency'); 175 } 176 177 if(sessionStorage.getItem('exchange') != '' && sessionStorage.getItem('exchange') != null && sessionStorage.getItem('exchange') != undefined) 178 { 179 exchange = sessionStorage.getItem('exchange'); 180 } 181 182 firstOptionButton.attr('onclick','validatePurchase('+id+')'); 183 firstOptionInput.val(response.package.id); 184 185 shortDescription = response.package.description.substr(0,120); 186 longDescription = response.package.description; 187 188 title.text(response.package.title); 189 firstOptionTitle.text(response.package.title); 190 191 param = "'description'"; 192 description.html(shortDescription+'<a href="javascript:;" class="btn btn-link" onclick="switchLength('+param+')">'+traslation.details.seeMore+'</a>'); 193 description.addClass('short'); 194 195 notes.html(response.package.notes); 196 currencys.text(currency); 197 198 var priceSet = 0; 199 200 for (const key in response.package.rates) { 201 priceSet = currency == 'ARS' ? new Intl.NumberFormat('de-DE', {currency: 'ARS', style: 'currency'}).format(response.package.rates[key]) : new Intl.NumberFormat('en-US', {currency: 'USD', style: 'currency'}).format(response.package.rates[key]); 202 priceSet = priceSet.replace("ARS", ""); 203 priceSet = priceSet.replace("$", ""); 204 205 switch (key) { 206 case 'child': 207 priceChilds.text(priceSet); 208 break; 209 case 'infant': 210 priceInfants.text(priceSet); 211 break; 212 213 default: 214 priceAdults.text(priceSet); 215 break; 216 } 217 } 218 219 packageSeasons = response.package.seasons; 220 221 modalities.html(''); 222 223 if(response.package.seasons[0].modalities != null) 224 { 225 var sessionAdults = 1; 226 var sessionChilds = 0; 227 var sessionInfants = 0; 228 var disabled = ''; 229 230 if(sessionStorage.getItem('cartId') != '' && sessionStorage.getItem('cartId') != null && sessionStorage.getItem('cartId') != undefined) 231 { 232 disabled = ' disabled'; 233 } 234 235 if(sessionStorage.getItem('adults') != '' && sessionStorage.getItem('adults') != null && sessionStorage.getItem('adults') != undefined) 236 { 237 sessionAdults = sessionStorage.getItem('adults'); 238 } 239 240 if(sessionStorage.getItem('childs') != '' && sessionStorage.getItem('childs') != null && sessionStorage.getItem('childs') != undefined) 241 { 242 sessionChilds = sessionStorage.getItem('childs'); 243 } 244 245 if(sessionStorage.getItem('infants') != '' && sessionStorage.getItem('infants') != null && sessionStorage.getItem('infants') != undefined) 246 { 247 sessionInfants = sessionStorage.getItem('infants'); 248 } 249 250 for(i=0; i<response.package.seasons[0].modalities.length; i++) 251 { 252 var modality = ''; 253 var type = "'modality'"; 254 255 modality += '<div class="col-lg-12 mt-3">'; 256 modality += '<div class="card">'; 257 modality += '<div class="row no-gutters align-items-center justify-content-center bg-light">'; 258 modality += '<div class="col-md-9 p-3 bg-white">'; 259 modality += '<h5>'+response.package.seasons[0].modalities[i].title+'</h5>'; 260 modality += '<div class="mt-3"></div>'; 261 modality += '<form action="javascript:;" id="modality'+response.package.seasons[0].modalities[i].id+'Form">'; 262 modality += '<input type="hidden" name="package" value="'+response.package.id+'">'; 263 modality += '<input type="hidden" name="optional" value="'+response.package.seasons[0].modalities[i].id+'">'; 264 modality += '<div class="row">'; 265 modality += '<div class="col-lg-3">'; 266 modality += '<div class="form-group">'; 267 modality += '<label>'+traslation.details.activityDate+'</label>'; 268 modality += '<input class="form-control activityDate" type="date" name="activityDate" value="" onchange="switchPrice(this.value, '+type+', '+response.package.seasons[0].modalities[i].id+', '+i+')"/>'; 269 modality += '<div id="activityDateFeedback" class="input-feedback" style="display:none"></div>'; 270 modality += '</div>'; 271 modality += '</div>'; 272 modality += '<div class="col-lg-3">'; 273 modality += '<div class="form-group">'; 274 modality += '<label>'+traslation.details.adults+'</label>'; 275 modality += '<input class="form-control adults" type="'+type+'" name="adults" value="'+sessionAdults+'" '+disabled+'/>'; 276 modality += '<div id="adultsFeedback" class="input-feedback" style="display:none"></div>'; 277 modality += '</div>'; 278 modality += '</div>'; 279 modality += '<div class="col-lg-3">'; 280 modality += '<div class="form-group">'; 281 modality += '<label>'+traslation.details.childs+'</label>'; 282 modality += '<input class="form-control childs" type="'+type+'" name="childs" value="'+sessionChilds+'" '+disabled+'/>'; 283 modality += '<div id="childsFeedback" class="input-feedback" style="display:none"></div>'; 284 modality += '</div>'; 285 modality += '</div>'; 286 modality += '<div class="col-lg-3">'; 287 modality += '<div class="form-group">'; 288 modality += '<label>'+traslation.details.infants+'</label>'; 289 modality += '<input class="form-control infants" type="'+type+'" name="infants" value="'+sessionInfants+'" '+disabled+'/>'; 290 modality += '<div id="infantsFeedback" class="input-feedback" style="display:none"></div>'; 291 modality += '</div>'; 292 modality += '</div>'; 293 modality += '</div>'; 294 modality += '</form>'; 295 modality += '<ul class="nav nav-tabs" id="myTab'+response.package.seasons[0].modalities[i].id+'" role="tablist">'; 296 modality += '<li class="nav-item">'; 297 modality += '<a class="nav-link active" id="inclusions-tab'+response.package.seasons[0].modalities[i].id+'" data-bs-toggle="tab" href="#inclusions'+response.package.seasons[0].modalities[i].id+'" role="tab" aria-controls="inclusions'+response.package.seasons[0].modalities[i].id+'" aria-selected="true">'+traslation.details.includes+'</a>'; 298 modality += '</li>'; 299 modality += '<li class="nav-item">'; 300 modality += '<a class="nav-link" id="exclusions-tab'+response.package.seasons[0].modalities[i].id+'" data-bs-toggle="tab" href="#exclusions'+response.package.seasons[0].modalities[i].id+'" role="tab" aria-controls="exclusions'+response.package.seasons[0].modalities[i].id+'" aria-selected="false">'+traslation.details.excludes+'</a>'; 301 modality += '</li>'; 302 modality += '</ul>'; 303 modality += '<div class="tab-content p-3" id="myTabContent'+response.package.seasons[0].modalities[i].id+'">'; 304 modality += '<div class="tab-pane fade show active inclusions" id="inclusions'+response.package.seasons[0].modalities[i].id+'" class="inclusions role="tabpanel" aria-labelledby="inclusions-tab'+response.package.seasons[0].modalities[i].id+'">'; 305 //modality += '<ul>'; 306 307 if(response.package.seasons[0].modalities[i].inclusions != null) 308 { 309 for(j=0; j<response.package.seasons[0].modalities[i].inclusions.length; j++) 310 { 311 modality += '<li>'+response.package.seasons[0].modalities[i].inclusions[j]+'</li>'; 312 } 313 } 314 315 //modality += '</ul>'; 316 modality += '</div>'; 317 modality += '<div class="tab-pane fade exclusions" id="exclusions'+response.package.seasons[0].modalities[i].id+'" role="tabpanel" aria-labelledby="exclusions-tab'+response.package.seasons[0].modalities[i].id+'">'; 318 //modality += '<ul>'; 319 320 if(response.package.seasons[0].modalities[i].exclusions != null) 321 { 322 for(j=0; j<response.package.seasons[0].modalities[i].exclusions.length; j++) 323 { 324 modality += '<li>'+response.package.seasons[0].modalities[i].exclusions[j]+'</li>'; 325 } 326 } 327 328 //modality += '</ul>'; 329 modality += '</div>'; 330 modality += '</div>'; 331 332 var priceSet = currency == 'ARS' ? new I
332ntl.NumberFormat('de-DE', {currency: 'ARS', style: 'currency'}).format(response.package.seasons[0].modalities[i].rates.adult) : new Intl.NumberFormat('en-US', {currency: 'USD', style: 'currency'}).format(response.package.seasons[0].modalities[i].rates.adult); 333 priceSet = priceSet.replace("ARS", ""); 334 priceSet = priceSet.replace("$", ""); 335 336 var pricePerText = promotion === null ? traslation.details.pricePerPerson : traslation.details.pricePerFamilyGroup; 337 338 var texts = { 339 promotion: promotion, 340 adults: promotion !== null ? traslation.details.pricePerFamilyGroup : traslation.details.pricePer+' '+traslation.details.adults, 341 childs: traslation.details.pricePer+' '+traslation.details.childs, 342 infants: traslation.details.pricePer+' '+traslation.details.infants, 343 } 344 345 setPricePerText(texts); 346 347 modality += '</div>'; 348 modality += '<div class="col-md-3 text-center">'; 349 modality += '<h6>'+pricePerText+'</h6>'; 350 modality += '<h4><span class="currency'+i+'">'+currency+'</span> <span class="price'+i+'">'+priceSet+'</span></h4>'; 351 modality += '<a class="btn btn-secondary" onclick="validatePurchase('+response.package.id+','+response.package.seasons[0].modalities[i].id+')">'+traslation.details.purchase+'</a>'; 352 modality += '</div>'; 353 modality += '</div>'; 354 modality += '</div>'; 355 modality += '</div>'; 356 357 // modalities.append(modality); 358 } 359 } 360 361 var operationDates = response.package.seasons[0].operationDates; 362 363 $.each(response.package.seasons, function(key, value) 364 { 365 if(key > 0) 366 { 367 for(i=0; i<value.operationDates.length; i++) 368 { 369 operationDates.push(value.operationDates[i]); 370 } 371 } 372 }); 373 374 $('.datepicker').datepicker( 375 { 376 format: 'yyyy-mm-dd', 377 language: traslation.code, 378 beforeShowDay: function(date) 379 { 380 var month = (date.getMonth() + 1).toString().padStart(2, "0"); 381 var day = date.getDate().toString().padStart(2, "0"); 382 383 if ($.inArray(date.getFullYear() + '-' + (month) + '-' + day, operationDates) !== -1) 384 { 385 return; 386 } 387 388 return false; 389 } 390 } 391 ); 392 393 indicators.html(''); 394 inners.html(''); 395 highlights.html(''); 396 inclusions.html(''); 397 exclusions.html(''); 398 399 if(images != null) 400 { 401 for(i=0; i<images.length; i++) 402 { 403 if(i == 1) 404 { 405 active = 'active'; 406 } 407 else 408 { 409 active = ''; 410 } 411 412 if(i == 5) 413 { 414 break; 415 } 416 417 indicator = '<button type="button" data-bs-target="#MyCarousel" data-bs-slide-to="'+i+'" class="'+active+'" aria-label="Slide '+(i+1)+'"></button>'; 418 419 inner = '<div class="carousel-item '+active+'">'; 420 inner += '<img src="'+images[i]+'" class="d-block w-100" alt="..." style="height:400px">'; 421 inner += '</div>'; 422 423 indicators.append(indicator); 424 inners.append(inner); 425 } 426 427 if(indicators.children().length > 0) { indicators.children()[0].click(); } 428 } 429 430 if(response.package.highlights != null) 431 { 432 for(i=0; i<response.package.highlights.length; i++) 433 { 434 highlight += '<li>'+response.package.highlights[i]+'</li>'; 435 436 if(i == 3) 437 { 438 shortHighlights = highlight; 439 } 440 } 441 442 longHighlights = highlight; 443 444 param = "'highlights'"; 445 highlights.html(shortHighlights+'<a href="javascript:;" class="btn btn-link" onclick="switchLength('+param+')">'+traslation.details.seeMore+'</a>'); 446 highlights.addClass('short'); 447 } 448 449 if(response.package.inclusions != null) 450 { 451 for(i=0; i<response.package.inclusions.length; i++) 452 { 453 inclusion = '<li>'+response.package.inclusions[i]+'</li>'; 454 455 inclusions.append(inclusion); 456 } 457 } 458 459 if(response.package.exclusions != null) 460 { 461 for(i=0; i<response.package.exclusions.length; i++) 462 { 463 exclusion = '<li>'+response.package.exclusions[i]+'</li>'; 464 465 exclusions.append(exclusion); 466 } 467 } 468 469 $(tab.children()[0]).children().click(); 470 471 var activityDate = $('.activityDate'); 472 var adults = $('.adults'); 473 var childs = $('.childs'); 474 var infants = $('.infants'); 475 476 if(adults != null) 477 { 478 for(i=0; i<adults.length; i++) 479 { 480 $(adults[i]).attr('min', response.package.minPax); 481 $(adults[i]).attr('max', response.package.maxPax); 482 } 483 } 484 485 if(childs != null) 486 { 487 for(i=0; i<childs.length; i++) 488 { 489 $(childs[i]).attr('min', response.package.minPax); 490 $(childs[i]).attr('max', response.package.maxPax); 491 } 492 } 493 494 if(infants != null) 495 { 496 for(i=0; i<infants.length; i++) 497 { 498 $(infants[i]).attr('min', response.package.minPax); 499 $(infants[i]).attr('max', response.package.maxPax); 500 } 501 } 502 503 var firstSeason = 0; 504 var lastSeason = response.package.seasons.length - parseInt(1); 505 506 var date = new Date(); 507 508 var year = date.getFullYear();
509 var month = date.getMonth()+1; 510 var day = date.getDate(); 511 512 if(parseInt(month) < 10) 513 { 514 month = '0' + month; 515 } 516 517 if(day < 10) 518 { 519 day = '0' + day; 520 } 521 522 var today = year + "-" + month + "-" + day; 523 524 var dateWasAssigned = false; 525 526 if(activityDate != null) 527 { 528 for(i=0; i<activityDate.length; i++) 529 { 530 $(activityDate[i]).attr('min', response.package.seasons[firstSeason].from); 531 $(activityDate[i]).attr('max', response.package.seasons[lastSeason].to); 532 533 if(assignedDate != '') 534 { 535 if(assignedDate >= response.package.seasons[firstSeason].from && assignedDate <= response.package.seasons[lastSeason].to) 536 { 537 dateWasAssigned = true; 538 539 $(activityDate[i]).attr('value', assignedDate); 540 } 541 else if(today >= response.package.seasons[firstSeason].from && today <= response.package.seasons[lastSeason].to) 542 { 543 $(activityDate[i]).attr('value', today); 544 } 545 else 546 { 547 $(activityDate[i]).attr('value', response.package.seasons[firstSeason].from); 548 } 549 } 550 else if(today >= response.package.seasons[firstSeason].from && today <= response.package.seasons[lastSeason].to) 551 { 552 $(activityDate[i]).attr('value', today); 553 } 554 else 555 { 556 $(activityDate[i]).attr('value', response.package.seasons[firstSeason].from); 557 } 558 } 559 560 switchPrice(assignedDate, 'season'); 561 562 if(response.package.seasons.modalities != null) 563 { 564 for(i=0; i<response.package.seasons[0].modalities.length; i++) 565 { 566 switchPrice(assignedDate, 'modality', response.package.seasons[0].modalities[i].id, i); 567 } 568 } 569 } 570 571 Swal.closeModal(); 572 573 if(promotion === null) 574 { 575 modal.modal('show'); 576 } 577 else 578 { 579 (async () => { 580 try 581 { 582 var optionalDetail = new OptionalDetail('optional'); 583 584 await optionalDetail.generate(response.package, promotion); 585 586 var operationDates = response.package.seasons[0].operationDates; 587 588 $.each(response.package.seasons, function(key, value) 589 { 590 if(key > 0) 591 { 592 for(i=0; i<value.operationDates.length; i++) 593 { 594 operationDates.push(value.operationDates[i]); 595 } 596 } 597 }); 598 console.log(operationDates); 599 $('.datepicker').datepicker( 600 { 601 format: 'yyyy-mm-dd', 602 language: traslation.code, 603 beforeShowDay: function(date) 604 { 605 var month = (date.getMonth() + 1).toString().padStart(2, "0"); 606 var day = date.getDate().toString().padStart(2, "0"); 607 608 if ($.inArray(date.getFullYear() + '-' + (month) + '-' + day, operationDates) !== -1) 609 { 610 return; 611 } 612 613 return false; 614 } 615 }); 616 617 var scheduleInputs = $('[name="schedule"]'); 618 619 if(scheduleInputs.length > 0) 620 { 621 for(var i=0; i<scheduleInputs.length; i++) 622 { 623 var form = $(scheduleInputs[i]).parent().parent().parent().parent().attr('id'); 624 625 // instance.showPickups(scheduleInputs[i].value, `#${form}`); 626 } 627 } 628 } 629 catch (error) 630 { 631 console.log(error); 632 } 633 })(); 634 } 635 636 if(assignedDate != '' && dateWasAssigned == false) 637 { 638 Swal.fire({ 639 icon: 'warning',
640 title: traslation.details.swal.dateWasntAssigned.text, 641 text: '' 642 }); 643 } 644 } 645 else 646 { 647 Swal.fire({ 648 icon: 'error', 649 title: response.swal ? response.swal.title : traslation.swal.error.title, 650 text: response.swal ? response.swal.text : traslation.swal.error.text, 651 }); 652 } 653 }, 654 error: function (jqXHR, textStatus, errorThrown) 655 { 656 Swal.fire({ 657 icon: traslation.swal.error.icon, 658 title: traslation.swal.error.title, 659 text: traslation.swal.error.text, 660 }); 661 } 662 }); 663} 664 665function switchLength(type) 666{ 667 if(type == 'description') 668 { 669 var element = $('#description'); 670 var long = longDescription; 671 var short = shortDescription; 672 var param = "'description'"; 673 } 674 else if(type == 'highlights') 675 { 676 var element = $('#highlights'); 677 var long = longHighlights; 678 var short = shortHighlights; 679 var param = "'highlights'"; 680 } 681 682 element.hide('fast'); 683 684 if(element.hasClass('short')) 685 { 686 element.html(long+'<a href="javascript:;" class="btn btn-link" onclick="switchLength('+param+')">'+traslation.details.seeLess+'</a>'); 687 element.removeClass('short'); 688 element.addClass('long'); 689 } 690 else 691 { 692 element.html(short+'<a href="javascript:;" class="btn btn-link" onclick="switchLength('+param+')">'+traslation.details.seeMore+'</a>'); 693 element.removeClass('long'); 694 element.addClass('short'); 695 } 696 697 element.show('fast'); 698} 699 700function switchPrice(date, type, id = '', position = '') 701{ 702 date = "'"+date+"'"; 703 704 var seasons = packageSeasons; 705 var price = new Object 706 var from = ""; 707 var to = ""; 708 709 if(type == 'season') 710 { 711 var price = $('.price'); 712 var priceAdults = $('.priceAdults'); 713 var priceChilds = $('.priceChilds'); 714 var priceInfants = $('.priceInfants'); 715 } 716 else if(type == 'modality') 717 { 718 if(position == '') 719 { 720 position = 0; 721 } 722 723 price = $('.price'+position); 724 } 725 726 if(seasons != null) 727 { 728 for(i=0; i<seasons.length; i++) 729 { 730 from = "'"+seasons[i].from+"'"; 731 to = "'"+seasons[i].to+"'"; 732 733 if(date >= from && date <= to) 734 { 735 if(type == 'season') 736 { 737 var priceSet = 0; 738 739 for (const key in seasons[i].rates) { 740 priceSet = sessionStorage.getItem('currency') == 'ARS' ? new Intl.NumberFormat('de-DE', {currency: 'ARS', style: 'currency'}).format(seasons[i].rates[key]) : new Intl.NumberFormat('en-US', {currency: 'USD', style: 'currency'}).format(seasons[i].rates[key]); 741 priceSet = priceSet.replace("ARS", ""); 742 priceSet = priceSet.replace("$", ""); 743 744 switch (key) { 745 case 'child': 746 priceChilds.text(priceSet); 747 break; 748 case 'infant': 749 priceInfants.text(priceSet); 750 break; 751 752 default: 753 priceAdults.text(priceSet); 754 price.text(priceSet); 755 break; 756 } 757 } 758 } 759 else if(type == 'modality') 760 { 761 if(seasons[i].modalities != null) 762 { 763 for(j=0; j<seasons[i].modalities.length; j++) 764 { 765 if(seasons[i].modalities[j].id == id) 766 { 767 var priceSet = sessionStorage.getItem('currency') == 'ARS' ? new Intl.NumberFormat('de-DE', {currency: 'ARS', style: 'currency'}).format(seasons[i].modalities[j].rates.adult) : new Intl.NumberFormat('en-US', {currency: 'USD', style: 'currency'}).format(seasons[i].modalities[j].rates.adult); 768 priceSet = priceSet.replace("ARS", ""); 769 priceSet = priceSet.replace("$", ""); 770 771 price.text(priceSet); 772 773 break; 774 } 775 } 776 } 777 } 778 779 break; 780 } 781 } 782 } 783} 784 785function validatePurchase(packageId, optionalId = "") 786{ 787 if(optionalId != "") 788 { 789 var form = '#modality'+optionalId+'Form'; 790 } 791 else 792 { 793 var form = '#baseForm'; 794 } 795 796 resetErrors(form); 797 798 $.ajax({
799 url : "?controller=services&action=validate", 800 type: "POST", 801 data: $(form).serialize(), 802 dataType: "JSON", 803 success: function(response) 804 { 805 if(response.status) 806 { 807 purchase(packageId, optionalId); 808 } 809 else 810 { 811 if(response.method == 'formValidation') 812 { 813 showErrors(form, response.validation, true); 814 } 815 } 816 }, 817 error: function (jqXHR, textStatus, errorThrown) 818 { 819 Swal.fire({ 820 icon: traslation.swal.error.icon, 821 title: traslation.swal.error.title, 822 text: traslation.swal.error.text, 823 }); 824 } 825 }); 826} 827 828function purchase(packageId, optionalId = "") 829{ 830 if(optionalId != "") 831 { 832 var form = '#modality'+optionalId+'Form'; 833 var value = 'modality'+optionalId+'Form'; 834 } 835 else 836 { 837 var form = '#baseForm'; 838 var value = 'baseForm'; 839 } 840 841 Swal.fire({ 842 title: traslation.swal.loading.text, 843 }); 844 Swal.showLoading(); 845 846 $.ajax({
847 url : "?controller=cart&action=insert", 848 type: "POST", 849 data: $(form).serialize(), 850 dataType: "JSON", 851 success: function(response) 852 { 853 if(response.status) 854 { 855 $.each(response.session, function(key, value) 856 { 857 sessionStorage.setItem(key, value); 858 }); 859 860 const tickets = [ 861 17567, 862 17169, 863 17170, 864 17432, 865 17433, 866 17434, 867 16623, 868 17059, 869 17060 870 ]; 871 872 if(jQuery.inArray(packageId, tickets) != -1) 873 { 874 $(location).attr('href','index.php?controller=checkout'); 875 } 876 else 877 { 878 $(location).attr('href','index.php?controller=checkoutOptional'); 879 } 880 } 881 else 882 { 883 Swal.fire({ 884 icon: response.swal.icon, 885 title: response.swal.text 886 }); 887 } 888 }, 889 error: function (jqXHR, textStatus, errorThrown) 890 { 891 Swal.fire({ 892 icon: traslation.swal.error.icon, 893 title: traslation.swal.error.title, 894 text: traslation.swal.error.text, 895 }); 896 } 897 }); 898} 899 900function checkForm(attr, value) 901{ 902 var invalidClass = 'is-invalid'; 903 var validClass = 'is-valid'; 904 905 switch(attr) 906 { 907 case 'name': 908 var form = $('[name="'+value+'"]'); 909 break; 910 case 'class': 911 var form = $('.'+value); 912 break; 913 case 'id': 914 var form = $('#'+value); 915 break; 916 } 917 918 var inputs = form.find('input'); 919 var selects = form.find('select'); 920 var textareas = form.find('textarea'); 921 var feedbacks = form.find('.input-feedback'); 922 var controls; 923 924 if(inputs != null) 925 { 926 controls = inputs; 927 } 928 929 if(selects != null) 930 { 931 controls = $.merge(controls, selects); 932 } 933 934 if(textareas != null) 935 { 936 controls = $.merge(controls, textareas); 937 } 938 939 if(controls != null) 940 { 941 var control = ''; 942 var notAllowedControls = [ 943 'submit', 944 'reset' 945 ]; 946 var emptyControls = new Array; 947 948 controls.removeClass(invalidClass); 949 controls.removeClass(validClass); 950 feedbacks.removeClass('invalid-feedback') 951 feedbacks.hide(0); 952 953 for(i=0; i<controls.length; i++) 954 { 955 control = $(controls[i]); 956 957 if($.inArray(control.attr('type'), notAllowedControls) == -1) 958 { 959 if(control.is(":visible")) 960 { 961 if(validateEmpty(control.val())) 962 { 963 var name = control.attr('name'); 964 name = name.replace(/\[/g, ''); 965 name = name.replace(/\]/g, ''); 966 967 $('[name="'+control.attr('name')+'"]').addClass(invalidClass); 968 $('#'+name+'Feedback').addClass('invalid-feedback'); 969 $('#'+name+'Feedback').text('Campo requerido'); 970 $('#'+name+'Feedback').show(0); 971 972 emptyControls.push(control.attr('name')); 973 } 974 } 975 } 976 } 977 978 /*if($.inArray(control.attr('type'), notAllowedControls) == -1) 979 { if(control.is(":visible")) 980 { 981 if(control.attr('type') == 'checkbox') 982 { 983 if(!control.prop('checked')) 984 { 985 emptyControls.push(control.attr('name')); 986 } 987 } 988 else 989 { 990 if(control.val() == '' || control.val() == undefined || control.val() == null) 991 {
992 emptyControls.push(control.attr('name')); 993 } 994 else 995 { 996 control.addClass(validClass); 997 } 998 } 999 } 1000 }*/ 1001 1002 if(emptyControls != null) 1003 { 1004 $('[name="'+emptyControls[0]+'"]').focus(); 1005 1006 $('html,body').animate({ 1007 scrollTop: $('[name="'+emptyControls[0]+'"]').offset().top - 125 1008 }, 1000) 1009 1010 return false; 1011 } 1012 1013 controls.removeClass(validClass); 1014 1015 return true; 1016 } 1017}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.