@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,255 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TableColumn } from "@nuxt/ui";
|
|
3
|
+
|
|
4
|
+
import type { Requisition, RequisitionStatus } from "../../../interfaces/b2b";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Requisitions overview as a data table (datatable-ux reference
|
|
8
|
+
* implementation): wide search, status filter pills with counts and
|
|
9
|
+
* sortable columns. The detail (positions + audit trail) lives on its
|
|
10
|
+
* own page; open requisitions load straight into the cart (orderers).
|
|
11
|
+
*/
|
|
12
|
+
const { icon } = useIcons();
|
|
13
|
+
const { t, d } = useI18n();
|
|
14
|
+
const localePath = useLocalePath();
|
|
15
|
+
const { to } = useAppUrl();
|
|
16
|
+
const toast = useToast();
|
|
17
|
+
const cart = useCartStore();
|
|
18
|
+
const { role } = useB2BContext();
|
|
19
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
20
|
+
const { tableUi } = useDataTable();
|
|
21
|
+
|
|
22
|
+
const { data: requisitions, status } = useFetch<Requisition[]>("/api/account/requisitions", {
|
|
23
|
+
key: "account-requisitions",
|
|
24
|
+
default: () => [],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/* ---- search + status filter ---------------------------------------- */
|
|
28
|
+
const search = ref("");
|
|
29
|
+
const statusFilter = ref<string>("all");
|
|
30
|
+
|
|
31
|
+
const searched = computed(() => {
|
|
32
|
+
const query = search.value.trim().toLowerCase();
|
|
33
|
+
if (!query) {
|
|
34
|
+
return requisitions.value;
|
|
35
|
+
}
|
|
36
|
+
return requisitions.value.filter(requisition =>
|
|
37
|
+
[requisition.id, requisition.workflowName, requisition.requestedBy.name]
|
|
38
|
+
.some(value => value.toLowerCase().includes(query)),
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const filtered = computed(() =>
|
|
43
|
+
statusFilter.value === "all"
|
|
44
|
+
? searched.value
|
|
45
|
+
: searched.value.filter(requisition => requisition.status === statusFilter.value),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const REQUISITION_STATUSES: RequisitionStatus[] = ["open", "ordered", "cancelled"];
|
|
49
|
+
|
|
50
|
+
const filterItems = computed(() => [
|
|
51
|
+
{ value: "all", label: t("table.filterAll"), count: searched.value.length },
|
|
52
|
+
...REQUISITION_STATUSES.map(value => ({
|
|
53
|
+
value,
|
|
54
|
+
label: t(`governance.requisitions.status.${value}`),
|
|
55
|
+
count: searched.value.filter(requisition => requisition.status === value).length,
|
|
56
|
+
})),
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
/* ---- columns + sorting ---------------------------------------------- */
|
|
60
|
+
const sorting = ref([{ id: "requestedAt", desc: true }]);
|
|
61
|
+
|
|
62
|
+
const columns = computed<TableColumn<Requisition>[]>(() => [
|
|
63
|
+
{ accessorKey: "id", header: t("governance.requisitions.columns.id") },
|
|
64
|
+
{ accessorKey: "workflowName", header: t("governance.requisitions.columns.workflow") },
|
|
65
|
+
{
|
|
66
|
+
id: "requestedBy",
|
|
67
|
+
accessorFn: row => row.requestedBy.name,
|
|
68
|
+
header: t("governance.requisitions.columns.requestedBy"),
|
|
69
|
+
},
|
|
70
|
+
{ accessorKey: "requestedAt", header: t("governance.requisitions.columns.requestedAt") },
|
|
71
|
+
{
|
|
72
|
+
id: "positions",
|
|
73
|
+
accessorFn: row => row.items.length,
|
|
74
|
+
header: t("governance.requisitions.columns.positions"),
|
|
75
|
+
meta: { class: { th: "text-right", td: "text-right" } },
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
accessorKey: "totalValue",
|
|
79
|
+
header: t("governance.requisitions.columns.totalValue"),
|
|
80
|
+
meta: { class: { th: "text-right", td: "text-right" } },
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
accessorKey: "status",
|
|
84
|
+
header: t("governance.requisitions.columns.status"),
|
|
85
|
+
enableSorting: false,
|
|
86
|
+
},
|
|
87
|
+
{ id: "actions", header: "", enableSorting: false },
|
|
88
|
+
]);
|
|
89
|
+
|
|
90
|
+
const statusColors: Record<RequisitionStatus, "warning" | "success" | "error"> = {
|
|
91
|
+
open: "warning",
|
|
92
|
+
ordered: "success",
|
|
93
|
+
cancelled: "error",
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/* ---- row actions ----------------------------------------------------- */
|
|
97
|
+
const canLoad = computed(() => role.value !== null && role.value !== "requester");
|
|
98
|
+
|
|
99
|
+
const isLoaded = (requisition: Requisition): boolean =>
|
|
100
|
+
cart.requisitions.some(r => r.id === requisition.id);
|
|
101
|
+
|
|
102
|
+
async function loadIntoCart(requisition: Requisition): Promise<void> {
|
|
103
|
+
const added = cart.addRequisition(requisition);
|
|
104
|
+
if (!added) {
|
|
105
|
+
toast.add({
|
|
106
|
+
title: t("cart.requisition.mergeRejected"),
|
|
107
|
+
description: t("cart.requisition.mergeRejectedDescription"),
|
|
108
|
+
color: "warning",
|
|
109
|
+
icon: icon("warning"),
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
await navigateTo(to("/cart"));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const formatDate = (value: string) => d(new Date(value), { dateStyle: "medium" });
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<template>
|
|
120
|
+
<div>
|
|
121
|
+
<UiTableToolbar
|
|
122
|
+
v-model:search="search"
|
|
123
|
+
v-model:filter="statusFilter"
|
|
124
|
+
:search-placeholder="t('governance.requisitions.searchPlaceholder')"
|
|
125
|
+
:filter-items="filterItems"
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
<UTable
|
|
129
|
+
v-model:sorting="sorting"
|
|
130
|
+
:data="filtered"
|
|
131
|
+
:columns="columns"
|
|
132
|
+
:loading="status === 'pending'"
|
|
133
|
+
:ui="tableUi"
|
|
134
|
+
>
|
|
135
|
+
<template #id-header="{ column }">
|
|
136
|
+
<UiTableSortButton
|
|
137
|
+
:column="column"
|
|
138
|
+
:label="t('governance.requisitions.columns.id')"
|
|
139
|
+
/>
|
|
140
|
+
</template>
|
|
141
|
+
<template #workflowName-header="{ column }">
|
|
142
|
+
<UiTableSortButton
|
|
143
|
+
:column="column"
|
|
144
|
+
:label="t('governance.requisitions.columns.workflow')"
|
|
145
|
+
/>
|
|
146
|
+
</template>
|
|
147
|
+
<template #requestedBy-header="{ column }">
|
|
148
|
+
<UiTableSortButton
|
|
149
|
+
:column="column"
|
|
150
|
+
:label="t('governance.requisitions.columns.requestedBy')"
|
|
151
|
+
/>
|
|
152
|
+
</template>
|
|
153
|
+
<template #requestedAt-header="{ column }">
|
|
154
|
+
<UiTableSortButton
|
|
155
|
+
:column="column"
|
|
156
|
+
:label="t('governance.requisitions.columns.requestedAt')"
|
|
157
|
+
/>
|
|
158
|
+
</template>
|
|
159
|
+
<template #positions-header="{ column }">
|
|
160
|
+
<UiTableSortButton
|
|
161
|
+
:column="column"
|
|
162
|
+
:label="t('governance.requisitions.columns.positions')"
|
|
163
|
+
/>
|
|
164
|
+
</template>
|
|
165
|
+
<template #totalValue-header="{ column }">
|
|
166
|
+
<UiTableSortButton
|
|
167
|
+
:column="column"
|
|
168
|
+
:label="t('governance.requisitions.columns.totalValue')"
|
|
169
|
+
/>
|
|
170
|
+
</template>
|
|
171
|
+
|
|
172
|
+
<template #id-cell="{ row }">
|
|
173
|
+
<ULink
|
|
174
|
+
class="font-semibold text-highlighted hover:text-primary transition-colors"
|
|
175
|
+
:to="localePath(`/account/requisitions/${row.original.id}`)"
|
|
176
|
+
>
|
|
177
|
+
{{ row.original.id }}
|
|
178
|
+
</ULink>
|
|
179
|
+
</template>
|
|
180
|
+
<template #requestedBy-cell="{ row }">
|
|
181
|
+
{{ row.original.requestedBy.name }}
|
|
182
|
+
</template>
|
|
183
|
+
<template #requestedAt-cell="{ row }">
|
|
184
|
+
{{ formatDate(row.original.requestedAt) }}
|
|
185
|
+
</template>
|
|
186
|
+
<template #positions-cell="{ row }">
|
|
187
|
+
<span class="tabular-nums">{{ row.original.items.length }}</span>
|
|
188
|
+
</template>
|
|
189
|
+
<template #totalValue-cell="{ row }">
|
|
190
|
+
<span class="tabular-nums text-highlighted">{{ formatCurrency(row.original.totalValue) }}</span>
|
|
191
|
+
</template>
|
|
192
|
+
<template #status-cell="{ row }">
|
|
193
|
+
<UBadge
|
|
194
|
+
:color="statusColors[row.original.status]"
|
|
195
|
+
variant="subtle"
|
|
196
|
+
size="sm"
|
|
197
|
+
:label="t(`governance.requisitions.status.${row.original.status}`)"
|
|
198
|
+
/>
|
|
199
|
+
</template>
|
|
200
|
+
<template #actions-cell="{ row }">
|
|
201
|
+
<div class="flex items-center justify-end gap-1">
|
|
202
|
+
<UTooltip :text="t('governance.requisitions.details')">
|
|
203
|
+
<UButton
|
|
204
|
+
color="neutral"
|
|
205
|
+
variant="ghost"
|
|
206
|
+
size="sm"
|
|
207
|
+
tabindex="0"
|
|
208
|
+
:icon="icon('eye')"
|
|
209
|
+
:aria-label="t('governance.requisitions.details')"
|
|
210
|
+
:to="localePath(`/account/requisitions/${row.original.id}`)"
|
|
211
|
+
/>
|
|
212
|
+
</UTooltip>
|
|
213
|
+
<UTooltip
|
|
214
|
+
v-if="canLoad && row.original.status === 'open' && !isLoaded(row.original)"
|
|
215
|
+
:text="t('cart.requisition.load')"
|
|
216
|
+
>
|
|
217
|
+
<UButton
|
|
218
|
+
color="primary"
|
|
219
|
+
variant="soft"
|
|
220
|
+
size="sm"
|
|
221
|
+
tabindex="0"
|
|
222
|
+
:icon="icon('cart')"
|
|
223
|
+
:aria-label="t('cart.requisition.load')"
|
|
224
|
+
@click="loadIntoCart(row.original)"
|
|
225
|
+
/>
|
|
226
|
+
</UTooltip>
|
|
227
|
+
</div>
|
|
228
|
+
</template>
|
|
229
|
+
|
|
230
|
+
<template #loading>
|
|
231
|
+
<div class="space-y-3 py-2">
|
|
232
|
+
<USkeleton
|
|
233
|
+
v-for="index in 5"
|
|
234
|
+
:key="index"
|
|
235
|
+
class="h-9 w-full"
|
|
236
|
+
/>
|
|
237
|
+
</div>
|
|
238
|
+
</template>
|
|
239
|
+
<template #empty>
|
|
240
|
+
<UiFeedbackEmptyState
|
|
241
|
+
v-if="search || statusFilter !== 'all'"
|
|
242
|
+
:icon="icon('no-results')"
|
|
243
|
+
:title="t('table.noResults.title')"
|
|
244
|
+
:description="t('table.noResults.description')"
|
|
245
|
+
/>
|
|
246
|
+
<UiFeedbackEmptyState
|
|
247
|
+
v-else
|
|
248
|
+
:icon="icon('empty')"
|
|
249
|
+
:title="t('governance.requisitions.empty.title')"
|
|
250
|
+
:description="t('governance.requisitions.empty.description')"
|
|
251
|
+
/>
|
|
252
|
+
</template>
|
|
253
|
+
</UTable>
|
|
254
|
+
</div>
|
|
255
|
+
</template>
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import GovernanceWorkflowModal from "./GovernanceWorkflowModal.vue";
|
|
3
|
+
|
|
4
|
+
import type { Requisition, RequisitionStatus } from "../../../interfaces/b2b";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Detail page content of one workflow: the connected step chain plus the
|
|
8
|
+
* requisitions currently traveling through it; editing via modal.
|
|
9
|
+
*/
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
workflowId: string;
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const { icon } = useIcons();
|
|
15
|
+
const { t, d } = useI18n();
|
|
16
|
+
const localePath = useLocalePath();
|
|
17
|
+
const { context, role, refresh, status } = useB2BContext();
|
|
18
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
19
|
+
|
|
20
|
+
const workflow = computed(() =>
|
|
21
|
+
context.value?.workflows.find(wf => wf.id === props.workflowId) ?? null,
|
|
22
|
+
);
|
|
23
|
+
const canManage = computed(() => role.value !== null && role.value !== "requester");
|
|
24
|
+
|
|
25
|
+
const participantCount = computed(() => {
|
|
26
|
+
const ids = new Set(workflow.value?.steps.flatMap(step => step.users.map(u => u.id)) ?? []);
|
|
27
|
+
return ids.size;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const stepIcon = (type: "request" | "order"): string =>
|
|
31
|
+
icon(type === "order" ? "cart" : "check");
|
|
32
|
+
|
|
33
|
+
/* ---- requisitions in this workflow ------------------------------------ */
|
|
34
|
+
const { data: requisitions } = useFetch<Requisition[]>("/api/account/requisitions", {
|
|
35
|
+
key: "account-requisitions",
|
|
36
|
+
default: () => [],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const workflowRequisitions = computed(() =>
|
|
40
|
+
requisitions.value.filter(requisition => requisition.workflowId === props.workflowId).slice(0, 6));
|
|
41
|
+
|
|
42
|
+
const statusColors: Record<RequisitionStatus, "warning" | "success" | "error"> = {
|
|
43
|
+
open: "warning",
|
|
44
|
+
ordered: "success",
|
|
45
|
+
cancelled: "error",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const formatDate = (value: string) => d(new Date(value), { dateStyle: "medium" });
|
|
49
|
+
|
|
50
|
+
const editOpen = ref(false);
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<div>
|
|
55
|
+
<USkeleton
|
|
56
|
+
v-if="status === 'pending'"
|
|
57
|
+
class="h-48 w-full rounded-xl"
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
<UiFeedbackErrorBoundary
|
|
61
|
+
v-else-if="!workflow"
|
|
62
|
+
:title="t('governance.workflows.notFound')"
|
|
63
|
+
:show-retry="false"
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<div
|
|
67
|
+
v-else
|
|
68
|
+
class="space-y-6"
|
|
69
|
+
>
|
|
70
|
+
<!-- Head -->
|
|
71
|
+
<div
|
|
72
|
+
class="border border-(--ui-border) rounded-xl p-4 sm:p-5
|
|
73
|
+
flex flex-wrap items-center gap-x-8 gap-y-3"
|
|
74
|
+
>
|
|
75
|
+
<div>
|
|
76
|
+
<p class="text-xs text-muted">
|
|
77
|
+
{{ t('governance.workflows.columns.name') }}
|
|
78
|
+
</p>
|
|
79
|
+
<p class="text-sm font-semibold text-highlighted">
|
|
80
|
+
{{ workflow.name }}
|
|
81
|
+
</p>
|
|
82
|
+
</div>
|
|
83
|
+
<div>
|
|
84
|
+
<p class="text-xs text-muted">
|
|
85
|
+
{{ t('governance.workflows.columns.steps') }}
|
|
86
|
+
</p>
|
|
87
|
+
<p class="text-sm font-medium text-highlighted tabular-nums">
|
|
88
|
+
{{ workflow.steps.length }}
|
|
89
|
+
</p>
|
|
90
|
+
</div>
|
|
91
|
+
<div>
|
|
92
|
+
<p class="text-xs text-muted">
|
|
93
|
+
{{ t('governance.workflows.participants') }}
|
|
94
|
+
</p>
|
|
95
|
+
<p class="text-sm font-medium text-highlighted tabular-nums">
|
|
96
|
+
{{ participantCount }}
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
<UButton
|
|
100
|
+
v-if="canManage"
|
|
101
|
+
class="ms-auto"
|
|
102
|
+
color="neutral"
|
|
103
|
+
variant="outline"
|
|
104
|
+
size="sm"
|
|
105
|
+
tabindex="0"
|
|
106
|
+
:icon="icon('edit')"
|
|
107
|
+
:label="t('governance.edit')"
|
|
108
|
+
@click="editOpen = true"
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<!-- Step chain -->
|
|
113
|
+
<section class="border border-(--ui-border) rounded-xl overflow-hidden">
|
|
114
|
+
<h2 class="px-4 sm:px-5 py-3 text-sm font-semibold text-highlighted bg-elevated/60 border-b border-(--ui-border)">
|
|
115
|
+
{{ t('governance.workflows.columns.steps') }}
|
|
116
|
+
</h2>
|
|
117
|
+
<ol class="p-4 sm:p-5">
|
|
118
|
+
<li
|
|
119
|
+
v-for="(step, index) in workflow.steps"
|
|
120
|
+
:key="index"
|
|
121
|
+
class="relative flex items-start gap-4 pb-6 last:pb-0"
|
|
122
|
+
>
|
|
123
|
+
<span
|
|
124
|
+
v-if="index < workflow.steps.length - 1"
|
|
125
|
+
aria-hidden="true"
|
|
126
|
+
class="absolute left-4 top-9 -bottom-1 w-px bg-(--ui-border)"
|
|
127
|
+
/>
|
|
128
|
+
<span
|
|
129
|
+
class="relative flex size-8 shrink-0 items-center justify-center rounded-full
|
|
130
|
+
bg-primary/10 text-(--ui-primary) text-sm font-semibold tabular-nums ring-4 ring-default"
|
|
131
|
+
>{{ index + 1 }}</span>
|
|
132
|
+
<div class="min-w-0 pt-1">
|
|
133
|
+
<p class="flex items-center gap-1.5 text-sm font-medium text-highlighted">
|
|
134
|
+
<UIcon
|
|
135
|
+
:name="stepIcon(step.type)"
|
|
136
|
+
class="size-4 text-primary"
|
|
137
|
+
/>
|
|
138
|
+
{{ t(`governance.workflows.stepTypes.${step.type}`) }}
|
|
139
|
+
</p>
|
|
140
|
+
<div class="mt-1.5 flex flex-wrap gap-1.5">
|
|
141
|
+
<UBadge
|
|
142
|
+
v-for="user in step.users"
|
|
143
|
+
:key="user.id"
|
|
144
|
+
color="neutral"
|
|
145
|
+
variant="subtle"
|
|
146
|
+
size="sm"
|
|
147
|
+
:icon="icon('user')"
|
|
148
|
+
:label="user.name"
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</li>
|
|
153
|
+
</ol>
|
|
154
|
+
</section>
|
|
155
|
+
|
|
156
|
+
<!-- Requisitions in this workflow -->
|
|
157
|
+
<section class="border border-(--ui-border) rounded-xl overflow-hidden">
|
|
158
|
+
<header class="flex items-center justify-between px-4 sm:px-5 py-3 bg-elevated/60 border-b border-(--ui-border)">
|
|
159
|
+
<h2 class="text-sm font-semibold text-highlighted">
|
|
160
|
+
{{ t('governance.workflows.requisitionsTitle') }}
|
|
161
|
+
</h2>
|
|
162
|
+
<ULink
|
|
163
|
+
class="text-xs font-medium text-primary hover:underline"
|
|
164
|
+
:to="localePath('/account/requisitions')"
|
|
165
|
+
>
|
|
166
|
+
{{ t('account.dashboard.viewAll') }} →
|
|
167
|
+
</ULink>
|
|
168
|
+
</header>
|
|
169
|
+
<ul
|
|
170
|
+
v-if="workflowRequisitions.length"
|
|
171
|
+
class="divide-y divide-(--ui-border)"
|
|
172
|
+
>
|
|
173
|
+
<li
|
|
174
|
+
v-for="requisition in workflowRequisitions"
|
|
175
|
+
:key="requisition.id"
|
|
176
|
+
>
|
|
177
|
+
<NuxtLink
|
|
178
|
+
:to="localePath(`/account/requisitions/${requisition.id}`)"
|
|
179
|
+
class="flex flex-wrap items-center gap-x-4 gap-y-1 px-4 sm:px-5 py-3
|
|
180
|
+
hover:bg-elevated/40 transition-colors"
|
|
181
|
+
>
|
|
182
|
+
<span class="text-sm font-semibold text-highlighted">{{ requisition.id }}</span>
|
|
183
|
+
<span class="text-xs text-muted">
|
|
184
|
+
{{ requisition.requestedBy.name }} · {{ formatDate(requisition.requestedAt) }}
|
|
185
|
+
</span>
|
|
186
|
+
<span class="flex items-center gap-3 ms-auto">
|
|
187
|
+
<UBadge
|
|
188
|
+
:color="statusColors[requisition.status]"
|
|
189
|
+
variant="subtle"
|
|
190
|
+
size="sm"
|
|
191
|
+
:label="t(`governance.requisitions.status.${requisition.status}`)"
|
|
192
|
+
/>
|
|
193
|
+
<span class="text-sm tabular-nums text-highlighted min-w-20 text-right">
|
|
194
|
+
{{ formatCurrency(requisition.totalValue) }}
|
|
195
|
+
</span>
|
|
196
|
+
</span>
|
|
197
|
+
</NuxtLink>
|
|
198
|
+
</li>
|
|
199
|
+
</ul>
|
|
200
|
+
<p
|
|
201
|
+
v-else
|
|
202
|
+
class="px-4 sm:px-5 py-6 text-sm text-muted"
|
|
203
|
+
>
|
|
204
|
+
{{ t('governance.workflows.noRequisitions') }}
|
|
205
|
+
</p>
|
|
206
|
+
</section>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<GovernanceWorkflowModal
|
|
210
|
+
v-model:open="editOpen"
|
|
211
|
+
:workflow="workflow"
|
|
212
|
+
@saved="refresh"
|
|
213
|
+
/>
|
|
214
|
+
</div>
|
|
215
|
+
</template>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import GovernanceWorkflowModal from "./GovernanceWorkflowModal.vue";
|
|
3
|
+
import type { TableColumn } from "@nuxt/ui";
|
|
4
|
+
|
|
5
|
+
import type { ApprovalWorkflow } from "../../../interfaces/b2b";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Approval workflows overview (account pattern): data table with the Add
|
|
9
|
+
* modal; the step-chain detail and editing live on the detail page.
|
|
10
|
+
* Search and sortable columns per the datatable-ux baseline.
|
|
11
|
+
*/
|
|
12
|
+
const { icon } = useIcons();
|
|
13
|
+
const { t } = useI18n();
|
|
14
|
+
const localePath = useLocalePath();
|
|
15
|
+
const { context, role, refresh, status } = useB2BContext();
|
|
16
|
+
const { tableUi } = useDataTable();
|
|
17
|
+
|
|
18
|
+
const workflows = computed(() => context.value?.workflows ?? []);
|
|
19
|
+
const canManage = computed(() => role.value !== null && role.value !== "requester");
|
|
20
|
+
|
|
21
|
+
const names = (workflow: ApprovalWorkflow, type: "request" | "order") =>
|
|
22
|
+
workflow.steps
|
|
23
|
+
.filter(step => step.type === type)
|
|
24
|
+
.flatMap(step => step.users.map(u => u.name))
|
|
25
|
+
.join(", ");
|
|
26
|
+
|
|
27
|
+
/* ---- search ---------------------------------------------------------- */
|
|
28
|
+
const search = ref("");
|
|
29
|
+
|
|
30
|
+
const filtered = computed(() => {
|
|
31
|
+
const query = search.value.trim().toLowerCase();
|
|
32
|
+
if (!query) {
|
|
33
|
+
return workflows.value;
|
|
34
|
+
}
|
|
35
|
+
return workflows.value.filter(workflow =>
|
|
36
|
+
[workflow.name, ...workflow.steps.flatMap(step => step.users.map(u => u.name))]
|
|
37
|
+
.some(value => value.toLowerCase().includes(query)),
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/* ---- columns + sorting ------------------------------------------------ */
|
|
42
|
+
const sorting = ref([{ id: "name", desc: false }]);
|
|
43
|
+
|
|
44
|
+
const columns = computed<TableColumn<ApprovalWorkflow>[]>(() => [
|
|
45
|
+
{ accessorKey: "name", header: t("governance.workflows.columns.name") },
|
|
46
|
+
{
|
|
47
|
+
id: "steps",
|
|
48
|
+
accessorFn: row => row.steps.length,
|
|
49
|
+
header: t("governance.workflows.columns.steps"),
|
|
50
|
+
meta: { class: { th: "text-right", td: "text-right" } },
|
|
51
|
+
},
|
|
52
|
+
{ id: "requesters", header: t("governance.workflows.columns.requesters"), enableSorting: false },
|
|
53
|
+
{ id: "orderers", header: t("governance.workflows.columns.orderers"), enableSorting: false },
|
|
54
|
+
{ id: "actions", header: "", enableSorting: false },
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
const modalOpen = ref(false);
|
|
58
|
+
|
|
59
|
+
async function onSaved(): Promise<void> {
|
|
60
|
+
await refresh();
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<div>
|
|
66
|
+
<UiTableToolbar
|
|
67
|
+
v-model:search="search"
|
|
68
|
+
:search-placeholder="t('governance.workflows.searchPlaceholder')"
|
|
69
|
+
>
|
|
70
|
+
<template
|
|
71
|
+
v-if="canManage"
|
|
72
|
+
#actions
|
|
73
|
+
>
|
|
74
|
+
<UButton
|
|
75
|
+
color="primary"
|
|
76
|
+
tabindex="0"
|
|
77
|
+
:icon="icon('plus')"
|
|
78
|
+
:label="t('governance.workflows.add')"
|
|
79
|
+
@click="modalOpen = true"
|
|
80
|
+
/>
|
|
81
|
+
</template>
|
|
82
|
+
</UiTableToolbar>
|
|
83
|
+
|
|
84
|
+
<UTable
|
|
85
|
+
v-model:sorting="sorting"
|
|
86
|
+
:data="filtered"
|
|
87
|
+
:columns="columns"
|
|
88
|
+
:loading="status === 'pending'"
|
|
89
|
+
:ui="tableUi"
|
|
90
|
+
>
|
|
91
|
+
<template #name-header="{ column }">
|
|
92
|
+
<UiTableSortButton
|
|
93
|
+
:column="column"
|
|
94
|
+
:label="t('governance.workflows.columns.name')"
|
|
95
|
+
/>
|
|
96
|
+
</template>
|
|
97
|
+
<template #steps-header="{ column }">
|
|
98
|
+
<UiTableSortButton
|
|
99
|
+
:column="column"
|
|
100
|
+
:label="t('governance.workflows.columns.steps')"
|
|
101
|
+
/>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<template #name-cell="{ row }">
|
|
105
|
+
<ULink
|
|
106
|
+
class="font-semibold text-highlighted hover:text-primary transition-colors"
|
|
107
|
+
:to="localePath(`/account/workflows/${row.original.id}`)"
|
|
108
|
+
>
|
|
109
|
+
{{ row.original.name }}
|
|
110
|
+
</ULink>
|
|
111
|
+
</template>
|
|
112
|
+
<template #steps-cell="{ row }">
|
|
113
|
+
<span class="tabular-nums">{{ row.original.steps.length }}</span>
|
|
114
|
+
</template>
|
|
115
|
+
<template #requesters-cell="{ row }">
|
|
116
|
+
{{ names(row.original, 'request') || '—' }}
|
|
117
|
+
</template>
|
|
118
|
+
<template #orderers-cell="{ row }">
|
|
119
|
+
{{ names(row.original, 'order') || '—' }}
|
|
120
|
+
</template>
|
|
121
|
+
<template #actions-cell="{ row }">
|
|
122
|
+
<div class="flex justify-end">
|
|
123
|
+
<UTooltip :text="t('governance.requisitions.details')">
|
|
124
|
+
<UButton
|
|
125
|
+
color="neutral"
|
|
126
|
+
variant="ghost"
|
|
127
|
+
size="sm"
|
|
128
|
+
tabindex="0"
|
|
129
|
+
:icon="icon('eye')"
|
|
130
|
+
:aria-label="t('governance.requisitions.details')"
|
|
131
|
+
:to="localePath(`/account/workflows/${row.original.id}`)"
|
|
132
|
+
/>
|
|
133
|
+
</UTooltip>
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|
|
136
|
+
|
|
137
|
+
<template #loading>
|
|
138
|
+
<div class="space-y-3 py-2">
|
|
139
|
+
<USkeleton
|
|
140
|
+
v-for="index in 3"
|
|
141
|
+
:key="index"
|
|
142
|
+
class="h-9 w-full"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
<template #empty>
|
|
147
|
+
<UiFeedbackEmptyState
|
|
148
|
+
v-if="search"
|
|
149
|
+
:icon="icon('no-results')"
|
|
150
|
+
:title="t('table.noResults.title')"
|
|
151
|
+
:description="t('table.noResults.description')"
|
|
152
|
+
/>
|
|
153
|
+
<UiFeedbackEmptyState
|
|
154
|
+
v-else
|
|
155
|
+
:icon="icon('empty')"
|
|
156
|
+
:title="t('governance.workflows.empty.title')"
|
|
157
|
+
:description="t('governance.workflows.empty.description')"
|
|
158
|
+
/>
|
|
159
|
+
</template>
|
|
160
|
+
</UTable>
|
|
161
|
+
|
|
162
|
+
<GovernanceWorkflowModal
|
|
163
|
+
v-model:open="modalOpen"
|
|
164
|
+
:workflow="null"
|
|
165
|
+
@saved="onSaved"
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
</template>
|