@perevorot/shop 2.0.156 → 2.0.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js.map +1 -1
- package/dist/app.js.map +1 -1
- package/dist/components/account/Account.js.map +1 -1
- package/dist/components/account/OrderItem.js.map +1 -1
- package/dist/components/account/Orders.js.map +1 -1
- package/dist/components/account/User.js +1 -1
- package/dist/components/account/User.js.map +1 -1
- package/dist/components/account/Viewed.js.map +1 -1
- package/dist/components/account/Wish.js.map +1 -1
- package/dist/components/auth/Confirm.js.map +1 -1
- package/dist/components/auth/Forget.js.map +1 -1
- package/dist/components/auth/Login.js +1 -1
- package/dist/components/auth/Login.js.map +1 -1
- package/dist/components/auth/Registration.js +1 -1
- package/dist/components/auth/Registration.js.map +1 -1
- package/dist/components/auth/Reset.js.map +1 -1
- package/dist/components/auth/User.js +1 -1
- package/dist/components/auth/User.js.map +1 -1
- package/dist/components/auth/UserTrigger.js.map +1 -1
- package/dist/components/shop/Catalog.js.map +1 -1
- package/dist/components/shop/CodeCopy.js +1 -1
- package/dist/components/shop/CodeCopy.js.map +1 -1
- package/dist/components/shop/Cross.js.map +1 -1
- package/dist/components/shop/FilterToggle.js +1 -1
- package/dist/components/shop/FilterToggle.js.map +1 -1
- package/dist/components/shop/Gallery.js.map +1 -1
- package/dist/components/shop/Notice.js.map +1 -1
- package/dist/components/shop/Pagination.js.map +1 -1
- package/dist/components/shop/PromoProducts.js.map +1 -1
- package/dist/components/shop/Search.js.map +1 -1
- package/dist/components/shop/bundle/Bundle.js +1 -1
- package/dist/components/shop/bundle/Bundle.js.map +1 -1
- package/dist/components/shop/bundle/BundleAdd.js.map +1 -1
- package/dist/components/shop/cart/Cart.js.map +1 -1
- package/dist/components/shop/cart/CartAdd.js.map +1 -1
- package/dist/components/shop/cart/CartItem.js.map +1 -1
- package/dist/components/shop/cart/CartTrigger.js.map +1 -1
- package/dist/components/shop/cart/SuccessMessage.js.map +1 -1
- package/dist/components/shop/compare/Compare.js.map +1 -1
- package/dist/components/shop/compare/CompareAdd.js.map +1 -1
- package/dist/components/shop/compare/CompareDelete.js.map +1 -1
- package/dist/components/shop/compare/CompareDeleteAll.js.map +1 -1
- package/dist/components/shop/compare/CompareList.js.map +1 -1
- package/dist/components/shop/compare/Comparsion.js.map +1 -1
- package/dist/components/shop/compare/ComparsionModal.js.map +1 -1
- package/dist/components/shop/compare/SuccessMessage.js.map +1 -1
- package/dist/components/shop/filters/FilterSearch.js.map +1 -1
- package/dist/components/shop/filters/Price.js.map +1 -1
- package/dist/components/shop/order/Checkout.js +1 -1
- package/dist/components/shop/order/Checkout.js.map +1 -1
- package/dist/components/shop/order/CheckoutItem.js.map +1 -1
- package/dist/components/shop/order/OneClick.js +1 -1
- package/dist/components/shop/order/OneClick.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingCourier.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingPickup.js.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.map +1 -1
- package/dist/components/shop/reviews/Question.js +1 -1
- package/dist/components/shop/reviews/Question.js.map +1 -1
- package/dist/components/shop/reviews/Review.js +1 -1
- package/dist/components/shop/reviews/Review.js.map +1 -1
- package/dist/components/shop/viewed/Viewed.js.map +1 -1
- package/dist/components/shop/viewed/ViewedDelete.js.map +1 -1
- package/dist/components/shop/viewed/Viewer.js.map +1 -1
- package/dist/components/shop/wishlist/SuccessMessage.js.map +1 -1
- package/dist/components/shop/wishlist/Wishlist.js.map +1 -1
- package/dist/components/shop/wishlist/WishlistAdd.js.map +1 -1
- package/dist/components/shop/wishlist/WishlistDelete.js.map +1 -1
- package/dist/forms/FormCheckbox.js.map +1 -1
- package/dist/forms/FormCheckboxes.js.map +1 -1
- package/dist/forms/FormPassword.js.map +1 -1
- package/dist/forms/FormRadio.js.map +1 -1
- package/dist/forms/FormRating.js.map +1 -1
- package/dist/forms/FormSection.js.map +1 -1
- package/dist/forms/FormSelect.js.map +1 -1
- package/dist/forms/FormSwitch.js.map +1 -1
- package/dist/forms/FormText.js.map +1 -1
- package/dist/forms/FormTextarea.js.map +1 -1
- package/dist/global.js.map +1 -1
- package/dist/helpers.js +1 -1
- package/dist/helpers.js.map +1 -1
- package/dist/store.js +1 -1
- package/dist/store.js.map +1 -1
- package/dist/vuex.js.map +1 -1
- package/package.json +2 -2
|
@@ -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=b8ffe8f4&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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","cityIsValid","isCityInputBlured","warehouseIsValid","isWarehouseInputBlured","onMounted","f","params","is_other_recipient","valid","getValue","resolve","i","apply","this","args","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","type","disabled","_createElementBlock","_hoisted_1","_ctx","_ctx$item$params","_createBlock","onMouseleave","onClick","_hoisted_2","onFocus","placeholder","autocomplete","name","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","$event","_hoisted_10","_hoisted_11","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24"],"mappings":"0JA4DA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,SA+DEO,EA9DEC,EAAOC,WAAS,CAClBC,sBACWV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ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AAoDK,8CAAnCA,oCAC9BiB,MAI6BjB,kEAAjCF,yBAAAoB,oBAAsDlB,0CAG9DL,2BAAAwB,GACIxB,2BAAAyB,oBACItB,kDAAwCE,uBAAR/E,wBAAhC6E,gCAAS,gBAAkD1B,IAAKnD,EAAKgE,GAAKmB,2BAAOJ,kBAAgBc,EAAQ7F,uBAAUA,EAAKwF,qBACvFT,kBAAmBA,aAAWjC,QAAWiC,kEAA1EF,2BAAAuB,oBAA+FrB,iFAI3GF,0DAAW,qBAAqCE,sCAC5CL,2BAAA2B,GACI3B,2BAAA4B,GACI5B,2BAAA6B,GACIC,EACA9B,6BAAA+B,oBAAwB1B"}
|
|
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=b8ffe8f4&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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\n };\n }\n});\n</script>\n"],"names":["script","defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","cityIsValid","isCityInputBlured","warehouseIsValid","isWarehouseInputBlured","onMounted","f","_exit","_invoke","_props$item$params","then","direct","params","is_other_recipient","valid","getValue","_temp","Promise","resolve","_result","args","i","arguments","length","apply","this","e","close","window","addEventListener","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","response","id","_defineProperty","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_hoisted_1","class","_hoisted_2","_createElementVNode","createElementVNode","xlink:href","_hoisted_7","_hoisted_8","_hoisted_11","_hoisted_16","_hoisted_17","_hoisted_20","_hoisted_21","_hoisted_22","type","disabled","_hoisted_24","_openBlock","openBlock","_createElementBlock","_ctx","_ctx$item$params","_createBlock","createBlock","_component_checkout_shipping_other_recipient","_normalizeClass","is-active","onMouseleave","onClick","is-loading","$event","onFocus","placeholder","__","autocomplete","name","_withDirectives","_hoisted_5","_hoisted_6","_toDisplayString","createElementBlock","_Fragment","_hoisted_9","_hoisted_10","_hoisted_14","_hoisted_15","_renderList","_hoisted_18","_hoisted_19","toDisplayString","is-top","_hoisted_23"],"mappings":"+dA4DA,IAAAA,EAAeC,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,MAAK,SAACN,GACF,IA8DIO,EA9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{"version":3,"file":"CheckoutShippingPickup.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue?vue&type=template&id=aaaf2324&lang.js"],"sourcesContent":["<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n return !!(selected.value);\n };\n\n shippingComponentUserData.value = {};\n\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n","<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n return !!(selected.value);\n };\n\n shippingComponentUserData.value = {};\n\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","selected","computed","find","id","pickup","value","isValid","length","shippingComponentValid","inject","shippingComponentUserData","onMounted","i","arguments","e","code","get","set","isOpened","ref","close","window","addEventListener","key","target","closest","open","choose","option","stopPropagation","setTimeout","nl2p","_createElementVNode","_ctx","_createElementBlock","_hoisted_1","_hoisted_2","onMouseleave","onClick","_toDisplayString","name","_hoisted_4","_hoisted_5","_hoisted_6","$event","hours","map_url","description","image","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","innerHTML","_hoisted_15","href","rel","_hoisted_18","_hoisted_19","src"],"mappings":"4EA6CA,MAAeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,eAAMN,OACIO,EAAWC,YAAS,kBACfR,EAAMG,KAAKF,KAAKQ,MAAK,SAACN,UAASA,EAAKO,IAAMC,EAAOC,YAGtDC,EAAU,SAACH,UACRV,EAAMG,KAAKF,KAAKa,UAGRJ,GAIXK,EAAyBC,SAAO,0BAChCC,EAA4BD,SAAO,6BAEzCE,aAAU,iBACNH,EAAuBH,4BACTL,EAASK,OA2C3B,qDAEAO,GAAKC,UAAUD,qDAIbE,+BA9CEJ,EAA0BL,MAAQ,GAE7BL,EAASK,OACVZ,EAAMI,OAAOJ,EAAMG,KAAKmB,KAAM,GAAIT,YAIpCF,EAASH,WAAS,CACpBe,sBACWvB,EAAMC,KAAKD,EAAMG,KAAKmB,MAAQtB,EAAMC,KAAKD,EAAMG,KAAKmB,MAAMZ,GAAK,MAE1Ec,aAAId,GACAV,EAAMI,OACFJ,EAAMG,KAAKmB,KACX,C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ACIxB,0BAAIyB,KAAMxB,WAASa,QAAStB,OAAO,SAASkC,IAAI,8BAAczB,gEAEvDA,WAASc,2BAApBb,wCAAuC,OAAOqB,UAAQtB,OAAKA,WAASc,6DAG7Cd,WAASe,qBAAxCd,2BAAAyB,GACI3B,2BAAA4B,GACI5B,4BAAM6B,IAAK5B,WAASe"}
|
|
1
|
+
{"version":3,"file":"CheckoutShippingPickup.js","sources":["../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue","../../../../../src/components/shop/order/shipping/CheckoutShippingPickup.vue?vue&type=template&id=aaaf2324&lang.js"],"sourcesContent":["<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n return !!(selected.value);\n };\n\n shippingComponentUserData.value = {};\n\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n","<template>\n <div class=\"component pickup-wrapper\" v-if=\"item.data.length\">\n <div class=\"label\" v-if=\"__('shop.order.pickup_label')\">{{ __('shop.order.pickup_label') }}</div>\n <div class=\"dropdown\" v-bind:class=\"{ 'is-active': isOpened }\" @mouseleave=\"close\">\n <div class=\"input dropdown-trigger\" @click=\"open\">\n <span v-bind:class=\"{ 'is-placeholder': !selected }\" v-text=\"selected ? selected.name : __('shop.order.pickup')\"></span>\n <svg>\n <use xlink:href=\"#arrow-down\"></use>\n </svg>\n </div>\n <div class=\"dropdown-menu\">\n <div class=\"dropdown-content\">\n <a class=\"dropdown-item\" v-for=\"option in item.data\" v-bind:key=\"option.id\" @click=\"choose($event, option)\" v-bind:class=\"{ 'is-active': selected && option.id == selected.id }\">{{ option.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"data\" v-if=\"selected && (selected.hours || selected.map_url || selected.description || selected.image)\">\n <div class=\"columns is-gapless\">\n <div class=\"column\">\n <div class=\"data-wrapper\">\n <div v-if=\"selected.hours\" class=\"hours\">\n <svg>\n <use xlink:href=\"#hours\"></use>\n </svg>\n <span v-html=\"selected.hours\"></span>\n </div>\n <div v-if=\"selected.map_url\" class=\"map\">\n <a :href=\"selected.map_url\" target=\"_blank\" rel=\"noopener\">{{ __('shop.order.map') }}</a>\n </div>\n <div v-if=\"selected.description\" class=\"info\" v-html=\"nl2p(selected.description)\"></div>\n </div>\n </div>\n <div class=\"column is-4\" v-if=\"selected.image\">\n <div class=\"image\">\n <img :src=\"selected.image\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { nl2p } from '@perevorot/shop/dist/helpers';\nimport { ref, computed, defineComponent, onMounted, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const selected = computed(() => {\n return props.item.data.find((item) => item.id == pickup.value);\n });\n\n const isValid = (id) => {\n if (!props.item.data.length) {\n return true;\n } else {\n return !!id;\n }\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n onMounted(() => {\n shippingComponentValid.value = async () => {\n return !!(selected.value);\n };\n\n shippingComponentUserData.value = {};\n\n if (!selected.value) {\n props.commit(props.item.code, {}, isValid());\n }\n });\n\n const pickup = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].id : null;\n },\n set(id) {\n props.commit(\n props.item.code,\n {\n id: id\n },\n isValid(id)\n );\n }\n });\n\n const isOpened = ref(false);\n\n const open = () => {\n isOpened.value = true;\n };\n\n const close = () => {\n isOpened.value = false;\n };\n\n const choose = (e, option) => {\n e.stopPropagation();\n\n setTimeout(() => {\n pickup.value = option.id;\n }, 200);\n\n close();\n };\n\n window.addEventListener('keyup', (e) => {\n if (isOpened.value && e.key === 'Escape') {\n close();\n }\n });\n\n window.addEventListener('click', (e) => {\n if (!e.target.closest('.pickup-wrapper')) {\n close();\n }\n });\n\n return {\n selected,\n isOpened,\n open,\n choose,\n close,\n pickup,\n nl2p\n };\n }\n});\n</script>\n"],"names":["script","defineComponent","props","data","Object","item","commit","Function","setup","selected","computed","find","id","pickup","value","isValid","length","shippingComponentValid","inject","shippingComponentUserData","onMounted","f","args","i","arguments","Promise","resolve","apply","this","e","code","get","set","isOpened","ref","close","window","addEventListener","key","target","closest","open","choose","option","stopPropagation","setTimeout","nl2p","class","_createElementVNode","createElementVNode","xlink:href","_hoisted_5","_hoisted_6","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_19","_ctx","_openBlock","openBlock","_createElementBlock","_hoisted_1","__","_hoisted_2","_toDisplayString","_normalizeClass","is-active","onMouseleave","onClick","textContent","toDisplayString","name","_hoisted_4","_Fragment","_renderList","renderList","createElementBlock","$event","_hoisted_7","hours","map_url","description","image","_hoisted_8","_hoisted_12","_hoisted_13","innerHTML","_hoisted_15","href","rel","_hoisted_16","_hoisted_18","src"],"mappings":"4EA6CA,IAAAA,EAAeC,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,MAAK,SAACN,GACF,IAAMO,EAAWC,EAAAA,UAAS,WACtB,OAAOR,EAAMG,KAAKF,KAAKQ,MAAK,SAACN,GAAI,OAAKA,EAAKO,IAAMC,EAAOC,YAGtDC,EAAU,SAACH,GACb,OAAKV,EAAMG,KAAKF,KAAKa,UAGRJ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hD,WAAagD,EAAAhD,SAASsE,OAAStB,EAAQhD,SAACuE,SAAWvB,WAASwB,aAAexB,EAAAhD,SAASyE,QAA5GxB,EAAAA,YAAAE,EAAAgB,mBAsBK,MAtBLO,EAsBK,CArBDnC,EAAAA,mBAoBK,MApBLK,EAoBK,CAnBDL,qBAaK,MAbLM,EAaK,CAZDN,EAAAC,mBAWK,MAXLM,EAWK,CAVUE,EAAAhD,SAASsE,OAApBrB,EAAAA,YAAAE,EAAAA,mBAKK,MALLwB,EAKK,CAJDC,EAGArC,EAAAA,mBAAoC,OAAA,CAA9BsC,UAAQ7B,EAAQhD,SAACsE,oDAEhBtB,EAAAhD,SAASuE,SAApBtB,EAAAC,YAAAC,EAAAgB,mBAEK,MAFLW,EAEK,CADDvC,EAAwFC,mBAAA,IAAA,CAApFuC,KAAM/B,EAAQhD,SAACuE,QAASzC,OAAO,SAASkD,IAAI,8BAAchC,EAAEK,GAAA,mBAAA,EAAA4B,sCAEzDjC,EAAAhD,SAASwE,2BAApBrB,EAAuFgB,mBAAA,MAAA,OAAtD7B,MAAM,OAAOuC,UAAQ7B,EAAAX,KAAKW,EAAAhD,SAASwE,6DAG7CxB,EAAAhD,SAASyE,OAAxCxB,cAAAE,qBAIK,MAJL+B,EAIK,CAHD3C,EAAAC,mBAEK,MAFLO,EAEK,CADDR,EAAAA,mBAA4B,MAAA,CAAtB4C,IAAKnC,EAAQhD,SAACyE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue");function t(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var o=e.defineComponent({props:{data:Object,item:Object,commit:Function},setup:function(o){var n,r
|
|
1
|
+
"use strict";var e=require("vue");function t(e,t,o){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(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=e.computed({get:function(){return o.data[o.item.code]?o.data[o.item.code].city:null},set:function(e){var t={city:e};o.commit(o.item.code,t,i(t))}}),a=e.computed({get:function(){return o.data[o.item.code]?o.data[o.item.code].warehouse:null},set:function(e){var t={city:r.value,warehouse:e};o.commit(o.item.code,t,i(t))}}),u=e.ref(null),i=function(e){return!(!e.city||!e.warehouse)},l=e.inject("shippingComponentValid"),c=e.inject("shippingComponentUserData"),s=e.ref(!1),d=e.ref(!1),p=e.ref(""),v=e.ref(""),y=e.ref([]),h=e.ref([]),m=e.ref([]),f=e.ref(null),w=e.ref(null),g=e.ref(!1),k=e.ref(!1),V=e.ref(!1),E=e.ref(!1),C=e.computed((function(){return!!r.value||!I.value})),I=e.ref(!1),N=e.computed((function(){return!!a.value||!Q.value})),Q=e.ref(!1);e.onMounted((function(){var e;o.item.data&&o.item.data.length&&(h.value=o.item.data),l.value=(e=function(){var e=!1;return I.value=!0,Q.value=!0,function(e,t){var o=e();return o&&o.then?o.then(t):t(o)}((function(){var t,n,i,l;if(null!==(t=o.item.params)&&void 0!==t&&t.is_other_recipient&&u.value)return n=u.value.isValid(),i=function(t){t&&(c.value=u.value.getValue());var o=!!(r.value&&a.value&&t);return e=!0,o},l?i?i(n):n:(n&&n.then||(n=Promise.resolve(n)),i?n.then(i):n)}),(function(t){return e?t:!(!r.value||!a.value)}))},function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}})}));var _=function(){s.value=!1,d.value=!1,V.value=!1,E.value=!1,I.value=!0,Q.value=!0};window.addEventListener("keyup",(function(e){(s.value||d.value)&&"Escape"===e.key&&_()})),window.addEventListener("click",(function(e){!s.value&&!d.value||e.target.closest(".dropdown")||_()})),e.watch(p,(function(e){clearTimeout(n),r.value=null,e&&(g.value=!0,n=setTimeout((function(){$http.post($ziggy("api.delivery-ukr-poshta"),{q:e,action:"cities"}).then((function(e){y.value=e.data.cities})).finally((function(){g.value=!1}))}),400))})),e.watch(v,(function(e){clearTimeout(n),e?(k.value=!0,n=setTimeout((function(){$http.post($ziggy("api.delivery-ukr-poshta"),{q:e,city:r.value.id,action:"warehouses"}).then((function(e){m.value=e.data.warehouses})).finally((function(){k.value=!1}))}),400)):(a.value=null,m.value=[])}));return t(t(t(t(t(t(t(t(t({isCityOpened:s,isWarehouseOpened:d,openCity:function(){s.value=!0},openWarehouse:function(){d.value=!0},cities:y,citiesPopular:h,warehouses:m,chooseCity:function(e,t){e.stopPropagation(),r.value=t,m.value=[],v.value="",V.value=!1,$http.post($ziggy("api.delivery-ukr-poshta"),{city:t.id,action:"warehouses"}).then((function(e){m.value=e.data.warehouses})).finally((function(){k.value=!1})),_()},chooseWarehouse:function(e,t){e.stopPropagation(),a.value=t,E.value=!1,a.value=t,_()},queryCity:p,queryWarehouse:v,city:r,warehouse:a,loadingCity:g,loadingWarehouse:k,focusWarehouse:function(){Q.value=!1,s.value=!1,V.value=!1,E.value||(E.value=!0,e.nextTick((function(){w.value.value=" ",w.value.focus()})))},focusCity:function(){I.value=!1,Q.value=!1,d.value=!1,E.value=!1,V.value||(V.value=!0,e.nextTick((function(){f.value.value=" ",f.value.focus()})))}},"city",r),"warehouse",a),"cityQueryInput",f),"warehouseQueryInput",w),"cityQueryInputInQueryMode",V),"warehouseQueryInputInQueryMode",E),"userForm",u),"cityIsValid",C),"warehouseIsValid",N)}}),n={class:"component ukrposhta-wrapper"},r={class:"user-form"},a=["placeholder"],u=["value"],i=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),l={key:0,class:"help is-danger"},c={class:"dropdown-menu"},s={class:"dropdown-content"},d=["onClick"],p={key:0,class:"dropdown-item"},v={class:"user-form"},y=["placeholder"],h=["value"],m=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),f={key:0,class:"help is-danger"},w={class:"dropdown-menu"},g={class:"dropdown-content"},k=["onClick"],V={key:0,class:"dropdown-item"},E={class:"dropdown-trigger"},C={class:"user-form"},I={class:"control"},N=e.createElementVNode("input",{type:"text",class:"input",disabled:""},null,-1),Q={class:"label"};o.render=function(t,o,_,B,b,W){var S,D=e.resolveComponent("checkout-shipping-other-recipient");return e.openBlock(),e.createElementBlock("div",n,[null!==(S=t.item.params)&&void 0!==S&&S.is_other_recipient?(e.openBlock(),e.createBlock(D,{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,"is-danger":!t.cityIsValid}])},[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,a),[[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,u),[[e.vShow,!t.cityQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("label",{class:"label"},e.toDisplayString(t.__("shop.order.city")),513),[[e.vShow,!t.cityQueryInputInQueryMode]]),i],2),t.cityIsValid?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("p",l,e.toDisplayString(t.__("auth.validation.required")),1))])]),e.createElementVNode("div",c,[e.createElementVNode("div",s,[(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,d)})),128)),!t.queryCity||t.cities.length||t.loadingCity?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",p,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",v,[e.createElementVNode("div",{class:e.normalizeClass(["control",{"is-loading":t.loadingWarehouse,"is-danger":!t.warehouseIsValid}])},[e.withDirectives(e.createElementVNode("input",{type:"text",class:"input is-nolabel","onUpdate:modelValue":o[5]||(o[5]=function(e){return t.queryWarehouse=e}),onFocus:o[6]||(o[6]=function(){return t.focusWarehouse&&t.focusWarehouse.apply(t,arguments)}),placeholder:t.__("shop.order.warehouse_placeholder"),autocomplete:"chrome-off",ref:"warehouseQueryInput"},null,40,y),[[e.vModelText,t.queryWarehouse],[e.vShow,t.warehouseQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("input",{type:"text",class:"input",value:t.warehouse?t.warehouse.name:"",onFocus:o[7]||(o[7]=function(){return t.focusWarehouse&&t.focusWarehouse.apply(t,arguments)}),placeholder:" "},null,40,h),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),e.withDirectives(e.createElementVNode("label",{class:"label"},e.toDisplayString(t.__("shop.order.warehouse")),513),[[e.vShow,!t.warehouseQueryInputInQueryMode]]),m],2),t.warehouseIsValid?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("p",f,e.toDisplayString(t.__("auth.validation.required")),1))])]),e.createElementVNode("div",w,[e.createElementVNode("div",g,[(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,k)})),128)),!t.queryWarehouse||t.warehouses.length||t.loadingWarehouse?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",V,e.toDisplayString(t.__("shop.checkout.shipment.warehouse.not_found")),1))])])],34)):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["dropdown",{"is-top":t.warehouseQueryInputInQueryMode}])},[e.createElementVNode("div",E,[e.createElementVNode("div",C,[e.createElementVNode("div",I,[N,e.createElementVNode("label",Q,e.toDisplayString(t.__("shop.order.warehouse")),1)])])])],2))])},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=defe37f0&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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\n };\n }\n});\n</script>\n"],"names":["defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","cityIsValid","isCityInputBlured","warehouseIsValid","isWarehouseInputBlured","onMounted","f","length","then","direct","params","is_other_recipient","valid","getValue","i","resolve","apply","this","args","close","window","addEventListener","e","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","response","id","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_createElementVNode","type","disabled","_createElementBlock","_hoisted_1","_ctx","_ctx$item$params","_createBlock","onMouseleave","onClick","_hoisted_2","onFocus","placeholder","autocomplete","name","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","$event","_hoisted_10","_hoisted_11","_hoisted_14","_ho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AAoBS,sCAAOJ,wDAClCL,2BAAAqB,GACIrB,oDAAW,wBAAwCK,gCAAgCA,yCAC/EL,8BAAOC,KAAK,aAAa,wEAA4BI,qBAAiBM,sCAAON,wDAAiBO,YAAaP,yCAAwCQ,aAAa,aAAqD1E,IAAI,iDAApKkE,2BAAgIA,qDACrLL,8BAAOC,KAAK,aAAa,QAAShE,MAAOoE,YAAYA,YAAUS,QAAYH,sCAAON,wDAAgBO,YAAY,2BAAaP,qDAC3HL,oCAAa,2BAAoDK,8CAAnCA,oCAC9BiB,MAI6BjB,kEAAjCF,yBAAAoB,oBAAsDlB,0CAG9DL,2BAAAwB,GACIxB,2BAAAyB,oBACItB,kDAAwCE,uBAARhF,wBAAhC8E,gCAAS,gBAAkDzB,IAAKrD,EAAKiE,GAAKmB,2BAAOJ,kBAAgBc,EAAQ9F,uBAAUA,EAAKyF,qBACvFT,kBAAmBA,aAAW3C,QAAW2C,kEAA1EF,2BAAAuB,oBAA+FrB,iFAI3GF,0DAAW,qBAAqCE,sCAC5CL,2BAAA2B,GACI3B,2BAAA4B,GACI5B,2BAAA6B,GACIC,EACA9B,6BAAA+B,oBAAwB1B"}
|
|
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=defe37f0&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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\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, 'is-danger': !cityIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!cityIsValid\">{{ __('auth.validation.required') }}</p>\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, 'is-danger': !warehouseIsValid }\">\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 <p class=\"help is-danger\" v-if=\"!warehouseIsValid\">{{ __('auth.validation.required') }}</p>\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 class=\"dropdown\" v-bind:class=\"{ 'is-top': warehouseQueryInputInQueryMode }\" v-else>\n <div class=\"dropdown-trigger\">\n <div class=\"user-form\">\n <div class=\"control\">\n <input type=\"text\" class=\"input\" disabled />\n <label class=\"label\">{{ __('shop.order.warehouse') }}</label>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, onMounted, defineComponent, nextTick, inject } from 'vue';\n\nexport default defineComponent({\n props: {\n data: Object,\n item: Object,\n commit: Function\n },\n setup(props) {\n const city = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].city : null;\n },\n set(city) {\n const data = {\n city: city\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const warehouse = computed({\n get() {\n return props.data[props.item.code] ? props.data[props.item.code].warehouse : null;\n },\n set(warehouse) {\n const data = {\n city: city.value,\n warehouse: warehouse\n };\n\n props.commit(props.item.code, data, isValid(data));\n }\n });\n\n const userForm = ref(null);\n\n const isValid = (data) => {\n return !!(data.city && data.warehouse);\n };\n\n const shippingComponentValid = inject('shippingComponentValid');\n const shippingComponentUserData = inject('shippingComponentUserData');\n\n const isCityOpened = ref(false);\n const isWarehouseOpened = ref(false);\n const queryCity = ref('');\n const queryWarehouse = ref('');\n const cities = ref([]);\n const citiesPopular = ref([]);\n const warehouses = ref([]);\n const cityQueryInput = ref(null);\n const warehouseQueryInput = ref(null);\n const loadingCity = ref(false);\n const loadingWarehouse = ref(false);\n const cityQueryInputInQueryMode = ref(false);\n const warehouseQueryInputInQueryMode = ref(false);\n\n const cityIsValid = computed(() => {\n return city.value ? true : (!isCityInputBlured.value ? true : false);\n });\n\n const isCityInputBlured = ref(false);\n\n const warehouseIsValid = computed(() => {\n return warehouse.value ? true : (!isWarehouseInputBlured.value ? true : false);\n });\n\n const isWarehouseInputBlured = ref(false);\n\n let typeTimeout;\n\n onMounted(() => {\n if (props.item.data && props.item.data.length) {\n citiesPopular.value = props.item.data;\n }\n\n shippingComponentValid.value = async () => {\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\n\n if (props.item.params?.is_other_recipient && userForm.value) {\n const valid = await userForm.value.isValid();\n\n if (valid) {\n shippingComponentUserData.value = userForm.value.getValue();\n }\n\n return !!(city.value && warehouse.value && valid);\n }\n\n return !!(city.value && warehouse.value);\n };\n });\n\n const openCity = () => {\n isCityOpened.value = true;\n };\n\n const openWarehouse = () => {\n isWarehouseOpened.value = true;\n };\n\n const close = () => {\n isCityOpened.value = false;\n isWarehouseOpened.value = false;\n\n cityQueryInputInQueryMode.value = false;\n warehouseQueryInputInQueryMode.value = false;\n\n isCityInputBlured.value = true;\n isWarehouseInputBlured.value = true;\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 ((isCityOpened.value || isWarehouseOpened.value) && !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 isWarehouseInputBlured.value = false;\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 isCityInputBlured.value = false;\n isWarehouseInputBlured.value = false;\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 cityIsValid,\n warehouseIsValid\n };\n }\n});\n</script>\n"],"names":["script","defineComponent","props","data","Object","item","commit","Function","setup","typeTimeout","city","computed","get","code","set","isValid","warehouse","value","userForm","ref","shippingComponentValid","inject","shippingComponentUserData","isCityOpened","isWarehouseOpened","queryCity","queryWarehouse","cities","citiesPopular","warehouses","cityQueryInput","warehouseQueryInput","loadingCity","loadingWarehouse","cityQueryInputInQueryMode","warehouseQueryInputInQueryMode","cityIsValid","isCityInputBlured","warehouseIsValid","isWarehouseInputBlured","onMounted","f","length","_exit","_invoke","_props$item$params","then","direct","params","is_other_recipient","valid","getValue","_temp","_result","args","i","arguments","Promise","resolve","apply","this","e","close","window","addEventListener","key","target","closest","watch","q","clearTimeout","setTimeout","$http","post","$ziggy","action","response","id","_defineProperty","openCity","openWarehouse","chooseCity","stopPropagation","chooseWarehouse","focusWarehouse","nextTick","focus","focusCity","_hoisted_1","class","_hoisted_2","_createElementVNode","createElementVNode","xlink:href","_hoisted_7","_hoisted_8","_hoisted_11","_hoisted_16","_hoisted_17","_hoisted_20","_hoisted_21","_hoisted_22","type","disabled","_hoisted_24","_openBlock","openBlock","_createElementBlock","_ctx","_ctx$item$params","_createBlock","createBlock","_component_checkout_shipping_other_recipient","_normalizeClass","is-active","onMouseleave","onClick","is-loading","$event","onFocus","placeholder","__","autocomplete","name","_withDirectives","_hoisted_5","_hoisted_6","_toDisplayString","createElementBlock","_Fragment","_hoisted_9","_hoisted_10","_hoisted_14","_hoisted_15","_renderList","_hoisted_18","_hoisted_19","toDisplayString","is-top","_hoisted_23"],"mappings":"+dA4DA,IAAAA,EAAeC,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,OAAQC,UAEZC,MAAK,SAACN,GACF,IA8DIO,EA9DEC,EAAOC,EAAAA,SAAS,CAClBC,IAAG,WACC,OAAOV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMH,KAAO,MAE5EI,IAAG,SAACJ,GACA,IAAMP,EAAO,CACTO,KAAMA,GAGVR,EAAMI,OAAOJ,EAAMG,KAAKQ,KAAMV,EAAMY,EAAQZ,OAI9Ca,EAAYL,EAAAA,SAAS,CACvBC,IAAG,WACC,OAAOV,EAAMC,KAAKD,EAAMG,KAAKQ,MAAQX,EAAMC,KAAKD,EAAMG,KAAKQ,MAAMG,UAAY,MAEjFF,IAAG,SAACE,GACA,IAAMb,EAAO,CACTO,KAAMA,EAAKO,MACXD,UAAWA,GAGfd,EAAMI,OAAOJ,EAAMG,KAAKQ,KAAMV,EAAMY,EAAQZ,OAI9Ce,EAAWC,MAAI,MAEfJ,EAAU,SAACZ,GACb,SAAUA,EAAKO,OAAQP,EAAKa,YAG1BI,EAAyBC,SAAO,0BAChCC,EAA4BD,SAAO,6BAEnCE,EAAeJ,OAAI,GACnBK,EAAoBL,OAAI,GACxBM,EAAYN,MAAI,IAChBO,EAAiBP,MAAI,IACrBQ,EAASR,MAAI,IACbS,EAAgBT,MAAI,IACpBU,EAAaV,MAAI,IACjBW,EAAiBX,MAAI,MACrBY,EAAsBZ,MAAI,MAC1Ba,EAAcb,OAAI,GAClBc,EAAmBd,OAAI,GACvBe,EAA4Bf,OAAI,GAChCgB,EAAiChB,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GAAA,+CAAA,6BAI7Gd,EASKqB,mBAAA,MAAA,OATAvC,MAAKwB,EAAAA,eAAA,CAAC,WAAS,CAAAyB,SAA4B9B,EAA6BzE,oCACzEwD,EAAAA,mBAOK,MAPLQ,EAOK,CANDR,EAAAC,mBAKK,MALLQ,EAKK,CAJDT,EAAAC,mBAGK,MAHLS,EAGK,CAFDsC,EACAhD,EAAAA,mBAA4D,QAA5Da,EAA4DuB,EAAAU,gBAApC7B,EAAEa,GAAA,yBAAA"}
|
|
@@ -1 +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=25c0bbf4&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, onMounted } 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', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_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.middle_name = checkoutUser.value.middle_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 placeholder: __('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 placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_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 middle_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 onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n //console.log('checkoutUser.phone', checkoutUser.value.phone);\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, onMounted } 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', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_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.middle_name = checkoutUser.value.middle_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 placeholder: __('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 placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_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 middle_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 onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n //console.log('checkoutUser.phone', checkoutUser.value.phone);\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","checkoutUser","inject","field","form","ref","userSubmitButton","isValid","value","click","validation","user","i","arguments","resolve","apply","args","reject","type","name","last_name","middle_name","phone_me","phone_other","schema","component","model","label","list","code","__","placeholder","condition","mask","useSchemaForm","phoneRegExp","yup","object","shape","string","when","trim","required","matches","onMounted","phone","getValue","raw","JSON","parse","stringify","_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,uBACUC,EAAeC,SAAO,QACtBC,EAAQD,SAAO,SACfE,EAAOC,MAAI,MACXC,EAAmBD,MAAI,MAEvBE,uBACFD,EAAiBE,MAAMC,QAEVC,EAAWH,QAAQI,EAAKH,6BA8C/B,GAAII,IAAOA,EAAIC,oCACVD,sBAGLE,UAAUC,WAAYC,4BAEtBC,aAjDJN,EAAON,MAAI,CACba,KAAMf,EAAM,aAAc,MAC1BgB,KAAMhB,EAAM,aAAc,IAC1BiB,UAAWjB,EAAM,kBAAmB,I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,SACOkB,EAAIG,SAASE,OAAOC,SAASZ,GAAG,gCAG/CR,SAAUc,EAAIG,SAASC,KAAK,QAAQ,SAACtB,MACrB,MAARA,SACOkB,EAAIG,SAASG,SAASZ,GAAG,0BAA0Ba,QAAQR,EAAaL,GAAG,6BAG1FP,YAAaa,EAAIG,SAASC,KAAK,QAAQ,SAACtB,MACxB,SAARA,SACOkB,EAAIG,SAASG,SAASZ,GAAG,0BAA0Ba,QAAQR,EAAaL,GAAG,sCAK9Fc,aAAU,WACDjC,EAAKH,MAAMc,WACZX,EAAKH,MAAMc,SAAWrB,EAAaO,MAAMqC,UAK1C,CACHrB,OAAAA,EACAd,WAAAA,EACAC,KAAAA,EACAP,KAAAA,EACAE,iBAAAA,EACAC,QAAAA,EACAuC,SAtHa,eACPC,EAAMC,KAAKC,MAAMD,KAAKE,UAAUvC,EAAKH,cAE3B,MAAZuC,EAAI7B,MACJ6B,EAAI5B,KAAOlB,EAAaO,MAAMW,KAC9B4B,EAAI3B,UAAYnB,EAAaO,MAAMY,UACnC2B,EAAI1B,YAAcpB,EAAaO,MAAMa,YACrC0B,EAAIF,MAAQE,EAAIzB,gBAETyB,EAAIxB,mBACJwB,EAAIzB,WAEXyB,EAAIF,MAAQE,EAAIxB,mBAETwB,EAAIzB,gBACJyB,EAAIxB,oBAGRwB,EAAI7B,KAEJ6B,gBClEJ,gBAGS7B,KAAK,SAASb,IAAI,yBAAyB,wGAH/D8C,2BAAAC,GACIC,iBAAYC,iBAAiB,QAAS9B,OAAQ+B,6BAA4BA,aAAaC,mCAAmC,EAAMnD,IAAI,SACrHoD,qBACP,kBAAAC,8BAAAC"}
|
|
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=25c0bbf4&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, onMounted } 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', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_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.middle_name = checkoutUser.value.middle_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 placeholder: __('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 placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_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 middle_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 onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n //console.log('checkoutUser.phone', checkoutUser.value.phone);\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, onMounted } 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', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_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.middle_name = checkoutUser.value.middle_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 placeholder: __('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 placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_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 middle_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 onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n //console.log('checkoutUser.phone', checkoutUser.value.phone);\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","script","defineComponent","components","setup","f","checkoutUser","inject","field","form","ref","userSubmitButton","isValid","value","click","validation","user","args","i","arguments","length","Promise","resolve","apply","reject","e","type","name","last_name","middle_name","phone_me","phone_other","schema","component","model","label","list","code","__","placeholder","condition","mask","useSchemaForm","phoneRegExp","yup","object","shape","string","when","trim","required","matches","onMounted","phone","getValue","raw","JSON","parse","stringify","_hoisted_1","class","_openBlock","_createElementBlock","_createVNode","createVNode","_component_SchemaForm","schemaRowClasses","_ctx","validation-schema","preventModelCleanupOnSchemaChange","afterForm","_createElementVNode","createElementVNode","_hoisted_2"],"mappings":"omBAiBAA,EAAOA,QAACC,EAAQ,SAChBD,EAAOA,QAACE,EAAS,SAEjB,IAAMC,EAAaC,EAAAA,kBAAkB,CAACC,EAAiB,QAAC,MAExDC,EAAeC,kBAAgB,CAC3BC,WAAY,CACRL,WAAAA,GAEJM,MAAK,WACD,IAoDKC,EApDCC,EAAeC,SAAO,QACtBC,EAAQD,SAAO,SACfE,EAAOC,MAAI,MACXC,EAAmBD,MAAI,MAEvBE,GA+CDP,EA/CuB,WACM,OAA9BM,EAAiBE,MAAMC,QAEVC,EAAWH,QAAQI,EAAKH,mBA8CjC,IAAA,IAAAI,EAAE,GAAIC,EAAK,EAAEA,EAAIC,UAAEC,OAAAF,IACnBD,EAAAC,GAAAC,UAAOD,OAGP,OAAAG,QAAEC,QAASjB,EAACkB,WAAYN,4BAEtBO,OAAKC,MAjDTT,EAAON,EAAAA,IAAI,CACbgB,KAAMlB,EAAM,aAAc,MAC1BmB,KAAMnB,EAAM,aAAc,IAC1BoB,UAAWpB,EAAM,kBAAmB,IACpCqB,YAAarB,EAAM,oBAAqB,IACxCsB,SAAUtB,EAAM,iBAAkB,IAClCuB,YAAavB,EAAM,oBAAqB,MA0BtCwB,EAAStB,EAAAA,IAAI,CACfgB,KAAM,CACFO,UAAWpC,EAAS,QACpBqC,MAAO,OACPC,MAAO,GACPC,KAAM,CACF,CAAEC,KAAM,KAAMxB,MAAOyB,GAAG,wCACxB,CAAED,KAAM,QAASxB,MAAOyB,GAAG,6CAGnCX,KAAM,CACFM,UAAW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