@revenexx/cover 0.1.0
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/LICENSE +21 -0
- package/README.md +39 -0
- package/app/api/account.ts +8 -0
- package/app/api/categories.ts +3 -0
- package/app/api/checkout.ts +6 -0
- package/app/api/images.ts +4 -0
- package/app/api/markets.ts +3 -0
- package/app/api/product.ts +3 -0
- package/app/api/products.ts +4 -0
- package/app/api/search.ts +4 -0
- package/app/app.config.ts +29 -0
- package/app/assets/css/cover.css +25 -0
- package/app/components/account/AccountMenu.vue +30 -0
- package/app/components/account/AccountShell.vue +18 -0
- package/app/components/account/AccountSidebar.vue +90 -0
- package/app/components/account/address/AccountAddressCard.vue +287 -0
- package/app/components/account/carts/AccountCartsTable.vue +284 -0
- package/app/components/account/dashboard/AccountDashboard.vue +351 -0
- package/app/components/account/directorder/AccountDirectOrder.vue +512 -0
- package/app/components/account/governance/AccountApprovalLimitsTable.vue +221 -0
- package/app/components/account/governance/AccountCostCenterDetail.vue +276 -0
- package/app/components/account/governance/AccountCostCentersTable.vue +252 -0
- package/app/components/account/governance/AccountRequisitionDetail.vue +295 -0
- package/app/components/account/governance/AccountRequisitionsTable.vue +255 -0
- package/app/components/account/governance/AccountWorkflowDetail.vue +215 -0
- package/app/components/account/governance/AccountWorkflowsTable.vue +168 -0
- package/app/components/account/governance/GovernanceApprovalLimitModal.vue +183 -0
- package/app/components/account/governance/GovernanceCostCenterModal.vue +188 -0
- package/app/components/account/governance/GovernanceWorkflowModal.vue +191 -0
- package/app/components/account/orderlists/AccountOrderListDetail.vue +349 -0
- package/app/components/account/orderlists/AccountOrderListsTable.vue +352 -0
- package/app/components/account/orders/AccountOrderDetail.vue +376 -0
- package/app/components/account/orders/AccountOrdersTable.vue +281 -0
- package/app/components/account/preferences/AccountPreferences.vue +50 -0
- package/app/components/auth/AuthForgotPasswordPanel.vue +88 -0
- package/app/components/auth/AuthLoginPanel.vue +103 -0
- package/app/components/auth/AuthLoginTeaser.vue +24 -0
- package/app/components/auth/AuthPageHeader.vue +21 -0
- package/app/components/auth/AuthRegisterPanel.vue +431 -0
- package/app/components/auth/AuthRegisterTeaser.vue +24 -0
- package/app/components/auth/AuthResetPasswordPanel.vue +115 -0
- package/app/components/cart/CartButton.vue +42 -0
- package/app/components/cart/actions/CartCostCenterModal.vue +110 -0
- package/app/components/cart/actions/CartExportModal.vue +82 -0
- package/app/components/cart/actions/CartPositionTextsModal.vue +92 -0
- package/app/components/cart/actions/CartSaveToListModal.vue +177 -0
- package/app/components/cart/actions/CartWorkflowPickerModal.vue +64 -0
- package/app/components/cart/drawer/CartDrawer.vue +49 -0
- package/app/components/cart/item/CartItem.vue +318 -0
- package/app/components/cart/manage/CartNameModal.vue +68 -0
- package/app/components/cart/position/CartPosition.vue +369 -0
- package/app/components/cart/quickadd/CartQuickAdd.vue +145 -0
- package/app/components/cart/recommend/CartCrossSell.vue +102 -0
- package/app/components/cart/recommend/CartRecommendCard.vue +59 -0
- package/app/components/cart/recommend/CartReorderStrip.vue +108 -0
- package/app/components/cart/requisition/CartRequisitionGroup.vue +74 -0
- package/app/components/cart/skeleton/CartSkeleton.vue +18 -0
- package/app/components/cart/summary/CartSummary.vue +25 -0
- package/app/components/cart/summary/CartSummaryBreakdown.vue +35 -0
- package/app/components/cart/switcher/CartSwitcher.vue +147 -0
- package/app/components/cart/target/CartTargetModal.vue +129 -0
- package/app/components/cart/view/CartApprovalsPanel.vue +89 -0
- package/app/components/cart/view/CartListHeader.vue +86 -0
- package/app/components/cart/view/CartPositionList.vue +94 -0
- package/app/components/cart/view/CartSummaryPanel.vue +254 -0
- package/app/components/cart/view/CartView.vue +310 -0
- package/app/components/category/info/CategoryPrice.vue +47 -0
- package/app/components/category/info/CategorySku.vue +15 -0
- package/app/components/category/info/CategoryStock.vue +25 -0
- package/app/components/category/list/CategoryItemCount.vue +27 -0
- package/app/components/category/list/CategoryListPagination.vue +81 -0
- package/app/components/category/skeleton/CategoryDetailSkeleton.vue +12 -0
- package/app/components/category/skeleton/CategoryListSkeleton.vue +65 -0
- package/app/components/category/view/CategoryViewToggle.vue +33 -0
- package/app/components/category/view/GridView.vue +78 -0
- package/app/components/category/view/ListView.vue +80 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationView.vue +289 -0
- package/app/components/checkout/form/CheckoutSchemaForm.vue +72 -0
- package/app/components/checkout/onepage/CheckoutAddressPickerModal.vue +260 -0
- package/app/components/checkout/onepage/CheckoutAddressSection.vue +186 -0
- package/app/components/checkout/onepage/CheckoutDeliverySection.vue +158 -0
- package/app/components/checkout/onepage/CheckoutGate.vue +67 -0
- package/app/components/checkout/onepage/CheckoutGuestDetailsSection.vue +154 -0
- package/app/components/checkout/onepage/CheckoutNotesSection.vue +62 -0
- package/app/components/checkout/onepage/CheckoutOnePageView.vue +77 -0
- package/app/components/checkout/onepage/CheckoutPaymentSection.vue +181 -0
- package/app/components/checkout/onepage/CheckoutSectionTitle.vue +18 -0
- package/app/components/checkout/onepage/CheckoutSummarySection.vue +211 -0
- package/app/components/checkout/onepage/CheckoutWorkflowPanel.vue +38 -0
- package/app/components/layout/AppLogo.vue +21 -0
- package/app/components/layout/footer/Footer.vue +148 -0
- package/app/components/layout/header/AppBar.vue +75 -0
- package/app/components/layout/header/CategoryNav.vue +93 -0
- package/app/components/layout/header/HeaderActionItem.vue +81 -0
- package/app/components/layout/header/LocaleSwitcher.vue +123 -0
- package/app/components/layout/header/MainNav.vue +61 -0
- package/app/components/layout/header/MobileMenu.vue +81 -0
- package/app/components/layout/header/TopBar.vue +63 -0
- package/app/components/listing/ListingView.vue +227 -0
- package/app/components/product/detail/ProductDetailAddToCart.vue +188 -0
- package/app/components/product/detail/ProductDetailDescription.vue +20 -0
- package/app/components/product/detail/ProductDetailImageGallery.vue +58 -0
- package/app/components/product/detail/ProductDetailPricing.vue +108 -0
- package/app/components/product/detail/ProductDetailSaveToList.vue +291 -0
- package/app/components/product/detail/ProductDetailSpecifications.vue +33 -0
- package/app/components/product/detail/ProductDetailStock.vue +36 -0
- package/app/components/search/filter/SearchFacets.vue +256 -0
- package/app/components/search/filter/SearchFacetsDrawer.vue +58 -0
- package/app/components/ui/AppShell.vue +7 -0
- package/app/components/ui/debug/PiniaStateCard.vue +106 -0
- package/app/components/ui/feedback/EmptyState.vue +30 -0
- package/app/components/ui/feedback/ErrorBoundary.vue +44 -0
- package/app/components/ui/feedback/NotFound.vue +34 -0
- package/app/components/ui/forms/CountrySelection.vue +14 -0
- package/app/components/ui/forms/FormKitDatePicker.vue +124 -0
- package/app/components/ui/forms/PasswordInput.vue +136 -0
- package/app/components/ui/forms/SearchInput.vue +213 -0
- package/app/components/ui/table/TableSortButton.vue +51 -0
- package/app/components/ui/table/TableToolbar.vue +66 -0
- package/app/composables/useAccount.ts +27 -0
- package/app/composables/useAccountAddresses.ts +116 -0
- package/app/composables/useAccountOrders.ts +18 -0
- package/app/composables/useAppUrl.ts +38 -0
- package/app/composables/useAuthStore.ts +202 -0
- package/app/composables/useB2BContext.ts +23 -0
- package/app/composables/useCartActions.ts +25 -0
- package/app/composables/useCartCalculation.ts +90 -0
- package/app/composables/useCartSelection.ts +46 -0
- package/app/composables/useCartStore.ts +837 -0
- package/app/composables/useCartSummaryFormatting.ts +28 -0
- package/app/composables/useCategories.ts +29 -0
- package/app/composables/useCheckoutOnePage.ts +438 -0
- package/app/composables/useCheckoutProfileSource.ts +8 -0
- package/app/composables/useCheckoutSchema.ts +28 -0
- package/app/composables/useDataTable.ts +14 -0
- package/app/composables/useFormValidation.ts +29 -0
- package/app/composables/useIcons.ts +17 -0
- package/app/composables/useLocalePreferences.ts +45 -0
- package/app/composables/useMarkets.ts +15 -0
- package/app/composables/useProduct.ts +89 -0
- package/app/composables/useProductCard.ts +8 -0
- package/app/composables/useProductCardActions.ts +106 -0
- package/app/composables/useProductImage.ts +12 -0
- package/app/composables/useProductListing.ts +210 -0
- package/app/composables/useProductUrl.ts +17 -0
- package/app/composables/useProducts.ts +130 -0
- package/app/composables/useSearch.ts +12 -0
- package/app/composables/useThemeStore.ts +81 -0
- package/app/composables/useViewMode.ts +18 -0
- package/app/config/countries.ts +74 -0
- package/app/config/icons.ts +283 -0
- package/app/config/navigation.ts +191 -0
- package/app/config/palette.ts +13 -0
- package/app/config/themes.ts +20 -0
- package/app/formkit.config.ts +50 -0
- package/app/interfaces/account/address-list.ts +34 -0
- package/app/interfaces/account/order-list.ts +47 -0
- package/app/interfaces/account/order-lists.ts +35 -0
- package/app/interfaces/account/profile.ts +17 -0
- package/app/interfaces/account.ts +3 -0
- package/app/interfaces/address.ts +9 -0
- package/app/interfaces/auth.ts +104 -0
- package/app/interfaces/b2b.ts +234 -0
- package/app/interfaces/cart-calculation.ts +131 -0
- package/app/interfaces/cart-item.ts +45 -0
- package/app/interfaces/checkout-draft.ts +4 -0
- package/app/interfaces/checkout.ts +43 -0
- package/app/interfaces/delivery.ts +13 -0
- package/app/interfaces/market.ts +24 -0
- package/app/interfaces/payment.ts +19 -0
- package/app/interfaces/persisted-cart.ts +10 -0
- package/app/interfaces/product-detail.ts +54 -0
- package/app/interfaces/product-list.ts +33 -0
- package/app/interfaces/search-facets.ts +14 -0
- package/app/interfaces/validation.ts +14 -0
- package/app/layouts/default.vue +78 -0
- package/app/layouts/focus.vue +80 -0
- package/app/plugins/formkit-locale.client.ts +23 -0
- package/app/shared/constants.ts +1 -0
- package/app/validations/companyName.ts +18 -0
- package/app/validations/emailFormat.ts +10 -0
- package/app/validations/formValidationConfig.ts +50 -0
- package/app/validations/maxLength.ts +12 -0
- package/app/validations/minLength.ts +9 -0
- package/app/validations/optionalCompanyName.ts +23 -0
- package/app/validations/passwordsMatch.ts +5 -0
- package/app/validations/phoneNumber.ts +19 -0
- package/app/validations/required.ts +11 -0
- package/app/validations/termsRequired.ts +4 -0
- package/app/validations/types.ts +10 -0
- package/app/validations/zipCode.ts +15 -0
- package/i18n/locales/de/account.json +458 -0
- package/i18n/locales/de/auth.json +155 -0
- package/i18n/locales/de/cart.json +263 -0
- package/i18n/locales/de/checkout.json +217 -0
- package/i18n/locales/de/common.json +80 -0
- package/i18n/locales/de/cover.json +33 -0
- package/i18n/locales/de/order.json +1 -0
- package/i18n/locales/de/product.json +71 -0
- package/i18n/locales/de/search.json +54 -0
- package/i18n/locales/de/validation.json +12 -0
- package/i18n/locales/en/account.json +458 -0
- package/i18n/locales/en/auth.json +155 -0
- package/i18n/locales/en/cart.json +263 -0
- package/i18n/locales/en/checkout.json +217 -0
- package/i18n/locales/en/common.json +80 -0
- package/i18n/locales/en/cover.json +33 -0
- package/i18n/locales/en/order.json +1 -0
- package/i18n/locales/en/product.json +71 -0
- package/i18n/locales/en/search.json +54 -0
- package/i18n/locales/en/validation.json +12 -0
- package/nuxt.config.ts +109 -0
- package/package.json +65 -0
- package/public/img/product-placeholder.svg +8 -0
- package/public/templates/direct-order-template.csv +3 -0
- package/public/templates/direct-order-template.xlsx +0 -0
- package/server/api/account/address/[id].delete.ts +51 -0
- package/server/api/account/address/[id].put.ts +83 -0
- package/server/api/account/address/index.post.ts +60 -0
- package/server/api/account/addresses.get.ts +25 -0
- package/server/api/account/context.get.ts +16 -0
- package/server/api/account/governance/[domain]/[id].put.ts +57 -0
- package/server/api/account/governance/[domain].post.ts +111 -0
- package/server/api/account/order-lists/[id].delete.ts +22 -0
- package/server/api/account/order-lists/[id].get.ts +17 -0
- package/server/api/account/order-lists/[id].put.ts +46 -0
- package/server/api/account/order-lists/index.get.ts +14 -0
- package/server/api/account/order-lists/index.post.ts +38 -0
- package/server/api/account/orders/[id].get.ts +35 -0
- package/server/api/account/orders.get.ts +35 -0
- package/server/api/account/profile.get.ts +56 -0
- package/server/api/account/profile.put.ts +128 -0
- package/server/api/account/requisitions/[id].get.ts +15 -0
- package/server/api/account/requisitions.get.ts +23 -0
- package/server/api/auth/login.post.ts +37 -0
- package/server/api/auth/logout.post.ts +4 -0
- package/server/api/auth/me.get.ts +3 -0
- package/server/api/auth/personas.get.ts +7 -0
- package/server/api/auth/recovery.post.ts +32 -0
- package/server/api/auth/recovery.put.ts +37 -0
- package/server/api/auth/register.post.ts +126 -0
- package/server/api/cart/calculate.post.ts +25 -0
- package/server/api/cart/export.post.ts +81 -0
- package/server/api/cart/index.delete.ts +10 -0
- package/server/api/cart/index.get.ts +10 -0
- package/server/api/cart/sync.post.ts +14 -0
- package/server/api/carts/[id]/activate.post.ts +18 -0
- package/server/api/carts/[id]/index.delete.ts +18 -0
- package/server/api/carts/[id]/index.put.ts +19 -0
- package/server/api/carts/[id]/items.post.ts +21 -0
- package/server/api/carts/index.get.ts +14 -0
- package/server/api/carts/index.post.ts +14 -0
- package/server/api/categories/[slug].get.ts +22 -0
- package/server/api/categories/index.get.ts +11 -0
- package/server/api/checkout/profile.get.ts +21 -0
- package/server/api/checkout/schema/[key].get.ts +19 -0
- package/server/api/checkout/session.post.ts +8 -0
- package/server/api/images/detail/[filename].get.ts +18 -0
- package/server/api/images/list/[filename].get.ts +17 -0
- package/server/api/markets.get.ts +9 -0
- package/server/api/orders/index.post.ts +376 -0
- package/server/api/payment/methods.post.ts +65 -0
- package/server/api/product/[id].get.ts +29 -0
- package/server/api/products/[id].get.ts +30 -0
- package/server/api/products/index.get.ts +21 -0
- package/server/api/requisitions/index.post.ts +67 -0
- package/server/api/shipping/rates.post.ts +70 -0
- package/server/api/themes/index.get.ts +9 -0
- package/server/api/typesense/drop.get.ts +22 -0
- package/server/api/typesense/health.get.ts +9 -0
- package/server/api/typesense/search.post.ts +199 -0
- package/server/api/typesense/seed.get.ts +112 -0
- package/server/api/typesense/suggest.post.ts +69 -0
- package/server/config/account/organization.json +146 -0
- package/server/config/account/personas.json +169 -0
- package/server/config/account/user.json +8 -0
- package/server/config/account/workflows.json +19 -0
- package/server/data/account/address-list.json +103 -0
- package/server/data/account/order-list.json +491 -0
- package/server/data/account/order-lists.json +149 -0
- package/server/data/account/profile.json +9 -0
- package/server/data/account/registration-requests.json +3 -0
- package/server/data/account/requisitions.json +686 -0
- package/server/data/categories.json +186 -0
- package/server/data/forms/checkout/add-address.json +24 -0
- package/server/data/list/5137-1.png +0 -0
- package/server/data/list/5498-1.png +0 -0
- package/server/data/list/5498-2.png +0 -0
- package/server/data/list/5498-3.png +0 -0
- package/server/data/list/5498-4.png +0 -0
- package/server/data/list/5498-5.png +0 -0
- package/server/data/list/5498-6.png +0 -0
- package/server/data/list/5519-1.png +0 -0
- package/server/data/list/5713-1.png +0 -0
- package/server/data/list/5789-1.png +0 -0
- package/server/data/list/5930-1.png +0 -0
- package/server/data/list/6127-1.png +0 -0
- package/server/data/list/6234-1.png +0 -0
- package/server/data/list/6238-1.png +0 -0
- package/server/data/list/6246-1.png +0 -0
- package/server/data/list/6270-1.png +0 -0
- package/server/data/list/6330-1.png +0 -0
- package/server/data/list/6336-1.png +0 -0
- package/server/data/list/6360-1.png +0 -0
- package/server/data/list/6363-1.png +0 -0
- package/server/data/list/6375-1.png +0 -0
- package/server/data/list/6385-1.png +0 -0
- package/server/data/list/6413-1.png +0 -0
- package/server/data/list/6418-1.png +0 -0
- package/server/data/list/6465-1.png +0 -0
- package/server/data/list/6477-1.png +0 -0
- package/server/data/list/6509-1.png +0 -0
- package/server/data/list/6545-1.png +0 -0
- package/server/data/list/6548-1.png +0 -0
- package/server/data/list/6566-1.png +0 -0
- package/server/data/list/6581-1.png +0 -0
- package/server/data/list/6609-1.png +0 -0
- package/server/data/list/6611-1.png +0 -0
- package/server/data/list/6641-1.png +0 -0
- package/server/data/list/6659-1.png +0 -0
- package/server/data/list/6662-1.png +0 -0
- package/server/data/list/6689-1.png +0 -0
- package/server/data/list/6698-1.png +0 -0
- package/server/data/list/6701-1.png +0 -0
- package/server/data/list/6752-1.png +0 -0
- package/server/data/list/6755-1.png +0 -0
- package/server/data/list/6837-1.png +0 -0
- package/server/data/list/6841-1.png +0 -0
- package/server/data/list/6844-1.png +0 -0
- package/server/data/list/6846-1.png +0 -0
- package/server/data/list/6886-1.png +0 -0
- package/server/data/list/6895-1.png +0 -0
- package/server/data/list/6897-1.png +0 -0
- package/server/data/list/6919-1.png +0 -0
- package/server/data/list/6977-1.png +0 -0
- package/server/data/list/6983-1.png +0 -0
- package/server/data/list/6984-1.png +0 -0
- package/server/data/list/6985-1.png +0 -0
- package/server/data/list/6986-1.png +0 -0
- package/server/data/list/6989-1.png +0 -0
- package/server/data/list/6995-1.png +0 -0
- package/server/data/list/6998-1.png +0 -0
- package/server/data/markets.json +24 -0
- package/server/data/product-detail.json +2450 -0
- package/server/data/product-list.json +2450 -0
- package/server/data/themes.json +8 -0
- package/server/interfaces/account.ts +20 -0
- package/server/interfaces/auth.ts +32 -0
- package/server/interfaces/b2bContext.ts +23 -0
- package/server/interfaces/cart.ts +46 -0
- package/server/interfaces/cartCalculation.ts +17 -0
- package/server/interfaces/category.ts +12 -0
- package/server/interfaces/checkoutProfile.ts +5 -0
- package/server/interfaces/log.ts +3 -0
- package/server/interfaces/market.ts +10 -0
- package/server/interfaces/product.ts +21 -0
- package/server/interfaces/schema.ts +20 -0
- package/server/interfaces/theme.ts +10 -0
- package/server/services/ApiAuthService.ts +138 -0
- package/server/services/ApiCartService.ts +254 -0
- package/server/services/ApiCategoryService.ts +25 -0
- package/server/services/ApiMarketService.ts +71 -0
- package/server/services/ApiProductService.ts +53 -0
- package/server/services/LocalFileCategoryService.ts +23 -0
- package/server/services/LocalFileCheckoutProfileService.ts +117 -0
- package/server/services/LocalFileProductService.ts +128 -0
- package/server/services/LocalFileSchemaService.ts +70 -0
- package/server/services/LocalFileThemeService.ts +18 -0
- package/server/services/LogService.ts +28 -0
- package/server/services/MockAccountService.ts +58 -0
- package/server/services/MockAuthService.ts +105 -0
- package/server/services/MockB2BContextService.ts +149 -0
- package/server/services/MockCartCalculationService.ts +395 -0
- package/server/services/MockMarketService.ts +18 -0
- package/server/services/SdkAccountService.ts +56 -0
- package/server/services/SdkAuthService.ts +83 -0
- package/server/services/SessionCartService.ts +31 -0
- package/server/utils/accountService.ts +30 -0
- package/server/utils/authCookie.ts +13 -0
- package/server/utils/authService.ts +43 -0
- package/server/utils/b2bService.ts +49 -0
- package/server/utils/cartService.ts +59 -0
- package/server/utils/categoryService.ts +19 -0
- package/server/utils/checkoutProfileService.ts +9 -0
- package/server/utils/checkoutSession.ts +38 -0
- package/server/utils/coverData.ts +84 -0
- package/server/utils/governanceStore.ts +38 -0
- package/server/utils/i18n.ts +76 -0
- package/server/utils/inventoryService.ts +14 -0
- package/server/utils/liveCatalog.ts +234 -0
- package/server/utils/liveInventories.ts +76 -0
- package/server/utils/liveOrders.ts +139 -0
- package/server/utils/livePrices.ts +93 -0
- package/server/utils/locale.ts +39 -0
- package/server/utils/logService.ts +19 -0
- package/server/utils/marketService.ts +24 -0
- package/server/utils/orderService.ts +14 -0
- package/server/utils/paymentService.ts +14 -0
- package/server/utils/priceService.ts +14 -0
- package/server/utils/productService.ts +28 -0
- package/server/utils/productsSchema.ts +30 -0
- package/server/utils/revenexxApi.ts +136 -0
- package/server/utils/schemaService.ts +25 -0
- package/server/utils/serviceMode.ts +70 -0
- package/server/utils/shippingService.ts +14 -0
- package/server/utils/shopSdk.ts +88 -0
- package/server/utils/themeService.ts +16 -0
- package/server/utils/typesense.ts +27 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
3
|
+
|
|
4
|
+
import type { CartItem, CartItemPriceTier } from "../../../interfaces/cart-item";
|
|
5
|
+
import type { ProductDetailProduct } from "../../../interfaces/product-detail";
|
|
6
|
+
|
|
7
|
+
const { icon } = useIcons();
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
product: ProductDetailProduct;
|
|
11
|
+
maxQuantity: number;
|
|
12
|
+
price: number;
|
|
13
|
+
taxRate: number;
|
|
14
|
+
sku: string;
|
|
15
|
+
imageUrl: string;
|
|
16
|
+
prices: { [key: string]: number }[];
|
|
17
|
+
categorySlug?: string;
|
|
18
|
+
subcategorySlug?: string;
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const cartStore = useCartStore();
|
|
22
|
+
const toast = useToast();
|
|
23
|
+
const { t } = useI18n();
|
|
24
|
+
const quantity = ref(1);
|
|
25
|
+
|
|
26
|
+
const currentCartQuantity = computed(() =>
|
|
27
|
+
cartStore.items.find((item: CartItem) => item.id === props.product.id && !item.requisitionId)?.quantity ?? 0,
|
|
28
|
+
);
|
|
29
|
+
const quantityInvalid = computed(() => quantity.value < 1);
|
|
30
|
+
const quantityExceeded = computed(() =>
|
|
31
|
+
currentCartQuantity.value + quantity.value > props.maxQuantity,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
let exceededTimer: ReturnType<typeof setTimeout> | null = null;
|
|
35
|
+
const showQuantityExceeded = ref(false);
|
|
36
|
+
|
|
37
|
+
function triggerExceededError() {
|
|
38
|
+
showQuantityExceeded.value = true;
|
|
39
|
+
if (exceededTimer !== null) {
|
|
40
|
+
clearTimeout(exceededTimer);
|
|
41
|
+
}
|
|
42
|
+
exceededTimer = setTimeout(() => {
|
|
43
|
+
showQuantityExceeded.value = false;
|
|
44
|
+
exceededTimer = null;
|
|
45
|
+
}, 2000);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function buildPriceTiers(prices: { [key: string]: number }[]): CartItemPriceTier[] {
|
|
49
|
+
const priceMap = prices[0];
|
|
50
|
+
if (!priceMap) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
return Object.entries(priceMap)
|
|
54
|
+
.map(([qty, totalCents]) => ({
|
|
55
|
+
minQuantity: parseInt(qty),
|
|
56
|
+
unitPrice: Number(totalCents) / parseInt(qty) / 100,
|
|
57
|
+
}))
|
|
58
|
+
.sort((a, b) => a.minQuantity - b.minQuantity);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function setQuantity(next: number) {
|
|
62
|
+
quantity.value = Math.max(1, Math.min(next, 999999));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function onQuantityInput(event: Event) {
|
|
66
|
+
const input = event.target as HTMLInputElement;
|
|
67
|
+
const sanitized = input.value.replace(/[^0-9]/g, "").slice(0, 6);
|
|
68
|
+
input.value = sanitized;
|
|
69
|
+
quantity.value = parseInt(sanitized) || 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function addToCart() {
|
|
73
|
+
if (quantityInvalid.value) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (quantityExceeded.value) {
|
|
77
|
+
triggerExceededError();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const added = cartStore.addItem({
|
|
82
|
+
id: props.product.id,
|
|
83
|
+
name: props.product.name,
|
|
84
|
+
image: props.imageUrl,
|
|
85
|
+
sku: props.sku,
|
|
86
|
+
price: props.price / 100,
|
|
87
|
+
taxRate: props.taxRate,
|
|
88
|
+
priceTiers: buildPriceTiers(props.prices),
|
|
89
|
+
maxOrderQuantity: props.maxQuantity,
|
|
90
|
+
categorySlug: props.categorySlug,
|
|
91
|
+
subcategorySlug: props.subcategorySlug,
|
|
92
|
+
}, { chooseTarget: true });
|
|
93
|
+
if (!added) {
|
|
94
|
+
triggerExceededError();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (quantity.value > 1) {
|
|
98
|
+
const item = cartStore.items.find(i => i.id === props.product.id && !i.requisitionId);
|
|
99
|
+
if (item) {
|
|
100
|
+
cartStore.updateQuantityByKey(cartStore.keyOf(item), item.quantity + quantity.value - 1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toast.add({
|
|
105
|
+
title: t("product.actions.addedToCart", { quantity: quantity.value, name: props.product.name }),
|
|
106
|
+
color: "primary",
|
|
107
|
+
icon: icon("check"),
|
|
108
|
+
duration: 1500,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
onUnmounted(() => {
|
|
113
|
+
if (exceededTimer !== null) {
|
|
114
|
+
clearTimeout(exceededTimer);
|
|
115
|
+
exceededTimer = null;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<template>
|
|
121
|
+
<div class="space-y-4">
|
|
122
|
+
<div class="flex gap-3">
|
|
123
|
+
<div
|
|
124
|
+
class="flex items-center rounded-lg border border-(--ui-border) overflow-hidden
|
|
125
|
+
shrink-0"
|
|
126
|
+
>
|
|
127
|
+
<UButton
|
|
128
|
+
:icon="icon('minus')"
|
|
129
|
+
color="neutral"
|
|
130
|
+
variant="ghost"
|
|
131
|
+
tabindex="0"
|
|
132
|
+
:disabled="quantity <= 1"
|
|
133
|
+
:aria-label="t('cart.item.ariaDecreaseQuantity', { name: product.name })"
|
|
134
|
+
@click="setQuantity(quantity - 1)"
|
|
135
|
+
/>
|
|
136
|
+
<input
|
|
137
|
+
:value="String(quantity)"
|
|
138
|
+
type="text"
|
|
139
|
+
inputmode="numeric"
|
|
140
|
+
class="w-12 text-center text-sm font-medium bg-transparent
|
|
141
|
+
focus:outline-none"
|
|
142
|
+
:aria-label="t('product.detail.quantity')"
|
|
143
|
+
@input="onQuantityInput"
|
|
144
|
+
>
|
|
145
|
+
<UButton
|
|
146
|
+
:icon="icon('plus')"
|
|
147
|
+
color="neutral"
|
|
148
|
+
variant="ghost"
|
|
149
|
+
tabindex="0"
|
|
150
|
+
:aria-label="t('cart.item.ariaIncreaseQuantity', { name: product.name })"
|
|
151
|
+
@click="setQuantity(quantity + 1)"
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
<UButton
|
|
155
|
+
:icon="icon('cart')"
|
|
156
|
+
size="lg"
|
|
157
|
+
class="flex-1 justify-center"
|
|
158
|
+
tabindex="0"
|
|
159
|
+
:label="t('product.actions.addToCart')"
|
|
160
|
+
:disabled="quantityInvalid"
|
|
161
|
+
@click="addToCart"
|
|
162
|
+
/>
|
|
163
|
+
<slot name="after-cta" />
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<UiFeedbackErrorBoundary
|
|
167
|
+
v-if="showQuantityExceeded"
|
|
168
|
+
:title="t('product.actions.maxQuantityReachedTitle', { count: currentCartQuantity })"
|
|
169
|
+
:description="t('product.actions.maxQuantityReachedDescription', { max: maxQuantity })"
|
|
170
|
+
:show-retry="false"
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
<!-- B2B incentives -->
|
|
174
|
+
<ul class="rounded-xl bg-elevated/60 ring-1 ring-(--ui-border) divide-y divide-(--ui-border)">
|
|
175
|
+
<li
|
|
176
|
+
v-for="incentive in (['delivery', 'paymentTerms', 'volume'] as const)"
|
|
177
|
+
:key="incentive"
|
|
178
|
+
class="flex items-center gap-2.5 px-3.5 py-2.5 text-sm text-muted"
|
|
179
|
+
>
|
|
180
|
+
<UIcon
|
|
181
|
+
:name="icon(incentive === 'delivery' ? 'delivery' : incentive === 'paymentTerms' ? 'payment' : 'grid')"
|
|
182
|
+
class="size-4 shrink-0 text-(--ui-primary)"
|
|
183
|
+
/>
|
|
184
|
+
{{ t(`product.incentives.${incentive}`) }}
|
|
185
|
+
</li>
|
|
186
|
+
</ul>
|
|
187
|
+
</div>
|
|
188
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
description: string;
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div>
|
|
13
|
+
<h3 class="text-lg font-semibold text-highlighted mb-4">
|
|
14
|
+
{{ t('product.description') }}
|
|
15
|
+
</h3>
|
|
16
|
+
<p class="text-sm/6 text-muted max-w-prose">
|
|
17
|
+
{{ description }}
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProductDetailImage } from "../../../interfaces/product-detail";
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
images: ProductDetailImage[];
|
|
6
|
+
getImageUrl: (filename: string) => string;
|
|
7
|
+
}>();
|
|
8
|
+
|
|
9
|
+
const selectedIndex = ref(0);
|
|
10
|
+
const selectedImage = computed(() => props.images[selectedIndex.value]);
|
|
11
|
+
|
|
12
|
+
watch(() => props.images, () => {
|
|
13
|
+
selectedIndex.value = 0;
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div class="flex flex-col gap-3">
|
|
19
|
+
<div
|
|
20
|
+
class="w-full aspect-square rounded-2xl overflow-hidden bg-elevated/60
|
|
21
|
+
ring-1 ring-(--ui-border) flex items-center justify-center p-8"
|
|
22
|
+
>
|
|
23
|
+
<img
|
|
24
|
+
v-if="selectedImage"
|
|
25
|
+
:src="getImageUrl(selectedImage.url)"
|
|
26
|
+
:alt="`Product image ${selectedIndex + 1}`"
|
|
27
|
+
class="max-w-full max-h-full object-contain"
|
|
28
|
+
>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div
|
|
32
|
+
v-if="images.length > 1"
|
|
33
|
+
class="grid grid-cols-5 sm:grid-cols-6 gap-2"
|
|
34
|
+
>
|
|
35
|
+
<button
|
|
36
|
+
v-for="(image, index) in images"
|
|
37
|
+
:key="image.url"
|
|
38
|
+
type="button"
|
|
39
|
+
tabindex="0"
|
|
40
|
+
class="aspect-square rounded-lg overflow-hidden bg-elevated/60 p-1.5
|
|
41
|
+
ring-1 transition-all cursor-pointer
|
|
42
|
+
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--ui-primary)"
|
|
43
|
+
:class="index === selectedIndex
|
|
44
|
+
? 'ring-2 ring-(--ui-primary)'
|
|
45
|
+
: 'ring-(--ui-border) hover:ring-(--ui-primary)/50'"
|
|
46
|
+
:aria-label="`Thumbnail ${index + 1}`"
|
|
47
|
+
:aria-pressed="index === selectedIndex"
|
|
48
|
+
@click="selectedIndex = index"
|
|
49
|
+
>
|
|
50
|
+
<img
|
|
51
|
+
:src="getImageUrl(image.url)"
|
|
52
|
+
:alt="`Thumbnail ${index + 1}`"
|
|
53
|
+
class="w-full h-full object-contain"
|
|
54
|
+
>
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
prices: { [key: string]: number }[];
|
|
6
|
+
formatPrice: (cents: number) => string;
|
|
7
|
+
currentCartQuantity?: number;
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const { t } = useI18n();
|
|
11
|
+
|
|
12
|
+
const tiers = computed(() => {
|
|
13
|
+
if (!props.prices.length) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const priceMap = props.prices[0];
|
|
17
|
+
return Object.entries(priceMap ?? {})
|
|
18
|
+
.map(([qty, totalCents]) => {
|
|
19
|
+
const quantity = parseInt(qty);
|
|
20
|
+
return {
|
|
21
|
+
quantity,
|
|
22
|
+
totalCents: Number(totalCents),
|
|
23
|
+
unitCents: Number(totalCents) / quantity,
|
|
24
|
+
};
|
|
25
|
+
})
|
|
26
|
+
.sort((a, b) => a.quantity - b.quantity);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const baseUnit = computed(() => tiers.value[0]?.unitCents ?? 0);
|
|
30
|
+
|
|
31
|
+
function saving(unitCents: number): number {
|
|
32
|
+
if (!baseUnit.value || unitCents >= baseUnit.value) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
return Math.round((1 - unitCents / baseUnit.value) * 100);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const activeTier = computed(() => {
|
|
39
|
+
if (!props.currentCartQuantity || props.currentCartQuantity < 1) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return [...tiers.value]
|
|
43
|
+
.reverse()
|
|
44
|
+
.find(tier => tier.quantity <= props.currentCartQuantity!) ?? null;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const isActiveTier = (tierQuantity: number): boolean =>
|
|
48
|
+
activeTier.value?.quantity === tierQuantity;
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<div v-if="tiers.length > 1">
|
|
53
|
+
<h3 class="text-sm font-semibold text-highlighted mb-2">
|
|
54
|
+
{{ t('product.pricing.volumePricing') }}
|
|
55
|
+
</h3>
|
|
56
|
+
<div class="rounded-xl border border-(--ui-border) overflow-hidden">
|
|
57
|
+
<table class="w-full text-sm">
|
|
58
|
+
<thead>
|
|
59
|
+
<tr class="text-left text-xs uppercase tracking-wide text-muted bg-elevated/60">
|
|
60
|
+
<th class="py-2.5 px-3 font-medium">
|
|
61
|
+
{{ t('product.pricing.minQuantity') }}
|
|
62
|
+
</th>
|
|
63
|
+
<th class="py-2.5 px-3 text-right font-medium">
|
|
64
|
+
{{ t('product.pricing.unitPrice') }}
|
|
65
|
+
</th>
|
|
66
|
+
<th class="py-2.5 px-3 text-right font-medium max-sm:hidden">
|
|
67
|
+
{{ t('product.pricing.saving') }}
|
|
68
|
+
</th>
|
|
69
|
+
</tr>
|
|
70
|
+
</thead>
|
|
71
|
+
<tbody class="divide-y divide-(--ui-border)">
|
|
72
|
+
<tr
|
|
73
|
+
v-for="tier in tiers"
|
|
74
|
+
:key="tier.quantity"
|
|
75
|
+
:class="isActiveTier(tier.quantity) ? 'bg-primary/5' : ''"
|
|
76
|
+
>
|
|
77
|
+
<td class="py-2.5 px-3">
|
|
78
|
+
<span class="font-medium text-highlighted tabular-nums">
|
|
79
|
+
{{ t('product.pricing.fromQuantity', { quantity: tier.quantity }) }}
|
|
80
|
+
</span>
|
|
81
|
+
<UBadge
|
|
82
|
+
v-if="isActiveTier(tier.quantity)"
|
|
83
|
+
color="primary"
|
|
84
|
+
variant="subtle"
|
|
85
|
+
size="sm"
|
|
86
|
+
class="ms-2"
|
|
87
|
+
:label="t('product.pricing.yourTier')"
|
|
88
|
+
/>
|
|
89
|
+
</td>
|
|
90
|
+
<td class="py-2.5 px-3 text-right font-semibold text-highlighted tabular-nums">
|
|
91
|
+
{{ formatPrice(tier.unitCents) }}
|
|
92
|
+
</td>
|
|
93
|
+
<td class="py-2.5 px-3 text-right tabular-nums max-sm:hidden">
|
|
94
|
+
<span
|
|
95
|
+
v-if="saving(tier.unitCents)"
|
|
96
|
+
class="text-success font-medium"
|
|
97
|
+
>−{{ saving(tier.unitCents) }} %</span>
|
|
98
|
+
<span
|
|
99
|
+
v-else
|
|
100
|
+
class="text-dimmed"
|
|
101
|
+
>–</span>
|
|
102
|
+
</td>
|
|
103
|
+
</tr>
|
|
104
|
+
</tbody>
|
|
105
|
+
</table>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { OrderList, OrderListPosition } from "../../../interfaces/account/order-lists";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* "Add to order list" on the product detail page: shows on how many
|
|
6
|
+
* lists the article already sits (info flag with the list names), opens
|
|
7
|
+
* a dialog that toggles membership per list, offers the last-used list
|
|
8
|
+
* as a one-click shortcut and creates new lists inline.
|
|
9
|
+
*/
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
/** Icon-only trigger for the add-to-cart row (count chip + tooltip). */
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
productId: string;
|
|
14
|
+
sku: string;
|
|
15
|
+
name: string;
|
|
16
|
+
image?: string;
|
|
17
|
+
/** Unit price in EUR. */
|
|
18
|
+
price: number;
|
|
19
|
+
taxRate?: number;
|
|
20
|
+
categorySlug?: string;
|
|
21
|
+
subcategorySlug?: string;
|
|
22
|
+
}>();
|
|
23
|
+
|
|
24
|
+
const LAST_USED_STORAGE = "cover-last-order-list";
|
|
25
|
+
|
|
26
|
+
const { icon } = useIcons();
|
|
27
|
+
const { t } = useI18n();
|
|
28
|
+
const toast = useToast();
|
|
29
|
+
const auth = useAuthStore();
|
|
30
|
+
|
|
31
|
+
const open = ref(false);
|
|
32
|
+
const busyListId = ref<string | null>(null);
|
|
33
|
+
const newListName = ref("");
|
|
34
|
+
const creating = ref(false);
|
|
35
|
+
const lastUsedId = ref<string | null>(null);
|
|
36
|
+
|
|
37
|
+
onMounted(() => {
|
|
38
|
+
lastUsedId.value = localStorage.getItem(LAST_USED_STORAGE);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const { data: lists, refresh } = useFetch<OrderList[]>("/api/account/order-lists", {
|
|
42
|
+
key: "account-order-lists",
|
|
43
|
+
server: false,
|
|
44
|
+
lazy: true,
|
|
45
|
+
default: () => [],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const signedIn = computed(() => auth.user !== null);
|
|
49
|
+
|
|
50
|
+
/* ---- smart flag: where does the article already live? ----------------- */
|
|
51
|
+
const listsWithProduct = computed(() =>
|
|
52
|
+
(lists.value ?? []).filter(list => list.positions.some(p => p.id === props.productId)));
|
|
53
|
+
|
|
54
|
+
const onListNames = computed(() => listsWithProduct.value.map(list => list.name).join(", "));
|
|
55
|
+
|
|
56
|
+
const isOwn = (list: OrderList): boolean => list.owner.id === auth.user?.$id;
|
|
57
|
+
|
|
58
|
+
const lastUsedList = computed(() =>
|
|
59
|
+
(lists.value ?? []).find(list => list.id === lastUsedId.value && isOwn(list)) ?? null);
|
|
60
|
+
|
|
61
|
+
const contains = (list: OrderList): boolean =>
|
|
62
|
+
list.positions.some(p => p.id === props.productId);
|
|
63
|
+
|
|
64
|
+
/* ---- toggle membership ------------------------------------------------- */
|
|
65
|
+
function buildPosition(): OrderListPosition {
|
|
66
|
+
return {
|
|
67
|
+
id: props.productId,
|
|
68
|
+
sku: props.sku,
|
|
69
|
+
name: props.name,
|
|
70
|
+
...(props.image ? { image: props.image } : {}),
|
|
71
|
+
quantity: 1,
|
|
72
|
+
price: props.price,
|
|
73
|
+
...(typeof props.taxRate === "number" ? { taxRate: props.taxRate } : {}),
|
|
74
|
+
...(props.categorySlug ? { categorySlug: props.categorySlug } : {}),
|
|
75
|
+
...(props.subcategorySlug ? { subcategorySlug: props.subcategorySlug } : {}),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function toggle(list: OrderList): Promise<void> {
|
|
80
|
+
if (!isOwn(list) || busyListId.value) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
busyListId.value = list.id;
|
|
84
|
+
const removing = contains(list);
|
|
85
|
+
try {
|
|
86
|
+
await $fetch(`/api/account/order-lists/${list.id}`, {
|
|
87
|
+
method: "PUT",
|
|
88
|
+
body: removing
|
|
89
|
+
? { positions: list.positions.filter(p => p.id !== props.productId) }
|
|
90
|
+
: { appendPositions: [buildPosition()] },
|
|
91
|
+
});
|
|
92
|
+
await refresh();
|
|
93
|
+
if (!removing) {
|
|
94
|
+
lastUsedId.value = list.id;
|
|
95
|
+
localStorage.setItem(LAST_USED_STORAGE, list.id);
|
|
96
|
+
}
|
|
97
|
+
toast.add({
|
|
98
|
+
title: t(removing ? "orderLists.saveTo.removed" : "orderLists.saveTo.added", { list: list.name }),
|
|
99
|
+
color: "success",
|
|
100
|
+
icon: icon("success"),
|
|
101
|
+
duration: 1500,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
toast.add({ title: t("orderLists.saveTo.error"), color: "error", icon: icon("error") });
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
busyListId.value = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* ---- inline create ------------------------------------------------------ */
|
|
113
|
+
async function createAndAdd(): Promise<void> {
|
|
114
|
+
const name = newListName.value.trim();
|
|
115
|
+
if (!name) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
creating.value = true;
|
|
119
|
+
try {
|
|
120
|
+
const created = await $fetch<OrderList>("/api/account/order-lists", {
|
|
121
|
+
method: "POST",
|
|
122
|
+
body: { name, kind: "shopping", public: false, positions: [buildPosition()] },
|
|
123
|
+
});
|
|
124
|
+
await refresh();
|
|
125
|
+
lastUsedId.value = created.id;
|
|
126
|
+
localStorage.setItem(LAST_USED_STORAGE, created.id);
|
|
127
|
+
newListName.value = "";
|
|
128
|
+
toast.add({
|
|
129
|
+
title: t("orderLists.saveTo.added", { list: name }),
|
|
130
|
+
color: "success",
|
|
131
|
+
icon: icon("success"),
|
|
132
|
+
duration: 1500,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
toast.add({ title: t("orderLists.saveTo.error"), color: "error", icon: icon("error") });
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
creating.value = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<template>
|
|
145
|
+
<div
|
|
146
|
+
v-if="signedIn"
|
|
147
|
+
:class="compact ? 'shrink-0' : 'flex flex-wrap items-center gap-2'"
|
|
148
|
+
>
|
|
149
|
+
<!-- Compact: icon button with a count chip, lives next to add-to-cart -->
|
|
150
|
+
<UTooltip
|
|
151
|
+
v-if="compact"
|
|
152
|
+
:text="listsWithProduct.length
|
|
153
|
+
? `${t('orderLists.saveTo.onLists', { count: listsWithProduct.length })}: ${onListNames}`
|
|
154
|
+
: t('orderLists.saveTo.button')"
|
|
155
|
+
>
|
|
156
|
+
<UChip
|
|
157
|
+
:show="listsWithProduct.length > 0"
|
|
158
|
+
:text="listsWithProduct.length"
|
|
159
|
+
color="info"
|
|
160
|
+
size="3xl"
|
|
161
|
+
>
|
|
162
|
+
<UButton
|
|
163
|
+
color="neutral"
|
|
164
|
+
variant="outline"
|
|
165
|
+
size="lg"
|
|
166
|
+
tabindex="0"
|
|
167
|
+
:icon="icon('order-list')"
|
|
168
|
+
:aria-label="t('orderLists.saveTo.button')"
|
|
169
|
+
@click="open = true"
|
|
170
|
+
/>
|
|
171
|
+
</UChip>
|
|
172
|
+
</UTooltip>
|
|
173
|
+
|
|
174
|
+
<template v-else>
|
|
175
|
+
<UButton
|
|
176
|
+
color="neutral"
|
|
177
|
+
variant="soft"
|
|
178
|
+
tabindex="0"
|
|
179
|
+
:icon="icon('order-list')"
|
|
180
|
+
:label="t('orderLists.saveTo.button')"
|
|
181
|
+
@click="open = true"
|
|
182
|
+
/>
|
|
183
|
+
<UTooltip
|
|
184
|
+
v-if="listsWithProduct.length"
|
|
185
|
+
:text="onListNames"
|
|
186
|
+
>
|
|
187
|
+
<UBadge
|
|
188
|
+
color="info"
|
|
189
|
+
variant="subtle"
|
|
190
|
+
size="sm"
|
|
191
|
+
:icon="icon('info')"
|
|
192
|
+
:label="t('orderLists.saveTo.onLists', { count: listsWithProduct.length })"
|
|
193
|
+
/>
|
|
194
|
+
</UTooltip>
|
|
195
|
+
</template>
|
|
196
|
+
|
|
197
|
+
<UModal
|
|
198
|
+
v-model:open="open"
|
|
199
|
+
:title="t('orderLists.saveTo.title')"
|
|
200
|
+
>
|
|
201
|
+
<template #body>
|
|
202
|
+
<div class="space-y-4">
|
|
203
|
+
<!-- One click into the last-used list -->
|
|
204
|
+
<UButton
|
|
205
|
+
v-if="lastUsedList"
|
|
206
|
+
color="primary"
|
|
207
|
+
variant="soft"
|
|
208
|
+
tabindex="0"
|
|
209
|
+
class="w-full justify-between"
|
|
210
|
+
:loading="busyListId === lastUsedList.id"
|
|
211
|
+
:icon="icon('reset')"
|
|
212
|
+
:trailing-icon="contains(lastUsedList) ? icon('success') : undefined"
|
|
213
|
+
@click="toggle(lastUsedList)"
|
|
214
|
+
>
|
|
215
|
+
{{ t('orderLists.saveTo.lastUsed') }}: {{ lastUsedList.name }}
|
|
216
|
+
</UButton>
|
|
217
|
+
|
|
218
|
+
<!-- All lists, membership toggles on click -->
|
|
219
|
+
<div
|
|
220
|
+
v-if="lists?.length"
|
|
221
|
+
class="max-h-72 overflow-y-auto space-y-2 -mx-1 px-1"
|
|
222
|
+
>
|
|
223
|
+
<button
|
|
224
|
+
v-for="list in lists"
|
|
225
|
+
:key="list.id"
|
|
226
|
+
type="button"
|
|
227
|
+
tabindex="0"
|
|
228
|
+
class="w-full text-left p-3 rounded-lg border transition-colors
|
|
229
|
+
focus:outline-none focus-visible:ring-2 focus-visible:ring-(--ui-primary)"
|
|
230
|
+
:class="[
|
|
231
|
+
contains(list)
|
|
232
|
+
? 'border-(--ui-primary) bg-primary/5'
|
|
233
|
+
: 'border-(--ui-border)',
|
|
234
|
+
isOwn(list)
|
|
235
|
+
? 'cursor-pointer hover:border-(--ui-border-accented)'
|
|
236
|
+
: 'opacity-60 cursor-not-allowed',
|
|
237
|
+
]"
|
|
238
|
+
:disabled="!isOwn(list) || busyListId !== null"
|
|
239
|
+
:title="isOwn(list) ? undefined : t('orderLists.saveTo.sharedReadOnly')"
|
|
240
|
+
@click="toggle(list)"
|
|
241
|
+
>
|
|
242
|
+
<span class="flex items-center justify-between gap-3">
|
|
243
|
+
<span class="min-w-0">
|
|
244
|
+
<span class="block text-sm font-medium text-highlighted truncate">
|
|
245
|
+
{{ list.name }}
|
|
246
|
+
</span>
|
|
247
|
+
<span class="block text-xs text-muted">
|
|
248
|
+
{{ t('orderLists.columns.positions') }}: {{ list.positions.length }}
|
|
249
|
+
<template v-if="!isOwn(list)">
|
|
250
|
+
· {{ list.owner.name }}
|
|
251
|
+
</template>
|
|
252
|
+
</span>
|
|
253
|
+
</span>
|
|
254
|
+
<UIcon
|
|
255
|
+
v-if="contains(list)"
|
|
256
|
+
:name="icon('success')"
|
|
257
|
+
class="size-5 text-primary shrink-0"
|
|
258
|
+
/>
|
|
259
|
+
</span>
|
|
260
|
+
</button>
|
|
261
|
+
</div>
|
|
262
|
+
<p
|
|
263
|
+
v-else
|
|
264
|
+
class="text-sm text-muted"
|
|
265
|
+
>
|
|
266
|
+
{{ t('orderLists.saveTo.empty') }}
|
|
267
|
+
</p>
|
|
268
|
+
|
|
269
|
+
<!-- Inline create -->
|
|
270
|
+
<div class="pt-3 border-t border-(--ui-border) flex items-center gap-2">
|
|
271
|
+
<UInput
|
|
272
|
+
v-model="newListName"
|
|
273
|
+
class="flex-1"
|
|
274
|
+
:placeholder="t('orderLists.namePlaceholder')"
|
|
275
|
+
@keydown.enter="createAndAdd"
|
|
276
|
+
/>
|
|
277
|
+
<UButton
|
|
278
|
+
color="primary"
|
|
279
|
+
tabindex="0"
|
|
280
|
+
:disabled="!newListName.trim()"
|
|
281
|
+
:loading="creating"
|
|
282
|
+
:icon="icon('plus')"
|
|
283
|
+
:label="t('orderLists.saveTo.createAndAdd')"
|
|
284
|
+
@click="createAndAdd"
|
|
285
|
+
/>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
</template>
|
|
289
|
+
</UModal>
|
|
290
|
+
</div>
|
|
291
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
3
|
+
|
|
4
|
+
import type { ProductDetailAttribute } from "../../../interfaces/product-detail";
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
attributes: ProductDetailAttribute[];
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const { t } = useI18n();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div v-if="attributes.length">
|
|
15
|
+
<h3 class="text-lg font-semibold text-highlighted mb-4">
|
|
16
|
+
{{ t('product.specifications') }}
|
|
17
|
+
</h3>
|
|
18
|
+
<dl class="divide-y divide-(--ui-border) border-y border-(--ui-border)">
|
|
19
|
+
<div
|
|
20
|
+
v-for="attr in attributes"
|
|
21
|
+
:key="attr.id"
|
|
22
|
+
class="grid grid-cols-2 gap-4 py-2.5 text-sm"
|
|
23
|
+
>
|
|
24
|
+
<dt class="text-muted">
|
|
25
|
+
{{ attr.name }}
|
|
26
|
+
</dt>
|
|
27
|
+
<dd class="m-0 text-highlighted">
|
|
28
|
+
{{ attr.value }}
|
|
29
|
+
</dd>
|
|
30
|
+
</div>
|
|
31
|
+
</dl>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|