@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,349 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { OrderList } from "../../../interfaces/account/order-lists";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Detail page content of one order list: position management for the
|
|
6
|
+
* owner, add-to-cart, edit (modal) and delete.
|
|
7
|
+
*/
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
listId: string;
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
const { icon } = useIcons();
|
|
13
|
+
const { t, d } = useI18n();
|
|
14
|
+
const { to } = useAppUrl();
|
|
15
|
+
const toast = useToast();
|
|
16
|
+
const cart = useCartStore();
|
|
17
|
+
const authStore = useAuthStore();
|
|
18
|
+
const localePath = useLocalePath();
|
|
19
|
+
const { getImage } = useProductImage();
|
|
20
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
21
|
+
|
|
22
|
+
const { data: list, status, error, refresh } = useFetch<OrderList>(
|
|
23
|
+
`/api/account/order-lists/${props.listId}`,
|
|
24
|
+
{ key: `account-order-list:${props.listId}` },
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const isOwner = computed(() => authStore.user?.$id === list.value?.owner.id);
|
|
28
|
+
const listValue = computed(() =>
|
|
29
|
+
Math.round((list.value?.positions ?? []).reduce((sum, p) => sum + p.price * p.quantity, 0) * 100) / 100,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const formatDate = (value: string) => d(new Date(value), { dateStyle: "medium" });
|
|
33
|
+
|
|
34
|
+
/* ---- position management ------------------------------------------ */
|
|
35
|
+
async function updatePositions(positions: OrderList["positions"]): Promise<void> {
|
|
36
|
+
await $fetch(`/api/account/order-lists/${props.listId}`, {
|
|
37
|
+
method: "PUT",
|
|
38
|
+
body: { positions },
|
|
39
|
+
});
|
|
40
|
+
await refresh();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function changeQuantity(index: number, delta: number): Promise<void> {
|
|
44
|
+
if (!list.value) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
await updatePositions(list.value.positions.map((p, i) =>
|
|
48
|
+
i === index ? { ...p, quantity: Math.max(1, p.quantity + delta) } : p,
|
|
49
|
+
));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function removePosition(index: number): Promise<void> {
|
|
53
|
+
if (!list.value) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
await updatePositions(list.value.positions.filter((_, i) => i !== index));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ---- edit modal ----------------------------------------------------- */
|
|
60
|
+
const editOpen = ref(false);
|
|
61
|
+
const formName = ref("");
|
|
62
|
+
const formPublic = ref(false);
|
|
63
|
+
const saving = ref(false);
|
|
64
|
+
|
|
65
|
+
function openEdit(): void {
|
|
66
|
+
formName.value = list.value?.name ?? "";
|
|
67
|
+
formPublic.value = list.value?.public ?? false;
|
|
68
|
+
editOpen.value = true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function saveEdit(): Promise<void> {
|
|
72
|
+
saving.value = true;
|
|
73
|
+
try {
|
|
74
|
+
await $fetch(`/api/account/order-lists/${props.listId}`, {
|
|
75
|
+
method: "PUT",
|
|
76
|
+
body: { name: formName.value.trim(), public: formPublic.value },
|
|
77
|
+
});
|
|
78
|
+
editOpen.value = false;
|
|
79
|
+
await refresh();
|
|
80
|
+
toast.add({ title: t("orderLists.saved"), color: "success", icon: icon("success"), duration: 1500 });
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
toast.add({ title: t("orderLists.error"), color: "error", icon: icon("error") });
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
saving.value = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function deleteList(): Promise<void> {
|
|
91
|
+
try {
|
|
92
|
+
await $fetch(`/api/account/order-lists/${props.listId}`, { method: "DELETE" });
|
|
93
|
+
toast.add({ title: t("orderLists.deleted"), color: "success", icon: icon("success"), duration: 1500 });
|
|
94
|
+
await navigateTo(localePath("/account/order-lists"));
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
toast.add({ title: t("orderLists.error"), color: "error", icon: icon("error") });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* ---- add to cart ----------------------------------------------------- */
|
|
102
|
+
async function addToCart(): Promise<void> {
|
|
103
|
+
if (!list.value) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
let added = 0;
|
|
107
|
+
for (const position of list.value.positions) {
|
|
108
|
+
const ok = cart.addItem({
|
|
109
|
+
id: position.id,
|
|
110
|
+
name: position.name,
|
|
111
|
+
image: position.image ?? "",
|
|
112
|
+
sku: position.sku,
|
|
113
|
+
price: position.price,
|
|
114
|
+
taxRate: position.taxRate,
|
|
115
|
+
unit: position.unit,
|
|
116
|
+
costCenterId: position.costCenterId,
|
|
117
|
+
positionTexts: position.positionTexts,
|
|
118
|
+
customSku: position.customSku,
|
|
119
|
+
categorySlug: position.categorySlug,
|
|
120
|
+
subcategorySlug: position.subcategorySlug,
|
|
121
|
+
});
|
|
122
|
+
if (ok && position.quantity > 1) {
|
|
123
|
+
const item = cart.items.find(i => i.id === position.id && !i.requisitionId);
|
|
124
|
+
if (item) {
|
|
125
|
+
cart.updateQuantityByKey(cart.keyOf(item), item.quantity + position.quantity - 1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (ok) {
|
|
129
|
+
added++;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
toast.add({
|
|
133
|
+
title: t("orderLists.addedToCart", { count: added }),
|
|
134
|
+
color: "success",
|
|
135
|
+
icon: icon("success"),
|
|
136
|
+
duration: 2000,
|
|
137
|
+
});
|
|
138
|
+
await navigateTo(to("/cart"));
|
|
139
|
+
}
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<template>
|
|
143
|
+
<div>
|
|
144
|
+
<USkeleton
|
|
145
|
+
v-if="status === 'pending'"
|
|
146
|
+
class="h-64 w-full rounded-xl"
|
|
147
|
+
/>
|
|
148
|
+
|
|
149
|
+
<UiFeedbackErrorBoundary
|
|
150
|
+
v-else-if="error || !list"
|
|
151
|
+
:title="t('orderLists.notFound')"
|
|
152
|
+
:show-retry="false"
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
<div
|
|
156
|
+
v-else
|
|
157
|
+
class="space-y-6"
|
|
158
|
+
>
|
|
159
|
+
<h1 class="text-2xl font-semibold text-highlighted">
|
|
160
|
+
{{ list.name }}
|
|
161
|
+
</h1>
|
|
162
|
+
<!-- Head -->
|
|
163
|
+
<div
|
|
164
|
+
class="border border-(--ui-border) rounded-xl p-4 sm:p-5
|
|
165
|
+
flex flex-wrap items-center gap-x-8 gap-y-3"
|
|
166
|
+
>
|
|
167
|
+
<UBadge
|
|
168
|
+
:color="list.kind === 'shopping' ? 'primary' : 'info'"
|
|
169
|
+
variant="subtle"
|
|
170
|
+
:label="t(`orderLists.kinds.${list.kind}`)"
|
|
171
|
+
/>
|
|
172
|
+
<div>
|
|
173
|
+
<p class="text-xs text-muted">
|
|
174
|
+
{{ t('orderLists.columns.visibility') }}
|
|
175
|
+
</p>
|
|
176
|
+
<p class="text-sm font-medium text-highlighted">
|
|
177
|
+
{{ list.public ? t('orderLists.public') : list.owner.name }}
|
|
178
|
+
</p>
|
|
179
|
+
</div>
|
|
180
|
+
<div>
|
|
181
|
+
<p class="text-xs text-muted">
|
|
182
|
+
{{ t('orderLists.columns.updatedAt') }}
|
|
183
|
+
</p>
|
|
184
|
+
<p class="text-sm font-medium text-highlighted">
|
|
185
|
+
{{ formatDate(list.updatedAt) }}
|
|
186
|
+
</p>
|
|
187
|
+
</div>
|
|
188
|
+
<div>
|
|
189
|
+
<p class="text-xs text-muted">
|
|
190
|
+
{{ t('orderLists.columns.value') }}
|
|
191
|
+
</p>
|
|
192
|
+
<p class="text-sm font-semibold text-highlighted tabular-nums">
|
|
193
|
+
{{ formatCurrency(listValue) }}
|
|
194
|
+
</p>
|
|
195
|
+
</div>
|
|
196
|
+
<div
|
|
197
|
+
v-if="isOwner"
|
|
198
|
+
class="flex items-center gap-2 ms-auto"
|
|
199
|
+
>
|
|
200
|
+
<UButton
|
|
201
|
+
color="neutral"
|
|
202
|
+
variant="outline"
|
|
203
|
+
size="sm"
|
|
204
|
+
tabindex="0"
|
|
205
|
+
:icon="icon('edit')"
|
|
206
|
+
:label="t('governance.edit')"
|
|
207
|
+
@click="openEdit"
|
|
208
|
+
/>
|
|
209
|
+
<UButton
|
|
210
|
+
color="error"
|
|
211
|
+
variant="soft"
|
|
212
|
+
size="sm"
|
|
213
|
+
tabindex="0"
|
|
214
|
+
:icon="icon('delete')"
|
|
215
|
+
:label="t('orderLists.delete')"
|
|
216
|
+
@click="deleteList"
|
|
217
|
+
/>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<!-- Positions -->
|
|
222
|
+
<section class="border border-(--ui-border) rounded-xl overflow-hidden">
|
|
223
|
+
<h2 class="px-4 sm:px-5 py-3 text-sm font-semibold text-highlighted bg-elevated/60 border-b border-(--ui-border)">
|
|
224
|
+
{{ t('orderLists.columns.positions') }} ({{ list.positions.length }})
|
|
225
|
+
</h2>
|
|
226
|
+
<ul class="divide-y divide-(--ui-border) px-4 sm:px-5">
|
|
227
|
+
<li
|
|
228
|
+
v-for="(position, index) in list.positions"
|
|
229
|
+
:key="`${list.id}-${index}`"
|
|
230
|
+
class="flex items-center gap-3 py-3"
|
|
231
|
+
>
|
|
232
|
+
<span
|
|
233
|
+
class="w-14 h-14 shrink-0 flex items-center justify-center rounded-lg
|
|
234
|
+
bg-elevated/60 ring-1 ring-(--ui-border) p-1.5"
|
|
235
|
+
>
|
|
236
|
+
<img
|
|
237
|
+
v-if="position.image"
|
|
238
|
+
:src="getImage(position.image)"
|
|
239
|
+
:alt="position.name"
|
|
240
|
+
class="max-h-full max-w-full object-contain"
|
|
241
|
+
>
|
|
242
|
+
</span>
|
|
243
|
+
<div class="min-w-0 flex-1">
|
|
244
|
+
<p class="text-sm font-medium text-highlighted truncate">
|
|
245
|
+
{{ position.name }}
|
|
246
|
+
</p>
|
|
247
|
+
<p class="text-xs text-muted">
|
|
248
|
+
{{ position.sku }}
|
|
249
|
+
<template v-if="position.customSku">
|
|
250
|
+
· {{ position.customSku }}
|
|
251
|
+
</template>
|
|
252
|
+
· {{ formatCurrency(position.price) }}
|
|
253
|
+
</p>
|
|
254
|
+
</div>
|
|
255
|
+
<div
|
|
256
|
+
v-if="isOwner"
|
|
257
|
+
class="flex items-center gap-1 shrink-0"
|
|
258
|
+
>
|
|
259
|
+
<UButton
|
|
260
|
+
:icon="icon('minus')"
|
|
261
|
+
color="neutral"
|
|
262
|
+
variant="ghost"
|
|
263
|
+
size="xs"
|
|
264
|
+
tabindex="0"
|
|
265
|
+
:disabled="position.quantity <= 1"
|
|
266
|
+
:aria-label="t('cart.item.ariaDecreaseQuantity', { name: position.name })"
|
|
267
|
+
@click="changeQuantity(index, -1)"
|
|
268
|
+
/>
|
|
269
|
+
<span class="w-8 text-center text-sm tabular-nums">{{ position.quantity }}</span>
|
|
270
|
+
<UButton
|
|
271
|
+
:icon="icon('plus')"
|
|
272
|
+
color="neutral"
|
|
273
|
+
variant="ghost"
|
|
274
|
+
size="xs"
|
|
275
|
+
tabindex="0"
|
|
276
|
+
:aria-label="t('cart.item.ariaIncreaseQuantity', { name: position.name })"
|
|
277
|
+
@click="changeQuantity(index, 1)"
|
|
278
|
+
/>
|
|
279
|
+
<UButton
|
|
280
|
+
:icon="icon('delete')"
|
|
281
|
+
color="neutral"
|
|
282
|
+
variant="ghost"
|
|
283
|
+
size="xs"
|
|
284
|
+
tabindex="0"
|
|
285
|
+
:aria-label="t('cart.item.remove')"
|
|
286
|
+
@click="removePosition(index)"
|
|
287
|
+
/>
|
|
288
|
+
</div>
|
|
289
|
+
<span
|
|
290
|
+
v-else
|
|
291
|
+
class="text-sm tabular-nums shrink-0"
|
|
292
|
+
>{{ position.quantity }}×</span>
|
|
293
|
+
</li>
|
|
294
|
+
</ul>
|
|
295
|
+
</section>
|
|
296
|
+
|
|
297
|
+
<UButton
|
|
298
|
+
v-if="list.kind === 'shopping' && list.positions.length"
|
|
299
|
+
color="primary"
|
|
300
|
+
tabindex="0"
|
|
301
|
+
:icon="icon('cart')"
|
|
302
|
+
:label="t('cart.requisition.load')"
|
|
303
|
+
@click="addToCart"
|
|
304
|
+
/>
|
|
305
|
+
</div>
|
|
306
|
+
|
|
307
|
+
<!-- Edit modal -->
|
|
308
|
+
<UModal
|
|
309
|
+
v-model:open="editOpen"
|
|
310
|
+
:title="t('orderLists.editTitle')"
|
|
311
|
+
>
|
|
312
|
+
<template #body>
|
|
313
|
+
<div class="space-y-4">
|
|
314
|
+
<UFormField
|
|
315
|
+
:label="t('orderLists.columns.name')"
|
|
316
|
+
required
|
|
317
|
+
>
|
|
318
|
+
<UInput
|
|
319
|
+
v-model="formName"
|
|
320
|
+
class="w-full"
|
|
321
|
+
/>
|
|
322
|
+
</UFormField>
|
|
323
|
+
<UCheckbox
|
|
324
|
+
v-model="formPublic"
|
|
325
|
+
:label="t('orderLists.shareWithOrg')"
|
|
326
|
+
:description="t('orderLists.shareHint')"
|
|
327
|
+
/>
|
|
328
|
+
</div>
|
|
329
|
+
</template>
|
|
330
|
+
<template #footer>
|
|
331
|
+
<UButton
|
|
332
|
+
color="neutral"
|
|
333
|
+
variant="ghost"
|
|
334
|
+
tabindex="0"
|
|
335
|
+
:label="t('cart.item.cancel')"
|
|
336
|
+
@click="editOpen = false"
|
|
337
|
+
/>
|
|
338
|
+
<UButton
|
|
339
|
+
color="primary"
|
|
340
|
+
tabindex="0"
|
|
341
|
+
:disabled="!formName.trim()"
|
|
342
|
+
:loading="saving"
|
|
343
|
+
:label="t('governance.save')"
|
|
344
|
+
@click="saveEdit"
|
|
345
|
+
/>
|
|
346
|
+
</template>
|
|
347
|
+
</UModal>
|
|
348
|
+
</div>
|
|
349
|
+
</template>
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TableColumn } from "@nuxt/ui";
|
|
3
|
+
|
|
4
|
+
import type { OrderList, OrderListKind } from "../../../interfaces/account/order-lists";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Order lists overview (account pattern): data table with the Add modal;
|
|
8
|
+
* details (position management, edit, delete) live on their own page.
|
|
9
|
+
* Search, kind filter pills and sortable columns per datatable-ux.
|
|
10
|
+
*/
|
|
11
|
+
const { icon } = useIcons();
|
|
12
|
+
const { t, d } = useI18n();
|
|
13
|
+
const localePath = useLocalePath();
|
|
14
|
+
const { to } = useAppUrl();
|
|
15
|
+
const toast = useToast();
|
|
16
|
+
const cart = useCartStore();
|
|
17
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
18
|
+
const { tableUi } = useDataTable();
|
|
19
|
+
|
|
20
|
+
const { data: lists, status, refresh } = useFetch<OrderList[]>("/api/account/order-lists", {
|
|
21
|
+
key: "account-order-lists",
|
|
22
|
+
default: () => [],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const listValue = (list: OrderList): number =>
|
|
26
|
+
Math.round(list.positions.reduce((sum, p) => sum + p.price * p.quantity, 0) * 100) / 100;
|
|
27
|
+
|
|
28
|
+
/* ---- search + kind filter --------------------------------------------- */
|
|
29
|
+
const search = ref("");
|
|
30
|
+
const kindFilter = ref<string>("all");
|
|
31
|
+
|
|
32
|
+
const searched = computed(() => {
|
|
33
|
+
const query = search.value.trim().toLowerCase();
|
|
34
|
+
if (!query) {
|
|
35
|
+
return lists.value ?? [];
|
|
36
|
+
}
|
|
37
|
+
return (lists.value ?? []).filter(list =>
|
|
38
|
+
[list.name, list.owner.name].some(value => value.toLowerCase().includes(query)),
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const filtered = computed(() =>
|
|
43
|
+
kindFilter.value === "all"
|
|
44
|
+
? searched.value
|
|
45
|
+
: searched.value.filter(list => list.kind === kindFilter.value),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const LIST_KINDS: OrderListKind[] = ["shopping", "label"];
|
|
49
|
+
|
|
50
|
+
const filterItems = computed(() => [
|
|
51
|
+
{ value: "all", label: t("table.filterAll"), count: searched.value.length },
|
|
52
|
+
...LIST_KINDS.map(value => ({
|
|
53
|
+
value,
|
|
54
|
+
label: t(`orderLists.kinds.${value}`),
|
|
55
|
+
count: searched.value.filter(list => list.kind === value).length,
|
|
56
|
+
})),
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
/* ---- columns + sorting ------------------------------------------------ */
|
|
60
|
+
const sorting = ref([{ id: "updatedAt", desc: true }]);
|
|
61
|
+
|
|
62
|
+
const columns = computed<TableColumn<OrderList>[]>(() => [
|
|
63
|
+
{ accessorKey: "name", header: t("orderLists.columns.name") },
|
|
64
|
+
{ id: "kind", header: t("orderLists.columns.kind"), enableSorting: false },
|
|
65
|
+
{
|
|
66
|
+
id: "positions",
|
|
67
|
+
accessorFn: row => row.positions.length,
|
|
68
|
+
header: t("orderLists.columns.positions"),
|
|
69
|
+
meta: { class: { th: "text-right", td: "text-right" } },
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "value",
|
|
73
|
+
accessorFn: row => listValue(row),
|
|
74
|
+
header: t("orderLists.columns.value"),
|
|
75
|
+
meta: { class: { th: "text-right", td: "text-right" } },
|
|
76
|
+
},
|
|
77
|
+
{ id: "visibility", header: t("orderLists.columns.visibility"), enableSorting: false },
|
|
78
|
+
{ accessorKey: "updatedAt", header: t("orderLists.columns.updatedAt") },
|
|
79
|
+
{ id: "actions", header: "", enableSorting: false },
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
const formatDate = (value: string) => d(new Date(value), { dateStyle: "medium" });
|
|
83
|
+
|
|
84
|
+
/* ---- create / edit modal ------------------------------------------ */
|
|
85
|
+
const modalOpen = ref(false);
|
|
86
|
+
const formName = ref("");
|
|
87
|
+
const formKind = ref<OrderListKind>("shopping");
|
|
88
|
+
const formPublic = ref(false);
|
|
89
|
+
const saving = ref(false);
|
|
90
|
+
|
|
91
|
+
function openCreate(): void {
|
|
92
|
+
formName.value = "";
|
|
93
|
+
formKind.value = "shopping";
|
|
94
|
+
formPublic.value = false;
|
|
95
|
+
modalOpen.value = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function saveList(): Promise<void> {
|
|
99
|
+
saving.value = true;
|
|
100
|
+
try {
|
|
101
|
+
await $fetch("/api/account/order-lists", {
|
|
102
|
+
method: "POST",
|
|
103
|
+
body: { name: formName.value.trim(), kind: formKind.value, public: formPublic.value },
|
|
104
|
+
});
|
|
105
|
+
modalOpen.value = false;
|
|
106
|
+
await refresh();
|
|
107
|
+
toast.add({ title: t("orderLists.saved"), color: "success", icon: icon("success"), duration: 1500 });
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
toast.add({ title: t("orderLists.error"), color: "error", icon: icon("error") });
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
saving.value = false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ---- add to cart ---------------------------------------------------- */
|
|
118
|
+
async function addToCart(list: OrderList): Promise<void> {
|
|
119
|
+
let added = 0;
|
|
120
|
+
for (const position of list.positions) {
|
|
121
|
+
const ok = cart.addItem({
|
|
122
|
+
id: position.id,
|
|
123
|
+
name: position.name,
|
|
124
|
+
image: position.image ?? "",
|
|
125
|
+
sku: position.sku,
|
|
126
|
+
price: position.price,
|
|
127
|
+
taxRate: position.taxRate,
|
|
128
|
+
unit: position.unit,
|
|
129
|
+
costCenterId: position.costCenterId,
|
|
130
|
+
positionTexts: position.positionTexts,
|
|
131
|
+
customSku: position.customSku,
|
|
132
|
+
categorySlug: position.categorySlug,
|
|
133
|
+
subcategorySlug: position.subcategorySlug,
|
|
134
|
+
});
|
|
135
|
+
if (ok && position.quantity > 1) {
|
|
136
|
+
const item = cart.items.find(i => i.id === position.id && !i.requisitionId);
|
|
137
|
+
if (item) {
|
|
138
|
+
cart.updateQuantityByKey(cart.keyOf(item), item.quantity + position.quantity - 1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (ok) {
|
|
142
|
+
added++;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
toast.add({
|
|
146
|
+
title: t("orderLists.addedToCart", { count: added }),
|
|
147
|
+
color: "success",
|
|
148
|
+
icon: icon("success"),
|
|
149
|
+
duration: 2000,
|
|
150
|
+
});
|
|
151
|
+
await navigateTo(to("/cart"));
|
|
152
|
+
}
|
|
153
|
+
</script>
|
|
154
|
+
|
|
155
|
+
<template>
|
|
156
|
+
<div>
|
|
157
|
+
<UiTableToolbar
|
|
158
|
+
v-model:search="search"
|
|
159
|
+
v-model:filter="kindFilter"
|
|
160
|
+
:search-placeholder="t('orderLists.searchPlaceholder')"
|
|
161
|
+
:filter-items="filterItems"
|
|
162
|
+
>
|
|
163
|
+
<template #actions>
|
|
164
|
+
<UButton
|
|
165
|
+
color="primary"
|
|
166
|
+
tabindex="0"
|
|
167
|
+
:icon="icon('plus')"
|
|
168
|
+
:label="t('orderLists.add')"
|
|
169
|
+
@click="openCreate"
|
|
170
|
+
/>
|
|
171
|
+
</template>
|
|
172
|
+
</UiTableToolbar>
|
|
173
|
+
|
|
174
|
+
<UTable
|
|
175
|
+
v-model:sorting="sorting"
|
|
176
|
+
:data="filtered"
|
|
177
|
+
:columns="columns"
|
|
178
|
+
:loading="status === 'pending'"
|
|
179
|
+
:ui="tableUi"
|
|
180
|
+
>
|
|
181
|
+
<template #name-header="{ column }">
|
|
182
|
+
<UiTableSortButton
|
|
183
|
+
:column="column"
|
|
184
|
+
:label="t('orderLists.columns.name')"
|
|
185
|
+
/>
|
|
186
|
+
</template>
|
|
187
|
+
<template #positions-header="{ column }">
|
|
188
|
+
<UiTableSortButton
|
|
189
|
+
:column="column"
|
|
190
|
+
:label="t('orderLists.columns.positions')"
|
|
191
|
+
/>
|
|
192
|
+
</template>
|
|
193
|
+
<template #value-header="{ column }">
|
|
194
|
+
<UiTableSortButton
|
|
195
|
+
:column="column"
|
|
196
|
+
:label="t('orderLists.columns.value')"
|
|
197
|
+
/>
|
|
198
|
+
</template>
|
|
199
|
+
<template #updatedAt-header="{ column }">
|
|
200
|
+
<UiTableSortButton
|
|
201
|
+
:column="column"
|
|
202
|
+
:label="t('orderLists.columns.updatedAt')"
|
|
203
|
+
/>
|
|
204
|
+
</template>
|
|
205
|
+
|
|
206
|
+
<template #name-cell="{ row }">
|
|
207
|
+
<ULink
|
|
208
|
+
class="font-semibold text-highlighted hover:text-primary transition-colors"
|
|
209
|
+
:to="localePath(`/account/order-lists/${row.original.id}`)"
|
|
210
|
+
>
|
|
211
|
+
{{ row.original.name }}
|
|
212
|
+
</ULink>
|
|
213
|
+
</template>
|
|
214
|
+
<template #kind-cell="{ row }">
|
|
215
|
+
<UBadge
|
|
216
|
+
:color="row.original.kind === 'shopping' ? 'primary' : 'info'"
|
|
217
|
+
variant="subtle"
|
|
218
|
+
size="sm"
|
|
219
|
+
:label="t(`orderLists.kinds.${row.original.kind}`)"
|
|
220
|
+
/>
|
|
221
|
+
</template>
|
|
222
|
+
<template #positions-cell="{ row }">
|
|
223
|
+
<span class="tabular-nums">{{ row.original.positions.length }}</span>
|
|
224
|
+
</template>
|
|
225
|
+
<template #value-cell="{ row }">
|
|
226
|
+
<span class="tabular-nums text-highlighted">{{ formatCurrency(listValue(row.original)) }}</span>
|
|
227
|
+
</template>
|
|
228
|
+
<template #visibility-cell="{ row }">
|
|
229
|
+
<span class="inline-flex items-center gap-1.5 text-sm text-muted">
|
|
230
|
+
<UIcon
|
|
231
|
+
:name="icon(row.original.public ? 'users' : 'user')"
|
|
232
|
+
class="size-4"
|
|
233
|
+
/>
|
|
234
|
+
{{ row.original.public
|
|
235
|
+
? t('orderLists.public')
|
|
236
|
+
: row.original.owner.name }}
|
|
237
|
+
</span>
|
|
238
|
+
</template>
|
|
239
|
+
<template #updatedAt-cell="{ row }">
|
|
240
|
+
{{ formatDate(row.original.updatedAt) }}
|
|
241
|
+
</template>
|
|
242
|
+
<template #actions-cell="{ row }">
|
|
243
|
+
<div class="flex items-center justify-end gap-1">
|
|
244
|
+
<UTooltip :text="t('orderLists.details')">
|
|
245
|
+
<UButton
|
|
246
|
+
color="neutral"
|
|
247
|
+
variant="ghost"
|
|
248
|
+
size="sm"
|
|
249
|
+
tabindex="0"
|
|
250
|
+
:icon="icon('eye')"
|
|
251
|
+
:aria-label="t('orderLists.details')"
|
|
252
|
+
:to="localePath(`/account/order-lists/${row.original.id}`)"
|
|
253
|
+
/>
|
|
254
|
+
</UTooltip>
|
|
255
|
+
<UTooltip
|
|
256
|
+
v-if="row.original.kind === 'shopping' && row.original.positions.length"
|
|
257
|
+
:text="t('cart.requisition.load')"
|
|
258
|
+
>
|
|
259
|
+
<UButton
|
|
260
|
+
color="primary"
|
|
261
|
+
variant="soft"
|
|
262
|
+
size="sm"
|
|
263
|
+
tabindex="0"
|
|
264
|
+
:icon="icon('cart')"
|
|
265
|
+
:aria-label="t('cart.requisition.load')"
|
|
266
|
+
@click="addToCart(row.original)"
|
|
267
|
+
/>
|
|
268
|
+
</UTooltip>
|
|
269
|
+
</div>
|
|
270
|
+
</template>
|
|
271
|
+
|
|
272
|
+
<template #loading>
|
|
273
|
+
<div class="space-y-3 py-2">
|
|
274
|
+
<USkeleton
|
|
275
|
+
v-for="index in 4"
|
|
276
|
+
:key="index"
|
|
277
|
+
class="h-9 w-full"
|
|
278
|
+
/>
|
|
279
|
+
</div>
|
|
280
|
+
</template>
|
|
281
|
+
<template #empty>
|
|
282
|
+
<UiFeedbackEmptyState
|
|
283
|
+
v-if="search || kindFilter !== 'all'"
|
|
284
|
+
:icon="icon('no-results')"
|
|
285
|
+
:title="t('table.noResults.title')"
|
|
286
|
+
:description="t('table.noResults.description')"
|
|
287
|
+
/>
|
|
288
|
+
<UiFeedbackEmptyState
|
|
289
|
+
v-else
|
|
290
|
+
:icon="icon('empty')"
|
|
291
|
+
:title="t('orderLists.empty.title')"
|
|
292
|
+
:description="t('orderLists.empty.description')"
|
|
293
|
+
/>
|
|
294
|
+
</template>
|
|
295
|
+
</UTable>
|
|
296
|
+
|
|
297
|
+
<!-- Create / edit modal -->
|
|
298
|
+
<UModal
|
|
299
|
+
v-model:open="modalOpen"
|
|
300
|
+
:title="t('orderLists.addTitle')"
|
|
301
|
+
>
|
|
302
|
+
<template #body>
|
|
303
|
+
<div class="space-y-4">
|
|
304
|
+
<UFormField
|
|
305
|
+
:label="t('orderLists.columns.name')"
|
|
306
|
+
required
|
|
307
|
+
>
|
|
308
|
+
<UInput
|
|
309
|
+
v-model="formName"
|
|
310
|
+
class="w-full"
|
|
311
|
+
:placeholder="t('orderLists.namePlaceholder')"
|
|
312
|
+
/>
|
|
313
|
+
</UFormField>
|
|
314
|
+
<UFormField
|
|
315
|
+
:label="t('orderLists.columns.kind')"
|
|
316
|
+
>
|
|
317
|
+
<URadioGroup
|
|
318
|
+
v-model="formKind"
|
|
319
|
+
orientation="horizontal"
|
|
320
|
+
:items="[
|
|
321
|
+
{ value: 'shopping', label: t('orderLists.kinds.shopping') },
|
|
322
|
+
{ value: 'label', label: t('orderLists.kinds.label') },
|
|
323
|
+
]"
|
|
324
|
+
/>
|
|
325
|
+
</UFormField>
|
|
326
|
+
<UCheckbox
|
|
327
|
+
v-model="formPublic"
|
|
328
|
+
:label="t('orderLists.shareWithOrg')"
|
|
329
|
+
:description="t('orderLists.shareHint')"
|
|
330
|
+
/>
|
|
331
|
+
</div>
|
|
332
|
+
</template>
|
|
333
|
+
<template #footer>
|
|
334
|
+
<UButton
|
|
335
|
+
color="neutral"
|
|
336
|
+
variant="ghost"
|
|
337
|
+
tabindex="0"
|
|
338
|
+
:label="t('cart.item.cancel')"
|
|
339
|
+
@click="modalOpen = false"
|
|
340
|
+
/>
|
|
341
|
+
<UButton
|
|
342
|
+
color="primary"
|
|
343
|
+
tabindex="0"
|
|
344
|
+
:disabled="!formName.trim()"
|
|
345
|
+
:loading="saving"
|
|
346
|
+
:label="t('governance.save')"
|
|
347
|
+
@click="saveList"
|
|
348
|
+
/>
|
|
349
|
+
</template>
|
|
350
|
+
</UModal>
|
|
351
|
+
</div>
|
|
352
|
+
</template>
|