@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,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProductList } from "../../../interfaces/product-list";
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
product: ProductList;
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
const { url, getImage } = useProductCard(() => props.product);
|
|
10
|
+
const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.product);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<UCard
|
|
15
|
+
class="flex flex-col overflow-hidden"
|
|
16
|
+
:ui="{ body: 'flex-1' }"
|
|
17
|
+
>
|
|
18
|
+
<template #header>
|
|
19
|
+
<NuxtLink
|
|
20
|
+
:to="url"
|
|
21
|
+
:aria-label="`View ${product.name}`"
|
|
22
|
+
tabindex="0"
|
|
23
|
+
class="block focus-visible:outline-none focus-visible:ring-2
|
|
24
|
+
focus-visible:ring-(--ui-primary)"
|
|
25
|
+
>
|
|
26
|
+
<div class="h-50 flex items-center justify-center">
|
|
27
|
+
<img
|
|
28
|
+
:src="getImage(product.image)"
|
|
29
|
+
:alt="product.name"
|
|
30
|
+
class="max-h-full max-w-full object-contain"
|
|
31
|
+
>
|
|
32
|
+
</div>
|
|
33
|
+
</NuxtLink>
|
|
34
|
+
</template>
|
|
35
|
+
<div class="flex flex-col gap-2">
|
|
36
|
+
<NuxtLink
|
|
37
|
+
:to="url"
|
|
38
|
+
tabindex="0"
|
|
39
|
+
class="text-m font-medium text-highlighted leading-snug
|
|
40
|
+
hover:text-(--ui-primary) transition-colors"
|
|
41
|
+
>
|
|
42
|
+
{{ product.name }}
|
|
43
|
+
</NuxtLink>
|
|
44
|
+
<CategoryInfoCategorySku :product="product" />
|
|
45
|
+
<CategoryInfoCategoryStock
|
|
46
|
+
:product="product"
|
|
47
|
+
:is-out-of-stock="isOutOfStock"
|
|
48
|
+
/>
|
|
49
|
+
<CategoryInfoCategoryPrice :product="product" />
|
|
50
|
+
</div>
|
|
51
|
+
<template #footer>
|
|
52
|
+
<div class="flex gap-2">
|
|
53
|
+
<UButton
|
|
54
|
+
:label="t('product.actions.info')"
|
|
55
|
+
color="primary"
|
|
56
|
+
variant="soft"
|
|
57
|
+
class="flex-1 justify-center cursor-pointer focus-visible:outline-none
|
|
58
|
+
focus-visible:ring-2 focus-visible:ring-(--ui-primary)"
|
|
59
|
+
tabindex="0"
|
|
60
|
+
:to="url"
|
|
61
|
+
/>
|
|
62
|
+
<UButton
|
|
63
|
+
:label="t('product.actions.order')"
|
|
64
|
+
variant="solid"
|
|
65
|
+
:color="isOutOfStock || !hasPrice ? 'neutral' : 'primary'"
|
|
66
|
+
:disabled="isOutOfStock || !hasPrice"
|
|
67
|
+
:class="isOutOfStock || !hasPrice
|
|
68
|
+
? '!bg-gray-200 !text-gray-500 !border-gray-200 hover:!bg-gray-200 cursor-not-allowed'
|
|
69
|
+
: ''"
|
|
70
|
+
class="flex-1 justify-center cursor-pointer focus-visible:outline-none
|
|
71
|
+
focus-visible:ring-2 focus-visible:ring-(--ui-primary)"
|
|
72
|
+
tabindex="0"
|
|
73
|
+
@click="addToCart"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
</UCard>
|
|
78
|
+
</template>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProductList } from "../../../interfaces/product-list";
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
product: ProductList;
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
const { url, getImage } = useProductCard(() => props.product);
|
|
10
|
+
const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.product);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<UCard
|
|
15
|
+
class="overflow-hidden"
|
|
16
|
+
:ui="{ body: 'p-0 sm:p-0' }"
|
|
17
|
+
>
|
|
18
|
+
<div class="flex flex-row items-center gap-4 p-4">
|
|
19
|
+
<NuxtLink
|
|
20
|
+
:to="url"
|
|
21
|
+
:aria-label="`View ${product.name}`"
|
|
22
|
+
tabindex="0"
|
|
23
|
+
class="shrink-0 focus-visible:outline-none focus-visible:ring-2
|
|
24
|
+
focus-visible:ring-(--ui-primary) rounded"
|
|
25
|
+
>
|
|
26
|
+
<div class="w-15 h-15 sm:w-15 sm:h-15 flex items-center justify-center">
|
|
27
|
+
<img
|
|
28
|
+
:src="getImage(product.image)"
|
|
29
|
+
:alt="product.name"
|
|
30
|
+
class="max-h-full max-w-full object-contain"
|
|
31
|
+
>
|
|
32
|
+
</div>
|
|
33
|
+
</NuxtLink>
|
|
34
|
+
<div class="flex-1 min-w-0 flex flex-col gap-1">
|
|
35
|
+
<NuxtLink
|
|
36
|
+
:to="url"
|
|
37
|
+
tabindex="0"
|
|
38
|
+
class="text-base font-medium text-highlighted leading-snug
|
|
39
|
+
hover:text-(--ui-primary) transition-colors truncate"
|
|
40
|
+
>
|
|
41
|
+
{{ product.name }}
|
|
42
|
+
</NuxtLink>
|
|
43
|
+
<CategoryInfoCategorySku :product="product" />
|
|
44
|
+
<CategoryInfoCategoryStock
|
|
45
|
+
:product="product"
|
|
46
|
+
:is-out-of-stock="isOutOfStock"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="shrink-0 flex flex-col items-end gap-2">
|
|
50
|
+
<CategoryInfoCategoryPrice :product="product" />
|
|
51
|
+
<div class="flex gap-2">
|
|
52
|
+
<UButton
|
|
53
|
+
:label="t('product.actions.info')"
|
|
54
|
+
color="primary"
|
|
55
|
+
variant="soft"
|
|
56
|
+
size="sm"
|
|
57
|
+
class="cursor-pointer focus-visible:outline-none focus-visible:ring-2
|
|
58
|
+
focus-visible:ring-(--ui-primary)"
|
|
59
|
+
tabindex="0"
|
|
60
|
+
:to="url"
|
|
61
|
+
/>
|
|
62
|
+
<UButton
|
|
63
|
+
:label="t('product.actions.order')"
|
|
64
|
+
variant="solid"
|
|
65
|
+
size="sm"
|
|
66
|
+
:color="isOutOfStock || !hasPrice ? 'neutral' : 'primary'"
|
|
67
|
+
:disabled="isOutOfStock || !hasPrice"
|
|
68
|
+
:class="isOutOfStock || !hasPrice
|
|
69
|
+
? '!bg-gray-200 !text-gray-500 !border-gray-200 hover:!bg-gray-200 cursor-not-allowed'
|
|
70
|
+
: ''"
|
|
71
|
+
class="cursor-pointer focus-visible:outline-none focus-visible:ring-2
|
|
72
|
+
focus-visible:ring-(--ui-primary)"
|
|
73
|
+
tabindex="0"
|
|
74
|
+
@click="addToCart"
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</UCard>
|
|
80
|
+
</template>
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { AccountOrder } from "../../../interfaces/account/order-list";
|
|
3
|
+
import type { Requisition } from "../../../interfaces/b2b";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The thank-you page after checkout: hero with the order number, the
|
|
7
|
+
* "what happens next" steps, and — for signed-in customers — the full
|
|
8
|
+
* order recap (positions, addresses, payment, total). Covers all three
|
|
9
|
+
* outcomes: plain order, order awaiting approval, requisition.
|
|
10
|
+
*/
|
|
11
|
+
export type ConfirmationType = "order" | "approval" | "requisition";
|
|
12
|
+
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
recordId: string;
|
|
15
|
+
type: ConfirmationType;
|
|
16
|
+
approvers: string[];
|
|
17
|
+
}>();
|
|
18
|
+
|
|
19
|
+
const { icon } = useIcons();
|
|
20
|
+
const { t, tm, rt } = useI18n();
|
|
21
|
+
const localePath = useLocalePath();
|
|
22
|
+
const { to } = useAppUrl();
|
|
23
|
+
const checkout = useCheckoutOnePage();
|
|
24
|
+
const { getImage } = useProductImage();
|
|
25
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
26
|
+
// Forwards the auth cookie during SSR — plain $fetch would lose it.
|
|
27
|
+
const requestFetch = useRequestFetch();
|
|
28
|
+
|
|
29
|
+
/* ---- recap data (signed-in customers only; guests get the hero) ------- */
|
|
30
|
+
interface ConfirmationLine {
|
|
31
|
+
id: number;
|
|
32
|
+
name: string;
|
|
33
|
+
image?: string;
|
|
34
|
+
sku: string;
|
|
35
|
+
quantity: number;
|
|
36
|
+
unitPrice: number;
|
|
37
|
+
lineTotal: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface ConfirmationRecap {
|
|
41
|
+
lines: ConfirmationLine[];
|
|
42
|
+
total: number;
|
|
43
|
+
deliveryLines: string[];
|
|
44
|
+
billingLines: string[];
|
|
45
|
+
paymentMethod?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { data: recap } = await useAsyncData<ConfirmationRecap | null>(
|
|
49
|
+
`checkout-confirmation:${props.recordId}`,
|
|
50
|
+
async () => {
|
|
51
|
+
try {
|
|
52
|
+
if (props.type === "requisition") {
|
|
53
|
+
const requisition = await requestFetch<Requisition>(`/api/account/requisitions/${props.recordId}`);
|
|
54
|
+
const address = requisition.deliveryAddress;
|
|
55
|
+
return {
|
|
56
|
+
lines: requisition.items.map(item => ({
|
|
57
|
+
id: item.id,
|
|
58
|
+
name: item.name,
|
|
59
|
+
...(item.image ? { image: item.image } : {}),
|
|
60
|
+
sku: item.sku,
|
|
61
|
+
quantity: item.quantity,
|
|
62
|
+
unitPrice: item.price,
|
|
63
|
+
lineTotal: Math.round(item.price * item.quantity * 100) / 100,
|
|
64
|
+
})),
|
|
65
|
+
total: requisition.totalValue,
|
|
66
|
+
deliveryLines: address
|
|
67
|
+
? [address.company, address.street, `${address.postalCode} ${address.city}`.trim()].filter(Boolean)
|
|
68
|
+
: [],
|
|
69
|
+
billingLines: [],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const order = await requestFetch<AccountOrder>(`/api/account/orders/${props.recordId}`);
|
|
73
|
+
return {
|
|
74
|
+
lines: order.positions.map(position => ({
|
|
75
|
+
id: position.id,
|
|
76
|
+
name: position.name,
|
|
77
|
+
...(position.image ? { image: position.image } : {}),
|
|
78
|
+
sku: position.sku,
|
|
79
|
+
quantity: position.quantity,
|
|
80
|
+
unitPrice: position.unitPrice,
|
|
81
|
+
lineTotal: position.lineTotal,
|
|
82
|
+
})),
|
|
83
|
+
total: order.total,
|
|
84
|
+
deliveryLines: order.deliveryAddress?.split(" · ") ?? [],
|
|
85
|
+
billingLines: order.billingAddress?.split(" · ") ?? [],
|
|
86
|
+
...(order.paymentMethod ? { paymentMethod: order.paymentMethod } : {}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
/* ---- next steps -------------------------------------------------------- */
|
|
96
|
+
interface NextStep { title: string; text: string }
|
|
97
|
+
|
|
98
|
+
const nextSteps = computed<NextStep[]>(() =>
|
|
99
|
+
(tm(`confirmation.steps.${props.type}`) as unknown[]).map(step => ({
|
|
100
|
+
title: rt((step as Record<string, never>).title),
|
|
101
|
+
text: rt((step as Record<string, never>).text),
|
|
102
|
+
})));
|
|
103
|
+
|
|
104
|
+
const stepIcons: Record<ConfirmationType, string[]> = {
|
|
105
|
+
order: ["mail", "package", "delivery"],
|
|
106
|
+
approval: ["shield", "package", "delivery"],
|
|
107
|
+
requisition: ["route", "cart", "eye"],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const detailLink = computed(() =>
|
|
111
|
+
props.type === "requisition"
|
|
112
|
+
? localePath(`/account/requisitions/${props.recordId}`)
|
|
113
|
+
: localePath(`/account/orders/${props.recordId}`));
|
|
114
|
+
|
|
115
|
+
function continueShopping() {
|
|
116
|
+
checkout.reset();
|
|
117
|
+
void navigateTo(to("/"));
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<div class="py-12 sm:py-16">
|
|
123
|
+
<!-- Hero -->
|
|
124
|
+
<div class="max-w-xl">
|
|
125
|
+
<p class="text-base font-semibold text-primary">
|
|
126
|
+
{{ t('confirmation.thanks') }}
|
|
127
|
+
</p>
|
|
128
|
+
<h1 class="mt-2 text-4xl sm:text-5xl font-bold tracking-tight text-highlighted">
|
|
129
|
+
{{ t(`confirmation.${type}.title`) }}
|
|
130
|
+
</h1>
|
|
131
|
+
<i18n-t
|
|
132
|
+
:keypath="`confirmation.${type}.received`"
|
|
133
|
+
tag="p"
|
|
134
|
+
class="mt-3 text-base text-muted"
|
|
135
|
+
>
|
|
136
|
+
<template #id>
|
|
137
|
+
<span class="font-semibold text-highlighted">{{ recordId }}</span>
|
|
138
|
+
</template>
|
|
139
|
+
</i18n-t>
|
|
140
|
+
<p
|
|
141
|
+
v-if="type === 'approval' && approvers.length"
|
|
142
|
+
class="mt-2 text-sm text-warning font-medium"
|
|
143
|
+
>
|
|
144
|
+
{{ t('confirmation.approval.approvers', { names: approvers.join(', ') }) }}
|
|
145
|
+
</p>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<!-- Next steps -->
|
|
149
|
+
<section class="mt-12">
|
|
150
|
+
<h2 class="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
151
|
+
{{ t('confirmation.nextSteps') }}
|
|
152
|
+
</h2>
|
|
153
|
+
<ol class="mt-4 grid grid-cols-1 sm:grid-cols-3 border border-(--ui-border) rounded-xl overflow-hidden">
|
|
154
|
+
<li
|
|
155
|
+
v-for="(step, index) in nextSteps"
|
|
156
|
+
:key="step.title"
|
|
157
|
+
class="relative p-4 sm:p-5 border-(--ui-border)
|
|
158
|
+
max-sm:not-first:border-t sm:not-first:border-l"
|
|
159
|
+
>
|
|
160
|
+
<span class="flex items-center gap-2.5">
|
|
161
|
+
<span
|
|
162
|
+
class="flex size-8 shrink-0 items-center justify-center rounded-full
|
|
163
|
+
bg-primary/10"
|
|
164
|
+
>
|
|
165
|
+
<UIcon
|
|
166
|
+
:name="icon(stepIcons[type][index] ?? 'check')"
|
|
167
|
+
class="size-4 text-primary"
|
|
168
|
+
/>
|
|
169
|
+
</span>
|
|
170
|
+
<span class="text-sm font-semibold text-highlighted">{{ step.title }}</span>
|
|
171
|
+
</span>
|
|
172
|
+
<p class="mt-2.5 text-sm text-muted">
|
|
173
|
+
{{ step.text }}
|
|
174
|
+
</p>
|
|
175
|
+
</li>
|
|
176
|
+
</ol>
|
|
177
|
+
</section>
|
|
178
|
+
|
|
179
|
+
<!-- Recap (signed-in customers) -->
|
|
180
|
+
<section
|
|
181
|
+
v-if="recap?.lines.length"
|
|
182
|
+
class="mt-12"
|
|
183
|
+
>
|
|
184
|
+
<h2 class="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
185
|
+
{{ t('confirmation.summaryTitle') }}
|
|
186
|
+
</h2>
|
|
187
|
+
<div class="mt-4 border border-(--ui-border) rounded-xl overflow-hidden">
|
|
188
|
+
<ul class="divide-y divide-(--ui-border) px-4 sm:px-5">
|
|
189
|
+
<li
|
|
190
|
+
v-for="line in recap.lines"
|
|
191
|
+
:key="line.id"
|
|
192
|
+
class="flex items-center gap-4 py-4"
|
|
193
|
+
>
|
|
194
|
+
<span
|
|
195
|
+
class="size-16 shrink-0 flex items-center justify-center rounded-lg
|
|
196
|
+
bg-elevated/60 ring-1 ring-(--ui-border) p-1.5"
|
|
197
|
+
>
|
|
198
|
+
<img
|
|
199
|
+
v-if="line.image"
|
|
200
|
+
:src="getImage(line.image)"
|
|
201
|
+
:alt="line.name"
|
|
202
|
+
class="max-h-full max-w-full object-contain"
|
|
203
|
+
>
|
|
204
|
+
</span>
|
|
205
|
+
<div class="min-w-0 flex-1">
|
|
206
|
+
<p class="text-sm font-medium text-highlighted truncate">
|
|
207
|
+
{{ line.name }}
|
|
208
|
+
</p>
|
|
209
|
+
<p class="text-xs text-muted">
|
|
210
|
+
{{ line.sku }} · {{ line.quantity }}× {{ formatCurrency(line.unitPrice) }}
|
|
211
|
+
</p>
|
|
212
|
+
</div>
|
|
213
|
+
<span class="text-sm tabular-nums text-highlighted shrink-0">
|
|
214
|
+
{{ formatCurrency(line.lineTotal) }}
|
|
215
|
+
</span>
|
|
216
|
+
</li>
|
|
217
|
+
</ul>
|
|
218
|
+
|
|
219
|
+
<dl
|
|
220
|
+
v-if="recap.deliveryLines.length || recap.billingLines.length || recap.paymentMethod"
|
|
221
|
+
class="grid grid-cols-1 sm:grid-cols-3 gap-x-6 gap-y-5 px-4 sm:px-5 py-5
|
|
222
|
+
border-t border-(--ui-border) text-sm"
|
|
223
|
+
>
|
|
224
|
+
<div v-if="recap.deliveryLines.length">
|
|
225
|
+
<dt class="font-medium text-highlighted">
|
|
226
|
+
{{ t('orders.deliveryAddress') }}
|
|
227
|
+
</dt>
|
|
228
|
+
<dd class="mt-2 text-muted">
|
|
229
|
+
<span
|
|
230
|
+
v-for="line in recap.deliveryLines"
|
|
231
|
+
:key="line"
|
|
232
|
+
class="block"
|
|
233
|
+
>{{ line }}</span>
|
|
234
|
+
</dd>
|
|
235
|
+
</div>
|
|
236
|
+
<div v-if="recap.billingLines.length">
|
|
237
|
+
<dt class="font-medium text-highlighted">
|
|
238
|
+
{{ t('orders.detail.billingAddress') }}
|
|
239
|
+
</dt>
|
|
240
|
+
<dd class="mt-2 text-muted">
|
|
241
|
+
<span
|
|
242
|
+
v-for="line in recap.billingLines"
|
|
243
|
+
:key="line"
|
|
244
|
+
class="block"
|
|
245
|
+
>{{ line }}</span>
|
|
246
|
+
</dd>
|
|
247
|
+
</div>
|
|
248
|
+
<div v-if="recap.paymentMethod">
|
|
249
|
+
<dt class="font-medium text-highlighted">
|
|
250
|
+
{{ t('orders.detail.paymentMethodLabel') }}
|
|
251
|
+
</dt>
|
|
252
|
+
<dd class="mt-2 text-muted">
|
|
253
|
+
{{ t(`paymentMethods.${recap.paymentMethod}`) }}
|
|
254
|
+
</dd>
|
|
255
|
+
</div>
|
|
256
|
+
</dl>
|
|
257
|
+
|
|
258
|
+
<div
|
|
259
|
+
class="flex justify-between px-4 sm:px-5 py-4 border-t border-(--ui-border)
|
|
260
|
+
text-sm font-semibold text-highlighted"
|
|
261
|
+
>
|
|
262
|
+
<span>{{ t('orders.card.total') }}</span>
|
|
263
|
+
<span class="tabular-nums">{{ formatCurrency(recap.total) }}</span>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</section>
|
|
267
|
+
|
|
268
|
+
<!-- Actions -->
|
|
269
|
+
<div class="mt-10 flex flex-wrap items-center gap-3">
|
|
270
|
+
<UButton
|
|
271
|
+
color="primary"
|
|
272
|
+
size="lg"
|
|
273
|
+
tabindex="0"
|
|
274
|
+
:label="t('confirmation.continueShopping')"
|
|
275
|
+
:trailing-icon="icon('arrow-right')"
|
|
276
|
+
@click="continueShopping"
|
|
277
|
+
/>
|
|
278
|
+
<UButton
|
|
279
|
+
v-if="recap"
|
|
280
|
+
color="neutral"
|
|
281
|
+
variant="outline"
|
|
282
|
+
size="lg"
|
|
283
|
+
tabindex="0"
|
|
284
|
+
:label="type === 'requisition' ? t('confirmation.viewRequisition') : t('confirmation.viewOrder')"
|
|
285
|
+
:to="detailLink"
|
|
286
|
+
/>
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FormKitSchemaDefinition } from "@formkit/core";
|
|
3
|
+
|
|
4
|
+
import { getNode } from "@formkit/core";
|
|
5
|
+
|
|
6
|
+
const { icon } = useIcons();
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Renders a BFF-served FormKit schema inside a headless FormKit form.
|
|
10
|
+
* Used standalone (e.g. in modals via the exposed submit()), such as in
|
|
11
|
+
* the one-page checkout's address picker modal.
|
|
12
|
+
*/
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
/** BFF schema key, fetched via /api/checkout/schema/{key} */
|
|
15
|
+
schemaKey: string;
|
|
16
|
+
initialValues?: Record<string, unknown>;
|
|
17
|
+
}>();
|
|
18
|
+
|
|
19
|
+
const { fetchSchemaByKey } = useCheckoutSchema();
|
|
20
|
+
const { locale } = useI18n();
|
|
21
|
+
|
|
22
|
+
const formId = useId();
|
|
23
|
+
|
|
24
|
+
const { data: schema, pending } = await useAsyncData(
|
|
25
|
+
() => `checkout-schema-${props.schemaKey}-${locale.value}`,
|
|
26
|
+
() => fetchSchemaByKey(props.schemaKey) as Promise<FormKitSchemaDefinition>,
|
|
27
|
+
{ watch: [() => props.schemaKey, locale] },
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Validates and returns the form values, or null when invalid.
|
|
32
|
+
* Invalid submits surface the field messages exactly like a native submit.
|
|
33
|
+
*/
|
|
34
|
+
async function submit(): Promise<Record<string, unknown> | null> {
|
|
35
|
+
const node = getNode(formId);
|
|
36
|
+
if (!node) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
await node.settled;
|
|
40
|
+
if (!node.context?.state.valid) {
|
|
41
|
+
// Trigger a submit attempt so all validation messages become visible.
|
|
42
|
+
node.submit();
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return node.value as Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
defineExpose({ submit });
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<div
|
|
53
|
+
v-if="pending"
|
|
54
|
+
class="flex justify-center py-8"
|
|
55
|
+
>
|
|
56
|
+
<UIcon
|
|
57
|
+
:name="icon('loading')"
|
|
58
|
+
class="w-5 h-5 animate-spin text-muted"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<FormKit
|
|
63
|
+
v-else-if="schema"
|
|
64
|
+
:id="formId"
|
|
65
|
+
type="form"
|
|
66
|
+
:value="initialValues"
|
|
67
|
+
:actions="false"
|
|
68
|
+
:incomplete-message="false"
|
|
69
|
+
>
|
|
70
|
+
<FormKitSchema :schema="schema" />
|
|
71
|
+
</FormKit>
|
|
72
|
+
</template>
|