@meeovi/layer-commerce 1.0.10 → 1.0.13
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/app/components/catalog/product/ProductAccordion/ProductAccordion.vue +39 -0
- package/app/components/catalog/product/ProductAccordion/__tests__/ProductAccordion.spec.ts +15 -0
- package/app/components/catalog/product/ProductAccordion/types.ts +5 -0
- package/app/components/catalog/product/ProductProperties/ProductProperties.vue +50 -0
- package/app/components/catalog/product/ProductProperties/__tests__/ProductProperties.spec.ts +15 -0
- package/app/components/catalog/product/ProductProperties/types.ts +5 -0
- package/app/components/catalog/product/ProductSlider/ProductSlider.vue +28 -0
- package/app/components/catalog/product/ProductSlider/__tests__/ProductSlider.spec.ts +14 -0
- package/app/components/catalog/product/ProductSlider/types.ts +7 -0
- package/app/components/catalog/product/RecommendedProducts/RecommendedProducts.vue +12 -0
- package/app/components/catalog/product/RecommendedProducts/types.ts +5 -0
- package/app/components/catalog/product/RenderContentProductSlider/RenderContentProductSlider.vue +11 -0
- package/app/components/catalog/product/add-attribute.vue +54 -0
- package/app/components/catalog/product/add-product-type.vue +54 -0
- package/app/components/catalog/product/add-product.vue +53 -0
- package/app/components/catalog/product/add-showcase.vue +52 -0
- package/app/components/catalog/product/add-station.vue +54 -0
- package/app/components/catalog/product/bestsellers.vue +57 -0
- package/app/components/catalog/product/bidding.vue +93 -0
- package/app/components/catalog/product/colorOptions.vue +58 -0
- package/app/components/catalog/product/deals.vue +46 -0
- package/app/components/catalog/product/exclusives.vue +56 -0
- package/app/components/catalog/product/featuredproducts.vue +57 -0
- package/app/components/catalog/product/giftCard.vue +63 -0
- package/app/components/catalog/product/latestproducts.vue +46 -0
- package/app/components/catalog/product/productCard.vue +105 -0
- package/app/components/catalog/product/productCompare.vue +60 -0
- package/app/components/catalog/product/productCompareTable.vue +441 -0
- package/app/components/catalog/product/productDetails.vue +126 -0
- package/app/components/catalog/product/productFaqs.vue +17 -0
- package/app/components/catalog/product/productGallery.vue +16 -0
- package/app/components/catalog/product/productQty.vue +54 -0
- package/app/components/catalog/product/productReviews.vue +56 -0
- package/app/components/catalog/product/productSpecs.vue +116 -0
- package/app/components/catalog/product/radiostation.vue +36 -0
- package/app/components/catalog/product/recentlyviewed.vue +43 -0
- package/app/components/catalog/product/relatedbrands.vue +54 -0
- package/app/components/catalog/product/relatedproducts.vue +43 -0
- package/app/components/catalog/product/relatedstations.vue +40 -0
- package/app/components/catalog/product/shippingOptions.vue +41 -0
- package/app/components/catalog/product/sizeOptions.vue +42 -0
- package/app/components/catalog/product/update-attribute-set.vue +209 -0
- package/app/components/catalog/product/update-attribute.vue +118 -0
- package/app/components/catalog/product/update-product.vue +372 -0
- package/app/components/catalog/product/update-showcase.vue +153 -0
- package/app/components/catalog/shops/relatedstores.vue +37 -0
- package/app/components/catalog/shops/restaurant.vue +66 -0
- package/app/components/catalog/shops/stores.vue +44 -0
- package/app/components/catalog/vendor/README.md +3 -0
- package/app/components/catalog/vendor/blocks/biggestcustomers.vue +33 -0
- package/app/components/catalog/vendor/blocks/lowestselling.vue +33 -0
- package/app/components/catalog/vendor/blocks/topcategories.vue +33 -0
- package/app/components/catalog/vendor/blocks/topproducts.vue +27 -0
- package/app/components/catalog/vendor/pages/attributes.vue +43 -0
- package/app/components/catalog/vendor/pages/commissions.vue +43 -0
- package/app/components/catalog/vendor/pages/crm.vue +67 -0
- package/app/components/catalog/vendor/pages/dashboard.vue +46 -0
- package/app/components/catalog/vendor/pages/emails.vue +43 -0
- package/app/components/catalog/vendor/pages/enquiries.vue +43 -0
- package/app/components/catalog/vendor/pages/invoices.vue +43 -0
- package/app/components/catalog/vendor/pages/orders.vue +68 -0
- package/app/components/catalog/vendor/pages/products.vue +55 -0
- package/app/components/catalog/vendor/pages/reviews.vue +48 -0
- package/app/components/catalog/vendor/pages/shipments.vue +43 -0
- package/app/components/catalog/vendor/pages/stores.vue +43 -0
- package/app/components/categories/chart/[id].vue +200 -0
- package/app/components/categories/chart/add-chart.vue +142 -0
- package/app/components/categories/chart/chart.vue +82 -0
- package/app/components/categories/chart/monthlyChart.vue +46 -0
- package/app/components/categories/chart/weeklyChart.vue +46 -0
- package/app/components/categories/chart/yearlyChart.vue +46 -0
- package/app/components/categories/charts.vue +118 -0
- package/app/components/categories/deals.vue +101 -0
- package/app/components/categories/eats.vue +49 -0
- package/app/components/categories/restaurants.vue +26 -0
- package/app/components/categories/station/[id].vue +72 -0
- package/app/components/categories/stations.vue +124 -0
- package/app/components/categories/time/time.vue +63 -0
- package/app/components/categories/travel.vue +75 -0
- package/app/components/categories/weather/weather.vue +44 -0
- package/app/components/content/blocks/breadcrumbs.vue +0 -0
- package/app/components/content/blocks/currencySwitcher.vue +0 -0
- package/app/components/content/blocks/languageSwitcher.vue +0 -0
- package/app/components/content/blocks/videoproduct.vue +9 -0
- package/app/components/content/pages/checkout.vue +118 -0
- package/app/components/content/pages/meeoviGlobal.vue +68 -0
- package/app/components/content/pages/pickup-locations.vue +238 -0
- package/app/components/content/pages/showcases.vue +90 -0
- package/app/components/content/pages/success.vue +60 -0
- package/app/components/marketing/add-brand.vue +54 -0
- package/app/components/marketing/add-incentive.vue +54 -0
- package/app/components/marketing/promotions/giftcards.vue +102 -0
- package/app/components/marketing/promotions/subscriptions.vue +121 -0
- package/app/components/marketing/update-incentive.vue +326 -0
- package/app/components/menus/lowernav.vue +78 -0
- package/app/components/partials/LocaleSelector.vue +24 -0
- package/app/components/partials/ShoppingCart.vue +128 -0
- package/app/components/partials/StripePayment.vue +149 -0
- package/app/components/partials/addToCartBtn.vue +40 -0
- package/app/components/partials/cartItem.vue +124 -0
- package/app/components/partials/checkoutButton.vue +44 -0
- package/app/components/partials/compareBtn.vue +68 -0
- package/app/components/partials/ratings.vue +13 -0
- package/app/components/partials/store/CurrencySelector.vue +133 -0
- package/app/components/partials/store/StoreSwitcher.vue +13 -0
- package/app/components/placeholders/Comments.vue +15 -0
- package/app/components/placeholders/CreateListBtn.vue +7 -0
- package/app/components/placeholders/Event.vue +9 -0
- package/app/components/placeholders/ListShowcases.vue +9 -0
- package/app/components/placeholders/Short.vue +9 -0
- package/app/components/placeholders/Space.vue +9 -0
- package/app/components/placeholders/Tag.vue +7 -0
- package/app/components/related/brandCard.vue +41 -0
- package/app/components/related/incentiveCard.vue +44 -0
- package/app/components/related/invoiceCard.vue +43 -0
- package/app/components/related/orderCard.vue +43 -0
- package/app/components/related/relatedproducts.vue +17 -0
- package/app/components/sales/CartPageContent/CartPageContent.vue +37 -0
- package/app/components/sales/CheckoutAddress/CheckoutAddress.vue +50 -0
- package/app/components/sales/CheckoutAddress/__tests__/CheckoutAddress.spec.ts +16 -0
- package/app/components/sales/CheckoutAddress/types.ts +16 -0
- package/app/components/sales/CheckoutPayment/CheckoutPayment.vue +68 -0
- package/app/components/sales/CheckoutPayment/__tests__/CheckoutPayment.spec.ts +14 -0
- package/app/components/sales/CheckoutPayment/types.ts +12 -0
- package/app/components/sales/OrderSummary/OrderSummary.vue +57 -0
- package/app/components/sales/OrderSummary/__tests__/ContactInformation.spec.ts +52 -0
- package/app/components/sales/OrderSummary/types.ts +5 -0
- package/app/components/sales/incentives.vue +223 -0
- package/app/components/sales/invoices.vue +107 -0
- package/app/components/sales/orders.vue +378 -0
- package/app/components/sales/shipments.vue +65 -0
- package/app/components/sales/transactions.vue +109 -0
- package/app/components/shop/add-shop.vue +54 -0
- package/app/components/shop/cart/cartItem.vue +182 -0
- package/app/components/shop/cart/checkout.vue +415 -0
- package/app/components/shop/checkout/StripeCardElement.vue +206 -0
- package/app/components/shop/checkout/StripeCheckout.vue +49 -0
- package/app/components/shop/checkout/addressBilling.vue +263 -0
- package/app/components/shop/checkout/addressShipping.vue +175 -0
- package/app/components/shop/checkout/cart/ProductItem.vue +56 -0
- package/app/components/shop/checkout/cart/PromotionItem.vue +53 -0
- package/app/composables/_types.ts +18 -0
- package/app/composables/adapters/abstract/cartAdapter.ts +0 -0
- package/app/composables/adapters/abstract/categoryAdapter.ts +0 -0
- package/app/composables/adapters/abstract/customerAdapter.ts +0 -0
- package/app/composables/adapters/abstract/inventoryAdapter.ts +0 -0
- package/app/composables/adapters/abstract/orderAdapter.ts +0 -0
- package/app/composables/adapters/abstract/productAdapter.ts +7 -0
- package/app/composables/cart/registry.ts +20 -0
- package/app/composables/cart/types.ts +18 -0
- package/app/composables/cart/useCart.ts +15 -0
- package/app/composables/config.ts +19 -0
- package/app/composables/defs/apiDefinitions.ts +55 -0
- package/app/composables/defs/extension.feature +40 -0
- package/app/composables/defs/extension.mocks.ts +39 -0
- package/app/composables/defs/extension.test.ts +280 -0
- package/app/composables/defs/extension.ts +236 -0
- package/app/composables/defs/index.ts +3 -0
- package/app/composables/defs/types.ts +136 -0
- package/app/composables/domain/cart.ts +0 -0
- package/app/composables/domain/category.ts +0 -0
- package/app/composables/domain/order.ts +0 -0
- package/app/composables/domain/price.ts +0 -0
- package/app/composables/domain/product.ts +8 -0
- package/app/composables/domain/reward.ts +0 -0
- package/app/composables/domain/transactions.ts +0 -0
- package/app/composables/helpers/contextualizedNormalizers.feature +14 -0
- package/app/composables/helpers/contextualizedNormalizers.test.ts +85 -0
- package/app/composables/helpers/contextualizedNormalizers.ts +20 -0
- package/app/composables/helpers/index.ts +1 -0
- package/app/composables/index.ts +6 -0
- package/app/composables/methods/auth.ts +83 -0
- package/app/composables/methods/cart.ts +119 -0
- package/app/composables/methods/category.ts +27 -0
- package/app/composables/methods/checkout.ts +54 -0
- package/app/composables/methods/customer.ts +52 -0
- package/app/composables/methods/helpers.ts +5 -0
- package/app/composables/methods/index.ts +75 -0
- package/app/composables/methods/order.ts +39 -0
- package/app/composables/methods/product.ts +95 -0
- package/app/composables/methods/settings.ts +16 -0
- package/app/composables/models/cart.ts +95 -0
- package/app/composables/models/category.ts +13 -0
- package/app/composables/models/checkout.ts +17 -0
- package/app/composables/models/customer.ts +16 -0
- package/app/composables/models/facets.ts +25 -0
- package/app/composables/models/index.ts +94 -0
- package/app/composables/models/order.ts +43 -0
- package/app/composables/models/product.ts +73 -0
- package/app/composables/models/shared.ts +75 -0
- package/app/composables/products/registry.ts +20 -0
- package/app/composables/products/types.ts +13 -0
- package/app/composables/products/useEvents.ts +0 -0
- package/app/composables/products/useGiftCards.ts +0 -0
- package/app/composables/products/useProducts.ts +12 -0
- package/app/composables/products/useSubscriptions.ts +0 -0
- package/app/composables/registry.ts +21 -0
- package/app/composables/stores/cart.ts +218 -0
- package/app/composables/stores/cartStore.ts +300 -0
- package/app/composables/stores/checkout.ts +19 -0
- package/app/composables/stores/compare.ts +65 -0
- package/app/composables/stores/currency.js +29 -0
- package/app/composables/stores/digital-products.js +11 -0
- package/app/composables/stores/index.js +0 -0
- package/app/composables/stores/orders.ts +161 -0
- package/app/composables/stores/product.ts +26 -0
- package/app/composables/stores/productList.ts +0 -0
- package/app/composables/stores/productListInfo.ts +0 -0
- package/app/composables/stores/products.ts +112 -0
- package/app/composables/stores/recentlyViewedProducts.ts +0 -0
- package/app/composables/stores/review.ts +25 -0
- package/app/composables/stores/storeInPickUp.ts +22 -0
- package/app/composables/stores/user.ts +20 -0
- package/app/composables/stores/wishlist.ts +19 -0
- package/app/composables/types/Order.type.ts +181 -0
- package/app/composables/types/index.ts +285 -0
- package/app/composables/types/product.ts +14 -0
- package/app/composables/useBreakpoints/index.ts +1 -0
- package/app/composables/useBreakpoints/useBreakpoints.ts +28 -0
- package/app/composables/useCart/__tests__/useCart.spec.ts +11 -0
- package/app/composables/useCart/index.ts +1 -0
- package/app/composables/useCart/types.ts +17 -0
- package/app/composables/useCart/useCart.ts +46 -0
- package/app/composables/useCartShippingMethods/__tests__/useCartShippingMethods.spec.ts +11 -0
- package/app/composables/useCartShippingMethods/index.ts +1 -0
- package/app/composables/useCartShippingMethods/types.ts +17 -0
- package/app/composables/useCartShippingMethods/useCartShippingMethods.ts +47 -0
- package/app/composables/useCatalog.ts +64 -0
- package/app/composables/useContent/index.ts +1 -0
- package/app/composables/useContent/types.ts +44 -0
- package/app/composables/useContent/useContent.ts +45 -0
- package/app/composables/useContent.ts +57 -0
- package/app/composables/useCustomer/__tests__/useCustomer.spec.ts +25 -0
- package/app/composables/useCustomer/index.ts +2 -0
- package/app/composables/useCustomer/types.ts +17 -0
- package/app/composables/useCustomer/useCustomer.ts +40 -0
- package/app/composables/useCustomerAddress/__tests__/useCustomerAddress.spec.ts +11 -0
- package/app/composables/useCustomerAddress/index.ts +2 -0
- package/app/composables/useCustomerAddress/types.ts +17 -0
- package/app/composables/useCustomerAddress/useCustomerAddress.ts +55 -0
- package/app/composables/useCustomerOrder/__tests__/useCustomerOrder.spec.ts +11 -0
- package/app/composables/useCustomerOrder/adress.ts +10 -0
- package/app/composables/useCustomerOrder/index.ts +2 -0
- package/app/composables/useCustomerOrder/product.ts +37 -0
- package/app/composables/useCustomerOrder/types.ts +40 -0
- package/app/composables/useCustomerOrder/useCustomerOrder.ts +63 -0
- package/app/composables/useCustomerOrders/__tests__/useCustomerOrders.spec.ts +11 -0
- package/app/composables/useCustomerOrders/index.ts +2 -0
- package/app/composables/useCustomerOrders/types.ts +20 -0
- package/app/composables/useCustomerOrders/useCustomerOrders.ts +56 -0
- package/app/composables/useCustomerReturns/__tests__/useCustomerReturns.spec.ts +11 -0
- package/app/composables/useCustomerReturns/index.ts +2 -0
- package/app/composables/useCustomerReturns/types.ts +17 -0
- package/app/composables/useCustomerReturns/useCustomerReturns.ts +41 -0
- package/app/composables/useHandleError/index.ts +1 -0
- package/app/composables/useHandleError/types.ts +11 -0
- package/app/composables/useHandleError/useHandleError.ts +27 -0
- package/app/composables/usePageTitle.ts +16 -0
- package/app/composables/useProduct/index.ts +2 -0
- package/app/composables/useProduct/types.ts +17 -0
- package/app/composables/useProduct/useProduct.ts +42 -0
- package/app/composables/useProductAttribute/__tests__/useProduct.mock.ts +31 -0
- package/app/composables/useProductAttribute/__tests__/useProductAttribute.spec.ts +14 -0
- package/app/composables/useProductAttribute/index.ts +1 -0
- package/app/composables/useProductAttribute/useProductAttribute.ts +37 -0
- package/app/composables/useProductRecommended/__tests__/useProductRecommended.spec.ts +12 -0
- package/app/composables/useProductRecommended/index.ts +1 -0
- package/app/composables/useProductRecommended/types.ts +17 -0
- package/app/composables/useProductRecommended/useProductRecommended.ts +43 -0
- package/app/composables/useProductReviews/__tests__/productReviews.mock.ts +20 -0
- package/app/composables/useProductReviews/__tests__/useProductReviews.spec.ts +22 -0
- package/app/composables/useProductReviews/index.ts +2 -0
- package/app/composables/useProductReviews/types.ts +17 -0
- package/app/composables/useProductReviews/useProductReviews.ts +46 -0
- package/app/composables/useProducts/__tests__/useProducts.spec.ts +11 -0
- package/app/composables/useProducts/types.ts +22 -0
- package/app/composables/useProducts/useProducts.ts +41 -0
- package/app/composables/utils/countryList.ts +14 -0
- package/app/composables/utils/currency.js +56 -0
- package/app/composables/utils/glossary.ts +0 -0
- package/app/composables/utils/importExport.ts +0 -0
- package/app/composables/utils/index.js +0 -0
- package/app/composables/utils/print.ts +0 -0
- package/app/composables/utils/shopThemes.ts +0 -0
- package/app/composables/utils/statistics.ts +0 -0
- package/app/composables/utils/stock.ts +0 -0
- package/app/composables/utils/stripe.ts +16 -0
- package/app/composables/utils/taxation.ts +0 -0
- package/app/composables/utils/tellFriends.ts +0 -0
- package/app/composables/validationRules/index.ts +1 -0
- package/app/composables/validationRules/password.feature +67 -0
- package/app/composables/validationRules/password.test.ts +89 -0
- package/app/composables/validationRules/password.ts +25 -0
- package/app/composables/vendors/index.ts +0 -0
- package/app/composables/vendors/registry.ts +0 -0
- package/app/composables/vendors/useAffiliates.ts +0 -0
- package/app/composables/vendors/useCommission.ts +0 -0
- package/app/modules/vue-head/composables/useHead.ts +3 -0
- package/app/pages/brand/[...slug].vue +92 -0
- package/app/pages/brands.vue +90 -0
- package/app/pages/cart.vue +142 -0
- package/app/pages/compare.vue +166 -0
- package/app/pages/departments/[...slug].vue +385 -0
- package/app/pages/departments/category/[...slug].vue +135 -0
- package/app/pages/incentive/[...id].vue +66 -0
- package/app/pages/invoice/[id].vue +309 -0
- package/app/pages/order/[id].vue +327 -0
- package/app/pages/product/[...id].vue +309 -0
- package/app/pages/product/showcases/index.vue +86 -0
- package/app/pages/shipment/[...id].vue +176 -0
- package/app/pages/shop/[...slug].vue +158 -0
- package/app/pages/shops.vue +76 -0
- package/app/pages/subscription/[...id].vue +147 -0
- package/app/pages/transaction/[...id].vue +74 -0
- package/app/types/shims-imports.d.ts +13 -0
- package/app/utils/client.ts +26 -0
- package/app/utils/index.ts +53 -0
- package/app/utils/normalizer.ts +23 -0
- package/app/utils/normalizers/magento.ts +29 -0
- package/app/utils/normalizers/shopify.ts +29 -0
- package/global.d.ts +149 -0
- package/index.js +3 -0
- package/package.json +3 -9
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<form id="payment-form">
|
|
4
|
+
<div id="payment-element">
|
|
5
|
+
<!-- Stripe Elements will inject the payment form here -->
|
|
6
|
+
</div>
|
|
7
|
+
<button id="submit" :disabled="isLoading">
|
|
8
|
+
<span v-if="isLoading">Processing...</span>
|
|
9
|
+
<span v-else>Pay now</span>
|
|
10
|
+
</button>
|
|
11
|
+
<div v-if="errorMessage" class="error-message">
|
|
12
|
+
{{ errorMessage }}
|
|
13
|
+
</div>
|
|
14
|
+
</form>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
const { $stripe } = useNuxtApp()
|
|
20
|
+
const elements = ref(null)
|
|
21
|
+
const isLoading = ref(false)
|
|
22
|
+
const errorMessage = ref('')
|
|
23
|
+
|
|
24
|
+
// Initialize payment element
|
|
25
|
+
onMounted(async () => {
|
|
26
|
+
// Get clientSecret from your server
|
|
27
|
+
const response = await fetch('/api/payment/create-payment-intent', {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json'
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify({
|
|
33
|
+
amount: 1000, // Amount in cents
|
|
34
|
+
currency: 'usd'
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
const { clientSecret } = await response.json()
|
|
38
|
+
|
|
39
|
+
elements.value = $stripe.elements({
|
|
40
|
+
clientSecret,
|
|
41
|
+
appearance: {
|
|
42
|
+
theme: 'stripe'
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const paymentElement = elements.value.create('payment')
|
|
47
|
+
paymentElement.mount('#payment-element')
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// Handle form submission
|
|
51
|
+
const handleSubmit = async (e) => {
|
|
52
|
+
e.preventDefault()
|
|
53
|
+
|
|
54
|
+
if (!elements.value) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
isLoading.value = true
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const { error } = await $stripe.confirmPayment({
|
|
62
|
+
elements: elements.value,
|
|
63
|
+
confirmParams: {
|
|
64
|
+
return_url: `${window.location.origin}/payment-completion`,
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
if (error) {
|
|
69
|
+
errorMessage.value = error.message
|
|
70
|
+
}
|
|
71
|
+
} catch (e) {
|
|
72
|
+
errorMessage.value = 'An unexpected error occurred.'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
isLoading.value = false
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style scoped>
|
|
80
|
+
form {
|
|
81
|
+
width: 100%;
|
|
82
|
+
max-width: 500px;
|
|
83
|
+
margin: 0 auto;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#payment-element {
|
|
87
|
+
margin-bottom: 24px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
button {
|
|
91
|
+
background: #5469d4;
|
|
92
|
+
color: #ffffff;
|
|
93
|
+
border-radius: 4px;
|
|
94
|
+
border: 0;
|
|
95
|
+
padding: 12px 16px;
|
|
96
|
+
font-size: 16px;
|
|
97
|
+
font-weight: 600;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
display: block;
|
|
100
|
+
width: 100%;
|
|
101
|
+
transition: all 0.2s ease;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
button:hover {
|
|
105
|
+
filter: brightness(1.1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
button:disabled {
|
|
109
|
+
opacity: 0.5;
|
|
110
|
+
cursor: default;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.error-message {
|
|
114
|
+
color: rgb(205, 53, 53);
|
|
115
|
+
margin-top: 12px;
|
|
116
|
+
text-align: center;
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="globalPage">
|
|
3
|
+
<v-row>
|
|
4
|
+
<v-col cols="6">
|
|
5
|
+
<v-list>
|
|
6
|
+
<v-list-item>
|
|
7
|
+
<h5>{{ page?.repeaterTextBox?.[0]?.description }}</h5>
|
|
8
|
+
</v-list-item>
|
|
9
|
+
|
|
10
|
+
<v-list-item>
|
|
11
|
+
<p>{{ page?.repeaterTextBox?.[1]?.description }}</p>
|
|
12
|
+
</v-list-item>
|
|
13
|
+
|
|
14
|
+
<v-list-item>
|
|
15
|
+
<v-menu>
|
|
16
|
+
<template v-slot:activator="{ props }">
|
|
17
|
+
<v-btn color="warning" v-bind="props">
|
|
18
|
+
{{ page?.repeaterTextBox?.[2]?.description }}
|
|
19
|
+
</v-btn>
|
|
20
|
+
</template>
|
|
21
|
+
<v-list>
|
|
22
|
+
<v-list-item v-for="(sites, index) in sites" :key="index" :value="index">
|
|
23
|
+
<v-list-item :prepend-icon="sites?.icon" :href="`https://www.meeovi${sites?.url}`">{{ sites?.name }}</v-list-item>
|
|
24
|
+
</v-list-item>
|
|
25
|
+
</v-list>
|
|
26
|
+
</v-menu>
|
|
27
|
+
</v-list-item>
|
|
28
|
+
|
|
29
|
+
<v-list-item>
|
|
30
|
+
<div style="display: inline-block;"><p><strong>Note: </strong>{{ page?.repeaterTextBox?.[3]?.description }}</p></div>
|
|
31
|
+
</v-list-item>
|
|
32
|
+
</v-list>
|
|
33
|
+
</v-col>
|
|
34
|
+
|
|
35
|
+
<v-col cols="6">
|
|
36
|
+
<v-list>
|
|
37
|
+
<v-list-item>
|
|
38
|
+
<h5>{{ page?.repeaterTextBox?.[4]?.description }}</h5>
|
|
39
|
+
</v-list-item>
|
|
40
|
+
|
|
41
|
+
<v-list-item>
|
|
42
|
+
<p>{{ page?.repeaterTextBox?.[5]?.description }}</p>
|
|
43
|
+
</v-list-item>
|
|
44
|
+
</v-list>
|
|
45
|
+
</v-col>
|
|
46
|
+
|
|
47
|
+
<v-divider></v-divider>
|
|
48
|
+
</v-row>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
const {
|
|
54
|
+
$directus,
|
|
55
|
+
$readItems,
|
|
56
|
+
$readItem
|
|
57
|
+
} = useNuxtApp()
|
|
58
|
+
|
|
59
|
+
const {
|
|
60
|
+
data: page
|
|
61
|
+
} = await useAsyncData('page', () => {
|
|
62
|
+
return $directus.request($readItem('page', '46', {
|
|
63
|
+
fields: ['*', {
|
|
64
|
+
'*': ['*']
|
|
65
|
+
}]
|
|
66
|
+
}))
|
|
67
|
+
})
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="customerDashboard">
|
|
3
|
+
<v-row>
|
|
4
|
+
<v-toolbar color="transparent">
|
|
5
|
+
<v-toolbar-title>{{ pickupBlocks?.content?.[0]?.name }}</v-toolbar-title>
|
|
6
|
+
</v-toolbar>
|
|
7
|
+
|
|
8
|
+
<!-- Search and Filter Section -->
|
|
9
|
+
<v-col cols="12" class="mb-4">
|
|
10
|
+
<v-card>
|
|
11
|
+
<v-card-text>
|
|
12
|
+
<v-row>
|
|
13
|
+
<v-col cols="4">
|
|
14
|
+
<v-text-field v-model="searchAddress" label="Search by address"
|
|
15
|
+
@keyup.enter="searchByAddress"></v-text-field>
|
|
16
|
+
</v-col>
|
|
17
|
+
<v-col cols="3">
|
|
18
|
+
<v-select v-model="selectedRadius" :items="radiusOptions" label="Search radius"></v-select>
|
|
19
|
+
</v-col>
|
|
20
|
+
<v-col cols="2">
|
|
21
|
+
<v-btn color="primary" @click="searchByAddress">Search</v-btn>
|
|
22
|
+
</v-col>
|
|
23
|
+
</v-row>
|
|
24
|
+
</v-card-text>
|
|
25
|
+
</v-card>
|
|
26
|
+
</v-col>
|
|
27
|
+
|
|
28
|
+
<!-- Locations List -->
|
|
29
|
+
<v-col cols="4">
|
|
30
|
+
<template v-if="pickupLocations.length">
|
|
31
|
+
<v-card class="mx-auto mb-4" prepend-icon="$vuetify" :subtitle="pickupBlocks?.content?.[0]?.url_name"
|
|
32
|
+
width="100%" v-for="location in pickupLocations" :key="location?.id" @click="selectLocation(location)">
|
|
33
|
+
<template v-slot:title>
|
|
34
|
+
<span class="font-weight-black">{{ location?.name }}</span>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<v-card-text class="bg-surface-light pt-4">
|
|
38
|
+
<div>{{ pickupBlocks?.menus?.[0]?.name }} {{ location?.street }}</div>
|
|
39
|
+
<div>{{ pickupBlocks?.menus?.[1]?.name }} {{ location?.city }}</div>
|
|
40
|
+
<div>{{ pickupBlocks?.menus?.[2]?.name }} {{ location?.postcode }}</div>
|
|
41
|
+
<div>{{ pickupBlocks?.menus?.[3]?.name }} {{ location?.phone }}</div>
|
|
42
|
+
<div>{{ pickupBlocks?.menus?.[4]?.name }} {{ location?.email }}</div>
|
|
43
|
+
<div>{{ pickupBlocks?.menus?.[5]?.name }} {{ location?.region }}</div>
|
|
44
|
+
<div>{{ pickupBlocks?.menus?.[6]?.name }} {{ location?.description }}</div>
|
|
45
|
+
<div v-if="location.distance">Distance: {{ formatDistance(location.distance) }}</div>
|
|
46
|
+
</v-card-text>
|
|
47
|
+
</v-card>
|
|
48
|
+
</template>
|
|
49
|
+
<template v-else>
|
|
50
|
+
<v-card class="mx-auto mb-4" width="100%" elevation="0">
|
|
51
|
+
<v-card-text class="text-center">
|
|
52
|
+
<p class="text-h6" v-dompurify-html="pickupBlocks?.content?.[0]?.content"></p>
|
|
53
|
+
</v-card-text>
|
|
54
|
+
</v-card>
|
|
55
|
+
</template>
|
|
56
|
+
</v-col>
|
|
57
|
+
|
|
58
|
+
<!-- Map Section -->
|
|
59
|
+
<v-col cols="8">
|
|
60
|
+
<client-only>
|
|
61
|
+
<Map style="height: 600px" :zoom="mapZoom" :center="mapCenter" :use-global-leaflet="false">
|
|
62
|
+
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
63
|
+
attribution="© 'https://www.openstreetmap.org'; contributors" layer-type="base"
|
|
64
|
+
name="OpenStreetMap" />
|
|
65
|
+
<template v-if="pickupLocations.length">
|
|
66
|
+
<Marker v-for="location in pickupLocations" :key="location.id"
|
|
67
|
+
:lat-lng="[location?.latitude, location?.longitude]" @click="selectLocation(location)">
|
|
68
|
+
<Popup>{{ location?.name }}</Popup>
|
|
69
|
+
</Marker>
|
|
70
|
+
</template>
|
|
71
|
+
</Map>
|
|
72
|
+
</client-only>
|
|
73
|
+
</v-col>
|
|
74
|
+
|
|
75
|
+
<v-col cols="12">
|
|
76
|
+
<latestproducts />
|
|
77
|
+
</v-col>
|
|
78
|
+
</v-row>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script setup>
|
|
83
|
+
import {
|
|
84
|
+
ref,
|
|
85
|
+
computed,
|
|
86
|
+
onMounted
|
|
87
|
+
} from 'vue';
|
|
88
|
+
import latestproducts from '#commerce/app/components/catalog/product/latestproducts.vue';
|
|
89
|
+
|
|
90
|
+
// State
|
|
91
|
+
const locations = ref([]);
|
|
92
|
+
const selectedLocation = ref(null);
|
|
93
|
+
const searchAddress = ref('');
|
|
94
|
+
const selectedRadius = ref(25);
|
|
95
|
+
const mapZoom = ref(12);
|
|
96
|
+
const loading = ref(false);
|
|
97
|
+
const error = ref(null);
|
|
98
|
+
|
|
99
|
+
// Constants
|
|
100
|
+
const radiusOptions = [{
|
|
101
|
+
title: '10 miles',
|
|
102
|
+
value: 10
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: '25 miles',
|
|
106
|
+
value: 25
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
title: '50 miles',
|
|
110
|
+
value: 50
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: '100 miles',
|
|
114
|
+
value: 100
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
// Computed
|
|
119
|
+
const mapCenter = computed(() => {
|
|
120
|
+
if (selectedLocation.value) {
|
|
121
|
+
return [selectedLocation.value.latitude, selectedLocation.value.longitude];
|
|
122
|
+
}
|
|
123
|
+
if (locations.value.length) {
|
|
124
|
+
return [locations.value[0].latitude, locations.value[0].longitude];
|
|
125
|
+
}
|
|
126
|
+
return [47.21322, -1.559482]; // Default center
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Methods
|
|
130
|
+
const loadLocations = async () => {
|
|
131
|
+
try {
|
|
132
|
+
loading.value = true;
|
|
133
|
+
const result = await getPickupLocations();
|
|
134
|
+
locations.value = result.items || [];
|
|
135
|
+
} catch (err) {
|
|
136
|
+
error.value = err.message;
|
|
137
|
+
console.error('Error loading locations:', err);
|
|
138
|
+
} finally {
|
|
139
|
+
loading.value = false;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const searchByAddress = async () => {
|
|
144
|
+
try {
|
|
145
|
+
loading.value = true;
|
|
146
|
+
error.value = null;
|
|
147
|
+
|
|
148
|
+
// Get coordinates from address using browser's geolocation API
|
|
149
|
+
const coordinates = await getCoordinatesFromAddress(searchAddress.value);
|
|
150
|
+
|
|
151
|
+
const searchParams = {
|
|
152
|
+
searchTerm: searchAddress.value,
|
|
153
|
+
latitude: coordinates.latitude,
|
|
154
|
+
longitude: coordinates.longitude,
|
|
155
|
+
radius: selectedRadius.value
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const result = await getPickupLocationsByDistance(searchParams);
|
|
159
|
+
locations.value = result.items || [];
|
|
160
|
+
|
|
161
|
+
if (locations.value.length) {
|
|
162
|
+
mapZoom.value = 12;
|
|
163
|
+
selectedLocation.value = locations.value[0];
|
|
164
|
+
}
|
|
165
|
+
} catch (err) {
|
|
166
|
+
error.value = err.message;
|
|
167
|
+
console.error('Error searching locations:', err);
|
|
168
|
+
} finally {
|
|
169
|
+
loading.value = false;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const selectLocation = (location) => {
|
|
174
|
+
selectedLocation.value = location;
|
|
175
|
+
mapZoom.value = 15;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const formatDistance = (distance) => {
|
|
179
|
+
return `${Math.round(distance * 10) / 10} miles`;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// Helper function to get coordinates from address
|
|
183
|
+
const getCoordinatesFromAddress = async (address) => {
|
|
184
|
+
try {
|
|
185
|
+
// You might want to use a geocoding service here
|
|
186
|
+
// For now, returning mock coordinates
|
|
187
|
+
return {
|
|
188
|
+
latitude: 47.21322,
|
|
189
|
+
longitude: -1.559482
|
|
190
|
+
};
|
|
191
|
+
} catch (error) {
|
|
192
|
+
console.error('Error getting coordinates:', error);
|
|
193
|
+
throw new Error('Unable to get coordinates from address');
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// Directus setup
|
|
198
|
+
const {
|
|
199
|
+
$directus,
|
|
200
|
+
$readItem
|
|
201
|
+
} = useNuxtApp();
|
|
202
|
+
|
|
203
|
+
const {
|
|
204
|
+
data: pickupBlocks
|
|
205
|
+
} = await useAsyncData('pickupBlocks', () => {
|
|
206
|
+
return $directus.request($readItem('page_blocks', '10', {
|
|
207
|
+
fields: ['*', 'media.directus_files_id.filename_disk', 'content.*'],
|
|
208
|
+
}))
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const {
|
|
212
|
+
data: pickupLocations
|
|
213
|
+
} = await useAsyncData('pickupLocations', () => {
|
|
214
|
+
return $directus.request($readItem('pages', '33', {
|
|
215
|
+
fields: ['*', 'image.*'],
|
|
216
|
+
}))
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Initial load
|
|
220
|
+
onMounted(() => {
|
|
221
|
+
loadLocations();
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Meta
|
|
225
|
+
definePageMeta({
|
|
226
|
+
layout: 'nolive',
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
useHead({
|
|
230
|
+
title: 'Pickup Locations',
|
|
231
|
+
});
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<style scoped>
|
|
235
|
+
.customerDashboard {
|
|
236
|
+
padding: 20px;
|
|
237
|
+
}
|
|
238
|
+
</style>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-card variant="text">
|
|
4
|
+
<v-toolbar
|
|
5
|
+
:style="`background-color: ${showcasePage?.color}; color: ${showcasePage?.colortext} !important`">
|
|
6
|
+
<v-toolbar-title>{{ showcasePage?.name }}</v-toolbar-title>
|
|
7
|
+
|
|
8
|
+
<v-tabs v-model="currentTab" fixed-tabs>
|
|
9
|
+
|
|
10
|
+
<v-tab :value="'create'">
|
|
11
|
+
<createshowcase />
|
|
12
|
+
</v-tab>
|
|
13
|
+
</v-tabs>
|
|
14
|
+
</v-toolbar>
|
|
15
|
+
|
|
16
|
+
<v-tabs-window v-model="currentTab">
|
|
17
|
+
<v-tabs-window-item v-for="(menu, index) in showcaseBar" :key="menu?.value ?? index"
|
|
18
|
+
:value="menu?.value ?? menu">
|
|
19
|
+
<component :is="contentComponents[index] || null" />
|
|
20
|
+
</v-tabs-window-item>
|
|
21
|
+
</v-tabs-window>
|
|
22
|
+
</v-card>
|
|
23
|
+
|
|
24
|
+
<section data-bs-version="5.1" class="features03 flavorm5 cid-uHg490M3EL" id="features03-at">
|
|
25
|
+
<div class="container">
|
|
26
|
+
<div class="row">
|
|
27
|
+
<div class="item features-image col-12 col-lg-6" v-for="(list, index) in lists" :key="index">
|
|
28
|
+
<listShowcases :list="list" />
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</section>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
import createshowcase from '@/components/catalog/product/add-showcase.vue'
|
|
38
|
+
import listShowcases from '@/components/placeholders/ListShowcases.vue'
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
$directus,
|
|
42
|
+
$readItem,
|
|
43
|
+
$readItems
|
|
44
|
+
} = useNuxtApp()
|
|
45
|
+
|
|
46
|
+
// current selected tab value (matches menu.value)
|
|
47
|
+
const currentTab = ref(null);
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
data: showcasePage
|
|
51
|
+
} = await useAsyncData('showcasePage', () => {
|
|
52
|
+
return $directus.request($readItem('pages', '115', {
|
|
53
|
+
fields: ['*', {
|
|
54
|
+
'*': ['*']
|
|
55
|
+
}]
|
|
56
|
+
}))
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const {
|
|
60
|
+
data: lists
|
|
61
|
+
} = await useAsyncData('lists', () => {
|
|
62
|
+
return $directus.request($readItems('lists', {
|
|
63
|
+
fields: ['*', {
|
|
64
|
+
'*': ['*']
|
|
65
|
+
}],
|
|
66
|
+
filter: {
|
|
67
|
+
lists_type: {
|
|
68
|
+
lists_type_id: {
|
|
69
|
+
name: {
|
|
70
|
+
_eq: "Showcase"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
status: {
|
|
75
|
+
_eq: "Public"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}))
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const {
|
|
82
|
+
data: showcaseBar
|
|
83
|
+
} = await useAsyncData('showcaseBar', () => {
|
|
84
|
+
return $directus.request($readItem('navigation', '54', {
|
|
85
|
+
fields: ['*', {
|
|
86
|
+
'*': ['*']
|
|
87
|
+
}]
|
|
88
|
+
}))
|
|
89
|
+
})
|
|
90
|
+
</script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container class="text-center">
|
|
3
|
+
<v-row justify="center">
|
|
4
|
+
<v-col cols="12" md="8">
|
|
5
|
+
<v-card class="pa-6">
|
|
6
|
+
<v-icon color="success" size="64" class="mb-4">mdi-check-circle</v-icon>
|
|
7
|
+
<h1 class="text-h4 mb-4">Thank You for Your Purchase!</h1>
|
|
8
|
+
<p class="text-body-1 mb-4">
|
|
9
|
+
Your order has been successfully placed. We've sent a confirmation email to your registered email address.
|
|
10
|
+
</p>
|
|
11
|
+
<p class="text-body-1 mb-6">
|
|
12
|
+
Order ID: {{ orderId }}
|
|
13
|
+
</p>
|
|
14
|
+
<v-btn
|
|
15
|
+
color="primary"
|
|
16
|
+
@click="router.push('/')"
|
|
17
|
+
class="mr-4"
|
|
18
|
+
>
|
|
19
|
+
Continue Shopping
|
|
20
|
+
</v-btn>
|
|
21
|
+
<v-btn
|
|
22
|
+
color="secondary"
|
|
23
|
+
@click="router.push('/orders')"
|
|
24
|
+
>
|
|
25
|
+
View Orders
|
|
26
|
+
</v-btn>
|
|
27
|
+
</v-card>
|
|
28
|
+
</v-col>
|
|
29
|
+
</v-row>
|
|
30
|
+
</v-container>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script setup>
|
|
34
|
+
import { ref, onMounted } from 'vue';
|
|
35
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
36
|
+
|
|
37
|
+
const route = useRoute();
|
|
38
|
+
const router = useRouter();
|
|
39
|
+
const orderId = ref('');
|
|
40
|
+
|
|
41
|
+
onMounted(async () => {
|
|
42
|
+
const sessionId = route.query.session_id;
|
|
43
|
+
if (sessionId) {
|
|
44
|
+
try {
|
|
45
|
+
// Here you would typically fetch the order details from your backend
|
|
46
|
+
// using the session ID
|
|
47
|
+
orderId.value = sessionId;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('Error fetching order details:', error);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
.v-card {
|
|
57
|
+
border-radius: 8px;
|
|
58
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row justify="center">
|
|
3
|
+
<v-dialog v-model="dialog" :scrim="false" transition="dialog-bottom-transition">
|
|
4
|
+
<template v-slot:activator="{ props }">
|
|
5
|
+
<v-btn v-bind="props" class="rightAddBtn">
|
|
6
|
+
<v-icon start icon="fas:fa fa-plus"></v-icon>Create a Brand
|
|
7
|
+
</v-btn>
|
|
8
|
+
</template>
|
|
9
|
+
<v-card class="b-1">
|
|
10
|
+
<v-card-title>
|
|
11
|
+
<h3>Create New Brand</h3>
|
|
12
|
+
</v-card-title>
|
|
13
|
+
|
|
14
|
+
<v-card-text>
|
|
15
|
+
<div v-if="formError" class="error">{{ formError }}</div>
|
|
16
|
+
<div v-else-if="formSuccess" class="success">{{ formSuccess }}</div>
|
|
17
|
+
<form @submit.prevent="submitForm">
|
|
18
|
+
<DirectusFormElement v-for="field in brandFields" :key="field.field" :field="field" v-model="form[field.field]" />
|
|
19
|
+
<v-btn type="submit">Submit</v-btn>
|
|
20
|
+
</form>
|
|
21
|
+
</v-card-text>
|
|
22
|
+
</v-card>
|
|
23
|
+
</v-dialog>
|
|
24
|
+
</v-row>
|
|
25
|
+
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import { ref } from 'vue'
|
|
30
|
+
import DirectusFormElement from '#shared/app/components/ui/forms/DirectusFormElement.vue'
|
|
31
|
+
import { useDirectusForm } from '#shared/app/composables/globals/useDirectusForm'
|
|
32
|
+
|
|
33
|
+
const dialog = ref(false)
|
|
34
|
+
const { $directus, $readFieldsByCollection } = useNuxtApp()
|
|
35
|
+
|
|
36
|
+
const { data, error } = await useAsyncData('brands', async () => {
|
|
37
|
+
return $directus.request($readFieldsByCollection('brands'))
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// guard against undefined/null data.value and empty arrays
|
|
41
|
+
if (error.value || data.value == null || (data.value?.length ?? 0) === 0) {
|
|
42
|
+
console.error(error)
|
|
43
|
+
throw createError({
|
|
44
|
+
statusCode: 404,
|
|
45
|
+
statusMessage: 'Brand not found'
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const brandFields = data
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// use composable for form handling (validation, submit, provide context)
|
|
53
|
+
const { form, formError, formSuccess, submitForm } = useDirectusForm('brands', brandFields, { clearOnSuccess: true, closeDialogRef: dialog })
|
|
54
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row justify="center">
|
|
3
|
+
<v-dialog v-model="dialog" :scrim="false" transition="dialog-bottom-transition">
|
|
4
|
+
<template v-slot:activator="{ props }">
|
|
5
|
+
<v-btn v-bind="props" class="rightAddBtn">
|
|
6
|
+
<v-icon start icon="fas:fa fa-plus"></v-icon>Create a Coupon
|
|
7
|
+
</v-btn>
|
|
8
|
+
</template>
|
|
9
|
+
<v-card class="b-1">
|
|
10
|
+
<v-card-title>
|
|
11
|
+
<h3>Create New Coupon</h3>
|
|
12
|
+
</v-card-title>
|
|
13
|
+
|
|
14
|
+
<v-card-text>
|
|
15
|
+
<div v-if="formError" class="error">{{ formError }}</div>
|
|
16
|
+
<div v-else-if="formSuccess" class="success">{{ formSuccess }}</div>
|
|
17
|
+
<form @submit.prevent="submitForm">
|
|
18
|
+
<DirectusFormElement v-for="field in couponFields" :key="field.field" :field="field" v-model="form[field.field]" />
|
|
19
|
+
<v-btn type="submit">Submit</v-btn>
|
|
20
|
+
</form>
|
|
21
|
+
</v-card-text>
|
|
22
|
+
</v-card>
|
|
23
|
+
</v-dialog>
|
|
24
|
+
</v-row>
|
|
25
|
+
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import { ref } from 'vue'
|
|
30
|
+
import DirectusFormElement from '#shared/app/components/ui/forms/DirectusFormElement.vue'
|
|
31
|
+
import { useDirectusForm } from '#shared/app/composables/globals/useDirectusForm'
|
|
32
|
+
|
|
33
|
+
const dialog = ref(false)
|
|
34
|
+
const { $directus, $readFieldsByCollection } = useNuxtApp()
|
|
35
|
+
|
|
36
|
+
const { data, error } = await useAsyncData('incentives', async () => {
|
|
37
|
+
return $directus.request($readFieldsByCollection('incentives'))
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// guard against undefined/null data.value and empty arrays
|
|
41
|
+
if (error.value || data.value == null || (data.value?.length ?? 0) === 0) {
|
|
42
|
+
console.error(error)
|
|
43
|
+
throw createError({
|
|
44
|
+
statusCode: 404,
|
|
45
|
+
statusMessage: 'Coupon not found'
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const couponFields = data
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// use composable for form handling (validation, submit, provide context)
|
|
53
|
+
const { form, formError, formSuccess, submitForm } = useDirectusForm('incentives', couponFields, { clearOnSuccess: true, closeDialogRef: dialog })
|
|
54
|
+
</script>
|