@vendure/dashboard 3.4.3-master-202509260228 → 3.5.0-minor-202510012036
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/README.md +4 -0
- package/dist/plugin/api/api-extensions.js +11 -14
- package/dist/plugin/api/metrics.resolver.d.ts +2 -2
- package/dist/plugin/api/metrics.resolver.js +2 -2
- package/dist/plugin/config/metrics-strategies.d.ts +9 -9
- package/dist/plugin/config/metrics-strategies.js +6 -6
- package/dist/plugin/constants.d.ts +2 -0
- package/dist/plugin/constants.js +3 -1
- package/dist/plugin/dashboard.plugin.js +13 -0
- package/dist/plugin/service/metrics.service.d.ts +3 -3
- package/dist/plugin/service/metrics.service.js +37 -53
- package/dist/plugin/types.d.ts +9 -12
- package/dist/plugin/types.js +7 -11
- package/dist/vite/vite-plugin-config.js +13 -9
- package/dist/vite/vite-plugin-translations.d.ts +22 -0
- package/dist/vite/vite-plugin-translations.js +66 -0
- package/dist/vite/vite-plugin-vendure-dashboard.js +10 -8
- package/lingui.config.js +25 -2
- package/package.json +159 -156
- package/src/app/app-providers.tsx +0 -4
- package/src/app/common/delete-bulk-action.tsx +6 -5
- package/src/app/common/duplicate-bulk-action.tsx +4 -5
- package/src/app/common/duplicate-entity-dialog.tsx +1 -1
- package/src/app/common/set-document-direction.ts +7 -0
- package/src/app/main.tsx +50 -17
- package/src/app/routes/_authenticated/_administrators/administrators.tsx +8 -6
- package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +17 -6
- package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +2 -2
- package/src/app/routes/_authenticated/_assets/assets.tsx +1 -1
- package/src/app/routes/_authenticated/_assets/assets_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_assets/components/asset-bulk-actions.tsx +8 -6
- package/src/app/routes/_authenticated/_assets/components/asset-tag-filter.tsx +1 -1
- package/src/app/routes/_authenticated/_assets/components/asset-tags-editor.tsx +1 -1
- package/src/app/routes/_authenticated/_assets/components/manage-tags-dialog.tsx +3 -8
- package/src/app/routes/_authenticated/_channels/channels.tsx +3 -6
- package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +5 -5
- package/src/app/routes/_authenticated/_collections/collections.tsx +10 -6
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +16 -5
- package/src/app/routes/_authenticated/_collections/components/collection-bulk-actions.tsx +1 -1
- package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx +6 -6
- package/src/app/routes/_authenticated/_countries/countries.graphql.ts +2 -0
- package/src/app/routes/_authenticated/_countries/countries.tsx +2 -3
- package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +4 -4
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +2 -4
- package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +8 -8
- package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +3 -3
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-utils.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-history/default-customer-history-components.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/customers.graphql.ts +4 -0
- package/src/app/routes/_authenticated/_customers/customers.tsx +23 -11
- package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +10 -8
- package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +1 -1
- package/src/app/routes/_authenticated/_facets/components/facet-bulk-actions.tsx +6 -5
- package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +1 -1
- package/src/app/routes/_authenticated/_facets/facets.tsx +5 -5
- package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +7 -5
- package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +18 -6
- package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +5 -5
- package/src/app/routes/_authenticated/_orders/components/add-manual-payment-dialog.tsx +19 -21
- package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +22 -22
- package/src/app/routes/_authenticated/_orders/components/fulfill-order-dialog.tsx +6 -6
- package/src/app/routes/_authenticated/_orders/components/fulfillment-details.tsx +15 -9
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx +11 -9
- package/src/app/routes/_authenticated/_orders/components/order-history/default-order-history-components.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history-utils.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-line-custom-fields-form.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-modification-preview-dialog.tsx +4 -4
- package/src/app/routes/_authenticated/_orders/components/order-modification-summary.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-table-totals.tsx +27 -27
- package/src/app/routes/_authenticated/_orders/components/order-table.tsx +2 -2
- package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +26 -20
- package/src/app/routes/_authenticated/_orders/components/seller-orders-card.tsx +3 -1
- package/src/app/routes/_authenticated/_orders/components/settle-refund-dialog.tsx +6 -6
- package/src/app/routes/_authenticated/_orders/components/shipping-method-selector.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/use-transition-order-to-state.tsx +3 -2
- package/src/app/routes/_authenticated/_orders/orders.tsx +5 -9
- package/src/app/routes/_authenticated/_orders/orders_.$aggregateOrderId_.seller-orders.$sellerOrderId.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx +4 -4
- package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +17 -17
- package/src/app/routes/_authenticated/_orders/utils/order-detail-loaders.tsx +1 -1
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +5 -6
- package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_product-variants/components/product-variant-bulk-actions.tsx +1 -1
- package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +1 -1
- package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +10 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +9 -2
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_products/components/add-option-group-dialog.tsx +5 -5
- package/src/app/routes/_authenticated/_products/components/add-product-variant-dialog.tsx +5 -5
- package/src/app/routes/_authenticated/_products/components/assign-facet-values-dialog.tsx +5 -4
- package/src/app/routes/_authenticated/_products/components/create-product-options-dialog.tsx +9 -12
- package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +1 -1
- package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +4 -4
- package/src/app/routes/_authenticated/_products/components/option-groups-editor.tsx +1 -1
- package/src/app/routes/_authenticated/_products/components/product-bulk-actions.tsx +1 -1
- package/src/app/routes/_authenticated/_products/components/product-option-group-badge.tsx +19 -0
- package/src/app/routes/_authenticated/_products/components/product-option-select.tsx +3 -3
- package/src/app/routes/_authenticated/_products/components/product-options-table.tsx +114 -0
- package/src/app/routes/_authenticated/_products/product-option-groups.graphql.ts +103 -0
- package/src/app/routes/_authenticated/_products/products.graphql.ts +44 -32
- package/src/app/routes/_authenticated/_products/products.tsx +34 -5
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +29 -12
- package/src/app/routes/_authenticated/_products/products_.$id_.variants.tsx +11 -11
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$id.tsx +177 -0
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +208 -0
- package/src/app/routes/_authenticated/_profile/profile.tsx +4 -4
- package/src/app/routes/_authenticated/_promotions/promotions.tsx +2 -4
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +16 -9
- package/src/app/routes/_authenticated/_roles/components/permissions-table-grid.tsx +1 -1
- package/src/app/routes/_authenticated/_roles/roles.tsx +3 -6
- package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +4 -6
- package/src/app/routes/_authenticated/_sellers/sellers.tsx +3 -4
- package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_shipping-methods/components/price-display.tsx +5 -5
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-method-test-result-wrapper.tsx +1 -1
- package/src/app/routes/_authenticated/_shipping-methods/components/test-address-form.tsx +11 -11
- package/src/app/routes/_authenticated/_shipping-methods/components/test-order-builder.tsx +1 -1
- package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-result.tsx +8 -8
- package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_shipping-methods/components/test-single-method-result.tsx +8 -8
- package/src/app/routes/_authenticated/_shipping-methods/components/test-single-shipping-method-sheet.tsx +4 -4
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +2 -3
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +2 -2
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +3 -4
- package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_system/healthchecks.tsx +10 -4
- package/src/app/routes/_authenticated/_system/job-queue.tsx +10 -13
- package/src/app/routes/_authenticated/_system/scheduled-tasks.tsx +18 -16
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +2 -4
- package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +8 -12
- package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +6 -4
- package/src/app/routes/_authenticated/_zones/components/zone-countries-sheet.tsx +4 -1
- package/src/app/routes/_authenticated/_zones/zones.tsx +4 -4
- package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +8 -5
- package/src/app/routes/_authenticated/index.tsx +46 -25
- package/src/app/styles.css +4 -0
- package/src/i18n/common-strings.ts +111 -0
- package/src/i18n/locales/ar.po +4777 -0
- package/src/i18n/locales/cs.po +4777 -0
- package/src/i18n/locales/de.po +4299 -1101
- package/src/i18n/locales/en.po +3857 -659
- package/src/i18n/locales/es.po +4777 -0
- package/src/i18n/locales/fa.po +4777 -0
- package/src/i18n/locales/fr.po +4777 -0
- package/src/i18n/locales/he.po +4777 -0
- package/src/i18n/locales/hr.po +4777 -0
- package/src/i18n/locales/it.po +4777 -0
- package/src/i18n/locales/ja.po +4777 -0
- package/src/i18n/locales/ko.po +4628 -0
- package/src/i18n/locales/nb.po +4777 -0
- package/src/i18n/locales/ne.po +4777 -0
- package/src/i18n/locales/nl.po +4628 -0
- package/src/i18n/locales/pl.po +4777 -0
- package/src/i18n/locales/pt_BR.po +4777 -0
- package/src/i18n/locales/pt_PT.po +4777 -0
- package/src/i18n/locales/ru.po +4777 -0
- package/src/i18n/locales/sv.po +4777 -0
- package/src/i18n/locales/tr.po +4777 -0
- package/src/i18n/locales/uk.po +4777 -0
- package/src/i18n/locales/zh_Hans.po +4777 -0
- package/src/i18n/locales/zh_Hant.po +4777 -0
- package/src/lib/components/data-display/json.tsx +16 -1
- package/src/lib/components/data-input/combination-mode-input.tsx +1 -1
- package/src/lib/components/data-input/custom-field-list-input.tsx +11 -7
- package/src/lib/components/data-input/customer-group-input.tsx +27 -33
- package/src/lib/components/data-input/datetime-input.tsx +40 -1
- package/src/lib/components/data-input/default-relation-input.tsx +5 -4
- package/src/lib/components/data-input/index.ts +3 -0
- package/src/lib/components/data-input/product-multi-selector-input.tsx +14 -14
- package/src/lib/components/data-input/relation-selector.tsx +1 -1
- package/src/lib/components/data-input/select-with-options.tsx +1 -1
- package/src/lib/components/data-input/slug-input.tsx +290 -0
- package/src/lib/components/data-table/add-filter-menu.tsx +17 -10
- package/src/lib/components/data-table/data-table-bulk-action-item.tsx +45 -8
- package/src/lib/components/data-table/data-table-bulk-actions.tsx +4 -4
- package/src/lib/components/data-table/data-table-column-header.tsx +13 -8
- package/src/lib/components/data-table/data-table-context.tsx +91 -0
- package/src/lib/components/data-table/data-table-faceted-filter.tsx +2 -1
- package/src/lib/components/data-table/data-table-filter-badge.tsx +9 -5
- package/src/lib/components/data-table/data-table-filter-dialog.tsx +1 -1
- package/src/lib/components/data-table/data-table-utils.ts +21 -4
- package/src/lib/components/data-table/data-table-view-options.tsx +21 -10
- package/src/lib/components/data-table/data-table.tsx +146 -94
- package/src/lib/components/data-table/filters/data-table-boolean-filter.tsx +4 -4
- package/src/lib/components/data-table/global-views-bar.tsx +97 -0
- package/src/lib/components/data-table/global-views-sheet.tsx +11 -0
- package/src/lib/components/data-table/human-readable-operator.tsx +1 -1
- package/src/lib/components/data-table/manage-global-views-button.tsx +26 -0
- package/src/lib/components/data-table/my-views-button.tsx +47 -0
- package/src/lib/components/data-table/refresh-button.tsx +12 -3
- package/src/lib/components/data-table/save-view-button.tsx +41 -0
- package/src/lib/components/data-table/save-view-dialog.tsx +113 -0
- package/src/lib/components/data-table/use-generated-columns.tsx +13 -8
- package/src/lib/components/data-table/user-views-sheet.tsx +11 -0
- package/src/lib/components/data-table/views-sheet.tsx +305 -0
- package/src/lib/components/date-range-picker.tsx +186 -0
- package/src/lib/components/layout/app-sidebar.tsx +3 -1
- package/src/lib/components/layout/channel-switcher.tsx +8 -10
- package/src/lib/components/layout/dev-mode-indicator.tsx +1 -1
- package/src/lib/components/layout/generated-breadcrumbs.tsx +10 -8
- package/src/lib/components/layout/language-dialog.tsx +34 -13
- package/src/lib/components/layout/manage-languages-dialog.tsx +1 -1
- package/src/lib/components/layout/nav-main.tsx +23 -13
- package/src/lib/components/layout/nav-user.tsx +19 -23
- package/src/lib/components/login/login-form.tsx +1 -1
- package/src/lib/components/shared/asset/asset-bulk-actions.tsx +4 -4
- package/src/lib/components/shared/asset/asset-focal-point-editor.tsx +1 -1
- package/src/lib/components/shared/asset/asset-gallery.tsx +15 -14
- package/src/lib/components/shared/assign-to-channel-bulk-action.tsx +11 -11
- package/src/lib/components/shared/assign-to-channel-dialog.tsx +6 -5
- package/src/lib/components/shared/channel-code-label.tsx +1 -1
- package/src/lib/components/shared/channel-selector.tsx +4 -4
- package/src/lib/components/shared/configurable-operation-multi-selector.tsx +16 -14
- package/src/lib/components/shared/configurable-operation-selector.tsx +1 -1
- package/src/lib/components/shared/confirmation-dialog.tsx +8 -8
- package/src/lib/components/shared/country-selector.tsx +1 -1
- package/src/lib/components/shared/currency-selector.tsx +4 -4
- package/src/lib/components/shared/custom-fields-form.tsx +8 -24
- package/src/lib/components/shared/customer-address-form.tsx +3 -3
- package/src/lib/components/shared/customer-group-selector.tsx +1 -1
- package/src/lib/components/shared/customer-selector.tsx +1 -1
- package/src/lib/components/shared/error-page.tsx +1 -1
- package/src/lib/components/shared/facet-value-selector.tsx +10 -10
- package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +1 -1
- package/src/lib/components/shared/history-timeline/history-note-editor.tsx +1 -1
- package/src/lib/components/shared/history-timeline/history-note-entry.tsx +1 -1
- package/src/lib/components/shared/language-selector.tsx +4 -4
- package/src/lib/components/shared/navigation-confirmation.tsx +1 -1
- package/src/lib/components/shared/paginated-list-data-table.tsx +64 -34
- package/src/lib/components/shared/remove-from-channel-bulk-action.tsx +6 -5
- package/src/lib/components/shared/rich-text-editor/image-dialog.tsx +1 -1
- package/src/lib/components/shared/rich-text-editor/link-dialog.tsx +1 -1
- package/src/lib/components/shared/rich-text-editor/responsive-toolbar.tsx +1 -1
- package/src/lib/components/shared/rich-text-editor/table-edit-icons.tsx +1 -1
- package/src/lib/components/shared/role-code-label.tsx +1 -1
- package/src/lib/components/shared/role-selector.tsx +4 -4
- package/src/lib/components/shared/seller-selector.tsx +1 -1
- package/src/lib/components/shared/stock-level-label.tsx +3 -5
- package/src/lib/components/shared/table-cell/order-table-cell-components.tsx +3 -1
- package/src/lib/components/shared/tax-category-selector.tsx +1 -1
- package/src/lib/components/shared/translatable-form-field.tsx +15 -15
- package/src/lib/components/shared/zone-selector.tsx +1 -1
- package/src/lib/components/ui/button.tsx +1 -1
- package/src/lib/framework/dashboard-widget/base-widget.tsx +11 -9
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +35 -6
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +18 -12
- package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +9 -3
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +26 -79
- package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +35 -0
- package/src/lib/framework/defaults.ts +34 -63
- package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +319 -9
- package/src/lib/framework/document-introspection/add-custom-fields.ts +60 -31
- package/src/lib/framework/document-introspection/get-document-structure.spec.ts +1 -159
- package/src/lib/framework/document-introspection/include-only-selected-list-fields.spec.ts +1840 -0
- package/src/lib/framework/document-introspection/include-only-selected-list-fields.ts +940 -0
- package/src/lib/framework/document-introspection/testing-utils.ts +161 -0
- package/src/lib/framework/extension-api/display-component-extensions.tsx +2 -0
- package/src/lib/framework/extension-api/types/data-table.ts +62 -4
- package/src/lib/framework/extension-api/types/navigation.ts +16 -0
- package/src/lib/framework/form-engine/utils.ts +34 -0
- package/src/lib/framework/layout-engine/page-layout.tsx +36 -36
- package/src/lib/framework/page/detail-page.tsx +10 -10
- package/src/lib/framework/page/list-page.tsx +289 -4
- package/src/lib/framework/page/use-extended-router.tsx +101 -34
- package/src/lib/graphql/api.ts +6 -2
- package/src/lib/graphql/graphql-env.d.ts +38 -26
- package/src/lib/hooks/use-display-locale.ts +40 -0
- package/src/lib/hooks/use-dynamic-translations.ts +46 -0
- package/src/lib/hooks/use-extended-detail-query.ts +1 -1
- package/src/lib/hooks/use-extended-list-query.ts +6 -1
- package/src/lib/hooks/use-local-format.ts +15 -1
- package/src/lib/hooks/use-saved-views.ts +230 -0
- package/src/lib/hooks/use-ui-language-loader.ts +30 -0
- package/src/lib/index.ts +15 -0
- package/src/lib/lib/load-i18n-messages.ts +17 -0
- package/src/lib/lib/trans.tsx +15 -11
- package/src/lib/providers/i18n-provider.tsx +7 -14
- package/src/lib/types/saved-views.ts +39 -0
- package/src/lib/utils/saved-views-utils.ts +40 -0
package/src/app/routes/_authenticated/_orders/components/order-modification-preview-dialog.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import { Textarea } from '@/vdb/components/ui/textarea.js';
|
|
|
17
17
|
import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
|
|
18
18
|
import { api } from '@/vdb/graphql/api.js';
|
|
19
19
|
import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
|
|
20
|
-
import { Trans, useLingui } from '
|
|
20
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
21
21
|
import { useMutation } from '@tanstack/react-query';
|
|
22
22
|
import { ResultOf, VariablesOf } from 'gql.tada';
|
|
23
23
|
import { CheckIcon } from 'lucide-react';
|
|
@@ -53,7 +53,7 @@ export function OrderModificationPreviewDialog({
|
|
|
53
53
|
modifyOrderInput,
|
|
54
54
|
onResolve,
|
|
55
55
|
}: Readonly<OrderModificationPreviewDialogProps>) {
|
|
56
|
-
const {
|
|
56
|
+
const { t } = useLingui();
|
|
57
57
|
const { formatCurrency } = useLocalFormat();
|
|
58
58
|
// Use a ref to track the last input sent to avoid duplicate calls
|
|
59
59
|
const lastInputRef = useRef<ModifyOrderInput | null>(null);
|
|
@@ -99,7 +99,7 @@ export function OrderModificationPreviewDialog({
|
|
|
99
99
|
previewMutation.data?.modifyOrder?.__typename === 'Order' ? previewMutation.data.modifyOrder : null;
|
|
100
100
|
const error =
|
|
101
101
|
previewMutation.data && previewMutation.data.modifyOrder?.__typename !== 'Order'
|
|
102
|
-
? previewMutation.data.modifyOrder?.message ||
|
|
102
|
+
? previewMutation.data.modifyOrder?.message || t`Unknown error`
|
|
103
103
|
: previewMutation.error?.message || null;
|
|
104
104
|
const loading = previewMutation.isPending;
|
|
105
105
|
|
|
@@ -303,7 +303,7 @@ export function OrderModificationPreviewDialog({
|
|
|
303
303
|
<Textarea
|
|
304
304
|
{...field}
|
|
305
305
|
className="bg-background"
|
|
306
|
-
placeholder={
|
|
306
|
+
placeholder={t`Enter refund note`}
|
|
307
307
|
/>
|
|
308
308
|
)}
|
|
309
309
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableCell, TableRow } from '@/vdb/components/ui/table.js';
|
|
2
|
-
import { Trans } from '
|
|
2
|
+
import { Trans } from '@lingui/react/macro';
|
|
3
3
|
import { Order } from '../utils/order-types.js';
|
|
4
4
|
import { MoneyGrossNet } from './money-gross-net.js';
|
|
5
5
|
|
|
@@ -15,35 +15,35 @@ export function OrderTableTotals({ order, columnCount }: Readonly<OrderTableTota
|
|
|
15
15
|
<>
|
|
16
16
|
{order.surcharges?.length > 0
|
|
17
17
|
? order.surcharges.map((surcharge, index) => (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
<TableRow key={`${surcharge.description}-${index}`}>
|
|
19
|
+
<TableCell colSpan={columnCount - 1} className="h-12">
|
|
20
|
+
<Trans>Surcharge</Trans>: {surcharge.description}
|
|
21
|
+
</TableCell>
|
|
22
|
+
<TableCell colSpan={1} className="h-12">
|
|
23
|
+
<MoneyGrossNet
|
|
24
|
+
priceWithTax={surcharge.priceWithTax}
|
|
25
|
+
price={surcharge.price}
|
|
26
|
+
currencyCode={currencyCode}
|
|
27
|
+
/>
|
|
28
|
+
</TableCell>
|
|
29
|
+
</TableRow>
|
|
30
|
+
))
|
|
31
31
|
: null}
|
|
32
32
|
{order.discounts?.length > 0
|
|
33
33
|
? order.discounts.map((discount, index) => (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
<TableRow key={`${discount.description}-${index}`}>
|
|
35
|
+
<TableCell colSpan={columnCount - 1} className="h-12">
|
|
36
|
+
<Trans>Discount</Trans>: {discount.description}
|
|
37
|
+
</TableCell>
|
|
38
|
+
<TableCell colSpan={1} className="h-12">
|
|
39
|
+
<MoneyGrossNet
|
|
40
|
+
priceWithTax={discount.amountWithTax}
|
|
41
|
+
price={discount.amount}
|
|
42
|
+
currencyCode={currencyCode}
|
|
43
|
+
/>
|
|
44
|
+
</TableCell>
|
|
45
|
+
</TableRow>
|
|
46
|
+
))
|
|
47
47
|
: null}
|
|
48
48
|
<TableRow>
|
|
49
49
|
<TableCell colSpan={columnCount - 1} className="h-12">
|
|
@@ -10,7 +10,7 @@ import { addCustomFields } from '@/vdb/framework/document-introspection/add-cust
|
|
|
10
10
|
import { getFieldsFromDocumentNode } from '@/vdb/framework/document-introspection/get-document-structure.js';
|
|
11
11
|
import { ResultOf } from '@/vdb/graphql/graphql.js';
|
|
12
12
|
import { useUserSettings } from '@/vdb/hooks/use-user-settings.js';
|
|
13
|
-
import { Trans } from '
|
|
13
|
+
import { Trans } from '@lingui/react/macro';
|
|
14
14
|
import { JsonEditor } from 'json-edit-react';
|
|
15
15
|
import { EllipsisVertical } from 'lucide-react';
|
|
16
16
|
import { useMemo } from 'react';
|
|
@@ -160,7 +160,7 @@ export function OrderTable({ order, pageId }: Readonly<OrderTableProps>) {
|
|
|
160
160
|
enableSorting: false,
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
const columnVisibility = getColumnVisibility(
|
|
163
|
+
const columnVisibility = getColumnVisibility(columns, defaultColumnVisibility, customFieldColumnNames);
|
|
164
164
|
const visibleColumnCount = Object.values(columnVisibility).filter(Boolean).length;
|
|
165
165
|
const data = order.lines;
|
|
166
166
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/vdb/components/ui/table.js';
|
|
2
2
|
import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
|
|
3
|
-
import { Trans } from '
|
|
3
|
+
import { Trans } from '@lingui/react/macro';
|
|
4
4
|
import { Order } from '../utils/order-types.js';
|
|
5
5
|
|
|
6
6
|
export function OrderTaxSummary({ order }: Readonly<{ order: Order }>) {
|
|
@@ -3,8 +3,9 @@ import { Button } from '@/vdb/components/ui/button.js';
|
|
|
3
3
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/vdb/components/ui/collapsible.js';
|
|
4
4
|
import { api } from '@/vdb/graphql/api.js';
|
|
5
5
|
import { ResultOf } from '@/vdb/graphql/graphql.js';
|
|
6
|
+
import { useDynamicTranslations } from '@/vdb/hooks/use-dynamic-translations.js';
|
|
6
7
|
import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
|
|
7
|
-
import { Trans, useLingui } from '
|
|
8
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
8
9
|
import { useMutation } from '@tanstack/react-query';
|
|
9
10
|
import { JsonEditor } from 'json-edit-react';
|
|
10
11
|
import { ChevronDown } from 'lucide-react';
|
|
@@ -32,7 +33,8 @@ type PaymentDetailsProps = {
|
|
|
32
33
|
|
|
33
34
|
export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<PaymentDetailsProps>) {
|
|
34
35
|
const { formatCurrency, formatDate } = useLocalFormat();
|
|
35
|
-
const {
|
|
36
|
+
const { t } = useLingui();
|
|
37
|
+
const { getTranslatedPaymentState, getTranslatedRefundState } = useDynamicTranslations();
|
|
36
38
|
const [settleRefundDialogOpen, setSettleRefundDialogOpen] = useState(false);
|
|
37
39
|
const [selectedRefundId, setSelectedRefundId] = useState<string | null>(null);
|
|
38
40
|
|
|
@@ -40,14 +42,14 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
40
42
|
mutationFn: api.mutate(settlePaymentDocument),
|
|
41
43
|
onSuccess: (result: ResultOf<typeof settlePaymentDocument>) => {
|
|
42
44
|
if (result.settlePayment.__typename === 'Payment') {
|
|
43
|
-
toast.success(
|
|
45
|
+
toast.success(t`Payment settled successfully`);
|
|
44
46
|
onSuccess?.();
|
|
45
47
|
} else {
|
|
46
|
-
toast.error(result.settlePayment.message ??
|
|
48
|
+
toast.error(result.settlePayment.message ?? t`Failed to settle payment`);
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
51
|
onError: () => {
|
|
50
|
-
toast.error(
|
|
52
|
+
toast.error(t`Failed to settle payment`);
|
|
51
53
|
},
|
|
52
54
|
});
|
|
53
55
|
|
|
@@ -55,16 +57,14 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
55
57
|
mutationFn: api.mutate(transitionPaymentToStateDocument),
|
|
56
58
|
onSuccess: (result: ResultOf<typeof transitionPaymentToStateDocument>) => {
|
|
57
59
|
if (result.transitionPaymentToState.__typename === 'Payment') {
|
|
58
|
-
toast.success(
|
|
60
|
+
toast.success(t`Payment state updated successfully`);
|
|
59
61
|
onSuccess?.();
|
|
60
62
|
} else {
|
|
61
|
-
toast.error(
|
|
62
|
-
result.transitionPaymentToState.message ?? i18n.t('Failed to update payment state'),
|
|
63
|
-
);
|
|
63
|
+
toast.error(result.transitionPaymentToState.message ?? t`Failed to update payment state`);
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
onError: () => {
|
|
67
|
-
toast.error(
|
|
67
|
+
toast.error(t`Failed to update payment state`);
|
|
68
68
|
},
|
|
69
69
|
});
|
|
70
70
|
|
|
@@ -72,14 +72,14 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
72
72
|
mutationFn: api.mutate(cancelPaymentDocument),
|
|
73
73
|
onSuccess: (result: ResultOf<typeof cancelPaymentDocument>) => {
|
|
74
74
|
if (result.cancelPayment.__typename === 'Payment') {
|
|
75
|
-
toast.success(
|
|
75
|
+
toast.success(t`Payment cancelled successfully`);
|
|
76
76
|
onSuccess?.();
|
|
77
77
|
} else {
|
|
78
|
-
toast.error(result.cancelPayment.message ??
|
|
78
|
+
toast.error(result.cancelPayment.message ?? t`Failed to cancel payment`);
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
onError: () => {
|
|
82
|
-
toast.error(
|
|
82
|
+
toast.error(t`Failed to cancel payment`);
|
|
83
83
|
},
|
|
84
84
|
});
|
|
85
85
|
|
|
@@ -87,15 +87,15 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
87
87
|
mutationFn: api.mutate(settleRefundDocument),
|
|
88
88
|
onSuccess: (result: ResultOf<typeof settleRefundDocument>) => {
|
|
89
89
|
if (result.settleRefund.__typename === 'Refund') {
|
|
90
|
-
toast.success(
|
|
90
|
+
toast.success(t`Refund settled successfully`);
|
|
91
91
|
onSuccess?.();
|
|
92
92
|
setSettleRefundDialogOpen(false);
|
|
93
93
|
} else {
|
|
94
|
-
toast.error(result.settleRefund.message ??
|
|
94
|
+
toast.error(result.settleRefund.message ?? t`Failed to settle refund`);
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
onError: () => {
|
|
98
|
-
toast.error(
|
|
98
|
+
toast.error(t`Failed to settle refund`);
|
|
99
99
|
},
|
|
100
100
|
});
|
|
101
101
|
|
|
@@ -139,7 +139,7 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
139
139
|
|
|
140
140
|
if (payment.nextStates?.includes('Settled')) {
|
|
141
141
|
actions.push({
|
|
142
|
-
label:
|
|
142
|
+
label: t`Settle payment`,
|
|
143
143
|
onClick: handleSettlePayment,
|
|
144
144
|
type: 'success',
|
|
145
145
|
disabled: settlePaymentMutation.isPending,
|
|
@@ -148,7 +148,10 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
148
148
|
|
|
149
149
|
nextOtherStates().forEach(state => {
|
|
150
150
|
actions.push({
|
|
151
|
-
label:
|
|
151
|
+
label:
|
|
152
|
+
state === 'Cancelled'
|
|
153
|
+
? t`Cancel payment`
|
|
154
|
+
: t`Transition to ${getTranslatedPaymentState(state)}`,
|
|
152
155
|
type: getTypeForState(state),
|
|
153
156
|
onClick: () => handlePaymentStateTransition(state),
|
|
154
157
|
disabled: transitionPaymentMutation.isPending || cancelPaymentMutation.isPending,
|
|
@@ -210,7 +213,10 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
210
213
|
<div key={refund.id} className="p-3 border rounded-md bg-muted/50">
|
|
211
214
|
<div className="space-y-1">
|
|
212
215
|
<LabeledData label={<Trans>Refund ID</Trans>} value={refund.id} />
|
|
213
|
-
<LabeledData
|
|
216
|
+
<LabeledData
|
|
217
|
+
label={<Trans>State</Trans>}
|
|
218
|
+
value={getTranslatedRefundState(refund.state)}
|
|
219
|
+
/>
|
|
214
220
|
<LabeledData
|
|
215
221
|
label={<Trans>Created at</Trans>}
|
|
216
222
|
value={formatDate(refund.createdAt, {
|
|
@@ -266,7 +272,7 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
266
272
|
)}
|
|
267
273
|
<div className="mt-3 pt-3 border-t">
|
|
268
274
|
<StateTransitionControl
|
|
269
|
-
currentState={payment.state}
|
|
275
|
+
currentState={getTranslatedPaymentState(payment.state)}
|
|
270
276
|
actions={getPaymentActions()}
|
|
271
277
|
isLoading={
|
|
272
278
|
settlePaymentMutation.isPending ||
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DetailPageButton } from '@/vdb/components/shared/detail-page-button.js';
|
|
2
2
|
import { Badge } from '@/vdb/components/ui/badge.js';
|
|
3
3
|
import { api } from '@/vdb/graphql/api.js';
|
|
4
|
+
import { useDynamicTranslations } from '@/vdb/hooks/use-dynamic-translations.js';
|
|
4
5
|
import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
|
|
5
6
|
import { useQuery } from '@tanstack/react-query';
|
|
6
7
|
import { sellerOrdersDocument } from '../orders.graphql.js';
|
|
@@ -12,6 +13,7 @@ export interface SellerOrdersCardProps {
|
|
|
12
13
|
|
|
13
14
|
export function SellerOrdersCard({ orderId }: Readonly<SellerOrdersCardProps>) {
|
|
14
15
|
const { formatCurrency } = useLocalFormat();
|
|
16
|
+
const { getTranslatedOrderState } = useDynamicTranslations();
|
|
15
17
|
const { data, isLoading, error } = useQuery({
|
|
16
18
|
queryKey: ['seller-orders', orderId],
|
|
17
19
|
queryFn: () => api.query(sellerOrdersDocument, { orderId }),
|
|
@@ -51,7 +53,7 @@ export function SellerOrdersCard({ orderId }: Readonly<SellerOrdersCardProps>) {
|
|
|
51
53
|
<div className="flex gap-2">
|
|
52
54
|
{seller && <Badge variant={'secondary'}>{seller.name}</Badge>}
|
|
53
55
|
</div>
|
|
54
|
-
<Badge variant={'secondary'}>{sellerOrder.state}</Badge>
|
|
56
|
+
<Badge variant={'secondary'}>{getTranslatedOrderState(sellerOrder.state)}</Badge>
|
|
55
57
|
</div>
|
|
56
58
|
</div>
|
|
57
59
|
);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@/vdb/components/ui/dialog.js';
|
|
10
10
|
import { Input } from '@/vdb/components/ui/input.js';
|
|
11
11
|
import { Label } from '@/vdb/components/ui/label.js';
|
|
12
|
-
import { Trans } from '
|
|
12
|
+
import { Trans } from '@lingui/react/macro';
|
|
13
13
|
import { useState } from 'react';
|
|
14
14
|
|
|
15
15
|
type SettleRefundDialogProps = {
|
|
@@ -20,11 +20,11 @@ type SettleRefundDialogProps = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export function SettleRefundDialog({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}: Readonly<SettleRefundDialogProps>) {
|
|
23
|
+
open,
|
|
24
|
+
onOpenChange,
|
|
25
|
+
onSettle,
|
|
26
|
+
isLoading,
|
|
27
|
+
}: Readonly<SettleRefundDialogProps>) {
|
|
28
28
|
const [transactionId, setTransactionId] = useState('');
|
|
29
29
|
|
|
30
30
|
const handleSettle = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Money } from '@/vdb/components/data-display/money.js';
|
|
2
2
|
import { Card, CardContent, CardHeader, CardTitle } from '@/vdb/components/ui/card.js';
|
|
3
3
|
import { ResultOf } from '@/vdb/graphql/graphql.js';
|
|
4
|
-
import { Trans } from '
|
|
4
|
+
import { Trans } from '@lingui/react/macro';
|
|
5
5
|
import { draftOrderEligibleShippingMethodsDocument } from '../orders.graphql.js';
|
|
6
6
|
|
|
7
7
|
type ShippingMethodQuote = ResultOf<
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
DropdownMenuItem,
|
|
6
6
|
DropdownMenuTrigger,
|
|
7
7
|
} from '@/vdb/components/ui/dropdown-menu.js';
|
|
8
|
-
import { Trans } from '
|
|
8
|
+
import { Trans } from '@lingui/react/macro';
|
|
9
9
|
import { cn } from '@/vdb/lib/utils.js';
|
|
10
10
|
import { EllipsisVertical, CircleDashed, CircleCheck, CircleX } from 'lucide-react';
|
|
11
11
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@/vdb/components/ui/dialog.js';
|
|
11
11
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/vdb/components/ui/select.js';
|
|
12
12
|
import { api } from '@/vdb/graphql/api.js';
|
|
13
|
-
import { Trans } from '
|
|
13
|
+
import { Trans } from '@lingui/react/macro';
|
|
14
14
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
15
15
|
import { ResultOf } from 'gql.tada';
|
|
16
16
|
import { useState } from 'react';
|
|
@@ -22,7 +22,8 @@ import { orderHistoryDocument, transitionOrderToStateDocument } from '../orders.
|
|
|
22
22
|
*/
|
|
23
23
|
export function useTransitionOrderToState(orderId: string | undefined) {
|
|
24
24
|
const [selectStateOpen, setSelectStateOpen] = useState(false);
|
|
25
|
-
const [onSuccessFn, setOnSuccessFn] = useState<() => void>(() => {
|
|
25
|
+
const [onSuccessFn, setOnSuccessFn] = useState<() => void>(() => {
|
|
26
|
+
});
|
|
26
27
|
const { data, isLoading, error } = useQuery({
|
|
27
28
|
queryKey: ['orderPreModifyingState', orderId],
|
|
28
29
|
queryFn: async () => {
|
|
@@ -10,7 +10,7 @@ import { ListPage } from '@/vdb/framework/page/list-page.js';
|
|
|
10
10
|
import { api } from '@/vdb/graphql/api.js';
|
|
11
11
|
import { ResultOf } from '@/vdb/graphql/graphql.js';
|
|
12
12
|
import { useServerConfig } from '@/vdb/hooks/use-server-config.js';
|
|
13
|
-
import { Trans } from '
|
|
13
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
14
14
|
import { useMutation } from '@tanstack/react-query';
|
|
15
15
|
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
16
16
|
import { PlusIcon } from 'lucide-react';
|
|
@@ -24,6 +24,7 @@ export const Route = createFileRoute('/_authenticated/_orders/orders')({
|
|
|
24
24
|
function OrderListPage() {
|
|
25
25
|
const serverConfig = useServerConfig();
|
|
26
26
|
const navigate = useNavigate();
|
|
27
|
+
const { t } = useLingui();
|
|
27
28
|
const { mutate: createDraftOrder } = useMutation({
|
|
28
29
|
mutationFn: api.mutate(createDraftOrderDocument),
|
|
29
30
|
onSuccess: (result: ResultOf<typeof createDraftOrderDocument>) => {
|
|
@@ -33,7 +34,7 @@ function OrderListPage() {
|
|
|
33
34
|
return (
|
|
34
35
|
<ListPage
|
|
35
36
|
pageId="order-list"
|
|
36
|
-
title=
|
|
37
|
+
title={<Trans>Orders</Trans>}
|
|
37
38
|
onSearchTermChange={searchTerm => {
|
|
38
39
|
return {
|
|
39
40
|
_or: [
|
|
@@ -60,19 +61,15 @@ function OrderListPage() {
|
|
|
60
61
|
route={Route}
|
|
61
62
|
customizeColumns={{
|
|
62
63
|
total: {
|
|
63
|
-
header: 'Total',
|
|
64
64
|
cell: OrderMoneyCell,
|
|
65
65
|
},
|
|
66
66
|
totalWithTax: {
|
|
67
|
-
header: 'Total with Tax',
|
|
68
67
|
cell: OrderMoneyCell,
|
|
69
68
|
},
|
|
70
69
|
state: {
|
|
71
|
-
header: 'State',
|
|
72
70
|
cell: OrderStateCell,
|
|
73
71
|
},
|
|
74
72
|
code: {
|
|
75
|
-
header: 'Code',
|
|
76
73
|
cell: ({ cell, row }) => {
|
|
77
74
|
const value = cell.getValue() as string;
|
|
78
75
|
const id = row.original.id;
|
|
@@ -80,11 +77,10 @@ function OrderListPage() {
|
|
|
80
77
|
},
|
|
81
78
|
},
|
|
82
79
|
customer: {
|
|
83
|
-
header: 'Customer',
|
|
84
80
|
cell: CustomerCell,
|
|
85
81
|
},
|
|
86
82
|
shippingLines: {
|
|
87
|
-
header:
|
|
83
|
+
header: () => <Trans>Shipping</Trans>,
|
|
88
84
|
cell: ({ row }) => {
|
|
89
85
|
const value = row.original.shippingLines;
|
|
90
86
|
return <div>{value.map(line => line.shippingMethod.name).join(', ')}</div>;
|
|
@@ -100,7 +96,7 @@ function OrderListPage() {
|
|
|
100
96
|
}}
|
|
101
97
|
facetedFilters={{
|
|
102
98
|
state: {
|
|
103
|
-
title:
|
|
99
|
+
title: t`State`,
|
|
104
100
|
options:
|
|
105
101
|
serverConfig?.orderProcess.map(state => {
|
|
106
102
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
2
2
|
import { Badge } from '@/vdb/components/ui/badge.js';
|
|
3
3
|
import { Button } from '@/vdb/components/ui/button.js';
|
|
4
|
-
import { Trans } from '
|
|
4
|
+
import { Trans } from '@lingui/react/macro';
|
|
5
5
|
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
6
6
|
import { ArrowLeft } from 'lucide-react';
|
|
7
7
|
import { OrderDetail, OrderDetailShared } from './components/order-detail-shared.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
2
2
|
import { PageBlock } from '@/vdb/framework/layout-engine/page-layout.js';
|
|
3
|
-
import { Trans } from '
|
|
3
|
+
import { Trans } from '@lingui/react/macro';
|
|
4
4
|
import { createFileRoute } from '@tanstack/react-router';
|
|
5
5
|
import { OrderDetailShared } from './components/order-detail-shared.js';
|
|
6
6
|
import { SellerOrdersCard } from './components/seller-orders-card.js';
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
11
11
|
import { getDetailQueryOptions, useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
12
12
|
import { api } from '@/vdb/graphql/api.js';
|
|
13
|
-
import { Trans, useLingui } from '
|
|
13
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
14
14
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
15
15
|
import { createFileRoute, Link, useNavigate } from '@tanstack/react-router';
|
|
16
16
|
import { VariablesOf } from 'gql.tada';
|
|
@@ -71,7 +71,7 @@ type ProductVariantInfo = {
|
|
|
71
71
|
function ModifyOrderPage() {
|
|
72
72
|
const params = Route.useParams();
|
|
73
73
|
const navigate = useNavigate({ from: '/orders/$id/modify' });
|
|
74
|
-
const {
|
|
74
|
+
const { t } = useLingui();
|
|
75
75
|
const queryClient = useQueryClient();
|
|
76
76
|
const { form, submitHandler, entity } = useDetailPage({
|
|
77
77
|
pageId,
|
|
@@ -84,11 +84,11 @@ function ModifyOrderPage() {
|
|
|
84
84
|
},
|
|
85
85
|
params: { id: params.id },
|
|
86
86
|
onSuccess: async () => {
|
|
87
|
-
toast(
|
|
87
|
+
toast(t`Successfully updated order`);
|
|
88
88
|
form.reset(form.getValues());
|
|
89
89
|
},
|
|
90
90
|
onError: err => {
|
|
91
|
-
toast(
|
|
91
|
+
toast(t`Failed to update order`, {
|
|
92
92
|
description: err instanceof Error ? err.message : 'Unknown error',
|
|
93
93
|
});
|
|
94
94
|
},
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
18
18
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
19
19
|
import { api } from '@/vdb/graphql/api.js';
|
|
20
|
-
import { Trans, useLingui } from '
|
|
20
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
21
21
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
22
22
|
import { createFileRoute, Link, useNavigate } from '@tanstack/react-router';
|
|
23
23
|
import { ResultOf } from 'gql.tada';
|
|
@@ -54,7 +54,7 @@ export const Route = createFileRoute('/_authenticated/_orders/orders_/draft/$id'
|
|
|
54
54
|
|
|
55
55
|
function DraftOrderPage() {
|
|
56
56
|
const params = Route.useParams();
|
|
57
|
-
const {
|
|
57
|
+
const { t } = useLingui();
|
|
58
58
|
const navigate = useNavigate();
|
|
59
59
|
|
|
60
60
|
const { entity, refreshEntity, form } = useDetailPage({
|
|
@@ -102,7 +102,7 @@ function DraftOrderPage() {
|
|
|
102
102
|
const order = result.addItemToDraftOrder;
|
|
103
103
|
switch (order.__typename) {
|
|
104
104
|
case 'Order':
|
|
105
|
-
toast.success(
|
|
105
|
+
toast.success(t`Item added to order`);
|
|
106
106
|
refreshEntity();
|
|
107
107
|
break;
|
|
108
108
|
default:
|
|
@@ -118,7 +118,7 @@ function DraftOrderPage() {
|
|
|
118
118
|
const order = result.adjustDraftOrderLine;
|
|
119
119
|
switch (order.__typename) {
|
|
120
120
|
case 'Order':
|
|
121
|
-
toast.success(
|
|
121
|
+
toast.success(t`Order line updated`);
|
|
122
122
|
refreshEntity();
|
|
123
123
|
break;
|
|
124
124
|
default:
|
|
@@ -134,7 +134,7 @@ function DraftOrderPage() {
|
|
|
134
134
|
const order = result.removeDraftOrderLine;
|
|
135
135
|
switch (order.__typename) {
|
|
136
136
|
case 'Order':
|
|
137
|
-
toast.success(
|
|
137
|
+
toast.success(t`Order line removed`);
|
|
138
138
|
refreshEntity();
|
|
139
139
|
break;
|
|
140
140
|
default:
|
|
@@ -150,7 +150,7 @@ function DraftOrderPage() {
|
|
|
150
150
|
const order = result.setCustomerForDraftOrder;
|
|
151
151
|
switch (order.__typename) {
|
|
152
152
|
case 'Order':
|
|
153
|
-
toast.success(
|
|
153
|
+
toast.success(t`Customer set for order`);
|
|
154
154
|
refreshEntity();
|
|
155
155
|
break;
|
|
156
156
|
default:
|
|
@@ -163,7 +163,7 @@ function DraftOrderPage() {
|
|
|
163
163
|
const { mutate: setShippingAddressForDraftOrder } = useMutation({
|
|
164
164
|
mutationFn: api.mutate(setShippingAddressForDraftOrderDocument),
|
|
165
165
|
onSuccess: (result: ResultOf<typeof setShippingAddressForDraftOrderDocument>) => {
|
|
166
|
-
toast.success(
|
|
166
|
+
toast.success(t`Shipping address set for order`);
|
|
167
167
|
refreshEntity();
|
|
168
168
|
},
|
|
169
169
|
});
|
|
@@ -171,7 +171,7 @@ function DraftOrderPage() {
|
|
|
171
171
|
const { mutate: setBillingAddressForDraftOrder } = useMutation({
|
|
172
172
|
mutationFn: api.mutate(setBillingAddressForDraftOrderDocument),
|
|
173
173
|
onSuccess: (result: ResultOf<typeof setBillingAddressForDraftOrderDocument>) => {
|
|
174
|
-
toast.success(
|
|
174
|
+
toast.success(t`Billing address set for order`);
|
|
175
175
|
refreshEntity();
|
|
176
176
|
},
|
|
177
177
|
});
|
|
@@ -179,7 +179,7 @@ function DraftOrderPage() {
|
|
|
179
179
|
const { mutate: unsetShippingAddressForDraftOrder } = useMutation({
|
|
180
180
|
mutationFn: api.mutate(unsetShippingAddressForDraftOrderDocument),
|
|
181
181
|
onSuccess: (result: ResultOf<typeof unsetShippingAddressForDraftOrderDocument>) => {
|
|
182
|
-
toast.success(
|
|
182
|
+
toast.success(t`Shipping address unset for order`);
|
|
183
183
|
refreshEntity();
|
|
184
184
|
},
|
|
185
185
|
});
|
|
@@ -187,7 +187,7 @@ function DraftOrderPage() {
|
|
|
187
187
|
const { mutate: unsetBillingAddressForDraftOrder } = useMutation({
|
|
188
188
|
mutationFn: api.mutate(unsetBillingAddressForDraftOrderDocument),
|
|
189
189
|
onSuccess: (result: ResultOf<typeof unsetBillingAddressForDraftOrderDocument>) => {
|
|
190
|
-
toast.success(
|
|
190
|
+
toast.success(t`Billing address unset for order`);
|
|
191
191
|
refreshEntity();
|
|
192
192
|
},
|
|
193
193
|
});
|
|
@@ -198,7 +198,7 @@ function DraftOrderPage() {
|
|
|
198
198
|
const order = result.setDraftOrderShippingMethod;
|
|
199
199
|
switch (order.__typename) {
|
|
200
200
|
case 'Order':
|
|
201
|
-
toast.success(
|
|
201
|
+
toast.success(t`Shipping method set for order`);
|
|
202
202
|
refreshEntity();
|
|
203
203
|
break;
|
|
204
204
|
default:
|
|
@@ -214,7 +214,7 @@ function DraftOrderPage() {
|
|
|
214
214
|
const order = result.applyCouponCodeToDraftOrder;
|
|
215
215
|
switch (order.__typename) {
|
|
216
216
|
case 'Order':
|
|
217
|
-
toast.success(
|
|
217
|
+
toast.success(t`Coupon code set for order`);
|
|
218
218
|
refreshEntity();
|
|
219
219
|
break;
|
|
220
220
|
default:
|
|
@@ -227,7 +227,7 @@ function DraftOrderPage() {
|
|
|
227
227
|
const { mutate: removeCouponCodeForDraftOrder } = useMutation({
|
|
228
228
|
mutationFn: api.mutate(removeCouponCodeFromDraftOrderDocument),
|
|
229
229
|
onSuccess: (result: ResultOf<typeof removeCouponCodeFromDraftOrderDocument>) => {
|
|
230
|
-
toast.success(
|
|
230
|
+
toast.success(t`Coupon code removed from order`);
|
|
231
231
|
refreshEntity();
|
|
232
232
|
},
|
|
233
233
|
});
|
|
@@ -238,7 +238,7 @@ function DraftOrderPage() {
|
|
|
238
238
|
const order = result.transitionOrderToState;
|
|
239
239
|
switch (order?.__typename) {
|
|
240
240
|
case 'Order':
|
|
241
|
-
toast.success(
|
|
241
|
+
toast.success(t`Draft order completed`);
|
|
242
242
|
refreshEntity();
|
|
243
243
|
setTimeout(() => {
|
|
244
244
|
navigate({ to: `/orders/$id`, params: { id: order.id } });
|
|
@@ -255,7 +255,7 @@ function DraftOrderPage() {
|
|
|
255
255
|
mutationFn: api.mutate(deleteDraftOrderDocument),
|
|
256
256
|
onSuccess: (result: ResultOf<typeof deleteDraftOrderDocument>) => {
|
|
257
257
|
if (result.deleteDraftOrder.result === 'DELETED') {
|
|
258
|
-
toast.success(
|
|
258
|
+
toast.success(t`Draft order deleted`);
|
|
259
259
|
navigate({ to: '/orders' });
|
|
260
260
|
} else {
|
|
261
261
|
toast.error(result.deleteDraftOrder.message);
|
|
@@ -283,8 +283,8 @@ function DraftOrderPage() {
|
|
|
283
283
|
<PageActionBarRight>
|
|
284
284
|
<PermissionGuard requires={['DeleteOrder']}>
|
|
285
285
|
<ConfirmationDialog
|
|
286
|
-
title={
|
|
287
|
-
description={
|
|
286
|
+
title={t`Delete draft order`}
|
|
287
|
+
description={t`Are you sure you want to delete this draft order?`}
|
|
288
288
|
onConfirm={() => {
|
|
289
289
|
deleteDraftOrder({ orderId: entity.id });
|
|
290
290
|
}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
|
|
2
2
|
import { getDetailQueryOptions } from '@/vdb/framework/page/use-detail-page.js';
|
|
3
3
|
import { ResultOf } from '@/vdb/graphql/graphql.js';
|
|
4
|
-
import { Trans } from '
|
|
4
|
+
import { Trans } from '@lingui/react/macro';
|
|
5
5
|
import { redirect } from '@tanstack/react-router';
|
|
6
6
|
import { OrderDetail } from '../components/order-detail-shared.js';
|
|
7
7
|
import { orderDetailDocument } from '../orders.graphql.js';
|