@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,124 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getLocalTimeZone, parseDate, today, type CalendarDate } from "@internationalized/date";
|
|
3
|
+
import type { FormKitFrameworkContext } from "@formkit/core";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* FormKit input wrapping Nuxt UI's UCalendar in a popover: registered as
|
|
7
|
+
* `type="datepicker"` (see formkit.config.ts). Values travel as ISO
|
|
8
|
+
* "YYYY-MM-DD" strings, so the input drops into any string-backed form
|
|
9
|
+
* state. Min/max and a date filter come in via the FormKit props
|
|
10
|
+
* `minDays`/`maxDays`/`disableWeekends`.
|
|
11
|
+
*/
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
context: FormKitFrameworkContext;
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
const { icon } = useIcons();
|
|
17
|
+
const { t, d } = useI18n();
|
|
18
|
+
|
|
19
|
+
const open = ref(false);
|
|
20
|
+
|
|
21
|
+
const timeZone = getLocalTimeZone();
|
|
22
|
+
|
|
23
|
+
const calendarValue = computed<CalendarDate | null>(() => {
|
|
24
|
+
const raw = props.context._value;
|
|
25
|
+
if (typeof raw !== "string" || !raw) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
return parseDate(raw);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const displayValue = computed(() =>
|
|
37
|
+
calendarValue.value
|
|
38
|
+
? d(calendarValue.value.toDate(timeZone), { dateStyle: "medium" })
|
|
39
|
+
: (props.context.attrs.placeholder as string | undefined) ?? t("formkit.datepicker.placeholder"));
|
|
40
|
+
|
|
41
|
+
const minValue = computed(() => {
|
|
42
|
+
const minDays = Number(props.context.minDays ?? 0);
|
|
43
|
+
return today(timeZone).add({ days: Number.isFinite(minDays) ? minDays : 0 });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const maxValue = computed(() => {
|
|
47
|
+
const maxDays = Number(props.context.maxDays ?? Number.NaN);
|
|
48
|
+
return Number.isFinite(maxDays) ? today(timeZone).add({ days: maxDays }) : undefined;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const disableWeekends = computed(() => Boolean(props.context.disableWeekends));
|
|
52
|
+
|
|
53
|
+
function isDateDisabled(date: { toDate: (tz: string) => Date }): boolean {
|
|
54
|
+
if (!disableWeekends.value) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const day = date.toDate(timeZone).getDay();
|
|
58
|
+
return day === 0 || day === 6;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function onSelect(value: CalendarDate | null | undefined): void {
|
|
62
|
+
props.context.node.input(value ? value.toString() : "");
|
|
63
|
+
open.value = false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function clear(): void {
|
|
67
|
+
props.context.node.input("");
|
|
68
|
+
open.value = false;
|
|
69
|
+
}
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<UPopover v-model:open="open">
|
|
74
|
+
<button
|
|
75
|
+
:id="context.id"
|
|
76
|
+
type="button"
|
|
77
|
+
tabindex="0"
|
|
78
|
+
:disabled="Boolean(context.disabled)"
|
|
79
|
+
class="w-full flex items-center justify-between gap-2 px-3 py-2 text-sm border rounded-md
|
|
80
|
+
bg-transparent border-(--ui-border) text-left cursor-pointer
|
|
81
|
+
focus:outline-none focus:ring-2 focus:ring-(--ui-primary)"
|
|
82
|
+
:class="calendarValue ? 'text-highlighted' : 'text-muted'"
|
|
83
|
+
:aria-label="(context.attrs['aria-label'] as string | undefined) ?? String(context.label ?? '')"
|
|
84
|
+
@blur="context.handlers.blur()"
|
|
85
|
+
>
|
|
86
|
+
<span class="flex items-center gap-2 min-w-0">
|
|
87
|
+
<UIcon
|
|
88
|
+
:name="icon('calendar')"
|
|
89
|
+
class="size-4 shrink-0 text-primary"
|
|
90
|
+
/>
|
|
91
|
+
<span class="truncate">{{ displayValue }}</span>
|
|
92
|
+
</span>
|
|
93
|
+
<UIcon
|
|
94
|
+
:name="icon('chevron-down')"
|
|
95
|
+
class="size-4 shrink-0 text-dimmed"
|
|
96
|
+
/>
|
|
97
|
+
</button>
|
|
98
|
+
|
|
99
|
+
<template #content>
|
|
100
|
+
<div class="p-2">
|
|
101
|
+
<UCalendar
|
|
102
|
+
:model-value="calendarValue"
|
|
103
|
+
:min-value="minValue"
|
|
104
|
+
:max-value="maxValue"
|
|
105
|
+
:is-date-unavailable="isDateDisabled"
|
|
106
|
+
@update:model-value="onSelect($event as CalendarDate | null)"
|
|
107
|
+
/>
|
|
108
|
+
<div
|
|
109
|
+
v-if="calendarValue"
|
|
110
|
+
class="flex justify-end pt-1"
|
|
111
|
+
>
|
|
112
|
+
<UButton
|
|
113
|
+
color="neutral"
|
|
114
|
+
variant="ghost"
|
|
115
|
+
size="xs"
|
|
116
|
+
tabindex="0"
|
|
117
|
+
:label="t('formkit.datepicker.clear')"
|
|
118
|
+
@click="clear"
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
123
|
+
</UPopover>
|
|
124
|
+
</template>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { icon } = useIcons();
|
|
3
|
+
|
|
4
|
+
const { t } = useI18n();
|
|
5
|
+
|
|
6
|
+
const modelValue = defineModel<string>({ required: true });
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
autocomplete?: string;
|
|
11
|
+
showStrength?: boolean;
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const showPassword = ref(false);
|
|
15
|
+
const inputId = useId();
|
|
16
|
+
|
|
17
|
+
interface PasswordRequirement {
|
|
18
|
+
regex: RegExp;
|
|
19
|
+
key: string;
|
|
20
|
+
met: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function checkStrength(value: string): PasswordRequirement[] {
|
|
24
|
+
const rules = [
|
|
25
|
+
{ regex: /.{8,}/, key: "minLength" },
|
|
26
|
+
{ regex: /\d/, key: "number" },
|
|
27
|
+
{ regex: /[a-z]/, key: "lowercase" },
|
|
28
|
+
{ regex: /[A-Z]/, key: "uppercase" },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
return rules.map(rule => ({
|
|
32
|
+
...rule,
|
|
33
|
+
met: rule.regex.test(value),
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const strength = computed(() => props.showStrength ? checkStrength(modelValue.value) : []);
|
|
38
|
+
const score = computed(() => strength.value.filter(req => req.met).length);
|
|
39
|
+
|
|
40
|
+
const color = computed(() => {
|
|
41
|
+
if (score.value === 0) {
|
|
42
|
+
return "primary" as const;
|
|
43
|
+
}
|
|
44
|
+
if (score.value <= 2) {
|
|
45
|
+
return "error" as const;
|
|
46
|
+
}
|
|
47
|
+
if (score.value === 3) {
|
|
48
|
+
return "warning" as const;
|
|
49
|
+
}
|
|
50
|
+
return "success" as const;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const strengthText = computed(() => {
|
|
54
|
+
if (score.value === 0) {
|
|
55
|
+
return t("auth.password.strength.enter");
|
|
56
|
+
}
|
|
57
|
+
if (score.value <= 2) {
|
|
58
|
+
return t("auth.password.strength.weak");
|
|
59
|
+
}
|
|
60
|
+
if (score.value === 3) {
|
|
61
|
+
return t("auth.password.strength.medium");
|
|
62
|
+
}
|
|
63
|
+
return t("auth.password.strength.strong");
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<div>
|
|
69
|
+
<UInput
|
|
70
|
+
:id="inputId"
|
|
71
|
+
v-model="modelValue"
|
|
72
|
+
:type="showPassword ? 'text' : 'password'"
|
|
73
|
+
:autocomplete="autocomplete"
|
|
74
|
+
:color="showStrength ? color : undefined"
|
|
75
|
+
:placeholder="placeholder"
|
|
76
|
+
class="w-full"
|
|
77
|
+
>
|
|
78
|
+
<template #trailing>
|
|
79
|
+
<UTooltip :text="showPassword ? t('auth.password.hide') : t('auth.password.show')">
|
|
80
|
+
<UButton
|
|
81
|
+
color="neutral"
|
|
82
|
+
variant="link"
|
|
83
|
+
size="sm"
|
|
84
|
+
:icon="showPassword ? icon('eye-off') : icon('eye')"
|
|
85
|
+
:aria-label="showPassword ? t('auth.password.hide') : t('auth.password.show')"
|
|
86
|
+
:aria-pressed="showPassword"
|
|
87
|
+
:aria-controls="inputId"
|
|
88
|
+
@click="showPassword = !showPassword"
|
|
89
|
+
/>
|
|
90
|
+
</UTooltip>
|
|
91
|
+
</template>
|
|
92
|
+
</UInput>
|
|
93
|
+
|
|
94
|
+
<template v-if="showStrength">
|
|
95
|
+
<UProgress
|
|
96
|
+
:color="color"
|
|
97
|
+
:indicator="strengthText"
|
|
98
|
+
:model-value="score"
|
|
99
|
+
:max="4"
|
|
100
|
+
size="sm"
|
|
101
|
+
class="mt-4"
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<p class="text-sm font-medium mt-4">
|
|
105
|
+
{{ `${strengthText}. ${t('auth.password.strength.mustContain')}` }}
|
|
106
|
+
</p>
|
|
107
|
+
|
|
108
|
+
<ul
|
|
109
|
+
class="space-y-1 mt-1"
|
|
110
|
+
:aria-label="t('auth.password.strength.mustContain')"
|
|
111
|
+
>
|
|
112
|
+
<li
|
|
113
|
+
v-for="req in strength"
|
|
114
|
+
:key="req.key"
|
|
115
|
+
class="flex items-center gap-0.5"
|
|
116
|
+
:class="req.met ? 'text-success' : 'text-muted'"
|
|
117
|
+
>
|
|
118
|
+
<UIcon
|
|
119
|
+
:name="req.met ? icon('success') : icon('error')"
|
|
120
|
+
class="size-4 shrink-0"
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
<span class="text-xs font-light">
|
|
124
|
+
{{ t(`auth.password.strength.requirements.${req.key}`) }}
|
|
125
|
+
<span class="sr-only">
|
|
126
|
+
{{ req.met
|
|
127
|
+
? t('auth.password.strength.requirementMet')
|
|
128
|
+
: t('auth.password.strength.requirementNotMet')
|
|
129
|
+
}}
|
|
130
|
+
</span>
|
|
131
|
+
</span>
|
|
132
|
+
</li>
|
|
133
|
+
</ul>
|
|
134
|
+
</template>
|
|
135
|
+
</div>
|
|
136
|
+
</template>
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
+
|
|
4
|
+
import { searchApi } from "../../../api/search";
|
|
5
|
+
import type { Product } from "../../../composables/useProducts";
|
|
6
|
+
|
|
7
|
+
const { icon } = useIcons();
|
|
8
|
+
|
|
9
|
+
interface Suggestion {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
sku: string;
|
|
13
|
+
category: string;
|
|
14
|
+
categorySlug: string;
|
|
15
|
+
subcategorySlug?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { t } = useI18n();
|
|
19
|
+
const { search: searchConfig } = useAppConfig();
|
|
20
|
+
|
|
21
|
+
const query = ref<string>("");
|
|
22
|
+
const emit = defineEmits<{ search: [query: string] }>();
|
|
23
|
+
|
|
24
|
+
const suggestions = ref<Suggestion[]>([]);
|
|
25
|
+
const activeIndex = ref<number>(-1);
|
|
26
|
+
const showDropdown = computed(() => suggestions.value.length > 0);
|
|
27
|
+
|
|
28
|
+
const containerRef = ref<HTMLElement | null>(null);
|
|
29
|
+
|
|
30
|
+
// Camera-based QR/barcode scanning (FormKit barcode input): the decoded
|
|
31
|
+
// value becomes the search query and triggers the search immediately.
|
|
32
|
+
// The input definition is loaded on first open, client-only — the package
|
|
33
|
+
// re-exports from the CommonJS @zxing/library, which must never be touched
|
|
34
|
+
// during SSR.
|
|
35
|
+
const scannerOpen = ref(false);
|
|
36
|
+
const scannedCode = ref("");
|
|
37
|
+
const barcodeType = shallowRef<object | null>(null);
|
|
38
|
+
|
|
39
|
+
async function openScanner(): Promise<void> {
|
|
40
|
+
if (!barcodeType.value) {
|
|
41
|
+
const { barcode } = await import("@formkit/barcode");
|
|
42
|
+
barcodeType.value = barcode;
|
|
43
|
+
}
|
|
44
|
+
scannerOpen.value = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
watch(scannedCode, (code) => {
|
|
48
|
+
if (!code) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
scannerOpen.value = false;
|
|
52
|
+
scannedCode.value = "";
|
|
53
|
+
query.value = code;
|
|
54
|
+
close();
|
|
55
|
+
emit("search", code);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const debouncedFetch = useDebounceFn(fetchSuggestions, 250);
|
|
59
|
+
|
|
60
|
+
watch(query, (val) => {
|
|
61
|
+
activeIndex.value = -1;
|
|
62
|
+
if (!val.trim() || val.trim().length < searchConfig.autocompleteMinChars) {
|
|
63
|
+
suggestions.value = [];
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
void debouncedFetch(val);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
async function fetchSuggestions(q: string): Promise<void> {
|
|
70
|
+
const data = await $fetch<{ suggestions: Suggestion[] }>(searchApi.suggest(), {
|
|
71
|
+
method: "POST",
|
|
72
|
+
body: { q },
|
|
73
|
+
}).catch(() => ({ suggestions: [] }));
|
|
74
|
+
suggestions.value = data.suggestions;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function close(): void {
|
|
78
|
+
suggestions.value = [];
|
|
79
|
+
activeIndex.value = -1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function select(s: Suggestion): void {
|
|
83
|
+
query.value = s.name;
|
|
84
|
+
close();
|
|
85
|
+
const url = useProductUrl({
|
|
86
|
+
id: s.id,
|
|
87
|
+
name: s.name,
|
|
88
|
+
categorySlug: s.categorySlug,
|
|
89
|
+
subcategorySlug: s.subcategorySlug,
|
|
90
|
+
} as Product);
|
|
91
|
+
void navigateTo(url.value);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function onEnter(): void {
|
|
95
|
+
const activeSuggestion = activeIndex.value >= 0
|
|
96
|
+
? suggestions.value[activeIndex.value]
|
|
97
|
+
: undefined;
|
|
98
|
+
|
|
99
|
+
if (activeSuggestion) {
|
|
100
|
+
select(activeSuggestion);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
close();
|
|
104
|
+
emit("search", query.value);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function onDown(): void {
|
|
109
|
+
activeIndex.value = Math.min(activeIndex.value + 1, suggestions.value.length - 1);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function onUp(): void {
|
|
113
|
+
activeIndex.value = Math.max(activeIndex.value - 1, -1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function handleClickOutside(e: MouseEvent): void {
|
|
117
|
+
if (containerRef.value && !containerRef.value.contains(e.target as Node)) {
|
|
118
|
+
close();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onMounted(() => document.addEventListener("click", handleClickOutside));
|
|
123
|
+
onUnmounted(() => document.removeEventListener("click", handleClickOutside));
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<template>
|
|
127
|
+
<div
|
|
128
|
+
ref="containerRef"
|
|
129
|
+
class="relative w-full"
|
|
130
|
+
>
|
|
131
|
+
<UInput
|
|
132
|
+
v-model="query"
|
|
133
|
+
name="search"
|
|
134
|
+
:leading-icon="icon('search')"
|
|
135
|
+
:placeholder="t('search.input.placeholder')"
|
|
136
|
+
:aria-label="t('search.input.placeholder')"
|
|
137
|
+
size="lg"
|
|
138
|
+
color="primary"
|
|
139
|
+
variant="none"
|
|
140
|
+
:ui="{
|
|
141
|
+
root: 'w-full',
|
|
142
|
+
base: `rounded-xl bg-elevated/60 shadow-sm ring-1 ring-default
|
|
143
|
+
focus-visible:ring-2 focus-visible:ring-(--ui-primary) max-sm:text-base
|
|
144
|
+
placeholder:text-muted pr-11`,
|
|
145
|
+
leadingIcon: 'text-primary',
|
|
146
|
+
}"
|
|
147
|
+
class="w-full"
|
|
148
|
+
@keydown.enter.prevent="onEnter"
|
|
149
|
+
@keydown.down.prevent="onDown"
|
|
150
|
+
@keydown.up.prevent="onUp"
|
|
151
|
+
@keydown.escape="close"
|
|
152
|
+
>
|
|
153
|
+
<template #trailing>
|
|
154
|
+
<UTooltip :text="t('search.input.scan')">
|
|
155
|
+
<UButton
|
|
156
|
+
:icon="icon('scan')"
|
|
157
|
+
color="primary"
|
|
158
|
+
variant="ghost"
|
|
159
|
+
size="sm"
|
|
160
|
+
tabindex="0"
|
|
161
|
+
:aria-label="t('search.input.scan')"
|
|
162
|
+
class="cursor-pointer"
|
|
163
|
+
@click="openScanner"
|
|
164
|
+
/>
|
|
165
|
+
</UTooltip>
|
|
166
|
+
</template>
|
|
167
|
+
</UInput>
|
|
168
|
+
|
|
169
|
+
<UModal
|
|
170
|
+
v-model:open="scannerOpen"
|
|
171
|
+
:title="t('search.input.scanTitle')"
|
|
172
|
+
:description="t('search.input.scanHint')"
|
|
173
|
+
>
|
|
174
|
+
<template #body>
|
|
175
|
+
<FormKit
|
|
176
|
+
v-if="barcodeType"
|
|
177
|
+
v-model="scannedCode"
|
|
178
|
+
:type="barcodeType"
|
|
179
|
+
name="searchScan"
|
|
180
|
+
:label="t('search.input.scanTitle')"
|
|
181
|
+
outer-class="w-full"
|
|
182
|
+
/>
|
|
183
|
+
</template>
|
|
184
|
+
</UModal>
|
|
185
|
+
<div
|
|
186
|
+
v-if="showDropdown"
|
|
187
|
+
class="absolute z-50 w-full top-full mt-1 bg-(--ui-bg) border border-(--ui-border)
|
|
188
|
+
rounded-lg shadow-lg overflow-hidden"
|
|
189
|
+
>
|
|
190
|
+
<button
|
|
191
|
+
v-for="(s, i) in suggestions"
|
|
192
|
+
:key="s.id"
|
|
193
|
+
type="button"
|
|
194
|
+
class="w-full flex items-center gap-3 px-3 py-2 text-sm text-left
|
|
195
|
+
cursor-pointer transition-colors"
|
|
196
|
+
:class="i === activeIndex ? 'bg-(--ui-bg-elevated)' : 'hover:bg-(--ui-bg-elevated)'"
|
|
197
|
+
@click="select(s)"
|
|
198
|
+
>
|
|
199
|
+
<UIcon
|
|
200
|
+
:name="icon('package')"
|
|
201
|
+
class="shrink-0 text-(--ui-text-muted) size-4"
|
|
202
|
+
/>
|
|
203
|
+
<span class="flex-1 truncate font-medium">{{ s.name }}</span>
|
|
204
|
+
<UBadge
|
|
205
|
+
:label="s.sku"
|
|
206
|
+
variant="soft"
|
|
207
|
+
size="xs"
|
|
208
|
+
class="shrink-0"
|
|
209
|
+
/>
|
|
210
|
+
</button>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Sortable column header for data tables (datatable-ux): clickable label
|
|
4
|
+
* with a visible sort affordance — the icon on the active column carries
|
|
5
|
+
* the primary accent, inactive columns keep a subtle hint.
|
|
6
|
+
*
|
|
7
|
+
* Used inside UTable `#<id>-header` slots: pass the TanStack `column`
|
|
8
|
+
* from the slot context.
|
|
9
|
+
*/
|
|
10
|
+
interface SortableColumn {
|
|
11
|
+
getIsSorted: () => false | "asc" | "desc";
|
|
12
|
+
toggleSorting: (desc?: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
column: SortableColumn;
|
|
17
|
+
label: string;
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
const { icon } = useIcons();
|
|
21
|
+
|
|
22
|
+
const sorted = computed(() => props.column.getIsSorted());
|
|
23
|
+
|
|
24
|
+
const sortIcon = computed(() => {
|
|
25
|
+
if (sorted.value === "asc") {
|
|
26
|
+
return icon("sort-asc");
|
|
27
|
+
}
|
|
28
|
+
if (sorted.value === "desc") {
|
|
29
|
+
return icon("sort-desc");
|
|
30
|
+
}
|
|
31
|
+
return icon("sort");
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
tabindex="0"
|
|
39
|
+
class="group inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide
|
|
40
|
+
text-muted hover:text-highlighted transition-colors cursor-pointer"
|
|
41
|
+
:aria-label="label"
|
|
42
|
+
@click="column.toggleSorting(sorted === 'asc')"
|
|
43
|
+
>
|
|
44
|
+
{{ label }}
|
|
45
|
+
<UIcon
|
|
46
|
+
:name="sortIcon"
|
|
47
|
+
class="size-3.5 transition-colors"
|
|
48
|
+
:class="sorted ? 'text-primary' : 'text-dimmed group-hover:text-muted'"
|
|
49
|
+
/>
|
|
50
|
+
</button>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Data table toolbar (datatable-ux): a prominent, wide search input plus
|
|
4
|
+
* minimalist filter pills for the primary dimension (usually status) —
|
|
5
|
+
* the two features every table needs to scale. The `actions` slot holds
|
|
6
|
+
* the primary action (e.g. the Add button).
|
|
7
|
+
*/
|
|
8
|
+
export interface TableToolbarFilterItem {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
count?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
defineProps<{
|
|
15
|
+
searchPlaceholder?: string;
|
|
16
|
+
filterItems?: TableToolbarFilterItem[];
|
|
17
|
+
}>();
|
|
18
|
+
|
|
19
|
+
const search = defineModel<string>("search", { default: "" });
|
|
20
|
+
const filter = defineModel<string>("filter", { default: "all" });
|
|
21
|
+
|
|
22
|
+
const { icon } = useIcons();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div class="mb-4 space-y-3">
|
|
27
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
28
|
+
<UInput
|
|
29
|
+
v-model="search"
|
|
30
|
+
:icon="icon('search')"
|
|
31
|
+
:placeholder="searchPlaceholder"
|
|
32
|
+
class="w-full sm:w-auto sm:flex-1 sm:max-w-md"
|
|
33
|
+
/>
|
|
34
|
+
<div
|
|
35
|
+
v-if="$slots.actions"
|
|
36
|
+
class="flex items-center gap-2 ms-auto"
|
|
37
|
+
>
|
|
38
|
+
<slot name="actions" />
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div
|
|
43
|
+
v-if="filterItems?.length"
|
|
44
|
+
class="flex flex-wrap items-center gap-1"
|
|
45
|
+
>
|
|
46
|
+
<UButton
|
|
47
|
+
v-for="item in filterItems"
|
|
48
|
+
:key="item.value"
|
|
49
|
+
:color="filter === item.value ? 'primary' : 'neutral'"
|
|
50
|
+
:variant="filter === item.value ? 'soft' : 'ghost'"
|
|
51
|
+
size="sm"
|
|
52
|
+
tabindex="0"
|
|
53
|
+
@click="filter = item.value"
|
|
54
|
+
>
|
|
55
|
+
{{ item.label }}
|
|
56
|
+
<span
|
|
57
|
+
v-if="item.count !== undefined"
|
|
58
|
+
class="text-xs tabular-nums"
|
|
59
|
+
:class="filter === item.value ? 'text-primary/70' : 'text-dimmed'"
|
|
60
|
+
>
|
|
61
|
+
{{ item.count }}
|
|
62
|
+
</span>
|
|
63
|
+
</UButton>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { accountApi } from "../api/account";
|
|
2
|
+
import type { AccountProfile, AccountProfileUpdateInput } from "../interfaces/account/profile";
|
|
3
|
+
|
|
4
|
+
export const useAccount = () => {
|
|
5
|
+
const { data: user } = useFetch<AccountProfile>(accountApi.profile(), {
|
|
6
|
+
key: "account-user",
|
|
7
|
+
default: (): AccountProfile => ({
|
|
8
|
+
name: "",
|
|
9
|
+
email: "",
|
|
10
|
+
initials: "",
|
|
11
|
+
phone: "",
|
|
12
|
+
company: "",
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const updateProfile = async (payload: AccountProfileUpdateInput): Promise<AccountProfile> => {
|
|
17
|
+
const updated = await $fetch<AccountProfile>(accountApi.profile(), {
|
|
18
|
+
method: "PUT",
|
|
19
|
+
body: payload,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
user.value = updated;
|
|
23
|
+
return updated;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return { user, updateProfile };
|
|
27
|
+
};
|