{"version":3,"file":"product.js","mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA,CAAC","sources":["webpack://build/../vincishoes2/assets/javascripts/pages/product.js"],"sourcesContent":["const Product = {\n $sectionProduct: $(\"[data-section-product]\"),\n $wrapperImages: $(\"[data-section-product]\").find(\"[data-product-images]\"),\n $sliderProduct: $(\"[data-section-product]\").find(\n \"[data-product-images] [data-main-slider]\"\n ),\n $thumbsProduct: $(\"[data-section-product]\").find(\n \"[data-product-images] [data-slider-thumbs]\"\n ),\n sliderProduct: [],\n /* Exibe as primeiras imagens do produto ** Importante para quando houver imagem por sku** */\n showFirstImages: function () {\n var _this = this;\n var variants = JSON.parse(\n document.getElementById(\"vndajs\").dataset.variant\n );\n var $imagesWithoutSkus = _this.$sliderProduct.find(\".image-without-sku\");\n var $thumbsWithoutSkus = _this.$thumbsProduct.find(\".image-without-sku\");\n\n if ($imagesWithoutSkus.length > 0) {\n /* \n Todas as imagens sem skus são exibidas sempre\n */\n\n $imagesWithoutSkus.removeClass(\"inactive\").addClass(\"active\");\n\n $thumbsWithoutSkus.removeClass(\"inactive\").addClass(\"active\");\n } else {\n /* \n Percorre todas as variantes\n */\n for (var i = 0; i < variants.length; i++) {\n if (variants[i].main) {\n //console.info(variants[i]);\n\n // Procura a imagem que contém o sku e a exibe\n _this.$sliderProduct\n .find('[data-image][data-skus-image*=\"' + variants[i].sku + '\"]')\n .addClass(\"active\")\n .removeClass(\"inactive\");\n\n _this.$thumbsProduct\n .find(\n '[data-image-thumb][data-skus-image*=\"' + variants[i].sku + '\"]'\n )\n .addClass(\"active\")\n .removeClass(\"inactive\");\n }\n }\n }\n },\n setGallery: function () {\n var _this = this;\n var gallery = new Swiper(_this.$sliderProduct, {\n slidesPerView: 1,\n spaceBetween: 0,\n watchOverflow: true,\n autoHeight: true,\n simulateTouch: false,\n navigation: {\n nextEl: $(\".wrapper-slider\").find(\".swiper-button-next\"),\n prevEl: $(\".wrapper-slider\").find(\".swiper-button-prev\"),\n },\n pagination: {\n el: $(\".wrapper-slider\").find(\".swiper-pagination\"),\n type: \"bullets\",\n clickable: true,\n },\n });\n\n var galleryThumbs = new Swiper(_this.$thumbsProduct, {\n slidesPerView: 4,\n spaceBetween: 12,\n //watchOverflow: true,\n direction: \"vertical\",\n });\n\n this.sliderProduct.push(gallery);\n this.sliderProduct.push(galleryThumbs);\n\n $(\".image-thumb [data-slide-index] img\").on(\"click\", function () {\n gallery.slideTo($(this).parent().data(\"slide-index\") - 1);\n });\n },\n submitNotify: function () {\n $(document).on(\"submit\", \"[data-form-notify]\", function (event) {\n event.preventDefault();\n template_store.submitFormNotify($(this));\n });\n },\n setTabs: function () {\n $(\"[data-tab]\").on(\"click\", function () {\n //$('[data-tab]').removeClass('active')\n //$('[data-content]').removeClass('active')\n\n var el = '[data-content=\"' + $(this).data(\"tab\") + '\"]';\n\n //console.log(el);\n //console.log('sadasdasd')\n\n if ($(this).hasClass(\"active\")) {\n $(this).removeClass(\"active\");\n $(el).removeClass(\"active\");\n } else {\n $(this).addClass(\"active\");\n $(el).addClass(\"active\");\n }\n });\n },\n init: function () {\n // console.log('Product init called');\n var _this = this;\n\n template_store.setCarrosselProdutos();\n _this.showFirstImages();\n _this.setGallery();\n _this.submitNotify();\n _this.setTabs();\n\n $(document).on(\n \"submit\",\n store.config.selectorFormProduct,\n function (event) {\n event.preventDefault();\n\n var $form = $(this);\n var $parent = $form.closest(store.config.selectorWrapperProduct);\n\n //var $btnComprar = $parent.find(store.config.selectorBtnBuy);\n\n var respValidated = store.validateFormProduct($form);\n var $boxResponse = $parent.find(\".resp-validate\");\n\n if (respValidated.validated) {\n store.addItem($form, $parent);\n } else {\n //console.info('não foi');\n store.setRespValidateProduct(respValidated, $form, $boxResponse);\n }\n }\n );\n\n if ($(\".info-tamanho\").length > 0) {\n $(\".label\").mouseenter(function () {\n //console.log($(this).find('.info-tamanho'))\n if (!template_store.elementInViewport($(this).find(\".info-tamanho\"))) {\n $(this)\n .find(\".info-tamanho\")\n .css(\"right\", \"auto\")\n .css(\"left\", \"-15px\")\n .css(\"opacity\", \"1\");\n $(this)\n .find(\".info-tamanho\")\n .find(\".arrow\")\n .css(\"right\", \"auto\")\n .css(\"left\", \"20px\");\n } else {\n $(this)\n .find(\".info-tamanho\")\n .css(\"right\", \"-15px\")\n .css(\"left\", \"auto\")\n .css(\"opacity\", \"1\");\n $(this)\n .find(\".info-tamanho\")\n .find(\".arrow\")\n .css(\"right\", \"20px\")\n .css(\"left\", \"auto\");\n }\n //console.log($(this).find('.info-tamanho').length)\n if ($(this).find(\".info-tamanho\").length > 0) {\n $(\".info-tamanho-produto\").css(\"margin-top\", \"82px\");\n }\n });\n $(\".label\").mouseleave(function () {\n $(this).find(\".info-tamanho\").css(\"opacity\", \"0\");\n $(\".info-tamanho-produto\").css(\"margin-top\", \"20px\");\n });\n }\n\n $(\".open-guide\").on(\"click\", function () {\n $(\".modal-guide\").addClass(\"open\");\n $(\".overlay-modal-guide\").addClass(\"open\");\n });\n $(\".modal-guide .close\").on(\"click\", function () {\n $(\".modal-guide\").removeClass(\"open\");\n $(\".overlay-modal-guide\").removeClass(\"open\");\n });\n $(\".overlay-modal-guide\").on(\"click\", function () {\n $(\".modal-guide\").removeClass(\"open\");\n $(\".overlay-modal-guide\").removeClass(\"open\");\n });\n },\n};\n\nwindow.addEventListener(\"DOMContentLoaded\", () => {\n Product.init();\n});\n"],"names":[],"sourceRoot":""}