@perevorot/shop 1.1.21 → 1.1.23
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/js/components/auth/Login.js +1 -1
- package/dist/js/components/auth/Login.js.map +1 -1
- package/dist/js/components/auth/Registration.js +1 -1
- package/dist/js/components/auth/Registration.js.map +1 -1
- package/dist/js/components/auth/User.js +1 -1
- package/dist/js/components/auth/User.js.map +1 -1
- package/dist/js/components/shop/Gallery.js +1 -1
- package/dist/js/components/shop/Gallery.js.map +1 -1
- package/dist/js/components/shop/Pagination.js +1 -1
- package/dist/js/components/shop/Pagination.js.map +1 -1
- package/dist/js/components/shop/cart/Cart.js +1 -1
- package/dist/js/components/shop/cart/Cart.js.map +1 -1
- package/dist/js/components/shop/cart/CartAdd.js +1 -1
- package/dist/js/components/shop/cart/CartAdd.js.map +1 -1
- package/dist/js/components/shop/cart/CartItem.js +1 -1
- package/dist/js/components/shop/cart/CartItem.js.map +1 -1
- package/dist/js/components/shop/cart/CartTrigger.js +1 -1
- package/dist/js/components/shop/cart/CartTrigger.js.map +1 -1
- package/dist/js/components/shop/compare/CompareAdd.js +1 -1
- package/dist/js/components/shop/compare/CompareAdd.js.map +1 -1
- package/dist/js/components/shop/order/OneClick.js +1 -1
- package/dist/js/components/shop/order/OneClick.js.map +1 -1
- package/dist/js/components/shop/wishlist/WishlistAdd.js +1 -1
- package/dist/js/components/shop/wishlist/WishlistAdd.js.map +1 -1
- package/dist/js/components/shop/wishlist/WishlistDelete.js +1 -1
- package/dist/js/components/shop/wishlist/WishlistDelete.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartAdd.js","sources":["../../../../../src/js/components/shop/cart/SuccessMessage.vue","../../../../../src/js/components/shop/cart/SuccessMessage.vue?vue&type=template&id=39849712&lang.js","../../../../../src/js/components/shop/cart/CartAdd.vue","../../../../../src/js/components/shop/cart/CartAdd.vue?vue&type=template&id=5462c63a&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-cart-success-message\">\n {{ translate(\"shop.cart.message\") }}\n </div>\n</template>\n<script>\nexport default {\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"shop-cart-success-message\">\n {{ translate(\"shop.cart.message\") }}\n </div>\n</template>\n<script>\nexport default {\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"cart-add\" ref=\"button\" v-bind:class=\"{ 'is-already-in-cart': $env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0 }\">\n <div class=\"columns\">\n <div class=\"column\" v-if=\"$env.shop.isCustomQuantity && isChangeQuantity\">\n <div class=\"cart-change-quantity\">\n <button class=\"button is-small decrease\" @click=\"decrease\" :disabled=\"loading || quantity == 1\" v-if=\"isPlusMinus\">-</button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"quantity\" :disabled=\"loading\" />\n <button class=\"button is-small increase\" @click=\"increase\" :disabled=\"loading\" v-if=\"isPlusMinus\">+</button>\n </div>\n </div>\n <div class=\"column is-narrow\">\n <button class=\"button is-link is-small\" v-on:click=\"add\" :disabled=\"loading\">\n <slot :label=\"__('shop.cart.add')\">\n <svg class=\"icon cart\">\n <use v-bind=\"{ 'xlink:href': cartIcon }\" />\n </svg>\n <span class=\"cart-add-button-label\">{{ __('shop.cart.add') }}</span>\n </slot>\n </button>\n </div>\n </div>\n <div v-if=\"$env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0\">\n {{ __('shop.cart.already', { quantity: cart }) }}\n <br />\n <a v-on:click.prevent=\"remove\" :disabled=\"loading\" v-text=\"__('shop.cart.remove')\"></a>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { useToast } from 'vue-toastification';\nimport SuccessMessage from './SuccessMessage.vue';\n\nconst toast = useToast();\n\nexport default {\n name: 'cart-add',\n props: {\n id: Number,\n isChangeQuantity: {\n type: Boolean,\n default: true\n },\n isAlreadyInCart: {\n type: Boolean,\n default: true\n },\n isSimple: {\n type: Boolean,\n default: false\n },\n isPlusMinus: {\n type: Boolean,\n default: false\n },\n after: {\n type: String,\n default: 'modal'\n },\n product: null\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const quantity = ref(1);\n const button = ref(null);\n\n const cart = computed(() => store.getters['cart/productQuantity'](props.id));\n\n const cartIcon = computed(() => {\n return $env.shop.isAlreadyInCart && isAlreadyInCart && cart.value > 0 ? '#cart-add-already' : '#cart-add';\n });\n\n let isAlreadyInCart = props.isAlreadyInCart;\n let isChangeQuantity = props.isChangeQuantity;\n let isPlusMinus = props.isPlusMinus;\n\n if (props.isSimple) {\n isAlreadyInCart = false;\n isChangeQuantity = false;\n isPlusMinus = false;\n }\n\n const add = () => {\n loading.value = true;\n\n let options = [];\n\n if (button.value.closest('.product-main')) {\n const checkedOptions = document.querySelectorAll('#options input[type=checkbox]:checked');\n\n checkedOptions.forEach((element) => {\n options.push(parseInt(element.value));\n });\n }\n\n const q = Math.max(1, quantity.value);\n const product = button.value.closest('[shop-product]');\n const name = props.product ? props.product.name : product.querySelector('[shop-product-name]').textContent;\n const price = props.product ? props.product.price_clean : product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '');\n const code = props.product ? props.product.code : product.dataset.code;\n const category = props.product ? props.product.category : product.dataset.category;\n const brand = props.product ? props.product.brand : product.dataset.brand;\n\n store.dispatch('cart/add', {\n product: {\n id: props.id,\n quantity: q,\n options: options\n },\n finally: () => {\n loading.value = false;\n quantity.value = 1;\n\n if (props.after == 'message') {\n const component = {\n component: SuccessMessage\n };\n\n toast(component, {\n type: 'success-cart'\n });\n }\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: 'add_to_cart'\n };\n\n if ($env.debug.ecommerce) {\n console.log(JSON.stringify(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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.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(JSON.stringify(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.value++;\n };\n\n const decrease = () => {\n if (quantity.value > 1) {\n quantity.value--;\n }\n };\n\n return {\n button,\n loading,\n quantity,\n add,\n remove,\n cart,\n increase,\n decrease,\n isAlreadyInCart,\n isChangeQuantity,\n isPlusMinus,\n cartIcon,\n };\n }\n};\n</script>\n","<template>\n <div class=\"cart-add\" ref=\"button\" v-bind:class=\"{ 'is-already-in-cart': $env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0 }\">\n <div class=\"columns\">\n <div class=\"column\" v-if=\"$env.shop.isCustomQuantity && isChangeQuantity\">\n <div class=\"cart-change-quantity\">\n <button class=\"button is-small decrease\" @click=\"decrease\" :disabled=\"loading || quantity == 1\" v-if=\"isPlusMinus\">-</button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"quantity\" :disabled=\"loading\" />\n <button class=\"button is-small increase\" @click=\"increase\" :disabled=\"loading\" v-if=\"isPlusMinus\">+</button>\n </div>\n </div>\n <div class=\"column is-narrow\">\n <button class=\"button is-link is-small\" v-on:click=\"add\" :disabled=\"loading\">\n <slot :label=\"__('shop.cart.add')\">\n <svg class=\"icon cart\">\n <use v-bind=\"{ 'xlink:href': cartIcon }\" />\n </svg>\n <span class=\"cart-add-button-label\">{{ __('shop.cart.add') }}</span>\n </slot>\n </button>\n </div>\n </div>\n <div v-if=\"$env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0\">\n {{ __('shop.cart.already', { quantity: cart }) }}\n <br />\n <a v-on:click.prevent=\"remove\" :disabled=\"loading\" v-text=\"__('shop.cart.remove')\"></a>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { useToast } from 'vue-toastification';\nimport SuccessMessage from './SuccessMessage.vue';\n\nconst toast = useToast();\n\nexport default {\n name: 'cart-add',\n props: {\n id: Number,\n isChangeQuantity: {\n type: Boolean,\n default: true\n },\n isAlreadyInCart: {\n type: Boolean,\n default: true\n },\n isSimple: {\n type: Boolean,\n default: false\n },\n isPlusMinus: {\n type: Boolean,\n default: false\n },\n after: {\n type: String,\n default: 'modal'\n },\n product: null\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const quantity = ref(1);\n const button = ref(null);\n\n const cart = computed(() => store.getters['cart/productQuantity'](props.id));\n\n const cartIcon = computed(() => {\n return $env.shop.isAlreadyInCart && isAlreadyInCart && cart.value > 0 ? '#cart-add-already' : '#cart-add';\n });\n\n let isAlreadyInCart = props.isAlreadyInCart;\n let isChangeQuantity = props.isChangeQuantity;\n let isPlusMinus = props.isPlusMinus;\n\n if (props.isSimple) {\n isAlreadyInCart = false;\n isChangeQuantity = false;\n isPlusMinus = false;\n }\n\n const add = () => {\n loading.value = true;\n\n let options = [];\n\n if (button.value.closest('.product-main')) {\n const checkedOptions = document.querySelectorAll('#options input[type=checkbox]:checked');\n\n checkedOptions.forEach((element) => {\n options.push(parseInt(element.value));\n });\n }\n\n const q = Math.max(1, quantity.value);\n const product = button.value.closest('[shop-product]');\n const name = props.product ? props.product.name : product.querySelector('[shop-product-name]').textContent;\n const price = props.product ? props.product.price_clean : product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '');\n const code = props.product ? props.product.code : product.dataset.code;\n const category = props.product ? props.product.category : product.dataset.category;\n const brand = props.product ? props.product.brand : product.dataset.brand;\n\n store.dispatch('cart/add', {\n product: {\n id: props.id,\n quantity: q,\n options: options\n },\n finally: () => {\n loading.value = false;\n quantity.value = 1;\n\n if (props.after == 'message') {\n const component = {\n component: SuccessMessage\n };\n\n toast(component, {\n type: 'success-cart'\n });\n }\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: 'add_to_cart'\n };\n\n if ($env.debug.ecommerce) {\n console.log(JSON.stringify(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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.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(JSON.stringify(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.value++;\n };\n\n const decrease = () => {\n if (quantity.value > 1) {\n quantity.value--;\n }\n };\n\n return {\n button,\n loading,\n quantity,\n add,\n remove,\n cart,\n increase,\n decrease,\n isAlreadyInCart,\n isChangeQuantity,\n isPlusMinus,\n cartIcon,\n };\n }\n};\n</script>\n"],"names":["script$1","setup","translate","window","__","_hoisted_1","class","_createElementBlock","_toDisplayString","$setup","toast","useToast","script","name","props","id","Number","isChangeQuantity","type","Boolean","default","isAlreadyInCart","isSimple","isPlusMinus","after","String","product","store","useStore","loading","ref","quantity","button","cart","computed","getters","cartIcon","$env","shop","value","add","options","closest","document","querySelectorAll","forEach","element","push","parseInt","q","Math","max","querySelector","textContent","price","price_clean","childNodes","nodeValue","replace","code","dataset","category","brand","dispatch","finally","component","SuccessMessage","object","ecommerce","currencyCode","items","item_name","item_id","item_brand","item_category","event","debug","console","log","JSON","stringify","dataLayer","remove","increase","decrease","_hoisted_3","_hoisted_7","_hoisted_9","_hoisted_10","_createElementVNode","createElementVNode","createElementBlock","_normalizeClass","is-already-in-cart","_ctx","isCustomQuantity","_openBlock","_hoisted_2","onClick","apply","arguments","disabled","_hoisted_4","min","$event","_hoisted_6","_renderSlot","renderSlot","$slots","label","toDisplayString","_hoisted_11","_hoisted_12"],"mappings":"oFAMeA,EAAA,CACXC,MAAK,WAGD,MAAO,CACHC,UAHcC,OAAOC,MCPxBC,EAAA,CAAAC,MAAM,iFAAXC,qBAEK,MAFLF,EAEKG,EAAAA,gBADEC,EAASP,UAAA,sBAAA,ICgCpB,IAAMQ,EAAQC,EAAQA,WAEPC,EAAA,CACXC,KAAM,WACNC,MAAO,CACHC,GAAIC,OACJC,iBAAkB,CACdC,KAAMC,QACNC,SAAS,GAEbC,gBAAiB,CACbH,KAAMC,QACNC,SAAS,GAEbE,SAAU,CACNJ,KAAMC,QACNC,SAAS,GAEbG,YAAa,CACTL,KAAMC,QACNC,SAAS,GAEbI,MAAO,CACHN,KAAMO,OACNL,QAAS,SAEbM,QAAS,MAEbzB,MAAAA,SAAMa,GACF,IAAMa,EAAQC,EAAAA,WACRC,EAAUC,OAAI,GACdC,EAAWD,MAAI,GACfE,EAASF,MAAI,MAEbG,EAAOC,EAAAA,UAAS,WAAA,OAAMP,EAAMQ,QAAQ,wBAAwBrB,EAAMC,OAElEqB,EAAWF,EAAAA,UAAS,WACtB,OAAOG,KAAKC,KAAKjB,iBAAmBA,GAAmBY,EAAKM,MAAQ,EAAI,oBAAsB,eAG9FlB,EAAkBP,EAAMO,gBACxBJ,EAAmBH,EAAMG,iBACzBM,EAAcT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CAA9EQ,uDAAezF,EAAMyE,QAAAzE,EAAAyE,OAAAiB,MAAA1F,EAAA2F,aAAA,CAAA,aAAGC,SAAU5F,EAAOoB,QAAEwB,YAAA7C,EAAAA,gBAAQsF,EAAE1F,GAAA"}
|
|
1
|
+
{"version":3,"file":"CartAdd.js","sources":["../../../../../src/js/components/shop/cart/SuccessMessage.vue","../../../../../src/js/components/shop/cart/SuccessMessage.vue?vue&type=template&id=39849712&lang.js","../../../../../src/js/components/shop/cart/CartAdd.vue","../../../../../src/js/components/shop/cart/CartAdd.vue?vue&type=template&id=a1629598&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-cart-success-message\">\n {{ translate(\"shop.cart.message\") }}\n </div>\n</template>\n<script>\nexport default {\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"shop-cart-success-message\">\n {{ translate(\"shop.cart.message\") }}\n </div>\n</template>\n<script>\nexport default {\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"cart-add\" ref=\"button\" v-bind:class=\"{ 'is-already-in-cart': $env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0 }\">\n <div class=\"columns\">\n <div class=\"column\" v-if=\"$env.shop.isCustomQuantity && isChangeQuantity\">\n <div class=\"cart-change-quantity\">\n <button class=\"button is-small decrease\" @click=\"decrease\" :disabled=\"loading || quantity == 1\" v-if=\"isPlusMinus\" aria-label=\"Decrease\">-</button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"quantity\" :disabled=\"loading\" />\n <button class=\"button is-small increase\" @click=\"increase\" :disabled=\"loading\" v-if=\"isPlusMinus\" aria-label=\"Increase\">+</button>\n </div>\n </div>\n <div class=\"column is-narrow\">\n <button class=\"button is-link is-small\" v-on:click=\"add\" :disabled=\"loading\" aria-label=\"Add to cart\">\n <slot :label=\"__('shop.cart.add')\">\n <svg class=\"icon cart\">\n <use v-bind=\"{ 'xlink:href': cartIcon }\" />\n </svg>\n <span class=\"cart-add-button-label\">{{ __('shop.cart.add') }}</span>\n </slot>\n </button>\n </div>\n </div>\n <div v-if=\"$env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0\">\n {{ __('shop.cart.already', { quantity: cart }) }}\n <br />\n <a v-on:click.prevent=\"remove\" :disabled=\"loading\" v-text=\"__('shop.cart.remove')\"></a>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { useToast } from 'vue-toastification';\nimport SuccessMessage from './SuccessMessage.vue';\n\nconst toast = useToast();\n\nexport default {\n name: 'cart-add',\n props: {\n id: Number,\n isChangeQuantity: {\n type: Boolean,\n default: true\n },\n isAlreadyInCart: {\n type: Boolean,\n default: true\n },\n isSimple: {\n type: Boolean,\n default: false\n },\n isPlusMinus: {\n type: Boolean,\n default: false\n },\n after: {\n type: String,\n default: 'modal'\n },\n product: null\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const quantity = ref(1);\n const button = ref(null);\n\n const cart = computed(() => store.getters['cart/productQuantity'](props.id));\n\n const cartIcon = computed(() => {\n return $env.shop.isAlreadyInCart && isAlreadyInCart && cart.value > 0 ? '#cart-add-already' : '#cart-add';\n });\n\n let isAlreadyInCart = props.isAlreadyInCart;\n let isChangeQuantity = props.isChangeQuantity;\n let isPlusMinus = props.isPlusMinus;\n\n if (props.isSimple) {\n isAlreadyInCart = false;\n isChangeQuantity = false;\n isPlusMinus = false;\n }\n\n const add = () => {\n loading.value = true;\n\n let options = [];\n\n if (button.value.closest('.product-main')) {\n const checkedOptions = document.querySelectorAll('#options input[type=checkbox]:checked');\n\n checkedOptions.forEach((element) => {\n options.push(parseInt(element.value));\n });\n }\n\n const q = Math.max(1, quantity.value);\n const product = button.value.closest('[shop-product]');\n const name = props.product ? props.product.name : product.querySelector('[shop-product-name]').textContent;\n const price = props.product ? props.product.price_clean : product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '');\n const code = props.product ? props.product.code : product.dataset.code;\n const category = props.product ? props.product.category : product.dataset.category;\n const brand = props.product ? props.product.brand : product.dataset.brand;\n\n store.dispatch('cart/add', {\n product: {\n id: props.id,\n quantity: q,\n options: options\n },\n finally: () => {\n loading.value = false;\n quantity.value = 1;\n\n if (props.after == 'message') {\n const component = {\n component: SuccessMessage\n };\n\n toast(component, {\n type: 'success-cart'\n });\n }\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: 'add_to_cart'\n };\n\n if ($env.debug.ecommerce) {\n console.log(JSON.stringify(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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.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(JSON.stringify(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.value++;\n };\n\n const decrease = () => {\n if (quantity.value > 1) {\n quantity.value--;\n }\n };\n\n return {\n button,\n loading,\n quantity,\n add,\n remove,\n cart,\n increase,\n decrease,\n isAlreadyInCart,\n isChangeQuantity,\n isPlusMinus,\n cartIcon,\n };\n }\n};\n</script>\n","<template>\n <div class=\"cart-add\" ref=\"button\" v-bind:class=\"{ 'is-already-in-cart': $env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0 }\">\n <div class=\"columns\">\n <div class=\"column\" v-if=\"$env.shop.isCustomQuantity && isChangeQuantity\">\n <div class=\"cart-change-quantity\">\n <button class=\"button is-small decrease\" @click=\"decrease\" :disabled=\"loading || quantity == 1\" v-if=\"isPlusMinus\" aria-label=\"Decrease\">-</button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"quantity\" :disabled=\"loading\" />\n <button class=\"button is-small increase\" @click=\"increase\" :disabled=\"loading\" v-if=\"isPlusMinus\" aria-label=\"Increase\">+</button>\n </div>\n </div>\n <div class=\"column is-narrow\">\n <button class=\"button is-link is-small\" v-on:click=\"add\" :disabled=\"loading\" aria-label=\"Add to cart\">\n <slot :label=\"__('shop.cart.add')\">\n <svg class=\"icon cart\">\n <use v-bind=\"{ 'xlink:href': cartIcon }\" />\n </svg>\n <span class=\"cart-add-button-label\">{{ __('shop.cart.add') }}</span>\n </slot>\n </button>\n </div>\n </div>\n <div v-if=\"$env.shop.isAlreadyInCart && isAlreadyInCart && cart > 0\">\n {{ __('shop.cart.already', { quantity: cart }) }}\n <br />\n <a v-on:click.prevent=\"remove\" :disabled=\"loading\" v-text=\"__('shop.cart.remove')\"></a>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { useToast } from 'vue-toastification';\nimport SuccessMessage from './SuccessMessage.vue';\n\nconst toast = useToast();\n\nexport default {\n name: 'cart-add',\n props: {\n id: Number,\n isChangeQuantity: {\n type: Boolean,\n default: true\n },\n isAlreadyInCart: {\n type: Boolean,\n default: true\n },\n isSimple: {\n type: Boolean,\n default: false\n },\n isPlusMinus: {\n type: Boolean,\n default: false\n },\n after: {\n type: String,\n default: 'modal'\n },\n product: null\n },\n setup(props) {\n const store = useStore();\n const loading = ref(false);\n const quantity = ref(1);\n const button = ref(null);\n\n const cart = computed(() => store.getters['cart/productQuantity'](props.id));\n\n const cartIcon = computed(() => {\n return $env.shop.isAlreadyInCart && isAlreadyInCart && cart.value > 0 ? '#cart-add-already' : '#cart-add';\n });\n\n let isAlreadyInCart = props.isAlreadyInCart;\n let isChangeQuantity = props.isChangeQuantity;\n let isPlusMinus = props.isPlusMinus;\n\n if (props.isSimple) {\n isAlreadyInCart = false;\n isChangeQuantity = false;\n isPlusMinus = false;\n }\n\n const add = () => {\n loading.value = true;\n\n let options = [];\n\n if (button.value.closest('.product-main')) {\n const checkedOptions = document.querySelectorAll('#options input[type=checkbox]:checked');\n\n checkedOptions.forEach((element) => {\n options.push(parseInt(element.value));\n });\n }\n\n const q = Math.max(1, quantity.value);\n const product = button.value.closest('[shop-product]');\n const name = props.product ? props.product.name : product.querySelector('[shop-product-name]').textContent;\n const price = props.product ? props.product.price_clean : product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '');\n const code = props.product ? props.product.code : product.dataset.code;\n const category = props.product ? props.product.category : product.dataset.category;\n const brand = props.product ? props.product.brand : product.dataset.brand;\n\n store.dispatch('cart/add', {\n product: {\n id: props.id,\n quantity: q,\n options: options\n },\n finally: () => {\n loading.value = false;\n quantity.value = 1;\n\n if (props.after == 'message') {\n const component = {\n component: SuccessMessage\n };\n\n toast(component, {\n type: 'success-cart'\n });\n }\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: 'add_to_cart'\n };\n\n if ($env.debug.ecommerce) {\n console.log(JSON.stringify(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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.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(JSON.stringify(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.value++;\n };\n\n const decrease = () => {\n if (quantity.value > 1) {\n quantity.value--;\n }\n };\n\n return {\n button,\n loading,\n quantity,\n add,\n remove,\n cart,\n increase,\n decrease,\n isAlreadyInCart,\n isChangeQuantity,\n isPlusMinus,\n cartIcon,\n };\n }\n};\n</script>\n"],"names":["script$1","setup","translate","window","__","_hoisted_1","class","_createElementBlock","_toDisplayString","$setup","toast","useToast","script","name","props","id","Number","isChangeQuantity","type","Boolean","default","isAlreadyInCart","isSimple","isPlusMinus","after","String","product","store","useStore","loading","ref","quantity","button","cart","computed","getters","cartIcon","$env","shop","value","add","options","closest","document","querySelectorAll","forEach","element","push","parseInt","q","Math","max","querySelector","textContent","price","price_clean","childNodes","nodeValue","replace","code","dataset","category","brand","dispatch","finally","component","SuccessMessage","object","ecommerce","currencyCode","items","item_name","item_id","item_brand","item_category","event","debug","console","log","JSON","stringify","dataLayer","remove","increase","decrease","_hoisted_3","_hoisted_7","_hoisted_9","_hoisted_10","_createElementVNode","createElementVNode","createElementBlock","_normalizeClass","is-already-in-cart","_ctx","isCustomQuantity","_openBlock","_hoisted_2","onClick","apply","arguments","disabled","aria-label","_hoisted_4","min","$event","_hoisted_6","_renderSlot","renderSlot","$slots","label","toDisplayString","_hoisted_11","_hoisted_12"],"mappings":"oFAMeA,EAAA,CACXC,MAAK,WAGD,MAAO,CACHC,UAHcC,OAAOC,MCPxBC,EAAA,CAAAC,MAAM,iFAAXC,qBAEK,MAFLF,EAEKG,EAAAA,gBADEC,EAASP,UAAA,sBAAA,ICgCpB,IAAMQ,EAAQC,EAAQA,WAEPC,EAAA,CACXC,KAAM,WACNC,MAAO,CACHC,GAAIC,OACJC,iBAAkB,CACdC,KAAMC,QACNC,SAAS,GAEbC,gBAAiB,CACbH,KAAMC,QACNC,SAAS,GAEbE,SAAU,CACNJ,KAAMC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K,EAKMC,WAAAd,EAAAe,OAAA,UAAA,CALCC,MAAOhB,EAAE1F,GAAA,mBAAhB,WAAA,MAKM,EAJF4F,EAAAA,YAAAzF,EAAAA,mBAEK,MAFLgF,EAEK,CADDE,qBAA0C,0DAAbhF,EAAS2B,YAAA,KAAA,OAE1CqD,EAAmEC,mBAAA,OAAnEF,EAAmEhF,EAAAuG,gBAA5BjB,EAAE1F,GAAA,kBAAA,iBAK9C0F,EAAAzD,KAAKC,KAAKjB,iBAAmBZ,EAAAY,iBAAmBZ,EAAGwB,KAAA,iBAA9D1B,EAIKoF,mBAAA,MAAAqB,EAAA,qCAHElB,EAAE1F,GAAA,oBAAA,CAAA2B,SAAkCtB,EAAKwB,QAAI,IAChD,GAAAgF,EACAxB,EAAsFC,mBAAA,IAAA,CAA9EQ,uDAAezF,EAAMyE,QAAAzE,EAAAyE,OAAAiB,MAAA1F,EAAA2F,aAAA,CAAA,aAAGC,SAAU5F,EAAOoB,QAAEwB,YAAA7C,EAAAA,gBAAQsF,EAAE1F,GAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),i={name:"CartItem",props:{item:Object},setup:function(i){var n=t.useStore(),o=e.ref(!1),l=e.ref(),a=e.ref(i.item.attributes.options&&i.item.attributes.options.length?i.item.attributes.options:[]),c=e.ref(!1),r=e.computed((function(){return n.getters["auth/is"]}));i.item.attributes.options&&i.item.attributes.options.length&&(c.value=!0);var s=function(e){o.value=!0,n.dispatch("cart/add",{product:{id:i.item.id,quantity:e},finally:function(){o.value=!1}})};i.item.options&&i.item.options.length&&e.watch(a,(function(e){o.value=!0,n.dispatch("cart/options",{product:{id:i.item.id,options:Object.values(e)},finally:function(){o.value=!1}})}));return{loading:o,increase:function(){s(1)},decrease:function(){s(-1)},remove:function(){o.value=!0,n.dispatch("cart/remove",{id:i.item.id,finally:function(){o.value=!1}})},options:a,optionsToggled:c,input:l,gotoProduct:function(e){window.addEventListener("beforeunload",(function(){n.commit("cart/modal",null)})),window.location.href=e},auth:r}}},n={key:0,class:"column is-12"},o=[e.createElementVNode("div",{class:"bundle-title"},"Вместе дешевле",-1)],l={class:"column name"},a={class:"column is-narrow"},c={class:"cart-actions"},r=["disabled"],s=[e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#cart-remove"})],-1)],m={class:"column is-narrow"},d=["src"],u={key:1},p=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],v={class:"column"},k={class:"columns is-gapless mb-0"},b={class:"column"},E={key:0,class:"code"},V={class:"title"},g={key:0},N={key:0,class:"column is-narrow has-text-right is-relative"},f={class:"quantity"},h=["disabled"],y=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-minus"})],-1)],B=["disabled"],C=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-plus"})],-1)],w={key:0,class:"quantity-price"},x=["innerHTML"],T=e.createTextVNode(" / шт"),q={class:"column is-2 has-text-right"},D=["innerHTML"],L=["innerHTML"],M=["innerHTML"],S=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),H={class:"wrapper"},z={class:"column is-narrow"},P=["value","id"],O={class:"column"},$=["for"],j={key:0,class:"option-description"},U={class:"column is-2 has-text-right"},F=e.createTextVNode("+"),I=["innerHTML"],A={key:0,class:"bundle columns"},G=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),J={class:"column is-narrow"},K=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),Q=["src"],R={key:1},W=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],X={class:"column"},Y={key:0,class:"code"},Z={class:"title"},_={key:1,class:"bundle columns"},ee=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),te={class:"column is-narrow"},ie=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),ne=["src"],oe={key:1},le=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],ae={class:"column"},ce={key:0,class:"code"},re={class:"title"};i.render=function(t,i,se,me,de,ue){var pe=e.resolveComponent("wishlist-add");return se.item.deleted?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["columns is-multiline shop-cart-item",{inactive:!1===se.item.attributes.active,"is-bundle":se.item.attributes.bundle}])},[se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",n,o)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",l,[e.createElementVNode("div",{class:e.normalizeClass(["columns",{"mb-0":se.item.attributes.bundle}])},[e.createElementVNode("div",a,[e.createElementVNode("div",c,[e.createElementVNode("button",{class:"remove",onClick:i[0]||(i[0]=function(){return me.remove&&me.remove.apply(me,arguments)}),disabled:me.loading},s,8,r),me.auth&&!se.item.attributes.bundle?(e.openBlock(),e.createBlock(pe,{key:0,id:se.item.id},null,8,["id"])):e.createCommentVNode("v-if",!0)])]),e.createElementVNode("div",m,[e.createElementVNode("a",{onClick:i[1]||(i[1]=function(e){return me.gotoProduct(se.item.attributes.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.image}])},[se.item.attributes.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.image},null,8,d)):(e.openBlock(),e.createElementBlock("svg",u,p))],2)])]),e.createElementVNode("div",v,[e.createElementVNode("div",k,[e.createElementVNode("div",b,[se.item.attributes.code?(e.openBlock(),e.createElementBlock("div",E,"Код продукта: "+e.toDisplayString(se.item.attributes.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",V,[!1===se.item.attributes.active?(e.openBlock(),e.createElementBlock("span",g,e.toDisplayString(se.item.name),1)):(e.openBlock(),e.createElementBlock("a",{key:1,onClick:i[2]||(i[2]=function(e){return me.gotoProduct(se.item.attributes.href)})},e.toDisplayString(se.item.name),1))])]),(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",f,[e.createElementVNode("button",{class:"button decrease",onClick:i[3]||(i[3]=function(){return me.decrease&&me.decrease.apply(me,arguments)}),disabled:me.loading||1==se.item.quantity},y,8,h),e.withDirectives(e.createElementVNode("input",{class:"input is-small",type:"number",min:"1","onUpdate:modelValue":i[4]||(i[4]=function(e){return se.item.quantity=e}),disabled:""},null,512),[[e.vModelText,se.item.quantity]]),e.createElementVNode("button",{class:"button increase",onClick:i[5]||(i[5]=function(){return me.increase&&me.increase.apply(me,arguments)}),disabled:me.loading},C,8,B)]),se.item.quantity>1?(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("span",{innerHTML:t.$filters.price(se.item.attributes.price)},null,8,x),T])):e.createCommentVNode("v-if",!0)])),e.createElementVNode("div",q,[e.createElementVNode("div",{class:e.normalizeClass(["price",{"bundle-price":se.item.attributes.bundle}])},[se.item.attributes.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(se.item.attributes.priceOld*se.item.quantity)},null,8,D)):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.amount?(e.openBlock(),e.createElementBlock("div",{key:1,class:"bundle-amount",innerHTML:"Выгода "+(se.item.attributes.amount.percent?se.item.attributes.amount.percent+"%":t.$filters.price(se.item.attributes.amount.sum*se.item.quantity))},null,8,L)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{innerHTML:t.$filters.price(se.item.attributes.price*se.item.quantity)},null,8,M)],2)])]),se.item.options&&se.item.options.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["options",{"is-toggled":me.optionsToggled}])},[e.createElementVNode("div",{class:"toggler",onClick:i[6]||(i[6]=function(e){return me.optionsToggled=!me.optionsToggled})},[e.createElementVNode("span",null,"Дополнительные услуги, "+e.toDisplayString(se.item.options.length),1),S]),e.withDirectives(e.createElementVNode("div",H,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.item.options,(function(n,o){return e.openBlock(),e.createElementBlock("div",{key:o,class:e.normalizeClass(["columns",{"is-checked":-1!==me.options.indexOf(n.id)}])},[e.createElementVNode("div",z,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"checkbox","onUpdate:modelValue":i[7]||(i[7]=function(e){return me.options=e}),value:n.id,id:"option-"+se.item.id+"-"+n.id},null,8,P),[[e.vModelCheckbox,me.options]])]),e.createElementVNode("div",O,[e.createElementVNode("label",{class:"option-title is-clickable",for:"option-"+se.item.id+"-"+n.id},e.toDisplayString(n.name),9,$),n.description?(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(n.description),1)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",U,[F,e.createElementVNode("span",{innerHTML:t.$filters.price(n.price)},null,8,I)])],2)})),128))],512),[[e.vShow,me.optionsToggled]])],2)):e.createCommentVNode("v-if",!0)])],2),se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",A,[G,e.createElementVNode("div",J,[K,e.createElementVNode("a",{onClick:i[8]||(i[8]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.second.image}])},[se.item.attributes.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.second.image},null,8,Q)):(e.openBlock(),e.createElementBlock("svg",R,W))],2)])]),e.createElementVNode("div",X,[se.item.attributes.second.code?(e.openBlock(),e.createElementBlock("div",Y,"Код продукта: "+e.toDisplayString(se.item.attributes.second.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Z,[e.createElementVNode("a",{onClick:i[9]||(i[9]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},e.toDisplayString(se.item.attributes.second.name),1)])])])):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.third?(e.openBlock(),e.createElementBlock("div",_,[ee,e.createElementVNode("div",te,[ie,e.createElementVNode("a",{onClick:i[10]||(i[10]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.third.image}])},[se.item.attributes.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.third.image},null,8,ne)):(e.openBlock(),e.createElementBlock("svg",oe,le))],2)])]),e.createElementVNode("div",ae,[se.item.attributes.third.code?(e.openBlock(),e.createElementBlock("div",ce,"Код продукта: "+e.toDisplayString(se.item.attributes.third.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",re,[e.createElementVNode("a",{onClick:i[11]||(i[11]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},e.toDisplayString(se.item.attributes.third.name),1)])])])):e.createCommentVNode("v-if",!0)])],2))},module.exports=i;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),i={name:"CartItem",props:{item:Object},setup:function(i){var n=t.useStore(),o=e.ref(!1),l=e.ref(),a=e.ref(i.item.attributes.options&&i.item.attributes.options.length?i.item.attributes.options:[]),r=e.ref(!1),c=e.computed((function(){return n.getters["auth/is"]}));i.item.attributes.options&&i.item.attributes.options.length&&(r.value=!0);var s=function(e){o.value=!0,n.dispatch("cart/add",{product:{id:i.item.id,quantity:e},finally:function(){o.value=!1}})};i.item.options&&i.item.options.length&&e.watch(a,(function(e){o.value=!0,n.dispatch("cart/options",{product:{id:i.item.id,options:Object.values(e)},finally:function(){o.value=!1}})}));return{loading:o,increase:function(){s(1)},decrease:function(){s(-1)},remove:function(){o.value=!0,n.dispatch("cart/remove",{id:i.item.id,finally:function(){o.value=!1}})},options:a,optionsToggled:r,input:l,gotoProduct:function(e){window.addEventListener("beforeunload",(function(){n.commit("cart/modal",null)})),window.location.href=e},auth:c}}},n={key:0,class:"column is-12"},o=[e.createElementVNode("div",{class:"bundle-title"},"Вместе дешевле",-1)],l={class:"column name"},a={class:"column is-narrow"},r={class:"cart-actions"},c=["disabled"],s=[e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#cart-remove"})],-1)],m={class:"column is-narrow"},d=["src"],u={key:1},p=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],v={class:"column"},b={class:"columns is-gapless mb-0"},k={class:"column"},E={key:0,class:"code"},V={class:"title"},g={key:0},N={key:0,class:"column is-narrow has-text-right is-relative"},f={class:"quantity"},h=["disabled"],y=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-minus"})],-1)],B=["disabled"],C=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-plus"})],-1)],w={key:0,class:"quantity-price"},x=["innerHTML"],T=e.createTextVNode(" / шт"),q={class:"column is-2 has-text-right"},D=["innerHTML"],L=["innerHTML"],M=["innerHTML"],S=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),H={class:"wrapper"},z={class:"column is-narrow"},P=["value","id"],O={class:"column"},$=["for"],j={key:0,class:"option-description"},I={class:"column is-2 has-text-right"},U=e.createTextVNode("+"),F=["innerHTML"],R={key:0,class:"bundle columns"},A=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),G={class:"column is-narrow"},J=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),K=["src"],Q={key:1},W=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],X={class:"column"},Y={key:0,class:"code"},Z={class:"title"},_={key:1,class:"bundle columns"},ee=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),te={class:"column is-narrow"},ie=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),ne=["src"],oe={key:1},le=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],ae={class:"column"},re={key:0,class:"code"},ce={class:"title"};i.render=function(t,i,se,me,de,ue){var pe=e.resolveComponent("wishlist-add");return se.item.deleted?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["columns is-multiline shop-cart-item",{inactive:!1===se.item.attributes.active,"is-bundle":se.item.attributes.bundle}])},[se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",n,o)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",l,[e.createElementVNode("div",{class:e.normalizeClass(["columns",{"mb-0":se.item.attributes.bundle}])},[e.createElementVNode("div",a,[e.createElementVNode("div",r,[e.createElementVNode("button",{class:"remove",onClick:i[0]||(i[0]=function(){return me.remove&&me.remove.apply(me,arguments)}),disabled:me.loading,"aria-label":"Remove"},s,8,c),me.auth&&!se.item.attributes.bundle?(e.openBlock(),e.createBlock(pe,{key:0,id:se.item.id},null,8,["id"])):e.createCommentVNode("v-if",!0)])]),e.createElementVNode("div",m,[e.createElementVNode("a",{onClick:i[1]||(i[1]=function(e){return me.gotoProduct(se.item.attributes.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.image}])},[se.item.attributes.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.image},null,8,d)):(e.openBlock(),e.createElementBlock("svg",u,p))],2)])]),e.createElementVNode("div",v,[e.createElementVNode("div",b,[e.createElementVNode("div",k,[se.item.attributes.code?(e.openBlock(),e.createElementBlock("div",E,"Код продукта: "+e.toDisplayString(se.item.attributes.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",V,[!1===se.item.attributes.active?(e.openBlock(),e.createElementBlock("span",g,e.toDisplayString(se.item.name),1)):(e.openBlock(),e.createElementBlock("a",{key:1,onClick:i[2]||(i[2]=function(e){return me.gotoProduct(se.item.attributes.href)})},e.toDisplayString(se.item.name),1))])]),(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",f,[e.createElementVNode("button",{class:"button decrease",onClick:i[3]||(i[3]=function(){return me.decrease&&me.decrease.apply(me,arguments)}),disabled:me.loading||1==se.item.quantity,"aria-label":"Decrease"},y,8,h),e.withDirectives(e.createElementVNode("input",{class:"input is-small",type:"number",min:"1","onUpdate:modelValue":i[4]||(i[4]=function(e){return se.item.quantity=e}),disabled:""},null,512),[[e.vModelText,se.item.quantity]]),e.createElementVNode("button",{class:"button increase",onClick:i[5]||(i[5]=function(){return me.increase&&me.increase.apply(me,arguments)}),disabled:me.loading,"aria-label":"Increase"},C,8,B)]),se.item.quantity>1?(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("span",{innerHTML:t.$filters.price(se.item.attributes.price)},null,8,x),T])):e.createCommentVNode("v-if",!0)])),e.createElementVNode("div",q,[e.createElementVNode("div",{class:e.normalizeClass(["price",{"bundle-price":se.item.attributes.bundle}])},[se.item.attributes.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(se.item.attributes.priceOld*se.item.quantity)},null,8,D)):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.amount?(e.openBlock(),e.createElementBlock("div",{key:1,class:"bundle-amount",innerHTML:"Выгода "+(se.item.attributes.amount.percent?se.item.attributes.amount.percent+"%":t.$filters.price(se.item.attributes.amount.sum*se.item.quantity))},null,8,L)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{innerHTML:t.$filters.price(se.item.attributes.price*se.item.quantity)},null,8,M)],2)])]),se.item.options&&se.item.options.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["options",{"is-toggled":me.optionsToggled}])},[e.createElementVNode("div",{class:"toggler",onClick:i[6]||(i[6]=function(e){return me.optionsToggled=!me.optionsToggled})},[e.createElementVNode("span",null,"Дополнительные услуги, "+e.toDisplayString(se.item.options.length),1),S]),e.withDirectives(e.createElementVNode("div",H,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.item.options,(function(n,o){return e.openBlock(),e.createElementBlock("div",{key:o,class:e.normalizeClass(["columns",{"is-checked":-1!==me.options.indexOf(n.id)}])},[e.createElementVNode("div",z,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"checkbox","onUpdate:modelValue":i[7]||(i[7]=function(e){return me.options=e}),value:n.id,id:"option-"+se.item.id+"-"+n.id},null,8,P),[[e.vModelCheckbox,me.options]])]),e.createElementVNode("div",O,[e.createElementVNode("label",{class:"option-title is-clickable",for:"option-"+se.item.id+"-"+n.id},e.toDisplayString(n.name),9,$),n.description?(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(n.description),1)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",I,[U,e.createElementVNode("span",{innerHTML:t.$filters.price(n.price)},null,8,F)])],2)})),128))],512),[[e.vShow,me.optionsToggled]])],2)):e.createCommentVNode("v-if",!0)])],2),se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",R,[A,e.createElementVNode("div",G,[J,e.createElementVNode("a",{onClick:i[8]||(i[8]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.second.image}])},[se.item.attributes.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.second.image},null,8,K)):(e.openBlock(),e.createElementBlock("svg",Q,W))],2)])]),e.createElementVNode("div",X,[se.item.attributes.second.code?(e.openBlock(),e.createElementBlock("div",Y,"Код продукта: "+e.toDisplayString(se.item.attributes.second.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Z,[e.createElementVNode("a",{onClick:i[9]||(i[9]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},e.toDisplayString(se.item.attributes.second.name),1)])])])):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.third?(e.openBlock(),e.createElementBlock("div",_,[ee,e.createElementVNode("div",te,[ie,e.createElementVNode("a",{onClick:i[10]||(i[10]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.third.image}])},[se.item.attributes.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.third.image},null,8,ne)):(e.openBlock(),e.createElementBlock("svg",oe,le))],2)])]),e.createElementVNode("div",ae,[se.item.attributes.third.code?(e.openBlock(),e.createElementBlock("div",re,"Код продукта: "+e.toDisplayString(se.item.attributes.third.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",ce,[e.createElementVNode("a",{onClick:i[11]||(i[11]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},e.toDisplayString(se.item.attributes.third.name),1)])])])):e.createCommentVNode("v-if",!0)])],2))},module.exports=i;
|
|
2
2
|
//# sourceMappingURL=CartItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartItem.js","sources":["../../../../../src/js/components/shop/cart/CartItem.vue","../../../../../src/js/components/shop/cart/CartItem.vue?vue&type=template&id=23822b30&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\">Вместе дешевле</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\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\"><use xlink:href=\"#cart-remove\" /></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\">\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><use xlink:href=\"#logo\" /></svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.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 </div>\n <div class=\"column is-narrow has-text-right is-relative\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg><use xlink:href=\"#cart-minus\" /></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><use xlink:href=\"#cart-plus\" /></svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / шт</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 <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=\"'Выгода ' + (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 </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>Дополнительные услуги, {{ item.options.length }}</span>\n <svg><use xlink:href=\"#arrow-down\" /></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\"><use xlink:href=\"#bundle-plus\" /></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><use xlink:href=\"#logo\" /></svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.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\"><use xlink:href=\"#bundle-plus\" /></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><use xlink:href=\"#logo\" /></svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\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.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\">Вместе дешевле</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\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\"><use xlink:href=\"#cart-remove\" /></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\">\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><use xlink:href=\"#logo\" /></svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.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 </div>\n <div class=\"column is-narrow has-text-right is-relative\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg><use xlink:href=\"#cart-minus\" /></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><use xlink:href=\"#cart-plus\" /></svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / шт</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 <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=\"'Выгода ' + (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 </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>Дополнительные услуги, {{ item.options.length }}</span>\n <svg><use xlink:href=\"#arrow-down\" /></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\"><use xlink:href=\"#bundle-plus\" /></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><use xlink:href=\"#logo\" /></svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.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\"><use xlink:href=\"#bundle-plus\" /></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><use xlink:href=\"#logo\" /></svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\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.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":["script","name","props","item","Object","setup","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","quantity","difference","dispatch","product","id","finally","watch","values","increase","decrease","remove","gotoProduct","href","window","addEventListener","commit","location","class","_createElementVNode","createElementVNode","_hoisted_4","_hoisted_5","_hoisted_6","xlink:href","_hoisted_10","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_19","_hoisted_22","_hoisted_33","_hoisted_38","_hoisted_39","_hoisted_41","_hoisted_44","_hoisted_49","_hoisted_55","_hoisted_57","_hoisted_60","_hoisted_66","_hoisted_68","$props","deleted","_createElementBlock","createElementBlock","_normalizeClass","inactive","active","is-bundle","bundle","_openBlock","_hoisted_1","_hoisted_3","mb-0","onClick","$setup","apply","arguments","disabled","_createBlock","_component_wishlist_add","no-thumb","image","src","_hoisted_12","_hoisted_14","code","_hoisted_18","_hoisted_20","_toDisplayString","toDisplayString","openBlock","_hoisted_21","type","min","onUpdate:modelValue","_cache","$event","_vModelText","_hoisted_29","innerHTML","_ctx","price","bundle-price","priceOld","$filters","amount","percent","sum","_hoisted_37","_withDirectives","withDirectives","_Fragment","option","index","key","is-checked","indexOf","for","_hoisted_42","description","_hoisted_43","_hoisted_47","_hoisted_48","_hoisted_50","second","_hoisted_52","_hoisted_54","_hoisted_56","third","_hoisted_58","_hoisted_59","_hoisted_61","_hoisted_63","_hoisted_65","_hoisted_67"],"mappings":"oDA0HeA,EAAA,CACXC,KAAM,WACNC,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sE,GAAAC,aAIvDhG,EAAAA,mBAKK,MALLqB,GAKK,CAJuBE,GAAAzD,KAAKS,WAAWoH,MAAM3C,oBAA9CvB,EAAAA,mBAAuG,MAAvGwE,GAAoD,iBAAc9C,EAAAC,gBAAG7B,GAAIzD,KAACS,WAAWoH,MAAM3C,MAAK,oCAChGhD,qBAEK,MAFLsB,GAEK,CADDtB,EAAuFC,mBAAA,IAAA,CAAnFmC,QAAKsB,EAAA,MAAAA,EAAA,IAAA,SAAAC,GAAA,OAAEtB,eAAYd,GAAAzD,KAAKS,WAAWoH,MAAMjG,SAAUyD,EAAAC,gBAAA7B,GAAAzD,KAAKS,WAAWoH,MAAM/H,MAAG"}
|
|
1
|
+
{"version":3,"file":"CartItem.js","sources":["../../../../../src/js/components/shop/cart/CartItem.vue","../../../../../src/js/components/shop/cart/CartItem.vue?vue&type=template&id=5fe54bad&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\">Вместе дешевле</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\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\" aria-label=\"Remove\">\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\">\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 <div class=\"code\" v-if=\"item.attributes.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 </div>\n <div class=\"column is-narrow has-text-right is-relative\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\" aria-label=\"Decrease\">\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\" aria-label=\"Increase\">\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> / шт</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 <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=\"'Выгода ' + (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 </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>Дополнительные услуги, {{ 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\">Код продукта: {{ 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\">Код продукта: {{ 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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\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.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\">Вместе дешевле</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\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\" aria-label=\"Remove\">\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\">\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 <div class=\"code\" v-if=\"item.attributes.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 </div>\n <div class=\"column is-narrow has-text-right is-relative\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\" aria-label=\"Decrease\">\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\" aria-label=\"Increase\">\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> / шт</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 <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=\"'Выгода ' + (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 </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>Дополнительные услуги, {{ 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\">Код продукта: {{ 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\">Код продукта: {{ 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 remove = () => {\n loading.value = true;\n\n store.dispatch('cart/remove', {\n id: props.item.id,\n finally: () => {\n loading.value = false;\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.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":["script","name","props","item","Object","setup","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","quantity","difference","dispatch","product","id","finally","watch","values","increase","decrease","remove","gotoProduct","href","window","addEventListener","commit","location","class","_createElementVNode","createElementVNode","_hoisted_4","_hoisted_5","_hoisted_6","xlink:href","_hoisted_10","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_19","_hoisted_22","_hoisted_33","_hoisted_38","_hoisted_39","_hoisted_41","_hoisted_44","_hoisted_49","_hoisted_55","_hoisted_57","_hoisted_60","_hoisted_66","_hoisted_68","$props","deleted","_createElementBlock","createElementBlock","_normalizeClass","inactive","active","is-bundle","bundle","_openBlock","_hoisted_1","_hoisted_3","mb-0","onClick","$setup","apply","arguments","disabled","aria-label","_createBlock","_component_wishlist_add","no-thumb","image","src","_hoisted_12","_hoisted_14","code","_hoisted_18","_hoisted_20","_toDisplayString","toDisplayString","openBlock","_hoisted_21","type","min","onUpdate:modelValue","_cache","$event","_vModelText","_hoisted_29","innerHTML","_ctx","price","bundle-price","priceOld","$filters","amount","percent","sum","_hoisted_37","_withDirectives","withDirectives","_Fragment","option","index","key","is-checked","indexOf","for","_hoisted_42","description","_hoisted_43","_hoisted_47","_hois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,CAAC,kBAA+C,CAAAiB,YAAArB,GAAAzD,KAAKS,WAAWqH,MAAM/C,WACjCtB,GAAAzD,KAAKS,WAAWqH,MAAM/C,qBAApEpB,EAA4EC,mBAAA,MAAA,OAAtEoB,IAAKvB,GAAIzD,KAACS,WAAWqH,MAAM/C,kCACjCpB,EAAAA,mBAEK,MAAAuE,GAAAC,aAIjBjG,EAAAA,mBAKK,MALLqB,GAKK,CAJuBE,GAAAzD,KAAKS,WAAWqH,MAAM3C,oBAA9CxB,EAAAA,mBAAuG,MAAvGyE,GAAoD,iBAAc9C,EAAAC,gBAAG9B,GAAIzD,KAACS,WAAWqH,MAAM3C,MAAK,oCAChGjD,qBAEK,MAFLsB,GAEK,CADDtB,EAAuFC,mBAAA,IAAA,CAAnFmC,QAAKuB,EAAA,MAAAA,EAAA,IAAA,SAAAC,GAAA,OAAEvB,eAAYd,GAAAzD,KAAKS,WAAWqH,MAAMlG,SAAU0D,EAAAC,gBAAA9B,GAAAzD,KAAKS,WAAWqH,MAAMhI,MAAG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),n=e.defineComponent({name:"cart-trigger",setup:function(){var n=t.useStore();return{quantity:e.computed((function(){return n.getters["cart/quantity"]})),open:function(){n.commit("cart/modal",!0)}}}}),r={class:"cart"},o={class:"dropdown is-right is-hoverable"},a={class:"dropdown-trigger"},i=e.createElementVNode("svg",{width:"22",height:"19"},[e.createElementVNode("use",{"xlink:href":"#cart"})],-1),u=["textContent"];n.render=function(t,n,c,
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),n=e.defineComponent({name:"cart-trigger",setup:function(){var n=t.useStore();return{quantity:e.computed((function(){return n.getters["cart/quantity"]})),open:function(){n.commit("cart/modal",!0)}}}}),r={class:"cart"},o={class:"dropdown is-right is-hoverable"},a={class:"dropdown-trigger"},i=e.createElementVNode("svg",{width:"22",height:"19"},[e.createElementVNode("use",{"xlink:href":"#cart"})],-1),u=["textContent"];n.render=function(t,n,l,c,s,d){return e.openBlock(),e.createElementBlock("div",r,[e.createElementVNode("div",o,[e.createElementVNode("div",a,[e.renderSlot(t.$slots,"default",{total:t.quantity,open:t.open},(function(){return[e.createElementVNode("button",{class:e.normalizeClass(["button",{"is-products":t.quantity}]),onClick:n[0]||(n[0]=function(){return t.open&&t.open.apply(t,arguments)}),"aria-label":"Cart"},[i,e.createElementVNode("span",{textContent:e.toDisplayString(t.quantity)},null,8,u)],2)]}))])])])},module.exports=n;
|
|
2
2
|
//# sourceMappingURL=CartTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartTrigger.js","sources":["../../../../../src/js/components/shop/cart/CartTrigger.vue","../../../../../src/js/components/shop/cart/CartTrigger.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"CartTrigger.js","sources":["../../../../../src/js/components/shop/cart/CartTrigger.vue","../../../../../src/js/components/shop/cart/CartTrigger.vue?vue&type=template&id=1aaa97cb&lang.js"],"sourcesContent":["<template>\n <div class=\"cart\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <slot :total=\"quantity\" :open=\"open\">\n <button class=\"button\" @click=\"open\" v-bind:class=\"{ 'is-products': quantity }\" aria-label=\"Cart\">\n <svg width=\"22\" height=\"19\">\n <use xlink:href=\"#cart\" />\n </svg>\n <span v-text=\"quantity\"></span>\n </button>\n </slot>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { computed, defineComponent } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default defineComponent({\n name: 'cart-trigger',\n setup() {\n const store = useStore();\n const quantity = computed(() => store.getters['cart/quantity']);\n\n const open = () => {\n store.commit('cart/modal', true);\n };\n\n return {\n quantity,\n open,\n }\n },\n})\n</script>\n","<template>\n <div class=\"cart\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <slot :total=\"quantity\" :open=\"open\">\n <button class=\"button\" @click=\"open\" v-bind:class=\"{ 'is-products': quantity }\" aria-label=\"Cart\">\n <svg width=\"22\" height=\"19\">\n <use xlink:href=\"#cart\" />\n </svg>\n <span v-text=\"quantity\"></span>\n </button>\n </slot>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { computed, defineComponent } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default defineComponent({\n name: 'cart-trigger',\n setup() {\n const store = useStore();\n const quantity = computed(() => store.getters['cart/quantity']);\n\n const open = () => {\n store.commit('cart/modal', true);\n };\n\n return {\n quantity,\n open,\n }\n },\n})\n</script>\n"],"names":["script","defineComponent","name","setup","store","useStore","quantity","computed","getters","open","commit","_hoisted_1","class","_hoisted_2","_hoisted_3","_createElementVNode","createElementVNode","width","height","xlink:href","_openBlock","_createElementBlock","_renderSlot","renderSlot","_ctx","$slots","total","_normalizeClass","is-products","onClick","apply","arguments","aria-label","_hoisted_4","textContent","_toDisplayString"],"mappings":"oDAoBAA,EAAeC,kBAAgB,CAC3BC,KAAM,eACNC,MAAK,WACD,IAAMC,EAAQC,EAAAA,WAOd,MAAO,CACHC,SAPaC,EAAAA,UAAS,WAAA,OAAMH,EAAMI,QAAQ,oBAQ1CC,KANS,WACTL,EAAMM,OAAO,cAAc,QC1B9BC,EAAA,CAAAC,MAAM,QACFC,EAAA,CAAAD,MAAM,kCACFE,EAAA,CAAAF,MAAM,sBAGCG,EAEKC,mBAAA,MAAA,CAFAC,MAAM,KAAKC,OAAO,OACnBH,EAAyBC,mBAAA,MAAA,CAApBG,aAAW,gEANxC,OAAAC,EAAAA,YAAAC,qBAaK,MAbLV,EAaK,CAZDI,EAAAC,mBAWK,MAXLH,EAWK,CAVDE,EAAAC,mBASK,MATLF,EASK,CARDQ,EAOMC,WAAAC,EAAAC,OAAA,UAAA,CAPCC,MAAOF,EAAQlB,SAAGG,KAAMe,EAAIf,OAAnC,WAAA,MAOM,CANFM,EAKQC,mBAAA,SAAA,CALAJ,MAAKe,EAAAA,eAAA,CAAC,SAAS,CAAAC,cAA6CJ,cAA5CK,sCAAOL,EAAIf,MAAAe,EAAAf,KAAAqB,MAAAN,EAAAO,aAA6CC,aAAW,SACvFC,EAGAlB,EAA8BC,mBAAA,OAAA,CAAxBkB,YAAAC,EAAAA,gBAAQX,EAAQlB"}
|
|
@@ -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"},a=["href"];r.render=function(t,o,r,c,s,l){return e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",null,e.toDisplayString(c.translate("shop.compare.product_deleted_named",{product:r.last.name})),1),e.createElementVNode("a",{href:r.last.url,class:"mt-2 is-size-7",style:{color:"#fff","border-bottom":"1px solid #fff"}},e.toDisplayString(c.translate("shop.compare.goto")),9,a)])};var c=o.useToast(),s=e.defineComponent({props:{id:Number},setup:function(o){var n=e.ref(!1),a=t.useStore(),s=e.computed((function(){return a.getters["compare/last"]})),l=e.computed((function(){return a.getters["compare/product"](o.id)}));return{product:l,action:function(){n.value||(n.value=!0,a.dispatch("compare/toggle",{id:o.id,finally:function(){l.value?c({component:r,props:{last:s}},{type:"success"}):c(__("shop.compare.product_deleted"),{type:"warning"});n.value=!1}}))},loading:n}}}),l=["title"],u=e.createElementVNode("svg",{class:"icon compare"},[e.createElementVNode("use",{"xlink:href":"#compare"})],-1);s.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[u]}))],10,l)},module.exports=s;
|
|
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"},a=["href"];r.render=function(t,o,r,c,s,l){return e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",null,e.toDisplayString(c.translate("shop.compare.product_deleted_named",{product:r.last.name})),1),e.createElementVNode("a",{href:r.last.url,class:"mt-2 is-size-7",style:{color:"#fff","border-bottom":"1px solid #fff"}},e.toDisplayString(c.translate("shop.compare.goto")),9,a)])};var c=o.useToast(),s=e.defineComponent({props:{id:Number},setup:function(o){var n=e.ref(!1),a=t.useStore(),s=e.computed((function(){return a.getters["compare/last"]})),l=e.computed((function(){return a.getters["compare/product"](o.id)}));return{product:l,action:function(){n.value||(n.value=!0,a.dispatch("compare/toggle",{id:o.id,finally:function(){l.value?c({component:r,props:{last:s}},{type:"success"}):c(__("shop.compare.product_deleted"),{type:"warning"});n.value=!1}}))},loading:n}}}),l=["title"],u=e.createElementVNode("svg",{class:"icon compare"},[e.createElementVNode("use",{"xlink:href":"#compare"})],-1);s.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"),"aria-label":"Add to compare"},[e.renderSlot(t.$slots,"default",{product:t.product},(function(){return[u]}))],10,l)},module.exports=s;
|
|
2
2
|
//# sourceMappingURL=CompareAdd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompareAdd.js","sources":["../../../../../src/js/components/shop/compare/SuccessMessage.vue","../../../../../src/js/components/shop/compare/SuccessMessage.vue?vue&type=template&id=1ea4d310&lang.js","../../../../../src/js/components/shop/compare/CompareAdd.vue","../../../../../src/js/components/shop/compare/CompareAdd.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"CompareAdd.js","sources":["../../../../../src/js/components/shop/compare/SuccessMessage.vue","../../../../../src/js/components/shop/compare/SuccessMessage.vue?vue&type=template&id=1ea4d310&lang.js","../../../../../src/js/components/shop/compare/CompareAdd.vue","../../../../../src/js/components/shop/compare/CompareAdd.vue?vue&type=template&id=bc8e8d80&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')\" aria-label=\"Add to compare\">\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 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 } else {\n toast(__(\"shop.compare.product_deleted\"), {\n type: \"warning\",\n });\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')\" aria-label=\"Add to compare\">\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 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 } else {\n toast(__(\"shop.compare.product_deleted\"), {\n type: \"warning\",\n });\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":["script$1","props","last","setup","translate","window","__","_hoisted_1","class","_openBlock","openBlock","_createElementBlock","_createElementVNode","$setup","product","$props","name","href","url","style","color","border-bottom","_hoisted_2","toast","useToast","script","defineComponent","id","Number","loading","ref","store","useStore","computed","getters","action","value","dispatch","finally","component","SuccessMessage","type","createElementVNode","xlink:href","createElementBlock","_normalizeClass","is-loading","_ctx","onClick","apply","arguments","title","aria-label","_renderSlot","renderSlot","$slots"],"mappings":"oFAkBeA,EAAA,CACXC,MAAO,CACHC,KAAM,MAEVC,MAAK,WAGD,MAAO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C,GAAA,oBAAsB8C,aAAW,mBAC3JC,EAAAC,WAIMP,EAJCQ,OAAA,UAAA,CAAAzC,QAASiC,EAAAjC,UAAhB,WAAA,MAIM,CAHFQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/js/forms/FormText"),n=require("@perevorot/shop/dist/js/forms/FormTextarea"),l=require("yup"),i=require("vue-toastification");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=c(o),d=c(a),m=c(n),p=u(l);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,a,n,l,i=[],c=!0,u=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=n.call(r)).done)&&(i.push(o.value),i.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var h=i.useToast();e.markRaw(d.default),e.markRaw(m.default);var y=e.ref(null),b={components:{SchemaForm:r.SchemaFormFactory([s.default({})])},name:"order-one-click",props:{id:Number,className:String,callback:Function,closeAction:Function,model:Array},setup:function(o){var a,n=e.ref(!1),l=e.ref(0),i=e.ref({}),c=t.useStore(),u=e.computed((function(){return c.getters["order/modal"]})),s=e.computed((function(){return c.getters["auth/me"]})),f=e.computed((function(){return c.getters["cart/items"]})),b=e.ref(!1),g=e.inject("promoCode"),k=function(e,t){c.commit("order/modal",null),t&&o.closeAction&&o.closeAction()},_={name:{component:d.default,label:__("shop.order.oneclick.name"),store:"oneclick",model:"name"},phone:{component:d.default,label:__("shop.order.oneclick.phone"),type:"phone",placeholder:"(050) 123-45-67",mask:"(###) ###-##-##",store:"oneclick",model:"phone"}};-1!==o.model.indexOf("email")&&(_.email={component:d.default,label:__("shop.order.oneclick.email"),store:"oneclick",model:"email"}),-1!==o.model.indexOf("comment")&&(_.comment={component:m.default,label:__("shop.order.oneclick.comment"),store:"oneclick",model:"email"});var S=e.ref(_),w={name:p.string().trim().required(__("auth.validation.required")),phone:p.string().trim().required(__("auth.validation.required")).matches(/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,__("auth.validation.phone"))};-1!==o.model.indexOf("email")&&(w.email=p.string().trim().email(__("auth.validation.email")).required(__("auth.validation.required")));var N=p.object().shape(w),q=e.ref({});e.onMounted((function(){if(q.value={name:(s.value.last_name?s.value.last_name:"")+(s.value.name?" "+s.value.name:""),email:s.value.email?s.value.email:"",phone:s.value.phone_formatted?s.value.phone_formatted:"",id:o.id?o.id:null},o.id){var e=y.value.closest("[shop-product]"),t=e.querySelector("[shop-product-name]").textContent,r=e.querySelector("[shop-product-price]").childNodes[0].nodeValue.replace(/ /g,""),n=e.dataset.code,l=e.dataset.category,i=e.dataset.brand;a=[{name:t,id:n,price:r,brand:i,category:l,quantity:1}]}else a=[],f.value.forEach((function(e){a.push({name:e.name,id:e.code,price:e.price,category:e.category?e.category.name:"",brand:e.brand?e.brand.name:"",quantity:e.quantity})}))}));var E=e.computed((function(){var e=0;return f.value.length&&f.value.forEach((function(t){e+=(t.price_old?t.price_old:t.price_regular)*t.quantity})),e}));r.useSchemaForm(q);return{open:function(){if(b.value=!1,c.commit("order/modal","oneclick"),o.id){var e={ecommerce:{currencyCode:"UAH",add:{products:a}},event:"addToCart"};$env.debug.ecommerce&&console.log(JSON.stringify(e)),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(e))}},close:k,modal:u,loading:n,key:l,errors:i,schema:S,validation:N,model:q,onSubmit:function(){n.value=!0;var e=document.querySelector(".shop-product .product-info .cart-change-quantity input");e&&(q.value.quantity=e.value);var t=Object.assign({},q.value,{promoCode:g&&g.value?g.value:null});$http.post($ziggy("api.order.oneclick"),t).then((function(e){var t=function(){o.callback?(k(),o.callback(e)):(b.value=!0,l.value++)},r={ecommerce:{purchase:{actionField:{id:e.data.id,affiliation:"forward-ua.com",revenue:o.id?a[0].price:E.value,tax:"0",shipping:"0"},products:a}},event:"purchaseOneClick",eventCallback:function(){t()}};$env.debug.ecommerce&&console.log(JSON.stringify(r)),!$env.debug.ecommerce&&window.dataLayer?(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(r)):t()})).finally((function(){n.value=!1})).catch((function(e){if(e.response&&e.response.data&&e.response.data.error&&e.response.data.message&&h(e.response.data.message,{type:"error"}),e.response&&e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=v(r[t],2),a=o[0],n=o[1];n[0]&&(i.value[a]=n[0])}l.value++}console.error(e)}))},thanks:b,button:y,promoCode:g}}},g={class:"shop-order-one-click",ref:"button"},k={class:"modal-content"},_=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],S={class:"box"},w={class:"title"},N={class:"field"},q=["innerHTML"],E={class:"mt-3"};b.render=function(t,r,o,a,n,l){var i=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("button",{class:e.normalizeClass(o.className?o.className:"button is-link is-small"),onClick:r[0]||(r[0]=function(){return a.open&&a.open.apply(a,arguments)})},e.toDisplayString(t.__("shop.order.oneclick.add")),3),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":a.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:r[1]||(r[1]=function(){return a.close&&a.close.apply(a,arguments)})}),e.createElementVNode("div",k,[e.createElementVNode("button",{class:"modal-close is-large",onClick:r[2]||(r[2]=function(){return a.close&&a.close.apply(a,arguments)})},_),e.createElementVNode("div",S,[e.createElementVNode("div",w,e.toDisplayString(t.__("shop.order.oneclick.title")),1),e.withDirectives(e.createElementVNode("div",null,[e.createVNode(i,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",N,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit"},e.toDisplayString(t.__("shop.order.oneclick.submit")),3)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"])],512),[[e.vShow,!a.thanks]]),e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",{innerHTML:t.__("shop.order.oneclick.thanks")},null,8,q),e.createElementVNode("div",E,[e.createElementVNode("button",{class:"button",onClick:r[3]||(r[3]=function(e){return a.close(e,!0)})},e.toDisplayString(t.__("shop.order.oneclick.continue")),1)])],512),[[e.vShow,a.thanks]])])])],2)],512)},module.exports=b;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/js/forms/FormText"),n=require("@perevorot/shop/dist/js/forms/FormTextarea"),l=require("yup"),i=require("vue-toastification");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=c(o),d=c(a),m=c(n),p=u(l);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,a,n,l,i=[],c=!0,u=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=n.call(r)).done)&&(i.push(o.value),i.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var h=i.useToast();e.markRaw(d.default),e.markRaw(m.default);var y=e.ref(null),b={components:{SchemaForm:r.SchemaFormFactory([s.default({})])},name:"order-one-click",props:{id:Number,className:String,callback:Function,closeAction:Function,model:Array},setup:function(o){var a,n=e.ref(!1),l=e.ref(0),i=e.ref({}),c=t.useStore(),u=e.computed((function(){return c.getters["order/modal"]})),s=e.computed((function(){return c.getters["auth/me"]})),f=e.computed((function(){return c.getters["cart/items"]})),b=e.ref(!1),g=e.inject("promoCode"),k=function(e,t){c.commit("order/modal",null),t&&o.closeAction&&o.closeAction()},_={name:{component:d.default,label:__("shop.order.oneclick.name"),store:"oneclick",model:"name"},phone:{component:d.default,label:__("shop.order.oneclick.phone"),type:"phone",placeholder:"(050) 123-45-67",mask:"(###) ###-##-##",store:"oneclick",model:"phone"}};-1!==o.model.indexOf("email")&&(_.email={component:d.default,label:__("shop.order.oneclick.email"),store:"oneclick",model:"email"}),-1!==o.model.indexOf("comment")&&(_.comment={component:m.default,label:__("shop.order.oneclick.comment"),store:"oneclick",model:"email"});var S=e.ref(_),w={name:p.string().trim().required(__("auth.validation.required")),phone:p.string().trim().required(__("auth.validation.required")).matches(/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,__("auth.validation.phone"))};-1!==o.model.indexOf("email")&&(w.email=p.string().trim().email(__("auth.validation.email")).required(__("auth.validation.required")));var N=p.object().shape(w),q=e.ref({});e.onMounted((function(){if(q.value={name:(s.value.last_name?s.value.last_name:"")+(s.value.name?" "+s.value.name:""),email:s.value.email?s.value.email:"",phone:s.value.phone_formatted?s.value.phone_formatted:"",id:o.id?o.id:null},o.id){var e=y.value.closest("[shop-product]"),t=e.querySelector("[shop-product-name]").textContent,r=e.querySelector("[shop-product-price]").childNodes[0].nodeValue.replace(/ /g,""),n=e.dataset.code,l=e.dataset.category,i=e.dataset.brand;a=[{name:t,id:n,price:r,brand:i,category:l,quantity:1}]}else a=[],f.value.forEach((function(e){a.push({name:e.name,id:e.code,price:e.price,category:e.category?e.category.name:"",brand:e.brand?e.brand.name:"",quantity:e.quantity})}))}));var E=e.computed((function(){var e=0;return f.value.length&&f.value.forEach((function(t){e+=(t.price_old?t.price_old:t.price_regular)*t.quantity})),e}));r.useSchemaForm(q);return{open:function(){if(b.value=!1,c.commit("order/modal","oneclick"),o.id){var e={ecommerce:{currencyCode:"UAH",add:{products:a}},event:"addToCart"};$env.debug.ecommerce&&console.log(JSON.stringify(e)),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(e))}},close:k,modal:u,loading:n,key:l,errors:i,schema:S,validation:N,model:q,onSubmit:function(){n.value=!0;var e=document.querySelector(".shop-product .product-info .cart-change-quantity input");e&&(q.value.quantity=e.value);var t=Object.assign({},q.value,{promoCode:g&&g.value?g.value:null});$http.post($ziggy("api.order.oneclick"),t).then((function(e){var t=function(){o.callback?(k(),o.callback(e)):(b.value=!0,l.value++)},r={ecommerce:{purchase:{actionField:{id:e.data.id,affiliation:"forward-ua.com",revenue:o.id?a[0].price:E.value,tax:"0",shipping:"0"},products:a}},event:"purchaseOneClick",eventCallback:function(){t()}};$env.debug.ecommerce&&console.log(JSON.stringify(r)),!$env.debug.ecommerce&&window.dataLayer?(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(r)):t()})).finally((function(){n.value=!1})).catch((function(e){if(e.response&&e.response.data&&e.response.data.error&&e.response.data.message&&h(e.response.data.message,{type:"error"}),e.response&&e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=v(r[t],2),a=o[0],n=o[1];n[0]&&(i.value[a]=n[0])}l.value++}console.error(e)}))},thanks:b,button:y,promoCode:g}}},g={class:"shop-order-one-click",ref:"button"},k={class:"modal-content"},_=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],S={class:"box"},w={class:"title"},N={class:"field"},q=["innerHTML"],E={class:"mt-3"};b.render=function(t,r,o,a,n,l){var i=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("button",{class:e.normalizeClass(o.className?o.className:"button is-link is-small"),onClick:r[0]||(r[0]=function(){return a.open&&a.open.apply(a,arguments)}),"aria-label":"Buy in one click"},e.toDisplayString(t.__("shop.order.oneclick.add")),3),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":a.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:r[1]||(r[1]=function(){return a.close&&a.close.apply(a,arguments)})}),e.createElementVNode("div",k,[e.createElementVNode("button",{class:"modal-close is-large",onClick:r[2]||(r[2]=function(){return a.close&&a.close.apply(a,arguments)})},_),e.createElementVNode("div",S,[e.createElementVNode("div",w,e.toDisplayString(t.__("shop.order.oneclick.title")),1),e.withDirectives(e.createElementVNode("div",null,[e.createVNode(i,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",N,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit"},e.toDisplayString(t.__("shop.order.oneclick.submit")),3)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"])],512),[[e.vShow,!a.thanks]]),e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",{innerHTML:t.__("shop.order.oneclick.thanks")},null,8,q),e.createElementVNode("div",E,[e.createElementVNode("button",{class:"button",onClick:r[3]||(r[3]=function(e){return a.close(e,!0)})},e.toDisplayString(t.__("shop.order.oneclick.continue")),1)])],512),[[e.vShow,a.thanks]])])])],2)],512)},module.exports=b;
|
|
2
2
|
//# sourceMappingURL=OneClick.js.map
|