@perevorot/shop 2.0.84 → 2.0.86
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/order/Checkout.js +1 -1
- package/dist/components/shop/order/Checkout.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/dist/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.js.map +1 -1
- package/dist/components/shop/order/shipping/OtherRecipient.js +1 -1
- package/dist/components/shop/order/shipping/OtherRecipient.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,r,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,l(t))}}),a=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,l(t))}}),i=e.ref(null),l=function(e){return!(!e.city||!e.warehouse)},c=e.inject("shippingComponentValid"),s=e.inject("shippingComponentUserData");c.value=(
|
|
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,r,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,l(t))}}),a=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,l(t))}}),i=e.ref(null),l=function(e){return!(!e.city||!e.warehouse)},c=e.inject("shippingComponentValid"),s=e.inject("shippingComponentUserData"),d=e.ref(!1),p=e.ref(!1),v=e.ref(""),h=e.ref(""),y=e.ref([]),f=e.ref([]),m=e.ref([]),w=e.ref(null),g=e.ref(null),k=e.ref(!1),C=e.ref(!1),E=e.ref(!1),V=e.ref(!1);e.onMounted((function(){var e;c.value=(e=function(){var e=!1;return function(e,t){var o=e();return o&&o.then?o.then(t):t(o)}((function(){var t,n,r,l;if(null!==(t=o.item.params)&&void 0!==t&&t.is_other_recipient)return n=i.value.isValid(),r=function(t){t&&(s.value=i.value.getValue());var o=!!(u.value&&a.value&&t);return e=!0,o},l?r?r(n):n:(n&&n.then||(n=Promise.resolve(n)),r?n.then(r):n)}),(function(t){return e?t:!(!u.value||!a.value)}))},function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}),o.item.data&&o.item.data.length&&(f.value=o.item.data)}));var N=function(){d.value=!1,p.value=!1,E.value=!1,V.value=!1};window.addEventListener("keyup",(function(e){(d.value||p.value)&&"Escape"===e.key&&N()})),window.addEventListener("click",(function(e){e.target.closest(".dropdown")||N()})),e.watch(v,(function(e){clearTimeout(r),u.value=null,e&&(k.value=!0,r=setTimeout((function(){$http.post($ziggy("api.delivery-nova-poshta"),{q:e,action:"cities"}).then((function(e){y.value=e.data.cities})).finally((function(){k.value=!1}))}),400))})),e.watch(h,(function(e){clearTimeout(r),e?(C.value=!0,r=setTimeout((function(){$http.post($ziggy("api.delivery-nova-poshta"),{q:e,city:u.value.id,action:"warehouses"}).then((function(e){m.value=e.data.warehouses})).finally((function(){C.value=!1}))}),400)):(a.value=null,m.value=[])}));return t(n={isCityOpened:d,isWarehouseOpened:p,openCity:function(){d.value=!0},openWarehouse:function(){p.value=!0},cities:y,citiesPopular:f,warehouses:m,chooseCity:function(e,t){e.stopPropagation(),u.value=t,m.value=[],h.value="",E.value=!1,$http.post($ziggy("api.delivery-nova-poshta"),{city:t.id,action:"warehouses"}).then((function(e){m.value=e.data.warehouses})).finally((function(){C.value=!1})),N()},chooseWarehouse:function(e,t){e.stopPropagation(),a.value=t,V.value=!1,a.value=t,N()},queryCity:v,queryWarehouse:h,city:u,warehouse:a,loadingCity:k,loadingWarehouse:C,focusWarehouse:function(){d.value=!1,E.value=!1,V.value||(V.value=!0,e.nextTick((function(){g.value.value=" ",g.value.focus()})))},focusCity:function(){p.value=!1,V.value=!1,E.value||(E.value=!0,e.nextTick((function(){w.value.value=" ",w.value.focus()})))}},"city",u),t(n,"warehouse",a),t(n,"cityQueryInput",w),t(n,"warehouseQueryInput",g),t(n,"cityQueryInputInQueryMode",E),t(n,"warehouseQueryInputInQueryMode",V),t(n,"userForm",i),n}}),n={class:"component novaposhta-wrapper"},r={class:"user-form"},u=["placeholder"],a=["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"},v=["placeholder"],h=["value"],y=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){var N,I=e.resolveComponent("checkout-shipping-other-recipient");return e.openBlock(),e.createElementBlock("div",n,[null!==(N=t.item.params)&&void 0!==N&&N.is_other_recipient?(e.openBlock(),e.createBlock(I,{key:0,ref:"userForm"},null,512)):e.createCommentVNode("v-if",!0),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",r,[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,a),[[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:1,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,v),[[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,h),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("label",{class:"label"},e.toDisplayString(t.__("shop.order.warehouse")),513),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),y],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=9c4b7f90&lang.js"],"sourcesContent":["<template>\n <div class=\"component novaposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\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('.dropdown')) {\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 userForm,\n };\n }\n});\n</script>\n","<template>\n <div class=\"component novaposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\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('.dropdown')) {\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 userForm,\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","f","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","params","_props$item$params","is_other_recipient","valid","getValue","then","args","i","arguments","length","Promise","resolve","reject","e","typeTimeout","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","close","window","addEventListener","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","_ctx$item$params","_createBlock","onMouseleave","onClick","_hoisted_2","type","onFocus","placeholder","autocomplete","name","_hoisted_5","_hoisted_6","_hoisted_7","$event","_hoisted_9","_hoisted_10","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EAAKqF,qBACvFV,kBAAmBA,aAAWhD,QAAWgD,kEAA1EF,2BAAAsB,oBAA+FpB"}
|
|
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=e1c6b6d8&lang.js"],"sourcesContent":["<template>\n <div class=\"component novaposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\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 shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n\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('.dropdown')) {\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 userForm,\n };\n }\n});\n</script>\n","<template>\n <div class=\"component novaposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\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 shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n\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('.dropdown')) {\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 userForm,\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","params","_props$item$params","is_other_recipient","valid","getValue","then","reject","e","length","close","window","addEventListener","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","_ctx$item$params","_createBlock","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":"0JAgDA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SAmDEO,EAlDEC,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,OAI9Ce,EAAWC,MAAI,MAEfJ,EAAU,SAACZ,YACHA,EAAKO,OAAQP,EAAKa,YAG1BI,EAAyBC,SAAO,0BAChCC,EAA4BD,SAAO,6BAEnCE,EAAeJ,OAAI,GACnBK,EAAoBL,OAAI,GACxBM,EAAYN,MAAI,IAChBO,EAAiBP,MAAI,IACrBQ,EAASR,MAAI,IACbS,EAAgBT,MAAI,IACpBU,EAAaV,MAAI,IACjBW,EAAiBX,MAAI,MACrBY,EAAsBZ,MAAI,MAC1Ba,EAAcb,OAAI,GAClBc,EAAmBd,OAAI,GACvBe,EAA4Bf,OAAI,GAChCgB,EAAiChB,OAAI,GAI3CiB,aAAU,iBACNhB,EAAuBH,kIACff,EAAMG,KAAKgC,qBAAXC,EA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AgBc,EAAQnF,uBAAUA,EAAK+E,qBACvFV,kBAAmBA,aAAW7B,QAAW6B,kEAA1EF,2BAAAsB,oBAA+FpB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@perevorot/shop/dist/helpers"),t=require("vue")
|
|
1
|
+
"use strict";var e=require("@perevorot/shop/dist/helpers"),t=require("vue");var n=t.defineComponent({props:{data:Object,item:Object,commit:Function},setup:function(n){var o=t.computed((function(){return n.item.data.find((function(e){return e.id==i.value}))})),c=function(e){return!n.item.data.length||!!e},l=t.inject("shippingComponentValid"),r=t.inject("shippingComponentUserData");t.onMounted((function(){var e;l.value=(e=function(){return!!i.value},function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}),r.value={},o.value||n.commit(n.item.code,{},c())}));var i=t.computed({get:function(){return n.data[n.item.code]?n.data[n.item.code].id:null},set:function(e){n.commit(n.item.code,{id:e},c(e))}}),a=t.ref(!1),s=function(){a.value=!1};return window.addEventListener("keyup",(function(e){a.value&&"Escape"===e.key&&s()})),window.addEventListener("click",(function(e){e.target.closest(".pickup-wrapper")||s()})),{selected:o,isOpened:a,open:function(){a.value=!0},choose:function(e,t){e.stopPropagation(),setTimeout((function(){i.value=t.id}),200),s()},close:s,pickup:i,nl2p:e.nl2p}}}),o={key:0,class:"component pickup-wrapper"},c={key:0,class:"label"},l=["textContent"],r=t.createElementVNode("svg",null,[t.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),i={class:"dropdown-menu"},a={class:"dropdown-content"},s=["onClick"],d={key:1,class:"data"},p={class:"columns is-gapless"},m={class:"column"},u={class:"data-wrapper"},v={key:0,class:"hours"},k=t.createElementVNode("svg",null,[t.createElementVNode("use",{"xlink:href":"#hours"})],-1),f=["innerHTML"],E={key:1,class:"map"},h=["href"],g=["innerHTML"],V={key:0,class:"column is-4"},N={class:"image"},y=["src"];n.render=function(e,n,B,C,w,_){return e.item.data.length?(t.openBlock(),t.createElementBlock("div",o,[e.__("shop.order.pickup_label")?(t.openBlock(),t.createElementBlock("div",c,t.toDisplayString(e.__("shop.order.pickup_label")),1)):t.createCommentVNode("v-if",!0),t.createElementVNode("div",{class:t.normalizeClass(["dropdown",{"is-active":e.isOpened}]),onMouseleave:n[1]||(n[1]=function(){return e.close&&e.close.apply(e,arguments)})},[t.createElementVNode("div",{class:"input dropdown-trigger",onClick:n[0]||(n[0]=function(){return e.open&&e.open.apply(e,arguments)})},[t.createElementVNode("span",{class:t.normalizeClass({"is-placeholder":!e.selected}),textContent:t.toDisplayString(e.selected?e.selected.name:e.__("shop.order.pickup"))},null,10,l),r]),t.createElementVNode("div",i,[t.createElementVNode("div",a,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.data,(function(n){return t.openBlock(),t.createElementBlock("a",{class:t.normalizeClass(["dropdown-item",{"is-active":e.selected&&n.id==e.selected.id}]),key:n.id,onClick:function(t){return e.choose(t,n)}},t.toDisplayString(n.name),11,s)})),128))])])],34),e.selected&&(e.selected.hours||e.selected.map_url||e.selected.description||e.selected.image)?(t.openBlock(),t.createElementBlock("div",d,[t.createElementVNode("div",p,[t.createElementVNode("div",m,[t.createElementVNode("div",u,[e.selected.hours?(t.openBlock(),t.createElementBlock("div",v,[k,t.createElementVNode("span",{innerHTML:e.selected.hours},null,8,f)])):t.createCommentVNode("v-if",!0),e.selected.map_url?(t.openBlock(),t.createElementBlock("div",E,[t.createElementVNode("a",{href:e.selected.map_url,target:"_blank",rel:"noopener"},t.toDisplayString(e.__("shop.order.map")),9,h)])):t.createCommentVNode("v-if",!0),e.selected.description?(t.openBlock(),t.createElementBlock("div",{key:2,class:"info",innerHTML:e.nl2p(e.selected.description)},null,8,g)):t.createCommentVNode("v-if",!0)])]),e.selected.image?(t.openBlock(),t.createElementBlock("div",V,[t.createElementVNode("div",N,[t.createElementVNode("img",{src:e.selected.image},null,8,y)])])):t.createCommentVNode("v-if",!0)])])):t.createCommentVNode("v-if",!0)])):t.createCommentVNode("v-if",!0)},module.exports=n;
|
|
2
2
|
//# sourceMappingURL=CheckoutShippingPickup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutShippingPickup.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue?vue&type=template&id=f18382ec&lang.js"],"sourcesContent":["<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n onMounted(() => {\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n","<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n onMounted(() => {\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","selected","computed","find","id","pickup","value","isValid","length","onMounted","code","get","set","isOpened","ref","close","window","addEventListener","e","key","target","closest","open","choose","option","stopPropagation","setTimeout","nl2p","_createElementVNode","_ctx","_createElementBlock","_hoisted_1","_hoisted_2","onMouseleave","onClick","_toDisplayString","name","_hoisted_4","_hoisted_5","_hoisted_6","$event","hours","map_url","description","image","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","innerHTML","_hoisted_15","href","rel","_hoisted_18","_hoisted_19","src"],"mappings":"8EA6CeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,OACIO,EAAWC,YAAS,kBACfR,EAAMG,KAAKF,KAAKQ,MAAK,SAACN,UAASA,EAAKO,IAAMC,EAAOC,YAGtDC,EAAU,SAACH,UACRV,EAAMG,KAAKF,KAAKa,UAGRJ,GAIjBK,aAAU,WACDR,EAASK,OACVZ,EAAMI,OAAOJ,EAAMG,KAAKa,KAAM,GAAIH,YAIpCF,EAASH,WAAS,CACpBS,sBACWjB,EAAMC,KAAKD,EAAMG,KAAKa,MAAQhB,EAAMC,KAAKD,EAAMG,KAAKa,MAAMN,GAAK,MAE1EQ,aAAIR,GACAV,EAAMI,OACFJ,EAAMG,KAAKa,KACX,CACIN,GAAIA,GAERG,EAAQH,OAKdS,EAAWC,OAAI,GAMfC,EAAQ,WACVF,EAASP,OAAQ,UAarBU,OAAOC,iBAAiB,SAAS,SAACC,GAC1BL,EAASP,OAAmB,WAAVY,EAAEC,KACpBJ,OAIRC,OAAOC,iBAAiB,SAAS,SAACC,GACzBA,EAAEE,OAAOC,QAAQ,oBAClBN,OAID,CACHd,SAAAA,EACAY,SAAAA,EACAS,KAjCS,WACTT,EAASP,OAAQ,GAiCjBiB,OA1BW,SAACL,EAAGM,GACfN,EAAEO,kBAEFC,YAAW,WACPrB,EAAOC,MAAQkB,EAAOpB,KACvB,KAEHW,KAoBAA,MAAAA,EACAV,OAAAA,EACAsB,KAAAA,0BC3HG,2CACI,6BAIHC,iCACIA,yCAAgB,8BAGb,0BACI,iDAKR,iBACI,+BACI,mBACI,+BAC0B,WAC7BA,iCACIA,yCAAgB,+CAIW,iDAMhC,wBACI,yDAhCiBC,OAAKlC,KAAKa,sBAAtDsB,2BAAAC,GAC6BF,+CAAzBC,2BAAAE,oBAA2DH,qEAC3DD,oDAAW,wBAAwCC,cAAaI,2CAAYJ,wCACxED,kCAAW,yBAA0BM,sCAAOL,sCACxCD,uEAAyCC,yBAAYM,kBAAQN,WAAWA,WAASO,KAAOP,uCACxFQ,IAIJT,2BAAAU,GACIV,2BAAAW,oBACIT,kDAA0CD,OAAKlC,eAAf6B,wBAAhCM,kDAAS,6BAAgID,YAAYL,EAAOpB,IAAMyB,WAASzB,MAA/Ge,IAAKK,EAAOpB,GAAK8B,2BAAOL,SAAOW,EAAQhB,uBAAiFA,EAAOY,8BAI/KP,aAAaA,WAASY,OAASZ,WAASa,SAAWb,WAASc,aAAed,WAASe,sBAA5Gd,2BAAAe,GACIjB,2BAAAkB,GACIlB,2BAAAmB,GACInB,2BAAAoB,GACenB,WAASY,qBAApBX,2BAAAmB,GACIC,EAGAtB,6BAAMuB,UAAQtB,WAASY,oDAEhBZ,WAASa,uBAApBZ,2BAAAsB,GACIxB,0BAAIyB,KAAMxB,WAASa,QAAStB,OAAO,SAASkC,IAAI,8BAAczB,gEAEvDA,WAASc,2BAApBb,wCAAuC,OAAOqB,UAAQtB,OAAKA,WAASc,6DAG7Cd,WAASe,qBAAxCd,2BAAAyB,GACI3B,2BAAA4B,GACI5B,4BAAM6B,IAAK5B,WAASe"}
|
|
1
|
+
{"version":3,"file":"CheckoutShippingPickup.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue?vue&type=template&id=4c66cc4f&lang.js"],"sourcesContent":["<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n return !!(pickup.value);\n };\n\n shippingComponentUserData.value = {};\n\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n","<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n return !!(pickup.value);\n };\n\n shippingComponentUserData.value = {};\n\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","selected","computed","find","id","pickup","value","isValid","length","shippingComponentValid","inject","shippingComponentUserData","onMounted","i","arguments","e","code","get","set","isOpened","ref","close","window","addEventListener","key","target","closest","open","choose","option","stopPropagation","setTimeout","nl2p","_createElementVNode","_ctx","_createElementBlock","_hoisted_1","_hoisted_2","onMouseleave","onClick","_toDisplayString","name","_hoisted_4","_hoisted_5","_hoisted_6","$event","hours","map_url","description","image","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","innerHTML","_hoisted_15","href","rel","_hoisted_18","_hoisted_19","src"],"mappings":"4EA6CA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,OACIO,EAAWC,YAAS,kBACfR,EAAMG,KAAKF,KAAKQ,MAAK,SAACN,UAASA,EAAKO,IAAMC,EAAOC,YAGtDC,EAAU,SAACH,UACRV,EAAMG,KAAKF,KAAKa,UAGRJ,GAIXK,EAAyBC,SAAO,0BAChCC,EAA4BD,SAAO,6BAEzCE,aAAU,iBACNH,EAAuBH,4BACTD,EAAOC,OA2CzB,qDAEAO,GAAKC,UAAUD,qDAIbE,+BA9CEJ,EAA0BL,MAAQ,GAE7BL,EAASK,OACVZ,EAAMI,OAAOJ,EAAMG,KAAKmB,KAAM,GAAIT,YAIpCF,EAASH,WAAS,CACpBe,sBACWvB,EAAMC,KAAKD,EAAMG,KAAKmB,MAAQtB,EAAMC,KAAKD,EAAMG,KAAKmB,MAAMZ,GAAK,MAE1Ec,aAAId,GACAV,EAAMI,OACFJ,EAAMG,KAAKmB,KACX,CACIZ,GAAIA,GAERG,EAAQH,OAKde,EAAWC,OAAI,GAMfC,EAAQ,WACVF,EAASb,OAAQ,UAarB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ApBb,wCAAuC,OAAOqB,UAAQtB,OAAKA,WAASc,6DAG7Cd,WAASe,qBAAxCd,2BAAAyB,GACI3B,2BAAA4B,GACI5B,4BAAM6B,IAAK5B,WAASe"}
|
|
@@ -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,r,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,l(t))}}),a=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,l(t))}}),i=e.ref(null),l=function(e){return!(!e.city||!e.warehouse)},c=e.inject("shippingComponentValid"),s=e.inject("shippingComponentUserData");c.value=(
|
|
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,r,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,l(t))}}),a=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,l(t))}}),i=e.ref(null),l=function(e){return!(!e.city||!e.warehouse)},c=e.inject("shippingComponentValid"),s=e.inject("shippingComponentUserData"),d=e.ref(!1),p=e.ref(!1),v=e.ref(""),h=e.ref(""),y=e.ref([]),f=e.ref([]),m=e.ref([]),w=e.ref(null),k=e.ref(null),g=e.ref(!1),C=e.ref(!1),E=e.ref(!1),V=e.ref(!1);e.onMounted((function(){var e;o.item.data&&o.item.data.length&&(f.value=o.item.data),c.value=(e=function(){var e=!1;return function(e,t){var o=e();return o&&o.then?o.then(t):t(o)}((function(){var t,n,r,l;if(null!==(t=o.item.params)&&void 0!==t&&t.is_other_recipient)return n=i.value.isValid(),r=function(t){t&&(s.value=i.value.getValue());var o=!!(u.value&&a.value&&t);return e=!0,o},l?r?r(n):n:(n&&n.then||(n=Promise.resolve(n)),r?n.then(r):n)}),(function(t){return e?t:!(!u.value||!a.value)}))},function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}})}));var N=function(){d.value=!1,p.value=!1,E.value=!1,V.value=!1};window.addEventListener("keyup",(function(e){(d.value||p.value)&&"Escape"===e.key&&N()})),window.addEventListener("click",(function(e){e.target.closest(".dropdown")||N()})),e.watch(v,(function(e){clearTimeout(r),u.value=null,e&&(g.value=!0,r=setTimeout((function(){$http.post($ziggy("api.delivery-ukr-poshta"),{q:e,action:"cities"}).then((function(e){y.value=e.data.cities})).finally((function(){g.value=!1}))}),400))})),e.watch(h,(function(e){clearTimeout(r),e?(C.value=!0,r=setTimeout((function(){$http.post($ziggy("api.delivery-ukr-poshta"),{q:e,city:u.value.id,action:"warehouses"}).then((function(e){m.value=e.data.warehouses})).finally((function(){C.value=!1}))}),400)):(a.value=null,m.value=[])}));return t(n={isCityOpened:d,isWarehouseOpened:p,openCity:function(){d.value=!0},openWarehouse:function(){p.value=!0},cities:y,citiesPopular:f,warehouses:m,chooseCity:function(e,t){e.stopPropagation(),u.value=t,m.value=[],h.value="",E.value=!1,$http.post($ziggy("api.delivery-ukr-poshta"),{city:t.id,action:"warehouses"}).then((function(e){m.value=e.data.warehouses})).finally((function(){C.value=!1})),N()},chooseWarehouse:function(e,t){e.stopPropagation(),a.value=t,V.value=!1,a.value=t,N()},queryCity:v,queryWarehouse:h,city:u,warehouse:a,loadingCity:g,loadingWarehouse:C,focusWarehouse:function(){d.value=!1,E.value=!1,V.value||(V.value=!0,e.nextTick((function(){k.value.value=" ",k.value.focus()})))},focusCity:function(){p.value=!1,V.value=!1,E.value||(E.value=!0,e.nextTick((function(){w.value.value=" ",w.value.focus()})))}},"city",u),t(n,"warehouse",a),t(n,"cityQueryInput",w),t(n,"warehouseQueryInput",k),t(n,"cityQueryInputInQueryMode",E),t(n,"warehouseQueryInputInQueryMode",V),t(n,"userForm",i),n}}),n={class:"component ukrposhta-wrapper"},r={class:"user-form"},u=["placeholder"],a=["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"},v=["placeholder"],h=["value"],y=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),f={class:"dropdown-menu"},m={class:"dropdown-content"},w=["onClick"],k={key:0,class:"dropdown-item"};o.render=function(t,o,g,C,E,V){var N,I=e.resolveComponent("checkout-shipping-other-recipient");return e.openBlock(),e.createElementBlock("div",n,[null!==(N=t.item.params)&&void 0!==N&&N.is_other_recipient?(e.openBlock(),e.createBlock(I,{key:0,ref:"userForm"},null,512)):e.createCommentVNode("v-if",!0),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",r,[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,a),[[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:1,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,v),[[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,h),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("label",{class:"label"},e.toDisplayString(t.__("shop.order.warehouse")),513),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),y],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",k,e.toDisplayString(t.__("shop.checkout.shipment.warehouse.not_found")),1))])])],34)):e.createCommentVNode("v-if",!0)])},module.exports=o;
|
|
2
2
|
//# sourceMappingURL=CheckoutShippingUkrposhtaWarehouse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutShippingUkrposhtaWarehouse.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.vue?vue&type=template&id=346d3c1a&lang.js"],"sourcesContent":["<template>\n <div class=\"component ukrposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\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-ukr-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('.dropdown')) {\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-ukr-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-ukr-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 userForm,\n };\n }\n});\n</script>\n","<template>\n <div class=\"component ukrposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\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-ukr-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('.dropdown')) {\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-ukr-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-ukr-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 userForm,\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","f","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","params","_props$item$params","is_other_recipient","valid","getValue","then","args","i","arguments","length","Promise","resolve","reject","e","typeTimeout","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","close","window","addEventListener","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","_ctx$item$params","_createBlock","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":"0JAgDA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SA6DaO,EA5DTC,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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W,UAMZd,2BAAAe,GACIf,2BAAAgB,oBACIf,kDAAwCE,YAAYA,SAASA,0BAA7B3E,wBAAhCyE,gCAAS,gBAA0EvB,IAAKlD,EAAK8D,GAAKiB,2BAAOJ,aAAWc,EAAQzF,uBAAUA,EAAKqF,qBAC1GV,aAAcA,SAAOhD,QAAWgD,6DAAjEF,2BAAAiB,oBAAiFf,iEAI2BA,sBAAxHF,0DAAW,wBAAwCE,6BAA6BA,oCAA+CG,2CAAYH,wCACvIH,kCAAW,mBAAoBO,sCAAOJ,wDAClCH,2BAAAmB,GACInB,oDAAW,wBAAwCG,yCAC/CH,8BAAOS,KAAK,aAAa,wEAA4BN,qBAAiBO,sCAAOP,wDAAiBQ,YAAaR,yCAAwCS,aAAa,aAAqDtE,IAAI,iDAApK6D,2BAAgIA,qDACrLH,8BAAOS,KAAK,aAAa,QAASrE,MAAO+D,YAAYA,YAAUU,QAAYH,sCAAOP,wDAAgBQ,YAAY,2BAAaR,qDAC3HH,oCAAa,2BAAoDG,8CAAnCA,oCAC9BiB,UAMZpB,2BAAAqB,GACIrB,2BAAAsB,oBACIrB,kDAAwCE,uBAAR3E,wBAAhCyE,gCAAS,gBAAkDvB,IAAKlD,EAAK8D,GAAKiB,2BAAOJ,kBAAgBc,EAAQzF,uBAAUA,EAAKqF,qBACvFV,kBAAmBA,aAAWhD,QAAWgD,kEAA1EF,2BAAAsB,oBAA+FpB"}
|
|
1
|
+
{"version":3,"file":"CheckoutShippingUkrposhtaWarehouse.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.vue?vue&type=template&id=02d899da&lang.js"],"sourcesContent":["<template>\n <div class=\"component ukrposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\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 shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\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-ukr-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('.dropdown')) {\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-ukr-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-ukr-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 userForm,\n };\n }\n});\n</script>\n","<template>\n <div class=\"component ukrposhta-wrapper\">\n <checkout-shipping-other-recipient v-if=\"item.params?.is_other_recipient\" ref=\"userForm\"></checkout-shipping-other-recipient>\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>\n <use xlink:href=\"#arrow-down\"></use>\n </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>\n <use xlink:href=\"#arrow-down\"></use>\n </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, inject } 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 userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\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 shippingComponentValid.value = async () => {\n if (props.item.params?.is_other_recipient) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\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-ukr-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('.dropdown')) {\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-ukr-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-ukr-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 userForm,\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","length","params","_props$item$params","is_other_recipient","valid","getValue","then","i","arguments","reject","e","close","window","addEventListener","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","_ctx$item$params","_createBlock","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":"0JAgDA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SAmDEO,EAlDEC,EAAOC,WAAS,CAClBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMH,KAAO,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sCAAOP,8CAAWQ,YAAY,2BAAaR,gDAC5GH,oCAAa,2BAA+CG,yCAA9BA,+BAC9BW,UAMZd,2BAAAe,GACIf,2BAAAgB,oBACIf,kDAAwCE,YAAYA,SAASA,0BAA7BvE,wBAAhCqE,gCAAS,gBAA0EvB,IAAK9C,EAAK0D,GAAKiB,2BAAOJ,aAAWc,EAAQrF,uBAAUA,EAAKiF,qBAC1GV,aAAcA,SAAOvC,QAAWuC,6DAAjEF,2BAAAiB,oBAAiFf,iEAI2BA,sBAAxHF,0DAAW,wBAAwCE,6BAA6BA,oCAA+CG,2CAAYH,wCACvIH,kCAAW,mBAAoBO,sCAAOJ,wDAClCH,2BAAAmB,GACInB,oDAAW,wBAAwCG,yCAC/CH,8BAAOS,KAAK,aAAa,wEAA4BN,qBAAiBO,sCAAOP,wDAAiBQ,YAAaR,yCAAwCS,aAAa,aAAqDlE,IAAI,iDAApKyD,2BAAgIA,qDACrLH,8BAAOS,KAAK,aAAa,QAASjE,MAAO2D,YAAYA,YAAUU,QAAYH,sCAAOP,wDAAgBQ,YAAY,2BAAaR,qDAC3HH,oCAAa,2BAAoDG,8CAAnCA,oCAC9BiB,UAMZpB,2BAAAqB,GACIrB,2BAAAsB,oBACIrB,kDAAwCE,uBAARvE,wBAAhCqE,gCAAS,gBAAkDvB,IAAK9C,EAAK0D,GAAKiB,2BAAOJ,kBAAgBc,EAAQrF,uBAAUA,EAAKiF,qBACvFV,kBAAmBA,aAAWvC,QAAWuC,kEAA1EF,2BAAAsB,oBAA+FpB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("formvuelate"),r=require("@formvuelate/plugin-vee-validate"),n=require("@perevorot/shop/dist/forms/FormText"),o=require("@perevorot/shop/dist/forms/FormRadio"),a=require("yup");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=i(r),m=i(n),h=i(o),s=u(a);e.markRaw(m.default),e.markRaw(h.default);var p=t.SchemaFormFactory([l.default({})]),c=e.defineComponent({components:{SchemaForm:p},setup:function(){var r,n=e.inject("user"),o=e.inject("field"),a=e.ref(null),i=e.ref(null),u=(r=function(){return i.value.click(),d.isValid(l.value)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(r.apply(this,e))}catch(e){return Promise.reject(e)}}),l=e.ref({type:o("other_type"),name:o("other_name"),last_name:o("other_last_name"),phone_me:o("other_phone_me"),phone_other:o("other_phone_other")}),p=e.ref({type:{component:h.default,model:"type",label:"",list:[{code:"me",value:__("auth.registration.form.user_type_me")},{code:"other",value:__("auth.registration.form.user_type_other")}]},name:{component:m.default,label:__("auth.registration.form.name"),model:"name",condition:function(e){return"other"===e.type}},last_name:{component:m.default,label:__("auth.registration.form.last_name"),model:"last_name",condition:function(e){return"other"===e.type}},phone_me:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_me",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"me"===e.type}},phone_other:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_other",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"other"===e.type}}});t.useSchemaForm(l);var c=/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,d=s.object().shape({name:s.string().when("type",(function(e){if("other"==e)return s.string().trim().required(__("auth.validation.required"))})),last_name:s.string().when("type",(function(e){if("other"==e)return s.string().trim().required(__("auth.validation.required"))})),phone_me:s.string().when("type",(function(e){if("me"==e)return s.string().required(__("auth.validation.phone")).matches(c,__("auth.validation.phone"))})),phone_other:s.string().when("type",(function(e){if("other"==e)return s.string().required(__("auth.validation.phone")).matches(c,__("auth.validation.phone"))}))});return{schema:p,validation:d,user:l,form:a,userSubmitButton:i,isValid:u,getValue:function(){var e=JSON.parse(JSON.stringify(l.value));return"me"==e.type?(e.name=n.value.name,e.last_name=n.value.last_name,e.phone=e.phone_me,delete e.phone_other,delete e.phone_me):(e.phone=e.phone_other,delete e.phone_me,delete e.phone_other),delete e.type,e}}}}),d={class:"auth-user"},f={type:"submit",ref:"userSubmitButton",class:"is-hidden"};c.render=function(t,r,n,o,a,i){var u=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",d,[e.createVNode(u,{schemaRowClasses:"field",schema:t.schema,"validation-schema":t.validation,preventModelCleanupOnSchemaChange:!0,ref:"form"},{afterForm:e.withCtx((function(){return[e.createElementVNode("button",f,null,512)]})),_:1},8,["schema","validation-schema"])])},module.exports=c;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("formvuelate"),r=require("@formvuelate/plugin-vee-validate"),n=require("@perevorot/shop/dist/forms/FormText"),o=require("@perevorot/shop/dist/forms/FormRadio"),a=require("yup");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=i(r),m=i(n),h=i(o),s=u(a);e.markRaw(m.default),e.markRaw(h.default);var p=t.SchemaFormFactory([l.default({})]),c=e.defineComponent({components:{SchemaForm:p},setup:function(){var r,n=e.inject("user"),o=e.inject("field"),a=e.ref(null),i=e.ref(null),u=(r=function(){return i.value.click(),d.isValid(l.value)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(r.apply(this,e))}catch(e){return Promise.reject(e)}}),l=e.ref({type:o("other_type","me"),name:o("other_name",""),last_name:o("other_last_name",""),phone_me:o("other_phone_me",""),phone_other:o("other_phone_other","")}),p=e.ref({type:{component:h.default,model:"type",label:"",list:[{code:"me",value:__("auth.registration.form.user_type_me")},{code:"other",value:__("auth.registration.form.user_type_other")}]},name:{component:m.default,label:__("auth.registration.form.name"),model:"name",condition:function(e){return"other"===e.type}},last_name:{component:m.default,label:__("auth.registration.form.last_name"),model:"last_name",condition:function(e){return"other"===e.type}},phone_me:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_me",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"me"===e.type}},phone_other:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_other",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"other"===e.type}}});t.useSchemaForm(l);var c=/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,d=s.object().shape({name:s.string().when("type",(function(e){if("other"==e)return s.string().trim().required(__("auth.validation.required"))})),last_name:s.string().when("type",(function(e){if("other"==e)return s.string().trim().required(__("auth.validation.required"))})),phone_me:s.string().when("type",(function(e){if("me"==e)return s.string().required(__("auth.validation.phone")).matches(c,__("auth.validation.phone"))})),phone_other:s.string().when("type",(function(e){if("other"==e)return s.string().required(__("auth.validation.phone")).matches(c,__("auth.validation.phone"))}))});return{schema:p,validation:d,user:l,form:a,userSubmitButton:i,isValid:u,getValue:function(){var e=JSON.parse(JSON.stringify(l.value));return"me"==e.type?(e.name=n.value.name,e.last_name=n.value.last_name,e.phone=e.phone_me,delete e.phone_other,delete e.phone_me):(e.phone=e.phone_other,delete e.phone_me,delete e.phone_other),delete e.type,e}}}}),d={class:"auth-user"},f={type:"submit",ref:"userSubmitButton",class:"is-hidden"};c.render=function(t,r,n,o,a,i){var u=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",d,[e.createVNode(u,{schemaRowClasses:"field",schema:t.schema,"validation-schema":t.validation,preventModelCleanupOnSchemaChange:!0,ref:"form"},{afterForm:e.withCtx((function(){return[e.createElementVNode("button",f,null,512)]})),_:1},8,["schema","validation-schema"])])},module.exports=c;
|
|
2
2
|
//# sourceMappingURL=OtherRecipient.js.map
|