@perevorot/shop 2.0.33 → 2.0.36
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/components/shop/cart/Cart.js +1 -1
- package/dist/components/shop/cart/Cart.js.map +1 -1
- package/dist/components/shop/cart/CartItem.js +1 -1
- package/dist/components/shop/cart/CartItem.js.map +1 -1
- package/dist/components/shop/compare/CompareDeleteAll.js +1 -1
- package/dist/components/shop/compare/CompareDeleteAll.js.map +1 -1
- package/dist/components/shop/order/Checkout.js +1 -1
- package/dist/components/shop/order/Checkout.js.map +1 -1
- package/dist/components/shop/order/CheckoutItem.js +1 -1
- package/dist/components/shop/order/CheckoutItem.js.map +1 -1
- package/dist/components/shop/order/OneClick.js +1 -1
- package/dist/components/shop/order/OneClick.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingCourier.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingCourier.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingPickup.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingPickup.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=e.defineComponent({name:"CheckoutItem",props:{item:Object},setup:function(t){var i=e.computed((function(){return t.item.attributes.options&&t.item.attributes.options.length?t.item.attributes.options:[]}));return{itemOptions:e.computed((function(){return t.item.options&&t.item.options.length?t.item.options.filter((function(e){return-1!==i.value.indexOf(e.id)})):[]}))}}}),i={key:0,class:"column is-12"},n=
|
|
1
|
+
"use strict";var e=require("vue"),t=e.defineComponent({name:"CheckoutItem",props:{item:Object},setup:function(t){var i=e.computed((function(){return t.item.attributes.options&&t.item.attributes.options.length?t.item.attributes.options:[]}));return{itemOptions:e.computed((function(){return t.item.options&&t.item.options.length?t.item.options.filter((function(e){return-1!==i.value.indexOf(e.id)})):[]}))}}}),i={key:0,class:"column is-12"},n={class:"bundle-title"},l={class:"column name"},r={class:"column is-narrow"},a=["href"],o=["src"],s={key:1},c=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],m={class:"column"},d={class:"columns is-gapless mb-0"},u={class:"column"},p={key:0,class:"code"},b={class:"title"},k=["href"],E={class:"column is-2 has-text-centered is-relative"},v={class:"quantity"},N={key:0,class:"quantity-price"},V=["innerHTML"],h={class:"column is-2 has-text-right"},g=["innerHTML"],f=["innerHTML"],y=["innerHTML"],B={key:0,class:"options is-toggled"},C={class:"toggler"},D={class:"wrapper"},S={class:"column"},_={class:"option-title"},q={class:"column is-2 has-text-right"},x=e.createTextVNode("+"),T=["innerHTML"],L={key:0,class:"bundle columns"},H={class:"column is-narrow"},M=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),O=["href"],z=["src"],$={key:1},w=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],I={class:"column"},j={key:0,class:"code"},F={class:"title"},A=["href"],G={key:1,class:"bundle columns"},J={class:"column is-narrow"},K=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),P=["href"],Q=["src"],R={key:1},U=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],W={class:"column"},X={key:0,class:"code"},Y={class:"title"},Z=["href"];t.render=function(t,ee,te,ie,ne,le){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["columns is-multiline shop-cart-item",{"is-bundle":t.item.attributes.bundle}])},[t.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",i,[e.createElementVNode("div",n,e.toDisplayString(t.__("shop.cart.bundle")),1)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",l,[e.createElementVNode("div",{class:e.normalizeClass(["columns",{"mb-0":t.item.attributes.bundle}])},[e.createElementVNode("div",r,[e.createElementVNode("a",{href:t.item.attributes.href},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!t.item.attributes.image}])},[t.item.attributes.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.item.attributes.image},null,8,o)):(e.openBlock(),e.createElementBlock("svg",s,c))],2)],8,a)]),e.createElementVNode("div",m,[e.createElementVNode("div",d,[e.createElementVNode("div",u,[t.item.attributes.code?(e.openBlock(),e.createElementBlock("div",p,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(t.item.attributes.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",b,[e.createElementVNode("a",{href:t.item.attributes.href},e.toDisplayString(t.item.name),9,k)])]),e.createElementVNode("div",E,[e.createElementVNode("div",v,"⨉ "+e.toDisplayString(t.item.quantity),1),parseInt(t.item.quantity)>1?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("span",{innerHTML:t.$filters.price(t.item.attributes.price)},null,8,V),e.createTextVNode(" / "+e.toDisplayString(t.__("shop.cart.q")),1)])):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",h,[e.createElementVNode("div",{class:e.normalizeClass(["price",{"bundle-price":t.item.attributes.bundle}])},[t.item.attributes.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(t.item.attributes.priceOld*t.item.quantity)},null,8,g)):e.createCommentVNode("v-if",!0),t.item.attributes.bundle&&t.item.attributes.amount?(e.openBlock(),e.createElementBlock("div",{key:1,class:"bundle-amount",innerHTML:t.__("shop.cart.bundle_amount")+(t.item.attributes.amount.percent?t.item.attributes.amount.percent+"%":t.$filters.price(t.item.attributes.amount.sum*t.item.quantity))},null,8,f)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{innerHTML:t.$filters.price(t.item.attributes.price*t.item.quantity)},null,8,y)],2)])]),t.itemOptions&&t.itemOptions.length?(e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("div",C,[e.createElementVNode("span",null,e.toDisplayString(t.__("shop.cart.additional"))+" "+e.toDisplayString(t.itemOptions.length),1)]),e.createElementVNode("div",D,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.itemOptions,(function(i,n){return e.openBlock(),e.createElementBlock("div",{key:n,class:"columns is-checked"},[e.createElementVNode("div",S,[e.createElementVNode("div",_,e.toDisplayString(i.name),1)]),e.createElementVNode("div",q,[x,e.createElementVNode("span",{innerHTML:t.$filters.price(i.price)},null,8,T)])])})),128))])])):e.createCommentVNode("v-if",!0)])],2),t.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",H,[M,e.createElementVNode("a",{href:t.item.attributes.second.href},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!t.item.attributes.second.image}])},[t.item.attributes.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.item.attributes.second.image},null,8,z)):(e.openBlock(),e.createElementBlock("svg",$,w))],2)],8,O)]),e.createElementVNode("div",I,[t.item.attributes.second.code?(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(t.item.attributes.second.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",F,[e.createElementVNode("a",{href:t.item.attributes.second.href},e.toDisplayString(t.item.attributes.second.name),9,A)])])])):e.createCommentVNode("v-if",!0),t.item.attributes.bundle&&t.item.attributes.third?(e.openBlock(),e.createElementBlock("div",G,[e.createElementVNode("div",J,[K,e.createElementVNode("a",{href:t.item.attributes.third.href},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!t.item.attributes.third.image}])},[t.item.attributes.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.item.attributes.third.image},null,8,Q)):(e.openBlock(),e.createElementBlock("svg",R,U))],2)],8,P)]),e.createElementVNode("div",W,[t.item.attributes.third.code?(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(t.item.attributes.third.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Y,[e.createElementVNode("a",{href:t.item.attributes.third.href},e.toDisplayString(t.item.attributes.third.name),9,Z)])])])):e.createCommentVNode("v-if",!0)])],2)},module.exports=t;
|
|
2
2
|
//# sourceMappingURL=CheckoutItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutItem.js","sources":["../../../../src/components/shop/order/CheckoutItem.vue","../../../../src/components/shop/order/CheckoutItem.vue?vue&type=template&id=497060f6&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-bind:class=\"{ '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 <a :href=\"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 <a :href=\"item.attributes.href\">{{ item.name }}</a>\n </div>\n </div>\n <div class=\"column is-2 has-text-centered is-relative\">\n <div class=\"quantity\">⨉ {{ item.quantity }}</div>\n <div class=\"quantity-price\" v-if=\"parseInt(item.quantity) > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / шт</div>\n </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 is-toggled\" v-if=\"itemOptions && itemOptions.length\">\n <div class=\"toggler\">\n <span>Дополнительные услуги, {{ itemOptions.length }}</span>\n </div>\n <div class=\"wrapper\">\n <div v-for=\"(option, index) in itemOptions\" v-bind:key=\"index\" class=\"columns is-checked\">\n <div class=\"column\">\n <div class=\"option-title\">{{ option.name }}</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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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 :href=\"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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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 :href=\"item.attributes.third.href\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { defineComponent, computed } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'CheckoutItem',\n props: {\n item: Object\n },\n setup(props) {\n const options = computed(() => props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const itemOptions = computed(() => props.item.options && props.item.options.length ? props.item.options.filter(option => options.value.indexOf(option.id) !==-1) : []);\n\n return {\n itemOptions,\n };\n }\n});\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-bind:class=\"{ '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 <a :href=\"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 <a :href=\"item.attributes.href\">{{ item.name }}</a>\n </div>\n </div>\n <div class=\"column is-2 has-text-centered is-relative\">\n <div class=\"quantity\">⨉ {{ item.quantity }}</div>\n <div class=\"quantity-price\" v-if=\"parseInt(item.quantity) > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / шт</div>\n </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 is-toggled\" v-if=\"itemOptions && itemOptions.length\">\n <div class=\"toggler\">\n <span>Дополнительные услуги, {{ itemOptions.length }}</span>\n </div>\n <div class=\"wrapper\">\n <div v-for=\"(option, index) in itemOptions\" v-bind:key=\"index\" class=\"columns is-checked\">\n <div class=\"column\">\n <div class=\"option-title\">{{ option.name }}</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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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 :href=\"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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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 :href=\"item.attributes.third.href\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { defineComponent, computed } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'CheckoutItem',\n props: {\n item: Object\n },\n setup(props) {\n const options = computed(() => props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const itemOptions = computed(() => props.item.options && props.item.options.length ? props.item.options.filter(option => options.value.indexOf(option.id) !==-1) : []);\n\n return {\n itemOptions,\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","item","Object","setup","options","computed","attributes","length","itemOptions","filter","option","value","indexOf","id","_createElementVNode","_createElementBlock","_ctx","bundle","_hoisted_1","_hoisted_4","_hoisted_5","href","image","src","_hoisted_11","_hoisted_12","_hoisted_13","code","_hoisted_14","_hoisted_15","_hoisted_17","_hoisted_18","quantity","parseInt","_hoisted_19","innerHTML","price","_hoisted_22","priceOld","amount","percent","sum","_hoisted_26","_hoisted_27","_hoisted_28","index","key","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_34","_hoisted_35","_hoisted_36","second","_hoisted_42","_hoisted_43","_hoisted_44","third","_hoisted_46","_hoisted_47","_hoisted_48","_hoisted_54","_hoisted_55","_hoisted_56"],"mappings":"oCA0F6BA,kBAAgB,CACzCC,KAAM,eACNC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACII,EAAUC,YAAS,kBAAML,EAAMC,KAAKK,WAAWF,SAAWJ,EAAMC,KAAKK,WA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V,WAAW+C,OAAOtD,kDAI3CiB,OAAKV,WAAWW,QAAUD,OAAKV,WAAWmD,qBAA5E1C,2BAAA2C,GACI5C,2BAAA6C,GACIC,EACA9C,0BAAIO,KAAML,OAAKV,WAAWmD,MAAMpC,OAC5BP,uDAAc,+BAA+CE,OAAKV,WAAWmD,MAAMnC,WACjCN,OAAKV,WAAWmD,MAAMnC,qBAApEP,kCAAMQ,IAAKP,OAAKV,WAAWmD,MAAMnC,iCACjCP,6CAIZD,2BAAA+C,GAC4B7C,OAAKV,WAAWmD,MAAM9B,oBAA9CZ,2BAAA+C,EAAoD,mCAAiB9C,OAAKV,WAAWmD,MAAM9B,0CAC3Fb,2BAAAiD,GACIjD,0BAAIO,KAAML,OAAKV,WAAWmD,MAAMpC,wBAASL,OAAKV,WAAWmD,MAAM1D"}
|
|
1
|
+
{"version":3,"file":"CheckoutItem.js","sources":["../../../../src/components/shop/order/CheckoutItem.vue","../../../../src/components/shop/order/CheckoutItem.vue?vue&type=template&id=4d5a1fac&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-bind:class=\"{ 'is-bundle': item.attributes.bundle }\">\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow\">\n <a :href=\"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\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"title\">\n <a :href=\"item.attributes.href\">{{ item.name }}</a>\n </div>\n </div>\n <div class=\"column is-2 has-text-centered is-relative\">\n <div class=\"quantity\">⨉ {{ item.quantity }}</div>\n <div class=\"quantity-price\" v-if=\"parseInt(item.quantity) > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </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=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\"></div>\n </div>\n </div>\n </div>\n <div class=\"options is-toggled\" v-if=\"itemOptions && itemOptions.length\">\n <div class=\"toggler\">\n <span>{{ __('shop.cart.additional') }} {{ itemOptions.length }}</span>\n </div>\n <div class=\"wrapper\">\n <div v-for=\"(option, index) in itemOptions\" v-bind:key=\"index\" class=\"columns is-checked\">\n <div class=\"column\">\n <div class=\"option-title\">{{ option.name }}</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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a :href=\"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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a :href=\"item.attributes.third.href\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { defineComponent, computed } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'CheckoutItem',\n props: {\n item: Object\n },\n setup(props) {\n const options = computed(() => (props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []));\n const itemOptions = computed(() => (props.item.options && props.item.options.length ? props.item.options.filter((option) => options.value.indexOf(option.id) !== -1) : []));\n\n return {\n itemOptions\n };\n }\n});\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-bind:class=\"{ 'is-bundle': item.attributes.bundle }\">\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow\">\n <a :href=\"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\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"title\">\n <a :href=\"item.attributes.href\">{{ item.name }}</a>\n </div>\n </div>\n <div class=\"column is-2 has-text-centered is-relative\">\n <div class=\"quantity\">⨉ {{ item.quantity }}</div>\n <div class=\"quantity-price\" v-if=\"parseInt(item.quantity) > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </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=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\"></div>\n </div>\n </div>\n </div>\n <div class=\"options is-toggled\" v-if=\"itemOptions && itemOptions.length\">\n <div class=\"toggler\">\n <span>{{ __('shop.cart.additional') }} {{ itemOptions.length }}</span>\n </div>\n <div class=\"wrapper\">\n <div v-for=\"(option, index) in itemOptions\" v-bind:key=\"index\" class=\"columns is-checked\">\n <div class=\"column\">\n <div class=\"option-title\">{{ option.name }}</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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a :href=\"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 <svg class=\"bundle-icon\"><use xlink:href=\"#bundle-plus\" /></svg>\n <a :href=\"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\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a :href=\"item.attributes.third.href\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { defineComponent, computed } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'CheckoutItem',\n props: {\n item: Object\n },\n setup(props) {\n const options = computed(() => (props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []));\n const itemOptions = computed(() => (props.item.options && props.item.options.length ? props.item.options.filter((option) => options.value.indexOf(option.id) !== -1) : []));\n\n return {\n itemOptions\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","item","Object","setup","options","computed","attributes","length","itemOptions","filter","option","value","indexOf","id","_createElementVNode","_createElementBlock","_ctx","bundle","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","href","image","src","_hoisted_10","_hoisted_11","_hoisted_12","code","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","quantity","parseInt","_hoisted_18","innerHTML","price","_hoisted_20","priceOld","amount","percent","sum","_hoisted_24","_hoisted_25","_hoisted_26","index","key","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_32","_hoisted_33","_hoisted_34","second","_hoisted_40","_hoisted_41","_hoisted_42","third","_hoisted_44","_hoisted_45","_hoisted_46","_hoisted_52","_hoisted_53","_hoisted_54"],"mappings":"oCA0F6BA,kBAAgB,CACzCC,KAAM,eACNC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACII,EAAUC,YAAS,kBAAOL,EAAMC,KAAKK,WAAWF,SAAWJ,EAAMC,KAAKK,WAAWF,QAAQG,OAASP,EAAMC,KAAKK,WAAWF,QAAU,YAGjI,CACHI,YAHgBH,YAAS,kBAAOL,EAAMC,KAAKG,SAAWJ,EAAMC,KAAKG,QAAQG,OAASP,EAAMC,KAAKG,QAAQK,QAAO,SAACC,UAAiD,IAAtCN,EAAQO,MAAMC,QAAQF,EAAOG,OAAc,yBC/F5J,yBACI,yBAEJ,wBAEQ,sDAIaC,qBAA0B,oBAAV,4BAI7B,mBACI,oCACI,yBACI,iBACA,6BAIJ,sDACI,2BACA,2CAEJ,6FAQJ,+BACI,oBAGA,oBAEQ,mBACI,yBAEJ,kDAA6B,oCAMjD,2BACI,sBACPA,kCAAW,gBAAcA,qBAAiC,oBAAjB,wDAIrBA,qBAA0B,oBAAV,4BAI7B,yBACI,iBACA,mCAKR,2BACI,sBACPA,kCAAW,gBAAcA,qBAAiC,oBAAjB,wDAIrBA,qBAA0B,oBAAV,4BAI7B,yBACI,iBACA,6EA9E3BC,oDAAW,mDAAmEC,OAAKV,WAAWW,YAC1DD,OAAKV,WAAWW,sBAAhDF,2BAAAG,GACIJ,2BAAAK,oBAA6BH,gEAEjCF,2BAAAM,GACIN,oDAAW,kBAAkCE,OAAKV,WAAWW,YACzDH,2BAAAO,GACIP,0BAAIQ,KAAMN,OAAKV,WAAWgB,OACtBR,uDAAc,+BAA+CE,OAAKV,WAAWiB,WACjCP,OAAKV,WAAWiB,qBAAxDR,kCAAMS,IA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IC,EACAvC,0BAAIQ,KAAMN,OAAKV,WAAWgD,OAAOhC,OAC7BR,uDAAc,+BAA+CE,OAAKV,WAAWgD,OAAO/B,WACjCP,OAAKV,WAAWgD,OAAO/B,qBAAtER,kCAAMS,IAAKR,OAAKV,WAAWgD,OAAO/B,iCAClCR,6CAIZD,2BAAAyC,GAC4BvC,OAAKV,WAAWgD,OAAO1B,oBAA/Cb,2BAAAyC,oBAAwDxC,8CAA2BA,OAAKV,WAAWgD,OAAO1B,0CAC1Gd,2BAAA2C,GACI3C,0BAAIQ,KAAMN,OAAKV,WAAWgD,OAAOhC,wBAASN,OAAKV,WAAWgD,OAAOvD,kDAI3CiB,OAAKV,WAAWW,QAAUD,OAAKV,WAAWoD,qBAA5E3C,2BAAA4C,GACI7C,2BAAA8C,GACIC,EACA/C,0BAAIQ,KAAMN,OAAKV,WAAWoD,MAAMpC,OAC5BR,uDAAc,+BAA+CE,OAAKV,WAAWoD,MAAMnC,WACjCP,OAAKV,WAAWoD,MAAMnC,qBAApER,kCAAMS,IAAKR,OAAKV,WAAWoD,MAAMnC,iCACjCR,6CAIZD,2BAAAgD,GAC4B9C,OAAKV,WAAWoD,MAAM9B,oBAA9Cb,2BAAAgD,oBAAuD/C,8CAA2BA,OAAKV,WAAWoD,MAAM9B,0CACxGd,2BAAAkD,GACIlD,0BAAIQ,KAAMN,OAAKV,WAAWoD,MAAMpC,wBAASN,OAAKV,WAAWoD,MAAM3D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),a=require("formvuelate"),r=require("@formvuelate/plugin-vee-validate"),n=require("@perevorot/shop/dist/forms/FormText"),o=require("@perevorot/shop/dist/forms/FormTextarea"),l=require("yup"),i=require("vue-toastification");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var u=c(r),m=c(n),d=c(o),p=s(l);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==a)return;var r,n,o=[],l=!0,i=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(i)throw n}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return v(e,t)}(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.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}var h=i.useToast();e.markRaw(m.default),e.markRaw(d.default);var y={components:{SchemaForm:a.SchemaFormFactory([u.default({})])},name:"order-one-click",props:{id:Number,className:String,callback:Function,closeAction:Function,model:Array,nameSpace:{type:String,default:"oneclick"}},setup:function(r){var n=e.ref(!1),o=e.ref(0),l=e.ref({}),i=t.useStore(),c=e.ref(!1),s=e.computed((function(){return i.getters["auth/me"]})),u=e.ref(!1),v=function(e,t){c.value=!1,t&&r.closeAction&&r.closeAction()},y={name:{component:m.default,label:__("shop.order."+r.nameSpace+".name"),store:"oneclick",model:"name"},phone:{component:m.default,label:__("shop.order."+r.nameSpace+".phone"),type:"phone",placeholder:"(050) 123-45-67",mask:"(###) ###-##-##",store:r.nameSpace,model:"phone"}};-1!==r.model.indexOf("email")&&(y.email={component:m.default,label:__("shop.order."+r.nameSpace+".email"),store:r.nameSpace,model:"email"}),-1!==r.model.indexOf("comment")&&(y.comment={component:d.default,label:__("shop.order."+r.nameSpace+".comment"),store:r.nameSpace,model:"email"});var b=e.ref(y),S={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!==r.model.indexOf("email")&&(S.email=p.string().trim().email(__("auth.validation.email")).required(__("auth.validation.required")));var _=p.object().shape(S),g=e.ref({});e.onMounted((function(){g.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:r.id?r.id:null,namespace:r.nameSpace}})),a.useSchemaForm(g);return{open:function(){u.value=!1,c.value=!0},close:v,modal:c,loading:n,key:o,errors:l,schema:b,validation:_,model:g,onSubmit:function(){n.value=!0;var e=document.querySelector(".shop-product .product-info .cart-change-quantity input");e&&(g.value.quantity=e.value),$http.post($ziggy("api.order.oneclick"),g.value).then((function(e){r.callback?(v(),r.callback(e)):(u.value=!0,o.value++)})).finally((function(){n.value=!1})).catch((function(e){if(e.response.data&&e.response.data.error&&e.response.data.message&&h(e.response.data.message,{type:"error"}),e.response.data&&e.response.data.errors){for(var t=0,a=Object.entries(e.response.data.errors);t<a.length;t++){var r=f(a[t],2),n=r[0],i=r[1];i[0]&&(l.value[n]=i[0])}o.value++}}))},thanks:u}}},b={class:"shop-order-one-click"},S={class:"modal-content"},_=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],g={class:"box"},k={class:"title"},N={class:"field"},E=["innerHTML"],q={class:"mt-3"};y.render=function(t,a,r,n,o,l){var i=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("button",{class:e.normalizeClass(r.className?r.className:"button is-link is-small"),onClick:a[0]||(a[0]=function(){return n.open&&n.open.apply(n,arguments)})},e.toDisplayString(t.__("shop.order."+r.nameSpace+".add")),3),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":n.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:a[1]||(a[1]=function(){return n.close&&n.close.apply(n,arguments)})}),e.createElementVNode("div",S,[e.createElementVNode("button",{class:"modal-close is-large",onClick:a[2]||(a[2]=function(){return n.close&&n.close.apply(n,arguments)})},_),e.createElementVNode("div",g,[e.createElementVNode("div",k,e.toDisplayString(t.__("shop.order."+r.nameSpace+".title")),1),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(),e.createBlock(i,{schemaRowClasses:"field",schema:n.schema,"validation-schema":n.validation,"initial-errors":n.errors,key:n.key,onSubmit:n.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",N,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":n.loading}]),type:"submit"},e.toDisplayString(t.__("shop.order."+r.nameSpace+".submit")),3)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"]))],512),[[e.vShow,!n.thanks]]),e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",{innerHTML:t.__("shop.order."+r.nameSpace+".thanks")},null,8,E),e.createElementVNode("div",q,[e.createElementVNode("button",{class:"button",onClick:a[3]||(a[3]=function(e){return n.close(e,!0)})},e.toDisplayString(t.__("shop.order."+r.nameSpace+".continue")),1)])],512),[[e.vShow,n.thanks]])])])],2)])},module.exports=y;
|
|
2
2
|
//# sourceMappingURL=OneClick.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneClick.js","sources":["../../../../src/components/shop/order/OneClick.vue","../../../../src/components/shop/order/OneClick.vue?vue&type=template&id=2dd03fc7&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-order-one-click\">\n <button v-bind:class=\"className ? className : 'button is-link is-small'\" @click=\"open\">\n {{ __('shop.order.' + nameSpace + '.add') }}\n </button>\n\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">\n {{ __('shop.order.' + nameSpace + '.title') }}\n </div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading\n }\"\n >\n {{ __('shop.order.' + nameSpace + '.submit') }}\n </button>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div v-html=\"__('shop.order.' + nameSpace + '.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close($event, true)\">\n {{ __('shop.order.' + nameSpace + '.continue') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, markRaw, onMounted } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\nimport * as yup from 'yup';\nimport { useToast } from 'vue-toastification';\n\nconst toast = useToast();\n\nmarkRaw(FormText);\nmarkRaw(FormTextarea);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n components: {\n SchemaForm\n },\n name: 'order-one-click',\n props: {\n id: Number,\n className: String,\n callback: Function,\n closeAction: Function,\n model: Array,\n nameSpace: {\n type: String,\n default: 'oneclick'\n }\n },\n setup(props) {\n const loading = ref(false);\n const key = ref(0);\n const errors = ref({});\n const store = useStore();\n const modal = computed(() => store.getters['order/modal']);\n const user = computed(() => store.getters['auth/me']);\n const thanks = ref(false);\n\n const open = () => {\n thanks.value = false;\n store.commit('order/modal', 'oneclick');\n };\n\n const close = (e, fromButton) => {\n store.commit('order/modal', null);\n\n if (fromButton && props.closeAction) {\n props.closeAction();\n }\n };\n\n let schemaObject = {\n name: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.name'),\n store: 'oneclick',\n model: 'name'\n },\n phone: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.phone'),\n type: 'phone',\n placeholder: '(050) 123-45-67',\n mask: '(###) ###-##-##',\n store: props.nameSpace,\n model: 'phone'\n }\n };\n\n if (props.model.indexOf('email') !== -1) {\n schemaObject.email = {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.email'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n if (props.model.indexOf('comment') !== -1) {\n schemaObject.comment = {\n component: FormTextarea,\n label: __('shop.order.' + props.nameSpace + '.comment'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n const schema = ref(schemaObject);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n let validationObject = {\n name: yup.string().trim().required(__('auth.validation.required')),\n phone: yup.string().trim().required(__('auth.validation.required')).matches(phoneRegExp, __('auth.validation.phone'))\n };\n\n if (props.model.indexOf('email') !== -1) {\n validationObject.email = yup.string().trim().email(__('auth.validation.email')).required(__('auth.validation.required'));\n }\n\n const validation = yup.object().shape(validationObject);\n\n const model = ref({});\n\n onMounted(() => {\n model.value = {\n name: (user.value.last_name ? user.value.last_name : '') + (user.value.name ? ' ' + user.value.name : ''),\n email: user.value.email ? user.value.email : '',\n phone: user.value.phone_formatted ? user.value.phone_formatted : '',\n id: props.id ? props.id : null,\n namespace: props.nameSpace\n };\n });\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n const quantityInput = document.querySelector('.shop-product .product-info .cart-change-quantity input');\n\n if (quantityInput) {\n model.value.quantity = quantityInput.value;\n }\n\n $http\n .post($ziggy('api.order.oneclick'), model.value)\n .then((response) => {\n if (props.callback) {\n close();\n props.callback(response);\n } else {\n thanks.value = true;\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n })\n .catch((error) => {\n if (error.response.data && error.response.data.error && error.response.data.message) {\n toast(error.response.data.message, {\n type: 'error'\n });\n }\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n });\n };\n\n return {\n open,\n close,\n modal,\n loading,\n key,\n errors,\n schema,\n validation,\n model,\n onSubmit,\n thanks\n };\n }\n};\n</script>","<template>\n <div class=\"shop-order-one-click\">\n <button v-bind:class=\"className ? className : 'button is-link is-small'\" @click=\"open\">\n {{ __('shop.order.' + nameSpace + '.add') }}\n </button>\n\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">\n {{ __('shop.order.' + nameSpace + '.title') }}\n </div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading\n }\"\n >\n {{ __('shop.order.' + nameSpace + '.submit') }}\n </button>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div v-html=\"__('shop.order.' + nameSpace + '.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close($event, true)\">\n {{ __('shop.order.' + nameSpace + '.continue') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, markRaw, onMounted } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\nimport * as yup from 'yup';\nimport { useToast } from 'vue-toastification';\n\nconst toast = useToast();\n\nmarkRaw(FormText);\nmarkRaw(FormTextarea);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n components: {\n SchemaForm\n },\n name: 'order-one-click',\n props: {\n id: Number,\n className: String,\n callback: Function,\n closeAction: Function,\n model: Array,\n nameSpace: {\n type: String,\n default: 'oneclick'\n }\n },\n setup(props) {\n const loading = ref(false);\n const key = ref(0);\n const errors = ref({});\n const store = useStore();\n const modal = computed(() => store.getters['order/modal']);\n const user = computed(() => store.getters['auth/me']);\n const thanks = ref(false);\n\n const open = () => {\n thanks.value = false;\n store.commit('order/modal', 'oneclick');\n };\n\n const close = (e, fromButton) => {\n store.commit('order/modal', null);\n\n if (fromButton && props.closeAction) {\n props.closeAction();\n }\n };\n\n let schemaObject = {\n name: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.name'),\n store: 'oneclick',\n model: 'name'\n },\n phone: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.phone'),\n type: 'phone',\n placeholder: '(050) 123-45-67',\n mask: '(###) ###-##-##',\n store: props.nameSpace,\n model: 'phone'\n }\n };\n\n if (props.model.indexOf('email') !== -1) {\n schemaObject.email = {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.email'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n if (props.model.indexOf('comment') !== -1) {\n schemaObject.comment = {\n component: FormTextarea,\n label: __('shop.order.' + props.nameSpace + '.comment'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n const schema = ref(schemaObject);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n let validationObject = {\n name: yup.string().trim().required(__('auth.validation.required')),\n phone: yup.string().trim().required(__('auth.validation.required')).matches(phoneRegExp, __('auth.validation.phone'))\n };\n\n if (props.model.indexOf('email') !== -1) {\n validationObject.email = yup.string().trim().email(__('auth.validation.email')).required(__('auth.validation.required'));\n }\n\n const validation = yup.object().shape(validationObject);\n\n const model = ref({});\n\n onMounted(() => {\n model.value = {\n name: (user.value.last_name ? user.value.last_name : '') + (user.value.name ? ' ' + user.value.name : ''),\n email: user.value.email ? user.value.email : '',\n phone: user.value.phone_formatted ? user.value.phone_formatted : '',\n id: props.id ? props.id : null,\n namespace: props.nameSpace\n };\n });\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n const quantityInput = document.querySelector('.shop-product .product-info .cart-change-quantity input');\n\n if (quantityInput) {\n model.value.quantity = quantityInput.value;\n }\n\n $http\n .post($ziggy('api.order.oneclick'), model.value)\n .then((response) => {\n if (props.callback) {\n close();\n props.callback(response);\n } else {\n thanks.value = true;\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n })\n .catch((error) => {\n if (error.response.data && error.response.data.error && error.response.data.message) {\n toast(error.response.data.message, {\n type: 'error'\n });\n }\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n });\n };\n\n return {\n open,\n close,\n modal,\n loading,\n key,\n errors,\n schema,\n validation,\n model,\n onSubmit,\n thanks\n };\n }\n};\n</script>"],"names":["toast","useToast","markRaw","FormText","FormTextarea","components","SchemaForm","SchemaFormFactory","VeeValidatePlugin","name","props","id","Number","className","String","callback","Function","closeAction","model","Array","nameSpace","type","setup","loading","ref","key","errors","store","useStore","modal","computed","getters","user","thanks","close","e","fromButton","commit","schemaObject","component","label","__","phone","placeholder","mask","indexOf","email","comment","schema","validationObject","yup","string","trim","required","matches","validation","object","shape","onMounted","value","last_name","phone_formatted","namespace","useSchemaForm","open","onSubmit","quantityInput","document","querySelector","quantity","$http","post","$ziggy","then","response","error","data","message","Object","entries","field","messages","_createElementVNode","_createElementBlock","_hoisted_1","$props","onClick","$setup","_ctx","_hoisted_2","_hoisted_5","_hoisted_6","_createBlock","schemaRowClasses","afterForm","_hoisted_7","innerHTML","_hoisted_9","$event"],"mappings":"ymDA0DA,IAAMA,EAAQC,aAEdC,UAAQC,WACRD,UAAQE,WAER,MAEe,CACXC,WAAY,CACRC,WAJWC,oBAAkB,CAACC,UAAkB,OAMpDC,KAAM,kBACNC,MAAO,CACHC,GAAIC,OACJC,UAAWC,OACXC,SAAUC,SACVC,YAAaD,SACbE,MAAOC,MACPC,UAAW,CACPC,KAAMP,eACG,aAGjBQ,eAAMZ,OACIa,EAAUC,OAAI,GACdC,EAAMD,MAAI,GACVE,EAASF,MAAI,IACbG,EAAQC,aACRC,EAAQC,YAAS,kBAAMH,EAAMI,QAAQ,kBACrCC,EAAOF,YAAS,kBAAMH,EAAMI,QAAQ,cACpCE,EAAST,OAAI,GAObU,EAAQ,SAACC,EAAGC,GACdT,EAAMU,OAAO,cAAe,MAExBD,GAAc1B,EAAMO,aACpBP,EAAMO,eAIVqB,EAAe,CACf7B,KAAM,CACF8B,UAAWpC,UACXqC,MAAOC,GAAG,cAAgB/B,EAAMU,UAAY,SAC5CO,MAAO,WACPT,MAAO,QAEXwB,MAAO,CACHH,UAAWpC,UACXqC,MAAOC,GAAG,cAAgB/B,EAAMU,UAAY,UAC5CC,KAAM,QACNsB,YAAa,kBACbC,KAAM,kBACNjB,MAAOjB,EAAMU,UACbF,MAAO,WAIuB,IAAlCR,EAAMQ,MAAM2B,QAAQ,WACpBP,EAAaQ,MAAQ,CACjBP,UAAWpC,UACXqC,MAAOC,GAAG,cAAgB/B,EAAMU,UAAY,UAC5CO,MAAOjB,EAAMU,U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zCc,MAAK,SAACC,GACChE,EAAMK,UACNmB,IACAxB,EAAMK,SAAS2D,KAEfzC,EAAO0B,OAAQ,EAEflC,EAAIkC,qBAGH,WACLpC,EAAQoC,OAAQ,YAEb,SAACgB,MACAA,EAAMD,SAASE,MAAQD,EAAMD,SAASE,KAAKD,OAASA,EAAMD,SAASE,KAAKC,SACxE7E,EAAM2E,EAAMD,SAASE,KAAKC,QAAS,CAC/BxD,KAAM,UAIVsD,EAAMD,SAASE,MAAQD,EAAMD,SAASE,KAAKlD,OAAQ,eACnBoD,OAAOC,QAAQJ,EAAMD,SAASE,KAAKlD,uBAAS,iBAAhEsD,OAAOC,OACXA,EAAS,KACTvD,EAAOiC,MAAMqB,GAASC,EAAS,IAIvCxD,EAAIkC,aAgBhB1B,OAAAA,cC7NG,iCAOQ,oBAEHiD,kCAAW,eACPA,yCAAgB,0BAGb,gBACI,kBAMY,kCAgBR,mGApC/BC,2BAAAC,GACIF,sDAAsBG,YAAYA,uCAAwCC,sCAAOC,uDAC1EC,mBAAmBH,wBAG1BH,oDAAW,qBAAqCK,aAC5CL,kCAAW,mBAAoBI,sCAAOC,wCACtCL,2BAAAO,GACIP,qCAAc,uBAAwBI,sCAAOC,0CAK7CL,2BAAAQ,GACIR,2BAAAS,oBACOH,mBAAmBH,2CAE1BH,gDACIU,iBAAYC,iBAAiB,QAAS7C,OAAQuC,6BAA4BA,8BAA6BA,SAAS9D,IAAK8D,MAAMtB,SAAQsB,aACpHO,qBACP,kBAAAZ,2BAAAa,GACIb,uDACU,4CACN7D,KAAK,4BAKFmE,mBAAmBH,sHAX5BE,6BAiBdL,iCACIA,4BAAKc,UAAQR,mBAAmBH,kCAChCH,2BAAAe,GACIf,qCAAc,SAAUI,uCAAOC,QAAMW,2BAC9BV,mBAAmBH,+CAJrBE"}
|
|
1
|
+
{"version":3,"file":"OneClick.js","sources":["../../../../src/components/shop/order/OneClick.vue","../../../../src/components/shop/order/OneClick.vue?vue&type=template&id=2d90000d&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-order-one-click\">\n <button v-bind:class=\"className ? className : 'button is-link is-small'\" @click=\"open\">\n {{ __('shop.order.' + nameSpace + '.add') }}\n </button>\n\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">\n {{ __('shop.order.' + nameSpace + '.title') }}\n </div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading\n }\"\n >\n {{ __('shop.order.' + nameSpace + '.submit') }}\n </button>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div v-html=\"__('shop.order.' + nameSpace + '.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close($event, true)\">\n {{ __('shop.order.' + nameSpace + '.continue') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, markRaw, onMounted } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\nimport * as yup from 'yup';\nimport { useToast } from 'vue-toastification';\n\nconst toast = useToast();\n\nmarkRaw(FormText);\nmarkRaw(FormTextarea);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n components: {\n SchemaForm\n },\n name: 'order-one-click',\n props: {\n id: Number,\n className: String,\n callback: Function,\n closeAction: Function,\n model: Array,\n nameSpace: {\n type: String,\n default: 'oneclick'\n }\n },\n setup(props) {\n const loading = ref(false);\n const key = ref(0);\n const errors = ref({});\n const store = useStore();\n const modal = ref(false);\n const user = computed(() => store.getters['auth/me']);\n const thanks = ref(false);\n\n const open = () => {\n thanks.value = false;\n modal.value = true;\n };\n\n const close = (e, fromButton) => {\n modal.value = false;\n\n if (fromButton && props.closeAction) {\n props.closeAction();\n }\n };\n\n let schemaObject = {\n name: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.name'),\n store: 'oneclick',\n model: 'name'\n },\n phone: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.phone'),\n type: 'phone',\n placeholder: '(050) 123-45-67',\n mask: '(###) ###-##-##',\n store: props.nameSpace,\n model: 'phone'\n }\n };\n\n if (props.model.indexOf('email') !== -1) {\n schemaObject.email = {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.email'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n if (props.model.indexOf('comment') !== -1) {\n schemaObject.comment = {\n component: FormTextarea,\n label: __('shop.order.' + props.nameSpace + '.comment'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n const schema = ref(schemaObject);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n let validationObject = {\n name: yup.string().trim().required(__('auth.validation.required')),\n phone: yup.string().trim().required(__('auth.validation.required')).matches(phoneRegExp, __('auth.validation.phone'))\n };\n\n if (props.model.indexOf('email') !== -1) {\n validationObject.email = yup.string().trim().email(__('auth.validation.email')).required(__('auth.validation.required'));\n }\n\n const validation = yup.object().shape(validationObject);\n\n const model = ref({});\n\n onMounted(() => {\n model.value = {\n name: (user.value.last_name ? user.value.last_name : '') + (user.value.name ? ' ' + user.value.name : ''),\n email: user.value.email ? user.value.email : '',\n phone: user.value.phone_formatted ? user.value.phone_formatted : '',\n id: props.id ? props.id : null,\n namespace: props.nameSpace\n };\n });\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n const quantityInput = document.querySelector('.shop-product .product-info .cart-change-quantity input');\n\n if (quantityInput) {\n model.value.quantity = quantityInput.value;\n }\n\n $http\n .post($ziggy('api.order.oneclick'), model.value)\n .then((response) => {\n if (props.callback) {\n close();\n props.callback(response);\n } else {\n thanks.value = true;\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n })\n .catch((error) => {\n if (error.response.data && error.response.data.error && error.response.data.message) {\n toast(error.response.data.message, {\n type: 'error'\n });\n }\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n });\n };\n\n return {\n open,\n close,\n modal,\n loading,\n key,\n errors,\n schema,\n validation,\n model,\n onSubmit,\n thanks\n };\n }\n};\n</script>","<template>\n <div class=\"shop-order-one-click\">\n <button v-bind:class=\"className ? className : 'button is-link is-small'\" @click=\"open\">\n {{ __('shop.order.' + nameSpace + '.add') }}\n </button>\n\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">\n {{ __('shop.order.' + nameSpace + '.title') }}\n </div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading\n }\"\n >\n {{ __('shop.order.' + nameSpace + '.submit') }}\n </button>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div v-html=\"__('shop.order.' + nameSpace + '.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close($event, true)\">\n {{ __('shop.order.' + nameSpace + '.continue') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, markRaw, onMounted } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\nimport * as yup from 'yup';\nimport { useToast } from 'vue-toastification';\n\nconst toast = useToast();\n\nmarkRaw(FormText);\nmarkRaw(FormTextarea);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n components: {\n SchemaForm\n },\n name: 'order-one-click',\n props: {\n id: Number,\n className: String,\n callback: Function,\n closeAction: Function,\n model: Array,\n nameSpace: {\n type: String,\n default: 'oneclick'\n }\n },\n setup(props) {\n const loading = ref(false);\n const key = ref(0);\n const errors = ref({});\n const store = useStore();\n const modal = ref(false);\n const user = computed(() => store.getters['auth/me']);\n const thanks = ref(false);\n\n const open = () => {\n thanks.value = false;\n modal.value = true;\n };\n\n const close = (e, fromButton) => {\n modal.value = false;\n\n if (fromButton && props.closeAction) {\n props.closeAction();\n }\n };\n\n let schemaObject = {\n name: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.name'),\n store: 'oneclick',\n model: 'name'\n },\n phone: {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.phone'),\n type: 'phone',\n placeholder: '(050) 123-45-67',\n mask: '(###) ###-##-##',\n store: props.nameSpace,\n model: 'phone'\n }\n };\n\n if (props.model.indexOf('email') !== -1) {\n schemaObject.email = {\n component: FormText,\n label: __('shop.order.' + props.nameSpace + '.email'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n if (props.model.indexOf('comment') !== -1) {\n schemaObject.comment = {\n component: FormTextarea,\n label: __('shop.order.' + props.nameSpace + '.comment'),\n store: props.nameSpace,\n model: 'email'\n };\n }\n\n const schema = ref(schemaObject);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n let validationObject = {\n name: yup.string().trim().required(__('auth.validation.required')),\n phone: yup.string().trim().required(__('auth.validation.required')).matches(phoneRegExp, __('auth.validation.phone'))\n };\n\n if (props.model.indexOf('email') !== -1) {\n validationObject.email = yup.string().trim().email(__('auth.validation.email')).required(__('auth.validation.required'));\n }\n\n const validation = yup.object().shape(validationObject);\n\n const model = ref({});\n\n onMounted(() => {\n model.value = {\n name: (user.value.last_name ? user.value.last_name : '') + (user.value.name ? ' ' + user.value.name : ''),\n email: user.value.email ? user.value.email : '',\n phone: user.value.phone_formatted ? user.value.phone_formatted : '',\n id: props.id ? props.id : null,\n namespace: props.nameSpace\n };\n });\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n const quantityInput = document.querySelector('.shop-product .product-info .cart-change-quantity input');\n\n if (quantityInput) {\n model.value.quantity = quantityInput.value;\n }\n\n $http\n .post($ziggy('api.order.oneclick'), model.value)\n .then((response) => {\n if (props.callback) {\n close();\n props.callback(response);\n } else {\n thanks.value = true;\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n })\n .catch((error) => {\n if (error.response.data && error.response.data.error && error.response.data.message) {\n toast(error.response.data.message, {\n type: 'error'\n });\n }\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n });\n };\n\n return {\n open,\n close,\n modal,\n loading,\n key,\n errors,\n schema,\n validation,\n model,\n onSubmit,\n thanks\n };\n }\n};\n</script>"],"names":["toast","useToast","markRaw","FormText","FormTextarea","components","SchemaForm","SchemaFormFactory","VeeValidatePlugin","name","props","id","Number","className","String","callback","Function","closeAction","model","Array","nameSpace","type","setup","loading","ref","key","errors","store","useStore","modal","user","computed","getters","thanks","close","e","fromButton","value","schemaObject","component","label","__","phone","placeholder","mask","indexOf","email","comment","schema","validationObject","yup","string","trim","required","matches","validation","object","shape","onMounted","last_name","phone_formatted","namespace","useSchemaForm","open","onSubmit","quantityInput","document","querySelector","quantity","$http","post","$ziggy","then","response","error","data","message","Object","entries","field","messages","_createElementVNode","_createElementBlock","_hoisted_1","$props","onClick","$setup","_ctx","_hoisted_2","_hoisted_5","_hoisted_6","_createBlock","schemaRowClasses","afterForm","_hoisted_7","innerHTML","_hoisted_9","$event"],"mappings":"ymDA0DA,IAAMA,EAAQC,aAEdC,UAAQC,WACRD,UAAQE,WAER,MAEe,CACXC,WAAY,CACRC,WAJWC,oBAAkB,CAACC,UAAkB,OAMpDC,KAAM,kBACNC,MAAO,CACHC,GAAIC,OACJC,UAAWC,OACXC,SAAUC,SACVC,YAAaD,SACbE,MAAOC,MACPC,UAAW,CACPC,KAAMP,eACG,aAGjBQ,eAAMZ,OACIa,EAAUC,OAAI,GACdC,EAAMD,MAAI,GACVE,EAASF,MAAI,IACbG,EAAQC,aACRC,EAAQL,OAAI,GACZM,EAAOC,YAAS,kBAAMJ,EAAMK,QAAQ,cACpCC,EAAST,OAAI,GAObU,EAAQ,SAACC,EAAGC,GACdP,EAAMQ,OAAQ,EAEVD,GAAc1B,EAAMO,aACpBP,EAAMO,eAIVqB,EAAe,CACf7B,KAAM,CACF8B,UAAWpC,UACXqC,MAAOC,GAAG,cAAgB/B,EAAMU,UAAY,SAC5CO,MAAO,WACPT,MAAO,QAEXwB,MAAO,CACHH,UAAWpC,UACXqC,MAAOC,GAAG,cAAgB/B,EAAMU,UAAY,UAC5CC,KAAM,QACNsB,YAAa,kBACbC,KAAM,kBACNjB,MAAOjB,EAAMU,UACbF,MAAO,WAIuB,IAAlCR,EAAMQ,MAAM2B,QAAQ,WACpBP,EAAaQ,MAAQ,CACjBP,UAAWpC,UACXqC,MAAOC,GAAG,cAAgB/B,EAAMU,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function},setup:function(t){var
|
|
1
|
+
"use strict";var e=require("vue"),t=e.defineComponent({props:{data:Object,item:Object,commit:Function},setup:function(t){var i=e.computed({get:function(){return t.data[t.item.code]?t.data[t.item.code].address:""},set:function(e){var i={address:e,time:n.value};return t.commit(t.item.code,i,r(i)),e}}),n=e.computed({get:function(){return t.data[t.item.code]?t.data[t.item.code].time:""},set:function(e){var n={address:i.value,time:e};return t.commit(t.item.code,n,r(n)),e}}),r=function(e){return""!=e.address.trim()&&(!t.item.data.length||t.item.data.length&&""!==e.time.trim())};return{address:i,time:n}}}),i={class:"component"},n={class:"user-form"},r={class:"control"},o=["id"],a=["for"],d={class:"time"},c=["onClick"];t.render=function(t,m,l,s,u,p){return e.openBlock(),e.createElementBlock("div",i,[e.createElementVNode("div",n,[e.createElementVNode("div",r,[e.withDirectives(e.createElementVNode("input",{type:"input",class:"input","onUpdate:modelValue":m[0]||(m[0]=function(e){return t.address=e}),id:"shipping-courier-"+t.item.id,placeholder:" ",autocomplete:"chrome-off"},null,8,o),[[e.vModelText,t.address]]),e.createElementVNode("label",{class:"label",for:"shipping-courier-"+t.item.id},e.toDisplayString(t.__("shop.order.delivery_address")),9,a)])]),e.createElementVNode("div",d,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.data,(function(i){return e.openBlock(),e.createElementBlock("div",{key:i.id,class:e.normalizeClass({"is-selected":t.time==i.name}),onClick:function(e){return t.time=i.name}},e.toDisplayString(i.name),11,c)})),128))])])},module.exports=t;
|
|
2
2
|
//# sourceMappingURL=CheckoutShippingCourier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutShippingCourier.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingCourier.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingCourier.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"CheckoutShippingCourier.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingCourier.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingCourier.vue?vue&type=template&id=f9aea38a&lang.js"],"sourcesContent":["<template>\n <div class=\"component\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"input\" class=\"input\" v-model=\"address\" :id=\"'shipping-courier-' + item.id\" placeholder=\" \" autocomplete=\"chrome-off\" />\n <label class=\"label\" :for=\"'shipping-courier-' + item.id\">{{ __('shop.order.delivery_address') }}</label>\n </div>\n </div>\n <div class=\"time\">\n <div v-for=\"item in item.data\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-selected': time == item.name }\" @click=\"time = item.name\">{{ item.name }}</div>\n </div>\n </div>\n</template>\n<script>\nimport { computed, defineComponent } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const address = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].address : '';\n },\n set(address) {\n const data = {\n address: address,\n time: time.value\n };\n\n props.commit(props.item.code, data, isValid(data));\n\n return address;\n }\n });\n\n const time = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].time : '';\n },\n set(time) {\n const data = {\n address: address.value,\n time: time\n };\n\n props.commit(props.item.code, data, isValid(data));\n\n return time;\n }\n });\n\n const isValid = (data) => {\n return data.address.trim() != '' && (!props.item.data.length || (props.item.data.length && data.time.trim() !== ''));\n };\n\n return {\n address,\n time\n };\n }\n});\n</script>\n","<template>\n <div class=\"component\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"input\" class=\"input\" v-model=\"address\" :id=\"'shipping-courier-' + item.id\" placeholder=\" \" autocomplete=\"chrome-off\" />\n <label class=\"label\" :for=\"'shipping-courier-' + item.id\">{{ __('shop.order.delivery_address') }}</label>\n </div>\n </div>\n <div class=\"time\">\n <div v-for=\"item in item.data\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-selected': time == item.name }\" @click=\"time = item.name\">{{ item.name }}</div>\n </div>\n </div>\n</template>\n<script>\nimport { computed, defineComponent } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const address = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].address : '';\n },\n set(address) {\n const data = {\n address: address,\n time: time.value\n };\n\n props.commit(props.item.code, data, isValid(data));\n\n return address;\n }\n });\n\n const time = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].time : '';\n },\n set(time) {\n const data = {\n address: address.value,\n time: time\n };\n\n props.commit(props.item.code, data, isValid(data));\n\n return time;\n }\n });\n\n const isValid = (data) => {\n return data.address.trim() != '' && (!props.item.data.length || (props.item.data.length && data.time.trim() !== ''));\n };\n\n return {\n address,\n time\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","address","computed","get","code","set","time","value","isValid","trim","length","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","type","_ctx","id","placeholder","autocomplete","_hoisted_6","key","name","onClick"],"mappings":"oCAgBeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,OACIO,EAAUC,WAAS,CACrBC,sBACWT,EAAMC,KAAKD,EAAMG,KAAKO,MAAQV,EAAMC,KAAKD,EAAMG,KAAKO,MAAMH,QAAU,IAE/EI,aAAIJ,OACMN,EAAO,CACTM,QAASA,EACTK,KAAMA,EAAKC,cAGfb,EAAMI,OAAOJ,EAAMG,KAAKO,KAAMT,EAAMa,EAAQb,IAErCM,KAITK,EAAOJ,WAAS,CAClBC,sBACWT,EAAMC,KAAKD,EAAMG,KAAKO,MAAQV,EAAMC,KAAKD,EAAMG,KAAKO,MAAME,KAAO,IAE5ED,aAAIC,OACMX,EAAO,CACTM,QAASA,EAAQM,MACjBD,KAAMA,UAGVZ,EAAMI,OAAOJ,EAAMG,KAAKO,KAAMT,EAAMa,EAAQb,IAErCW,KAITE,EAAU,SAACb,SACiB,IAAvBA,EAAKM,QAAQQ,UAAkBf,EAAMG,KAAKF,KAAKe,QAAWhB,EAAMG,KAAKF,KAAKe,QAA+B,KAArBf,EAAKW,KAAKG,eAGlG,CACHR,QAAAA,EACAK,KAAAA,eC5DG,sBACI,sBACI,uCAKJ,0EAPfK,2BAAAC,GACIC,2BAAAC,GACID,2BAAAE,oBACIF,8BAAOG,KAAK,cAAc,6DAAiBC,cAAUC,uBAA0BD,OAAKC,GAAIC,YAAY,IAAIC,aAAa,uCAA1EH,aAC3CJ,oCAAa,gCAAoCI,OAAKC,sBAAOD,8CAGrEJ,2BAAAQ,oBACIV,kDAAoBM,OAAKtB,eAAbE,wBAAZc,4BAAsCW,IAAKzB,EAAKqB,yCAAmCD,QAAQpB,EAAK0B,OAASC,2BAAOP,OAAOpB,EAAK0B,yBAAS1B,EAAK0B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=e.defineComponent({props:{data:Object,item:Object,commit:Function},setup:function(t){return{address:e.computed({get:function(){return t.data[t.item.code]?t.data[t.item.code].address:""},set:function(e){var r={address:e};return t.commit(t.item.code,r,""!==e.trim()),e}})}}}),r={class:"component"},o={class:"user-form"},i={class:"control"},
|
|
1
|
+
"use strict";var e=require("vue"),t=e.defineComponent({props:{data:Object,item:Object,commit:Function},setup:function(t){return{address:e.computed({get:function(){return t.data[t.item.code]?t.data[t.item.code].address:""},set:function(e){var r={address:e};return t.commit(t.item.code,r,""!==e.trim()),e}})}}}),r={class:"component"},o={class:"user-form"},i={class:"control"},d=["id"],n=["for"];t.render=function(t,c,s,a,l,u){return e.openBlock(),e.createElementBlock("div",r,[e.createElementVNode("div",o,[e.createElementVNode("div",i,[e.withDirectives(e.createElementVNode("input",{type:"input",class:"input","onUpdate:modelValue":c[0]||(c[0]=function(e){return t.address=e}),id:"shipping-courier-"+t.item.id,placeholder:" ",autocomplete:"chrome-off"},null,8,d),[[e.vModelText,t.address]]),e.createElementVNode("label",{class:"label",for:"shipping-courier-"+t.item.id},e.toDisplayString(t.__("shop.order.delivery_address")),9,n)])])])},module.exports=t;
|
|
2
2
|
//# sourceMappingURL=CheckoutShippingNovaposhtaAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutShippingNovaposhtaAddress.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"CheckoutShippingNovaposhtaAddress.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.vue?vue&type=template&id=0fd8c0e8&lang.js"],"sourcesContent":["<template>\n <div class=\"component\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"input\" class=\"input\" v-model=\"address\" :id=\"'shipping-courier-' + item.id\" placeholder=\" \" autocomplete=\"chrome-off\" />\n <label class=\"label\" :for=\"'shipping-courier-' + item.id\">{{ __('shop.order.delivery_address') }}</label>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { computed, defineComponent } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const address = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].address : '';\n },\n set(address) {\n const data = {\n address: address\n };\n\n props.commit(props.item.code, data, address.trim() !== '');\n\n return address;\n }\n });\n\n return {\n address\n };\n }\n});\n</script>\n","<template>\n <div class=\"component\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"input\" class=\"input\" v-model=\"address\" :id=\"'shipping-courier-' + item.id\" placeholder=\" \" autocomplete=\"chrome-off\" />\n <label class=\"label\" :for=\"'shipping-courier-' + item.id\">{{ __('shop.order.delivery_address') }}</label>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { computed, defineComponent } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const address = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].address : '';\n },\n set(address) {\n const data = {\n address: address\n };\n\n props.commit(props.item.code, data, address.trim() !== '');\n\n return address;\n }\n });\n\n return {\n address\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","address","computed","get","code","set","trim","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","type","_ctx","id","placeholder","autocomplete"],"mappings":"oCAaeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SAgBK,CACHO,QAhBYC,WAAS,CACrBC,sBACWT,EAAMC,KAAKD,EAAMG,KAAKO,MAAQV,EAAMC,KAAKD,EAAMG,KAAKO,MAAMH,QAAU,IAE/EI,aAAIJ,OACMN,EAAO,CACTM,QAASA,UAGbP,EAAMI,OAAOJ,EAAMG,KAAKO,KAAMT,EAAyB,KAAnBM,EAAQK,QAErCL,kBC9BR,sBACI,sBACI,kFAFnBM,2BAAAC,GACIC,2BAAAC,GACID,2BAAAE,oBACIF,8BAAOG,KAAK,cAAc,6DAAiBC,cAAUC,uBAA0BD,OAAKC,GAAIC,YAAY,IAAIC,aAAa,uCAA1EH,aAC3CJ,oCAAa,gCAAoCI,OAAKC,sBAAOD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue");function t(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var o=e.defineComponent({props:{data:Object,item:Object,commit:Function},setup:function(o){var n,a,u=e.computed({get:function(){return o.data[o.item.code]?o.data[o.item.code].city:null},set:function(e){var t={city:e};o.commit(o.item.code,t,
|
|
1
|
+
"use strict";var e=require("vue");function t(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var o=e.defineComponent({props:{data:Object,item:Object,commit:Function},setup:function(o){var n,a,u=e.computed({get:function(){return o.data[o.item.code]?o.data[o.item.code].city:null},set:function(e){var t={city:e};o.commit(o.item.code,t,i(t))}}),r=e.computed({get:function(){return o.data[o.item.code]?o.data[o.item.code].warehouse:null},set:function(e){var t={city:u.value,warehouse:e};o.commit(o.item.code,t,i(t))}}),i=function(e){return!(!e.city||!e.warehouse)},l=e.ref(!1),c=e.ref(!1),s=e.ref(""),d=e.ref(""),p=e.ref([]),y=e.ref([]),v=e.ref([]),h=e.ref(null),f=e.ref(null),m=e.ref(!1),w=e.ref(!1),g=e.ref(!1),k=e.ref(!1);e.onMounted((function(){o.item.data&&o.item.data.length&&(y.value=o.item.data)}));var C=function(){l.value=!1,c.value=!1,g.value=!1,k.value=!1};window.addEventListener("keyup",(function(e){(l.value||c.value)&&"Escape"===e.key&&C()})),window.addEventListener("click",(function(e){e.target.closest(".novaposhta-wrapper")||C()})),e.watch(s,(function(e){clearTimeout(a),u.value=null,e&&(m.value=!0,a=setTimeout((function(){$http.post($ziggy("api.delivery-nova-poshta"),{q:e,action:"cities"}).then((function(e){p.value=e.data.cities})).finally((function(){m.value=!1}))}),400))})),e.watch(d,(function(e){clearTimeout(a),e?(w.value=!0,a=setTimeout((function(){$http.post($ziggy("api.delivery-nova-poshta"),{q:e,city:u.value.id,action:"warehouses"}).then((function(e){v.value=e.data.warehouses})).finally((function(){w.value=!1}))}),400)):(r.value=null,v.value=[])}));return t(n={isCityOpened:l,isWarehouseOpened:c,openCity:function(){l.value=!0},openWarehouse:function(){c.value=!0},cities:p,citiesPopular:y,warehouses:v,chooseCity:function(e,t){e.stopPropagation(),u.value=t,v.value=[],d.value="",g.value=!1,$http.post($ziggy("api.delivery-nova-poshta"),{city:t.id,action:"warehouses"}).then((function(e){v.value=e.data.warehouses})).finally((function(){w.value=!1})),C()},chooseWarehouse:function(e,t){e.stopPropagation(),r.value=t,k.value=!1,r.value=t,C()},queryCity:s,queryWarehouse:d,city:u,warehouse:r,loadingCity:m,loadingWarehouse:w,focusWarehouse:function(){l.value=!1,g.value=!1,k.value||(k.value=!0,e.nextTick((function(){f.value.value=" ",f.value.focus()})))},focusCity:function(){c.value=!1,k.value=!1,g.value||(g.value=!0,e.nextTick((function(){h.value.value=" ",h.value.focus()})))}},"city",u),t(n,"warehouse",r),t(n,"cityQueryInput",h),t(n,"warehouseQueryInput",f),t(n,"cityQueryInputInQueryMode",g),t(n,"warehouseQueryInputInQueryMode",k),n}}),n={class:"component novaposhta-wrapper"},a={class:"user-form"},u=["placeholder"],r=["value"],i=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),l={class:"dropdown-menu"},c={class:"dropdown-content"},s=["onClick"],d={key:0,class:"dropdown-item"},p={class:"user-form"},y=["placeholder"],v=["value"],h=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),f={class:"dropdown-menu"},m={class:"dropdown-content"},w=["onClick"],g={key:0,class:"dropdown-item"};o.render=function(t,o,k,C,E,V){return e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isCityOpened,"is-top":t.cityQueryInputInQueryMode}]),onMouseleave:o[4]||(o[4]=function(){return t.close&&t.close.apply(t,arguments)})},[e.createElementVNode("div",{class:"dropdown-trigger",onClick:o[3]||(o[3]=function(){return t.openCity&&t.openCity.apply(t,arguments)})},[e.createElementVNode("div",a,[e.createElementVNode("div",{class:e.normalizeClass(["control",{"is-loading":t.loadingCity}])},[e.withDirectives(e.createElementVNode("input",{type:"text",class:"input is-nolabel","onUpdate:modelValue":o[0]||(o[0]=function(e){return t.queryCity=e}),onFocus:o[1]||(o[1]=function(){return t.focusCity&&t.focusCity.apply(t,arguments)}),placeholder:t.__("shop.order.city_placeholder"),autocomplete:"chrome-off",ref:"cityQueryInput"},null,40,u),[[e.vModelText,t.queryCity],[e.vShow,t.cityQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("input",{type:"text",class:"input",value:t.city?t.city.name:"",onFocus:o[2]||(o[2]=function(){return t.focusCity&&t.focusCity.apply(t,arguments)}),placeholder:" "},null,40,r),[[e.vShow,!t.cityQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("label",{class:"label"},e.toDisplayString(t.__("shop.order.city")),513),[[e.vShow,!t.cityQueryInputInQueryMode]]),i],2)])]),e.createElementVNode("div",l,[e.createElementVNode("div",c,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.queryCity?t.cities:t.citiesPopular,(function(o){return e.openBlock(),e.createElementBlock("a",{class:"dropdown-item",key:o.id,onClick:function(e){return t.chooseCity(e,o)}},e.toDisplayString(o.name),9,s)})),128)),!t.queryCity||t.cities.length||t.loadingCity?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",d,e.toDisplayString(t.__("shop.checkout.shipment.warehouse.not_found")),1))])])],34),t.city?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["dropdown",{"is-active":t.isWarehouseOpened,"is-top":t.warehouseQueryInputInQueryMode}]),onMouseleave:o[9]||(o[9]=function(){return t.close&&t.close.apply(t,arguments)})},[e.createElementVNode("div",{class:"dropdown-trigger",onClick:o[8]||(o[8]=function(){return t.openWarehouse&&t.openWarehouse.apply(t,arguments)})},[e.createElementVNode("div",p,[e.createElementVNode("div",{class:e.normalizeClass(["control",{"is-loading":t.loadingWarehouse}])},[e.withDirectives(e.createElementVNode("input",{type:"text",class:"input is-nolabel","onUpdate:modelValue":o[5]||(o[5]=function(e){return t.queryWarehouse=e}),onFocus:o[6]||(o[6]=function(){return t.focusWarehouse&&t.focusWarehouse.apply(t,arguments)}),placeholder:t.__("shop.order.warehouse_placeholder"),autocomplete:"chrome-off",ref:"warehouseQueryInput"},null,40,y),[[e.vModelText,t.queryWarehouse],[e.vShow,t.warehouseQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("input",{type:"text",class:"input",value:t.warehouse?t.warehouse.name:"",onFocus:o[7]||(o[7]=function(){return t.focusWarehouse&&t.focusWarehouse.apply(t,arguments)}),placeholder:" "},null,40,v),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("label",{class:"label"},e.toDisplayString(t.__("shop.order.warehouse")),513),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),h],2)])]),e.createElementVNode("div",f,[e.createElementVNode("div",m,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.warehouses,(function(o){return e.openBlock(),e.createElementBlock("a",{class:"dropdown-item",key:o.id,onClick:function(e){return t.chooseWarehouse(e,o)}},e.toDisplayString(o.name),9,w)})),128)),!t.queryWarehouse||t.warehouses.length||t.loadingWarehouse?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",g,e.toDisplayString(t.__("shop.checkout.shipment.warehouse.not_found")),1))])])],34)):e.createCommentVNode("v-if",!0)])},module.exports=o;
|
|
2
2
|
//# sourceMappingURL=CheckoutShippingNovaposhtaWarehouse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutShippingNovaposhtaWarehouse.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.vue?vue&type=template&id=71db2232&lang.js"],"sourcesContent":["<template>\n <div class=\"component novaposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" placeholder=\"Введите название города\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <!-- <label class=\"label\" v-show=\"cityQueryInputInQueryMode\">Город</label> -->\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">Город</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in queryCity ? cities : citiesPopular\" v-bind:key=\"item.id\" @click=\"chooseCity($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryCity && !cities.length && !loadingCity\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isWarehouseOpened, 'is-top': warehouseQueryInputInQueryMode }\" v-if=\"city\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openWarehouse\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingWarehouse }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryWarehouse\" @focus=\"focusWarehouse\" placeholder=\"Введите номер отделения или адрес\" autocomplete=\"chrome-off\" v-show=\"warehouseQueryInputInQueryMode\" ref=\"warehouseQueryInput\" />\n <!-- <label class=\"label\" v-show=\"warehouseQueryInputInQueryMode\">Отделение</label> -->\n <input type=\"text\" class=\"input\" :value=\"warehouse ? warehouse.name : ''\" @focus=\"focusWarehouse\" placeholder=\" \" v-show=\"!warehouseQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!warehouseQueryInputInQueryMode\">Отделение</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in warehouses\" v-bind:key=\"item.id\" @click=\"chooseWarehouse($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryWarehouse && !warehouses.length && !loadingWarehouse\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n city: item.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n\n close();\n };\n\n const chooseWarehouse = (e, item) => {\n e.stopPropagation();\n\n warehouse.value = item;\n warehouseQueryInputInQueryMode.value = false;\n warehouse.value = item;\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if ((isCityOpened.value || isWarehouseOpened.value) && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.novaposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n action: 'cities'\n })\n .then((response) => {\n cities.value = response.data.cities;\n })\n .finally(() => {\n loadingCity.value = false;\n });\n }, 400);\n }\n });\n\n watch(queryWarehouse, (q) => {\n clearTimeout(typeTimeout);\n\n if (q) {\n loadingWarehouse.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n city: city.value.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n }, 400);\n } else {\n warehouse.value = null;\n warehouses.value = [];\n }\n });\n\n const focusWarehouse = () => {\n isCityOpened.value = false;\n cityQueryInputInQueryMode.value = false;\n\n if (!warehouseQueryInputInQueryMode.value) {\n warehouseQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n warehouseQueryInput.value.value = ' ';\n warehouseQueryInput.value.focus();\n });\n }\n };\n\n const focusCity = () => {\n isWarehouseOpened.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n if (!cityQueryInputInQueryMode.value) {\n cityQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n cityQueryInput.value.value = ' ';\n cityQueryInput.value.focus();\n });\n }\n };\n\n return {\n isCityOpened,\n isWarehouseOpened,\n openCity,\n openWarehouse,\n cities,\n citiesPopular,\n warehouses,\n chooseCity,\n chooseWarehouse,\n queryCity,\n queryWarehouse,\n city,\n warehouse,\n loadingCity,\n loadingWarehouse,\n focusWarehouse,\n focusCity,\n city,\n warehouse,\n cityQueryInput,\n warehouseQueryInput,\n cityQueryInputInQueryMode,\n warehouseQueryInputInQueryMode\n };\n }\n});\n</script>\n","<template>\n <div class=\"component novaposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" placeholder=\"Введите название города\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <!-- <label class=\"label\" v-show=\"cityQueryInputInQueryMode\">Город</label> -->\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">Город</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in queryCity ? cities : citiesPopular\" v-bind:key=\"item.id\" @click=\"chooseCity($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryCity && !cities.length && !loadingCity\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isWarehouseOpened, 'is-top': warehouseQueryInputInQueryMode }\" v-if=\"city\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openWarehouse\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingWarehouse }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryWarehouse\" @focus=\"focusWarehouse\" placeholder=\"Введите номер отделения или адрес\" autocomplete=\"chrome-off\" v-show=\"warehouseQueryInputInQueryMode\" ref=\"warehouseQueryInput\" />\n <!-- <label class=\"label\" v-show=\"warehouseQueryInputInQueryMode\">Отделение</label> -->\n <input type=\"text\" class=\"input\" :value=\"warehouse ? warehouse.name : ''\" @focus=\"focusWarehouse\" placeholder=\" \" v-show=\"!warehouseQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!warehouseQueryInputInQueryMode\">Отделение</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in warehouses\" v-bind:key=\"item.id\" @click=\"chooseWarehouse($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryWarehouse && !warehouses.length && !loadingWarehouse\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n city: item.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n\n close();\n };\n\n const chooseWarehouse = (e, item) => {\n e.stopPropagation();\n\n warehouse.value = item;\n warehouseQueryInputInQueryMode.value = false;\n warehouse.value = item;\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if ((isCityOpened.value || isWarehouseOpened.value) && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.novaposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n action: 'cities'\n })\n .then((response) => {\n cities.value = response.data.cities;\n })\n .finally(() => {\n loadingCity.value = false;\n });\n }, 400);\n }\n });\n\n watch(queryWarehouse, (q) => {\n clearTimeout(typeTimeout);\n\n if (q) {\n loadingWarehouse.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n city: city.value.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n }, 400);\n } else {\n warehouse.value = null;\n warehouses.value = [];\n }\n });\n\n const focusWarehouse = () => {\n isCityOpened.value = false;\n cityQueryInputInQueryMode.value = false;\n\n if (!warehouseQueryInputInQueryMode.value) {\n warehouseQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n warehouseQueryInput.value.value = ' ';\n warehouseQueryInput.value.focus();\n });\n }\n };\n\n const focusCity = () => {\n isWarehouseOpened.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n if (!cityQueryInputInQueryMode.value) {\n cityQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n cityQueryInput.value.value = ' ';\n cityQueryInput.value.focus();\n });\n }\n };\n\n return {\n isCityOpened,\n isWarehouseOpened,\n openCity,\n openWarehouse,\n cities,\n citiesPopular,\n warehouses,\n chooseCity,\n chooseWarehouse,\n queryCity,\n queryWarehouse,\n city,\n warehouse,\n loadingCity,\n loadingWarehouse,\n focusWarehouse,\n focusCity,\n city,\n warehouse,\n cityQueryInput,\n warehouseQueryInput,\n cityQueryInputInQueryMode,\n warehouseQueryInputInQueryMode\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","isCityOpened","ref","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","length","close","window","addEventListener","e","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","then","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","onMouseleave","onClick","_hoisted_2","type","onFocus","placeholder","autocomplete","_createComm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E,YAAYA,SAASA,0BAA7B3D,wBAAhCyD,gCAAS,gBAA0ExB,IAAKjC,EAAK8C,GAAKe,2BAAOF,aAAWc,EAAQzE,uBAAUA,EAAKoE,qBAC1GT,aAAcA,SAAO/B,QAAW+B,6DAAjEF,2BAAAiB,oBAAiFf,iEAI2BA,sBAAxHF,0DAAW,wBAAwCE,6BAA6BA,oCAA+CC,2CAAYD,wCACvIH,kCAAW,mBAAoBK,sCAAOF,wDAClCH,2BAAAmB,GACInB,oDAAW,wBAAwCG,yCAC/CH,8BAAOO,KAAK,aAAa,wEAA4BJ,qBAAiBK,sCAAOL,wDAAgBM,YAAY,oCAAoCC,aAAa,aAAqDpD,IAAI,gDAA9J6C,2BAA0HA,oCAC/KQ,0HACAX,8BAAOO,KAAK,aAAa,QAASnD,MAAO+C,YAAYA,YAAUS,QAAYJ,sCAAOL,wDAAgBM,YAAY,2BAAaN,qDAC3HH,6BAAAoB,EAA8D,4BAAhCjB,oCAC9BkB,UAIZrB,2BAAAsB,GACItB,2BAAAuB,oBACItB,kDAAwCE,uBAAR3D,wBAAhCyD,gCAAS,gBAAkDxB,IAAKjC,EAAK8C,GAAKe,2BAAOF,kBAAgBc,EAAQzE,uBAAUA,EAAKoE,qBACvFT,kBAAmBA,aAAW/B,QAAW+B,kEAA1EF,2BAAAuB,oBAA+FrB"}
|
|
1
|
+
{"version":3,"file":"CheckoutShippingNovaposhtaWarehouse.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.vue?vue&type=template&id=320a4699&lang.js"],"sourcesContent":["<template>\n <div class=\"component novaposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" :placeholder=\"__('shop.order.city_placeholder')\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">{{ __('shop.order.city') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in queryCity ? cities : citiesPopular\" v-bind:key=\"item.id\" @click=\"chooseCity($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryCity && !cities.length && !loadingCity\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isWarehouseOpened, 'is-top': warehouseQueryInputInQueryMode }\" v-if=\"city\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openWarehouse\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingWarehouse }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryWarehouse\" @focus=\"focusWarehouse\" :placeholder=\"__('shop.order.warehouse_placeholder')\" autocomplete=\"chrome-off\" v-show=\"warehouseQueryInputInQueryMode\" ref=\"warehouseQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"warehouse ? warehouse.name : ''\" @focus=\"focusWarehouse\" placeholder=\" \" v-show=\"!warehouseQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!warehouseQueryInputInQueryMode\">{{ __('shop.order.warehouse') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in warehouses\" v-bind:key=\"item.id\" @click=\"chooseWarehouse($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryWarehouse && !warehouses.length && !loadingWarehouse\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n city: item.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n\n close();\n };\n\n const chooseWarehouse = (e, item) => {\n e.stopPropagation();\n\n warehouse.value = item;\n warehouseQueryInputInQueryMode.value = false;\n warehouse.value = item;\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if ((isCityOpened.value || isWarehouseOpened.value) && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.novaposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n action: 'cities'\n })\n .then((response) => {\n cities.value = response.data.cities;\n })\n .finally(() => {\n loadingCity.value = false;\n });\n }, 400);\n }\n });\n\n watch(queryWarehouse, (q) => {\n clearTimeout(typeTimeout);\n\n if (q) {\n loadingWarehouse.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n city: city.value.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n }, 400);\n } else {\n warehouse.value = null;\n warehouses.value = [];\n }\n });\n\n const focusWarehouse = () => {\n isCityOpened.value = false;\n cityQueryInputInQueryMode.value = false;\n\n if (!warehouseQueryInputInQueryMode.value) {\n warehouseQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n warehouseQueryInput.value.value = ' ';\n warehouseQueryInput.value.focus();\n });\n }\n };\n\n const focusCity = () => {\n isWarehouseOpened.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n if (!cityQueryInputInQueryMode.value) {\n cityQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n cityQueryInput.value.value = ' ';\n cityQueryInput.value.focus();\n });\n }\n };\n\n return {\n isCityOpened,\n isWarehouseOpened,\n openCity,\n openWarehouse,\n cities,\n citiesPopular,\n warehouses,\n chooseCity,\n chooseWarehouse,\n queryCity,\n queryWarehouse,\n city,\n warehouse,\n loadingCity,\n loadingWarehouse,\n focusWarehouse,\n focusCity,\n city,\n warehouse,\n cityQueryInput,\n warehouseQueryInput,\n cityQueryInputInQueryMode,\n warehouseQueryInputInQueryMode\n };\n }\n});\n</script>\n","<template>\n <div class=\"component novaposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" :placeholder=\"__('shop.order.city_placeholder')\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">{{ __('shop.order.city') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in queryCity ? cities : citiesPopular\" v-bind:key=\"item.id\" @click=\"chooseCity($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryCity && !cities.length && !loadingCity\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isWarehouseOpened, 'is-top': warehouseQueryInputInQueryMode }\" v-if=\"city\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openWarehouse\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingWarehouse }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryWarehouse\" @focus=\"focusWarehouse\" :placeholder=\"__('shop.order.warehouse_placeholder')\" autocomplete=\"chrome-off\" v-show=\"warehouseQueryInputInQueryMode\" ref=\"warehouseQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"warehouse ? warehouse.name : ''\" @focus=\"focusWarehouse\" placeholder=\" \" v-show=\"!warehouseQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!warehouseQueryInputInQueryMode\">{{ __('shop.order.warehouse') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in warehouses\" v-bind:key=\"item.id\" @click=\"chooseWarehouse($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryWarehouse && !warehouses.length && !loadingWarehouse\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n city: item.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n\n close();\n };\n\n const chooseWarehouse = (e, item) => {\n e.stopPropagation();\n\n warehouse.value = item;\n warehouseQueryInputInQueryMode.value = false;\n warehouse.value = item;\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if ((isCityOpened.value || isWarehouseOpened.value) && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.novaposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n action: 'cities'\n })\n .then((response) => {\n cities.value = response.data.cities;\n })\n .finally(() => {\n loadingCity.value = false;\n });\n }, 400);\n }\n });\n\n watch(queryWarehouse, (q) => {\n clearTimeout(typeTimeout);\n\n if (q) {\n loadingWarehouse.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n city: city.value.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n }, 400);\n } else {\n warehouse.value = null;\n warehouses.value = [];\n }\n });\n\n const focusWarehouse = () => {\n isCityOpened.value = false;\n cityQueryInputInQueryMode.value = false;\n\n if (!warehouseQueryInputInQueryMode.value) {\n warehouseQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n warehouseQueryInput.value.value = ' ';\n warehouseQueryInput.value.focus();\n });\n }\n };\n\n const focusCity = () => {\n isWarehouseOpened.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n if (!cityQueryInputInQueryMode.value) {\n cityQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n cityQueryInput.value.value = ' ';\n cityQueryInput.value.focus();\n });\n }\n };\n\n return {\n isCityOpened,\n isWarehouseOpened,\n openCity,\n openWarehouse,\n cities,\n citiesPopular,\n warehouses,\n chooseCity,\n chooseWarehouse,\n queryCity,\n queryWarehouse,\n city,\n warehouse,\n loadingCity,\n loadingWarehouse,\n focusWarehouse,\n focusCity,\n city,\n warehouse,\n cityQueryInput,\n warehouseQueryInput,\n cityQueryInputInQueryMode,\n warehouseQueryInputInQueryMode\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","isCityOpened","ref","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","length","close","window","addEventListener","e","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","then","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","onMouseleave","onClick","_hoisted_2","type","onFocus","placeholder","autocomplete","name","_hoisted_5","_hoisted_6","_hoisted_7","$event","_hoisted_9","_hoisted_10","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_17"],"mappings":"0JA2CA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SA8CEO,EA7CEC,EAAOC,WAAS,CAClBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMH,KAAO,MAE5EI,aAAIJ,OACMP,EAAO,CACTO,KAAMA,GAGVR,EAAMI,OAAOJ,EAAMG,KAAKQ,KAAMV,EAAMY,EAAQZ,OAI9Ca,EAAYL,WAAS,CACvBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMG,UAAY,MAEjFF,aAAIE,OACMb,EAAO,CACTO,KAAMA,EAAKO,MACXD,UAAWA,GAGfd,EAAMI,OAAOJ,EAAMG,KAAKQ,KAAMV,EAAMY,EAAQZ,OAI9CY,EAAU,SAACZ,YACHA,EAAKO,OAAQP,EAAKa,YAG1BE,EAAeC,OAAI,GACnBC,EAAoBD,OAAI,GACxBE,EAAYF,MAAI,IAChBG,EAAiBH,MAAI,IACrBI,EAASJ,MAAI,IACbK,EAAgBL,MAAI,IACpBM,EAAaN,MAAI,IACjBO,EAAiBP,MAAI,MACrBQ,EAAsBR,MAAI,MAC1BS,EAAcT,OAAI,GAClBU,EAAmBV,OAAI,GACvBW,EAA4BX,OAAI,GAChCY,EAAiCZ,OAAI,GAI3Ca,aAAU,WACF9B,EAAMG,KAAKF,MAAQD,EAAMG,KAAKF,KAAK8B,SACnCT,EAAcP,MAAQf,EAAMG,KAAKF,aAYnC+B,EAAQ,WACVhB,EAAaD,OAAQ,EACrBG,EAA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