@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,108 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import CartRecommendCard from "./CartRecommendCard.vue";
|
|
3
|
+
import { accountApi } from "../../../api/account";
|
|
4
|
+
|
|
5
|
+
import type { AccountOrderListResponse } from "../../../interfaces/account/order-list";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* "Recently ordered" strip on the cart page: the fastest path to a B2B
|
|
9
|
+
* reorder. Flattens the order history into unique articles not yet in
|
|
10
|
+
* the cart; one click adds them. Renders nothing for guests or buyers
|
|
11
|
+
* without history.
|
|
12
|
+
*/
|
|
13
|
+
const { icon } = useIcons();
|
|
14
|
+
const { t } = useI18n();
|
|
15
|
+
const toast = useToast();
|
|
16
|
+
const cart = useCartStore();
|
|
17
|
+
|
|
18
|
+
const { data } = useFetch<AccountOrderListResponse>(accountApi.orders(), {
|
|
19
|
+
key: "account-orders",
|
|
20
|
+
server: false,
|
|
21
|
+
lazy: true,
|
|
22
|
+
default: () => ({ orders: [] }),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const suggestions = computed(() => {
|
|
26
|
+
const inCart = new Set(cart.items.map(item => item.id));
|
|
27
|
+
const seen = new Set<string>();
|
|
28
|
+
const result: {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
image?: string;
|
|
32
|
+
sku: string;
|
|
33
|
+
price: number;
|
|
34
|
+
categorySlug?: string;
|
|
35
|
+
subcategorySlug?: string;
|
|
36
|
+
}[] = [];
|
|
37
|
+
for (const order of data.value.orders) {
|
|
38
|
+
if (order.status === "cancelled") {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
for (const position of order.positions) {
|
|
42
|
+
if (seen.has(position.id) || inCart.has(position.id)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
seen.add(position.id);
|
|
46
|
+
result.push({
|
|
47
|
+
id: position.id,
|
|
48
|
+
name: position.name,
|
|
49
|
+
...(position.image ? { image: position.image } : {}),
|
|
50
|
+
sku: position.sku,
|
|
51
|
+
price: position.unitPrice,
|
|
52
|
+
...(position.categorySlug ? { categorySlug: position.categorySlug } : {}),
|
|
53
|
+
...(position.subcategorySlug ? { subcategorySlug: position.subcategorySlug } : {}),
|
|
54
|
+
});
|
|
55
|
+
if (result.length >= 8) {
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
function add(suggestion: (typeof suggestions.value)[number]): void {
|
|
64
|
+
const ok = cart.addItem({
|
|
65
|
+
id: suggestion.id,
|
|
66
|
+
name: suggestion.name,
|
|
67
|
+
image: suggestion.image ?? "",
|
|
68
|
+
sku: suggestion.sku,
|
|
69
|
+
price: suggestion.price,
|
|
70
|
+
categorySlug: suggestion.categorySlug,
|
|
71
|
+
subcategorySlug: suggestion.subcategorySlug,
|
|
72
|
+
}, { chooseTarget: true });
|
|
73
|
+
if (ok) {
|
|
74
|
+
toast.add({
|
|
75
|
+
title: t("product.actions.addedToCart", { quantity: 1, name: suggestion.name }),
|
|
76
|
+
color: "primary",
|
|
77
|
+
icon: icon("check"),
|
|
78
|
+
duration: 1000,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<template>
|
|
85
|
+
<section
|
|
86
|
+
v-if="suggestions.length"
|
|
87
|
+
class="print:hidden"
|
|
88
|
+
>
|
|
89
|
+
<h2 class="flex items-center gap-2 text-sm font-semibold text-highlighted mb-3">
|
|
90
|
+
<UIcon
|
|
91
|
+
:name="icon('reset')"
|
|
92
|
+
class="size-4 text-primary"
|
|
93
|
+
/>
|
|
94
|
+
{{ t('cart.boost.reorderTitle') }}
|
|
95
|
+
</h2>
|
|
96
|
+
<div class="flex gap-3 overflow-x-auto pb-2 -mx-1 px-1">
|
|
97
|
+
<CartRecommendCard
|
|
98
|
+
v-for="suggestion in suggestions"
|
|
99
|
+
:key="suggestion.id"
|
|
100
|
+
:name="suggestion.name"
|
|
101
|
+
:image="suggestion.image"
|
|
102
|
+
:sku="suggestion.sku"
|
|
103
|
+
:price="suggestion.price"
|
|
104
|
+
@add="add(suggestion)"
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</section>
|
|
108
|
+
</template>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import CartPositionList from "../view/CartPositionList.vue";
|
|
3
|
+
import type { CalculatedCartLine } from "../../../interfaces/cart-calculation";
|
|
4
|
+
import type { CartItem } from "../../../interfaces/cart-item";
|
|
5
|
+
import type { CartRequisitionMeta } from "../../../interfaces/persisted-cart";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Frame around the positions of one loaded requisition: collapsible, shows
|
|
9
|
+
* requester, request date and workflow name, and offers unloading the
|
|
10
|
+
* requisition from the cart (spec: Bestellanforderung im Warenkorb).
|
|
11
|
+
*/
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
requisition: CartRequisitionMeta;
|
|
14
|
+
items: CartItem[];
|
|
15
|
+
linesByKey: Map<string, CalculatedCartLine>;
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
}>();
|
|
18
|
+
|
|
19
|
+
const { icon } = useIcons();
|
|
20
|
+
const { t, d } = useI18n();
|
|
21
|
+
const cart = useCartStore();
|
|
22
|
+
|
|
23
|
+
const open = ref(true);
|
|
24
|
+
|
|
25
|
+
const requestedAt = computed(() => d(new Date(props.requisition.requestedAt), {
|
|
26
|
+
dateStyle: "medium",
|
|
27
|
+
timeStyle: "short",
|
|
28
|
+
}));
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<section class="border border-(--ui-primary)/40 rounded-lg overflow-hidden">
|
|
33
|
+
<header class="flex items-center gap-3 bg-primary/5 px-3 py-2.5">
|
|
34
|
+
<UButton
|
|
35
|
+
:icon="icon(open ? 'chevron-up' : 'chevron-down')"
|
|
36
|
+
color="neutral"
|
|
37
|
+
variant="ghost"
|
|
38
|
+
size="xs"
|
|
39
|
+
tabindex="0"
|
|
40
|
+
:aria-label="t(open ? 'cart.requisition.collapse' : 'cart.requisition.expand')"
|
|
41
|
+
@click="open = !open"
|
|
42
|
+
/>
|
|
43
|
+
<div class="flex flex-col min-w-0 flex-1">
|
|
44
|
+
<span class="text-sm font-medium text-highlighted truncate">
|
|
45
|
+
{{ t('cart.requisition.title') }} · {{ requisition.workflowName }}
|
|
46
|
+
</span>
|
|
47
|
+
<span class="text-xs text-muted">
|
|
48
|
+
{{ t('cart.requisition.meta', { name: requisition.requestedBy.name, date: requestedAt }) }}
|
|
49
|
+
</span>
|
|
50
|
+
</div>
|
|
51
|
+
<UButton
|
|
52
|
+
v-if="!readonly"
|
|
53
|
+
:icon="icon('logout')"
|
|
54
|
+
color="neutral"
|
|
55
|
+
variant="ghost"
|
|
56
|
+
size="xs"
|
|
57
|
+
tabindex="0"
|
|
58
|
+
:label="t('cart.requisition.unload')"
|
|
59
|
+
@click="cart.removeRequisition(requisition.id)"
|
|
60
|
+
/>
|
|
61
|
+
</header>
|
|
62
|
+
<div
|
|
63
|
+
v-show="open"
|
|
64
|
+
class="px-3"
|
|
65
|
+
>
|
|
66
|
+
<CartPositionList
|
|
67
|
+
:items="items"
|
|
68
|
+
:lines-by-key="linesByKey"
|
|
69
|
+
:scope="requisition.id"
|
|
70
|
+
:readonly="readonly"
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
</section>
|
|
74
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="divide-y divide-(--ui-border)">
|
|
3
|
+
<li
|
|
4
|
+
v-for="i in 3"
|
|
5
|
+
:key="i"
|
|
6
|
+
class="flex items-center gap-3 py-3"
|
|
7
|
+
>
|
|
8
|
+
<USkeleton class="w-14 h-14 shrink-0 rounded-md" />
|
|
9
|
+
<div class="flex flex-col gap-1.5 flex-1">
|
|
10
|
+
<USkeleton class="h-4 w-3/4" />
|
|
11
|
+
<USkeleton class="h-3 w-1/4" />
|
|
12
|
+
<USkeleton class="h-3 w-1/3" />
|
|
13
|
+
<USkeleton class="h-7 w-28 mt-1 rounded-md" />
|
|
14
|
+
</div>
|
|
15
|
+
<USkeleton class="w-6 h-6 self-start shrink-0 rounded-md" />
|
|
16
|
+
</li>
|
|
17
|
+
</ul>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { t } = useI18n();
|
|
3
|
+
const cart = useCartStore();
|
|
4
|
+
const { to } = useAppUrl();
|
|
5
|
+
|
|
6
|
+
async function checkout() {
|
|
7
|
+
cart.closeCart();
|
|
8
|
+
await navigateTo(to("/cart"));
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div class="flex flex-col gap-3 w-full">
|
|
14
|
+
<CartSummaryBreakdown />
|
|
15
|
+
<div class="flex justify-end">
|
|
16
|
+
<UButton
|
|
17
|
+
color="primary"
|
|
18
|
+
variant="solid"
|
|
19
|
+
:label="t('cart.actions.proceedToCart')"
|
|
20
|
+
tabindex="0"
|
|
21
|
+
@click="checkout"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { t } = useI18n();
|
|
3
|
+
const { subtotalDisplay, visibleTaxRows, total } = storeToRefs(useCartStore());
|
|
4
|
+
const { formatCurrency, taxRateLabel } = useCartSummaryFormatting();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<dl class="flex flex-col gap-3 m-0">
|
|
9
|
+
<div class="flex justify-between text-sm text-muted">
|
|
10
|
+
<dt>{{ t('summary.subtotal') }}</dt>
|
|
11
|
+
<dd class="m-0">
|
|
12
|
+
{{ formatCurrency(subtotalDisplay) }}
|
|
13
|
+
</dd>
|
|
14
|
+
</div>
|
|
15
|
+
<div
|
|
16
|
+
v-for="taxRow in visibleTaxRows"
|
|
17
|
+
:key="taxRow.rate"
|
|
18
|
+
class="flex justify-between text-sm text-muted"
|
|
19
|
+
>
|
|
20
|
+
<dt>{{ taxRateLabel(taxRow.rate) }}</dt>
|
|
21
|
+
<dd class="m-0">
|
|
22
|
+
{{ formatCurrency(taxRow.amount) }}
|
|
23
|
+
</dd>
|
|
24
|
+
</div>
|
|
25
|
+
<div
|
|
26
|
+
class="flex justify-between text-sm font-semibold text-highlighted
|
|
27
|
+
border-t border-(--ui-border) pt-3"
|
|
28
|
+
>
|
|
29
|
+
<dt>{{ t('summary.total') }}</dt>
|
|
30
|
+
<dd class="m-0">
|
|
31
|
+
{{ formatCurrency(total) }}
|
|
32
|
+
</dd>
|
|
33
|
+
</div>
|
|
34
|
+
</dl>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import CartNameModal from "../manage/CartNameModal.vue";
|
|
3
|
+
import type { DropdownMenuItem } from "@nuxt/ui";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cart switcher for the cart page (multiple-carts feature): pick the
|
|
7
|
+
* active cart, create a new one, rename or delete the current one.
|
|
8
|
+
* Renders nothing while the org flag is off.
|
|
9
|
+
*/
|
|
10
|
+
const { icon } = useIcons();
|
|
11
|
+
const { t } = useI18n();
|
|
12
|
+
const toast = useToast();
|
|
13
|
+
const cart = useCartStore();
|
|
14
|
+
const { settings } = useB2BContext();
|
|
15
|
+
|
|
16
|
+
const enabled = computed(() => settings.value?.cart.multipleCarts === true);
|
|
17
|
+
|
|
18
|
+
const createOpen = ref(false);
|
|
19
|
+
const renameOpen = ref(false);
|
|
20
|
+
const deleteOpen = ref(false);
|
|
21
|
+
|
|
22
|
+
const menuItems = computed<DropdownMenuItem[][]>(() => [
|
|
23
|
+
cart.cartSummaries.map(summary => ({
|
|
24
|
+
label: summary.name,
|
|
25
|
+
...(summary.active ? { icon: icon("success") } : {}),
|
|
26
|
+
suffix: `${summary.positions} · ${summary.itemCount}×`,
|
|
27
|
+
onSelect: () => {
|
|
28
|
+
if (!summary.active) {
|
|
29
|
+
cart.switchCart(summary.id);
|
|
30
|
+
toast.add({
|
|
31
|
+
title: t("cart.multi.switched", { name: summary.name }),
|
|
32
|
+
color: "primary",
|
|
33
|
+
icon: icon("cart"),
|
|
34
|
+
duration: 1500,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
})),
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
label: t("cart.multi.newCart"),
|
|
42
|
+
icon: icon("plus"),
|
|
43
|
+
onSelect: () => {
|
|
44
|
+
createOpen.value = true;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: t("cart.multi.rename"),
|
|
49
|
+
icon: icon("edit"),
|
|
50
|
+
onSelect: () => {
|
|
51
|
+
renameOpen.value = true;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: t("cart.multi.delete"),
|
|
56
|
+
icon: icon("delete"),
|
|
57
|
+
color: "error",
|
|
58
|
+
onSelect: () => {
|
|
59
|
+
deleteOpen.value = true;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
function onCreate(name: string): void {
|
|
66
|
+
cart.createCart(name);
|
|
67
|
+
toast.add({
|
|
68
|
+
title: t("cart.multi.created", { name }),
|
|
69
|
+
color: "success",
|
|
70
|
+
icon: icon("success"),
|
|
71
|
+
duration: 1500,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function onRename(name: string): void {
|
|
76
|
+
cart.renameCart(cart.activeCartId, name);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function onDelete(): void {
|
|
80
|
+
cart.deleteCart(cart.activeCartId);
|
|
81
|
+
deleteOpen.value = false;
|
|
82
|
+
toast.add({
|
|
83
|
+
title: t("cart.multi.deleted"),
|
|
84
|
+
color: "success",
|
|
85
|
+
icon: icon("success"),
|
|
86
|
+
duration: 1500,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<div v-if="enabled">
|
|
93
|
+
<UDropdownMenu :items="menuItems">
|
|
94
|
+
<UButton
|
|
95
|
+
color="neutral"
|
|
96
|
+
variant="outline"
|
|
97
|
+
size="sm"
|
|
98
|
+
tabindex="0"
|
|
99
|
+
:icon="icon('cart')"
|
|
100
|
+
:trailing-icon="icon('chevron-down')"
|
|
101
|
+
:label="cart.activeCartName"
|
|
102
|
+
:aria-label="t('cart.multi.switcher')"
|
|
103
|
+
/>
|
|
104
|
+
</UDropdownMenu>
|
|
105
|
+
|
|
106
|
+
<CartNameModal
|
|
107
|
+
v-model:open="createOpen"
|
|
108
|
+
mode="create"
|
|
109
|
+
@save="onCreate"
|
|
110
|
+
/>
|
|
111
|
+
<CartNameModal
|
|
112
|
+
v-model:open="renameOpen"
|
|
113
|
+
mode="rename"
|
|
114
|
+
:initial-name="cart.activeCartName"
|
|
115
|
+
@save="onRename"
|
|
116
|
+
/>
|
|
117
|
+
|
|
118
|
+
<UModal
|
|
119
|
+
v-model:open="deleteOpen"
|
|
120
|
+
:title="t('cart.multi.deleteTitle')"
|
|
121
|
+
>
|
|
122
|
+
<template #body>
|
|
123
|
+
<p class="text-sm text-muted">
|
|
124
|
+
{{ t('cart.multi.deleteDescription', {
|
|
125
|
+
name: cart.activeCartName,
|
|
126
|
+
count: cart.items.length,
|
|
127
|
+
}) }}
|
|
128
|
+
</p>
|
|
129
|
+
</template>
|
|
130
|
+
<template #footer>
|
|
131
|
+
<UButton
|
|
132
|
+
color="neutral"
|
|
133
|
+
variant="ghost"
|
|
134
|
+
tabindex="0"
|
|
135
|
+
:label="t('cart.item.cancel')"
|
|
136
|
+
@click="deleteOpen = false"
|
|
137
|
+
/>
|
|
138
|
+
<UButton
|
|
139
|
+
color="error"
|
|
140
|
+
tabindex="0"
|
|
141
|
+
:label="t('cart.multi.delete')"
|
|
142
|
+
@click="onDelete"
|
|
143
|
+
/>
|
|
144
|
+
</template>
|
|
145
|
+
</UModal>
|
|
146
|
+
</div>
|
|
147
|
+
</template>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Target-cart dialog for the multiple-carts feature: after a single add
|
|
4
|
+
* the buyer picks which cart the item should live in (default: the
|
|
5
|
+
* active one). The "always use the active cart" option persists as a
|
|
6
|
+
* preference and suppresses the dialog — editable under Account →
|
|
7
|
+
* Ordering settings. This component also wires the org feature flag to
|
|
8
|
+
* the cart store's add interception.
|
|
9
|
+
*/
|
|
10
|
+
const { icon } = useIcons();
|
|
11
|
+
const { t } = useI18n();
|
|
12
|
+
const toast = useToast();
|
|
13
|
+
const cart = useCartStore();
|
|
14
|
+
const { settings } = useB2BContext();
|
|
15
|
+
|
|
16
|
+
const multiCartEnabled = computed(() => settings.value?.cart.multipleCarts === true);
|
|
17
|
+
|
|
18
|
+
// The store intercepts single adds only while the flag is on and the
|
|
19
|
+
// buyer has not opted into "always active cart".
|
|
20
|
+
watchEffect(() => {
|
|
21
|
+
cart.interceptAdds = multiCartEnabled.value && !cart.alwaysActiveCart;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const open = computed({
|
|
25
|
+
get: () => cart.pendingAdd !== null,
|
|
26
|
+
set: (value: boolean) => {
|
|
27
|
+
if (!value) {
|
|
28
|
+
cart.pendingAdd = null;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const selectedCartId = ref("");
|
|
34
|
+
const alwaysActive = ref(false);
|
|
35
|
+
|
|
36
|
+
watch(() => cart.pendingAdd, (pending) => {
|
|
37
|
+
if (pending) {
|
|
38
|
+
selectedCartId.value = cart.activeCartId;
|
|
39
|
+
alwaysActive.value = false;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function confirm(): void {
|
|
44
|
+
const pending = cart.pendingAdd;
|
|
45
|
+
if (!pending) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (selectedCartId.value !== cart.activeCartId) {
|
|
49
|
+
const target = cart.cartSummaries.find(summary => summary.id === selectedCartId.value);
|
|
50
|
+
cart.moveLineToCart(pending.lineKey, selectedCartId.value);
|
|
51
|
+
toast.add({
|
|
52
|
+
title: t("cart.multi.modal.moved", { name: target?.name ?? "" }),
|
|
53
|
+
color: "success",
|
|
54
|
+
icon: icon("success"),
|
|
55
|
+
duration: 2000,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (alwaysActive.value) {
|
|
59
|
+
cart.setAlwaysActiveCart(true);
|
|
60
|
+
}
|
|
61
|
+
cart.pendingAdd = null;
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<UModal
|
|
67
|
+
v-model:open="open"
|
|
68
|
+
:title="t('cart.multi.modal.title')"
|
|
69
|
+
>
|
|
70
|
+
<template #body>
|
|
71
|
+
<div class="space-y-4">
|
|
72
|
+
<p class="text-sm text-muted">
|
|
73
|
+
{{ t('cart.multi.modal.description', { name: cart.pendingAdd?.name ?? '' }) }}
|
|
74
|
+
</p>
|
|
75
|
+
|
|
76
|
+
<div class="space-y-2">
|
|
77
|
+
<button
|
|
78
|
+
v-for="summary in cart.cartSummaries"
|
|
79
|
+
:key="summary.id"
|
|
80
|
+
type="button"
|
|
81
|
+
tabindex="0"
|
|
82
|
+
class="w-full text-left p-3 rounded-lg border transition-colors cursor-pointer
|
|
83
|
+
focus:outline-none focus-visible:ring-2 focus-visible:ring-(--ui-primary)"
|
|
84
|
+
:class="selectedCartId === summary.id
|
|
85
|
+
? 'border-(--ui-primary) bg-primary/5 ring-1 ring-(--ui-primary)'
|
|
86
|
+
: 'border-(--ui-border) hover:border-(--ui-border-accented)'"
|
|
87
|
+
:aria-pressed="selectedCartId === summary.id"
|
|
88
|
+
@click="selectedCartId = summary.id"
|
|
89
|
+
>
|
|
90
|
+
<span class="flex items-center justify-between gap-3">
|
|
91
|
+
<span class="flex items-center gap-2 min-w-0">
|
|
92
|
+
<UIcon
|
|
93
|
+
:name="icon('cart')"
|
|
94
|
+
class="size-4 shrink-0"
|
|
95
|
+
:class="selectedCartId === summary.id ? 'text-primary' : 'text-dimmed'"
|
|
96
|
+
/>
|
|
97
|
+
<span class="text-sm font-medium text-highlighted truncate">{{ summary.name }}</span>
|
|
98
|
+
<UBadge
|
|
99
|
+
v-if="summary.active"
|
|
100
|
+
color="primary"
|
|
101
|
+
variant="subtle"
|
|
102
|
+
size="sm"
|
|
103
|
+
:label="t('cart.multi.activeBadge')"
|
|
104
|
+
/>
|
|
105
|
+
</span>
|
|
106
|
+
<span class="text-xs text-muted tabular-nums shrink-0">
|
|
107
|
+
{{ summary.positions }} · {{ summary.itemCount }}×
|
|
108
|
+
</span>
|
|
109
|
+
</span>
|
|
110
|
+
</button>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<UCheckbox
|
|
114
|
+
v-model="alwaysActive"
|
|
115
|
+
:label="t('cart.multi.modal.alwaysActive')"
|
|
116
|
+
:description="t('cart.multi.modal.alwaysActiveHint')"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
<template #footer>
|
|
121
|
+
<UButton
|
|
122
|
+
color="primary"
|
|
123
|
+
tabindex="0"
|
|
124
|
+
:label="t('cart.multi.modal.confirm')"
|
|
125
|
+
@click="confirm"
|
|
126
|
+
/>
|
|
127
|
+
</template>
|
|
128
|
+
</UModal>
|
|
129
|
+
</template>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ApprovalLimitEvaluation } from "../../../interfaces/b2b";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Approval limits evaluated against the current cart, rendered above the
|
|
6
|
+
* CTA. Budget-style limits show their utilization; exceeded limits explain
|
|
7
|
+
* the approval consequence (approver, escalation time frame).
|
|
8
|
+
*/
|
|
9
|
+
defineProps<{
|
|
10
|
+
limits: ApprovalLimitEvaluation[];
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const { icon } = useIcons();
|
|
14
|
+
const { t } = useI18n();
|
|
15
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
16
|
+
|
|
17
|
+
function progress(limit: ApprovalLimitEvaluation): number | null {
|
|
18
|
+
if (limit.threshold === undefined || limit.actual === undefined || limit.threshold <= 0) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return Math.min(100, Math.round((limit.actual / limit.threshold) * 100));
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div
|
|
27
|
+
v-if="limits.length"
|
|
28
|
+
class="space-y-2.5"
|
|
29
|
+
>
|
|
30
|
+
<h3 class="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
31
|
+
{{ t('cart.approvals.title') }}
|
|
32
|
+
</h3>
|
|
33
|
+
<div
|
|
34
|
+
v-for="limit in limits"
|
|
35
|
+
:key="limit.limitId"
|
|
36
|
+
class="rounded-lg border p-2.5 space-y-1.5"
|
|
37
|
+
:class="limit.status === 'exceeded'
|
|
38
|
+
? 'border-warning/40 bg-warning/5'
|
|
39
|
+
: 'border-default'"
|
|
40
|
+
>
|
|
41
|
+
<div class="flex items-center justify-between gap-2">
|
|
42
|
+
<span class="text-xs font-medium text-highlighted">{{ limit.label }}</span>
|
|
43
|
+
<UBadge
|
|
44
|
+
v-if="limit.status === 'exceeded'"
|
|
45
|
+
color="warning"
|
|
46
|
+
variant="subtle"
|
|
47
|
+
size="sm"
|
|
48
|
+
:label="t('cart.approvals.exceeded')"
|
|
49
|
+
/>
|
|
50
|
+
<UIcon
|
|
51
|
+
v-else
|
|
52
|
+
:name="icon('success')"
|
|
53
|
+
class="size-4 text-success"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<template v-if="progress(limit) !== null">
|
|
58
|
+
<div class="h-1.5 rounded-full bg-elevated overflow-hidden">
|
|
59
|
+
<div
|
|
60
|
+
class="h-full rounded-full transition-all"
|
|
61
|
+
:class="limit.status === 'exceeded' ? 'bg-warning' : 'bg-primary'"
|
|
62
|
+
:style="{ width: `${progress(limit)}%` }"
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
<p class="text-[0.6875rem] text-muted">
|
|
66
|
+
{{ t('cart.approvals.usage', {
|
|
67
|
+
actual: formatCurrency(limit.actual ?? 0),
|
|
68
|
+
threshold: formatCurrency(limit.threshold ?? 0),
|
|
69
|
+
}) }}
|
|
70
|
+
<template v-if="limit.exceededBy">
|
|
71
|
+
· {{ t('cart.approvals.exceededBy', { amount: formatCurrency(limit.exceededBy) }) }}
|
|
72
|
+
</template>
|
|
73
|
+
</p>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<p
|
|
77
|
+
v-if="limit.status === 'exceeded'"
|
|
78
|
+
class="text-[0.6875rem] text-muted"
|
|
79
|
+
>
|
|
80
|
+
{{ limit.approval.required
|
|
81
|
+
? t('cart.approvals.approvalRequired', {
|
|
82
|
+
approver: limit.approval.approverName ?? t('cart.approvals.unknownApprover'),
|
|
83
|
+
hours: limit.approval.timeLimitHours ?? 48,
|
|
84
|
+
})
|
|
85
|
+
: t('cart.approvals.infoOnly') }}
|
|
86
|
+
</p>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|