@perevorot/shop 2.0.120 → 2.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/components/account/Wish.js +1 -1
- package/dist/components/account/Wish.js.map +1 -1
- package/dist/components/auth/Login.js +1 -1
- package/dist/components/auth/Login.js.map +1 -1
- package/dist/components/auth/Registration.js +1 -1
- package/dist/components/auth/Registration.js.map +1 -1
- package/dist/components/auth/User.js +1 -1
- package/dist/components/auth/User.js.map +1 -1
- package/dist/components/shop/Search.js +1 -1
- package/dist/components/shop/Search.js.map +1 -1
- package/dist/components/shop/cart/CartAdd.js +1 -1
- package/dist/components/shop/cart/CartAdd.js.map +1 -1
- package/dist/components/shop/cart/CartItem.js +1 -1
- package/dist/components/shop/cart/CartItem.js.map +1 -1
- package/dist/components/shop/compare/CompareAdd.js +1 -1
- package/dist/components/shop/compare/CompareAdd.js.map +1 -1
- package/dist/components/shop/compare/ComparsionModal.js +1 -1
- package/dist/components/shop/compare/ComparsionModal.js.map +1 -1
- package/dist/components/shop/filters/FilterSearch.js +1 -1
- package/dist/components/shop/filters/FilterSearch.js.map +1 -1
- package/dist/components/shop/order/Checkout.js +1 -1
- package/dist/components/shop/order/Checkout.js.map +1 -1
- package/dist/components/shop/viewed/Viewed.js +1 -1
- package/dist/components/shop/viewed/Viewed.js.map +1 -1
- package/dist/components/shop/viewed/Viewer.js +1 -1
- package/dist/components/shop/viewed/Viewer.js.map +1 -1
- package/dist/components/shop/wishlist/WishlistAdd.js +1 -1
- package/dist/components/shop/wishlist/WishlistAdd.js.map +1 -1
- package/dist/components/shop/wishlist/WishlistDelete.js +1 -1
- package/dist/components/shop/wishlist/WishlistDelete.js.map +1 -1
- package/dist/store.js +1 -1
- package/dist/store.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartItem.js","sources":["../../../../src/components/shop/cart/CartItem.vue","../../../../src/components/shop/cart/CartItem.vue?vue&type=template&id=224cb7df&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\">\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.id\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\">\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\"></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const q = props.item.quantity;\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.category;\n const brand = props.item.attributes.brand;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\n\n const object = {\n ecommerce: {\n currencyCode: 'UAH',\n items: [\n {\n item_name: name,\n item_id: code,\n price: price,\n quantity: q,\n item_brand: brand,\n item_category: category,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch('cart/add', {\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch('cart/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit('cart/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit('cart/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\">\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.id\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\">\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\"></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const q = props.item.quantity;\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.category;\n const brand = props.item.attributes.brand;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\n\n const object = {\n ecommerce: {\n currencyCode: 'UAH',\n items: [\n {\n item_name: name,\n item_id: code,\n price: price,\n quantity: q,\n item_brand: brand,\n item_category: category,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch('cart/add', {\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch('cart/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit('cart/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit('cart/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>"],"names":["name","props","item","Object","setup","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","q","quantity","price","code","category","brand","difference","dispatch","product","id","watch","values","increase","decrease","remove","object","ecommerce","currencyCode","items","item_name","item_id","item_brand","item_category","event","$env","debug","console","log","window","dataLayer","push","gotoProduct","href","addEventListener","commit","location","_createElementVNode","$props","deleted","_createElementBlock","active","bundle","_hoisted_1","_hoisted_2","_ctx","_hoisted_3","_hoisted_4","_hoisted_5","onClick","$setup","disabled","_createBlock","_hoisted_9","image","src","_hoisted_14","_hoisted_15","_hoisted_16","_renderSlot","_hoisted_17","_hoisted_18","_hoisted_20","_hoisted_21","type","min","_hoisted_28","innerHTML","_hoisted_31","filters","priceOld","amount","percent","sum","_hoisted_35","_hoisted_36","option","index","key","indexOf","_hoisted_37","_hoisted_39","description","_hoisted_41","_hoisted_42","_hoisted_44","_hoisted_45","_hoisted_46","_hoisted_47","second","_hoisted_52","_hoisted_53","_hoisted_54","third","_hoisted_55","_hoisted_56","_hoisted_57","_hoisted_58","_hoisted_63","_hoisted_64","_hoisted_65"],"mappings":"sDAgJe,CACXA,KAAM,WACNC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACII,EAAQC,aACRC,EAAUC,OAAI,GACdC,EAAQD,QACRE,EAAUF,MAAIP,EAAMC,KAAKS,WAAWD,SAAWT,EAAMC,KAAKS,WAAWD,QAAQE,OAASX,EAAMC,KAAKS,WAAWD,QAAU,IACtHG,EAAiBL,OAAI,GACrBM,EAAOC,YAAS,kBAAMV,EAAMW,QAAQ,cAEtCf,EAAMC,KAAKS,WAAWD,SAAWT,EAAMC,KAAKS,WAAWD,QAAQE,SAC/DC,EAAeI,OAAQ,OAGrBC,EAAIjB,EAAMC,KAAKiB,SACfnB,EAAOC,EAAMC,KAAKF,KAClBoB,EAAQnB,EAAMC,KAAKS,WAAWS,MAC9BC,EAAOpB,EAAMC,KAAKS,WAAWU,KAC7BC,EAAWrB,EAAMC,KAAKS,WAAWW,SACjCC,EAAQtB,EAAMC,KAAKS,WAAWY,MAkD9BJ,EAAW,SAACK,GACdjB,EAAQU,OAAQ,EAEhBZ,EAAMoB,SAAS,WAAY,CACv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/D,0BAAIY,yCAAOC,eAAYZ,QAAK5C,WAAWmG,MAAM5D,2BAAUK,QAAK5C,WAAWmG,MAAM9G"}
|
|
1
|
+
{"version":3,"file":"CartItem.js","sources":["../../../../src/components/shop/cart/CartItem.vue","../../../../src/components/shop/cart/CartItem.vue?vue&type=template&id=39d21427&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\">\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.id\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\">\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\"></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch('cart/add', {\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch('cart/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit('cart/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit('cart/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\">\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.id\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\">\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\"></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch('cart/add', {\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch('cart/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit('cart/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit('cart/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>"],"names":["name","props","item","Object","setup","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","price","code","category","categoryFull","brand","property","quantity","difference","dispatch","product","id","callback","q","object","ecommerce","currency","parseFloat","items","item_name","item_id","event","item_brand","index","itemListName","item_list_name","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","watch","values","increase","decrease","remove","gotoProduct","href","addEventListener","commit","location","_createElementVNode","$props","deleted","_createElementBlock","active","bundle","_hoisted_1","_hoisted_2","_ctx","_hoisted_3","_hoisted_4","_hoisted_5","onClick","$setup","disabled","_createBlock","_hoisted_9","image","src","_hoisted_14","_hoisted_15","_hoisted_16","_renderSlot","_hoisted_17","_hoisted_18","_hoisted_20","_hoisted_21","type","min","_hoisted_28","innerHTML","_hoisted_31","filters","priceOld","amount","percent","sum","_hoisted_35","_hoisted_36","option","key","_hoisted_37","_hoisted_39","description","_hoisted_41","_hoisted_42","_hoisted_44","_hoisted_45","_hoisted_46","_hoisted_47","second","_hoisted_52","_hoisted_53","_hoisted_54","third","_hois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0G,OAAOjC,WACjChB,QAAKzD,WAAW0G,OAAOjC,qBAAtEd,kCAAMe,IAAKjB,QAAKzD,WAAW0G,OAAOjC,iCAClCd,yCAMZH,2BAAAmD,GAC4BlD,QAAKzD,WAAW0G,OAAOlG,oBAA/CmD,2BAAAiD,oBAAwD5C,8CAA2BP,QAAKzD,WAAW0G,OAAOlG,0CAC1GgD,2BAAAqD,GACIrD,0BAAIY,uCAAOC,eAAYZ,QAAKzD,WAAW0G,OAAOtD,2BAAUK,QAAKzD,WAAW0G,OAAOrH,gDAIzDoE,QAAKzD,WAAW6D,QAAUJ,QAAKzD,WAAW8G,qBAA5EnD,2BAAAoD,GACIC,EAGAxD,2BAAAyD,GACIC,GAGA1D,0BAAIY,yCAAOC,eAAYZ,QAAKzD,WAAW8G,MAAM1D,UACzCI,uDAAc,+BAA+CC,QAAKzD,WAAW8G,MAAMrC,WACjChB,QAAKzD,WAAW8G,MAAMrC,qBAApEd,kCAAMe,IAAKjB,QAAKzD,WAAW8G,MAAMrC,kCACjCd,2CAMZH,2BAAA2D,IAC4B1D,QAAKzD,WAAW8G,MAAMtG,oBAA9CmD,2BAAAyD,qBAAuDpD,8CAA2BP,QAAKzD,WAAW8G,MAAMtG,0CACxGgD,2BAAA6D,IACI7D,0BAAIY,yCAAOC,eAAYZ,QAAKzD,WAAW8G,MAAM1D,2BAAUK,QAAKzD,WAAW8G,MAAMzH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),o=require("vue-toastification"),r={props:{last:null},setup:function(){return{translate:window.__}}},n={class:"shop-compare-success-message"};r.render=function(t,o,r,a,c,s){return e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",null,e.toDisplayString(a.translate("shop.compare.product_deleted_named",{product:r.last.name})),1),e.createCommentVNode(' <a\n :href="last.url"\n class="mt-2 is-size-7"\n style="color: #fff; border-bottom: 1px solid #fff"\n >{{ translate("shop.compare.goto") }}</a\n > ')])};var a=o.useToast(),c=e.defineComponent({props:{id:Number},setup:function(o){var n=e.ref(!1),c=t.useStore(),s=e.computed((function(){return c.getters["compare/last"]})),
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),o=require("vue-toastification"),r={props:{last:null},setup:function(){return{translate:window.__}}},n={class:"shop-compare-success-message"};r.render=function(t,o,r,a,c,s){return e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",null,e.toDisplayString(a.translate("shop.compare.product_deleted_named",{product:r.last.name})),1),e.createCommentVNode(' <a\n :href="last.url"\n class="mt-2 is-size-7"\n style="color: #fff; border-bottom: 1px solid #fff"\n >{{ translate("shop.compare.goto") }}</a\n > ')])};var a=o.useToast(),c=e.defineComponent({props:{id:Number},setup:function(o){var n=e.ref(!1),c=t.useStore(),s=e.computed((function(){return c.getters["compare/last"]})),l=e.computed((function(){return c.getters["compare/product"](o.id)}));return{product:l,action:function(){n.value||(n.value=!0,c.dispatch("compare/toggle",{id:o.id,finally:function(){var e={event:""};l.value?(a({component:r,props:{last:s}},{type:"success"}),e.event="add_to_comparison_list"):(a(__("shop.compare.product_deleted"),{type:"warning"}),e.event="remove_from_comparison_list");$env.debug.ecommerce&&console.log(e),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(e)),n.value=!1}}))},loading:n}}}),s=["title"],l=e.createElementVNode("svg",{class:"icon compare"},[e.createElementVNode("use",{"xlink:href":"#compare"})],-1);c.render=function(t,o,r,n,a,c){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["button compare",{"is-loading":t.loading,"is-transparent":!t.product}]),onClick:o[0]||(o[0]=function(){return t.action&&t.action.apply(t,arguments)}),title:t.__("shop.compare.add")},[e.renderSlot(t.$slots,"default",{product:t.product},(function(){return[l]}))],10,s)},module.exports=c;
|
|
2
2
|
//# sourceMappingURL=CompareAdd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompareAdd.js","sources":["../../../../src/components/shop/compare/SuccessMessage.vue","../../../../src/components/shop/compare/SuccessMessage.vue?vue&type=template&id=2662d3ca&lang.js","../../../../src/components/shop/compare/CompareAdd.vue","../../../../src/components/shop/compare/CompareAdd.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"CompareAdd.js","sources":["../../../../src/components/shop/compare/SuccessMessage.vue","../../../../src/components/shop/compare/SuccessMessage.vue?vue&type=template&id=2662d3ca&lang.js","../../../../src/components/shop/compare/CompareAdd.vue","../../../../src/components/shop/compare/CompareAdd.vue?vue&type=template&id=24209000&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-compare-success-message\">\n <div>\n {{\n translate(\"shop.compare.product_deleted_named\", {\n product: last.name,\n })\n }}\n </div>\n <!-- <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.compare.goto\") }}</a\n > -->\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"shop-compare-success-message\">\n <div>\n {{\n translate(\"shop.compare.product_deleted_named\", {\n product: last.name,\n })\n }}\n </div>\n <!-- <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.compare.goto\") }}</a\n > -->\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <button class=\"button compare\" @click=\"action\" v-bind:class=\"{ 'is-loading': loading, 'is-transparent': !product }\" :title=\"__('shop.compare.add')\">\n <slot :product=\"product\">\n <svg class=\"icon compare\">\n <use xlink:href=\"#compare\" />\n </svg>\n </slot>\n </button>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport SuccessMessage from \"./SuccessMessage.vue\";\n\nconst toast = useToast();\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number,\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const last = computed(() => store.getters[\"compare/last\"]);\n const product = computed(() =>\n store.getters[\"compare/product\"](props.id)\n );\n\n const action = () => {\n if (!loading.value) {\n loading.value = true;\n\n store.dispatch(\"compare/toggle\", {\n id: props.id,\n finally: () => {\n let object = {\n event: ''\n };\n\n if (product.value) {\n const component = {\n component: SuccessMessage,\n props: {\n last: last,\n },\n };\n\n toast(component, {\n type: \"success\",\n });\n\n object.event = 'add_to_comparison_list';\n } else {\n toast(__(\"shop.compare.product_deleted\"), {\n type: \"warning\",\n });\n\n object.event = 'remove_from_comparison_list';\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n loading.value = false;\n },\n });\n }\n };\n\n return {\n product,\n action,\n loading,\n };\n },\n});\n</script>","<template>\n <button class=\"button compare\" @click=\"action\" v-bind:class=\"{ 'is-loading': loading, 'is-transparent': !product }\" :title=\"__('shop.compare.add')\">\n <slot :product=\"product\">\n <svg class=\"icon compare\">\n <use xlink:href=\"#compare\" />\n </svg>\n </slot>\n </button>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport SuccessMessage from \"./SuccessMessage.vue\";\n\nconst toast = useToast();\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number,\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const last = computed(() => store.getters[\"compare/last\"]);\n const product = computed(() =>\n store.getters[\"compare/product\"](props.id)\n );\n\n const action = () => {\n if (!loading.value) {\n loading.value = true;\n\n store.dispatch(\"compare/toggle\", {\n id: props.id,\n finally: () => {\n let object = {\n event: ''\n };\n\n if (product.value) {\n const component = {\n component: SuccessMessage,\n props: {\n last: last,\n },\n };\n\n toast(component, {\n type: \"success\",\n });\n\n object.event = 'add_to_comparison_list';\n } else {\n toast(__(\"shop.compare.product_deleted\"), {\n type: \"warning\",\n });\n\n object.event = 'remove_from_comparison_list';\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n loading.value = false;\n },\n });\n }\n };\n\n return {\n product,\n action,\n loading,\n };\n },\n});\n</script>"],"names":["props","last","setup","translate","window","__","_createElementBlock","_hoisted_1","_createElementVNode","$setup","_createCommentVNode","toast","useToast","defineComponent","id","Number","loading","ref","store","useStore","computed","getters","product","action","value","dispatch","object","event","component","SuccessMessage","type","$env","debug","ecommerce","console","log","dataLayer","push","_ctx","onClick","title","_renderSlot","_hoisted_2"],"mappings":"sFAkBe,CACXA,MAAO,CACHC,KAAM,MAEVC,uBAGW,CACHC,UAHcC,OAAOC,eCtBlB,oFAAXC,2BAAAC,GACIC,kDAEQC,4EAKRC,mOCMR,IAAMC,EAAQC,eAEeC,kBAAgB,CACzCb,MAAO,CACHc,GAAIC,QAERb,eAAMF,OACIgB,EAAUC,OAAI,GACdC,EAAQC,aACRlB,EAAOmB,YAAS,kBAAMF,EAAMG,QAAQ,mBACpCC,EAAUF,YAAS,kBACrBF,EAAMG,QAAQ,mBAAmBrB,EAAMc,aAqDpC,CACHQ,QAAAA,EACAC,OApDW,WACNP,EAAQQ,QACTR,EAAQQ,OAAQ,EAEhBN,EAAMO,SAAS,iBAAkB,CAC7BX,GAAId,EAAMc,WACD,eACDY,EAAS,CACTC,MAAO,IAGPL,EAAQE,OAQRb,EAPkB,CACdiB,UAAWC,EACX7B,MAAO,CACHC,KAAMA,IAIG,CACb6B,KAAM,YAGVJ,EAAOC,MAAQ,2BAEfhB,EAAMN,GAAG,gCAAiC,CACtCyB,KAAM,YAGVJ,EAAOC,MAAQ,+BAGfI,KAAKC,MAAMC,WACXC,QAAQC,IAAIT,IAGXK,KAAKC,MAAMC,WAAa7B,OAAOgC,YAChChC,OAAOgC,UAAUC,KAAK,CAClBJ,UAAW,OAGf7B,OAAOgC,UAAUC,KAAKX,IAG1BV,EAAQQ,OAAQ,OAS5BR,QAAAA,oBC/EAR,kCAAW,iBACPA,yCAAgB,sEAH5BF,uDAAc,+BAA+DgC,4BAA4BA,aAAzEC,sCAAOD,wCAA8EE,MAAOF,2BACxHG,iCAAOnB,QAASgB,YAAhB,kBACII"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),o=require("@perevorot/shop/dist/helpers"),l=require("vue-toastification").useToast(),
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),o=require("@perevorot/shop/dist/helpers"),l=require("vue-toastification").useToast(),a=e.defineComponent({setup:function(){var a=t.useStore(),c=e.computed((function(){return a.getters["compare/modal"]})),n=e.ref(!0),r=e.ref(!1),s=e.ref(null);e.watch(s,(function(e){s.value&&window.promoCodeCallback&&"function"==typeof window.promoCodeCallback&&window.promoCodeCallback(s.value)}));var d=function(e,t){if(!t){var o=document.getElementById("compare-toggler"),l=document.getElementById("compare-overlay");o.classList.remove("is-open"),l.classList.remove("is-open"),document.querySelector("html").classList.remove("is-no-scroll")}a.commit("compare/modal",null)},i=function(e,t,o){r.value||(r.value=!0,a.dispatch("compare/category",{slug:t,finally:function(){l(__("shop.compare.category_deleted",{category:o}),{type:"success"}),d(),r.value=!1}}))};return window.addEventListener("beforeunload",(function(){a.commit("compare/modal",null)})),window.addEventListener("pagehide",(function(){a.commit("compare/modal",null)})),{modal:c,close:d,pluralize:o.pluralize,showAll:n,deleteCategory:i,remove:function(e,t){var o=[];c.value.products.forEach((function(e){e.id!=t&&o.push(e.id)})),a.dispatch("compare/delete",{id:t,callback:function(e){l(__("shop.compare.product_deleted"),{type:"success"});var t={event:"remove_from_comparison_list"};$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t)),o.length>0?a.dispatch("compare/modal",{id:c.value.category.slug+"/"+o.join(","),finally:function(){r.value=!1}}):i(0,c.value.category.slug,c.value.category.name)},finally:function(){r.value=!1}})},productsElement:s}}}),c={key:0,class:"shop-comparsion"},n={class:"comparsion-head"},r={key:0,class:"page-title"},s=["textContent"],d=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],i={class:"comparsion-controls"},m={class:"compare-switcher"},p={class:"switcher checkbox-label"},u=e.createElementVNode("input",{id:"comparsion-show",type:"checkbox",name:"compare-view",hidden:""},null,-1),E=e.createElementVNode("span",{class:"checkbox-custom"},null,-1),v=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#icon-trash"})],-1),e.createElementVNode("span",null,"Очистити список",-1)],h=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#compare"})],-1),e.createElementVNode("span",null,"Всі списки порівнянь",-1)],g={class:"scroll-wrapper"},N={class:"comparsion-body"},V={class:"products",ref:"productsElement"},y={"shop-product":""},f={class:"is-hidden","shop-product-category":""},k={class:"is-hidden","shop-product-brand":""},b={class:"product-card product-item"},B=["href"],w={class:"image"},C=["src"],x={class:"product-item-info"},L=["href"],S={class:"product-item-controls"},D=["onClick"],_=[e.createElementVNode("span",{class:"product-remove"},[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#icon-trash"})])],-1)],T={class:"product-item-add"},z={class:"prices"},F=["innerHTML"],H=["innerHTML"],M=["innerHTML"],q={class:"availability"},A={key:0,class:"has-text-success"},I={key:1,class:"available has-text-danger"},O={class:"row-title-mobile"},$=["colspan"],j={class:"row-title-text"},G={class:"property-title property-title-desktop"},J={class:"property-product is-hidden-tablet"},K={class:"property-value"},P=["data-code"],Q={class:"is-hidden","shop-product-name":""},R={class:"is-hidden","shop-product-price":""},U={class:"is-hidden","shop-product-brand":""},W={class:"is-hidden","shop-product-property":""},X={class:"is-hidden","shop-product-category":""};a.render=function(t,o,l,a,Y,Z){var ee=e.resolveComponent("wishlist-add"),te=e.resolveComponent("cart-add");return t.modal&&t.modal.category&&t.modal.products?(e.openBlock(),e.createElementBlock("section",c,[e.createElementVNode("div",n,[t.modal.category?(e.openBlock(),e.createElementBlock("h1",r,[e.createTextVNode(" Порівнюємо "+e.toDisplayString(t.modal.category.name)+" ",1),e.createElementVNode("span",{class:"badge",textContent:e.toDisplayString(t.pluralize(t.modal.products.length,t.__("shop.pluralize.products")))},null,8,s)])):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:"button comparsion-close",onClick:o[0]||(o[0]=function(e){return t.close(e,!0)})},d)]),e.createElementVNode("div",i,[e.createElementVNode("div",m,[e.createElementVNode("label",p,[u,E,e.createElementVNode("span",{class:"checkbox-text all-char",onClick:o[1]||(o[1]=function(e){return t.showAll=!0})},"Всі параметри"),e.createElementVNode("span",{class:"checkbox-text diff",onClick:o[2]||(o[2]=function(e){return t.showAll=!1})},"Тільки відмінності")])]),e.createElementVNode("button",{class:"button compare reset-compare",onClick:o[3]||(o[3]=function(e){return t.deleteCategory(e,t.modal.category.slug,t.modal.category.name)})},v),e.createElementVNode("button",{class:"all-compare-lists",onClick:o[4]||(o[4]=function(e){return t.close(e,!0)})},h)]),e.createElementVNode("div",g,[e.createElementVNode("div",N,[e.createElementVNode("div",V,[e.createElementVNode("table",{class:e.normalizeClass(["comparsion table",{"only-difference":!t.showAll}]),id:"comparsion-header"},[e.createElementVNode("thead",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.modal.products,(function(l){return e.openBlock(),e.createElementBlock("th",y,[e.createElementVNode("div",f,e.toDisplayString((t.modal.category.parent?t.modal.category.parent+" / ":"")+t.modal.category.name),1),e.createElementVNode("div",k,e.toDisplayString(l.brand),1),e.createElementVNode("div",b,[e.createElementVNode("a",{class:"product-item-image",href:l.href,"data-ga-item-index":""},[e.createElementVNode("figure",w,[e.createElementVNode("img",{src:l.image},null,8,C)])],8,B),e.createElementVNode("div",x,[e.createElementVNode("a",{class:"product-item-title",href:l.href,"shop-product-name":"","data-ga-item-index":""},e.toDisplayString(l.name),9,L)]),e.createElementVNode("div",S,[e.createVNode(ee,{id:l.id,code:l.code,property:l.property},null,8,["id","code","property"]),e.createElementVNode("button",{class:"button compare",onClick:function(e){return t.remove(e,l.id)}},_,8,D)]),e.createElementVNode("div",T,[e.createElementVNode("div",z,[l.price?(e.openBlock(),e.createElementBlock("div",{key:0,class:"current-price",innerHTML:l.price,"shop-product-price":""},null,8,F)):e.createCommentVNode("v-if",!0),l.priceOld?(e.openBlock(),e.createElementBlock("div",{key:1,class:"old-price",innerHTML:l.priceOld},null,8,H)):e.createCommentVNode("v-if",!0),l.discount?(e.openBlock(),e.createElementBlock("div",{key:2,class:"discount",innerHTML:l.discount},null,8,M)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",q,[l.available?(e.openBlock(),e.createElementBlock("div",A,"В наявності")):(e.openBlock(),e.createElementBlock("div",I,"Товар очікується"))])]),e.createElementVNode("div",{class:"is-hidden-tablet",onClick:o[5]||(o[5]=function(e){return t.close(e)})},[e.createVNode(te,{id:l.cart_id,"is-simple":!0},null,8,["id"])])])])})),256))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.modal.properties,(function(o){return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("tr",O,[e.createElementVNode("td",{colspan:t.modal.products.length},[e.createElementVNode("div",j,[e.createElementVNode("p",null,e.toDisplayString(o.name),1)])],8,$)]),e.createElementVNode("tr",{class:e.normalizeClass(o.is_same?"is-same":"is-differs")},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.values,(function(l,a){return e.openBlock(),e.createElementBlock("td",null,[e.createElementVNode("div",G,e.toDisplayString(o.name),1),e.createElementVNode("div",J,e.toDisplayString(t.modal.products[a].name),1),e.createElementVNode("div",K,e.toDisplayString(l||"—"),1)])})),256))],2)],64)})),256))]),e.createElementVNode("tfoot",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.modal.products,(function(l){return e.openBlock(),e.createElementBlock("td",{"shop-product":"","data-code":l.code},[e.createElementVNode("span",Q,e.toDisplayString(l.name),1),e.createElementVNode("span",R,e.toDisplayString(l.price),1),e.createElementVNode("span",U,e.toDisplayString(l.brand),1),e.createElementVNode("span",W,e.toDisplayString(l.property),1),e.createElementVNode("span",X,e.toDisplayString(l.categoryFull),1),e.createElementVNode("div",{class:"cell-btn-wrapper",onClick:o[6]||(o[6]=function(e){return t.close(e)})},[e.createVNode(te,{id:l.cart_id,"is-simple":!0},null,8,["id"])])],8,P)})),256))])])],2)],512)])])])):e.createCommentVNode("v-if",!0)},module.exports=a;
|
|
2
2
|
//# sourceMappingURL=ComparsionModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComparsionModal.js","sources":["../../../../src/components/shop/compare/ComparsionModal.vue","../../../../src/components/shop/compare/ComparsionModal.vue?vue&type=template&id=33dedbc1&lang.js"],"sourcesContent":["<template>\n <section class=\"shop-comparsion\" v-if=\"modal && modal.category && modal.products\">\n <div class=\"comparsion-head\">\n <h1 class=\"page-title\" v-if=\"modal.category\">\n Порівнюємо {{ modal.category.name }}\n <span class=\"badge\" v-text=\"pluralize(modal.products.length, __('shop.pluralize.products'))\"></span>\n </h1>\n <button class=\"button comparsion-close\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#close\"></use>\n </svg>\n </button>\n </div>\n <div class=\"comparsion-controls\">\n <div class=\"compare-switcher\">\n <label class=\"switcher checkbox-label\">\n <input id=\"comparsion-show\" type=\"checkbox\" name=\"compare-view\" hidden />\n <span class=\"checkbox-custom\"></span>\n <span class=\"checkbox-text all-char\" @click=\"showAll = true\">Всі параметри</span>\n <span class=\"checkbox-text diff\" @click=\"showAll = false\">Тільки відмінності</span>\n </label>\n </div>\n\n <button class=\"button compare reset-compare\" @click=\"deleteCategory($event, modal.category.slug, modal.category.name)\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n <span>Очистити список</span>\n </button>\n\n <button class=\"all-compare-lists\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#compare\"></use>\n </svg>\n <span>Всі списки порівнянь</span>\n </button>\n </div>\n <div class=\"scroll-wrapper\">\n <div class=\"comparsion-body\">\n <div class=\"products\">\n <table class=\"comparsion table\" id=\"comparsion-header\" v-bind:class=\"{ 'only-difference': !showAll }\">\n <thead>\n <th v-for=\"product in modal.products\" shop-product>\n <div class=\"is-hidden\" shop-product-category>{{ (modal.category.parent ? modal.category.parent + ' / ' : '') + modal.category.name }}</div>\n <div class=\"is-hidden\" shop-product-brand>{{ product.brand }}</div>\n <div class=\"product-item\">\n <a class=\"product-item-image\" :href=\"product.href\">\n <figure class=\"image\">\n <img :src=\"product.image\">\n </figure>\n </a>\n <div class=\"product-item-info\">\n <a class=\"product-item-title\" :href=\"product.href\" shop-product-name>\n {{ product.name }}\n </a>\n </div>\n <div class=\"product-item-controls\">\n <wishlist-add :id=\"product.id\"></wishlist-add>\n <button class=\"button compare\" @click=\"remove($event, product.id)\">\n <span class=\"product-remove\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n </span>\n </button>\n </div>\n <div class=\"product-item-add\">\n <div class=\"prices\">\n <div class=\"current-price\" v-html=\"product.price\" v-if=\"product.price\" shop-product-price></div>\n <div class=\"old-price\" v-html=\"product.priceOld\" v-if=\"product.priceOld\"></div>\n <div class=\"discount\" v-html=\"product.discount\" v-if=\"product.discount\"></div>\n </div>\n <div class=\"availability\">\n <div class=\"has-text-success\" v-if=\"product.available\">В наявності</div>\n <div class=\"available has-text-danger\" v-else>Товар очікується</div>\n </div>\n </div>\n <div class=\"is-hidden-tablet\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </div>\n </th>\n </thead>\n <tbody>\n <template v-for=\"property in modal.properties\">\n <tr class=\"row-title-mobile\">\n <td :colspan=\"modal.products.length\">\n <div class=\"row-title-text\">\n <p>{{ property.name }}</p>\n </div>\n </td>\n </tr>\n <tr :class=\"property.is_same ? 'is-same' : 'is-differs'\">\n <td v-for=\"(value, index) in property.values\">\n <div class=\"property-title property-title-desktop\">\n {{ property.name }}\n </div>\n <div class=\"property-product is-hidden-tablet\">\n {{ modal.products[index].name }}\n </div>\n <div class=\"property-value\">\n {{ value ? value : '—' }}\n </div>\n </td>\n </tr>\n </template>\n </tbody>\n <tfoot>\n <tr>\n <td v-for=\"product in modal.products\" shop-product>\n <span class=\"is-hidden\" shop-product-name>{{ product.name }}</span>\n <span class=\"is-hidden\" shop-product-price>{{ product.price }}</span>\n <span class=\"is-hidden\" shop-product-code>{{ product.code }}</span>\n <div class=\"cell-btn-wrapper\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </td>\n </tr>\n </tfoot>\n </table>\n </div>\n </div>\n </div>\n </section>\n</template>\n<script>\nimport { ref, computed, defineComponent } from 'vue';\nimport { useStore } from 'vuex';\nimport { pluralize } from '@perevorot/shop/dist/helpers';\nimport { useToast } from \"vue-toastification\";\n\nconst toast = useToast();\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const modal = computed(() => store.getters['compare/modal']);\n const showAll = ref(true);\n const loading = ref(false);\n\n const close = (e, isKeepCompare) => {\n if (!isKeepCompare) {\n const compareToggler = document.getElementById('compare-toggler');\n const compareOverlay = document.getElementById('compare-overlay');\n\n compareToggler.classList.remove('is-open');\n compareOverlay.classList.remove('is-open');\n\n document.querySelector('html').classList.remove('is-no-scroll');\n }\n\n store.commit('compare/modal', null);\n };\n\n const deleteCategory = ($event, slug, name) => {\n if (!loading.value) {\n loading.value = true;\n\n store.dispatch(\"compare/category\", {\n slug: slug,\n finally: () => {\n toast(\n __(\"shop.compare.category_deleted\", {\n category: name,\n }),\n {\n type: \"success\",\n }\n );\n\n close();\n\n loading.value = false;\n },\n });\n }\n };\n\n const remove = ($event, id) => {\n let slug = [];\n\n modal.value.products.forEach((product) => {\n if (product.id != id) {\n slug.push(product.id);\n }\n });\n\n store.dispatch(\"compare/delete\", {\n id: id,\n callback: (data) => {\n toast(\n __(\"shop.compare.product_deleted\"),\n {\n type: \"success\",\n }\n );\n\n if (slug.length > 0) {\n store.dispatch(\"compare/modal\", {\n id: modal.value.category.slug + '/' + slug.join(','),\n finally: () => {\n loading.value = false;\n },\n });\n } else {\n deleteCategory(null, modal.value.category.slug, modal.value.category.name)\n }\n },\n finally: () => {\n loading.value = false;\n },\n });\n }\n\n return {\n modal,\n close,\n pluralize,\n showAll,\n deleteCategory,\n remove\n }\n }\n});\n</script>","<template>\n <section class=\"shop-comparsion\" v-if=\"modal && modal.category && modal.products\">\n <div class=\"comparsion-head\">\n <h1 class=\"page-title\" v-if=\"modal.category\">\n Порівнюємо {{ modal.category.name }}\n <span class=\"badge\" v-text=\"pluralize(modal.products.length, __('shop.pluralize.products'))\"></span>\n </h1>\n <button class=\"button comparsion-close\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#close\"></use>\n </svg>\n </button>\n </div>\n <div class=\"comparsion-controls\">\n <div class=\"compare-switcher\">\n <label class=\"switcher checkbox-label\">\n <input id=\"comparsion-show\" type=\"checkbox\" name=\"compare-view\" hidden />\n <span class=\"checkbox-custom\"></span>\n <span class=\"checkbox-text all-char\" @click=\"showAll = true\">Всі параметри</span>\n <span class=\"checkbox-text diff\" @click=\"showAll = false\">Тільки відмінності</span>\n </label>\n </div>\n\n <button class=\"button compare reset-compare\" @click=\"deleteCategory($event, modal.category.slug, modal.category.name)\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n <span>Очистити список</span>\n </button>\n\n <button class=\"all-compare-lists\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#compare\"></use>\n </svg>\n <span>Всі списки порівнянь</span>\n </button>\n </div>\n <div class=\"scroll-wrapper\">\n <div class=\"comparsion-body\">\n <div class=\"products\">\n <table class=\"comparsion table\" id=\"comparsion-header\" v-bind:class=\"{ 'only-difference': !showAll }\">\n <thead>\n <th v-for=\"product in modal.products\" shop-product>\n <div class=\"is-hidden\" shop-product-category>{{ (modal.category.parent ? modal.category.parent + ' / ' : '') + modal.category.name }}</div>\n <div class=\"is-hidden\" shop-product-brand>{{ product.brand }}</div>\n <div class=\"product-item\">\n <a class=\"product-item-image\" :href=\"product.href\">\n <figure class=\"image\">\n <img :src=\"product.image\">\n </figure>\n </a>\n <div class=\"product-item-info\">\n <a class=\"product-item-title\" :href=\"product.href\" shop-product-name>\n {{ product.name }}\n </a>\n </div>\n <div class=\"product-item-controls\">\n <wishlist-add :id=\"product.id\"></wishlist-add>\n <button class=\"button compare\" @click=\"remove($event, product.id)\">\n <span class=\"product-remove\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n </span>\n </button>\n </div>\n <div class=\"product-item-add\">\n <div class=\"prices\">\n <div class=\"current-price\" v-html=\"product.price\" v-if=\"product.price\" shop-product-price></div>\n <div class=\"old-price\" v-html=\"product.priceOld\" v-if=\"product.priceOld\"></div>\n <div class=\"discount\" v-html=\"product.discount\" v-if=\"product.discount\"></div>\n </div>\n <div class=\"availability\">\n <div class=\"has-text-success\" v-if=\"product.available\">В наявності</div>\n <div class=\"available has-text-danger\" v-else>Товар очікується</div>\n </div>\n </div>\n <div class=\"is-hidden-tablet\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </div>\n </th>\n </thead>\n <tbody>\n <template v-for=\"property in modal.properties\">\n <tr class=\"row-title-mobile\">\n <td :colspan=\"modal.products.length\">\n <div class=\"row-title-text\">\n <p>{{ property.name }}</p>\n </div>\n </td>\n </tr>\n <tr :class=\"property.is_same ? 'is-same' : 'is-differs'\">\n <td v-for=\"(value, index) in property.values\">\n <div class=\"property-title property-title-desktop\">\n {{ property.name }}\n </div>\n <div class=\"property-product is-hidden-tablet\">\n {{ modal.products[index].name }}\n </div>\n <div class=\"property-value\">\n {{ value ? value : '—' }}\n </div>\n </td>\n </tr>\n </template>\n </tbody>\n <tfoot>\n <tr>\n <td v-for=\"product in modal.products\" shop-product>\n <span class=\"is-hidden\" shop-product-name>{{ product.name }}</span>\n <span class=\"is-hidden\" shop-product-price>{{ product.price }}</span>\n <span class=\"is-hidden\" shop-product-code>{{ product.code }}</span>\n <div class=\"cell-btn-wrapper\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </td>\n </tr>\n </tfoot>\n </table>\n </div>\n </div>\n </div>\n </section>\n</template>\n<script>\nimport { ref, computed, defineComponent } from 'vue';\nimport { useStore } from 'vuex';\nimport { pluralize } from '@perevorot/shop/dist/helpers';\nimport { useToast } from \"vue-toastification\";\n\nconst toast = useToast();\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const modal = computed(() => store.getters['compare/modal']);\n const showAll = ref(true);\n const loading = ref(false);\n\n const close = (e, isKeepCompare) => {\n if (!isKeepCompare) {\n const compareToggler = document.getElementById('compare-toggler');\n const compareOverlay = document.getElementById('compare-overlay');\n\n compareToggler.classList.remove('is-open');\n compareOverlay.classList.remove('is-open');\n\n document.querySelector('html').classList.remove('is-no-scroll');\n }\n\n store.commit('compare/modal', null);\n };\n\n const deleteCategory = ($event, slug, name) => {\n if (!loading.value) {\n loading.value = true;\n\n store.dispatch(\"compare/category\", {\n slug: slug,\n finally: () => {\n toast(\n __(\"shop.compare.category_deleted\", {\n category: name,\n }),\n {\n type: \"success\",\n }\n );\n\n close();\n\n loading.value = false;\n },\n });\n }\n };\n\n const remove = ($event, id) => {\n let slug = [];\n\n modal.value.products.forEach((product) => {\n if (product.id != id) {\n slug.push(product.id);\n }\n });\n\n store.dispatch(\"compare/delete\", {\n id: id,\n callback: (data) => {\n toast(\n __(\"shop.compare.product_deleted\"),\n {\n type: \"success\",\n }\n );\n\n if (slug.length > 0) {\n store.dispatch(\"compare/modal\", {\n id: modal.value.category.slug + '/' + slug.join(','),\n finally: () => {\n loading.value = false;\n },\n });\n } else {\n deleteCategory(null, modal.value.category.slug, modal.value.category.name)\n }\n },\n finally: () => {\n loading.value = false;\n },\n });\n }\n\n return {\n modal,\n close,\n pluralize,\n showAll,\n deleteCategory,\n remove\n }\n }\n});\n</script>"],"names":["toast","defineComponent","setup","store","useStore","modal","computed","getters","showAll","ref","loading","close","e","isKeepCompare","compareToggler","document","getElementById","compareOverlay","classList","remove","querySelector","commit","deleteCategory","$event","slug","name","value","dispatch","__","category","type","pluralize","id","products","forEach","product","push","callback","data","length","join","_createElementVNode","hidden","_ctx","_createElementBlock","_hoisted_1","_hoisted_2","_hoisted_3","_toDisplayString","onClick","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","parent","_hoisted_23","brand","_hoisted_24","href","_hoisted_26","src","image","_hoisted_28","_hoisted_30","_createVNode","_hoisted_34","_hoisted_35","price","innerHTML","priceOld","discount","_hoisted_39","available","_hoisted_40","_hoisted_41","cart_id","properties","property","_hoisted_42","colspan","_hoisted_44","is_same","values","index","_hoisted_45","_hoisted_46","_hoisted_47","_hoisted_48","_hoisted_49","_hoisted_50","_hoisted_51","code"],"mappings":"8FAmIMA,6CAEuBC,kBAAgB,CACzCC,qBACUC,EAAQC,aACRC,EAAQC,YAAS,kBAAMH,EAAMI,QAAQ,oBACrCC,EAAUC,OAAI,GACdC,EAAUD,OAAI,GAEdE,EAAQ,SAACC,EAAGC,OACTA,EAAe,KACVC,EAAiBC,SAASC,eAAe,mBACzCC,EAAiBF,SAASC,eAAe,mBAE/CF,EAAeI,UAAUC,OAAO,WAChCF,EAAeC,UAAUC,OAAO,WAEhCJ,SAASK,cAAc,QAAQF,UAAUC,OAAO,gBAGpDhB,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BAA4B,+CAChBtC,EAAQwC,wBAA/D/B,wCAAW,YAAY8B,UAAQvC,EAAQwC,qDACexC,EAAQyC,wBAA9DhC,wCAAW,WAAW8B,UAAQvC,EAAQyC,uDAE1CnC,2BAAAoC,GACwC1C,EAAQ2C,yBAA5ClC,2BAAAmC,EAAuD,+BACvDnC,2BAAAoC,EAA8C,yBAGtDvC,kCAAW,mBAAoBQ,uCAAON,QAAMpB,OACxC+C,iBAAWtC,GAAIG,EAAQ8C,qBAAqB,mCAK5DxC,oDACIG,kDAA6BD,QAAMuC,qBAAlBC,8DACb1C,0BAAA2C,GACI3C,2BAAK4C,QAAS1C,QAAMV,SAASM,SACzBE,2BAAA6C,GACI7C,gDAAM0C,EAAS1D,mBAI3BgB,kDAAY0C,EAASI,mDACjB3C,kDAA6BuC,EAASK,iBAA1B9D,EAAO+D,wBAAnB7C,gCACIH,2BAAAiD,oBACOP,EAAS1D,SAEhBgB,2BAAAkD,oBACOhD,QAAMV,SAASwD,GAAOhE,SAE7BgB,2BAAAmD,oBACOlE,0CAMvBe,mCACIA,iDACIG,kDAAsBD,QAAMV,mBAAjBE,wBAAXS,0BAAAiD,GACIpD,4BAAAqD,oBAA6C3D,EAAQV,SACrDgB,4BAAAsD,oBAA8C5D,EAAQsC,UACtDhC,4BAAAuD,oBAA6C7D,EAAQ8D,SACrDxD,kCAAW,mBAAoBQ,uCAAON,QAAMpB,OACxC+C,iBAAWtC,GAAIG,EAAQ8C,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"ComparsionModal.js","sources":["../../../../src/components/shop/compare/ComparsionModal.vue","../../../../src/components/shop/compare/ComparsionModal.vue?vue&type=template&id=74595e87&lang.js"],"sourcesContent":["<template>\n <section class=\"shop-comparsion\" v-if=\"modal && modal.category && modal.products\">\n <div class=\"comparsion-head\">\n <h1 class=\"page-title\" v-if=\"modal.category\">\n Порівнюємо {{ modal.category.name }}\n <span class=\"badge\" v-text=\"pluralize(modal.products.length, __('shop.pluralize.products'))\"></span>\n </h1>\n <button class=\"button comparsion-close\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#close\"></use>\n </svg>\n </button>\n </div>\n <div class=\"comparsion-controls\">\n <div class=\"compare-switcher\">\n <label class=\"switcher checkbox-label\">\n <input id=\"comparsion-show\" type=\"checkbox\" name=\"compare-view\" hidden />\n <span class=\"checkbox-custom\"></span>\n <span class=\"checkbox-text all-char\" @click=\"showAll = true\">Всі параметри</span>\n <span class=\"checkbox-text diff\" @click=\"showAll = false\">Тільки відмінності</span>\n </label>\n </div>\n\n <button class=\"button compare reset-compare\" @click=\"deleteCategory($event, modal.category.slug, modal.category.name)\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n <span>Очистити список</span>\n </button>\n\n <button class=\"all-compare-lists\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#compare\"></use>\n </svg>\n <span>Всі списки порівнянь</span>\n </button>\n </div>\n <div class=\"scroll-wrapper\">\n <div class=\"comparsion-body\">\n <div class=\"products\" ref=\"productsElement\">\n <table class=\"comparsion table\" id=\"comparsion-header\" v-bind:class=\"{ 'only-difference': !showAll }\">\n <thead>\n <th v-for=\"product in modal.products\" shop-product>\n <div class=\"is-hidden\" shop-product-category>{{ (modal.category.parent ? modal.category.parent + ' / ' : '') + modal.category.name }}</div>\n <div class=\"is-hidden\" shop-product-brand>{{ product.brand }}</div>\n <div class=\"product-card product-item\">\n <a class=\"product-item-image\" :href=\"product.href\" data-ga-item-index>\n <figure class=\"image\">\n <img :src=\"product.image\">\n </figure>\n </a>\n <div class=\"product-item-info\">\n <a class=\"product-item-title\" :href=\"product.href\" shop-product-name data-ga-item-index>\n {{ product.name }}\n </a>\n </div>\n <div class=\"product-item-controls\">\n <wishlist-add :id=\"product.id\" :code=\"product.code\" :property=\"product.property\"></wishlist-add>\n <button class=\"button compare\" @click=\"remove($event, product.id)\">\n <span class=\"product-remove\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n </span>\n </button>\n </div>\n <div class=\"product-item-add\">\n <div class=\"prices\">\n <div class=\"current-price\" v-html=\"product.price\" v-if=\"product.price\" shop-product-price></div>\n <div class=\"old-price\" v-html=\"product.priceOld\" v-if=\"product.priceOld\"></div>\n <div class=\"discount\" v-html=\"product.discount\" v-if=\"product.discount\"></div>\n </div>\n <div class=\"availability\">\n <div class=\"has-text-success\" v-if=\"product.available\">В наявності</div>\n <div class=\"available has-text-danger\" v-else>Товар очікується</div>\n </div>\n </div>\n <div class=\"is-hidden-tablet\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </div>\n </th>\n </thead>\n <tbody>\n <template v-for=\"property in modal.properties\">\n <tr class=\"row-title-mobile\">\n <td :colspan=\"modal.products.length\">\n <div class=\"row-title-text\">\n <p>{{ property.name }}</p>\n </div>\n </td>\n </tr>\n <tr :class=\"property.is_same ? 'is-same' : 'is-differs'\">\n <td v-for=\"(value, index) in property.values\">\n <div class=\"property-title property-title-desktop\">\n {{ property.name }}\n </div>\n <div class=\"property-product is-hidden-tablet\">\n {{ modal.products[index].name }}\n </div>\n <div class=\"property-value\">\n {{ value ? value : '—' }}\n </div>\n </td>\n </tr>\n </template>\n </tbody>\n <tfoot>\n <tr>\n <td v-for=\"product in modal.products\" shop-product :data-code=\"product.code\">\n <span class=\"is-hidden\" shop-product-name>{{ product.name }}</span>\n <span class=\"is-hidden\" shop-product-price>{{ product.price }}</span>\n <span class=\"is-hidden\" shop-product-brand>{{ product.brand }}</span>\n <span class=\"is-hidden\" shop-product-property>{{ product.property }}</span>\n <span class=\"is-hidden\" shop-product-category>{{ product.categoryFull }}</span>\n <div class=\"cell-btn-wrapper\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </td>\n </tr>\n </tfoot>\n </table>\n </div>\n </div>\n </div>\n </section>\n</template>\n<script>\nimport { ref, watch, computed, defineComponent, onMounted } from 'vue';\nimport { useStore } from 'vuex';\nimport { pluralize } from '@perevorot/shop/dist/helpers';\nimport { useToast } from \"vue-toastification\";\n\nconst toast = useToast();\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const modal = computed(() => {\n const out = store.getters['compare/modal'];\n\n return out;\n });\n const showAll = ref(true);\n const loading = ref(false);\n const productsElement = ref(null);\n\n watch(productsElement, (value) => {\n if (productsElement.value) {\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(productsElement.value);\n }\n }\n });\n\n const close = (e, isKeepCompare) => {\n if (!isKeepCompare) {\n const compareToggler = document.getElementById('compare-toggler');\n const compareOverlay = document.getElementById('compare-overlay');\n\n compareToggler.classList.remove('is-open');\n compareOverlay.classList.remove('is-open');\n\n document.querySelector('html').classList.remove('is-no-scroll');\n }\n\n store.commit('compare/modal', null);\n };\n\n const deleteCategory = ($event, slug, name) => {\n if (!loading.value) {\n loading.value = true;\n\n store.dispatch(\"compare/category\", {\n slug: slug,\n finally: () => {\n toast(\n __(\"shop.compare.category_deleted\", {\n category: name,\n }),\n {\n type: \"success\",\n }\n );\n\n close();\n\n loading.value = false;\n },\n });\n }\n };\n\n const remove = ($event, id) => {\n let slug = [];\n\n modal.value.products.forEach((product) => {\n if (product.id != id) {\n slug.push(product.id);\n }\n });\n\n store.dispatch(\"compare/delete\", {\n id: id,\n callback: (data) => {\n toast(\n __(\"shop.compare.product_deleted\"),\n {\n type: \"success\",\n }\n );\n\n let object = {\n event: 'remove_from_comparison_list'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n if (slug.length > 0) {\n store.dispatch(\"compare/modal\", {\n id: modal.value.category.slug + '/' + slug.join(','),\n finally: () => {\n loading.value = false;\n },\n });\n } else {\n deleteCategory(null, modal.value.category.slug, modal.value.category.name)\n }\n },\n finally: () => {\n loading.value = false;\n },\n });\n }\n\n window.addEventListener('beforeunload', () => {\n store.commit('compare/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit('compare/modal', null);\n });\n\n return {\n modal,\n close,\n pluralize,\n showAll,\n deleteCategory,\n remove,\n productsElement\n }\n }\n});\n</script>","<template>\n <section class=\"shop-comparsion\" v-if=\"modal && modal.category && modal.products\">\n <div class=\"comparsion-head\">\n <h1 class=\"page-title\" v-if=\"modal.category\">\n Порівнюємо {{ modal.category.name }}\n <span class=\"badge\" v-text=\"pluralize(modal.products.length, __('shop.pluralize.products'))\"></span>\n </h1>\n <button class=\"button comparsion-close\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#close\"></use>\n </svg>\n </button>\n </div>\n <div class=\"comparsion-controls\">\n <div class=\"compare-switcher\">\n <label class=\"switcher checkbox-label\">\n <input id=\"comparsion-show\" type=\"checkbox\" name=\"compare-view\" hidden />\n <span class=\"checkbox-custom\"></span>\n <span class=\"checkbox-text all-char\" @click=\"showAll = true\">Всі параметри</span>\n <span class=\"checkbox-text diff\" @click=\"showAll = false\">Тільки відмінності</span>\n </label>\n </div>\n\n <button class=\"button compare reset-compare\" @click=\"deleteCategory($event, modal.category.slug, modal.category.name)\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n <span>Очистити список</span>\n </button>\n\n <button class=\"all-compare-lists\" @click=\"close($event, true)\">\n <svg>\n <use xlink:href=\"#compare\"></use>\n </svg>\n <span>Всі списки порівнянь</span>\n </button>\n </div>\n <div class=\"scroll-wrapper\">\n <div class=\"comparsion-body\">\n <div class=\"products\" ref=\"productsElement\">\n <table class=\"comparsion table\" id=\"comparsion-header\" v-bind:class=\"{ 'only-difference': !showAll }\">\n <thead>\n <th v-for=\"product in modal.products\" shop-product>\n <div class=\"is-hidden\" shop-product-category>{{ (modal.category.parent ? modal.category.parent + ' / ' : '') + modal.category.name }}</div>\n <div class=\"is-hidden\" shop-product-brand>{{ product.brand }}</div>\n <div class=\"product-card product-item\">\n <a class=\"product-item-image\" :href=\"product.href\" data-ga-item-index>\n <figure class=\"image\">\n <img :src=\"product.image\">\n </figure>\n </a>\n <div class=\"product-item-info\">\n <a class=\"product-item-title\" :href=\"product.href\" shop-product-name data-ga-item-index>\n {{ product.name }}\n </a>\n </div>\n <div class=\"product-item-controls\">\n <wishlist-add :id=\"product.id\" :code=\"product.code\" :property=\"product.property\"></wishlist-add>\n <button class=\"button compare\" @click=\"remove($event, product.id)\">\n <span class=\"product-remove\">\n <svg>\n <use xlink:href=\"#icon-trash\"></use>\n </svg>\n </span>\n </button>\n </div>\n <div class=\"product-item-add\">\n <div class=\"prices\">\n <div class=\"current-price\" v-html=\"product.price\" v-if=\"product.price\" shop-product-price></div>\n <div class=\"old-price\" v-html=\"product.priceOld\" v-if=\"product.priceOld\"></div>\n <div class=\"discount\" v-html=\"product.discount\" v-if=\"product.discount\"></div>\n </div>\n <div class=\"availability\">\n <div class=\"has-text-success\" v-if=\"product.available\">В наявності</div>\n <div class=\"available has-text-danger\" v-else>Товар очікується</div>\n </div>\n </div>\n <div class=\"is-hidden-tablet\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </div>\n </th>\n </thead>\n <tbody>\n <template v-for=\"property in modal.properties\">\n <tr class=\"row-title-mobile\">\n <td :colspan=\"modal.products.length\">\n <div class=\"row-title-text\">\n <p>{{ property.name }}</p>\n </div>\n </td>\n </tr>\n <tr :class=\"property.is_same ? 'is-same' : 'is-differs'\">\n <td v-for=\"(value, index) in property.values\">\n <div class=\"property-title property-title-desktop\">\n {{ property.name }}\n </div>\n <div class=\"property-product is-hidden-tablet\">\n {{ modal.products[index].name }}\n </div>\n <div class=\"property-value\">\n {{ value ? value : '—' }}\n </div>\n </td>\n </tr>\n </template>\n </tbody>\n <tfoot>\n <tr>\n <td v-for=\"product in modal.products\" shop-product :data-code=\"product.code\">\n <span class=\"is-hidden\" shop-product-name>{{ product.name }}</span>\n <span class=\"is-hidden\" shop-product-price>{{ product.price }}</span>\n <span class=\"is-hidden\" shop-product-brand>{{ product.brand }}</span>\n <span class=\"is-hidden\" shop-product-property>{{ product.property }}</span>\n <span class=\"is-hidden\" shop-product-category>{{ product.categoryFull }}</span>\n <div class=\"cell-btn-wrapper\" @click=\"close($event)\">\n <cart-add :id=\"product.cart_id\" :is-simple=\"true\"></cart-add>\n </div>\n </td>\n </tr>\n </tfoot>\n </table>\n </div>\n </div>\n </div>\n </section>\n</template>\n<script>\nimport { ref, watch, computed, defineComponent, onMounted } from 'vue';\nimport { useStore } from 'vuex';\nimport { pluralize } from '@perevorot/shop/dist/helpers';\nimport { useToast } from \"vue-toastification\";\n\nconst toast = useToast();\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const modal = computed(() => {\n const out = store.getters['compare/modal'];\n\n return out;\n });\n const showAll = ref(true);\n const loading = ref(false);\n const productsElement = ref(null);\n\n watch(productsElement, (value) => {\n if (productsElement.value) {\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(productsElement.value);\n }\n }\n });\n\n const close = (e, isKeepCompare) => {\n if (!isKeepCompare) {\n const compareToggler = document.getElementById('compare-toggler');\n const compareOverlay = document.getElementById('compare-overlay');\n\n compareToggler.classList.remove('is-open');\n compareOverlay.classList.remove('is-open');\n\n document.querySelector('html').classList.remove('is-no-scroll');\n }\n\n store.commit('compare/modal', null);\n };\n\n const deleteCategory = ($event, slug, name) => {\n if (!loading.value) {\n loading.value = true;\n\n store.dispatch(\"compare/category\", {\n slug: slug,\n finally: () => {\n toast(\n __(\"shop.compare.category_deleted\", {\n category: name,\n }),\n {\n type: \"success\",\n }\n );\n\n close();\n\n loading.value = false;\n },\n });\n }\n };\n\n const remove = ($event, id) => {\n let slug = [];\n\n modal.value.products.forEach((product) => {\n if (product.id != id) {\n slug.push(product.id);\n }\n });\n\n store.dispatch(\"compare/delete\", {\n id: id,\n callback: (data) => {\n toast(\n __(\"shop.compare.product_deleted\"),\n {\n type: \"success\",\n }\n );\n\n let object = {\n event: 'remove_from_comparison_list'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n if (slug.length > 0) {\n store.dispatch(\"compare/modal\", {\n id: modal.value.category.slug + '/' + slug.join(','),\n finally: () => {\n loading.value = false;\n },\n });\n } else {\n deleteCategory(null, modal.value.category.slug, modal.value.category.name)\n }\n },\n finally: () => {\n loading.value = false;\n },\n });\n }\n\n window.addEventListener('beforeunload', () => {\n store.commit('compare/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit('compare/modal', null);\n });\n\n return {\n modal,\n close,\n pluralize,\n showAll,\n deleteCategory,\n remove,\n productsElement\n }\n }\n});\n</script>"],"names":["toast","defineComponent","setup","store","useStore","modal","computed","getters","showAll","ref","loading","productsElement","watch","value","window","promoCodeCallback","close","e","isKeepCompare","compareToggler","document","getElementById","compareOverlay","classList","remove","querySelector","commit","deleteCategory","$event","slug","name","dispatch","__","category","type","addEventListener","pluralize","id","products","forEach","product","push","callback","data","object","event","$env","debug","ecommerce","console","log","dataLayer","length","join","_createElementVNode","hidden","_ctx","_createElementBlock","_hoisted_1","_hoisted_2","_hoisted_3","_toDisplayString","onClick","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","parent","_hoisted_23","brand","_hoisted_24","href","_hoisted_26","src","image","_hoisted_28","_hoisted_30","_createVNode","code","property","_hoisted_34","_hoisted_35","price","innerHTML","priceOld","discount","_hoisted_39","available","_hoisted_40","_hoisted_41","cart_id","properties","_hoisted_42","colspan","_hoisted_44","is_same","values","index","_hoisted_45","_hoisted_46","_hoisted_47","_hoisted_49","_hoisted_50","_hoisted_51","_hoisted_52","_hoisted_53","categoryFull"],"mappings":"8FAqIMA,6CAEuBC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IG,kDAA6BD,QAAMyC,qBAAlBZ,8DACb/B,0BAAA4C,GACI5C,2BAAK6C,QAAS3C,QAAMlB,SAASc,SACzBE,2BAAA8C,GACI9C,gDAAM+B,EAASvD,mBAI3BwB,kDAAY+B,EAASgB,mDACjB5C,kDAA6B4B,EAASiB,iBAA1BzF,EAAO0F,wBAAnB9C,gCACIH,2BAAAkD,oBACOnB,EAASvD,SAEhBwB,2BAAAmD,oBACOjD,QAAMlB,SAASiE,GAAOzE,SAE7BwB,2BAAAoD,oBACO7F,0CAMvByC,mCACIA,iDACIG,kDAAsBD,QAAMlB,mBAAjBE,wBAAXiB,0CAAsC,eAAyBjB,EAAQ4C,OACnE9B,4BAAAqD,oBAA6CnE,EAAQV,SACrDwB,4BAAAsD,oBAA8CpE,EAAQgD,UACtDlC,4BAAAuD,oBAA8CrE,EAAQmC,UACtDrB,4BAAAwD,oBAAiDtE,EAAQ6C,aACzD/B,4BAAAyD,oBAAiDvE,EAAQwE,iBACzD1D,kCAAW,mBAAoBQ,uCAAON,QAAM5B,OACxCuD,kBAAW9C,GAAIG,EAAQwD,qBAAqB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(require("simplebar")),n=e.defineComponent({name:"filterSearch",props:{selector:String,element:String},setup:function(t){var n,o,c=e.ref(""),l=function(){if(c.value.trim()){var e=c.value.trim().toLowerCase(),t=[];u.forEach((function(r,n){-1!==r.indexOf(e)&&t.push(n)})),o.forEach((function(e){e.hidden=!0})),n.forEach((function(e,r){e.hidden=-1===t.indexOf(r)}))}else n.forEach((function(e){e.hidden=!1})),o.forEach((function(e){e.hidden=!1}))},u=[];return e.watch((function(){return c.value}),(function(){l()})),e.onMounted((function(){!function(){
|
|
1
|
+
"use strict";var e=require("vue");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(require("simplebar")),n=e.defineComponent({name:"filterSearch",props:{selector:String,element:String},setup:function(t){var n,o,c=e.ref(""),l=function(){if(c.value.trim()){var e=c.value.trim().toLowerCase(),t=[];u.forEach((function(r,n){-1!==r.indexOf(e)&&t.push(n)})),o.forEach((function(e){e.hidden=!0})),n.forEach((function(e,r){e.hidden=-1===t.indexOf(r)}))}else n.forEach((function(e){e.hidden=!1})),o.forEach((function(e){e.hidden=!1}))},u=[];return e.watch((function(){return c.value}),(function(){l()})),e.onMounted((function(){!function(){n=document.querySelectorAll(t.selector+" "+t.element),o=document.querySelectorAll(t.selector+" > :not("+t.element+")");var e=new r.default(document.querySelector(t.selector),{autoHide:!0}),c=document.querySelector(t.selector+" input[type=checkbox]:checked");c&&e.getScrollElement().scrollTo(0,c.closest(t.element).offsetTop),n.forEach((function(e){var t=e.querySelector("[filter]").textContent.trim();t.replace(/^[\s\d]+/,"")||(t=t.replace(/[^0-9 ]/g,"")),u.push(t.toLowerCase())}))}()})),{term:c,search:l}}}),o={class:"shop-filters-search"},c=["placeholder"];n.render=function(t,r,n,l,u,i){return e.openBlock(),e.createElementBlock("div",o,[e.withDirectives(e.createElementVNode("input",{type:"search",class:"input is-small mb-2",placeholder:t.__("shop.filter.search"),"onUpdate:modelValue":r[0]||(r[0]=function(e){return t.term=e})},null,8,c),[[e.vModelText,t.term]])])},module.exports=n;
|
|
2
2
|
//# sourceMappingURL=FilterSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSearch.js","sources":["../../../../src/components/shop/filters/FilterSearch.vue","../../../../src/components/shop/filters/FilterSearch.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"FilterSearch.js","sources":["../../../../src/components/shop/filters/FilterSearch.vue","../../../../src/components/shop/filters/FilterSearch.vue?vue&type=template&id=a7d1bee4&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-filters-search\">\n <input type=\"search\" class=\"input is-small mb-2\" :placeholder=\"__('shop.filter.search')\" v-model=\"term\" />\n </div>\n</template>\n<script>\nimport { ref, watch, defineComponent, onMounted } from 'vue';\nimport SimpleBar from 'simplebar';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'filterSearch',\n props: {\n selector: String,\n element: String\n },\n setup(props) {\n const term = ref('');\n\n const search = () => {\n if (term.value.trim()) {\n const t = term.value.trim().toLowerCase();\n let ids = [];\n\n data.forEach((item, key) => {\n if (item.indexOf(t) !== -1) {\n ids.push(key);\n }\n });\n\n otherElements.forEach((element) => {\n element.hidden = true;\n });\n\n nodes.forEach((node, key) => {\n node.hidden = ids.indexOf(key) === -1;\n });\n } else {\n nodes.forEach((node) => {\n node.hidden = false;\n });\n\n otherElements.forEach((element) => {\n element.hidden = false;\n });\n }\n };\n\n let data = [];\n let nodes;\n let otherElements;\n\n const load = () => {\n nodes = document.querySelectorAll(props.selector + ' ' + props.element);\n\n otherElements = document.querySelectorAll(props.selector + ' > :not(' + props.element + ')');\n\n const options = {\n autoHide: true\n };\n\n const scrollBar = new SimpleBar(document.querySelector(props.selector), options);\n\n const firstChecked = document.querySelector(props.selector + ' input[type=checkbox]:checked');\n\n if (firstChecked) {\n scrollBar.getScrollElement().scrollTo(0, firstChecked.closest(props.element).offsetTop);\n }\n\n nodes.forEach((element) => {\n let text = element.querySelector('[filter]').textContent.trim();\n\n if (!text.replace(/^[\\s\\d]+/, '')) {\n text = text.replace(/[^0-9 ]/g, '');\n }\n\n data.push(text.toLowerCase());\n });\n };\n\n watch(\n () => term.value,\n () => {\n search();\n }\n );\n\n onMounted(() => {\n load();\n });\n\n //document.addEventListener('DOMContentLoaded', load, false);\n\n return {\n term,\n search\n };\n }\n});\n</script>","<template>\n <div class=\"shop-filters-search\">\n <input type=\"search\" class=\"input is-small mb-2\" :placeholder=\"__('shop.filter.search')\" v-model=\"term\" />\n </div>\n</template>\n<script>\nimport { ref, watch, defineComponent, onMounted } from 'vue';\nimport SimpleBar from 'simplebar';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'filterSearch',\n props: {\n selector: String,\n element: String\n },\n setup(props) {\n const term = ref('');\n\n const search = () => {\n if (term.value.trim()) {\n const t = term.value.trim().toLowerCase();\n let ids = [];\n\n data.forEach((item, key) => {\n if (item.indexOf(t) !== -1) {\n ids.push(key);\n }\n });\n\n otherElements.forEach((element) => {\n element.hidden = true;\n });\n\n nodes.forEach((node, key) => {\n node.hidden = ids.indexOf(key) === -1;\n });\n } else {\n nodes.forEach((node) => {\n node.hidden = false;\n });\n\n otherElements.forEach((element) => {\n element.hidden = false;\n });\n }\n };\n\n let data = [];\n let nodes;\n let otherElements;\n\n const load = () => {\n nodes = document.querySelectorAll(props.selector + ' ' + props.element);\n\n otherElements = document.querySelectorAll(props.selector + ' > :not(' + props.element + ')');\n\n const options = {\n autoHide: true\n };\n\n const scrollBar = new SimpleBar(document.querySelector(props.selector), options);\n\n const firstChecked = document.querySelector(props.selector + ' input[type=checkbox]:checked');\n\n if (firstChecked) {\n scrollBar.getScrollElement().scrollTo(0, firstChecked.closest(props.element).offsetTop);\n }\n\n nodes.forEach((element) => {\n let text = element.querySelector('[filter]').textContent.trim();\n\n if (!text.replace(/^[\\s\\d]+/, '')) {\n text = text.replace(/[^0-9 ]/g, '');\n }\n\n data.push(text.toLowerCase());\n });\n };\n\n watch(\n () => term.value,\n () => {\n search();\n }\n );\n\n onMounted(() => {\n load();\n });\n\n //document.addEventListener('DOMContentLoaded', load, false);\n\n return {\n term,\n search\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","selector","String","element","setup","nodes","otherElements","term","ref","search","value","trim","t","toLowerCase","ids","data","forEach","item","key","indexOf","push","hidden","node","watch","onMounted","document","querySelectorAll","scrollBar","SimpleBar","querySelector","autoHide","firstChecked","getScrollElement","scrollTo","closest","offsetTop","text","textContent","replace","load","_createElementBlock","_hoisted_1","_createElementVNode","type","placeholder","_ctx"],"mappings":"0IAS6BA,kBAAgB,CACzCC,KAAM,eACNC,MAAO,CACHC,SAAUC,OACVC,QAASD,QAEbE,eAAMJ,OAiCEK,EACAC,EAjCEC,EAAOC,MAAI,I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