@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,512 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { productsApi } from "../../../api/products";
|
|
3
|
+
import { getBaseUnitPrice, getPriceTiers, type Product } from "../../../composables/useProducts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Direct order, structured after the Paul Horn IS8 pattern: three tabs —
|
|
7
|
+
* quick row entry (article no., customer article no., quantity, resolved
|
|
8
|
+
* name), whole-order file upload (template download per format) and bulk
|
|
9
|
+
* capture via clipboard paste with a selectable separator.
|
|
10
|
+
*/
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
/** Embedded in a modal (cart page): emit instead of navigating. */
|
|
13
|
+
embedded?: boolean;
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
(e: "added"): void;
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
const { icon } = useIcons();
|
|
21
|
+
const { t } = useI18n();
|
|
22
|
+
const { to } = useAppUrl();
|
|
23
|
+
const { locale } = useI18n();
|
|
24
|
+
const toast = useToast();
|
|
25
|
+
const cart = useCartStore();
|
|
26
|
+
|
|
27
|
+
const tab = ref("entry");
|
|
28
|
+
const tabs = computed(() => [
|
|
29
|
+
{ value: "entry", label: t("directOrder.tabs.entry") },
|
|
30
|
+
{ value: "upload", label: t("directOrder.tabs.upload") },
|
|
31
|
+
{ value: "paste", label: t("directOrder.tabs.paste") },
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
const { data: products } = useFetch<Product[]>(productsApi.list(), {
|
|
35
|
+
key: "direct-order-products",
|
|
36
|
+
headers: computed(() => ({ "x-locale": locale.value })),
|
|
37
|
+
server: false,
|
|
38
|
+
lazy: true,
|
|
39
|
+
default: () => [],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
function findProduct(sku: string): Product | undefined {
|
|
43
|
+
const needle = sku.trim().toLowerCase();
|
|
44
|
+
if (!needle) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
return (products.value ?? []).find(p => p.sku.toLowerCase() === needle)
|
|
48
|
+
?? (products.value ?? []).find(p => p.sku.toLowerCase().includes(needle));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ---- tab 1: quick row entry ----------------------------------------- */
|
|
52
|
+
interface Row {
|
|
53
|
+
sku: string;
|
|
54
|
+
customSku: string;
|
|
55
|
+
quantity: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const emptyRow = (): Row => ({ sku: "", customSku: "", quantity: 1 });
|
|
59
|
+
const rows = ref<Row[]>([emptyRow()]);
|
|
60
|
+
|
|
61
|
+
const resolvedRows = computed(() => rows.value.map((row) => {
|
|
62
|
+
const product = row.sku.trim() ? findProduct(row.sku) : undefined;
|
|
63
|
+
return {
|
|
64
|
+
...row,
|
|
65
|
+
product,
|
|
66
|
+
state: !row.sku.trim() ? "empty" as const : product ? "found" as const : "unknown" as const,
|
|
67
|
+
};
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
const validRowCount = computed(() =>
|
|
71
|
+
resolvedRows.value.filter(row => row.state === "found").length,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
function addRow(): void {
|
|
75
|
+
rows.value.push(emptyRow());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function removeRow(index: number): void {
|
|
79
|
+
rows.value.splice(index, 1);
|
|
80
|
+
if (rows.value.length === 0) {
|
|
81
|
+
addRow();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* ---- tab 2: file upload ----------------------------------------------- */
|
|
86
|
+
type UploadFormat = "xlsx" | "csv";
|
|
87
|
+
const uploadFormat = ref<UploadFormat>("xlsx");
|
|
88
|
+
|
|
89
|
+
const formatItems = computed(() => ([
|
|
90
|
+
{ value: "xlsx", label: t("directOrder.upload.formats.xlsx") },
|
|
91
|
+
{ value: "csv", label: t("directOrder.upload.formats.csv") },
|
|
92
|
+
]));
|
|
93
|
+
|
|
94
|
+
const templateUrl = computed(() => `/templates/direct-order-template.${uploadFormat.value}`);
|
|
95
|
+
|
|
96
|
+
const uploadText = ref("");
|
|
97
|
+
const uploadFileName = ref("");
|
|
98
|
+
|
|
99
|
+
function onFileUpload(event: Event): void {
|
|
100
|
+
const file = (event.target as HTMLInputElement).files?.[0];
|
|
101
|
+
if (!file) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
uploadFileName.value = file.name;
|
|
105
|
+
if (file.name.toLowerCase().endsWith(".xlsx")) {
|
|
106
|
+
uploadText.value = "";
|
|
107
|
+
toast.add({
|
|
108
|
+
title: t("directOrder.upload.xlsxDemoHint"),
|
|
109
|
+
color: "info",
|
|
110
|
+
icon: icon("info"),
|
|
111
|
+
duration: 4000,
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const reader = new FileReader();
|
|
116
|
+
reader.onload = () => {
|
|
117
|
+
uploadText.value = String(reader.result ?? "");
|
|
118
|
+
};
|
|
119
|
+
reader.readAsText(file);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const parsedUpload = computed(() => parseLines(uploadText.value, /[;,\t]/));
|
|
123
|
+
const uploadFoundCount = computed(() => parsedUpload.value.filter(r => r.state === "found").length);
|
|
124
|
+
|
|
125
|
+
/* ---- tab 3: bulk capture (paste) -------------------------------------- */
|
|
126
|
+
type Separator = "comma" | "semicolon";
|
|
127
|
+
const separator = ref<Separator>("comma");
|
|
128
|
+
|
|
129
|
+
const separatorItems = computed(() => ([
|
|
130
|
+
{ value: "comma", label: t("directOrder.paste.separators.comma") },
|
|
131
|
+
{ value: "semicolon", label: t("directOrder.paste.separators.semicolon") },
|
|
132
|
+
]));
|
|
133
|
+
|
|
134
|
+
const separatorChar = computed(() => (separator.value === "comma" ? "," : ";"));
|
|
135
|
+
|
|
136
|
+
const pastePlaceholder = computed(() => {
|
|
137
|
+
const sep = separatorChar.value;
|
|
138
|
+
return [
|
|
139
|
+
t("directOrder.columns.sku"),
|
|
140
|
+
t("directOrder.columns.customSku"),
|
|
141
|
+
t("directOrder.columns.quantity"),
|
|
142
|
+
].join(sep);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const pasteText = ref("");
|
|
146
|
+
|
|
147
|
+
const parsedPaste = computed(() =>
|
|
148
|
+
parseLines(pasteText.value, new RegExp(`[${separatorChar.value}\\t]`)));
|
|
149
|
+
const pasteFoundCount = computed(() => parsedPaste.value.filter(r => r.state === "found").length);
|
|
150
|
+
|
|
151
|
+
/* ---- shared parsing + add to cart -------------------------------------- */
|
|
152
|
+
interface ParsedLine {
|
|
153
|
+
sku: string;
|
|
154
|
+
customSku: string;
|
|
155
|
+
quantity: number;
|
|
156
|
+
product: Product | undefined;
|
|
157
|
+
state: "found" | "unknown";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function parseLines(text: string, splitter: RegExp): ParsedLine[] {
|
|
161
|
+
return text
|
|
162
|
+
.split(/\r?\n/)
|
|
163
|
+
.map(line => line.trim())
|
|
164
|
+
.filter(Boolean)
|
|
165
|
+
.map((line) => {
|
|
166
|
+
const [sku = "", customSku = "", qty = "1"] = line.split(splitter).map(part => part.trim());
|
|
167
|
+
const product = findProduct(sku);
|
|
168
|
+
return {
|
|
169
|
+
sku,
|
|
170
|
+
customSku,
|
|
171
|
+
quantity: Math.max(1, parseInt(qty, 10) || 1),
|
|
172
|
+
product,
|
|
173
|
+
state: product ? "found" as const : "unknown" as const,
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function buildTiers(prices: { [key: string]: number }[]) {
|
|
179
|
+
return getPriceTiers(prices).map(tier => ({
|
|
180
|
+
minQuantity: tier.quantity,
|
|
181
|
+
unitPrice: tier.unitCents / 100,
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function addProductToCart(product: Product, quantity: number, customSku?: string): boolean {
|
|
186
|
+
const price = getBaseUnitPrice(product.prices);
|
|
187
|
+
if (price === null) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
const ok = cart.addItem({
|
|
191
|
+
id: product.id,
|
|
192
|
+
name: product.name,
|
|
193
|
+
image: product.image,
|
|
194
|
+
sku: product.sku,
|
|
195
|
+
price,
|
|
196
|
+
taxRate: product.tax.rate,
|
|
197
|
+
priceTiers: buildTiers(product.prices),
|
|
198
|
+
categorySlug: product.categorySlug,
|
|
199
|
+
subcategorySlug: product.subcategorySlug,
|
|
200
|
+
...(customSku?.trim() ? { customSku: customSku.trim() } : {}),
|
|
201
|
+
...(typeof product.maxOrderQuantity === "number"
|
|
202
|
+
? { maxOrderQuantity: product.maxOrderQuantity }
|
|
203
|
+
: {}),
|
|
204
|
+
});
|
|
205
|
+
if (ok && quantity > 1) {
|
|
206
|
+
const item = cart.items.find(i => i.id === product.id && !i.requisitionId);
|
|
207
|
+
if (item) {
|
|
208
|
+
cart.updateQuantityByKey(cart.keyOf(item), item.quantity + quantity - 1);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return ok;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function submitParsed(lines: ParsedLine[]): Promise<void> {
|
|
215
|
+
let added = 0;
|
|
216
|
+
for (const line of lines) {
|
|
217
|
+
if (line.state === "found" && line.product) {
|
|
218
|
+
if (addProductToCart(line.product, line.quantity, line.customSku)) {
|
|
219
|
+
added++;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
await finish(added);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function submitRows(): Promise<void> {
|
|
227
|
+
let added = 0;
|
|
228
|
+
for (const row of resolvedRows.value) {
|
|
229
|
+
if (row.state === "found" && row.product) {
|
|
230
|
+
if (addProductToCart(row.product, Math.max(1, row.quantity || 1), row.customSku)) {
|
|
231
|
+
added++;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
await finish(added);
|
|
236
|
+
rows.value = [emptyRow()];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async function submitUpload(): Promise<void> {
|
|
240
|
+
await submitParsed(parsedUpload.value);
|
|
241
|
+
uploadText.value = "";
|
|
242
|
+
uploadFileName.value = "";
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function submitPaste(): Promise<void> {
|
|
246
|
+
await submitParsed(parsedPaste.value);
|
|
247
|
+
pasteText.value = "";
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function finish(added: number): Promise<void> {
|
|
251
|
+
toast.add({
|
|
252
|
+
title: t("directOrder.added", { count: added }),
|
|
253
|
+
color: added ? "success" : "warning",
|
|
254
|
+
icon: icon(added ? "success" : "warning"),
|
|
255
|
+
duration: 2000,
|
|
256
|
+
});
|
|
257
|
+
if (!added) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (props.embedded) {
|
|
261
|
+
emit("added");
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
await navigateTo(to("/cart"));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
</script>
|
|
268
|
+
|
|
269
|
+
<template>
|
|
270
|
+
<div class="space-y-6">
|
|
271
|
+
<UTabs
|
|
272
|
+
v-model="tab"
|
|
273
|
+
variant="link"
|
|
274
|
+
:items="tabs"
|
|
275
|
+
:content="false"
|
|
276
|
+
/>
|
|
277
|
+
|
|
278
|
+
<!-- Tab 1: quick row entry -->
|
|
279
|
+
<div
|
|
280
|
+
v-if="tab === 'entry'"
|
|
281
|
+
class="space-y-4"
|
|
282
|
+
>
|
|
283
|
+
<div class="rounded-xl border border-(--ui-border) overflow-x-auto">
|
|
284
|
+
<table class="w-full text-sm">
|
|
285
|
+
<thead>
|
|
286
|
+
<tr class="text-left text-xs uppercase tracking-wide text-muted bg-elevated/60">
|
|
287
|
+
<th class="py-2.5 px-3 font-semibold">
|
|
288
|
+
{{ t('directOrder.columns.sku') }}
|
|
289
|
+
</th>
|
|
290
|
+
<th class="py-2.5 px-3 font-semibold">
|
|
291
|
+
{{ t('directOrder.columns.customSku') }}
|
|
292
|
+
</th>
|
|
293
|
+
<th class="py-2.5 px-3 font-semibold w-36">
|
|
294
|
+
{{ t('directOrder.columns.quantity') }}
|
|
295
|
+
</th>
|
|
296
|
+
<th class="py-2.5 px-3 font-semibold">
|
|
297
|
+
{{ t('directOrder.columns.name') }}
|
|
298
|
+
</th>
|
|
299
|
+
<th class="w-12" />
|
|
300
|
+
</tr>
|
|
301
|
+
</thead>
|
|
302
|
+
<tbody class="divide-y divide-(--ui-border)">
|
|
303
|
+
<tr
|
|
304
|
+
v-for="(row, index) in resolvedRows"
|
|
305
|
+
:key="index"
|
|
306
|
+
>
|
|
307
|
+
<td class="py-2 px-3">
|
|
308
|
+
<UInput
|
|
309
|
+
v-model="rows[index]!.sku"
|
|
310
|
+
size="sm"
|
|
311
|
+
class="w-full min-w-40"
|
|
312
|
+
:placeholder="t('directOrder.skuPlaceholder')"
|
|
313
|
+
/>
|
|
314
|
+
</td>
|
|
315
|
+
<td class="py-2 px-3">
|
|
316
|
+
<UInput
|
|
317
|
+
v-model="rows[index]!.customSku"
|
|
318
|
+
size="sm"
|
|
319
|
+
class="w-full min-w-40"
|
|
320
|
+
:placeholder="t('directOrder.customSkuPlaceholder')"
|
|
321
|
+
/>
|
|
322
|
+
</td>
|
|
323
|
+
<td class="py-2 px-3">
|
|
324
|
+
<UInputNumber
|
|
325
|
+
v-model="rows[index]!.quantity"
|
|
326
|
+
size="sm"
|
|
327
|
+
:min="1"
|
|
328
|
+
class="w-32"
|
|
329
|
+
/>
|
|
330
|
+
</td>
|
|
331
|
+
<td class="py-2 px-3">
|
|
332
|
+
<span
|
|
333
|
+
v-if="row.state === 'found'"
|
|
334
|
+
class="inline-flex items-center gap-1.5 text-success"
|
|
335
|
+
>
|
|
336
|
+
<UIcon
|
|
337
|
+
:name="icon('success')"
|
|
338
|
+
class="size-4"
|
|
339
|
+
/>
|
|
340
|
+
<span class="truncate text-highlighted">{{ row.product!.name }}</span>
|
|
341
|
+
</span>
|
|
342
|
+
<span
|
|
343
|
+
v-else-if="row.state === 'unknown'"
|
|
344
|
+
class="inline-flex items-center gap-1.5 text-error text-xs"
|
|
345
|
+
>
|
|
346
|
+
<UIcon
|
|
347
|
+
:name="icon('error')"
|
|
348
|
+
class="size-4"
|
|
349
|
+
/>
|
|
350
|
+
{{ t('directOrder.unknownSku') }}
|
|
351
|
+
</span>
|
|
352
|
+
<span
|
|
353
|
+
v-else
|
|
354
|
+
class="text-dimmed"
|
|
355
|
+
>—</span>
|
|
356
|
+
</td>
|
|
357
|
+
<td class="py-2 px-2 text-right">
|
|
358
|
+
<UTooltip :text="t('directOrder.removeRow')">
|
|
359
|
+
<UButton
|
|
360
|
+
:icon="icon('delete')"
|
|
361
|
+
color="neutral"
|
|
362
|
+
variant="ghost"
|
|
363
|
+
size="xs"
|
|
364
|
+
tabindex="0"
|
|
365
|
+
:aria-label="t('directOrder.removeRow')"
|
|
366
|
+
@click="removeRow(index)"
|
|
367
|
+
/>
|
|
368
|
+
</UTooltip>
|
|
369
|
+
</td>
|
|
370
|
+
</tr>
|
|
371
|
+
</tbody>
|
|
372
|
+
</table>
|
|
373
|
+
</div>
|
|
374
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
375
|
+
<UButton
|
|
376
|
+
color="primary"
|
|
377
|
+
tabindex="0"
|
|
378
|
+
:icon="icon('cart')"
|
|
379
|
+
:disabled="validRowCount === 0"
|
|
380
|
+
:label="t('directOrder.submitRows')"
|
|
381
|
+
@click="submitRows"
|
|
382
|
+
/>
|
|
383
|
+
<UButton
|
|
384
|
+
color="neutral"
|
|
385
|
+
variant="soft"
|
|
386
|
+
tabindex="0"
|
|
387
|
+
:icon="icon('plus')"
|
|
388
|
+
:label="t('directOrder.addRow')"
|
|
389
|
+
@click="addRow"
|
|
390
|
+
/>
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<!-- Tab 2: whole-order file upload -->
|
|
395
|
+
<div
|
|
396
|
+
v-else-if="tab === 'upload'"
|
|
397
|
+
class="space-y-4"
|
|
398
|
+
>
|
|
399
|
+
<div class="text-sm text-muted space-y-1">
|
|
400
|
+
<p>{{ t('directOrder.upload.intro1') }}</p>
|
|
401
|
+
<p>{{ t('directOrder.upload.intro2') }}</p>
|
|
402
|
+
<p>{{ t('directOrder.upload.intro3') }}</p>
|
|
403
|
+
</div>
|
|
404
|
+
|
|
405
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
406
|
+
<USelect
|
|
407
|
+
v-model="uploadFormat"
|
|
408
|
+
:items="formatItems"
|
|
409
|
+
:aria-label="t('directOrder.upload.format')"
|
|
410
|
+
class="w-72"
|
|
411
|
+
/>
|
|
412
|
+
<UButton
|
|
413
|
+
color="neutral"
|
|
414
|
+
variant="soft"
|
|
415
|
+
tabindex="0"
|
|
416
|
+
:trailing-icon="icon('chevron-right')"
|
|
417
|
+
:label="t('directOrder.upload.template')"
|
|
418
|
+
:to="templateUrl"
|
|
419
|
+
external
|
|
420
|
+
download
|
|
421
|
+
/>
|
|
422
|
+
</div>
|
|
423
|
+
|
|
424
|
+
<label
|
|
425
|
+
class="flex items-center gap-3 w-full sm:max-w-lg p-3 rounded-lg border border-(--ui-border)
|
|
426
|
+
text-sm cursor-pointer hover:border-(--ui-border-accented) transition-colors"
|
|
427
|
+
>
|
|
428
|
+
<UIcon
|
|
429
|
+
:name="icon('upload')"
|
|
430
|
+
class="size-5 text-primary shrink-0"
|
|
431
|
+
/>
|
|
432
|
+
<span
|
|
433
|
+
class="truncate"
|
|
434
|
+
:class="uploadFileName ? 'text-highlighted' : 'text-muted'"
|
|
435
|
+
>
|
|
436
|
+
{{ uploadFileName || t('directOrder.upload.formats.' + uploadFormat) }}
|
|
437
|
+
</span>
|
|
438
|
+
<input
|
|
439
|
+
type="file"
|
|
440
|
+
:accept="uploadFormat === 'xlsx' ? '.xlsx' : '.csv,.txt'"
|
|
441
|
+
class="hidden"
|
|
442
|
+
@change="onFileUpload"
|
|
443
|
+
>
|
|
444
|
+
</label>
|
|
445
|
+
|
|
446
|
+
<div class="flex items-center gap-3">
|
|
447
|
+
<UButton
|
|
448
|
+
color="primary"
|
|
449
|
+
tabindex="0"
|
|
450
|
+
:icon="icon('cart')"
|
|
451
|
+
:disabled="uploadFoundCount === 0"
|
|
452
|
+
:label="t('directOrder.upload.submit')"
|
|
453
|
+
@click="submitUpload"
|
|
454
|
+
/>
|
|
455
|
+
<span
|
|
456
|
+
v-if="parsedUpload.length"
|
|
457
|
+
class="text-xs text-muted"
|
|
458
|
+
>
|
|
459
|
+
{{ t('directOrder.parseSummary', {
|
|
460
|
+
found: uploadFoundCount,
|
|
461
|
+
total: parsedUpload.length,
|
|
462
|
+
}) }}
|
|
463
|
+
</span>
|
|
464
|
+
</div>
|
|
465
|
+
</div>
|
|
466
|
+
|
|
467
|
+
<!-- Tab 3: bulk capture via paste -->
|
|
468
|
+
<div
|
|
469
|
+
v-else
|
|
470
|
+
class="space-y-4"
|
|
471
|
+
>
|
|
472
|
+
<div class="text-sm text-muted space-y-1">
|
|
473
|
+
<p>{{ t('directOrder.paste.intro1') }}</p>
|
|
474
|
+
<p>{{ t('directOrder.paste.intro2') }}</p>
|
|
475
|
+
</div>
|
|
476
|
+
|
|
477
|
+
<USelect
|
|
478
|
+
v-model="separator"
|
|
479
|
+
:items="separatorItems"
|
|
480
|
+
:aria-label="t('directOrder.paste.separator')"
|
|
481
|
+
class="w-72"
|
|
482
|
+
/>
|
|
483
|
+
|
|
484
|
+
<UTextarea
|
|
485
|
+
v-model="pasteText"
|
|
486
|
+
:rows="6"
|
|
487
|
+
class="w-full font-mono"
|
|
488
|
+
:placeholder="pastePlaceholder"
|
|
489
|
+
/>
|
|
490
|
+
|
|
491
|
+
<div class="flex items-center gap-3">
|
|
492
|
+
<UButton
|
|
493
|
+
color="primary"
|
|
494
|
+
tabindex="0"
|
|
495
|
+
:icon="icon('cart')"
|
|
496
|
+
:disabled="pasteFoundCount === 0"
|
|
497
|
+
:label="t('directOrder.paste.submit')"
|
|
498
|
+
@click="submitPaste"
|
|
499
|
+
/>
|
|
500
|
+
<span
|
|
501
|
+
v-if="parsedPaste.length"
|
|
502
|
+
class="text-xs text-muted"
|
|
503
|
+
>
|
|
504
|
+
{{ t('directOrder.parseSummary', {
|
|
505
|
+
found: pasteFoundCount,
|
|
506
|
+
total: parsedPaste.length,
|
|
507
|
+
}) }}
|
|
508
|
+
</span>
|
|
509
|
+
</div>
|
|
510
|
+
</div>
|
|
511
|
+
</div>
|
|
512
|
+
</template>
|