1 2 3 Number.prototype.format = function (n, x, s, c) { 4 var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')', 5 num = this.toFixed(Math.max(0, ~~n)); 6 7 return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ',')); 8}; 9String.prototype.format = function (n, x) { 10 var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\.' : '$') + ')'; 11 number = this * 1; 12 return number.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&,'); 13}; 14 15 16var gallery_fitxa = false; 17 18$(function () { 19 20 $("#filtres_shop_phone").click(function (e) { 21 e.stopPropagation(); 22 e.preventDefault(); 23 24 // $("#content_filtres").toggleClass("actiu"); 25 26 // $('#content_carro_lateral').magnificPopup({ // use it here 27 // type: 'inline', 28 // modal: false 29 // }); 30 31 $.magnificPopup.open({ 32 items: { 33 src: '#content_filtres' 34 }, 35 type: 'inline' 36 }); 37 38 }); 39 40 41 // $("#filtres_shop_phone").click(function (e) { 42 // e.preventDefault(); 43 44 // $(".menu_lat_categories").toggleClass("actiu"); 45 46 // }); 47 48 49 /*if($('.gallery_popup').length) 50 $('.gallery_popup').cycle();*/ 51 52 53 54 $(".owl-slide-home").owlCarousel({ 55 dots: true, 56 slideSpeed: 300, 57 pagination: true, 58 paginationSpeed: 400, 59 items: 1, 60 rewindSpeed: 500, 61 autoplay: true, 62 autoplayTimeout: 8000, 63 autoplayHoverPause: true, 64 mouseDrag: false, 65 loop: true, 66 nav: true, 67 navText: ['<i class="fa-light fa-angle-left"></i>', '<i class="fa-light fa-angle-right"></i>'] 68 }); 69 70 $(".owl-categories-home").owlCarousel({ 71 //items: 5, 72 autoplay: true, 73 autoplayTimeout: 8000, 74 loop: true, 75 center: true, 76 margin: 0, 77 URLhashListener:true, 78 autoplayHoverPause:true, 79 startPosition: 'URLHash', 80 smartSpeed : 750, 81 dots: true, 82 nav: true, 83 navText: ['<i class="fa-solid fa-angle-left"></i>', '<i class="fa-solid fa-angle-right"></i>'], 84 responsiveClass: true, 85 responsive: { 86 0: { 87 items: 1 88 }, 89 580: { 90 items: 2 91 }, 92 700: { 93 items: 3 94 }, 95 1100: { 96 items: 5, 97 nav: true 98 } 99 }, 100 }); 101 /* 102 $("#slide_home,#slide_home_mobile").owlCarousel({ 103 dots: true, 104 slideSpeed : 300, 105 pagination: true, 106 paginationSpeed : 400, 107 items: 1, 108 rewindSpeed: 500, 109 autoplay:true, 110 autoplayTimeout: 8000, 111 autoplayHoverPause: true, 112 mouseDrag:false, 113 loop:true, 114 nav: true, 115 navText: ['<i class="fa-solid fa-angle-left"></i>','<i class="fa-solid fa-angle-right"></i>'] 116 }); 117 */ 118 $(".owl-destacats").owlCarousel({ 119 nav: true, 120 navText: ["<i class='fa-solid fa-angle-left'></i>", "<i class='fa-solid fa-angle-right'></i>"], 121 slideSpeed: 300, 122 dots: false, 123 pagination: true, 124 paginationSpeed: 400, 125 rewindSpeed: 500, 126 autoplay: false, 127 autoplaySpeed: 600, 128 autoplayTimeout: 5000, 129 mouseDrag: false, 130 loop: false, 131 responsiveClass: true, 132 responsive: { 133 0: { 134 items: 2 135 }, 136 580: { 137 items: 2 138 }, 139 700: { 140 items: 4 141 }, 142 1100: { 143 items: 5 144 } 145 }, 146 margin:0, 147 onInitialized: function (event) { 148 console.log(event); 149 } 150 }); 151 152 $(".owl-promocions").owlCarousel({ 153 nav: true, 154 navText: ["<i class='fa-solid fa-angle-left'></i>", "<i class='fa-solid fa-angle-right'></i>"], 155 slideSpeed: 300, 156 dots: false, 157 pagination: true, 158 paginationSpeed: 400, 159 rewindSpeed: 500, 160 autoplay: false, 161 autoplaySpeed: 600, 162 autoplayTimeout: 5000, 163 mouseDrag: false, 164 loop: true, 165 responsiveClass: true, 166 responsive: { 167 0: { 168 items: 1 169 }, 170 580: { 171 items: 1 172 }, 173 700: { 174 items: 2 175 }, 176 1100: { 177 items: 3 178 } 179 }, 180 margin: 20, 181 onInitialized: function (event) { 182 console.log(event); 183 } 184 }); 185 186 $(".owl-slide-petit").owlCarousel({ 187 navigation: true, 188 slideSpeed: 300, 189 pagination: true, 190 paginationSpeed: 400, 191 items: 1, 192 rewindSpeed: 500, 193 autoplay: true, 194 autoplaySpeed: 600, 195 autoplayTimeout: 8000, 196 mouseDrag: false, 197 loop: true 198 }); 199 200 $(".owl-miniatures").owlCarousel({ 201 dots: false, 202 slideSpeed: 300, 203 pagination: true, 204 paginationSpeed: 400, 205 items: 4, 206 rewindSpeed: 500, 207 autoplay: false, 208 autoHeight: true, 209 autoplayTimeout: 5000, 210 autoplayHoverPause: true, 211 mouseDrag: false, 212 loop: false, 213 nav: true, 214 navText: ['<i class="fa-solid fa-angle-left"></i>', '<i class="fa-solid fa-angle-right"></i>'], 215 responsiveClass: true, 216 responsive: { 217 0: { 218 items: 2, 219 }, 220 600: { 221 items: 4, 222 }, 223 1000: { 224 items: 4 225 } 226 } 227 }); 228 229 230 231 AOS.init({ 232 duration: 1000, 233 easing: 'ease-in-out-sine', 234 disable: 'phone', 235 once: false, // whether animation should happen only once - while scrolling down 236 mirror: true, 237 debounceDelay: 50 238 239 }); 240 241 document.querySelectorAll('img') 242 .forEach((img) => 243 img.addEventListener('load', () => 244 AOS.refresh() 245 ) 246 ); 247 248 249 250 //if ($('.galeria_sarticle').length) { 251 252 gallery_fitxa = $(".gallery_popup"); 253 254 gallery_fitxa.owlCarousel({ 255 dots: false, 256 slideSpeed: 300, 257 pagination: true, 258 paginationSpeed: 400, 259 items: 1, 260 rewindSpeed: 500, 261 autoplay: false, 262 mouseDrag: false, 263 loop: true, 264 onTranslated: function () { 265 //setTimeout(function () { carrega_zoom($('.gallery_popup .owl-item.active img')), 500 }) 266 267 }, 268 onInitialized: function () { 269 $(".gallery_popup .owl-item").addClass("not_cloned"); 270 $(".gallery_popup .owl-item.cloned").removeClass("not_cloned"); 271 272 gallery_fitxa.magnificPopup({ 273 delegate: '.not_cloned a', // the selector for gallery item 274 type: 'image', 275 gallery: { 276 enabled: true 277 } 278 }); 279 } 280 }); 281 282 283 284 285 286 $('.galeria_sarticle #prev').click(function () { 287 $("#adv-custom-pager > div").animate({ scrollTop: "-=135" }); 288 }) 289 290 $('.galeria_sarticle #next').click(function () { 291 $("#adv-custom-pager > div").animate({ scrollTop: "+=135" }); 292 }) 293 294 // $('.galeria_sarticle #adv-custom-pager img').click(function () { 295 // setTimeout(function () { carrega_zoom($('.galeria_sarticle .cycle-slide-active')), 500 }) 296 // }); 297 //} 298 299 300 301 302 $(".galeria_popup").each(function () { 303 304 $(this).magnificPopup({ 305 delegate: 'a', // the selector for gallery item 306 type: 'image', 307 gallery: { 308 enabled: true 309 } 310 }); 311 312 }); 313 314 if (error_page != '') { 315 $.magnificPopup.open({ 316 items: { 317 src: '<div class="white-popup">' + error_page + '</div>', 318 type: 'inline' 319 } 320 }); 321 } 322 323 $('.link_lightbox').magnificPopup({ 324 type: 'inline', 325 mainClass: 'mfp-img-mobile', 326 midClick: true 327 }); 328 329 $('.ajax-popup-generic').magnificPopup({ 330 closeOnContentClick: false, 331 type: 'ajax', 332 }); 333 334 $(".galeriaV2").magnificPopup({ 335 delegate: 'a', // the selector for gallery item
336 type: 'image', 337 gallery: { 338 enabled: true 339 } 340 }); 341 342 $(".galeriaMovilV2").magnificPopup({ 343 delegate: 'a', // the selector for gallery item 344 type: 'image', 345 gallery: { 346 enabled: true 347 } 348 }); 349 350 $("#menu a").click(function (e) { 351 if ($(window).width() <= mida_mobile) { 352 event.preventDefault(); 353 354 355 var id = $(this).data('id'); 356 357 if ($("#submenu_" + id).length > 0) 358 $("#submenu_" + id).addClass('active'); 359 else 360 document.location = $(this).attr('href'); 361 } 362 }); 363 364 365 366 $(window).scroll(function () { 367 if ($(window).width() > 1100) { 368 if ($(document).scrollTop() > 300) { 369 $("#scroll_top").fadeIn(250); 370 } 371 else { 372 $("#scroll_top").fadeOut(250); 373 } 374 } 375 }); 376 377 $("#scroll_top").click(function () { 378 $('html,body').animate({ scrollTop: 0 }, 'fast'); 379 }); 380 381 382 /* --- Codi especific per la capcalera de gran jonquera --- */ 383 $(window).scroll(function() { 384 if ($(window).scrollTop() >= 150) { 385 $('header').addClass('scroll'); 386 } else { 387 $('header').removeClass('scroll'); 388 } 389 }); 390 /* --- Fi codi especific per la capcalera de gran jonquera --- */ 391 392 $("#boto_form_buscador_capcalera").on('click', function(event) { 393 event.preventDefault(); // Evita el comportamiento predeterminado 394 text_cerca = $("#text_buscador_capcalera").val(); 395 id_llistat_botigues = $("#id_llistat_botigues").val(); 396 397 filtra_botigues_lletra(id_llistat_botigues,text_cerca,1); 398 }); 399 400}); 401 402 403/* --- Inici funcions per Gran Jonquera --- */ 404function filtra_botigues_per_text() { 405 e.preventDefault(); 406 text_cerca = $("#text_buscador_capcalera").val(); 407 id_llistat_botigues = $("#id_llistat_botigues").val(); 408 409 filtra_botigues_lletra(id_llistat_botigues,text_cerca,1); 410} 411 412function filtra_botigues_lletra(id_llistat_botigues, lletra, tipus_cerca) { 413 $("#llistat_botigues").html( 414 '<div class="caixa_sense_resultats" align="center"><div class="loader">Loading...</div></div>' 415 ); 416 417 $.ajax({ 418 url: apps_url, 419 data: { 420 action: "p", 421 p: "files/public/php/functions.php", 422 m: "filtra_botigues_lletra", 423 id_llistat_botigues: id_llistat_botigues, 424 lletra: lletra, 425 tipus_cerca: tipus_cerca 426 }, 427 428 success: function (data) { 429 //console.log(data); 430 $(".single_llistat_lletra").removeClass("lletra_activa"); 431 $("#val_lletra_cercador_"+lletra).addClass("lletra_activa"); 432 433 $("#llistat_botigues").html(data); 434 //var data_selected = $("#data_selected_" + id_event).val(); 435 //$(".dia_" + data_selected).addClass("dia_selected"); 436 }, 437 }); 438} 439function activa_filtre(classe_filtre) { 440 if(classe_filtre == 1) { 441 $('#caixa_filtres_lletra').removeClass('mostra'); 442 $('#caixa_filtres_categories').addClass('mostra'); 443 444 $('#titol_filtre_gj_1').addClass('actiu'); 445 $('#titol_filtre_gj_2').removeClass('actiu'); 446 } else { 447 $('#caixa_filtres_categories').removeClass('mostra'); 448 $('#caixa_filtres_lletra').addClass('mostra'); 449 450 $('#titol_filtre_gj_2').addClass('actiu'); 451 $('#titol_filtre_gj_1').removeClass('actiu'); 452 } 453} 454function filtra_activitat(id_valor_tipus, id_item) { 455 $("#llistat_activitats").html( 456 '<div class="caixa_sense_resultats" align="center"><div class="loader">Loading...</div></div>' 457 ); 458 459 $.ajax({ 460 url: apps_url, 461 data: { 462 action: "p", 463 p: "files/public/php/functions.php", 464 m: "filtra_activitat", 465 id_item: id_item, 466 id_valor_tipus: id_valor_tipus 467 }, 468 469 success: function (data) { 470 //console.log(data); 471 $(".single_llistat_tipus_activitat").removeClass("activa"); 472 $("#val_tipus_activitat_"+id_valor_tipus).addClass("activa"); 473 474 $("#llistat_activitats").html(data); 475 //var data_selected = $("#data_selected_" + id_event).val(); 476 //$(".dia_" + data_selected).addClass("dia_selected"); 477 }, 478 }); 479} 480 481function activaSubmenu(id_submenu) { 482 $("#submenu_"+id_submenu).toggleClass("submenuactiu"); 483} 484function toggle(id) { 485 $(id).slideToggle('fast'); 486} 487/* --- Fi funcions per Gran Jonquera --- */ 488 489function toggle_recerca() { 490 if ($(".camp-recerca").hasClass("active")) { 491 $(".camp-recerca").removeClass("active"); 492 } 493 else { 494 $(".camp-recerca").addClass("active"); 495 496 $(".camp-recerca input").focus(); 497 } 498 console.log('swap camp-recerca'); 499} 500 501function uploadFiles(event) { 502 files = event.target.files; 503 event.stopPropagation(); 504 event.preventDefault(); 505 506 var data = new FormData(); 507 $.each(files, function (key, value) { 508 509 if (value["type"] == 'image/jpeg' || value["type"] == 'image/png') 510 data.append(key, value); 511 else 512 alert("Invalid file extension"); 513 }); 514 515 data.append('action', 'p') 516 data.append('p', 'files/public/php/functions.php') 517 data.append('m', 'upload_tmp_files') 518 519 if (!$('input[type=file][multiple]').length) 520 $("#files").html(""); 521 522 $("#files").prepend('<div id="spinner" align="center"><i class="fa fa-spin fa-spinner" style="font-size: 30px; margin: 10px 0px;"></i></div>'); 523 524 $.ajax({ 525 url: apps_url + '?action=p&p=files/public/php/functions.php&m=upload_tmp_files', 526 type: 'POST', 527 data: data, 528 cache: false, 529 dataType: 'json', 530 processData: false, 531 contentType: false, 532 success: function (data, textStatus, jqXHR) { 533 $('input[type=file]').val(""); 534 if (typeof data.error === 'undefined') { 535 for (x in data['files']) { 536 537 continuar = true 538 539 if ($('.files_uploaded').length >= 3) 540 continuar = false;
541 542 543 if (continuar) { 544 $(".files_uploaded").each(function (index, element) { 545 if ($(this).val() == data['files'][x]['path']) 546 continuar = false; 547 }); 548 } 549 550 551 if (continuar) { 552 $("#files").append("<div aria-data='" + data['files'][x]['path'] + "' class='files_uploaded_label'> <a href='" + http_url + data['files'][x]['path'] + "' target='_blank'><img src='" + http_url + "foto.php?src=" + data['files'][x]['path'] + "&width=100&adjust=true' /><span>" + data['files'][x]['name'] + "</span></a> <a href='javascript:remove_file(\"" + data['files'][x]['path'] + "\")'><i class='fal fa-times'></i></a></div><input type='hidden' name='file[]' value='" + data['files'][x]['path'] + "' class='files_uploaded'>"); 553 } 554 } 555 556 557 } 558 else { 559 alert(data['error']); 560 } 561 562 $("#spinner").remove(); 563 564 }, 565 error: function (jqXHR, textStatus, errorThrown) { 566 // Handle errors here 567 console.log('ERRORS: ' + textStatus); 568 // STOP LOADING SPINNER 569 } 570 }); 571} 572 573function remove_file(valor) { 574 $(".files_uploaded").each(function (index, element) { 575 if ($(this).val() == valor) { 576 $(this).remove() 577 578 } 579 }); 580 $(".files_uploaded_label").each(function (index, element) { 581 if ($(this).attr("aria-data") == valor) { 582 $(this).remove() 583 584 } 585 }); 586} 587 588 589 590var carregant = false; 591function filtra_llistat_ajax(next) { 592 593 $("#result_articles").html('<div align="center"><div class="loader">Loading...</div></div>'); 594 595 $("#frm_limits .deleteable").remove(); 596 597 $(".list_caracs input:checked").each(function(){ 598 $("#frm_limits").append("<input class='deleteable' type='hidden' name='"+$(this).attr("name")+"' value='"+$(this).val()+"' />"); 599 }); 600 601 if (next) 602 $("html,body").animate({ scrollTop: 0 }, 600); 603 604 if (!next) 605 next = 0; 606 607 carregant = true; 608 $.get(apps_url + "?ajax=true&no_index=true&" + $("#frm_limits").seri
608alize() + "&next=" + next, function (data) { 609 carregant = false; 610 $("#result_articles").html(data); 611 }); 612 613} 614 615var pagina_inici = 0; 616function carrega_anteriors() { 617 if (pagina_inici > 0) { 618 carregant = true; 619 $("#list_productes").prepend('<div id="loader" align="center" style="width:100%;"><div class="loader"></div></div>'); 620 $.ajax({ 621 type: 'POST', 622 url: "?ajax=true&scroll=true&no_index=true&" + $("#frm_limits").serialize() + "&next=" + ((pagina_inici - 1) * limit), 623 success: function (response) { 624 $("#list_productes").prepend(response); 625 $("#loader").remove(); 626 carregant = false; 627 pagina_inici--; 628 629 if (!pagina_inici) 630 $("#boto_anteriors").remove(); 631 } 632 }); 633 } 634 else { 635 $("#boto_anteriors").remove(); 636 } 637 638} 639 640function toggle_columna_footer(id) { 641 $("#" + id).toggleClass("active"); 642} 643 644function toggle_menu() { 645 //$("#menu").toggleClass("active"); 646 $("#cap_menu_capcalera").toggleClass("show"); 647} 648 649function inicia_zoom() { 650 651 652 carrega_zoom($(".zoom.primer")); 653} 654 655function carrega_zoom(el) { 656 657 658 659 $('.zoomContainer').remove(); 660 661 if ($(window).width() >= mida_mobile) { 662 el.elevateZoom({ 663 664 cursor: "crosshair", 665 zoomWindowFadeIn: 500, 666 zoomWindowFadeOut: 750, 667 responsive: true, 668 }); 669 670 } 671} 672 673 674// CART 675 676function add_to_wishlist(id_article, t) { 677 el = $(".favorito_" + id_article); 678 $.getJSON(apps_url + "?action=p&p=files/public/php/functions.php&m=add_wishlist&id_article=" + id_article, function (data) { 679 if (data == "OK") { 680 display_error('<i class="fa-solid fa-check"></i> ' + lang_afegit_favoritos, "P"); 681 el.attr('onclick', 'remove_from_wishlist("' + id_article + '"' + (t ? ',false,this' : '') + ')').addClass('active'); 682 } else if (data == "id_existent") { 683 display_error('<i class="fas fa-times"></i> ' + lang_error_id_article_existent, "E"); 684 } else 685 display_error('<i class="fas fa-times"></i> ' + lang_error_peticio, "E"); 686 }) 687} 688 689function remove_from_wishlist(id_article, amagar, t) { 690 el = $(".favorito_" + id_article); 691 $.getJSON(apps_url + "?action=p&p=files/public/php/functions.php&m=remove_wishlist&id_article=" + id_article, function (data) { 692 if (data == "OK") { 693 display_error('<i class="fa-solid fa-check"></i> ' + lang_tret_favoritos, "p"); 694 el.attr('onclick', 'add_to_wishlist("' + id_article + '"' + (t ? ',this' : '') + ')').removeClass('active'); 695 if (amagar) { 696 console.log("amagar:" + id_article); 697 $("#article_" + id_article).fadeOut(300, function () { if (!$(".bloc_article:visible").length) { $("#no_deseos").show(); } }); 698 } 699 } 700 }) 701} 702 703var error_mostrat = false; 704var timeoutMissatge = null; 705function display_error(text, tipus) { 706 switch (tipus) { 707 case 'E': case 'e': 708 clase = "error"; 709 break; 710 case 'P': case 'p': 711 clase = "positiu"; 712 break; 713 default: 714 clase = "neutre"; 715 break; 716 } 717 if (text) { 718 if (!error_mostrat) { 719 $('body').prepend('<div id="displayedError" style=""></div>'); 720 error_mostrat = true; 721 } 722 $('#displayedError').stop(true, true); 723 $('#displayedError').removeClass("error"); 724 $('#displayedError').removeClass("positiu"); 725 $('#displayedError').removeClass("neutre"); 726 $('#displayedError').addClass(clase); 727 $('#displayedError').html(text); 728 $('#displayedError').css({ 'position': 'fixed', 'bottom': '0', 'left': '0', 'right': '0', 'z-index': '500' }); 729 clearTimeout(timeoutMissatge); 730 $('#displayedError').stop(true, true).css('display', 'none').slideDown(300, function () { 731 timeoutMissatge = setTimeout(function () { $('#displayedError').slideUp(300); }, 3000); 732 }); 733 } 734} 735 736 737function cart_afegir_article(id, qty) { 738 q = 1; 739 if (qty) 740 q = qty; 741 else { 742 if ($("#article_" + id).length) 743 q = $("#article_" + id).val() * 1; 744 } 745 746 747 q = parseInt(q); 748 749 if (q < 1 || isNaN(q)) { q = 1; } 750 751 752 if ($("#carro_petit").length > 0)
753 ajaxpage(apps_url + "?action=p&p=files/public/oneStepCart/cart_small.php&action_cart=add&unitats=" + q + "&id_subarticle=" + id + "&show_quick_view=1", "carro_petit"); 754 755} 756 757///////////// 758 759function ajaxpage(url, containerid, post_params, callback) { 760 try { 761 obj = $("#" + containerid); 762 if (obj.outerHeight() > 50) { 763 t = obj.offset().top; 764 l = obj.offset().left; 765 obj.prepend('<div id="capa_trans" style="z-index:99;position:absolute; top:' + t + ';left:' + l + ';width:' + obj.width() + 'px; height:' + obj.height() + 'px;" align="center"><div id="capa_loading" style="z-index:1;position:absolute;top:' + t + ';left:' + l + ';height:100%;width:' + obj.width() + 'px;background-color:rgba(255,255,255,.5) " align="center" ><br/><br/><i class="fa-regular fa-spin fa-spinner" style="font-size: 30px; color: #e94339;"></div></div>'); 766 } 767 //host=window.location.host; 768 //href=window.location.href.toString(); 769 //protocol=href.split(host)[0]; 770 url = url.replace(url.split("/")[2], window.location.host); 771 $.post(url, post_params, function (data) { obj.html(data); $("#capa_trans").remove(); }) 772 .done(function () { 773 if (callback) { 774 callback(); 775 } 776 }) 777 .always(function (data) { 778 $("#capa_trans").remove(); 779 }); 780 781 } 782 catch (e) { 783 custom_alert(e.message); 784 } 785} 786 787 788// FUNCIONS ÃREA CLIENT ------------------------------------------------------------------------------------------------------------------------------------------ 789 790function guardar_tornar() { 791 document.location = http_url + 'mi-cuenta/'; 792} 793 794function desplega_menu_area_client() { 795 algun_visible = true; 796 797 $("#desplegador_menu_area_client").toggleClass("mnu_selected"); 798 $("#desplegador_menu_meva_comanda").removeClass("mnu_selected"); 799 $("#desplegador_menu_compra_rapida").removeClass("mnu_selected"); 800 801 if ($(".menu_lat_admin").css("display") == "none") { 802 $(".menu_lat_admin").stop(true, true).slideToggle(200); 803 $("#carro_resum").stop(true, true).slideUp(200); 804 $("#seccio").stop(true, true).slideUp(200); 805 } 806 else { 807 $(".menu_lat_admin").stop(true, true).slideToggle(200); 808 } 809} 810 811function albara_print(id) { 812 window.open(apps_url + "?action=p&p=files/public/CLIENT/comandes_client.php&action_client=imprimir&id_albara=" + id); 813} 814 815function factura_print(id) { 816 window.open(apps_url + "?action=p&p=files/public/CLIENT/comandes_client.php&action_client=imprimir_factura&id_factura=" + id); 817} 818 819function v_albara(id) { 820 if ($('#detalls_alb_' + id).hasClass("opened")) { 821 $('#detalls_alb_' + id).html("").removeClass("opened"); 822 } 823 else { 824 $('#detalls_alb_' + id).addClass("opened").html('<div align="center"><i class="fa fa-spin fa-spinner" style="font-size: 30px; margin: 10px 0px;"></i></div>'); 825 $.post(apps_url + '?action=p&p=files/public/CLIENT/comandes_detalls_client.php&id_albara=' + id + '&no_index=true', function (data) { 826 $('#detalls_alb_' + id).html(data); 827 }); 828 } 829} 830 831function v_pedido(id) { 832 if ($('#detalls_ped_' + id).hasClass("opened")) { 833 $('#detalls_ped_' + id).html("").removeClass("opened"); 834 } 835 else { 836 $('#detalls_ped_' + id).addClass("opened").html('<div align="center"><i class="fa fa-spin fa-spinner" style="font-size: 30px; margin: 10px 0px;"></i></div>'); 837 $.post(apps_url + '?action=p&p=files/public/CLIENT/comandes_detalls_client.php&id_pedido=' + id + '&no_index=true', function (data) { 838 $('#detalls_ped_' + id).html(data); 839 }); 840 } 841} 842 843function v_pedido_call(id) { 844 if ($('#detalls_ped_' + id).html() == "") { 845 $.post(apps_url + '?action=p&p=files/public/CLIENT/comandes_detalls_client.php&id_pedido=' + id + '&no_index=true', function (data) { 846 $('#detalls_ped_' + id).html(data); 847 }); 848 } 849} 850 851function v_carro_pendent(sid) { 852 $('#detalls_carro_' + sid).html('<div align="center"><i class="fa fa-spin fa-spinner" style="font-size: 30px; margin: 10px 0px;"></i></div>'); 853 $.post(apps_url + '?action=p&p=files/public/CLIENT/carros_pendents_detalls.php&sid_carro=' + sid + '&no_index=true', function (data) { 854 $('#detalls_carro_' + sid).html(data); 855 }); 856} 857function v_carro_recuperar(sid) { 858 $('#detalls_carro_' + sid).html('<div align="center"><i class="fa fa-spin fa-spinner" style="font-size: 30px; margin: 10px 0px;"></i></div>'); 859 $.post(apps_url + '?action=p&p=files/public/CLIENT/carros_pendents_recuperar.php&sid_carro=' + sid + '&no_index=true', function (data) { 860 $('#detalls_carro_' + sid).html(data); 861 ajaxpage(apps_url + "?action=p&p=files/public/oneStepCart/cart_small.php", "carro_petit"); 862 }); 863} 864 865 866function recalcula_rels_devolucio(id) { 867 var qty_kit = $("#dev_unitats_" + id).val() * 1; 868 869 $(".rel_" + id).each(function () { 870 var qty_unitat = $(this).data('qty-unitat'); 871 var qty_final = qty_unitat * qty_kit; 872 873 $(this).html(qty_final); 874 }); 875 876} 877 878formatLlista = true; 879 880function toggleFormat() { 881 882 var productos = document.querySelectorAll(".bloc_article"); 883 var imagenes = document.querySelectorAll(".link_image"); 884 var pare = document.querySelector("#list_productes"); 885 var llistat = document.querySelectorAll(".llistat"); 886 var llistat2 = document.querySelectorAll(".llistat2"); 887 var pantalla = window.innerWidth; 888 var fotos_descs = document.querySelectorAll(".foto-desc1"); 889 var fotos_descs2 = document.querySelectorAll(".foto-desc2"); 890 var boto1 = document.querySelectorAll(".boto1"); 891 var boto2 = document.querySelectorAll(".boto2"); 892 console.log(productos) 893 894 formatLlista = !formatLlista; 895 896 // per passar a targetes 897 if (productos[0].classList.contains("flex-bloc")) { 898 productos.forEach(item => { 899 item.classList.remove("flex-bloc"); 900 if (pantalla < 1010) { 901 item.style.width = "50%"; 902 } else { 903 item.style.width = "25%"; 904 } 905 });
906 imagenes.forEach(item => { 907 item.classList.remove("quarter-width"); 908 }); 909 llistat2.forEach(item => { 910 item.classList.remove("llistat2") 911 item.classList.add("llistat"); 912 }); 913 fotos_descs2.forEach(item => { 914 item.classList.remove("foto-desc2") 915 item.classList.add("foto-desc1") 916 }) 917 boto2.forEach(item => { 918 item.classList.add("boto1") 919 item.classList.remove("boto2") 920 }) 921 boto1.forEach(item => { 922 item.classList.remove("boto1") 923 item.classList.add("boto2") 924 }) 925 } 926 //per passar a llistat 927 else { 928 productos.forEach(item => { 929 pare.style.width = ""; 930 item.classList.add("flex-bloc"); 931 item.style.width = "100%"; 932 933 }); 934 imagenes.forEach(item => { 935 item.classList.add("quarter-width"); 936 }); 937 llistat.forEach(item => { 938 item.classList.remove("llistat") 939 item.classList.add("llistat2"); 940 }); 941 fotos_descs.forEach(item => { 942 item.classList.remove("foto-desc1") 943 item.classList.add("foto-desc2") 944 }) 945 boto1.forEach(item => { 946 item.classList.remove("boto1") 947 item.classList.add("boto2") 948 }) 949 boto2.forEach(item => { 950 item.classList.add("boto1") 951 item.classList.remove("boto2") 952 }) 953 954 console.log(formatLlista); 955 } 956} 957function toggleFormatRecarregat() { 958 959 var productos = document.querySelectorAll(".bloc_article"); 960 var imagenes = document.querySelectorAll(".link_image"); 961 var pare = document.querySelector("#list_productes"); 962 var llistat = document.querySelectorAll(".llistat"); 963 var botonesTargetes = document.querySelectorAll('.class_targetes'); 964 var botonesLlistat = document.querySelectorAll('.class_llistat'); 965 var fotos_descs = document.querySelectorAll(".foto-desc1"); 966 console.log(productos) 967 968 formatLlista = !formatLlista; 969 970 productos.forEach(item => { 971 pare.style.width = ""; 972 item.classList.add("flex-bloc"); 973 item.style.width = "100%"; 974 975 }); 976 imagenes.forEach(item => { 977 item.classList.add("quarter-width"); 978 }); 979 console.log(formatLlista) 980 if (formatLlista) { 981 console.log("entra"); 982 botonesTargetes.forEach(item => { 983 item.classList.remove('boto2'); 984 item.classList.add('boto1'); 985 }); 986 botonesLlistat.forEach(item => { 987 item.classList.remove('boto1'); 988 item.classList.add('boto2'); 989 }); 990 llistat.forEach(item => { 991 item.classList.remove("llistat") 992 item.classList.add("llistat2"); 993 }); 994 fotos_descs.forEach(item => { 995 item.classList.remove("foto-desc1") 996 item.classList.add("foto-desc2") 997 }) 998 } 999} 1000 1001function open_popup_login(next_url) { 1002 $.magnificPopup.open({ 1003 mainClass: "mfp-fade", 1004 removalDelay: 160, 1005 items: { 1006 src: "#popup_login", 1007 type: "inline", 1008 }, 1009 callbacks: { 1010 open: function () { 1011 $("#next_url_login").val(next_url); 1012 }, 1013 close: function () { 1014 $("#error_login").html(""); 1015 $("#next_url_login").val(""); 1016 }, 1017 }, 1018 }); 1019} 1020 1021function comprova_kit(max_articles,min_articles,id_parent) { 1022 var kit_ok = false; 1023 var num_articles = 0; 1024 1025 $(".rel_venta_"+id_parent).removeClass('selected').each(function() { 1026 val = $(this).val() * 1; 1027 1028 if (isNaN(val) || val < 0) { 1029 val = 0; 1030 $(this).val(0); 1031 } 1032 1033 if (val > 0) 1034 $(this).addClass('selected'); 1035 1036 num_articles += $(this).val() * 1; 1037 }); 1038 1039 if (max_articles > 0 || min_articles > 0) { 1040 $(".rel_venta_"+id_parent).removeClass('disabled').prop('disabled', false); 1041 1042 var condicio_min_max = min_articles && max_articles && num_articles >= min_articles && num_articles <= max_articles; 1043 var condicio_max = max_articles && !min_articles && num_articles <= max_articles; 1044 var condicio_min = min_articles && !max_articles && num_articles >= min_articles; 1045 1046 if (condicio_min_max || condicio_max || condicio_min) { 1047 if (max_articles && num_articles >= max_articles) 1048 $(".rel_venta_"+id_parent+":not(.selected)").addClass('disabled').prop('disabled', true); 1049 1050 $("#btn_afegir_kit_"+id_parent).removeClass('disabled'); 1051 $("#btn_afegir_kit_"+id_parent).attr('href',"javascript:cart_afegir_kit("+id_parent+")"); 1052 1053 kit_ok = true; 1054 } else { 1055 $("#btn_afegir_kit_"+id_parent).addClass('disabled'); 1056 $("#btn_afegir_kit_"+id_parent).attr('href',"#"); 1057 } 1058 1059 1060 } else 1061 kit_ok = true; 1062 1063 $("#num_articles_rel_"+id_parent).html(num_articles); 1064 1065 return kit_ok; 1066} 1067 1068function cart_afegir_kit(id, serialize_ext = null) { 1069 if (comprova_kit()) { 1070 //var serialize_rel_ventas = $("#frm-rel-ventas").serialize() 1071 1072 //Comprovem si li hem pasat per parametre els valors serialitzats. 1073 if (!serialize_ext) { 1074 var serialize_rel_ventas = $("#frm_rel_ventas_" + id).serialize(); 1075 } else { 1076 var serialize_rel_ventas = serialize_ext; 1077 } 1078 console.log(serialize_rel_ventas); 1079 if ($("#carro_petit").length > 0) 1080 ajaxpage(apps_url + "?action=p&p=PUBLIC/oneStepCart/cart_small.php&action_cart=
1080add&unitats=1&id_subarticle=" + id + "&show_quick_view=1&" + serialize_rel_ventas + "&kit=true", "carro_petit"); 1081 console.log(apps_url + "?action=p&p=PUBLIC/oneStepCart/cart_small.php&action_cart=add&unitats=1&id_subarticle=" + id + "&show_quick_view=1&" + serialize_rel_ventas + "&kit=true"); 1082 } 1083} 1084 1085$(document).ready(function(){ 1086 1087 // Definim alçada del menu i de la pagina en funcio del que es necessiti i la resolucio 1088 var altura = $("#top_bar").innerHeight(); 1089 var alturaheader = $("header").innerHeight(); 1090 var altura_footer = $("footer").innerHeight(); 1091 $(".ghost_header").css("height", alturaheader+"px"); 1092 $("main").css("min-height", "calc(100% - "+(alturaheader+altura_footer)+"px)"); 1093 1094 // $('#content_slide_home img').height( $(window).height() - alturaheader); 1095 1096});
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.