@perevorot/shop 2.0.82 → 2.0.84
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/CheckoutShippingUkrposhtaWarehouse.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.js.map +1 -1
- package/dist/components/shop/order/shipping/OtherRecipient.js +2 -0
- package/dist/components/shop/order/shipping/OtherRecipient.js.map +1 -0
- package/dist/helpers.js +1 -1
- package/dist/helpers.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,
|
|
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=(r=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 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)}});var d,p=e.ref(!1),v=e.ref(!1),h=e.ref(""),y=e.ref(""),f=e.ref([]),m=e.ref([]),w=e.ref([]),g=e.ref(null),k=e.ref(null),C=e.ref(!1),E=e.ref(!1),V=e.ref(!1),N=e.ref(!1);e.onMounted((function(){o.item.data&&o.item.data.length&&(m.value=o.item.data)}));var I=function(){p.value=!1,v.value=!1,V.value=!1,N.value=!1};window.addEventListener("keyup",(function(e){(p.value||v.value)&&"Escape"===e.key&&I()})),window.addEventListener("click",(function(e){e.target.closest(".dropdown")||I()})),e.watch(h,(function(e){clearTimeout(d),u.value=null,e&&(C.value=!0,d=setTimeout((function(){$http.post($ziggy("api.delivery-nova-poshta"),{q:e,action:"cities"}).then((function(e){f.value=e.data.cities})).finally((function(){C.value=!1}))}),400))})),e.watch(y,(function(e){clearTimeout(d),e?(E.value=!0,d=setTimeout((function(){$http.post($ziggy("api.delivery-nova-poshta"),{q:e,city:u.value.id,action:"warehouses"}).then((function(e){w.value=e.data.warehouses})).finally((function(){E.value=!1}))}),400)):(a.value=null,w.value=[])}));return t(n={isCityOpened:p,isWarehouseOpened:v,openCity:function(){p.value=!0},openWarehouse:function(){v.value=!0},cities:f,citiesPopular:m,warehouses:w,chooseCity:function(e,t){e.stopPropagation(),u.value=t,w.value=[],y.value="",V.value=!1,$http.post($ziggy("api.delivery-nova-poshta"),{city:t.id,action:"warehouses"}).then((function(e){w.value=e.data.warehouses})).finally((function(){E.value=!1})),I()},chooseWarehouse:function(e,t){e.stopPropagation(),a.value=t,N.value=!1,a.value=t,I()},queryCity:h,queryWarehouse:y,city:u,warehouse:a,loadingCity:C,loadingWarehouse:E,focusWarehouse:function(){p.value=!1,V.value=!1,N.value||(N.value=!0,e.nextTick((function(){k.value.value=" ",k.value.focus()})))},focusCity:function(){v.value=!1,N.value=!1,V.value||(V.value=!0,e.nextTick((function(){g.value.value=" ",g.value.focus()})))}},"city",u),t(n,"warehouse",a),t(n,"cityQueryInput",g),t(n,"warehouseQueryInput",k),t(n,"cityQueryInputInQueryMode",V),t(n,"warehouseQueryInputInQueryMode",N),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=320a4699&lang.js"],"sourcesContent":["<template>\n <div class=\"component novaposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" :placeholder=\"__('shop.order.city_placeholder')\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">{{ __('shop.order.city') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in queryCity ? cities : citiesPopular\" v-bind:key=\"item.id\" @click=\"chooseCity($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryCity && !cities.length && !loadingCity\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isWarehouseOpened, 'is-top': warehouseQueryInputInQueryMode }\" v-if=\"city\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openWarehouse\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingWarehouse }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryWarehouse\" @focus=\"focusWarehouse\" :placeholder=\"__('shop.order.warehouse_placeholder')\" autocomplete=\"chrome-off\" v-show=\"warehouseQueryInputInQueryMode\" ref=\"warehouseQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"warehouse ? warehouse.name : ''\" @focus=\"focusWarehouse\" placeholder=\" \" v-show=\"!warehouseQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!warehouseQueryInputInQueryMode\">{{ __('shop.order.warehouse') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in warehouses\" v-bind:key=\"item.id\" @click=\"chooseWarehouse($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryWarehouse && !warehouses.length && !loadingWarehouse\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n city: item.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n\n close();\n };\n\n const chooseWarehouse = (e, item) => {\n e.stopPropagation();\n\n warehouse.value = item;\n warehouseQueryInputInQueryMode.value = false;\n warehouse.value = item;\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if ((isCityOpened.value || isWarehouseOpened.value) && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.novaposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n action: 'cities'\n })\n .then((response) => {\n cities.value = response.data.cities;\n })\n .finally(() => {\n loadingCity.value = false;\n });\n }, 400);\n }\n });\n\n watch(queryWarehouse, (q) => {\n clearTimeout(typeTimeout);\n\n if (q) {\n loadingWarehouse.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n city: city.value.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n }, 400);\n } else {\n warehouse.value = null;\n warehouses.value = [];\n }\n });\n\n const focusWarehouse = () => {\n isCityOpened.value = false;\n cityQueryInputInQueryMode.value = false;\n\n if (!warehouseQueryInputInQueryMode.value) {\n warehouseQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n warehouseQueryInput.value.value = ' ';\n warehouseQueryInput.value.focus();\n });\n }\n };\n\n const focusCity = () => {\n isWarehouseOpened.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n if (!cityQueryInputInQueryMode.value) {\n cityQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n cityQueryInput.value.value = ' ';\n cityQueryInput.value.focus();\n });\n }\n };\n\n return {\n isCityOpened,\n isWarehouseOpened,\n openCity,\n openWarehouse,\n cities,\n citiesPopular,\n warehouses,\n chooseCity,\n chooseWarehouse,\n queryCity,\n queryWarehouse,\n city,\n warehouse,\n loadingCity,\n loadingWarehouse,\n focusWarehouse,\n focusCity,\n city,\n warehouse,\n cityQueryInput,\n warehouseQueryInput,\n cityQueryInputInQueryMode,\n warehouseQueryInputInQueryMode\n };\n }\n});\n</script>\n","<template>\n <div class=\"component novaposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" :placeholder=\"__('shop.order.city_placeholder')\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">{{ __('shop.order.city') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in queryCity ? cities : citiesPopular\" v-bind:key=\"item.id\" @click=\"chooseCity($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryCity && !cities.length && !loadingCity\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isWarehouseOpened, 'is-top': warehouseQueryInputInQueryMode }\" v-if=\"city\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openWarehouse\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingWarehouse }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryWarehouse\" @focus=\"focusWarehouse\" :placeholder=\"__('shop.order.warehouse_placeholder')\" autocomplete=\"chrome-off\" v-show=\"warehouseQueryInputInQueryMode\" ref=\"warehouseQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"warehouse ? warehouse.name : ''\" @focus=\"focusWarehouse\" placeholder=\" \" v-show=\"!warehouseQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!warehouseQueryInputInQueryMode\">{{ __('shop.order.warehouse') }}</label>\n <svg><use xlink:href=\"#arrow-down\"></use></svg>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"item in warehouses\" v-bind:key=\"item.id\" @click=\"chooseWarehouse($event, item)\">{{ item.name }}</a>\n <div class=\"dropdown-item\" v-if=\"queryWarehouse && !warehouses.length && !loadingWarehouse\">{{ __('shop.checkout.shipment.warehouse.not_found') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n city: item.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n\n close();\n };\n\n const chooseWarehouse = (e, item) => {\n e.stopPropagation();\n\n warehouse.value = item;\n warehouseQueryInputInQueryMode.value = false;\n warehouse.value = item;\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if ((isCityOpened.value || isWarehouseOpened.value) && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.novaposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n action: 'cities'\n })\n .then((response) => {\n cities.value = response.data.cities;\n })\n .finally(() => {\n loadingCity.value = false;\n });\n }, 400);\n }\n });\n\n watch(queryWarehouse, (q) => {\n clearTimeout(typeTimeout);\n\n if (q) {\n loadingWarehouse.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-nova-poshta'), {\n q: q,\n city: city.value.id,\n action: 'warehouses'\n })\n .then((response) => {\n warehouses.value = response.data.warehouses;\n })\n .finally(() => {\n loadingWarehouse.value = false;\n });\n }, 400);\n } else {\n warehouse.value = null;\n warehouses.value = [];\n }\n });\n\n const focusWarehouse = () => {\n isCityOpened.value = false;\n cityQueryInputInQueryMode.value = false;\n\n if (!warehouseQueryInputInQueryMode.value) {\n warehouseQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n warehouseQueryInput.value.value = ' ';\n warehouseQueryInput.value.focus();\n });\n }\n };\n\n const focusCity = () => {\n isWarehouseOpened.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n if (!cityQueryInputInQueryMode.value) {\n cityQueryInputInQueryMode.value = true;\n\n nextTick(() => {\n cityQueryInput.value.value = ' ';\n cityQueryInput.value.focus();\n });\n }\n };\n\n return {\n isCityOpened,\n isWarehouseOpened,\n openCity,\n openWarehouse,\n cities,\n citiesPopular,\n warehouses,\n chooseCity,\n chooseWarehouse,\n queryCity,\n queryWarehouse,\n city,\n warehouse,\n loadingCity,\n loadingWarehouse,\n focusWarehouse,\n focusCity,\n city,\n warehouse,\n cityQueryInput,\n warehouseQueryInput,\n cityQueryInputInQueryMode,\n warehouseQueryInputInQueryMode\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","isCityOpened","ref","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","length","close","window","addEventListener","e","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","then","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","onMouseleave","onClick","_hoisted_2","type","onFocus","placeholder","autocomplete","name","_hoisted_5","_hoisted_6","_hoisted_7","$event","_hoisted_9","_hoisted_10","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_17"],"mappings":"0JA2CA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SA8CEO,EA7CEC,EAAOC,WAAS,CAClBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMH,KAAO,MAE5EI,aAAIJ,OACMP,EAAO,CACTO,KAAMA,GAGVR,EAAMI,OAAOJ,EAAMG,KAAKQ,KAAMV,EAAMY,EAAQZ,OAI9Ca,EAAYL,WAAS,CACvBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMG,UAAY,MAEjFF,aAAIE,OACMb,EAAO,CACTO,KAAMA,EAAKO,MACXD,UAAWA,GAGfd,EAAMI,OAAOJ,EAAMG,KAAKQ,KAAMV,EAAMY,EAAQZ,OAI9CY,EAAU,SAACZ,YACHA,EAAKO,OAAQP,EAAKa,YAG1BE,EAAeC,OAAI,GACnBC,EAAoBD,OAAI,GACxBE,EAAYF,MAAI,IAChBG,EAAiBH,MAAI,IACrBI,EAASJ,MAAI,IACbK,EAAgBL,MAAI,IACpBM,EAAaN,MAAI,IACjBO,EAAiBP,MAAI,MACrBQ,EAAsBR,MAAI,MAC1BS,EAAcT,OAAI,GAClBU,EAAmBV,OAAI,GACvBW,EAA4BX,OAAI,GAChCY,EAAiCZ,OAAI,GAI3Ca,aAAU,WACF9B,EAAMG,KAAKF,MAAQD,EAAMG,KAAKF,KAAK8B,SACnCT,EAAcP,MAAQf,EAAMG,KAAKF,aAYnC+B,EAAQ,WACVhB,EAAaD,OAAQ,EACrBG,EAAkBH,OAAQ,EAE1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GACIb,2BAAAc,oBACIb,kDAAwCE,YAAYA,SAASA,0BAA7B3D,wBAAhCyD,gCAAS,gBAA0ExB,IAAKjC,EAAK8C,GAAKe,2BAAOF,aAAWY,EAAQvE,uBAAUA,EAAKmE,qBAC1GR,aAAcA,SAAO/B,QAAW+B,6DAAjEF,2BAAAe,oBAAiFb,iEAI2BA,sBAAxHF,0DAAW,wBAAwCE,6BAA6BA,oCAA+CC,2CAAYD,wCACvIH,kCAAW,mBAAoBK,sCAAOF,wDAClCH,2BAAAiB,GACIjB,oDAAW,wBAAwCG,yCAC/CH,8BAAOO,KAAK,aAAa,wEAA4BJ,qBAAiBK,sCAAOL,wDAAiBM,YAAaN,yCAAwCO,aAAa,aAAqDpD,IAAI,iDAApK6C,2BAAgIA,qDACrLH,8BAAOO,KAAK,aAAa,QAASnD,MAAO+C,YAAYA,YAAUQ,QAAYH,sCAAOL,wDAAgBM,YAAY,2BAAaN,qDAC3HH,oCAAa,2BAAoDG,8CAAnCA,oCAC9Be,UAIZlB,2BAAAmB,GACInB,2BAAAoB,oBACInB,kDAAwCE,uBAAR3D,wBAAhCyD,gCAAS,gBAAkDxB,IAAKjC,EAAK8C,GAAKe,2BAAOF,kBAAgBY,EAAQvE,uBAAUA,EAAKmE,qBACvFR,kBAAmBA,aAAW/B,QAAW+B,kEAA1EF,2BAAAoB,oBAA+FlB"}
|
|
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","_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,OACM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AiHA,gDACtKH,8BAAOS,KAAK,aAAa,QAASrE,MAAO+D,OAAOA,OAAKU,QAAYH,sCAAOP,8CAAWQ,YAAY,2BAAaR,gDAC5GH,oCAAa,2BAA+CG,yCAA9BA,+BAC9BW,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,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,u
|
|
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=(r=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 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)}});var d,p=e.ref(!1),v=e.ref(!1),h=e.ref(""),y=e.ref(""),f=e.ref([]),m=e.ref([]),w=e.ref([]),k=e.ref(null),g=e.ref(null),C=e.ref(!1),E=e.ref(!1),V=e.ref(!1),N=e.ref(!1);e.onMounted((function(){o.item.data&&o.item.data.length&&(m.value=o.item.data)}));var I=function(){p.value=!1,v.value=!1,V.value=!1,N.value=!1};window.addEventListener("keyup",(function(e){(p.value||v.value)&&"Escape"===e.key&&I()})),window.addEventListener("click",(function(e){e.target.closest(".dropdown")||I()})),e.watch(h,(function(e){clearTimeout(d),u.value=null,e&&(C.value=!0,d=setTimeout((function(){$http.post($ziggy("api.delivery-ukr-poshta"),{q:e,action:"cities"}).then((function(e){f.value=e.data.cities})).finally((function(){C.value=!1}))}),400))})),e.watch(y,(function(e){clearTimeout(d),e?(E.value=!0,d=setTimeout((function(){$http.post($ziggy("api.delivery-ukr-poshta"),{q:e,city:u.value.id,action:"warehouses"}).then((function(e){w.value=e.data.warehouses})).finally((function(){E.value=!1}))}),400)):(a.value=null,w.value=[])}));return t(n={isCityOpened:p,isWarehouseOpened:v,openCity:function(){p.value=!0},openWarehouse:function(){v.value=!0},cities:f,citiesPopular:m,warehouses:w,chooseCity:function(e,t){e.stopPropagation(),u.value=t,w.value=[],y.value="",V.value=!1,$http.post($ziggy("api.delivery-ukr-poshta"),{city:t.id,action:"warehouses"}).then((function(e){w.value=e.data.warehouses})).finally((function(){E.value=!1})),I()},chooseWarehouse:function(e,t){e.stopPropagation(),a.value=t,N.value=!1,a.value=t,I()},queryCity:h,queryWarehouse:y,city:u,warehouse:a,loadingCity:C,loadingWarehouse:E,focusWarehouse:function(){p.value=!1,V.value=!1,N.value||(N.value=!0,e.nextTick((function(){g.value.value=" ",g.value.focus()})))},focusCity:function(){v.value=!1,N.value=!1,V.value||(V.value=!0,e.nextTick((function(){k.value.value=" ",k.value.focus()})))}},"city",u),t(n,"warehouse",a),t(n,"cityQueryInput",k),t(n,"warehouseQueryInput",g),t(n,"cityQueryInputInQueryMode",V),t(n,"warehouseQueryInputInQueryMode",N),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=23041795&lang.js"],"sourcesContent":["<template>\n <div class=\"component ukrposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" :placeholder=\"__('shop.order.city_placeholder')\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">{{ __('shop.order.city') }}</label>\n <svg>\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 } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-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('.ukrposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-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 };\n }\n});\n</script>\n","<template>\n <div class=\"component ukrposhta-wrapper\">\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isCityOpened, 'is-top': cityQueryInputInQueryMode }\" @mouseleave=\"close\">\n <div class=\"dropdown-trigger\" @click=\"openCity\">\n <div class=\"user-form\">\n <div class=\"control\" v-bind:class=\"{ 'is-loading': loadingCity }\">\n <input type=\"text\" class=\"input is-nolabel\" v-model=\"queryCity\" @focus=\"focusCity\" :placeholder=\"__('shop.order.city_placeholder')\" autocomplete=\"chrome-off\" v-show=\"cityQueryInputInQueryMode\" ref=\"cityQueryInput\" />\n <input type=\"text\" class=\"input\" :value=\"city ? city.name : ''\" @focus=\"focusCity\" placeholder=\" \" v-show=\"!cityQueryInputInQueryMode\" />\n <label class=\"label\" v-show=\"!cityQueryInputInQueryMode\">{{ __('shop.order.city') }}</label>\n <svg>\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 } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n };\n\n const chooseCity = (e, item) => {\n e.stopPropagation();\n\n city.value = item;\n //warehouse.value = null;\n warehouses.value = [];\n queryWarehouse.value = '';\n\n cityQueryInputInQueryMode.value = false;\n\n $http\n .post($ziggy('api.delivery-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('.ukrposhta-wrapper')) {\n close();\n }\n });\n\n watch(queryCity, (q) => {\n clearTimeout(typeTimeout);\n city.value = null;\n\n if (q) {\n loadingCity.value = true;\n\n typeTimeout = setTimeout(() => {\n $http\n .post($ziggy('api.delivery-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 };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","isCityOpened","ref","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","onMounted","length","close","window","addEventListener","e","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","then","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","_createElementBlock","_hoisted_1","_ctx","onMouseleave","onClick","_hoisted_2","type","onFocus","placeholder","autocomplete","name","_hoisted_5","_hoisted_6","_hoisted_7","$event","_hoisted_9","_hoisted_10","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_17"],"mappings":"0JA+CA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SA8CEO,EA7CEC,EAAOC,WAAS,CAClBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMH,KAAO,MAE5EI,aAAIJ,OACMP,EAAO,CACTO,KAAMA,GAGVR,EAAMI,OAAOJ,EAAMG,KAAKQ,KAAMV,EAAMY,EAAQZ,OAI9Ca,EAAYL,WAAS,CACvBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMG,UAAY,MAEjFF,aAAIE,OACMb,EAAO,CACTO,KAAMA,EAAKO,MACXD,UAAWA,GAGfd,EAAMI,OAAOJ,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B,IAAKjC,EAAK8C,GAAKe,2BAAOF,kBAAgBY,EAAQvE,uBAAUA,EAAKmE,qBACvFR,kBAAmBA,aAAW/B,QAAW+B,kEAA1EF,2BAAAoB,oBAA+FlB"}
|
|
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,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,6BAEzCD,EAAuBH,OAwBRR,2HAvBPP,EAAMG,KAAKkB,qBAAXC,EAAmBC,4BACCP,EAASD,MAAMF,qBAA7BW,GAEFA,IACAJ,EAA0BL,MAAQC,EAASD,MAAMU,qBAG3CjB,EAAKO,OAASD,EAAUC,OAASS,oBAgClDE,EAAOA,EAAKX,GAASA,uCAKfA,EAAMW,KAAKA,GAAQX,gCAlCZP,EAAKO,QA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AAUU,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"}
|
|
@@ -0,0 +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;
|
|
2
|
+
//# sourceMappingURL=OtherRecipient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OtherRecipient.js","sources":["../../../../../src/components/shop/order/shipping/OtherRecipient.vue","../../../../../src/components/shop/order/shipping/OtherRecipient.vue?vue&type=template&id=7059040b&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-user\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :preventModelCleanupOnSchemaChange=\"true\" ref=\"form\">\n <template #afterForm>\n <button type=\"submit\" ref=\"userSubmitButton\" class=\"is-hidden\"></button>\n </template>\n </SchemaForm>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, markRaw, inject } from 'vue';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\nmarkRaw(FormRadio);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default defineComponent({\n components: {\n SchemaForm,\n },\n setup() {\n const checkoutUser = inject('user');\n const field = inject('field');\n const form = ref(null);\n const userSubmitButton = ref(null);\n\n const isValid = async () => {\n userSubmitButton.value.click();\n\n return await validation.isValid(user.value);\n }\n\n const user = ref({\n type: field('other_type'),\n name: field('other_name'),\n last_name: field('other_last_name'),\n phone_me: field('other_phone_me'),\n phone_other: field('other_phone_other'),\n });\n\n const getValue = () => {\n const raw = JSON.parse(JSON.stringify(user.value));\n\n if (raw.type == 'me') {\n raw.name = checkoutUser.value.name;\n raw.last_name = checkoutUser.value.last_name;\n raw.phone = raw.phone_me;\n\n delete raw.phone_other;\n delete raw.phone_me;\n } else {\n raw.phone = raw.phone_other;\n\n delete raw.phone_me;\n delete raw.phone_other;\n }\n\n delete raw.type;\n\n return raw;\n }\n\n const schema = ref({\n type: {\n component: FormRadio,\n model: 'type',\n label: '',\n list: [\n { code: 'me', value: __('auth.registration.form.user_type_me') },\n { code: 'other', value: __('auth.registration.form.user_type_other') }\n ],\n },\n name: {\n component: FormText,\n label: __('auth.registration.form.name'),\n model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n phone_me: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_me',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'me'\n },\n phone_other: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_other',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'other'\n },\n });\n\n useSchemaForm(user);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n const validation = yup.object().shape({\n name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n last_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n phone_me: yup.string().when('type', (type) => {\n if (type == 'me') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n }),\n phone_other: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n })\n });\n\n return {\n schema,\n validation,\n user,\n form,\n userSubmitButton,\n isValid,\n getValue,\n }\n }\n});\n</script>","<template>\n <div class=\"auth-user\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :preventModelCleanupOnSchemaChange=\"true\" ref=\"form\">\n <template #afterForm>\n <button type=\"submit\" ref=\"userSubmitButton\" class=\"is-hidden\"></button>\n </template>\n </SchemaForm>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, markRaw, inject } from 'vue';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\nmarkRaw(FormRadio);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default defineComponent({\n components: {\n SchemaForm,\n },\n setup() {\n const checkoutUser = inject('user');\n const field = inject('field');\n const form = ref(null);\n const userSubmitButton = ref(null);\n\n const isValid = async () => {\n userSubmitButton.value.click();\n\n return await validation.isValid(user.value);\n }\n\n const user = ref({\n type: field('other_type'),\n name: field('other_name'),\n last_name: field('other_last_name'),\n phone_me: field('other_phone_me'),\n phone_other: field('other_phone_other'),\n });\n\n const getValue = () => {\n const raw = JSON.parse(JSON.stringify(user.value));\n\n if (raw.type == 'me') {\n raw.name = checkoutUser.value.name;\n raw.last_name = checkoutUser.value.last_name;\n raw.phone = raw.phone_me;\n\n delete raw.phone_other;\n delete raw.phone_me;\n } else {\n raw.phone = raw.phone_other;\n\n delete raw.phone_me;\n delete raw.phone_other;\n }\n\n delete raw.type;\n\n return raw;\n }\n\n const schema = ref({\n type: {\n component: FormRadio,\n model: 'type',\n label: '',\n list: [\n { code: 'me', value: __('auth.registration.form.user_type_me') },\n { code: 'other', value: __('auth.registration.form.user_type_other') }\n ],\n },\n name: {\n component: FormText,\n label: __('auth.registration.form.name'),\n model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n phone_me: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_me',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'me'\n },\n phone_other: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_other',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'other'\n },\n });\n\n useSchemaForm(user);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n const validation = yup.object().shape({\n name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n last_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n phone_me: yup.string().when('type', (type) => {\n if (type == 'me') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n }),\n phone_other: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n })\n });\n\n return {\n schema,\n validation,\n user,\n form,\n userSubmitButton,\n isValid,\n getValue,\n }\n }\n});\n</script>"],"names":["markRaw","FormText","FormRadio","SchemaForm","SchemaFormFactory","VeeValidatePlugin","defineComponent","components","setup","f","checkoutUser","inject","field","form","ref","userSubmitButton","isValid","value","click","validation","user","i","resolve","apply","this","reject","e","type","name","last_name","phone_me","phone_other","schema","component","model","label","list","code","__","condition","mask","useSchemaForm","phoneRegExp","yup","object","shape","string","when","trim","required","matches","getValue","raw","JSON","parse","stringify","phone","_createElementBlock","_hoisted_1","_createVNode","schemaRowClasses","_ctx","preventModelCleanupOnSchemaChange","afterForm","_createElementVNode","_hoisted_2"],"mappings":"omBAiBAA,UAAQC,WACRD,UAAQE,WAER,IAAMC,EAAaC,oBAAkB,CAACC,UAAkB,QAEzCC,kBAAgB,CAC3BC,WAAY,CACRJ,WAAAA,GAEJK,qBAqDmBC,EApDTC,EAAeC,SAAO,QACtBC,EAAQD,SAAO,SACfE,EAAOC,MAAI,MACXC,EAAmBD,MAAI,MAEvBE,GA+CSP,oBA9CXM,EAAiBE,MAAMC,QAEVC,EAAWH,QAAQI,EAAKH,6BA8C/B,KAAQ,EAAGI,sCACNA,sBAGLC,UAAUC,MAAMC,iCAEhBC,OAAOC,MAjDXN,EAAON,MAAI,CACba,KAAMf,EAAM,cACZgB,KAAMhB,EAAM,cACZiB,UAAWjB,EAAM,mBACjBkB,SAAUlB,EAAM,kBAChBmB,YAAanB,EAAM,uBAyBjBoB,EAAS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,EACAmC,SAhGa,eACPC,EAAMC,KAAKC,MAAMD,KAAKE,UAAUnC,EAAKH,cAE3B,MAAZmC,EAAIzB,MACJyB,EAAIxB,KAAOlB,EAAaO,MAAMW,KAC9BwB,EAAIvB,UAAYnB,EAAaO,MAAMY,UACnCuB,EAAII,MAAQJ,EAAItB,gBAETsB,EAAIrB,mBACJqB,EAAItB,WAEXsB,EAAII,MAAQJ,EAAIrB,mBAETqB,EAAItB,gBACJsB,EAAIrB,oBAGRqB,EAAIzB,KAEJyB,gBChEJ,gBAGSzB,KAAK,SAASb,IAAI,yBAAyB,wGAH/D2C,2BAAAC,GACIC,iBAAYC,iBAAiB,QAAS5B,OAAQ6B,6BAA4BA,aAAaC,mCAAmC,EAAMhD,IAAI,SACrHiD,qBACP,kBAAAC,8BAAAC"}
|
package/dist/helpers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("vue"),e=require("yup"),t=require("@perevorot/shop/dist/forms/FormCheckbox"),o=require("@perevorot/shop/dist/forms/FormCheckboxes"),n=require("@perevorot/shop/dist/forms/FormPassword"),i=require("@perevorot/shop/dist/forms/FormRadio"),a=require("@perevorot/shop/dist/forms/FormRating"),u=require("@perevorot/shop/dist/forms/FormSection"),s=require("@perevorot/shop/dist/forms/FormSelect"),l=require("@perevorot/shop/dist/forms/FormSwitch"),c=require("@perevorot/shop/dist/forms/FormText"),f=require("@perevorot/shop/dist/forms/FormTextarea");function d(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}function m(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:function(){return r[t]}})}})),e.default=r,Object.freeze(e)}var p=m(e),h=d(t),v=d(o),b=d(n),y=d(i),F=d(a),g=d(u),
|
|
1
|
+
"use strict";var r=require("vue"),e=require("yup"),t=require("@perevorot/shop/dist/forms/FormCheckbox"),o=require("@perevorot/shop/dist/forms/FormCheckboxes"),n=require("@perevorot/shop/dist/forms/FormPassword"),i=require("@perevorot/shop/dist/forms/FormRadio"),a=require("@perevorot/shop/dist/forms/FormRating"),u=require("@perevorot/shop/dist/forms/FormSection"),s=require("@perevorot/shop/dist/forms/FormSelect"),l=require("@perevorot/shop/dist/forms/FormSwitch"),c=require("@perevorot/shop/dist/forms/FormText"),f=require("@perevorot/shop/dist/forms/FormTextarea");function d(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}function m(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:function(){return r[t]}})}})),e.default=r,Object.freeze(e)}var p=m(e),h=d(t),v=d(o),b=d(n),y=d(i),F=d(a),g=d(u),w=d(s),S=d(l),q=d(c),x=d(f);function j(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==t)return;var o,n,i=[],a=!0,u=!1;try{for(t=t.call(r);!(a=(o=t.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(r){u=!0,n=r}finally{try{a||null==t.return||t.return()}finally{if(u)throw n}}return i}(r,e)||k(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(r){return function(r){if(Array.isArray(r))return A(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||k(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(r,e){if(r){if("string"==typeof r)return A(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A(r,e):void 0}}function A(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=r[t];return o}p.addMethod(p.string,"minOrEmpty",(function(r,e){return this.test({name:"minOrEmpty",exclusive:!0,message:e,params:{min:r},test:function(e){return""==e||e.length>=r}})})),p.addMethod(p.string,"numberFilled",(function(r,e){return this.test({name:"numberFilled",exclusive:!0,message:__("auth.validation.number"),params:{min:r},test:function(r){return!(""==r||isNaN(r))}})}));var _={pluralize:function(r,e){return r+" "+e[r%100>4&&r%100<20?2:[2,0,1,1,1,2][Math.min(r%10,5)]]},formParse:function(e){var t={FormCheckbox:h.default,FormCheckboxes:v.default,FormPassword:b.default,FormRadio:y.default,FormRating:F.default,FormSection:g.default,FormSelect:w.default,FormSwitch:S.default,FormText:q.default,FormTextarea:x.default},o={},n={},i={};if(e.form)for(var a=function(){var e=j(s[u],2),a=e[0],l=e[1];if("_"!=a.charAt(0)){var c;switch(l.component){case"FormCheckbox":case"FormSwitch":c=!1;break;case"FormCheckboxes":c=[];break;default:c=""}o[a]=c}var f=t[l.component];r.markRaw(f);var d={component:f,label:l.label,validations:{}};if(l.validation){var m=p;l.validation.forEach((function(r){var e=[],t=r;if(t.split(":").length>1){var o=r.split(":");t=o.shift(),e=JSON.parse(o)}("required"==t&&(d.validations.required=!0),"phone"==t&&d.validations.required)&&(t="matches",e=[l.pattern?new RegExp(l.pattern):/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,__("auth.validation.phone")]);"array"!=t&&e.push(__("auth.validation."+t));try{var n;m=(n=m)[t].apply(n,O(e))}catch(r){}})),i[a]=m}l.condition&&(d.condition=function(r){return r[l.condition[0]]===l.condition[1]},i[a]=p.string().when(l.condition[0],{is:l.condition[1],then:i[a]})),["mask","placeholder","description","type","list","model","store","default","hidden"].forEach((function(r){l[r]&&(d[r]=l[r])})),n[a]=d},u=0,s=Object.entries(e.form);u<s.length;u++)a();return{schema:n,model:o,validation:p.object().shape(i)}},nl2p:function(r){return null==r?"":"<p>"+(r+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1</p><p>$2")+"</p>"}};module.exports=_;
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../src/helpers/modules/formParse.js","../src/helpers/index.js","../src/helpers/modules/pluralize.js","../src/helpers/modules/nl2p.js"],"sourcesContent":["import { markRaw } from 'vue';\nimport * as yup from 'yup';\n\nimport FormCheckbox from '@perevorot/shop/dist/forms/FormCheckbox';\nimport FormCheckboxes from '@perevorot/shop/dist/forms/FormCheckboxes';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport FormRating from '@perevorot/shop/dist/forms/FormRating';\nimport FormSection from '@perevorot/shop/dist/forms/FormSection';\nimport FormSelect from '@perevorot/shop/dist/forms/FormSelect';\nimport FormSwitch from '@perevorot/shop/dist/forms/FormSwitch';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\n\nyup.addMethod(yup.string, 'minOrEmpty', function (min, msg) {\n return this.test({\n name: 'minOrEmpty',\n exclusive: true,\n message: msg,\n params: {\n min: min,\n },\n test: (value) => value == '' || value.length >= min,\n });\n});\n\nyup.addMethod(yup.string, 'numberFilled', function (min, msg) {\n return this.test({\n name: 'numberFilled',\n exclusive: true,\n message: __('auth.validation.number'),\n params: {\n min: min,\n },\n test: (value) => !(value == '' || isNaN(value)),\n });\n});\n\nexport default function formParse(json) {\n let components = {\n FormCheckbox: FormCheckbox,\n FormCheckboxes: FormCheckboxes,\n FormPassword: FormPassword,\n FormRadio: FormRadio,\n FormRating: FormRating,\n FormSection: FormSection,\n FormSelect: FormSelect,\n FormSwitch: FormSwitch,\n FormText: FormText,\n FormTextarea: FormTextarea,\n };\n\n let model = {};\n let schema = {};\n let validation = {};\n\n if (json.form) {\n for (const [field, element] of Object.entries(json.form)) {\n if (field.charAt(0) != '_') {\n let value;\n\n switch (element.component) {\n case 'FormCheckbox':\n case 'FormSwitch':\n value = false;\n break;\n\n case 'FormCheckboxes':\n value = [];\n break;\n default:\n value = '';\n }\n\n model[field] = value;\n }\n\n const component = components[element.component];\n\n markRaw(component);\n\n let s = {\n component: component,\n label: element.label,\n validations: {},\n };\n\n if (element.validation) {\n let v = yup;\n\n const validations = element.validation;\n\n validations.forEach((rule) => {\n let attributes = [];\n let method = rule;\n\n if (method.split(':').length > 1) {\n let ruleWithAttributes = rule.split(':');\n method = ruleWithAttributes.shift();\n\n attributes = JSON.parse(ruleWithAttributes);\n }\n\n if (method == 'required') {\n s.validations.required = true;\n }\n\n if (method == 'phone' && s.validations.required) {\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n method = 'matches';\n\n attributes = [phoneRegExp, __('auth.validation.phone')];\n }\n\n if (method != 'array') {\n attributes.push(__('auth.validation.' + method));\n }\n\n try {\n v = v[method](...attributes);\n } catch (error) {}\n });\n\n validation[field] = v;\n }\n\n if (element.condition) {\n s.condition = (model) => model[element.condition[0]] === element.condition[1];\n\n validation[field] = yup.string().when(element.condition[0], {\n is: element.condition[1],\n then: validation[field],\n });\n }\n\n ['mask', 'placeholder', 'description', 'type', 'list', 'model', 'store', 'default', 'hidden'].forEach((f) => {\n if (element[f]) {\n s[f] = element[f];\n }\n });\n\n schema[field] = s;\n }\n }\n\n return {\n schema: schema,\n model: model,\n validation: yup.object().shape(validation),\n };\n}\n","import pluralize from './modules/pluralize';\nimport formParse from './modules/formParse';\nimport nl2p from './modules/nl2p';\n\nexport default {\n pluralize,\n formParse,\n nl2p,\n};\n","export default function pluralize(count, words) {\n let cases = [2, 0, 1, 1, 1, 2];\n\n return count + ' ' + words[count % 100 > 4 && count % 100 < 20 ? 2 : cases[Math.min(count % 10, 5)]];\n};","export default function nl2p(str) {\n if (typeof str === 'undefined' || str === null) {\n return '';\n }\n\n return '<p>' + (str + '').replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1' + '</p><p>' + '$2') + '</p>';\n}\n"],"names":["yup","addMethod","string","min","msg","this","test","name","exclusive","message","params","value","length","__","isNaN","pluralize","count","words","Math","formParse","json","components","FormCheckbox","FormCheckboxes","FormPassword","FormRadio","FormRating","FormSection","FormSelect","FormSwitch","FormText","FormTextarea","model","schema","validation","form","field","element","charAt","component","markRaw","s","label","validations","v","forEach","rule","attributes","method","split","ruleWithAttributes","shift","JSON","parse","required","push","error","condition","when","is","then","f","Object","entries","object","shape","nl2p","str","replace"],"mappings":"kyEAcAA,EAAIC,UAAUD,EAAIE,OAAQ,cAAc,SAAUC,EAAKC,UAC5CC,KAAKC,KAAK,CACbC,KAAM,aACNC,WAAW,EACXC,QAASL,EACTM,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,SAAmB,IAATA,GAAeA,EAAMC,QAAUT,QAIxDH,EAAIC,UAAUD,EAAIE,OAAQ,gBAAgB,SAAUC,EAAKC,UAC9CC,KAAKC,KAAK,CACbC,KAAM,eACNC,WAAW,EACXC,QAASI,GAAG,0BACZH,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,WAAqB,IAATA,GAAeG,MAAMH,UC9BhD,MAAe,CACXI,UCLW,SAAmBC,EAAOC,UAG9BD,EAAQ,IAAMC,EAAMD,EAAQ,IAAM,GAAKA,EAAQ,IAAM,GAAK,EAFrD,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,GAE+CE,KAAKf,IAAIa,EAAQ,GAAI,MDGhGG,UDgCW,SAAmBC,OAC1BC,EAAa,CACbC,aAAcA,UACdC,eAAgBA,UAChBC,aAAcA,UACdC,UAAWA,UACXC,WAAYA,UACZC,YAAaA,UACbC,WAAYA,UACZC,WAAYA,UACZC,SAAUA,UACVC,aAAcA,WAGdC,EAAQ,GACRC,EAAS,GACTC,EAAa,MAEbd,EAAKe,0CACOC,OAAOC,UACQ,KAAnBD,EAAME,OAAO,GAAW,KACpB3B,SAEI0B,EAAQE,eACP,mBACA,aACD5B,GAAQ,YAGP,iBACDA,EAAQ,iBAGRA,EAAQ,GAGhBqB,EAAMI,GAASzB,MAGb4B,EAAYlB,EAAWgB,EAAQE,WAErCC,UAAQD,OAEJE,EAAI,CACJF,UAAWA,EACXG,MAAOL,EAAQK,MACfC,YAAa,OAGbN,EAAQH,WAAY,KAChBU,EAAI5C,EAEYqC,EAAQH,WAEhBW,SAAQ,SAACC,OACbC,EAAa,GACbC,EAASF,KAETE,EAAOC,MAAM,KAAKrC,OAAS,EAAG,KAC1BsC,EAAqBJ,EAAKG,MAAM,KACpCD,EAASE,EAAmBC,QAE5BJ,EAAaK,KAAKC,MAAMH,
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../src/helpers/modules/formParse.js","../src/helpers/index.js","../src/helpers/modules/pluralize.js","../src/helpers/modules/nl2p.js"],"sourcesContent":["import { markRaw } from 'vue';\nimport * as yup from 'yup';\n\nimport FormCheckbox from '@perevorot/shop/dist/forms/FormCheckbox';\nimport FormCheckboxes from '@perevorot/shop/dist/forms/FormCheckboxes';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport FormRating from '@perevorot/shop/dist/forms/FormRating';\nimport FormSection from '@perevorot/shop/dist/forms/FormSection';\nimport FormSelect from '@perevorot/shop/dist/forms/FormSelect';\nimport FormSwitch from '@perevorot/shop/dist/forms/FormSwitch';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\n\nyup.addMethod(yup.string, 'minOrEmpty', function (min, msg) {\n return this.test({\n name: 'minOrEmpty',\n exclusive: true,\n message: msg,\n params: {\n min: min,\n },\n test: (value) => value == '' || value.length >= min,\n });\n});\n\nyup.addMethod(yup.string, 'numberFilled', function (min, msg) {\n return this.test({\n name: 'numberFilled',\n exclusive: true,\n message: __('auth.validation.number'),\n params: {\n min: min,\n },\n test: (value) => !(value == '' || isNaN(value)),\n });\n});\n\nexport default function formParse(json) {\n let components = {\n FormCheckbox: FormCheckbox,\n FormCheckboxes: FormCheckboxes,\n FormPassword: FormPassword,\n FormRadio: FormRadio,\n FormRating: FormRating,\n FormSection: FormSection,\n FormSelect: FormSelect,\n FormSwitch: FormSwitch,\n FormText: FormText,\n FormTextarea: FormTextarea,\n };\n\n let model = {};\n let schema = {};\n let validation = {};\n\n if (json.form) {\n for (const [field, element] of Object.entries(json.form)) {\n if (field.charAt(0) != '_') {\n let value;\n\n switch (element.component) {\n case 'FormCheckbox':\n case 'FormSwitch':\n value = false;\n break;\n\n case 'FormCheckboxes':\n value = [];\n break;\n default:\n value = '';\n }\n\n model[field] = value;\n }\n\n const component = components[element.component];\n\n markRaw(component);\n\n let s = {\n component: component,\n label: element.label,\n validations: {},\n };\n\n if (element.validation) {\n let v = yup;\n\n const validations = element.validation;\n\n validations.forEach((rule) => {\n let attributes = [];\n let method = rule;\n\n if (method.split(':').length > 1) {\n let ruleWithAttributes = rule.split(':');\n method = ruleWithAttributes.shift();\n\n attributes = JSON.parse(ruleWithAttributes);\n }\n\n if (method == 'required') {\n s.validations.required = true;\n }\n\n if (method == 'phone' && s.validations.required) {\n const phoneRegExp = element.pattern ? new RegExp(element.pattern) : /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n method = 'matches';\n\n attributes = [phoneRegExp, __('auth.validation.phone')];\n }\n\n if (method != 'array') {\n attributes.push(__('auth.validation.' + method));\n }\n\n try {\n v = v[method](...attributes);\n } catch (error) {}\n });\n\n validation[field] = v;\n }\n\n if (element.condition) {\n s.condition = (model) => model[element.condition[0]] === element.condition[1];\n\n validation[field] = yup.string().when(element.condition[0], {\n is: element.condition[1],\n then: validation[field],\n });\n }\n\n ['mask', 'placeholder', 'description', 'type', 'list', 'model', 'store', 'default', 'hidden'].forEach((f) => {\n if (element[f]) {\n s[f] = element[f];\n }\n });\n\n schema[field] = s;\n }\n }\n\n return {\n schema: schema,\n model: model,\n validation: yup.object().shape(validation),\n };\n}\n","import pluralize from './modules/pluralize';\nimport formParse from './modules/formParse';\nimport nl2p from './modules/nl2p';\n\nexport default {\n pluralize,\n formParse,\n nl2p,\n};\n","export default function pluralize(count, words) {\n let cases = [2, 0, 1, 1, 1, 2];\n\n return count + ' ' + words[count % 100 > 4 && count % 100 < 20 ? 2 : cases[Math.min(count % 10, 5)]];\n};","export default function nl2p(str) {\n if (typeof str === 'undefined' || str === null) {\n return '';\n }\n\n return '<p>' + (str + '').replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1' + '</p><p>' + '$2') + '</p>';\n}\n"],"names":["yup","addMethod","string","min","msg","this","test","name","exclusive","message","params","value","length","__","isNaN","pluralize","count","words","Math","formParse","json","components","FormCheckbox","FormCheckboxes","FormPassword","FormRadio","FormRating","FormSection","FormSelect","FormSwitch","FormText","FormTextarea","model","schema","validation","form","field","element","charAt","component","markRaw","s","label","validations","v","forEach","rule","attributes","method","split","ruleWithAttributes","shift","JSON","parse","required","pattern","RegExp","push","error","condition","when","is","then","f","Object","entries","object","shape","nl2p","str","replace"],"mappings":"kyEAcAA,EAAIC,UAAUD,EAAIE,OAAQ,cAAc,SAAUC,EAAKC,UAC5CC,KAAKC,KAAK,CACbC,KAAM,aACNC,WAAW,EACXC,QAASL,EACTM,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,SAAmB,IAATA,GAAeA,EAAMC,QAAUT,QAIxDH,EAAIC,UAAUD,EAAIE,OAAQ,gBAAgB,SAAUC,EAAKC,UAC9CC,KAAKC,KAAK,CACbC,KAAM,eACNC,WAAW,EACXC,QAASI,GAAG,0BACZH,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,WAAqB,IAATA,GAAe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