@deenruv/admin-ui 1.0.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 +23 -0
- package/catalog/catalog.module.d.ts +43 -0
- package/catalog/catalog.routes.d.ts +4 -0
- package/catalog/components/apply-facet-dialog/apply-facet-dialog.component.d.ts +16 -0
- package/catalog/components/asset-detail/asset-detail.component.d.ts +28 -0
- package/catalog/components/asset-list/asset-list.component.d.ts +23 -0
- package/catalog/components/assign-products-to-channel-dialog/assign-products-to-channel-dialog.component.d.ts +35 -0
- package/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.component.d.ts +40 -0
- package/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.graphql.d.ts +4 -0
- package/catalog/components/collection-contents/collection-contents.component.d.ts +39 -0
- package/catalog/components/collection-data-table/collection-data-table.component.d.ts +80 -0
- package/catalog/components/collection-detail/collection-detail.component.d.ts +71 -0
- package/catalog/components/collection-list/collection-breadcrumb.pipe.d.ts +11 -0
- package/catalog/components/collection-list/collection-list-bulk-actions.d.ts +8 -0
- package/catalog/components/collection-list/collection-list.component.d.ts +25 -0
- package/catalog/components/collection-tree/array-to-tree.d.ts +19 -0
- package/catalog/components/collection-tree/collection-tree-node.component.d.ts +44 -0
- package/catalog/components/collection-tree/collection-tree.component.d.ts +22 -0
- package/catalog/components/collection-tree/collection-tree.service.d.ts +33 -0
- package/catalog/components/collection-tree/collection-tree.types.d.ts +7 -0
- package/catalog/components/confirm-variant-deletion-dialog/confirm-variant-deletion-dialog.component.d.ts +10 -0
- package/catalog/components/create-facet-value-dialog/create-facet-value-dialog.component.d.ts +19 -0
- package/catalog/components/create-product-option-group-dialog/create-product-option-group-dialog.component.d.ts +18 -0
- package/catalog/components/create-product-variant-dialog/create-product-variant-dialog.component.d.ts +27 -0
- package/catalog/components/facet-detail/facet-detail.component.d.ts +76 -0
- package/catalog/components/facet-list/facet-list-bulk-actions.d.ts +7 -0
- package/catalog/components/facet-list/facet-list.component.d.ts +19 -0
- package/catalog/components/generate-product-variants/generate-product-variants.component.d.ts +65 -0
- package/catalog/components/move-collections-dialog/move-collections-dialog.component.d.ts +23 -0
- package/catalog/components/option-value-input/option-value-input.component.d.ts +48 -0
- package/catalog/components/product-detail/product-detail.component.d.ts +75 -0
- package/catalog/components/product-list/product-list-bulk-actions.d.ts +7 -0
- package/catalog/components/product-list/product-list.component.d.ts +18 -0
- package/catalog/components/product-list/product-list.graphql.d.ts +1 -0
- package/catalog/components/product-options-editor/product-options-editor.component.d.ts +47 -0
- package/catalog/components/product-variant-detail/product-variant-detail.component.d.ts +79 -0
- package/catalog/components/product-variant-detail/product-variant-detail.graphql.d.ts +3 -0
- package/catalog/components/product-variant-list/product-variant-list-bulk-actions.d.ts +6 -0
- package/catalog/components/product-variant-list/product-variant-list.component.d.ts +14 -0
- package/catalog/components/product-variant-list/product-variant-list.graphql.d.ts +1 -0
- package/catalog/components/product-variant-quick-jump/product-variant-quick-jump.component.d.ts +18 -0
- package/catalog/components/product-variants-editor/product-variants-editor.component.d.ts +88 -0
- package/catalog/components/product-variants-table/product-variants-table.component.d.ts +55 -0
- package/catalog/components/update-product-option-dialog/update-product-option-dialog.component.d.ts +25 -0
- package/catalog/components/variant-price-detail/variant-price-detail.component.d.ts +20 -0
- package/catalog/components/variant-price-strategy-detail/variant-price-strategy-detail.component.d.ts +10 -0
- package/catalog/index.d.ts +5 -0
- package/catalog/providers/product-detail/product-detail.service.d.ts +286 -0
- package/catalog/providers/product-detail/replace-last.d.ts +6 -0
- package/catalog/providers/routing/product-variants-resolver.d.ts +8 -0
- package/catalog/public_api.d.ts +48 -0
- package/core/app.component.d.ts +19 -0
- package/core/app.component.module.d.ts +9 -0
- package/core/app.config.d.ts +3 -0
- package/core/common/base-detail.component.d.ts +146 -0
- package/core/common/base-entity-resolver.d.ts +45 -0
- package/core/common/base-list.component.d.ts +138 -0
- package/core/common/component-registry-types.d.ts +65 -0
- package/core/common/deactivate-aware.d.ts +8 -0
- package/core/common/detail-breadcrumb.d.ts +12 -0
- package/core/common/generated-types.d.ts +20279 -0
- package/core/common/introspection-result-wrapper.d.ts +1 -0
- package/core/common/introspection-result.d.ts +7 -0
- package/core/common/single-search-selection-model.d.ts +16 -0
- package/core/common/title-setter.d.ts +4 -0
- package/core/common/utilities/bulk-action-utils.d.ts +49 -0
- package/core/common/utilities/configurable-operation-utils.d.ts +48 -0
- package/core/common/utilities/create-updated-translatable.d.ts +25 -0
- package/core/common/utilities/custom-field-default-value.d.ts +6 -0
- package/core/common/utilities/find-translation.d.ts +14 -0
- package/core/common/utilities/get-default-ui-language.d.ts +3 -0
- package/core/common/utilities/interpolate-description.d.ts +7 -0
- package/core/common/utilities/selection-manager.d.ts +30 -0
- package/core/common/utilities/string-to-color.d.ts +4 -0
- package/core/common/version.d.ts +1 -0
- package/core/components/alerts/alerts.component.d.ts +11 -0
- package/core/components/app-shell/app-shell.component.d.ts +41 -0
- package/core/components/base-nav/base-nav.component.d.ts +30 -0
- package/core/components/breadcrumb/breadcrumb.component.d.ts +27 -0
- package/core/components/channel-switcher/channel-switcher.component.d.ts +21 -0
- package/core/components/main-nav/main-nav.component.d.ts +22 -0
- package/core/components/notification/notification.component.d.ts +37 -0
- package/core/components/overlay-host/overlay-host.component.d.ts +12 -0
- package/core/components/settings-nav/settings-nav.component.d.ts +11 -0
- package/core/components/theme-switcher/theme-switcher.component.d.ts +16 -0
- package/core/components/ui-language-switcher-dialog/ui-language-switcher-dialog.component.d.ts +30 -0
- package/core/components/user-menu/user-menu.component.d.ts +12 -0
- package/core/core.module.d.ts +39 -0
- package/core/data/check-jobs-link.d.ts +19 -0
- package/core/data/client-state/client-defaults.d.ts +32 -0
- package/core/data/client-state/client-resolvers.d.ts +12 -0
- package/core/data/data.module.d.ts +17 -0
- package/core/data/definitions/administrator-definitions.d.ts +14 -0
- package/core/data/definitions/auth-definitions.d.ts +4 -0
- package/core/data/definitions/client-definitions.d.ts +17 -0
- package/core/data/definitions/collection-definitions.d.ts +13 -0
- package/core/data/definitions/customer-definitions.d.ts +23 -0
- package/core/data/definitions/facet-definitions.d.ts +13 -0
- package/core/data/definitions/order-definitions.d.ts +39 -0
- package/core/data/definitions/product-definitions.d.ts +49 -0
- package/core/data/definitions/promotion-definitions.d.ts +6 -0
- package/core/data/definitions/settings-definitions.d.ts +69 -0
- package/core/data/definitions/shared-definitions.d.ts +3 -0
- package/core/data/definitions/shipping-definitions.d.ts +8 -0
- package/core/data/omit-typename-link.d.ts +11 -0
- package/core/data/providers/administrator-data.service.d.ts +19 -0
- package/core/data/providers/auth-data.service.d.ts +9 -0
- package/core/data/providers/base-data.service.d.ts +26 -0
- package/core/data/providers/client-data.service.d.ts +26 -0
- package/core/data/providers/collection-data.service.d.ts +25 -0
- package/core/data/providers/customer-data.service.d.ts +36 -0
- package/core/data/providers/data.service.d.ts +86 -0
- package/core/data/providers/facet-data.service.d.ts +19 -0
- package/core/data/providers/fetch-adapter.d.ts +14 -0
- package/core/data/providers/interceptor.d.ts +49 -0
- package/core/data/providers/order-data.service.d.ts +48 -0
- package/core/data/providers/product-data.service.d.ts +86 -0
- package/core/data/providers/promotion-data.service.d.ts +11 -0
- package/core/data/providers/settings-data.service.d.ts +74 -0
- package/core/data/providers/shipping-method-data.service.d.ts +17 -0
- package/core/data/query-result.d.ts +43 -0
- package/core/data/server-config.d.ts +39 -0
- package/core/data/utils/add-custom-fields.d.ts +7 -0
- package/core/data/utils/get-server-location.d.ts +4 -0
- package/core/data/utils/is-entity-create-or-update-mutation.d.ts +6 -0
- package/core/data/utils/remove-readonly-custom-fields.d.ts +17 -0
- package/core/data/utils/transform-relation-custom-field-inputs.d.ts +8 -0
- package/core/extension/add-action-bar-dropdown-menu-item.d.ts +25 -0
- package/core/extension/add-action-bar-item.d.ts +21 -0
- package/core/extension/add-nav-menu-item.d.ts +56 -0
- package/core/extension/components/angular-route.component.d.ts +26 -0
- package/core/extension/components/route.component.d.ts +20 -0
- package/core/extension/providers/page-metadata.service.d.ts +9 -0
- package/core/extension/register-alert.d.ts +11 -0
- package/core/extension/register-bulk-action.d.ts +49 -0
- package/core/extension/register-custom-detail-component.d.ts +55 -0
- package/core/extension/register-dashboard-widget.d.ts +17 -0
- package/core/extension/register-data-table-component.d.ts +45 -0
- package/core/extension/register-form-input-component.d.ts +51 -0
- package/core/extension/register-history-entry-component.d.ts +66 -0
- package/core/extension/register-page-tab.d.ts +23 -0
- package/core/extension/register-route-component.d.ts +109 -0
- package/core/extension/types.d.ts +11 -0
- package/core/index.d.ts +5 -0
- package/core/providers/alerts/alerts.service.d.ts +150 -0
- package/core/providers/auth/auth.service.d.ts +40 -0
- package/core/providers/breadcrumb/breadcrumb.service.d.ts +39 -0
- package/core/providers/bulk-action-registry/bulk-action-registry.service.d.ts +9 -0
- package/core/providers/bulk-action-registry/bulk-action-types.d.ts +149 -0
- package/core/providers/channel/channel.service.d.ts +16 -0
- package/core/providers/component-registry/component-registry.service.d.ts +13 -0
- package/core/providers/currency/currency.service.d.ts +10 -0
- package/core/providers/custom-detail-component/custom-detail-component-types.d.ts +26 -0
- package/core/providers/custom-detail-component/custom-detail-component.service.d.ts +9 -0
- package/core/providers/custom-field-component/custom-field-component.service.d.ts +25 -0
- package/core/providers/custom-history-entry-component/history-entry-component-types.d.ts +81 -0
- package/core/providers/custom-history-entry-component/history-entry-component.service.d.ts +10 -0
- package/core/providers/dashboard-widget/dashboard-widget-types.d.ts +56 -0
- package/core/providers/dashboard-widget/dashboard-widget.service.d.ts +24 -0
- package/core/providers/data-table/data-table-filter-collection.d.ts +48 -0
- package/core/providers/data-table/data-table-filter.d.ts +108 -0
- package/core/providers/data-table/data-table-sort-collection.d.ts +24 -0
- package/core/providers/data-table/data-table-sort.d.ts +14 -0
- package/core/providers/guard/auth.guard.d.ts +17 -0
- package/core/providers/health-check/health-check.service.d.ts +40 -0
- package/core/providers/i18n/custom-http-loader.d.ts +21 -0
- package/core/providers/i18n/custom-message-format-compiler.d.ts +15 -0
- package/core/providers/i18n/i18n.service.d.ts +39 -0
- package/core/providers/job-queue/job-queue.service.d.ts +22 -0
- package/core/providers/local-storage/local-storage.service.d.ts +66 -0
- package/core/providers/localization/localization.service.d.ts +21 -0
- package/core/providers/modal/modal.service.d.ts +67 -0
- package/core/providers/modal/modal.types.d.ts +69 -0
- package/core/providers/nav-builder/nav-builder-types.d.ts +279 -0
- package/core/providers/nav-builder/nav-builder.service.d.ts +64 -0
- package/core/providers/notification/notification.service.d.ts +105 -0
- package/core/providers/overlay-host/overlay-host.service.d.ts +25 -0
- package/core/providers/page/page.service.d.ts +61 -0
- package/core/providers/permissions/permissions.service.d.ts +26 -0
- package/core/public_api.d.ts +313 -0
- package/core/shared/components/action-bar/action-bar.component.d.ts +17 -0
- package/core/shared/components/action-bar-dropdown-menu/action-bar-dropdown-menu.component.d.ts +15 -0
- package/core/shared/components/action-bar-items/action-bar-base.component.d.ts +29 -0
- package/core/shared/components/action-bar-items/action-bar-items.component.d.ts +11 -0
- package/core/shared/components/address-form/address-form.component.d.ts +10 -0
- package/core/shared/components/affixed-input/affixed-input.component.d.ts +10 -0
- package/core/shared/components/affixed-input/percentage-suffix-input.component.d.ts +22 -0
- package/core/shared/components/asset-file-input/asset-file-input.component.d.ts +39 -0
- package/core/shared/components/asset-gallery/asset-gallery.component.d.ts +97 -0
- package/core/shared/components/asset-gallery/asset-gallery.types.d.ts +3 -0
- package/core/shared/components/asset-picker-dialog/asset-picker-dialog.component.d.ts +60 -0
- package/core/shared/components/asset-preview/asset-preview.component.d.ts +61 -0
- package/core/shared/components/asset-preview-dialog/asset-preview-dialog.component.d.ts +22 -0
- package/core/shared/components/asset-preview-links/asset-preview-links.component.d.ts +8 -0
- package/core/shared/components/asset-search-input/asset-search-input.component.d.ts +26 -0
- package/core/shared/components/assets/assets.component.d.ts +36 -0
- package/core/shared/components/assign-to-channel-dialog/assign-to-channel-dialog.component.d.ts +28 -0
- package/core/shared/components/bulk-action-menu/bulk-action-menu.component.d.ts +34 -0
- package/core/shared/components/card/card.component.d.ts +13 -0
- package/core/shared/components/channel-assignment-control/channel-assignment-control.component.d.ts +32 -0
- package/core/shared/components/channel-badge/channel-badge.component.d.ts +7 -0
- package/core/shared/components/chart/chart.component.d.ts +28 -0
- package/core/shared/components/chart/tooltip-plugin.d.ts +21 -0
- package/core/shared/components/chip/chip.component.d.ts +38 -0
- package/core/shared/components/configurable-input/configurable-input.component.d.ts +43 -0
- package/core/shared/components/currency-code-selector/currency-code-selector.component.d.ts +21 -0
- package/core/shared/components/currency-input/currency-input.component.d.ts +53 -0
- package/core/shared/components/custom-detail-component-host/custom-detail-component-host.component.d.ts +20 -0
- package/core/shared/components/custom-field-control/custom-field-control.component.d.ts +31 -0
- package/core/shared/components/customer-label/customer-label.component.d.ts +7 -0
- package/core/shared/components/data-table/data-table-column.component.d.ts +11 -0
- package/core/shared/components/data-table/data-table.component.d.ts +107 -0
- package/core/shared/components/data-table-2/data-table-column.component.d.ts +25 -0
- package/core/shared/components/data-table-2/data-table-custom-component.service.d.ts +52 -0
- package/core/shared/components/data-table-2/data-table-custom-field-column.component.d.ts +18 -0
- package/core/shared/components/data-table-2/data-table-search.component.d.ts +10 -0
- package/core/shared/components/data-table-2/data-table2.component.d.ts +134 -0
- package/core/shared/components/data-table-column-picker/data-table-column-picker.component.d.ts +19 -0
- package/core/shared/components/data-table-filter-label/data-table-filter-label.component.d.ts +11 -0
- package/core/shared/components/data-table-filter-presets/add-filter-preset-button.component.d.ts +25 -0
- package/core/shared/components/data-table-filter-presets/data-table-filter-presets.component.d.ts +30 -0
- package/core/shared/components/data-table-filter-presets/filter-preset.service.d.ts +34 -0
- package/core/shared/components/data-table-filter-presets/rename-filter-preset-dialog.component.d.ts +9 -0
- package/core/shared/components/data-table-filters/custom-filter-component.directive.d.ts +8 -0
- package/core/shared/components/data-table-filters/data-table-filters.component.d.ts +30 -0
- package/core/shared/components/datetime-picker/constants.d.ts +5 -0
- package/core/shared/components/datetime-picker/datetime-picker.component.d.ts +100 -0
- package/core/shared/components/datetime-picker/datetime-picker.service.d.ts +37 -0
- package/core/shared/components/datetime-picker/types.d.ts +11 -0
- package/core/shared/components/dropdown/dropdown-item.directive.d.ts +9 -0
- package/core/shared/components/dropdown/dropdown-menu.component.d.ts +42 -0
- package/core/shared/components/dropdown/dropdown-trigger.directive.d.ts +11 -0
- package/core/shared/components/dropdown/dropdown.component.d.ts +39 -0
- package/core/shared/components/duplicate-entity-dialog/duplicate-entity-dialog.component.d.ts +33 -0
- package/core/shared/components/duplicate-entity-dialog/duplicate-entity-dialog.graphql.d.ts +2 -0
- package/core/shared/components/edit-note-dialog/edit-note-dialog.component.d.ts +18 -0
- package/core/shared/components/empty-placeholder/empty-placeholder.component.d.ts +6 -0
- package/core/shared/components/entity-info/entity-info.component.d.ts +11 -0
- package/core/shared/components/extension-host/extension-host-config.d.ts +9 -0
- package/core/shared/components/extension-host/extension-host.component.d.ts +28 -0
- package/core/shared/components/extension-host/extension-host.service.d.ts +23 -0
- package/core/shared/components/extension-host/host-external-frame.d.ts +28 -0
- package/core/shared/components/facet-value-chip/facet-value-chip.component.d.ts +11 -0
- package/core/shared/components/facet-value-selector/facet-value-selector.component.d.ts +49 -0
- package/core/shared/components/focal-point-control/focal-point-control.component.d.ts +24 -0
- package/core/shared/components/form-field/form-field-control.directive.d.ts +15 -0
- package/core/shared/components/form-field/form-field.component.d.ts +32 -0
- package/core/shared/components/form-item/form-item.component.d.ts +11 -0
- package/core/shared/components/formatted-address/formatted-address.component.d.ts +13 -0
- package/core/shared/components/help-tooltip/help-tooltip.component.d.ts +7 -0
- package/core/shared/components/history-entry-detail/history-entry-detail.component.d.ts +5 -0
- package/core/shared/components/items-per-page-controls/items-per-page-controls.component.d.ts +11 -0
- package/core/shared/components/labeled-data/labeled-data.component.d.ts +6 -0
- package/core/shared/components/language-code-selector/language-code-selector.component.d.ts +20 -0
- package/core/shared/components/language-selector/language-selector.component.d.ts +11 -0
- package/core/shared/components/localized-text/localized-text.component.d.ts +13 -0
- package/core/shared/components/manage-tags-dialog/manage-tags-dialog.component.d.ts +24 -0
- package/core/shared/components/modal-dialog/dialog-buttons.directive.d.ts +14 -0
- package/core/shared/components/modal-dialog/dialog-component-outlet.component.d.ts +14 -0
- package/core/shared/components/modal-dialog/dialog-title.directive.d.ts +14 -0
- package/core/shared/components/modal-dialog/modal-dialog.component.d.ts +44 -0
- package/core/shared/components/object-tree/object-tree.component.d.ts +32 -0
- package/core/shared/components/order-state-label/order-state-label.component.d.ts +17 -0
- package/core/shared/components/page/page.component.d.ts +21 -0
- package/core/shared/components/page-block/page-block.component.d.ts +5 -0
- package/core/shared/components/page-body/page-body.component.d.ts +5 -0
- package/core/shared/components/page-detail-layout/page-detail-layout.component.d.ts +5 -0
- package/core/shared/components/page-detail-layout/page-detail-sidebar.component.d.ts +5 -0
- package/core/shared/components/page-entity-info/page-entity-info.component.d.ts +10 -0
- package/core/shared/components/page-header/page-header.component.d.ts +5 -0
- package/core/shared/components/page-header-description/page-header-description.component.d.ts +5 -0
- package/core/shared/components/page-header-tabs/page-header-tabs.component.d.ts +14 -0
- package/core/shared/components/page-title/page-title.component.d.ts +16 -0
- package/core/shared/components/pagination-controls/pagination-controls.component.d.ts +11 -0
- package/core/shared/components/product-multi-selector-dialog/product-multi-selector-dialog.component.d.ts +38 -0
- package/core/shared/components/product-multi-selector-dialog/product-multi-selector-dialog.graphql.d.ts +1 -0
- package/core/shared/components/product-search-input/product-search-input.component.d.ts +28 -0
- package/core/shared/components/product-variant-selector/product-variant-selector.component.d.ts +58 -0
- package/core/shared/components/radio-card/radio-card-fieldset.component.d.ts +24 -0
- package/core/shared/components/radio-card/radio-card.component.d.ts +22 -0
- package/core/shared/components/rich-text-editor/external-image-dialog/external-image-dialog.component.d.ts +21 -0
- package/core/shared/components/rich-text-editor/link-dialog/link-dialog.component.d.ts +19 -0
- package/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.component.d.ts +31 -0
- package/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.service.d.ts +34 -0
- package/core/shared/components/rich-text-editor/prosemirror/custom-nodes.d.ts +5 -0
- package/core/shared/components/rich-text-editor/prosemirror/inputrules.d.ts +8 -0
- package/core/shared/components/rich-text-editor/prosemirror/keymap.d.ts +3 -0
- package/core/shared/components/rich-text-editor/prosemirror/menu/links.d.ts +4 -0
- package/core/shared/components/rich-text-editor/prosemirror/menu/menu-common.d.ts +16 -0
- package/core/shared/components/rich-text-editor/prosemirror/menu/menu-plugin.d.ts +9 -0
- package/core/shared/components/rich-text-editor/prosemirror/menu/menu.d.ts +3 -0
- package/core/shared/components/rich-text-editor/prosemirror/menu/sub-menu-with-icon.d.ts +14 -0
- package/core/shared/components/rich-text-editor/prosemirror/plugins/image-plugin.d.ts +7 -0
- package/core/shared/components/rich-text-editor/prosemirror/plugins/link-select-plugin.d.ts +5 -0
- package/core/shared/components/rich-text-editor/prosemirror/plugins/raw-editor-plugin.d.ts +7 -0
- package/core/shared/components/rich-text-editor/prosemirror/plugins/tables-plugin.d.ts +13 -0
- package/core/shared/components/rich-text-editor/prosemirror/prosemirror.service.d.ts +34 -0
- package/core/shared/components/rich-text-editor/prosemirror/types.d.ts +9 -0
- package/core/shared/components/rich-text-editor/prosemirror/utils.d.ts +9 -0
- package/core/shared/components/rich-text-editor/raw-html-dialog/raw-html-dialog.component.d.ts +21 -0
- package/core/shared/components/rich-text-editor/rich-text-editor.component.d.ts +42 -0
- package/core/shared/components/select-toggle/select-toggle.component.d.ts +15 -0
- package/core/shared/components/simple-dialog/simple-dialog.component.d.ts +14 -0
- package/core/shared/components/split-view/split-view.component.d.ts +23 -0
- package/core/shared/components/split-view/split-view.directive.d.ts +13 -0
- package/core/shared/components/status-badge/status-badge.component.d.ts +6 -0
- package/core/shared/components/tabbed-custom-fields/tabbed-custom-fields.component.d.ts +25 -0
- package/core/shared/components/table-row-action/table-row-action.component.d.ts +12 -0
- package/core/shared/components/tag-selector/tag-selector.component.d.ts +24 -0
- package/core/shared/components/timeline-entry/timeline-entry.component.d.ts +19 -0
- package/core/shared/components/title-input/title-input.component.d.ts +6 -0
- package/core/shared/components/ui-extension-point/ui-extension-point.component.d.ts +27 -0
- package/core/shared/components/zone-selector/zone-selector.component.d.ts +51 -0
- package/core/shared/directives/disabled.directive.d.ts +14 -0
- package/core/shared/directives/if-default-channel-active.directive.d.ts +16 -0
- package/core/shared/directives/if-directive-base.d.ts +27 -0
- package/core/shared/directives/if-multichannel.directive.d.ts +28 -0
- package/core/shared/directives/if-permissions.directive.d.ts +37 -0
- package/core/shared/dynamic-form-inputs/boolean-form-input/boolean-form-input.component.d.ts +19 -0
- package/core/shared/dynamic-form-inputs/code-editor-form-input/base-code-editor-form-input.component.d.ts +30 -0
- package/core/shared/dynamic-form-inputs/code-editor-form-input/html-editor-form-input.component.d.ts +22 -0
- package/core/shared/dynamic-form-inputs/code-editor-form-input/json-editor-form-input.component.d.ts +23 -0
- package/core/shared/dynamic-form-inputs/combination-mode-form-input/combination-mode-form-input.component.d.ts +28 -0
- package/core/shared/dynamic-form-inputs/currency-form-input/currency-form-input.component.d.ts +25 -0
- package/core/shared/dynamic-form-inputs/customer-group-form-input/customer-group-form-input.component.d.ts +33 -0
- package/core/shared/dynamic-form-inputs/date-form-input/date-form-input.component.d.ts +22 -0
- package/core/shared/dynamic-form-inputs/default-form-inputs.d.ts +19 -0
- package/core/shared/dynamic-form-inputs/dynamic-form-input/dynamic-form-input.component.d.ts +58 -0
- package/core/shared/dynamic-form-inputs/facet-value-form-input/facet-value-form-input.component.d.ts +23 -0
- package/core/shared/dynamic-form-inputs/number-form-input/number-form-input.component.d.ts +24 -0
- package/core/shared/dynamic-form-inputs/password-form-input/password-form-input.component.d.ts +19 -0
- package/core/shared/dynamic-form-inputs/product-multi-selector-form-input/product-multi-selector-form-input.component.d.ts +25 -0
- package/core/shared/dynamic-form-inputs/product-selector-form-input/product-selector-form-input.component.d.ts +34 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/asset/relation-asset-input.component.d.ts +23 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/customer/relation-customer-input.component.d.ts +25 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/generic/relation-generic-input.component.d.ts +18 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/product/relation-product-input.component.d.ts +26 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/product-variant/relation-product-variant-input.component.d.ts +26 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/relation-card/relation-card.component.d.ts +23 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/relation-form-input.component.d.ts +22 -0
- package/core/shared/dynamic-form-inputs/relation-form-input/relation-selector-dialog/relation-selector-dialog.component.d.ts +10 -0
- package/core/shared/dynamic-form-inputs/rich-text-form-input/rich-text-form-input.component.d.ts +19 -0
- package/core/shared/dynamic-form-inputs/select-form-input/select-form-input.component.d.ts +30 -0
- package/core/shared/dynamic-form-inputs/text-form-input/text-form-input.component.d.ts +21 -0
- package/core/shared/dynamic-form-inputs/textarea-form-input/textarea-form-input.component.d.ts +20 -0
- package/core/shared/pipes/asset-preview.pipe.d.ts +22 -0
- package/core/shared/pipes/channel-label.pipe.d.ts +7 -0
- package/core/shared/pipes/custom-field-description.pipe.d.ts +11 -0
- package/core/shared/pipes/custom-field-label.pipe.d.ts +13 -0
- package/core/shared/pipes/duration.pipe.d.ts +22 -0
- package/core/shared/pipes/file-size.pipe.d.ts +18 -0
- package/core/shared/pipes/has-permission.pipe.d.ts +27 -0
- package/core/shared/pipes/locale-base.pipe.d.ts +21 -0
- package/core/shared/pipes/locale-currency-name.pipe.d.ts +21 -0
- package/core/shared/pipes/locale-currency.pipe.d.ts +25 -0
- package/core/shared/pipes/locale-date.pipe.d.ts +23 -0
- package/core/shared/pipes/locale-language-name.pipe.d.ts +21 -0
- package/core/shared/pipes/locale-region-name.pipe.d.ts +21 -0
- package/core/shared/pipes/sentence-case.pipe.d.ts +10 -0
- package/core/shared/pipes/sort.pipe.d.ts +12 -0
- package/core/shared/pipes/state-i18n-token.pipe.d.ts +9 -0
- package/core/shared/pipes/string-to-color.pipe.d.ts +7 -0
- package/core/shared/pipes/time-ago.pipe.d.ts +21 -0
- package/core/shared/providers/routing/can-deactivate-detail-guard.d.ts +11 -0
- package/core/shared/shared.module.d.ts +168 -0
- package/core/validators/unicode-pattern.validator.d.ts +2 -0
- package/customer/components/add-customer-to-group-dialog/add-customer-to-group-dialog.component.d.ts +22 -0
- package/customer/components/address-card/address-card.component.d.ts +28 -0
- package/customer/components/address-detail-dialog/address-detail-dialog.component.d.ts +17 -0
- package/customer/components/customer-detail/customer-detail.component.d.ts +70 -0
- package/customer/components/customer-group-detail/customer-group-detail.component.d.ts +26 -0
- package/customer/components/customer-group-detail-dialog/customer-group-detail-dialog.component.d.ts +24 -0
- package/customer/components/customer-group-list/customer-group-list-bulk-actions.d.ts +1 -0
- package/customer/components/customer-group-list/customer-group-list.component.d.ts +29 -0
- package/customer/components/customer-group-member-list/customer-group-member-list-bulk-actions.d.ts +3 -0
- package/customer/components/customer-group-member-list/customer-group-member-list.component.d.ts +39 -0
- package/customer/components/customer-history/customer-history-entry-host.component.d.ts +18 -0
- package/customer/components/customer-history/customer-history.component.d.ts +51 -0
- package/customer/components/customer-list/customer-list-bulk-actions.d.ts +1 -0
- package/customer/components/customer-list/customer-list.component.d.ts +12 -0
- package/customer/components/customer-status-label/customer-status-label.component.d.ts +7 -0
- package/customer/components/select-customer-group-dialog/select-customer-group-dialog.component.d.ts +16 -0
- package/customer/customer.module.d.ts +24 -0
- package/customer/customer.routes.d.ts +4 -0
- package/customer/index.d.ts +5 -0
- package/customer/public_api.d.ts +18 -0
- package/dashboard/components/dashboard/dashboard.component.d.ts +34 -0
- package/dashboard/components/dashboard-widget/dashboard-widget.component.d.ts +13 -0
- package/dashboard/dashboard.module.d.ts +13 -0
- package/dashboard/dashboard.routes.d.ts +2 -0
- package/dashboard/default-widgets.d.ts +5 -0
- package/dashboard/index.d.ts +5 -0
- package/dashboard/public_api.d.ts +10 -0
- package/dashboard/widgets/latest-orders-widget/latest-orders-widget.component.d.ts +18 -0
- package/dashboard/widgets/order-chart-widget/order-chart-widget.component.d.ts +17 -0
- package/dashboard/widgets/order-summary-widget/order-summary-widget.component.d.ts +32 -0
- package/dashboard/widgets/test-widget/test-widget.component.d.ts +10 -0
- package/dashboard/widgets/welcome-widget/welcome-widget.component.d.ts +22 -0
- package/esm2022/catalog/catalog.module.mjs +331 -0
- package/esm2022/catalog/catalog.routes.mjs +144 -0
- package/esm2022/catalog/components/apply-facet-dialog/apply-facet-dialog.component.mjs +30 -0
- package/esm2022/catalog/components/asset-detail/asset-detail.component.mjs +77 -0
- package/esm2022/catalog/components/asset-list/asset-list.component.mjs +120 -0
- package/esm2022/catalog/components/assign-products-to-channel-dialog/assign-products-to-channel-dialog.component.mjs +102 -0
- package/esm2022/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.component.mjs +83 -0
- package/esm2022/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.graphql.mjs +69 -0
- package/esm2022/catalog/components/collection-contents/collection-contents.component.mjs +124 -0
- package/esm2022/catalog/components/collection-data-table/collection-data-table.component.mjs +95 -0
- package/esm2022/catalog/components/collection-detail/collection-detail.component.mjs +263 -0
- package/esm2022/catalog/components/collection-list/collection-breadcrumb.pipe.mjs +19 -0
- package/esm2022/catalog/components/collection-list/collection-list-bulk-actions.mjs +97 -0
- package/esm2022/catalog/components/collection-list/collection-list.component.mjs +157 -0
- package/esm2022/catalog/components/collection-tree/array-to-tree.mjs +56 -0
- package/esm2022/catalog/components/collection-tree/collection-tree-node.component.mjs +125 -0
- package/esm2022/catalog/components/collection-tree/collection-tree.component.mjs +49 -0
- package/esm2022/catalog/components/collection-tree/collection-tree.service.mjs +68 -0
- package/esm2022/catalog/components/collection-tree/collection-tree.types.mjs +2 -0
- package/esm2022/catalog/components/confirm-variant-deletion-dialog/confirm-variant-deletion-dialog.component.mjs +23 -0
- package/esm2022/catalog/components/create-facet-value-dialog/create-facet-value-dialog.component.mjs +44 -0
- package/esm2022/catalog/components/create-product-option-group-dialog/create-product-option-group-dialog.component.mjs +44 -0
- package/esm2022/catalog/components/create-product-variant-dialog/create-product-variant-dialog.component.mjs +80 -0
- package/esm2022/catalog/components/facet-detail/facet-detail.component.mjs +338 -0
- package/esm2022/catalog/components/facet-list/facet-list-bulk-actions.mjs +148 -0
- package/esm2022/catalog/components/facet-list/facet-list.component.mjs +91 -0
- package/esm2022/catalog/components/generate-product-variants/generate-product-variants.component.mjs +133 -0
- package/esm2022/catalog/components/move-collections-dialog/move-collections-dialog.component.mjs +100 -0
- package/esm2022/catalog/components/option-value-input/option-value-input.component.mjs +156 -0
- package/esm2022/catalog/components/product-detail/product-detail.component.mjs +321 -0
- package/esm2022/catalog/components/product-list/product-list-bulk-actions.mjs +144 -0
- package/esm2022/catalog/components/product-list/product-list.component.mjs +159 -0
- package/esm2022/catalog/components/product-list/product-list.graphql.mjs +37 -0
- package/esm2022/catalog/components/product-options-editor/product-options-editor.component.mjs +207 -0
- package/esm2022/catalog/components/product-variant-detail/product-variant-detail.component.mjs +266 -0
- package/esm2022/catalog/components/product-variant-detail/product-variant-detail.graphql.mjs +129 -0
- package/esm2022/catalog/components/product-variant-list/product-variant-list-bulk-actions.mjs +123 -0
- package/esm2022/catalog/components/product-variant-list/product-variant-list.component.mjs +118 -0
- package/esm2022/catalog/components/product-variant-list/product-variant-list.graphql.mjs +51 -0
- package/esm2022/catalog/components/product-variant-quick-jump/product-variant-quick-jump.component.mjs +53 -0
- package/esm2022/catalog/components/product-variants-editor/product-variants-editor.component.mjs +292 -0
- package/esm2022/catalog/components/product-variants-table/product-variants-table.component.mjs +72 -0
- package/esm2022/catalog/components/update-product-option-dialog/update-product-option-dialog.component.mjs +64 -0
- package/esm2022/catalog/components/variant-price-detail/variant-price-detail.component.mjs +59 -0
- package/esm2022/catalog/components/variant-price-strategy-detail/variant-price-strategy-detail.component.mjs +33 -0
- package/esm2022/catalog/deenruv-admin-ui-catalog.mjs +5 -0
- package/esm2022/catalog/providers/product-detail/product-detail.service.mjs +236 -0
- package/esm2022/catalog/providers/product-detail/replace-last.mjs +18 -0
- package/esm2022/catalog/providers/routing/product-variants-resolver.mjs +28 -0
- package/esm2022/catalog/public_api.mjs +50 -0
- package/esm2022/core/app.component.mjs +94 -0
- package/esm2022/core/app.component.module.mjs +19 -0
- package/esm2022/core/app.config.mjs +11 -0
- package/esm2022/core/common/base-detail.component.mjs +208 -0
- package/esm2022/core/common/base-entity-resolver.mjs +60 -0
- package/esm2022/core/common/base-list.component.mjs +186 -0
- package/esm2022/core/common/component-registry-types.mjs +2 -0
- package/esm2022/core/common/deactivate-aware.mjs +2 -0
- package/esm2022/core/common/detail-breadcrumb.mjs +26 -0
- package/esm2022/core/common/generated-types.mjs +1371 -0
- package/esm2022/core/common/introspection-result-wrapper.mjs +3 -0
- package/esm2022/core/common/introspection-result.mjs +329 -0
- package/esm2022/core/common/single-search-selection-model.mjs +51 -0
- package/esm2022/core/common/title-setter.mjs +14 -0
- package/esm2022/core/common/utilities/bulk-action-utils.mjs +271 -0
- package/esm2022/core/common/utilities/configurable-operation-utils.mjs +116 -0
- package/esm2022/core/common/utilities/create-updated-translatable.mjs +58 -0
- package/esm2022/core/common/utilities/custom-field-default-value.mjs +28 -0
- package/esm2022/core/common/utilities/find-translation.mjs +9 -0
- package/esm2022/core/common/utilities/get-default-ui-language.mjs +12 -0
- package/esm2022/core/common/utilities/interpolate-description.mjs +27 -0
- package/esm2022/core/common/utilities/selection-manager.mjs +96 -0
- package/esm2022/core/common/utilities/string-to-color.mjs +36 -0
- package/esm2022/core/common/version.mjs +3 -0
- package/esm2022/core/components/alerts/alerts.component.mjs +26 -0
- package/esm2022/core/components/app-shell/app-shell.component.mjs +104 -0
- package/esm2022/core/components/base-nav/base-nav.component.mjs +298 -0
- package/esm2022/core/components/breadcrumb/breadcrumb.component.mjs +33 -0
- package/esm2022/core/components/channel-switcher/channel-switcher.component.mjs +50 -0
- package/esm2022/core/components/main-nav/main-nav.component.mjs +62 -0
- package/esm2022/core/components/notification/notification.component.mjs +85 -0
- package/esm2022/core/components/overlay-host/overlay-host.component.mjs +22 -0
- package/esm2022/core/components/settings-nav/settings-nav.component.mjs +27 -0
- package/esm2022/core/components/theme-switcher/theme-switcher.component.mjs +39 -0
- package/esm2022/core/components/ui-language-switcher-dialog/ui-language-switcher-dialog.component.mjs +75 -0
- package/esm2022/core/components/user-menu/user-menu.component.mjs +37 -0
- package/esm2022/core/core.module.mjs +165 -0
- package/esm2022/core/data/check-jobs-link.mjs +32 -0
- package/esm2022/core/data/client-state/client-defaults.mjs +33 -0
- package/esm2022/core/data/client-state/client-resolvers.mjs +136 -0
- package/esm2022/core/data/data.module.mjs +135 -0
- package/esm2022/core/data/definitions/administrator-definitions.mjs +135 -0
- package/esm2022/core/data/definitions/auth-definitions.mjs +40 -0
- package/esm2022/core/data/definitions/client-definitions.mjs +137 -0
- package/esm2022/core/data/definitions/collection-definitions.mjs +184 -0
- package/esm2022/core/data/definitions/customer-definitions.mjs +261 -0
- package/esm2022/core/data/definitions/facet-definitions.mjs +155 -0
- package/esm2022/core/data/definitions/order-definitions.mjs +594 -0
- package/esm2022/core/data/definitions/product-definitions.mjs +828 -0
- package/esm2022/core/data/definitions/promotion-definitions.mjs +76 -0
- package/esm2022/core/data/definitions/settings-definitions.mjs +735 -0
- package/esm2022/core/data/definitions/shared-definitions.mjs +33 -0
- package/esm2022/core/data/definitions/shipping-definitions.mjs +98 -0
- package/esm2022/core/data/omit-typename-link.mjs +20 -0
- package/esm2022/core/data/providers/administrator-data.service.mjs +53 -0
- package/esm2022/core/data/providers/auth-data.service.mjs +20 -0
- package/esm2022/core/data/providers/base-data.service.mjs +66 -0
- package/esm2022/core/data/providers/client-data.service.mjs +82 -0
- package/esm2022/core/data/providers/collection-data.service.mjs +84 -0
- package/esm2022/core/data/providers/customer-data.service.mjs +125 -0
- package/esm2022/core/data/providers/data.service.mjs +90 -0
- package/esm2022/core/data/providers/facet-data.service.mjs +63 -0
- package/esm2022/core/data/providers/fetch-adapter.mjs +34 -0
- package/esm2022/core/data/providers/interceptor.mjs +162 -0
- package/esm2022/core/data/providers/order-data.service.mjs +135 -0
- package/esm2022/core/data/providers/product-data.service.mjs +257 -0
- package/esm2022/core/data/providers/promotion-data.service.mjs +50 -0
- package/esm2022/core/data/providers/settings-data.service.mjs +246 -0
- package/esm2022/core/data/providers/shipping-method-data.service.mjs +58 -0
- package/esm2022/core/data/query-result.mjs +77 -0
- package/esm2022/core/data/server-config.mjs +78 -0
- package/esm2022/core/data/utils/add-custom-fields.mjs +84 -0
- package/esm2022/core/data/utils/get-server-location.mjs +17 -0
- package/esm2022/core/data/utils/is-entity-create-or-update-mutation.mjs +45 -0
- package/esm2022/core/data/utils/remove-readonly-custom-fields.mjs +30 -0
- package/esm2022/core/data/utils/transform-relation-custom-field-inputs.mjs +46 -0
- package/esm2022/core/deenruv-admin-ui-core.mjs +5 -0
- package/esm2022/core/extension/add-action-bar-dropdown-menu-item.mjs +35 -0
- package/esm2022/core/extension/add-action-bar-item.mjs +31 -0
- package/esm2022/core/extension/add-nav-menu-item.mjs +75 -0
- package/esm2022/core/extension/components/angular-route.component.mjs +67 -0
- package/esm2022/core/extension/components/route.component.mjs +80 -0
- package/esm2022/core/extension/providers/page-metadata.service.mjs +20 -0
- package/esm2022/core/extension/register-alert.mjs +22 -0
- package/esm2022/core/extension/register-bulk-action.mjs +59 -0
- package/esm2022/core/extension/register-custom-detail-component.mjs +65 -0
- package/esm2022/core/extension/register-dashboard-widget.mjs +36 -0
- package/esm2022/core/extension/register-data-table-component.mjs +51 -0
- package/esm2022/core/extension/register-form-input-component.mjs +61 -0
- package/esm2022/core/extension/register-history-entry-component.mjs +76 -0
- package/esm2022/core/extension/register-page-tab.mjs +36 -0
- package/esm2022/core/extension/register-route-component.mjs +95 -0
- package/esm2022/core/extension/types.mjs +2 -0
- package/esm2022/core/providers/alerts/alerts.service.mjs +114 -0
- package/esm2022/core/providers/auth/auth.service.mjs +124 -0
- package/esm2022/core/providers/breadcrumb/breadcrumb.service.mjs +109 -0
- package/esm2022/core/providers/bulk-action-registry/bulk-action-registry.service.mjs +28 -0
- package/esm2022/core/providers/bulk-action-registry/bulk-action-types.mjs +2 -0
- package/esm2022/core/providers/channel/channel.service.mjs +39 -0
- package/esm2022/core/providers/component-registry/component-registry.service.mjs +25 -0
- package/esm2022/core/providers/currency/currency.service.mjs +21 -0
- package/esm2022/core/providers/custom-detail-component/custom-detail-component-types.mjs +2 -0
- package/esm2022/core/providers/custom-detail-component/custom-detail-component.service.mjs +27 -0
- package/esm2022/core/providers/custom-field-component/custom-field-component.service.mjs +38 -0
- package/esm2022/core/providers/custom-history-entry-component/history-entry-component-types.mjs +2 -0
- package/esm2022/core/providers/custom-history-entry-component/history-entry-component.service.mjs +22 -0
- package/esm2022/core/providers/dashboard-widget/dashboard-widget-types.mjs +2 -0
- package/esm2022/core/providers/dashboard-widget/dashboard-widget.service.mjs +91 -0
- package/esm2022/core/providers/data-table/data-table-filter-collection.mjs +295 -0
- package/esm2022/core/providers/data-table/data-table-filter.mjs +114 -0
- package/esm2022/core/providers/data-table/data-table-sort-collection.mjs +115 -0
- package/esm2022/core/providers/data-table/data-table-sort.mjs +34 -0
- package/esm2022/core/providers/guard/auth.guard.mjs +38 -0
- package/esm2022/core/providers/health-check/health-check.service.mjs +34 -0
- package/esm2022/core/providers/i18n/custom-http-loader.mjs +39 -0
- package/esm2022/core/providers/i18n/custom-message-format-compiler.mjs +31 -0
- package/esm2022/core/providers/i18n/i18n.service.mjs +78 -0
- package/esm2022/core/providers/job-queue/job-queue.service.mjs +91 -0
- package/esm2022/core/providers/local-storage/local-storage.service.mjs +97 -0
- package/esm2022/core/providers/localization/localization.service.mjs +31 -0
- package/esm2022/core/providers/modal/modal.service.mjs +96 -0
- package/esm2022/core/providers/modal/modal.types.mjs +2 -0
- package/esm2022/core/providers/nav-builder/nav-builder-types.mjs +2 -0
- package/esm2022/core/providers/nav-builder/nav-builder.service.mjs +174 -0
- package/esm2022/core/providers/notification/notification.service.mjs +157 -0
- package/esm2022/core/providers/overlay-host/overlay-host.service.mjs +48 -0
- package/esm2022/core/providers/page/page.service.mjs +63 -0
- package/esm2022/core/providers/permissions/permissions.service.mjs +46 -0
- package/esm2022/core/public_api.mjs +315 -0
- package/esm2022/core/shared/components/action-bar/action-bar.component.mjs +54 -0
- package/esm2022/core/shared/components/action-bar-dropdown-menu/action-bar-dropdown-menu.component.mjs +69 -0
- package/esm2022/core/shared/components/action-bar-items/action-bar-base.component.mjs +72 -0
- package/esm2022/core/shared/components/action-bar-items/action-bar-items.component.mjs +50 -0
- package/esm2022/core/shared/components/address-form/address-form.component.mjs +24 -0
- package/esm2022/core/shared/components/affixed-input/affixed-input.component.mjs +19 -0
- package/esm2022/core/shared/components/affixed-input/percentage-suffix-input.component.mjs +86 -0
- package/esm2022/core/shared/components/asset-file-input/asset-file-input.component.mjs +97 -0
- package/esm2022/core/shared/components/asset-gallery/asset-gallery.component.mjs +96 -0
- package/esm2022/core/shared/components/asset-gallery/asset-gallery.types.mjs +2 -0
- package/esm2022/core/shared/components/asset-picker-dialog/asset-picker-dialog.component.mjs +144 -0
- package/esm2022/core/shared/components/asset-preview/asset-preview.component.mjs +229 -0
- package/esm2022/core/shared/components/asset-preview-dialog/asset-preview-dialog.component.mjs +49 -0
- package/esm2022/core/shared/components/asset-preview-links/asset-preview-links.component.mjs +25 -0
- package/esm2022/core/shared/components/asset-search-input/asset-search-input.component.mjs +102 -0
- package/esm2022/core/shared/components/assets/assets.component.mjs +109 -0
- package/esm2022/core/shared/components/assign-to-channel-dialog/assign-to-channel-dialog.component.mjs +56 -0
- package/esm2022/core/shared/components/bulk-action-menu/bulk-action-menu.component.mjs +100 -0
- package/esm2022/core/shared/components/card/card.component.mjs +32 -0
- package/esm2022/core/shared/components/channel-assignment-control/channel-assignment-control.component.mjs +116 -0
- package/esm2022/core/shared/components/channel-badge/channel-badge.component.mjs +19 -0
- package/esm2022/core/shared/components/chart/chart.component.mjs +100 -0
- package/esm2022/core/shared/components/chart/tooltip-plugin.mjs +143 -0
- package/esm2022/core/shared/components/chip/chip.component.mjs +47 -0
- package/esm2022/core/shared/components/configurable-input/configurable-input.component.mjs +161 -0
- package/esm2022/core/shared/components/currency-code-selector/currency-code-selector.component.mjs +64 -0
- package/esm2022/core/shared/components/currency-input/currency-input.component.mjs +155 -0
- package/esm2022/core/shared/components/custom-detail-component-host/custom-detail-component-host.component.mjs +44 -0
- package/esm2022/core/shared/components/custom-field-control/custom-field-control.component.mjs +88 -0
- package/esm2022/core/shared/components/customer-label/customer-label.component.mjs +17 -0
- package/esm2022/core/shared/components/data-table/data-table-column.component.mjs +29 -0
- package/esm2022/core/shared/components/data-table/data-table.component.mjs +177 -0
- package/esm2022/core/shared/components/data-table-2/data-table-column.component.mjs +64 -0
- package/esm2022/core/shared/components/data-table-2/data-table-custom-component.service.mjs +26 -0
- package/esm2022/core/shared/components/data-table-2/data-table-custom-field-column.component.mjs +52 -0
- package/esm2022/core/shared/components/data-table-2/data-table-search.component.mjs +21 -0
- package/esm2022/core/shared/components/data-table-2/data-table2.component.mjs +308 -0
- package/esm2022/core/shared/components/data-table-column-picker/data-table-column-picker.component.mjs +44 -0
- package/esm2022/core/shared/components/data-table-filter-label/data-table-filter-label.component.mjs +32 -0
- package/esm2022/core/shared/components/data-table-filter-presets/add-filter-preset-button.component.mjs +69 -0
- package/esm2022/core/shared/components/data-table-filter-presets/data-table-filter-presets.component.mjs +80 -0
- package/esm2022/core/shared/components/data-table-filter-presets/filter-preset.service.mjs +79 -0
- package/esm2022/core/shared/components/data-table-filter-presets/rename-filter-preset-dialog.component.mjs +20 -0
- package/esm2022/core/shared/components/data-table-filters/custom-filter-component.directive.mjs +16 -0
- package/esm2022/core/shared/components/data-table-filters/data-table-filters.component.mjs +220 -0
- package/esm2022/core/shared/components/datetime-picker/constants.mjs +20 -0
- package/esm2022/core/shared/components/datetime-picker/datetime-picker.component.mjs +226 -0
- package/esm2022/core/shared/components/datetime-picker/datetime-picker.service.mjs +201 -0
- package/esm2022/core/shared/components/datetime-picker/types.mjs +2 -0
- package/esm2022/core/shared/components/dropdown/dropdown-item.directive.mjs +28 -0
- package/esm2022/core/shared/components/dropdown/dropdown-menu.component.mjs +202 -0
- package/esm2022/core/shared/components/dropdown/dropdown-trigger.directive.mjs +25 -0
- package/esm2022/core/shared/components/dropdown/dropdown.component.mjs +58 -0
- package/esm2022/core/shared/components/duplicate-entity-dialog/duplicate-entity-dialog.component.mjs +111 -0
- package/esm2022/core/shared/components/duplicate-entity-dialog/duplicate-entity-dialog.graphql.mjs +38 -0
- package/esm2022/core/shared/components/edit-note-dialog/edit-note-dialog.component.mjs +32 -0
- package/esm2022/core/shared/components/empty-placeholder/empty-placeholder.component.mjs +16 -0
- package/esm2022/core/shared/components/entity-info/entity-info.component.mjs +26 -0
- package/esm2022/core/shared/components/extension-host/extension-host-config.mjs +7 -0
- package/esm2022/core/shared/components/extension-host/extension-host.component.mjs +81 -0
- package/esm2022/core/shared/components/extension-host/extension-host.service.mjs +99 -0
- package/esm2022/core/shared/components/extension-host/host-external-frame.mjs +41 -0
- package/esm2022/core/shared/components/facet-value-chip/facet-value-chip.component.mjs +26 -0
- package/esm2022/core/shared/components/facet-value-selector/facet-value-selector.component.mjs +150 -0
- package/esm2022/core/shared/components/focal-point-control/focal-point-control.component.mjs +71 -0
- package/esm2022/core/shared/components/form-field/form-field-control.directive.mjs +37 -0
- package/esm2022/core/shared/components/form-field/form-field.component.mjs +73 -0
- package/esm2022/core/shared/components/form-item/form-item.component.mjs +21 -0
- package/esm2022/core/shared/components/formatted-address/formatted-address.component.mjs +38 -0
- package/esm2022/core/shared/components/help-tooltip/help-tooltip.component.mjs +16 -0
- package/esm2022/core/shared/components/history-entry-detail/history-entry-detail.component.mjs +16 -0
- package/esm2022/core/shared/components/items-per-page-controls/items-per-page-controls.component.mjs +28 -0
- package/esm2022/core/shared/components/labeled-data/labeled-data.component.mjs +13 -0
- package/esm2022/core/shared/components/language-code-selector/language-code-selector.component.mjs +72 -0
- package/esm2022/core/shared/components/language-selector/language-selector.component.mjs +30 -0
- package/esm2022/core/shared/components/localized-text/localized-text.component.mjs +24 -0
- package/esm2022/core/shared/components/manage-tags-dialog/manage-tags-dialog.component.mjs +61 -0
- package/esm2022/core/shared/components/modal-dialog/dialog-buttons.directive.mjs +23 -0
- package/esm2022/core/shared/components/modal-dialog/dialog-component-outlet.component.mjs +29 -0
- package/esm2022/core/shared/components/modal-dialog/dialog-title.directive.mjs +23 -0
- package/esm2022/core/shared/components/modal-dialog/modal-dialog.component.mjs +69 -0
- package/esm2022/core/shared/components/object-tree/object-tree.component.mjs +56 -0
- package/esm2022/core/shared/components/order-state-label/order-state-label.component.mjs +47 -0
- package/esm2022/core/shared/components/page/page.component.mjs +38 -0
- package/esm2022/core/shared/components/page-block/page-block.component.mjs +11 -0
- package/esm2022/core/shared/components/page-body/page-body.component.mjs +11 -0
- package/esm2022/core/shared/components/page-detail-layout/page-detail-layout.component.mjs +11 -0
- package/esm2022/core/shared/components/page-detail-layout/page-detail-sidebar.component.mjs +15 -0
- package/esm2022/core/shared/components/page-entity-info/page-entity-info.component.mjs +16 -0
- package/esm2022/core/shared/components/page-header/page-header.component.mjs +11 -0
- package/esm2022/core/shared/components/page-header-description/page-header-description.component.mjs +11 -0
- package/esm2022/core/shared/components/page-header-tabs/page-header-tabs.component.mjs +26 -0
- package/esm2022/core/shared/components/page-title/page-title.component.mjs +40 -0
- package/esm2022/core/shared/components/pagination-controls/pagination-controls.component.mjs +26 -0
- package/esm2022/core/shared/components/product-multi-selector-dialog/product-multi-selector-dialog.component.mjs +138 -0
- package/esm2022/core/shared/components/product-multi-selector-dialog/product-multi-selector-dialog.graphql.mjs +44 -0
- package/esm2022/core/shared/components/product-search-input/product-search-input.component.mjs +104 -0
- package/esm2022/core/shared/components/product-variant-selector/product-variant-selector.component.mjs +62 -0
- package/esm2022/core/shared/components/radio-card/radio-card-fieldset.component.mjs +54 -0
- package/esm2022/core/shared/components/radio-card/radio-card.component.mjs +53 -0
- package/esm2022/core/shared/components/rich-text-editor/external-image-dialog/external-image-dialog.component.mjs +37 -0
- package/esm2022/core/shared/components/rich-text-editor/link-dialog/link-dialog.component.mjs +35 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.component.mjs +136 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.service.mjs +44 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/custom-nodes.mjs +97 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/inputrules.mjs +61 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/keymap.mjs +118 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/menu/links.mjs +69 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/menu/menu-common.mjs +41 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/menu/menu-plugin.mjs +12 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/menu/menu.mjs +247 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/menu/sub-menu-with-icon.mjs +16 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/plugins/image-plugin.mjs +98 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/plugins/link-select-plugin.mjs +22 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/plugins/raw-editor-plugin.mjs +96 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/plugins/tables-plugin.mjs +164 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/prosemirror.service.mjs +155 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/types.mjs +2 -0
- package/esm2022/core/shared/components/rich-text-editor/prosemirror/utils.mjs +26 -0
- package/esm2022/core/shared/components/rich-text-editor/raw-html-dialog/raw-html-dialog.component.mjs +59 -0
- package/esm2022/core/shared/components/rich-text-editor/rich-text-editor.component.mjs +106 -0
- package/esm2022/core/shared/components/select-toggle/select-toggle.component.mjs +35 -0
- package/esm2022/core/shared/components/simple-dialog/simple-dialog.component.mjs +24 -0
- package/esm2022/core/shared/components/split-view/split-view.component.mjs +62 -0
- package/esm2022/core/shared/components/split-view/split-view.directive.mjs +28 -0
- package/esm2022/core/shared/components/status-badge/status-badge.component.mjs +16 -0
- package/esm2022/core/shared/components/tabbed-custom-fields/tabbed-custom-fields.component.mjs +70 -0
- package/esm2022/core/shared/components/table-row-action/table-row-action.component.mjs +28 -0
- package/esm2022/core/shared/components/tag-selector/tag-selector.component.mjs +60 -0
- package/esm2022/core/shared/components/timeline-entry/timeline-entry.component.mjs +54 -0
- package/esm2022/core/shared/components/title-input/title-input.component.mjs +21 -0
- package/esm2022/core/shared/components/ui-extension-point/ui-extension-point.component.mjs +142 -0
- package/esm2022/core/shared/components/zone-selector/zone-selector.component.mjs +99 -0
- package/esm2022/core/shared/directives/disabled.directive.mjs +41 -0
- package/esm2022/core/shared/directives/if-default-channel-active.directive.mjs +37 -0
- package/esm2022/core/shared/directives/if-directive-base.mjs +73 -0
- package/esm2022/core/shared/directives/if-multichannel.directive.mjs +43 -0
- package/esm2022/core/shared/directives/if-permissions.directive.mjs +66 -0
- package/esm2022/core/shared/dynamic-form-inputs/boolean-form-input/boolean-form-input.component.mjs +23 -0
- package/esm2022/core/shared/dynamic-form-inputs/code-editor-form-input/base-code-editor-form-input.component.mjs +62 -0
- package/esm2022/core/shared/dynamic-form-inputs/code-editor-form-input/html-editor-form-input.component.mjs +59 -0
- package/esm2022/core/shared/dynamic-form-inputs/code-editor-form-input/json-editor-form-input.component.mjs +85 -0
- package/esm2022/core/shared/dynamic-form-inputs/combination-mode-form-input/combination-mode-form-input.component.mjs +45 -0
- package/esm2022/core/shared/dynamic-form-inputs/currency-form-input/currency-form-input.component.mjs +32 -0
- package/esm2022/core/shared/dynamic-form-inputs/customer-group-form-input/customer-group-form-input.component.mjs +47 -0
- package/esm2022/core/shared/dynamic-form-inputs/date-form-input/date-form-input.component.mjs +32 -0
- package/esm2022/core/shared/dynamic-form-inputs/default-form-inputs.mjs +44 -0
- package/esm2022/core/shared/dynamic-form-inputs/dynamic-form-input/dynamic-form-input.component.mjs +271 -0
- package/esm2022/core/shared/dynamic-form-inputs/facet-value-form-input/facet-value-form-input.component.mjs +34 -0
- package/esm2022/core/shared/dynamic-form-inputs/number-form-input/number-form-input.component.mjs +39 -0
- package/esm2022/core/shared/dynamic-form-inputs/password-form-input/password-form-input.component.mjs +21 -0
- package/esm2022/core/shared/dynamic-form-inputs/product-multi-selector-form-input/product-multi-selector-form-input.component.mjs +49 -0
- package/esm2022/core/shared/dynamic-form-inputs/product-selector-form-input/product-selector-form-input.component.mjs +66 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/asset/relation-asset-input.component.mjs +84 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/customer/relation-customer-input.component.mjs +66 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/generic/relation-generic-input.component.mjs +54 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/product/relation-product-input.component.mjs +87 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/product-variant/relation-product-variant-input.component.mjs +87 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/relation-card/relation-card.component.mjs +60 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/relation-form-input.component.mjs +29 -0
- package/esm2022/core/shared/dynamic-form-inputs/relation-form-input/relation-selector-dialog/relation-selector-dialog.component.mjs +14 -0
- package/esm2022/core/shared/dynamic-form-inputs/rich-text-form-input/rich-text-form-input.component.mjs +21 -0
- package/esm2022/core/shared/dynamic-form-inputs/select-form-input/select-form-input.component.mjs +40 -0
- package/esm2022/core/shared/dynamic-form-inputs/text-form-input/text-form-input.component.mjs +28 -0
- package/esm2022/core/shared/dynamic-form-inputs/textarea-form-input/textarea-form-input.component.mjs +24 -0
- package/esm2022/core/shared/pipes/asset-preview.pipe.mjs +42 -0
- package/esm2022/core/shared/pipes/channel-label.pipe.mjs +23 -0
- package/esm2022/core/shared/pipes/custom-field-description.pipe.mjs +30 -0
- package/esm2022/core/shared/pipes/custom-field-label.pipe.mjs +39 -0
- package/esm2022/core/shared/pipes/duration.pipe.mjs +49 -0
- package/esm2022/core/shared/pipes/file-size.pipe.mjs +47 -0
- package/esm2022/core/shared/pipes/has-permission.pipe.mjs +54 -0
- package/esm2022/core/shared/pipes/locale-base.pipe.mjs +55 -0
- package/esm2022/core/shared/pipes/locale-currency-name.pipe.mjs +60 -0
- package/esm2022/core/shared/pipes/locale-currency.pipe.mjs +56 -0
- package/esm2022/core/shared/pipes/locale-date.pipe.mjs +90 -0
- package/esm2022/core/shared/pipes/locale-language-name.pipe.mjs +51 -0
- package/esm2022/core/shared/pipes/locale-region-name.pipe.mjs +51 -0
- package/esm2022/core/shared/pipes/sentence-case.pipe.mjs +30 -0
- package/esm2022/core/shared/pipes/sort.pipe.mjs +34 -0
- package/esm2022/core/shared/pipes/state-i18n-token.pipe.mjs +54 -0
- package/esm2022/core/shared/pipes/string-to-color.pipe.mjs +18 -0
- package/esm2022/core/shared/pipes/time-ago.pipe.mjs +52 -0
- package/esm2022/core/shared/providers/routing/can-deactivate-detail-guard.mjs +33 -0
- package/esm2022/core/shared/shared.module.mjs +707 -0
- package/esm2022/core/validators/unicode-pattern.validator.mjs +8 -0
- package/esm2022/customer/components/add-customer-to-group-dialog/add-customer-to-group-dialog.component.mjs +39 -0
- package/esm2022/customer/components/address-card/address-card.component.mjs +97 -0
- package/esm2022/customer/components/address-detail-dialog/address-detail-dialog.component.mjs +28 -0
- package/esm2022/customer/components/customer-detail/customer-detail.component.mjs +441 -0
- package/esm2022/customer/components/customer-group-detail/customer-group-detail.component.mjs +90 -0
- package/esm2022/customer/components/customer-group-detail-dialog/customer-group-detail-dialog.component.mjs +46 -0
- package/esm2022/customer/components/customer-group-list/customer-group-list-bulk-actions.mjs +9 -0
- package/esm2022/customer/components/customer-group-list/customer-group-list.component.mjs +148 -0
- package/esm2022/customer/components/customer-group-member-list/customer-group-member-list-bulk-actions.mjs +27 -0
- package/esm2022/customer/components/customer-group-member-list/customer-group-member-list.component.mjs +91 -0
- package/esm2022/customer/components/customer-history/customer-history-entry-host.component.mjs +62 -0
- package/esm2022/customer/components/customer-history/customer-history.component.mjs +89 -0
- package/esm2022/customer/components/customer-list/customer-list-bulk-actions.mjs +9 -0
- package/esm2022/customer/components/customer-list/customer-list.component.mjs +108 -0
- package/esm2022/customer/components/customer-status-label/customer-status-label.component.mjs +17 -0
- package/esm2022/customer/components/select-customer-group-dialog/select-customer-group-dialog.component.mjs +31 -0
- package/esm2022/customer/customer.module.mjs +146 -0
- package/esm2022/customer/customer.routes.mjs +50 -0
- package/esm2022/customer/deenruv-admin-ui-customer.mjs +5 -0
- package/esm2022/customer/public_api.mjs +20 -0
- package/esm2022/dashboard/components/dashboard/dashboard.component.mjs +124 -0
- package/esm2022/dashboard/components/dashboard-widget/dashboard-widget.component.mjs +32 -0
- package/esm2022/dashboard/dashboard.module.mjs +34 -0
- package/esm2022/dashboard/dashboard.routes.mjs +9 -0
- package/esm2022/dashboard/deenruv-admin-ui-dashboard.mjs +5 -0
- package/esm2022/dashboard/default-widgets.mjs +31 -0
- package/esm2022/dashboard/public_api.mjs +12 -0
- package/esm2022/dashboard/widgets/latest-orders-widget/latest-orders-widget.component.mjs +73 -0
- package/esm2022/dashboard/widgets/order-chart-widget/order-chart-widget.component.mjs +66 -0
- package/esm2022/dashboard/widgets/order-summary-widget/order-summary-widget.component.mjs +68 -0
- package/esm2022/dashboard/widgets/test-widget/test-widget.component.mjs +22 -0
- package/esm2022/dashboard/widgets/welcome-widget/welcome-widget.component.mjs +39 -0
- package/esm2022/deenruv-admin-ui.mjs +5 -0
- package/esm2022/login/components/login/login.component.mjs +97 -0
- package/esm2022/login/deenruv-admin-ui-login.mjs +5 -0
- package/esm2022/login/login.module.mjs +21 -0
- package/esm2022/login/login.routes.mjs +11 -0
- package/esm2022/login/providers/login.guard.mjs +31 -0
- package/esm2022/login/public_api.mjs +6 -0
- package/esm2022/marketing/components/promotion-detail/promotion-detail.component.mjs +269 -0
- package/esm2022/marketing/components/promotion-list/promotion-list-bulk-actions.mjs +78 -0
- package/esm2022/marketing/components/promotion-list/promotion-list.component.mjs +128 -0
- package/esm2022/marketing/deenruv-admin-ui-marketing.mjs +5 -0
- package/esm2022/marketing/marketing.module.mjs +75 -0
- package/esm2022/marketing/marketing.routes.mjs +32 -0
- package/esm2022/marketing/public_api.mjs +7 -0
- package/esm2022/order/common/get-refundable-payments.mjs +19 -0
- package/esm2022/order/common/modify-order-types.mjs +2 -0
- package/esm2022/order/components/add-manual-payment-dialog/add-manual-payment-dialog.component.mjs +61 -0
- package/esm2022/order/components/cancel-order-dialog/cancel-order-dialog.component.mjs +80 -0
- package/esm2022/order/components/coupon-code-selector/coupon-code-selector.component.mjs +62 -0
- package/esm2022/order/components/draft-order-detail/draft-order-detail.component.mjs +183 -0
- package/esm2022/order/components/draft-order-variant-selector/draft-order-variant-selector.component.mjs +59 -0
- package/esm2022/order/components/fulfill-order-dialog/fulfill-order-dialog.component.mjs +79 -0
- package/esm2022/order/components/fulfillment-card/fulfillment-card.component.mjs +48 -0
- package/esm2022/order/components/fulfillment-detail/fulfillment-detail.component.mjs +50 -0
- package/esm2022/order/components/fulfillment-state-label/fulfillment-state-label.component.mjs +28 -0
- package/esm2022/order/components/line-fulfillment/line-fulfillment.component.mjs +62 -0
- package/esm2022/order/components/line-refunds/line-refunds.component.mjs +28 -0
- package/esm2022/order/components/modification-detail/modification-detail.component.mjs +71 -0
- package/esm2022/order/components/order-custom-fields-card/order-custom-fields-card.component.mjs +64 -0
- package/esm2022/order/components/order-data-table/order-data-table.component.mjs +59 -0
- package/esm2022/order/components/order-data-table/order-total-column.component.mjs +20 -0
- package/esm2022/order/components/order-detail/order-detail.component.mjs +602 -0
- package/esm2022/order/components/order-editor/order-editor.component.mjs +485 -0
- package/esm2022/order/components/order-edits-preview-dialog/order-edits-preview-dialog.component.mjs +93 -0
- package/esm2022/order/components/order-history/order-history-entry-host.component.mjs +62 -0
- package/esm2022/order/components/order-history/order-history.component.mjs +184 -0
- package/esm2022/order/components/order-list/order-list.component.mjs +154 -0
- package/esm2022/order/components/order-modification-summary/order-modification-summary.component.mjs +76 -0
- package/esm2022/order/components/order-payment-card/order-payment-card.component.mjs +43 -0
- package/esm2022/order/components/order-process-graph/constants.mjs +2 -0
- package/esm2022/order/components/order-process-graph/order-process-edge.component.mjs +45 -0
- package/esm2022/order/components/order-process-graph/order-process-graph.component.mjs +96 -0
- package/esm2022/order/components/order-process-graph/order-process-node.component.mjs +53 -0
- package/esm2022/order/components/order-process-graph/types.mjs +2 -0
- package/esm2022/order/components/order-process-graph-dialog/order-process-graph-dialog.component.mjs +21 -0
- package/esm2022/order/components/order-state-select-dialog/order-state-select-dialog.component.mjs +28 -0
- package/esm2022/order/components/order-table/order-table.component.mjs +96 -0
- package/esm2022/order/components/payment-detail/payment-detail.component.mjs +18 -0
- package/esm2022/order/components/payment-for-refund-selector/payment-for-refund-selector.component.mjs +24 -0
- package/esm2022/order/components/payment-state-label/payment-state-label.component.mjs +28 -0
- package/esm2022/order/components/refund-detail/refund-detail.component.mjs +18 -0
- package/esm2022/order/components/refund-order-dialog/refund-order-dialog.component.mjs +173 -0
- package/esm2022/order/components/refund-state-label/refund-state-label.component.mjs +27 -0
- package/esm2022/order/components/select-address-dialog/select-address-dialog.component.mjs +89 -0
- package/esm2022/order/components/select-address-dialog/select-address-dialog.graphql.mjs +14 -0
- package/esm2022/order/components/select-customer-dialog/select-customer-dialog.component.mjs +65 -0
- package/esm2022/order/components/select-shipping-method-dialog/select-shipping-method-dialog.component.mjs +30 -0
- package/esm2022/order/components/seller-orders-card/seller-orders-card.component.mjs +39 -0
- package/esm2022/order/components/seller-orders-card/seller-orders-card.graphql.mjs +25 -0
- package/esm2022/order/components/settle-refund-dialog/settle-refund-dialog.component.mjs +24 -0
- package/esm2022/order/components/simple-item-list/simple-item-list.component.mjs +15 -0
- package/esm2022/order/deenruv-admin-ui-order.mjs +5 -0
- package/esm2022/order/order.module.mjs +244 -0
- package/esm2022/order/order.routes.mjs +56 -0
- package/esm2022/order/providers/order-transition.service.mjs +112 -0
- package/esm2022/order/providers/routing/order.guard.mjs +57 -0
- package/esm2022/order/public_api.mjs +53 -0
- package/esm2022/public_api.mjs +5 -0
- package/esm2022/react/components/react-custom-column.component.mjs +25 -0
- package/esm2022/react/components/react-custom-detail.component.mjs +23 -0
- package/esm2022/react/components/react-form-input.component.mjs +24 -0
- package/esm2022/react/components/react-route.component.mjs +26 -0
- package/esm2022/react/deenruv-admin-ui-react.mjs +5 -0
- package/esm2022/react/directives/react-component-host.directive.mjs +54 -0
- package/esm2022/react/public_api.mjs +27 -0
- package/esm2022/react/react-components/ActionBar.mjs +26 -0
- package/esm2022/react/react-components/Card.mjs +28 -0
- package/esm2022/react/react-components/CdsIcon.mjs +30 -0
- package/esm2022/react/react-components/FormField.mjs +28 -0
- package/esm2022/react/react-components/Link.mjs +30 -0
- package/esm2022/react/react-components/PageBlock.mjs +24 -0
- package/esm2022/react/react-components/PageDetailLayout.mjs +26 -0
- package/esm2022/react/react-components/RichTextEditor.mjs +73 -0
- package/esm2022/react/react-hooks/use-detail-component-data.mjs +48 -0
- package/esm2022/react/react-hooks/use-form-control.mjs +66 -0
- package/esm2022/react/react-hooks/use-injector.mjs +33 -0
- package/esm2022/react/react-hooks/use-page-metadata.mjs +41 -0
- package/esm2022/react/react-hooks/use-query.mjs +198 -0
- package/esm2022/react/react-hooks/use-rich-text-editor.mjs +50 -0
- package/esm2022/react/react-hooks/use-route-params.mjs +39 -0
- package/esm2022/react/register-react-custom-detail-component.mjs +33 -0
- package/esm2022/react/register-react-data-table-component.mjs +64 -0
- package/esm2022/react/register-react-form-input-component.mjs +27 -0
- package/esm2022/react/register-react-route-component.mjs +25 -0
- package/esm2022/react/types.mjs +2 -0
- package/esm2022/settings/components/add-country-to-zone-dialog/add-country-to-zone-dialog.component.mjs +57 -0
- package/esm2022/settings/components/admin-detail/admin-detail.component.mjs +205 -0
- package/esm2022/settings/components/administrator-list/administrator-list-bulk-actions.mjs +9 -0
- package/esm2022/settings/components/administrator-list/administrator-list.component.mjs +120 -0
- package/esm2022/settings/components/channel-detail/channel-detail.component.mjs +202 -0
- package/esm2022/settings/components/channel-list/channel-list-bulk-actions.mjs +16 -0
- package/esm2022/settings/components/channel-list/channel-list.component.mjs +81 -0
- package/esm2022/settings/components/country-detail/country-detail.component.mjs +126 -0
- package/esm2022/settings/components/country-list/country-list-bulk-actions.mjs +10 -0
- package/esm2022/settings/components/country-list/country-list.component.mjs +91 -0
- package/esm2022/settings/components/global-settings/global-settings.component.mjs +102 -0
- package/esm2022/settings/components/payment-method-detail/payment-method-detail.component.mjs +206 -0
- package/esm2022/settings/components/payment-method-list/payment-method-list-bulk-actions.mjs +56 -0
- package/esm2022/settings/components/payment-method-list/payment-method-list.component.mjs +99 -0
- package/esm2022/settings/components/permission-grid/permission-grid.component.mjs +81 -0
- package/esm2022/settings/components/profile/profile.component.mjs +96 -0
- package/esm2022/settings/components/role-detail/role-detail.component.mjs +119 -0
- package/esm2022/settings/components/role-list/role-list-bulk-actions.mjs +9 -0
- package/esm2022/settings/components/role-list/role-list.component.mjs +82 -0
- package/esm2022/settings/components/seller-detail/seller-detail.component.mjs +119 -0
- package/esm2022/settings/components/seller-list/seller-list-bulk-actions.mjs +9 -0
- package/esm2022/settings/components/seller-list/seller-list.component.mjs +75 -0
- package/esm2022/settings/components/shipping-eligibility-test-result/shipping-eligibility-test-result.component.mjs +30 -0
- package/esm2022/settings/components/shipping-method-detail/shipping-method-detail.component.mjs +256 -0
- package/esm2022/settings/components/shipping-method-list/shipping-method-list-bulk-actions.mjs +54 -0
- package/esm2022/settings/components/shipping-method-list/shipping-method-list.component.mjs +99 -0
- package/esm2022/settings/components/shipping-method-test-result/shipping-method-test-result.component.mjs +30 -0
- package/esm2022/settings/components/stock-location-detail/stock-location-detail.component.mjs +137 -0
- package/esm2022/settings/components/stock-location-list/stock-location-list-bulk-actions.mjs +68 -0
- package/esm2022/settings/components/stock-location-list/stock-location-list.component.mjs +87 -0
- package/esm2022/settings/components/tax-category-detail/tax-category-detail.component.mjs +114 -0
- package/esm2022/settings/components/tax-category-list/tax-category-list-bulk-actions.mjs +10 -0
- package/esm2022/settings/components/tax-category-list/tax-category-list.component.mjs +69 -0
- package/esm2022/settings/components/tax-rate-detail/tax-rate-detail.component.mjs +137 -0
- package/esm2022/settings/components/tax-rate-list/tax-rate-list-bulk-actions.mjs +10 -0
- package/esm2022/settings/components/tax-rate-list/tax-rate-list.component.mjs +83 -0
- package/esm2022/settings/components/test-address-form/test-address-form.component.mjs +48 -0
- package/esm2022/settings/components/test-order-builder/test-order-builder.component.mjs +71 -0
- package/esm2022/settings/components/test-shipping-methods/test-shipping-methods.component.mjs +52 -0
- package/esm2022/settings/components/zone-detail/zone-detail.component.mjs +117 -0
- package/esm2022/settings/components/zone-list/zone-list-bulk-actions.mjs +10 -0
- package/esm2022/settings/components/zone-list/zone-list.component.mjs +143 -0
- package/esm2022/settings/components/zone-member-list/zone-member-controls.directive.mjs +16 -0
- package/esm2022/settings/components/zone-member-list/zone-member-list-bulk-actions.mjs +26 -0
- package/esm2022/settings/components/zone-member-list/zone-member-list-header.directive.mjs +16 -0
- package/esm2022/settings/components/zone-member-list/zone-member-list.component.mjs +95 -0
- package/esm2022/settings/deenruv-admin-ui-settings.mjs +5 -0
- package/esm2022/settings/providers/routing/profile-resolver.mjs +30 -0
- package/esm2022/settings/public_api.mjs +51 -0
- package/esm2022/settings/settings.module.mjs +467 -0
- package/esm2022/settings/settings.routes.mjs +232 -0
- package/esm2022/system/components/health-check/health-check.component.mjs +18 -0
- package/esm2022/system/components/job-list/job-list.component.mjs +72 -0
- package/esm2022/system/components/job-state-label/job-state-label.component.mjs +46 -0
- package/esm2022/system/deenruv-admin-ui-system.mjs +5 -0
- package/esm2022/system/public_api.mjs +7 -0
- package/esm2022/system/system.module.mjs +22 -0
- package/esm2022/system/system.routes.mjs +20 -0
- package/fesm2022/deenruv-admin-ui-catalog.mjs +5171 -0
- package/fesm2022/deenruv-admin-ui-catalog.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-core.mjs +22758 -0
- package/fesm2022/deenruv-admin-ui-core.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-customer.mjs +1400 -0
- package/fesm2022/deenruv-admin-ui-customer.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-dashboard.mjs +454 -0
- package/fesm2022/deenruv-admin-ui-dashboard.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-login.mjs +157 -0
- package/fesm2022/deenruv-admin-ui-login.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-marketing.mjs +566 -0
- package/fesm2022/deenruv-admin-ui-marketing.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-order.mjs +3664 -0
- package/fesm2022/deenruv-admin-ui-order.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-react.mjs +999 -0
- package/fesm2022/deenruv-admin-ui-react.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-settings.mjs +4067 -0
- package/fesm2022/deenruv-admin-ui-settings.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui-system.mjs +164 -0
- package/fesm2022/deenruv-admin-ui-system.mjs.map +1 -0
- package/fesm2022/deenruv-admin-ui.mjs +11 -0
- package/fesm2022/deenruv-admin-ui.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/login/components/login/login.component.d.ts +37 -0
- package/login/index.d.ts +5 -0
- package/login/login.module.d.ts +9 -0
- package/login/login.routes.d.ts +2 -0
- package/login/providers/login.guard.d.ts +15 -0
- package/login/public_api.d.ts +4 -0
- package/marketing/components/promotion-detail/promotion-detail.component.d.ts +70 -0
- package/marketing/components/promotion-list/promotion-list-bulk-actions.d.ts +6 -0
- package/marketing/components/promotion-list/promotion-list.component.d.ts +13 -0
- package/marketing/index.d.ts +5 -0
- package/marketing/marketing.module.d.ts +14 -0
- package/marketing/marketing.routes.d.ts +4 -0
- package/marketing/public_api.d.ts +5 -0
- package/order/common/get-refundable-payments.d.ts +9 -0
- package/order/common/modify-order-types.d.ts +29 -0
- package/order/components/add-manual-payment-dialog/add-manual-payment-dialog.component.d.ts +19 -0
- package/order/components/cancel-order-dialog/cancel-order-dialog.component.d.ts +24 -0
- package/order/components/coupon-code-selector/coupon-code-selector.component.d.ts +22 -0
- package/order/components/draft-order-detail/draft-order-detail.component.d.ts +51 -0
- package/order/components/draft-order-variant-selector/draft-order-variant-selector.component.d.ts +24 -0
- package/order/components/fulfill-order-dialog/fulfill-order-dialog.component.d.ts +28 -0
- package/order/components/fulfillment-card/fulfillment-card.component.d.ts +12 -0
- package/order/components/fulfillment-detail/fulfillment-detail.component.d.ts +23 -0
- package/order/components/fulfillment-state-label/fulfillment-state-label.component.d.ts +7 -0
- package/order/components/line-fulfillment/line-fulfillment.component.d.ts +26 -0
- package/order/components/line-refunds/line-refunds.component.d.ts +9 -0
- package/order/components/modification-detail/modification-detail.component.d.ts +34 -0
- package/order/components/order-custom-fields-card/order-custom-fields-card.component.d.ts +21 -0
- package/order/components/order-data-table/order-data-table.component.d.ts +15 -0
- package/order/components/order-data-table/order-total-column.component.d.ts +7 -0
- package/order/components/order-detail/order-detail.component.d.ts +68 -0
- package/order/components/order-editor/order-editor.component.d.ts +99 -0
- package/order/components/order-edits-preview-dialog/order-edits-preview-dialog.component.d.ts +51 -0
- package/order/components/order-history/order-history-entry-host.component.d.ts +18 -0
- package/order/components/order-history/order-history.component.d.ts +92 -0
- package/order/components/order-list/order-list.component.d.ts +21 -0
- package/order/components/order-modification-summary/order-modification-summary.component.d.ts +19 -0
- package/order/components/order-payment-card/order-payment-card.component.d.ts +67 -0
- package/order/components/order-process-graph/constants.d.ts +1 -0
- package/order/components/order-process-graph/order-process-edge.component.d.ts +21 -0
- package/order/components/order-process-graph/order-process-graph.component.d.ts +32 -0
- package/order/components/order-process-graph/order-process-node.component.d.ts +26 -0
- package/order/components/order-process-graph/types.d.ts +4 -0
- package/order/components/order-process-graph-dialog/order-process-graph-dialog.component.d.ts +13 -0
- package/order/components/order-state-select-dialog/order-state-select-dialog.component.d.ts +13 -0
- package/order/components/order-table/order-table.component.d.ts +43 -0
- package/order/components/payment-detail/payment-detail.component.d.ts +8 -0
- package/order/components/payment-for-refund-selector/payment-for-refund-selector.component.d.ts +14 -0
- package/order/components/payment-state-label/payment-state-label.component.d.ts +7 -0
- package/order/components/refund-detail/refund-detail.component.d.ts +8 -0
- package/order/components/refund-order-dialog/refund-order-dialog.component.d.ts +46 -0
- package/order/components/refund-state-label/refund-state-label.component.d.ts +7 -0
- package/order/components/select-address-dialog/select-address-dialog.component.d.ts +27 -0
- package/order/components/select-address-dialog/select-address-dialog.graphql.d.ts +1 -0
- package/order/components/select-customer-dialog/select-customer-dialog.component.d.ts +32 -0
- package/order/components/select-shipping-method-dialog/select-shipping-method-dialog.component.d.ts +18 -0
- package/order/components/seller-orders-card/seller-orders-card.component.d.ts +24 -0
- package/order/components/seller-orders-card/seller-orders-card.graphql.d.ts +1 -0
- package/order/components/settle-refund-dialog/settle-refund-dialog.component.d.ts +11 -0
- package/order/components/simple-item-list/simple-item-list.component.d.ts +9 -0
- package/order/index.d.ts +5 -0
- package/order/order.module.d.ts +52 -0
- package/order/order.routes.d.ts +3 -0
- package/order/providers/order-transition.service.d.ts +32 -0
- package/order/providers/routing/order.guard.d.ts +13 -0
- package/order/public_api.d.ts +51 -0
- package/package.json +133 -0
- package/public_api.d.ts +4 -0
- package/react/components/react-custom-column.component.d.ts +17 -0
- package/react/components/react-custom-detail.component.d.ts +24 -0
- package/react/components/react-form-input.component.d.ts +20 -0
- package/react/components/react-route.component.d.ts +10 -0
- package/react/directives/react-component-host.directive.d.ts +23 -0
- package/react/index.d.ts +5 -0
- package/react/public_api.d.ts +25 -0
- package/react/react-components/ActionBar.d.ts +23 -0
- package/react/react-components/Card.d.ts +24 -0
- package/react/react-components/CdsIcon.d.ts +45 -0
- package/react/react-components/FormField.d.ts +27 -0
- package/react/react-components/Link.d.ts +22 -0
- package/react/react-components/PageBlock.d.ts +21 -0
- package/react/react-components/PageDetailLayout.d.ts +23 -0
- package/react/react-components/RichTextEditor.d.ts +62 -0
- package/react/react-hooks/use-detail-component-data.d.ts +32 -0
- package/react/react-hooks/use-form-control.d.ts +29 -0
- package/react/react-hooks/use-injector.d.ts +24 -0
- package/react/react-hooks/use-page-metadata.d.ts +30 -0
- package/react/react-hooks/use-query.d.ts +163 -0
- package/react/react-hooks/use-rich-text-editor.d.ts +37 -0
- package/react/react-hooks/use-route-params.d.ts +22 -0
- package/react/register-react-custom-detail-component.d.ts +38 -0
- package/react/register-react-data-table-component.d.ts +83 -0
- package/react/register-react-form-input-component.d.ts +9 -0
- package/react/register-react-route-component.d.ts +32 -0
- package/react/types.d.ts +17 -0
- package/settings/components/add-country-to-zone-dialog/add-country-to-zone-dialog.component.d.ts +20 -0
- package/settings/components/admin-detail/admin-detail.component.d.ts +64 -0
- package/settings/components/administrator-list/administrator-list-bulk-actions.d.ts +1 -0
- package/settings/components/administrator-list/administrator-list.component.d.ts +29 -0
- package/settings/components/channel-detail/channel-detail.component.d.ts +46 -0
- package/settings/components/channel-list/channel-list-bulk-actions.d.ts +1 -0
- package/settings/components/channel-list/channel-list.component.d.ts +13 -0
- package/settings/components/country-detail/country-detail.component.d.ts +29 -0
- package/settings/components/country-list/country-list-bulk-actions.d.ts +1 -0
- package/settings/components/country-list/country-list.component.d.ts +11 -0
- package/settings/components/global-settings/global-settings.component.d.ts +29 -0
- package/settings/components/payment-method-detail/payment-method-detail.component.d.ts +64 -0
- package/settings/components/payment-method-list/payment-method-list-bulk-actions.d.ts +3 -0
- package/settings/components/payment-method-list/payment-method-list.component.d.ts +11 -0
- package/settings/components/permission-grid/permission-grid.component.d.ts +28 -0
- package/settings/components/profile/profile.component.d.ts +28 -0
- package/settings/components/role-detail/role-detail.component.d.ts +31 -0
- package/settings/components/role-list/role-list-bulk-actions.d.ts +1 -0
- package/settings/components/role-list/role-list.component.d.ts +17 -0
- package/settings/components/seller-detail/seller-detail.component.d.ts +31 -0
- package/settings/components/seller-list/seller-list-bulk-actions.d.ts +1 -0
- package/settings/components/seller-list/seller-list.component.d.ts +11 -0
- package/settings/components/shipping-eligibility-test-result/shipping-eligibility-test-result.component.d.ts +12 -0
- package/settings/components/shipping-method-detail/shipping-method-detail.component.d.ts +76 -0
- package/settings/components/shipping-method-list/shipping-method-list-bulk-actions.d.ts +3 -0
- package/settings/components/shipping-method-list/shipping-method-list.component.d.ts +12 -0
- package/settings/components/shipping-method-test-result/shipping-method-test-result.component.d.ts +12 -0
- package/settings/components/stock-location-detail/stock-location-detail.component.d.ts +32 -0
- package/settings/components/stock-location-list/stock-location-list-bulk-actions.d.ts +3 -0
- package/settings/components/stock-location-list/stock-location-list.component.d.ts +12 -0
- package/settings/components/tax-category-detail/tax-category-detail.component.d.ts +32 -0
- package/settings/components/tax-category-list/tax-category-list-bulk-actions.d.ts +1 -0
- package/settings/components/tax-category-list/tax-category-list.component.d.ts +11 -0
- package/settings/components/tax-rate-detail/tax-rate-detail.component.d.ts +39 -0
- package/settings/components/tax-rate-list/tax-rate-list-bulk-actions.d.ts +1 -0
- package/settings/components/tax-rate-list/tax-rate-list.component.d.ts +11 -0
- package/settings/components/test-address-form/test-address-form.component.d.ts +25 -0
- package/settings/components/test-order-builder/test-order-builder.component.d.ts +31 -0
- package/settings/components/test-shipping-methods/test-shipping-methods.component.d.ts +23 -0
- package/settings/components/zone-detail/zone-detail.component.d.ts +31 -0
- package/settings/components/zone-list/zone-list-bulk-actions.d.ts +1 -0
- package/settings/components/zone-list/zone-list.component.d.ts +26 -0
- package/settings/components/zone-member-list/zone-member-controls.directive.d.ts +8 -0
- package/settings/components/zone-member-list/zone-member-list-bulk-actions.d.ts +3 -0
- package/settings/components/zone-member-list/zone-member-list-header.directive.d.ts +8 -0
- package/settings/components/zone-member-list/zone-member-list.component.d.ts +40 -0
- package/settings/index.d.ts +5 -0
- package/settings/providers/routing/profile-resolver.d.ts +8 -0
- package/settings/public_api.d.ts +49 -0
- package/settings/settings.module.d.ts +45 -0
- package/settings/settings.routes.d.ts +3 -0
- package/static/assets/.gitkeep +0 -0
- package/static/assets/logo-login.webp +0 -0
- package/static/assets/logo-top.webp +0 -0
- package/static/deenruv-ui-config.json +290 -0
- package/static/favicon.ico +0 -0
- package/static/fonts/fonts.scss +253 -0
- package/static/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/static/fonts/inter-cyrillic.woff2 +0 -0
- package/static/fonts/inter-greek-ext.woff2 +0 -0
- package/static/fonts/inter-greek.woff2 +0 -0
- package/static/fonts/inter-latin-ext.woff2 +0 -0
- package/static/fonts/inter-latin.woff2 +0 -0
- package/static/fonts/inter-vietnamese.woff2 +0 -0
- package/static/i18n-messages/ar.json +814 -0
- package/static/i18n-messages/cs.json +814 -0
- package/static/i18n-messages/de.json +814 -0
- package/static/i18n-messages/en.json +814 -0
- package/static/i18n-messages/es.json +814 -0
- package/static/i18n-messages/fa.json +814 -0
- package/static/i18n-messages/fr.json +814 -0
- package/static/i18n-messages/he.json +814 -0
- package/static/i18n-messages/hr.json +814 -0
- package/static/i18n-messages/it.json +814 -0
- package/static/i18n-messages/nb.json +812 -0
- package/static/i18n-messages/ne.json +814 -0
- package/static/i18n-messages/pl.json +814 -0
- package/static/i18n-messages/pt_BR.json +814 -0
- package/static/i18n-messages/pt_PT.json +814 -0
- package/static/i18n-messages/ru.json +814 -0
- package/static/i18n-messages/sv.json +807 -0
- package/static/i18n-messages/uk.json +814 -0
- package/static/i18n-messages/zh_Hans.json +814 -0
- package/static/i18n-messages/zh_Hant.json +814 -0
- package/static/index.html +14 -0
- package/static/polyfills.ts +66 -0
- package/static/styles/_mixins.scss +60 -0
- package/static/styles/_variables.scss +11 -0
- package/static/styles/component/prosemirror.scss +511 -0
- package/static/styles/global/_buttons.scss +147 -0
- package/static/styles/global/_clarity.scss +140 -0
- package/static/styles/global/_forms.scss +187 -0
- package/static/styles/global/_global.scss +41 -0
- package/static/styles/global/_overrides.scss +165 -0
- package/static/styles/global/_sass-overrides.scss +8 -0
- package/static/styles/global/_utilities.scss +155 -0
- package/static/styles/rtl.scss +143 -0
- package/static/styles/styles.scss +19 -0
- package/static/styles/theme/dark.scss +591 -0
- package/static/styles/theme/default.scss +254 -0
- package/static/styles/ui-extension-theme.scss +13 -0
- package/static/theme.min.css +1 -0
- package/system/components/health-check/health-check.component.d.ts +8 -0
- package/system/components/job-list/job-list.component.d.ts +19 -0
- package/system/components/job-state-label/job-state-label.component.d.ts +9 -0
- package/system/index.d.ts +5 -0
- package/system/public_api.d.ts +5 -0
- package/system/system.module.d.ts +11 -0
- package/system/system.routes.d.ts +2 -0
|
@@ -0,0 +1,3664 @@
|
|
|
1
|
+
import * as i2 from '@angular/forms';
|
|
2
|
+
import { FormControl, Validators, UntypedFormGroup, UntypedFormControl, FormGroup, UntypedFormArray } from '@angular/forms';
|
|
3
|
+
import { summate, notNullOrUndefined, isObject, assertNever } from '@deenruv/common/lib/shared-utils';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { ChangeDetectionStrategy, Component, EventEmitter, Output, Input, Injectable, ContentChildren, HostBinding, ViewChildren, ViewContainerRef, ViewChild, NgModule } from '@angular/core';
|
|
6
|
+
import * as i1 from '@deenruv/admin-ui/core';
|
|
7
|
+
import { GetAddManualPaymentMethodListDocument, getAppConfig, GetCouponCodeSelectorPromotionListDocument, GetCustomerAddressesDocument, SortOrder, HistoryEntryType, DataTable2ColumnComponent, DataTable2Component, AdjustmentType, TypedBaseDetailComponent, DeletionResult, configurableDefinitionToInstance, GlobalFlag, configurableOperationValueIsValid, toConfigurableOperationInput, ORDER_DETAIL_FRAGMENT, getCustomFieldsDefaults, SetOrderCustomerDocument, EditNoteDialogComponent, transformRelationCustomFieldInputs, TypedBaseListComponent, OrderType, getOrderStateTranslationToken, GetOrderListDocument, LogicalOperator, ADDRESS_FRAGMENT, PageComponent, detailComponentWithResolver, OrderDetailQueryDocument, SharedModule, PageService } from '@deenruv/admin-ui/core';
|
|
8
|
+
import { gql } from 'apollo-angular';
|
|
9
|
+
import * as i5 from '@ng-select/ng-select';
|
|
10
|
+
import * as i2$1 from '@angular/common';
|
|
11
|
+
import * as i4 from '@ngx-translate/core';
|
|
12
|
+
import { marker } from '@biesbjerg/ngx-translate-extract-marker';
|
|
13
|
+
import * as i3 from '@clr/angular';
|
|
14
|
+
import { Subject, concat, of, EMPTY, combineLatest, BehaviorSubject, forkJoin } from 'rxjs';
|
|
15
|
+
import { debounceTime, distinctUntilChanged, switchMap, map, startWith, tap, catchError, retryWhen, delay, take, mapTo, takeUntil, shareReplay } from 'rxjs/operators';
|
|
16
|
+
import { pick } from '@deenruv/common/lib/pick';
|
|
17
|
+
import * as i1$1 from '@angular/router';
|
|
18
|
+
import { RouterModule, ROUTES } from '@angular/router';
|
|
19
|
+
import * as i3$1 from '@angular/cdk/bidi';
|
|
20
|
+
import * as i5$1 from 'ngx-pagination';
|
|
21
|
+
import { DEFAULT_CHANNEL_CODE } from '@deenruv/common/lib/shared-constants';
|
|
22
|
+
import { simpleDeepClone } from '@deenruv/common/lib/simple-deep-clone';
|
|
23
|
+
|
|
24
|
+
function getRefundablePayments(payments) {
|
|
25
|
+
const settledPayments = (payments || []).filter(p => p.state === 'Settled');
|
|
26
|
+
return settledPayments.map((payment, index) => {
|
|
27
|
+
const refundableAmount = payment.amount -
|
|
28
|
+
summate(payment.refunds.filter(r => r.state !== 'Failed'), 'total');
|
|
29
|
+
return {
|
|
30
|
+
...payment,
|
|
31
|
+
refundableAmount,
|
|
32
|
+
amountToRefundControl: new FormControl(0, {
|
|
33
|
+
nonNullable: true,
|
|
34
|
+
validators: [Validators.min(0), Validators.max(refundableAmount)],
|
|
35
|
+
}),
|
|
36
|
+
selected: index === 0,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const GET_PAYMENT_METHODS_FOR_MANUAL_ADD = gql `
|
|
42
|
+
query GetAddManualPaymentMethodList($options: PaymentMethodListOptions!) {
|
|
43
|
+
paymentMethods(options: $options) {
|
|
44
|
+
items {
|
|
45
|
+
id
|
|
46
|
+
createdAt
|
|
47
|
+
updatedAt
|
|
48
|
+
name
|
|
49
|
+
code
|
|
50
|
+
description
|
|
51
|
+
enabled
|
|
52
|
+
}
|
|
53
|
+
totalItems
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
class AddManualPaymentDialogComponent {
|
|
58
|
+
constructor(dataService) {
|
|
59
|
+
this.dataService = dataService;
|
|
60
|
+
this.form = new UntypedFormGroup({
|
|
61
|
+
method: new UntypedFormControl('', Validators.required),
|
|
62
|
+
transactionId: new UntypedFormControl('', Validators.required),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
ngOnInit() {
|
|
66
|
+
this.paymentMethods$ = this.dataService
|
|
67
|
+
.query(GetAddManualPaymentMethodListDocument, {
|
|
68
|
+
options: {
|
|
69
|
+
take: 999,
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
.mapSingle(data => data.paymentMethods.items);
|
|
73
|
+
}
|
|
74
|
+
submit() {
|
|
75
|
+
const formValue = this.form.value;
|
|
76
|
+
this.resolveWith({
|
|
77
|
+
method: formValue.method,
|
|
78
|
+
transactionId: formValue.transactionId,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
cancel() {
|
|
82
|
+
this.resolveWith();
|
|
83
|
+
}
|
|
84
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddManualPaymentDialogComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
85
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: AddManualPaymentDialogComponent, selector: "vdr-add-manual-payment-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.add-payment-to-order' | translate }}</ng-template>\n<form [formGroup]=\"form\">\n <vdr-form-field [label]=\"'order.payment-method' | translate\" for=\"method\">\n <ng-select\n [items]=\"paymentMethods$ | async\"\n bindLabel=\"code\"\n appendTo=\"body\"\n autofocus\n bindValue=\"code\"\n [addTag]=\"true\"\n formControlName=\"method\"\n ></ng-select>\n </vdr-form-field>\n <vdr-form-field [label]=\"'order.transaction-id' | translate\" for=\"transactionId\">\n <input id=\"transactionId\" type=\"text\" formControlName=\"transactionId\" />\n </vdr-form-field>\n</form>\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"submit()\" class=\"btn btn-primary\" [disabled]=\"form.invalid || form.pristine\">\n {{ 'order.add-payment' | translate }} ({{ outstandingAmount | localeCurrency: currencyCode }})\n </button>\n</ng-template>\n", styles: [".ng-select{min-width:100%}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "component", type: i1.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"], outputs: ["readOnlyToggleChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
86
|
+
}
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddManualPaymentDialogComponent, decorators: [{
|
|
88
|
+
type: Component,
|
|
89
|
+
args: [{ selector: 'vdr-add-manual-payment-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.add-payment-to-order' | translate }}</ng-template>\n<form [formGroup]=\"form\">\n <vdr-form-field [label]=\"'order.payment-method' | translate\" for=\"method\">\n <ng-select\n [items]=\"paymentMethods$ | async\"\n bindLabel=\"code\"\n appendTo=\"body\"\n autofocus\n bindValue=\"code\"\n [addTag]=\"true\"\n formControlName=\"method\"\n ></ng-select>\n </vdr-form-field>\n <vdr-form-field [label]=\"'order.transaction-id' | translate\" for=\"transactionId\">\n <input id=\"transactionId\" type=\"text\" formControlName=\"transactionId\" />\n </vdr-form-field>\n</form>\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"submit()\" class=\"btn btn-primary\" [disabled]=\"form.invalid || form.pristine\">\n {{ 'order.add-payment' | translate }} ({{ outstandingAmount | localeCurrency: currencyCode }})\n </button>\n</ng-template>\n", styles: [".ng-select{min-width:100%}\n"] }]
|
|
90
|
+
}], ctorParameters: () => [{ type: i1.DataService }] });
|
|
91
|
+
|
|
92
|
+
class CancelOrderDialogComponent {
|
|
93
|
+
get selectionCount() {
|
|
94
|
+
return Object.values(this.lineQuantities).reduce((sum, n) => sum + n, 0);
|
|
95
|
+
}
|
|
96
|
+
constructor(i18nService) {
|
|
97
|
+
this.i18nService = i18nService;
|
|
98
|
+
this.cancelAll = true;
|
|
99
|
+
this.lineQuantities = {};
|
|
100
|
+
this.reasons = getAppConfig().cancellationReasons ?? [
|
|
101
|
+
marker('order.cancel-reason-customer-request'),
|
|
102
|
+
marker('order.cancel-reason-not-available'),
|
|
103
|
+
];
|
|
104
|
+
this.reasons = this.reasons.map(r => this.i18nService.translate(r));
|
|
105
|
+
}
|
|
106
|
+
ngOnInit() {
|
|
107
|
+
this.lineQuantities = this.order.lines.reduce((result, line) => ({ ...result, [line.id]: line.quantity }), {});
|
|
108
|
+
}
|
|
109
|
+
radioChanged() {
|
|
110
|
+
if (this.cancelAll) {
|
|
111
|
+
for (const line of this.order.lines) {
|
|
112
|
+
this.lineQuantities[line.id] = line.quantity;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
for (const line of this.order.lines) {
|
|
117
|
+
this.lineQuantities[line.id] = 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
checkIfAllSelected() {
|
|
122
|
+
for (const [lineId, quantity] of Object.entries(this.lineQuantities)) {
|
|
123
|
+
const quantityInOrder = this.order.lines.find(line => line.id === lineId)?.quantity;
|
|
124
|
+
if (quantityInOrder && quantity < quantityInOrder) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// If we got here, all of the selected quantities are equal to the order
|
|
129
|
+
// line quantities, i.e. everything is selected.
|
|
130
|
+
this.cancelAll = true;
|
|
131
|
+
}
|
|
132
|
+
select() {
|
|
133
|
+
this.resolveWith({
|
|
134
|
+
orderId: this.order.id,
|
|
135
|
+
lines: this.getLineInputs(),
|
|
136
|
+
reason: this.reason,
|
|
137
|
+
cancelShipping: this.cancelAll,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
cancel() {
|
|
141
|
+
this.resolveWith();
|
|
142
|
+
}
|
|
143
|
+
getLineInputs() {
|
|
144
|
+
if (this.order.active) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
return Object.entries(this.lineQuantities)
|
|
148
|
+
.map(([orderLineId, quantity]) => ({
|
|
149
|
+
orderLineId,
|
|
150
|
+
quantity,
|
|
151
|
+
}))
|
|
152
|
+
.filter(l => 0 < l.quantity);
|
|
153
|
+
}
|
|
154
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CancelOrderDialogComponent, deps: [{ token: i1.I18nService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
155
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CancelOrderDialogComponent, selector: "vdr-cancel-order-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.cancel-order' | translate }}</ng-template>\n\n<div class=\"fulfillment-wrapper\">\n <div class=\"order-lines\">\n <table class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th>{{ 'order.product-name' | translate }}</th>\n <th>{{ 'order.product-sku' | translate }}</th>\n <th>{{ 'order.quantity' | translate }}</th>\n <th>{{ 'order.unit-price' | translate }}</th>\n <th>{{ 'order.cancel' | translate }}</th>\n </tr>\n </thead>\n <tr\n *ngFor=\"let line of order.lines\"\n class=\"order-line\"\n [class.is-disabled]=\"cancelAll\"\n [class.is-cancelled]=\"line.quantity === 0\"\n >\n <td class=\"align-middle thumb\">\n <img [src]=\"line.featuredAsset | assetPreview: 'tiny'\" />\n </td>\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\n <td class=\"align-middle quantity\">{{ line.quantity }}</td>\n <td class=\"align-middle quantity\">\n {{ line.unitPriceWithTax | localeCurrency: order.currencyCode }}\n </td>\n <td class=\"align-middle fulfil\">\n <input\n *ngIf=\"line.quantity > 0 && !order.active; else nonEditable\"\n [(ngModel)]=\"lineQuantities[line.id]\"\n (input)=\"checkIfAllSelected()\"\n [disabled]=\"cancelAll\"\n type=\"number\"\n [max]=\"line.quantity\"\n min=\"0\"\n />\n <ng-template #nonEditable>{{ line.quantity }}</ng-template>\n </td>\n </tr>\n </table>\n </div>\n <div class=\"cancellation-details\">\n <ng-container *ngIf=\"order.active !== true\">\n <clr-radio-wrapper>\n <input\n type=\"radio\"\n clrRadio\n [value]=\"true\"\n [(ngModel)]=\"cancelAll\"\n name=\"options\"\n (ngModelChange)=\"radioChanged()\"\n />\n <label>{{ 'order.cancel-entire-order' | translate }}</label>\n </clr-radio-wrapper>\n <clr-radio-wrapper>\n <input\n type=\"radio\"\n clrRadio\n [value]=\"false\"\n [(ngModel)]=\"cancelAll\"\n name=\"options\"\n (ngModelChange)=\"radioChanged()\"\n />\n <label>{{ 'order.cancel-specified-items' | translate }}</label>\n </clr-radio-wrapper>\n </ng-container>\n <label class=\"clr-control-label\">{{ 'order.cancellation-reason' | translate }}</label>\n <ng-select\n [items]=\"reasons\"\n bindLabel=\"name\"\n autofocus\n bindValue=\"id\"\n [addTag]=\"true\"\n [(ngModel)]=\"reason\"\n ></ng-select>\n </div>\n</div>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"!reason || (!order.active && selectionCount === 0)\"\n class=\"btn btn-primary\"\n >\n <ng-container *ngIf=\"!order.active\">\n {{ 'order.cancel-selected-items' | translate }}\n </ng-container>\n <ng-container *ngIf=\"order.active\">\n {{ 'order.cancel-order' | translate }}\n </ng-container>\n </button>\n</ng-template>\n", styles: [":host{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper{display:flex;flex-direction:row}}@media screen and (min-width: 768px){.fulfillment-wrapper .cancellation-details{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper .order-lines{flex:1;overflow-y:auto}.fulfillment-wrapper .order-lines table{margin-top:0}.fulfillment-wrapper tr.ignore{color:var(--color-grey-300)}.fulfillment-wrapper .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}.fulfillment-wrapper .is-disabled td,.fulfillment-wrapper .is-disabled td input{background-color:var(--color-component-bg-200)}\n"], dependencies: [{ kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["id", "for"] }, { kind: "directive", type: i3.ClrRadio, selector: "[clrRadio]" }, { kind: "component", type: i3.ClrRadioWrapper, selector: "clr-radio-wrapper" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.AssetPreviewPipe, name: "assetPreview" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
156
|
+
}
|
|
157
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CancelOrderDialogComponent, decorators: [{
|
|
158
|
+
type: Component,
|
|
159
|
+
args: [{ selector: 'vdr-cancel-order-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.cancel-order' | translate }}</ng-template>\n\n<div class=\"fulfillment-wrapper\">\n <div class=\"order-lines\">\n <table class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th>{{ 'order.product-name' | translate }}</th>\n <th>{{ 'order.product-sku' | translate }}</th>\n <th>{{ 'order.quantity' | translate }}</th>\n <th>{{ 'order.unit-price' | translate }}</th>\n <th>{{ 'order.cancel' | translate }}</th>\n </tr>\n </thead>\n <tr\n *ngFor=\"let line of order.lines\"\n class=\"order-line\"\n [class.is-disabled]=\"cancelAll\"\n [class.is-cancelled]=\"line.quantity === 0\"\n >\n <td class=\"align-middle thumb\">\n <img [src]=\"line.featuredAsset | assetPreview: 'tiny'\" />\n </td>\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\n <td class=\"align-middle quantity\">{{ line.quantity }}</td>\n <td class=\"align-middle quantity\">\n {{ line.unitPriceWithTax | localeCurrency: order.currencyCode }}\n </td>\n <td class=\"align-middle fulfil\">\n <input\n *ngIf=\"line.quantity > 0 && !order.active; else nonEditable\"\n [(ngModel)]=\"lineQuantities[line.id]\"\n (input)=\"checkIfAllSelected()\"\n [disabled]=\"cancelAll\"\n type=\"number\"\n [max]=\"line.quantity\"\n min=\"0\"\n />\n <ng-template #nonEditable>{{ line.quantity }}</ng-template>\n </td>\n </tr>\n </table>\n </div>\n <div class=\"cancellation-details\">\n <ng-container *ngIf=\"order.active !== true\">\n <clr-radio-wrapper>\n <input\n type=\"radio\"\n clrRadio\n [value]=\"true\"\n [(ngModel)]=\"cancelAll\"\n name=\"options\"\n (ngModelChange)=\"radioChanged()\"\n />\n <label>{{ 'order.cancel-entire-order' | translate }}</label>\n </clr-radio-wrapper>\n <clr-radio-wrapper>\n <input\n type=\"radio\"\n clrRadio\n [value]=\"false\"\n [(ngModel)]=\"cancelAll\"\n name=\"options\"\n (ngModelChange)=\"radioChanged()\"\n />\n <label>{{ 'order.cancel-specified-items' | translate }}</label>\n </clr-radio-wrapper>\n </ng-container>\n <label class=\"clr-control-label\">{{ 'order.cancellation-reason' | translate }}</label>\n <ng-select\n [items]=\"reasons\"\n bindLabel=\"name\"\n autofocus\n bindValue=\"id\"\n [addTag]=\"true\"\n [(ngModel)]=\"reason\"\n ></ng-select>\n </div>\n</div>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"!reason || (!order.active && selectionCount === 0)\"\n class=\"btn btn-primary\"\n >\n <ng-container *ngIf=\"!order.active\">\n {{ 'order.cancel-selected-items' | translate }}\n </ng-container>\n <ng-container *ngIf=\"order.active\">\n {{ 'order.cancel-order' | translate }}\n </ng-container>\n </button>\n</ng-template>\n", styles: [":host{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper{display:flex;flex-direction:row}}@media screen and (min-width: 768px){.fulfillment-wrapper .cancellation-details{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper .order-lines{flex:1;overflow-y:auto}.fulfillment-wrapper .order-lines table{margin-top:0}.fulfillment-wrapper tr.ignore{color:var(--color-grey-300)}.fulfillment-wrapper .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}.fulfillment-wrapper .is-disabled td,.fulfillment-wrapper .is-disabled td input{background-color:var(--color-component-bg-200)}\n"] }]
|
|
160
|
+
}], ctorParameters: () => [{ type: i1.I18nService }] });
|
|
161
|
+
|
|
162
|
+
const GET_COUPON_CODE_SELECTOR_PROMOTION_LIST = gql `
|
|
163
|
+
query GetCouponCodeSelectorPromotionList($options: PromotionListOptions) {
|
|
164
|
+
promotions(options: $options) {
|
|
165
|
+
items {
|
|
166
|
+
id
|
|
167
|
+
name
|
|
168
|
+
couponCode
|
|
169
|
+
}
|
|
170
|
+
totalItems
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
class CouponCodeSelectorComponent {
|
|
175
|
+
constructor(dataService) {
|
|
176
|
+
this.dataService = dataService;
|
|
177
|
+
this.addCouponCode = new EventEmitter();
|
|
178
|
+
this.removeCouponCode = new EventEmitter();
|
|
179
|
+
this.couponCodeInput$ = new Subject();
|
|
180
|
+
}
|
|
181
|
+
ngOnInit() {
|
|
182
|
+
this.availableCouponCodes$ = concat(this.couponCodeInput$.pipe(debounceTime(200), distinctUntilChanged(), switchMap(term => this.dataService.query(GetCouponCodeSelectorPromotionListDocument, {
|
|
183
|
+
options: {
|
|
184
|
+
take: 10,
|
|
185
|
+
skip: 0,
|
|
186
|
+
filter: {
|
|
187
|
+
couponCode: { contains: term },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
}).single$), map(({ promotions }) =>
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
192
|
+
promotions.items.map(p => ({ code: p.couponCode, promotionName: p.name }))), startWith([])));
|
|
193
|
+
if (!this.control) {
|
|
194
|
+
this.control = new UntypedFormControl(this.couponCodes ?? []);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CouponCodeSelectorComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
198
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CouponCodeSelectorComponent, selector: "vdr-coupon-code-selector", inputs: { couponCodes: "couponCodes", control: "control" }, outputs: { addCouponCode: "addCouponCode", removeCouponCode: "removeCouponCode" }, ngImport: i0, template: "<ng-select\n [items]=\"availableCouponCodes$ | async\"\n appendTo=\"body\"\n bindLabel=\"code\"\n bindValue=\"code\"\n [addTag]=\"false\"\n [multiple]=\"true\"\n [hideSelected]=\"true\"\n [minTermLength]=\"2\"\n typeToSearchText=\"\"\n [typeahead]=\"couponCodeInput$\"\n [formControl]=\"control\"\n (add)=\"addCouponCode.emit($event.code)\"\n (remove)=\"removeCouponCode.emit($event.value?.code)\"\n>\n <ng-template ng-option-tmp let-item=\"item\">\n <div class=\"flex items-center\">\n <vdr-chip class=\"mr-1\">{{ item.code }}</vdr-chip>\n <span>{{ item.promotionName }}</span>\n </div>\n </ng-template>\n</ng-select>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i5.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
199
|
+
}
|
|
200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CouponCodeSelectorComponent, decorators: [{
|
|
201
|
+
type: Component,
|
|
202
|
+
args: [{ selector: 'vdr-coupon-code-selector', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-select\n [items]=\"availableCouponCodes$ | async\"\n appendTo=\"body\"\n bindLabel=\"code\"\n bindValue=\"code\"\n [addTag]=\"false\"\n [multiple]=\"true\"\n [hideSelected]=\"true\"\n [minTermLength]=\"2\"\n typeToSearchText=\"\"\n [typeahead]=\"couponCodeInput$\"\n [formControl]=\"control\"\n (add)=\"addCouponCode.emit($event.code)\"\n (remove)=\"removeCouponCode.emit($event.value?.code)\"\n>\n <ng-template ng-option-tmp let-item=\"item\">\n <div class=\"flex items-center\">\n <vdr-chip class=\"mr-1\">{{ item.code }}</vdr-chip>\n <span>{{ item.promotionName }}</span>\n </div>\n </ng-template>\n</ng-select>\n" }]
|
|
203
|
+
}], ctorParameters: () => [{ type: i1.DataService }], propDecorators: { couponCodes: [{
|
|
204
|
+
type: Input
|
|
205
|
+
}], control: [{
|
|
206
|
+
type: Input
|
|
207
|
+
}], addCouponCode: [{
|
|
208
|
+
type: Output
|
|
209
|
+
}], removeCouponCode: [{
|
|
210
|
+
type: Output
|
|
211
|
+
}] } });
|
|
212
|
+
|
|
213
|
+
class SelectAddressDialogComponent {
|
|
214
|
+
constructor(dataService, formBuilder) {
|
|
215
|
+
this.dataService = dataService;
|
|
216
|
+
this.formBuilder = formBuilder;
|
|
217
|
+
this.useExisting = true;
|
|
218
|
+
this.createNew = false;
|
|
219
|
+
}
|
|
220
|
+
ngOnInit() {
|
|
221
|
+
this.addressForm = this.formBuilder.group({
|
|
222
|
+
fullName: [this.currentAddress?.fullName ?? ''],
|
|
223
|
+
company: [this.currentAddress?.company ?? ''],
|
|
224
|
+
streetLine1: [this.currentAddress?.streetLine1 ?? '', Validators.required],
|
|
225
|
+
streetLine2: [this.currentAddress?.streetLine2 ?? ''],
|
|
226
|
+
city: [this.currentAddress?.city ?? '', Validators.required],
|
|
227
|
+
province: [this.currentAddress?.province ?? ''],
|
|
228
|
+
postalCode: [this.currentAddress?.postalCode ?? '', Validators.required],
|
|
229
|
+
countryCode: [this.currentAddress?.countryCode ?? '', Validators.required],
|
|
230
|
+
phoneNumber: [this.currentAddress?.phoneNumber ?? ''],
|
|
231
|
+
});
|
|
232
|
+
this.useExisting = !!this.customerId;
|
|
233
|
+
this.addresses$ = this.customerId
|
|
234
|
+
? this.dataService
|
|
235
|
+
.query(GetCustomerAddressesDocument, { customerId: this.customerId })
|
|
236
|
+
.mapSingle(({ customer }) => customer?.addresses ?? [])
|
|
237
|
+
.pipe(tap(addresses => {
|
|
238
|
+
if (this.currentAddress) {
|
|
239
|
+
this.selectedAddress = addresses.find(a => a.streetLine1 === this.currentAddress?.streetLine1 &&
|
|
240
|
+
a.postalCode === this.currentAddress?.postalCode);
|
|
241
|
+
}
|
|
242
|
+
if (addresses.length === 0) {
|
|
243
|
+
this.createNew = true;
|
|
244
|
+
this.useExisting = false;
|
|
245
|
+
}
|
|
246
|
+
}))
|
|
247
|
+
: of([]);
|
|
248
|
+
this.availableCountries$ = this.dataService.settings
|
|
249
|
+
.getAvailableCountries()
|
|
250
|
+
.mapSingle(({ countries }) => countries.items);
|
|
251
|
+
}
|
|
252
|
+
trackByFn(item) {
|
|
253
|
+
return item.id;
|
|
254
|
+
}
|
|
255
|
+
addressIdFn(item) {
|
|
256
|
+
return item.streetLine1 + item.postalCode;
|
|
257
|
+
}
|
|
258
|
+
cancel() {
|
|
259
|
+
this.resolveWith();
|
|
260
|
+
}
|
|
261
|
+
select() {
|
|
262
|
+
if (this.useExisting && this.selectedAddress) {
|
|
263
|
+
this.resolveWith({
|
|
264
|
+
...pick(this.selectedAddress, [
|
|
265
|
+
'fullName',
|
|
266
|
+
'company',
|
|
267
|
+
'streetLine1',
|
|
268
|
+
'streetLine2',
|
|
269
|
+
'city',
|
|
270
|
+
'province',
|
|
271
|
+
'phoneNumber',
|
|
272
|
+
'postalCode',
|
|
273
|
+
]),
|
|
274
|
+
countryCode: this.selectedAddress.country.code,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
if (this.createNew && this.addressForm.valid) {
|
|
278
|
+
const formValue = this.addressForm.value;
|
|
279
|
+
this.resolveWith(formValue);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectAddressDialogComponent, deps: [{ token: i1.DataService }, { token: i2.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
283
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SelectAddressDialogComponent, selector: "vdr-select-address-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.select-address' | translate }}</ng-template>\n\n<clr-tabs *ngIf=\"addresses$ | async as addresses\">\n <clr-tab *ngIf=\"customerId && addresses.length\">\n <button clrTabLink>{{ 'order.existing-address' | translate }}</button>\n <ng-template [(clrIfActive)]=\"useExisting\">\n <clr-tab-content>\n <vdr-radio-card-fieldset\n class=\"block mt-4\"\n [idFn]=\"addressIdFn\"\n [selectedItemId]=\"selectedAddress && addressIdFn(selectedAddress)\"\n (selectItem)=\"selectedAddress = $event\"\n >\n <vdr-radio-card *ngFor=\"let address of addresses\" [item]=\"address\">\n <vdr-formatted-address [address]=\"address\"></vdr-formatted-address>\n </vdr-radio-card>\n </vdr-radio-card-fieldset>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n <clr-tab>\n <button clrTabLink>{{ 'customer.create-new-address' | translate }}</button>\n\n <ng-template [(clrIfActive)]=\"createNew\">\n <clr-tab-content>\n <vdr-address-form\n [formGroup]=\"addressForm\"\n [availableCountries]=\"availableCountries$ | async\"\n ></vdr-address-form>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n</clr-tabs>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"(useExisting && !selectedAddress) || (createNew && addressForm.invalid)\"\n class=\"btn btn-primary\"\n >\n {{ 'common.okay' | translate }}\n </button>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.ClrIfActive, selector: "[clrIfActive]", inputs: ["clrIfActive"], outputs: ["clrIfActiveChange"] }, { kind: "component", type: i3.ClrTabContent, selector: "clr-tab-content", inputs: ["id"] }, { kind: "component", type: i3.ClrTab, selector: "clr-tab" }, { kind: "component", type: i3.ClrTabs, selector: "clr-tabs", inputs: ["clrLayout"] }, { kind: "directive", type: i3.ClrTabLink, selector: "[clrTabLink]", inputs: ["id", "clrTabLinkInOverflow"] }, { kind: "directive", type: i3.ÇlrTabsWillyWonka, selector: "clr-tabs" }, { kind: "directive", type: i3.ÇlrActiveOompaLoompa, selector: "[clrTabLink], clr-tab-content" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "component", type: i1.FormattedAddressComponent, selector: "vdr-formatted-address", inputs: ["address"] }, { kind: "component", type: i1.AddressFormComponent, selector: "vdr-address-form", inputs: ["customFields", "formGroup", "availableCountries"] }, { kind: "component", type: i1.RadioCardComponent, selector: "vdr-radio-card", inputs: ["item"], exportAs: ["VdrRadioCard"] }, { kind: "component", type: i1.RadioCardFieldsetComponent, selector: "vdr-radio-card-fieldset", inputs: ["selectedItemId", "idFn"], outputs: ["selectItem"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
284
|
+
}
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectAddressDialogComponent, decorators: [{
|
|
286
|
+
type: Component,
|
|
287
|
+
args: [{ selector: 'vdr-select-address-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.select-address' | translate }}</ng-template>\n\n<clr-tabs *ngIf=\"addresses$ | async as addresses\">\n <clr-tab *ngIf=\"customerId && addresses.length\">\n <button clrTabLink>{{ 'order.existing-address' | translate }}</button>\n <ng-template [(clrIfActive)]=\"useExisting\">\n <clr-tab-content>\n <vdr-radio-card-fieldset\n class=\"block mt-4\"\n [idFn]=\"addressIdFn\"\n [selectedItemId]=\"selectedAddress && addressIdFn(selectedAddress)\"\n (selectItem)=\"selectedAddress = $event\"\n >\n <vdr-radio-card *ngFor=\"let address of addresses\" [item]=\"address\">\n <vdr-formatted-address [address]=\"address\"></vdr-formatted-address>\n </vdr-radio-card>\n </vdr-radio-card-fieldset>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n <clr-tab>\n <button clrTabLink>{{ 'customer.create-new-address' | translate }}</button>\n\n <ng-template [(clrIfActive)]=\"createNew\">\n <clr-tab-content>\n <vdr-address-form\n [formGroup]=\"addressForm\"\n [availableCountries]=\"availableCountries$ | async\"\n ></vdr-address-form>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n</clr-tabs>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"(useExisting && !selectedAddress) || (createNew && addressForm.invalid)\"\n class=\"btn btn-primary\"\n >\n {{ 'common.okay' | translate }}\n </button>\n</ng-template>\n" }]
|
|
288
|
+
}], ctorParameters: () => [{ type: i1.DataService }, { type: i2.UntypedFormBuilder }] });
|
|
289
|
+
|
|
290
|
+
class SelectCustomerDialogComponent {
|
|
291
|
+
constructor(dataService, formBuilder) {
|
|
292
|
+
this.dataService = dataService;
|
|
293
|
+
this.formBuilder = formBuilder;
|
|
294
|
+
// populated by the dialog service
|
|
295
|
+
this.canCreateNew = true;
|
|
296
|
+
this.includeNoteInput = false;
|
|
297
|
+
this.title = marker('order.set-customer-for-order');
|
|
298
|
+
this.isLoading = false;
|
|
299
|
+
this.input$ = new Subject();
|
|
300
|
+
this.selectedCustomer = [];
|
|
301
|
+
this.useExisting = true;
|
|
302
|
+
this.createNew = false;
|
|
303
|
+
this.note = '';
|
|
304
|
+
this.customerForm = this.formBuilder.group({
|
|
305
|
+
title: '',
|
|
306
|
+
firstName: ['', Validators.required],
|
|
307
|
+
lastName: ['', Validators.required],
|
|
308
|
+
phoneNumber: '',
|
|
309
|
+
emailAddress: ['', [Validators.required, Validators.email]],
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
ngOnInit() {
|
|
313
|
+
this.customers$ = concat(of([]), // default items
|
|
314
|
+
this.input$.pipe(debounceTime(200), distinctUntilChanged(), tap(() => (this.isLoading = true)), switchMap(term => this.dataService.customer
|
|
315
|
+
.getCustomerList(10, 0, term)
|
|
316
|
+
.mapStream(({ customers }) => customers.items)
|
|
317
|
+
.pipe(catchError(() => of([])), // empty list on error
|
|
318
|
+
tap(() => (this.isLoading = false))))));
|
|
319
|
+
}
|
|
320
|
+
trackByFn(item) {
|
|
321
|
+
return item.id;
|
|
322
|
+
}
|
|
323
|
+
cancel() {
|
|
324
|
+
this.resolveWith();
|
|
325
|
+
}
|
|
326
|
+
select() {
|
|
327
|
+
if (this.useExisting && this.selectedCustomer.length === 1) {
|
|
328
|
+
this.resolveWith({ ...this.selectedCustomer[0], note: this.note });
|
|
329
|
+
}
|
|
330
|
+
else if (this.createNew && this.customerForm.valid) {
|
|
331
|
+
const formValue = this.customerForm.value;
|
|
332
|
+
this.resolveWith({ ...formValue, note: this.note });
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectCustomerDialogComponent, deps: [{ token: i1.DataService }, { token: i2.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
336
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SelectCustomerDialogComponent, selector: "vdr-select-customer-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ title | translate }}</ng-template>\n\n<ng-container *ngIf=\"!canCreateNew\">\n <ng-container *ngTemplateOutlet=\"customerSelect\"></ng-container>\n <vdr-form-field [label]=\"'common.add-note' | translate\" *ngIf=\"includeNoteInput\" class=\"mt-4\">\n <textarea [(ngModel)]=\"note\"></textarea>\n </vdr-form-field>\n</ng-container>\n\n<clr-tabs *ngIf=\"canCreateNew\" class=\"pt-1\">\n <clr-tab>\n <button clrTabLink>{{ 'order.existing-customer' | translate }}</button>\n\n <ng-template [(clrIfActive)]=\"useExisting\">\n <clr-tab-content>\n <div class=\"mt-4\">\n <ng-container *ngTemplateOutlet=\"customerSelect\"></ng-container>\n </div>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n <clr-tab *ngIf=\"canCreateNew\">\n <button clrTabLink>{{ 'customer.create-new-customer' | translate }}</button>\n\n <ng-template [(clrIfActive)]=\"createNew\">\n <clr-tab-content>\n <form [formGroup]=\"customerForm\">\n <vdr-form-field [label]=\"'customer.title' | translate\" for=\"title\">\n <input id=\"title\" type=\"text\" formControlName=\"title\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.first-name' | translate\" for=\"firstName\">\n <input id=\"firstName\" type=\"text\" formControlName=\"firstName\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.last-name' | translate\" for=\"lastName\">\n <input id=\"lastName\" type=\"text\" formControlName=\"lastName\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.email-address' | translate\" for=\"emailAddress\">\n <input id=\"emailAddress\" type=\"text\" formControlName=\"emailAddress\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.phone-number' | translate\" for=\"phoneNumber\">\n <input id=\"phoneNumber\" type=\"text\" formControlName=\"phoneNumber\" />\n </vdr-form-field>\n </form>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n</clr-tabs>\n\n<ng-template #customerSelect>\n <ng-select\n [items]=\"customers$ | async\"\n appendTo=\"body\"\n bindLabel=\"name\"\n [addTag]=\"false\"\n [multiple]=\"true\"\n [hideSelected]=\"true\"\n [trackByFn]=\"trackByFn\"\n [minTermLength]=\"2\"\n [loading]=\"isLoading\"\n [typeahead]=\"input$\"\n [(ngModel)]=\"selectedCustomer\"\n >\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\n <span class=\"item-row\">\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon\n ><span class=\"mx-1\">{{ item.firstName }} {{ item.lastName }}</span>\n <vdr-chip>{{ item.emailAddress }}</vdr-chip>\n </span>\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <span class=\"item-row\">\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon\n ><span class=\"mx-1\">{{ item.firstName }} {{ item.lastName }}</span>\n <vdr-chip>{{ item.emailAddress }}</vdr-chip>\n </span>\n </ng-template>\n </ng-select>\n</ng-template>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"(useExisting && selectedCustomer.length === 0) || (createNew && customerForm.invalid)\"\n class=\"btn btn-primary\"\n >\n {{ 'common.okay' | translate }}\n </button>\n</ng-template>\n", styles: [".item-row{display:flex;align-items:center}clr-tabs{display:block}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrIfActive, selector: "[clrIfActive]", inputs: ["clrIfActive"], outputs: ["clrIfActiveChange"] }, { kind: "component", type: i3.ClrTabContent, selector: "clr-tab-content", inputs: ["id"] }, { kind: "component", type: i3.ClrTab, selector: "clr-tab" }, { kind: "component", type: i3.ClrTabs, selector: "clr-tabs", inputs: ["clrLayout"] }, { kind: "directive", type: i3.ClrTabLink, selector: "[clrTabLink]", inputs: ["id", "clrTabLinkInOverflow"] }, { kind: "directive", type: i3.ÇlrTabsWillyWonka, selector: "clr-tabs" }, { kind: "directive", type: i3.ÇlrActiveOompaLoompa, selector: "[clrTabLink], clr-tab-content" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i5.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i5.NgLabelTemplateDirective, selector: "[ng-label-tmp]" }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "component", type: i1.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"], outputs: ["readOnlyToggleChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
337
|
+
}
|
|
338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectCustomerDialogComponent, decorators: [{
|
|
339
|
+
type: Component,
|
|
340
|
+
args: [{ selector: 'vdr-select-customer-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ title | translate }}</ng-template>\n\n<ng-container *ngIf=\"!canCreateNew\">\n <ng-container *ngTemplateOutlet=\"customerSelect\"></ng-container>\n <vdr-form-field [label]=\"'common.add-note' | translate\" *ngIf=\"includeNoteInput\" class=\"mt-4\">\n <textarea [(ngModel)]=\"note\"></textarea>\n </vdr-form-field>\n</ng-container>\n\n<clr-tabs *ngIf=\"canCreateNew\" class=\"pt-1\">\n <clr-tab>\n <button clrTabLink>{{ 'order.existing-customer' | translate }}</button>\n\n <ng-template [(clrIfActive)]=\"useExisting\">\n <clr-tab-content>\n <div class=\"mt-4\">\n <ng-container *ngTemplateOutlet=\"customerSelect\"></ng-container>\n </div>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n <clr-tab *ngIf=\"canCreateNew\">\n <button clrTabLink>{{ 'customer.create-new-customer' | translate }}</button>\n\n <ng-template [(clrIfActive)]=\"createNew\">\n <clr-tab-content>\n <form [formGroup]=\"customerForm\">\n <vdr-form-field [label]=\"'customer.title' | translate\" for=\"title\">\n <input id=\"title\" type=\"text\" formControlName=\"title\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.first-name' | translate\" for=\"firstName\">\n <input id=\"firstName\" type=\"text\" formControlName=\"firstName\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.last-name' | translate\" for=\"lastName\">\n <input id=\"lastName\" type=\"text\" formControlName=\"lastName\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.email-address' | translate\" for=\"emailAddress\">\n <input id=\"emailAddress\" type=\"text\" formControlName=\"emailAddress\" />\n </vdr-form-field>\n <vdr-form-field [label]=\"'customer.phone-number' | translate\" for=\"phoneNumber\">\n <input id=\"phoneNumber\" type=\"text\" formControlName=\"phoneNumber\" />\n </vdr-form-field>\n </form>\n </clr-tab-content>\n </ng-template>\n </clr-tab>\n</clr-tabs>\n\n<ng-template #customerSelect>\n <ng-select\n [items]=\"customers$ | async\"\n appendTo=\"body\"\n bindLabel=\"name\"\n [addTag]=\"false\"\n [multiple]=\"true\"\n [hideSelected]=\"true\"\n [trackByFn]=\"trackByFn\"\n [minTermLength]=\"2\"\n [loading]=\"isLoading\"\n [typeahead]=\"input$\"\n [(ngModel)]=\"selectedCustomer\"\n >\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\n <span class=\"item-row\">\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon\n ><span class=\"mx-1\">{{ item.firstName }} {{ item.lastName }}</span>\n <vdr-chip>{{ item.emailAddress }}</vdr-chip>\n </span>\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <span class=\"item-row\">\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon\n ><span class=\"mx-1\">{{ item.firstName }} {{ item.lastName }}</span>\n <vdr-chip>{{ item.emailAddress }}</vdr-chip>\n </span>\n </ng-template>\n </ng-select>\n</ng-template>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"(useExisting && selectedCustomer.length === 0) || (createNew && customerForm.invalid)\"\n class=\"btn btn-primary\"\n >\n {{ 'common.okay' | translate }}\n </button>\n</ng-template>\n", styles: [".item-row{display:flex;align-items:center}clr-tabs{display:block}\n"] }]
|
|
341
|
+
}], ctorParameters: () => [{ type: i1.DataService }, { type: i2.UntypedFormBuilder }] });
|
|
342
|
+
|
|
343
|
+
class SelectShippingMethodDialogComponent {
|
|
344
|
+
ngOnInit() {
|
|
345
|
+
if (this.currentSelectionId) {
|
|
346
|
+
this.selectedMethod = this.eligibleShippingMethods.find(m => m.id === this.currentSelectionId);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
methodIdFn(item) {
|
|
350
|
+
return item.id;
|
|
351
|
+
}
|
|
352
|
+
cancel() {
|
|
353
|
+
this.resolveWith();
|
|
354
|
+
}
|
|
355
|
+
select() {
|
|
356
|
+
if (this.selectedMethod) {
|
|
357
|
+
this.resolveWith(this.selectedMethod.id);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectShippingMethodDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
361
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SelectShippingMethodDialogComponent, selector: "vdr-select-shipping-method-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.select-shipping-method' | translate }}</ng-template>\n<vdr-radio-card-fieldset\n [idFn]=\"methodIdFn\"\n [selectedItemId]=\"selectedMethod?.id\"\n (selectItem)=\"selectedMethod = $event\"\n>\n <vdr-radio-card *ngFor=\"let quote of eligibleShippingMethods\" [item]=\"quote\">\n <div class=\"result-details\">\n <vdr-labeled-data [label]=\"'settings.shipping-method' | translate\">\n {{ quote.name }}\n </vdr-labeled-data>\n <div class=\"price-row\">\n <vdr-labeled-data [label]=\"'common.price' | translate\">\n {{ quote.price | localeCurrency: currencyCode }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'common.price-with-tax' | translate\">\n {{ quote.priceWithTax | localeCurrency: currencyCode }}\n </vdr-labeled-data>\n </div>\n <vdr-object-tree *ngIf=\"quote.metadata\" [value]=\"quote.metadata\"></vdr-object-tree>\n </div>\n </vdr-radio-card>\n</vdr-radio-card-fieldset>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"!selectedMethod\"\n class=\"btn btn-primary\"\n >\n {{ 'common.okay' | translate }}\n </button>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.ObjectTreeComponent, selector: "vdr-object-tree", inputs: ["value", "isArrayItem"] }, { kind: "component", type: i1.RadioCardComponent, selector: "vdr-radio-card", inputs: ["item"], exportAs: ["VdrRadioCard"] }, { kind: "component", type: i1.RadioCardFieldsetComponent, selector: "vdr-radio-card-fieldset", inputs: ["selectedItemId", "idFn"], outputs: ["selectItem"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
362
|
+
}
|
|
363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectShippingMethodDialogComponent, decorators: [{
|
|
364
|
+
type: Component,
|
|
365
|
+
args: [{ selector: 'vdr-select-shipping-method-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.select-shipping-method' | translate }}</ng-template>\n<vdr-radio-card-fieldset\n [idFn]=\"methodIdFn\"\n [selectedItemId]=\"selectedMethod?.id\"\n (selectItem)=\"selectedMethod = $event\"\n>\n <vdr-radio-card *ngFor=\"let quote of eligibleShippingMethods\" [item]=\"quote\">\n <div class=\"result-details\">\n <vdr-labeled-data [label]=\"'settings.shipping-method' | translate\">\n {{ quote.name }}\n </vdr-labeled-data>\n <div class=\"price-row\">\n <vdr-labeled-data [label]=\"'common.price' | translate\">\n {{ quote.price | localeCurrency: currencyCode }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'common.price-with-tax' | translate\">\n {{ quote.priceWithTax | localeCurrency: currencyCode }}\n </vdr-labeled-data>\n </div>\n <vdr-object-tree *ngIf=\"quote.metadata\" [value]=\"quote.metadata\"></vdr-object-tree>\n </div>\n </vdr-radio-card>\n</vdr-radio-card-fieldset>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button\n type=\"submit\"\n (click)=\"select()\"\n [disabled]=\"!selectedMethod\"\n class=\"btn btn-primary\"\n >\n {{ 'common.okay' | translate }}\n </button>\n</ng-template>\n" }]
|
|
366
|
+
}] });
|
|
367
|
+
|
|
368
|
+
class OrderStateSelectDialogComponent {
|
|
369
|
+
constructor() {
|
|
370
|
+
this.nextStates = [];
|
|
371
|
+
this.message = '';
|
|
372
|
+
this.selectedState = '';
|
|
373
|
+
}
|
|
374
|
+
select() {
|
|
375
|
+
if (this.selectedState) {
|
|
376
|
+
this.resolveWith(this.selectedState);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
cancel() {
|
|
380
|
+
this.resolveWith();
|
|
381
|
+
}
|
|
382
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderStateSelectDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
383
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderStateSelectDialogComponent, selector: "vdr-order-state-select-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.select-state' | translate }}</ng-template>\n<p>{{ message | translate }}</p>\n<vdr-form-field>\n <select name=\"state\" [(ngModel)]=\"selectedState\">\n <option *ngFor=\"let state of nextStates\" [value]=\"state\">\n {{ state | stateI18nToken | translate }}\n </option>\n </select>\n</vdr-form-field>\n<ng-template vdrDialogButtons>\n <button type=\"submit\" *ngIf=\"cancellable\" (click)=\"cancel()\" class=\"btn btn-secondary\">\n {{ 'common.cancel' | translate }}\n </button>\n <button type=\"submit\" (click)=\"select()\" class=\"btn btn-primary\" [disabled]=\"!selectedState\">\n {{ 'order.transition-to-state' | translate: { state: (selectedState | stateI18nToken | translate) } }}\n </button>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"], outputs: ["readOnlyToggleChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
384
|
+
}
|
|
385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderStateSelectDialogComponent, decorators: [{
|
|
386
|
+
type: Component,
|
|
387
|
+
args: [{ selector: 'vdr-order-state-select-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.select-state' | translate }}</ng-template>\n<p>{{ message | translate }}</p>\n<vdr-form-field>\n <select name=\"state\" [(ngModel)]=\"selectedState\">\n <option *ngFor=\"let state of nextStates\" [value]=\"state\">\n {{ state | stateI18nToken | translate }}\n </option>\n </select>\n</vdr-form-field>\n<ng-template vdrDialogButtons>\n <button type=\"submit\" *ngIf=\"cancellable\" (click)=\"cancel()\" class=\"btn btn-secondary\">\n {{ 'common.cancel' | translate }}\n </button>\n <button type=\"submit\" (click)=\"select()\" class=\"btn btn-primary\" [disabled]=\"!selectedState\">\n {{ 'order.transition-to-state' | translate: { state: (selectedState | stateI18nToken | translate) } }}\n </button>\n</ng-template>\n" }]
|
|
388
|
+
}] });
|
|
389
|
+
|
|
390
|
+
class OrderTransitionService {
|
|
391
|
+
constructor(dataService, modalService, notificationService, i18nService) {
|
|
392
|
+
this.dataService = dataService;
|
|
393
|
+
this.modalService = modalService;
|
|
394
|
+
this.notificationService = notificationService;
|
|
395
|
+
this.i18nService = i18nService;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Attempts to transition the Order to the last state it was in before it was transitioned
|
|
399
|
+
* to the "Modifying" state. If this fails, a manual prompt is used.
|
|
400
|
+
*/
|
|
401
|
+
transitionToPreModifyingState(orderId, nextStates) {
|
|
402
|
+
return this.getPreModifyingState(orderId).pipe(switchMap(state => {
|
|
403
|
+
const manualTransitionOptions = {
|
|
404
|
+
orderId,
|
|
405
|
+
nextStates,
|
|
406
|
+
message: this.i18nService.translate(marker('order.unable-to-transition-to-state-try-another'), { state }),
|
|
407
|
+
cancellable: false,
|
|
408
|
+
retry: 10,
|
|
409
|
+
};
|
|
410
|
+
if (state) {
|
|
411
|
+
return this.transitionToStateOrThrow(orderId, state).pipe(catchError(err => this.manuallyTransitionToState(manualTransitionOptions)));
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
return this.manuallyTransitionToState(manualTransitionOptions);
|
|
415
|
+
}
|
|
416
|
+
}));
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Displays a modal for manually selecting the next state.
|
|
420
|
+
*/
|
|
421
|
+
manuallyTransitionToState(options) {
|
|
422
|
+
return this.modalService
|
|
423
|
+
.fromComponent(OrderStateSelectDialogComponent, {
|
|
424
|
+
locals: {
|
|
425
|
+
nextStates: options.nextStates,
|
|
426
|
+
cancellable: options.cancellable,
|
|
427
|
+
message: options.message,
|
|
428
|
+
},
|
|
429
|
+
closable: false,
|
|
430
|
+
size: 'md',
|
|
431
|
+
})
|
|
432
|
+
.pipe(switchMap(result => {
|
|
433
|
+
if (result) {
|
|
434
|
+
return this.transitionToStateOrThrow(options.orderId, result);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
if (!options.cancellable) {
|
|
438
|
+
throw new Error(`An order state must be selected`);
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
return EMPTY;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}), retryWhen(errors => errors.pipe(delay(2000), take(options.retry))));
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Attempts to get the last state the Order was in before it was transitioned
|
|
448
|
+
* to the "Modifying" state.
|
|
449
|
+
*/
|
|
450
|
+
getPreModifyingState(orderId) {
|
|
451
|
+
return this.dataService.order
|
|
452
|
+
.getOrderHistory(orderId, {
|
|
453
|
+
filter: {
|
|
454
|
+
type: {
|
|
455
|
+
eq: HistoryEntryType.ORDER_STATE_TRANSITION,
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
sort: {
|
|
459
|
+
createdAt: SortOrder.DESC,
|
|
460
|
+
},
|
|
461
|
+
})
|
|
462
|
+
.mapSingle(result => result.order)
|
|
463
|
+
.pipe(map(result => {
|
|
464
|
+
const item = result?.history.items.find(i => i.data.to === 'Modifying');
|
|
465
|
+
if (item) {
|
|
466
|
+
return item.data.from;
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
}));
|
|
472
|
+
}
|
|
473
|
+
transitionToStateOrThrow(orderId, state) {
|
|
474
|
+
return this.dataService.order.transitionToState(orderId, state).pipe(map(({ transitionOrderToState }) => {
|
|
475
|
+
switch (transitionOrderToState?.__typename) {
|
|
476
|
+
case 'Order':
|
|
477
|
+
return transitionOrderToState?.state;
|
|
478
|
+
case 'OrderStateTransitionError':
|
|
479
|
+
this.notificationService.error(transitionOrderToState?.transitionError);
|
|
480
|
+
throw new Error(transitionOrderToState?.transitionError);
|
|
481
|
+
}
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
484
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderTransitionService, deps: [{ token: i1.DataService }, { token: i1.ModalService }, { token: i1.NotificationService }, { token: i1.I18nService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
485
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderTransitionService, providedIn: 'root' }); }
|
|
486
|
+
}
|
|
487
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderTransitionService, decorators: [{
|
|
488
|
+
type: Injectable,
|
|
489
|
+
args: [{
|
|
490
|
+
providedIn: 'root',
|
|
491
|
+
}]
|
|
492
|
+
}], ctorParameters: () => [{ type: i1.DataService }, { type: i1.ModalService }, { type: i1.NotificationService }, { type: i1.I18nService }] });
|
|
493
|
+
|
|
494
|
+
class OrderCustomFieldsCardComponent {
|
|
495
|
+
constructor(formBuilder, modalService) {
|
|
496
|
+
this.formBuilder = formBuilder;
|
|
497
|
+
this.modalService = modalService;
|
|
498
|
+
this.customFieldsConfig = [];
|
|
499
|
+
this.customFieldValues = {};
|
|
500
|
+
this.updateClick = new EventEmitter();
|
|
501
|
+
this.editable = false;
|
|
502
|
+
}
|
|
503
|
+
ngOnInit() {
|
|
504
|
+
this.customFieldForm = this.formBuilder.group({});
|
|
505
|
+
for (const field of this.customFieldsConfig) {
|
|
506
|
+
this.customFieldForm.addControl(field.name, this.formBuilder.control(this.customFieldValues[field.name]));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
onUpdateClick() {
|
|
510
|
+
this.updateClick.emit(this.customFieldForm.value);
|
|
511
|
+
this.customFieldForm.markAsPristine();
|
|
512
|
+
this.editable = false;
|
|
513
|
+
}
|
|
514
|
+
onCancelClick() {
|
|
515
|
+
if (this.customFieldForm.dirty) {
|
|
516
|
+
this.modalService
|
|
517
|
+
.dialog({
|
|
518
|
+
title: marker('catalog.confirm-cancel'),
|
|
519
|
+
buttons: [
|
|
520
|
+
{ type: 'secondary', label: marker('common.keep-editing') },
|
|
521
|
+
{ type: 'danger', label: marker('common.discard-changes'), returnValue: true },
|
|
522
|
+
],
|
|
523
|
+
})
|
|
524
|
+
.subscribe(result => {
|
|
525
|
+
if (result) {
|
|
526
|
+
this.customFieldForm.reset();
|
|
527
|
+
this.customFieldForm.markAsPristine();
|
|
528
|
+
this.editable = false;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
this.editable = false;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderCustomFieldsCardComponent, deps: [{ token: i2.UntypedFormBuilder }, { token: i1.ModalService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
537
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderCustomFieldsCardComponent, selector: "vdr-order-custom-fields-card", inputs: { customFieldsConfig: "customFieldsConfig", customFieldValues: "customFieldValues" }, outputs: { updateClick: "updateClick" }, ngImport: i0, template: "<div class=\"card\" *ngIf=\"customFieldsConfig.length\">\n <div class=\"card-header\">\n {{ 'common.custom-fields' | translate }}\n </div>\n <div class=\"card-block\">\n <div class=\"card-text custom-field-form\" [class.editable]=\"editable\">\n <vdr-tabbed-custom-fields\n entityName=\"Order\"\n [customFields]=\"customFieldsConfig\"\n [customFieldsFormGroup]=\"customFieldForm\"\n [readonly]=\"!editable\"\n [compact]=\"true\"\n ></vdr-tabbed-custom-fields>\n </div>\n </div>\n <div class=\"card-footer\">\n <button class=\"btn btn-sm btn-secondary\" (click)=\"editable = true\" *ngIf=\"!editable\">\n <clr-icon shape=\"pencil\"></clr-icon>\n {{ 'common.edit' | translate }}\n </button>\n <button\n class=\"btn btn-sm btn-primary\"\n (click)=\"onUpdateClick()\"\n *ngIf=\"editable\"\n [disabled]=\"customFieldForm.pristine || customFieldForm.invalid\"\n >\n <clr-icon shape=\"check\"></clr-icon>\n {{ 'common.update' | translate }}\n </button>\n <button\n class=\"btn btn-sm btn-secondary\"\n (click)=\"onCancelClick()\"\n *ngIf=\"editable\"\n >\n <clr-icon shape=\"times\"></clr-icon>\n {{ 'common.cancel' | translate }}\n </button>\n </div>\n</div>\n", styles: ["vdr-custom-field-control{margin-bottom:6px;display:block}.custom-field-form ::ng-deep .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable ::ng-deep .clr-control-label{color:inherit}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.TabbedCustomFieldsComponent, selector: "vdr-tabbed-custom-fields", inputs: ["entityName", "customFields", "customFieldsFormGroup", "readonly", "compact", "showLabel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
538
|
+
}
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderCustomFieldsCardComponent, decorators: [{
|
|
540
|
+
type: Component,
|
|
541
|
+
args: [{ selector: 'vdr-order-custom-fields-card', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"card\" *ngIf=\"customFieldsConfig.length\">\n <div class=\"card-header\">\n {{ 'common.custom-fields' | translate }}\n </div>\n <div class=\"card-block\">\n <div class=\"card-text custom-field-form\" [class.editable]=\"editable\">\n <vdr-tabbed-custom-fields\n entityName=\"Order\"\n [customFields]=\"customFieldsConfig\"\n [customFieldsFormGroup]=\"customFieldForm\"\n [readonly]=\"!editable\"\n [compact]=\"true\"\n ></vdr-tabbed-custom-fields>\n </div>\n </div>\n <div class=\"card-footer\">\n <button class=\"btn btn-sm btn-secondary\" (click)=\"editable = true\" *ngIf=\"!editable\">\n <clr-icon shape=\"pencil\"></clr-icon>\n {{ 'common.edit' | translate }}\n </button>\n <button\n class=\"btn btn-sm btn-primary\"\n (click)=\"onUpdateClick()\"\n *ngIf=\"editable\"\n [disabled]=\"customFieldForm.pristine || customFieldForm.invalid\"\n >\n <clr-icon shape=\"check\"></clr-icon>\n {{ 'common.update' | translate }}\n </button>\n <button\n class=\"btn btn-sm btn-secondary\"\n (click)=\"onCancelClick()\"\n *ngIf=\"editable\"\n >\n <clr-icon shape=\"times\"></clr-icon>\n {{ 'common.cancel' | translate }}\n </button>\n </div>\n</div>\n", styles: ["vdr-custom-field-control{margin-bottom:6px;display:block}.custom-field-form ::ng-deep .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable ::ng-deep .clr-control-label{color:inherit}\n"] }]
|
|
542
|
+
}], ctorParameters: () => [{ type: i2.UntypedFormBuilder }, { type: i1.ModalService }], propDecorators: { customFieldsConfig: [{
|
|
543
|
+
type: Input
|
|
544
|
+
}], customFieldValues: [{
|
|
545
|
+
type: Input
|
|
546
|
+
}], updateClick: [{
|
|
547
|
+
type: Output
|
|
548
|
+
}] } });
|
|
549
|
+
|
|
550
|
+
class LineFulfillmentComponent {
|
|
551
|
+
constructor() {
|
|
552
|
+
this.fulfilledCount = 0;
|
|
553
|
+
this.fulfillments = [];
|
|
554
|
+
}
|
|
555
|
+
ngOnChanges(changes) {
|
|
556
|
+
if (this.line) {
|
|
557
|
+
this.fulfilledCount = this.getDeliveredCount(this.line);
|
|
558
|
+
this.fulfillmentStatus = this.getFulfillmentStatus(this.fulfilledCount, this.line.quantity);
|
|
559
|
+
this.fulfillments = this.getFulfillments(this.line);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Returns the number of items in an OrderLine which are fulfilled.
|
|
564
|
+
*/
|
|
565
|
+
getDeliveredCount(line) {
|
|
566
|
+
return (line.fulfillmentLines?.reduce((sum, fulfillmentLine) => sum + fulfillmentLine.quantity, 0) ?? 0);
|
|
567
|
+
}
|
|
568
|
+
getFulfillmentStatus(fulfilledCount, lineQuantity) {
|
|
569
|
+
if (fulfilledCount === lineQuantity) {
|
|
570
|
+
return 'full';
|
|
571
|
+
}
|
|
572
|
+
if (0 < fulfilledCount && fulfilledCount < lineQuantity) {
|
|
573
|
+
return 'partial';
|
|
574
|
+
}
|
|
575
|
+
return 'none';
|
|
576
|
+
}
|
|
577
|
+
getFulfillments(line) {
|
|
578
|
+
return (line.fulfillmentLines
|
|
579
|
+
?.map(fulfillmentLine => {
|
|
580
|
+
const fulfillment = this.allOrderFulfillments?.find(f => f.id === fulfillmentLine.fulfillmentId);
|
|
581
|
+
if (!fulfillment) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
return {
|
|
585
|
+
count: fulfillmentLine.quantity,
|
|
586
|
+
fulfillment,
|
|
587
|
+
};
|
|
588
|
+
})
|
|
589
|
+
.filter(notNullOrUndefined) ?? []);
|
|
590
|
+
}
|
|
591
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LineFulfillmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
592
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: LineFulfillmentComponent, selector: "vdr-line-fulfillment", inputs: { line: "line", allOrderFulfillments: "allOrderFulfillments", orderState: "orderState" }, usesOnChanges: true, ngImport: i0, template: "<vdr-dropdown class=\"search-settings-menu\" *ngIf=\"fulfilledCount || orderState === 'PartiallyDelivered'\">\n <button type=\"button\" class=\"icon-button\" vdrDropdownTrigger>\n <clr-icon *ngIf=\"fulfillmentStatus === 'full'\" class=\"item-fulfilled\" shape=\"check-circle\"></clr-icon>\n <clr-icon\n *ngIf=\"fulfillmentStatus === 'partial'\"\n class=\"item-partially-fulfilled\"\n shape=\"check-circle\"\n ></clr-icon>\n <clr-icon\n *ngIf=\"fulfillmentStatus === 'none'\"\n class=\"item-not-fulfilled\"\n shape=\"exclamation-circle\"\n ></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <label class=\"dropdown-header\" *ngIf=\"fulfillmentStatus === 'full'\">\n {{ 'order.line-fulfillment-all' | translate }}\n </label>\n <label class=\"dropdown-header\" *ngIf=\"fulfillmentStatus === 'partial'\">\n {{\n 'order.line-fulfillment-partial' | translate: { total: line.quantity, count: fulfilledCount }\n }}\n </label>\n <label class=\"dropdown-header\" *ngIf=\"fulfillmentStatus === 'none'\">\n {{ 'order.line-fulfillment-none' | translate }}\n </label>\n <div class=\"fulfillment-detail\" *ngFor=\"let item of fulfillments\">\n <div class=\"fulfillment-title\">\n {{ 'order.fulfillment' | translate }} #{{ item.fulfillment.id }} ({{\n 'order.item-count' | translate: { count: item.count }\n }})\n </div>\n <vdr-labeled-data [label]=\"'common.created-at' | translate\">\n {{ item.fulfillment.createdAt | localeDate: 'medium' }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.fulfillment-method' | translate\">\n {{ item.fulfillment.method }}\n </vdr-labeled-data>\n <vdr-labeled-data\n *ngIf=\"item.fulfillment.trackingCode\"\n [label]=\"'order.tracking-code' | translate\"\n >\n {{ item.fulfillment.trackingCode }}\n </vdr-labeled-data>\n </div>\n </vdr-dropdown-menu>\n</vdr-dropdown>\n", styles: [".item-fulfilled{color:var(--color-success-700)}.item-partially-fulfilled{color:var(--color-warning-700)}.item-not-fulfilled{color:var(--color-error-700)}.fulfillment-detail{margin:6px 12px}.fulfillment-detail:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["id", "for"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
593
|
+
}
|
|
594
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LineFulfillmentComponent, decorators: [{
|
|
595
|
+
type: Component,
|
|
596
|
+
args: [{ selector: 'vdr-line-fulfillment', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-dropdown class=\"search-settings-menu\" *ngIf=\"fulfilledCount || orderState === 'PartiallyDelivered'\">\n <button type=\"button\" class=\"icon-button\" vdrDropdownTrigger>\n <clr-icon *ngIf=\"fulfillmentStatus === 'full'\" class=\"item-fulfilled\" shape=\"check-circle\"></clr-icon>\n <clr-icon\n *ngIf=\"fulfillmentStatus === 'partial'\"\n class=\"item-partially-fulfilled\"\n shape=\"check-circle\"\n ></clr-icon>\n <clr-icon\n *ngIf=\"fulfillmentStatus === 'none'\"\n class=\"item-not-fulfilled\"\n shape=\"exclamation-circle\"\n ></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <label class=\"dropdown-header\" *ngIf=\"fulfillmentStatus === 'full'\">\n {{ 'order.line-fulfillment-all' | translate }}\n </label>\n <label class=\"dropdown-header\" *ngIf=\"fulfillmentStatus === 'partial'\">\n {{\n 'order.line-fulfillment-partial' | translate: { total: line.quantity, count: fulfilledCount }\n }}\n </label>\n <label class=\"dropdown-header\" *ngIf=\"fulfillmentStatus === 'none'\">\n {{ 'order.line-fulfillment-none' | translate }}\n </label>\n <div class=\"fulfillment-detail\" *ngFor=\"let item of fulfillments\">\n <div class=\"fulfillment-title\">\n {{ 'order.fulfillment' | translate }} #{{ item.fulfillment.id }} ({{\n 'order.item-count' | translate: { count: item.count }\n }})\n </div>\n <vdr-labeled-data [label]=\"'common.created-at' | translate\">\n {{ item.fulfillment.createdAt | localeDate: 'medium' }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.fulfillment-method' | translate\">\n {{ item.fulfillment.method }}\n </vdr-labeled-data>\n <vdr-labeled-data\n *ngIf=\"item.fulfillment.trackingCode\"\n [label]=\"'order.tracking-code' | translate\"\n >\n {{ item.fulfillment.trackingCode }}\n </vdr-labeled-data>\n </div>\n </vdr-dropdown-menu>\n</vdr-dropdown>\n", styles: [".item-fulfilled{color:var(--color-success-700)}.item-partially-fulfilled{color:var(--color-warning-700)}.item-not-fulfilled{color:var(--color-error-700)}.fulfillment-detail{margin:6px 12px}.fulfillment-detail:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}\n"] }]
|
|
597
|
+
}], propDecorators: { line: [{
|
|
598
|
+
type: Input
|
|
599
|
+
}], allOrderFulfillments: [{
|
|
600
|
+
type: Input
|
|
601
|
+
}], orderState: [{
|
|
602
|
+
type: Input
|
|
603
|
+
}] } });
|
|
604
|
+
|
|
605
|
+
class LineRefundsComponent {
|
|
606
|
+
getRefundedCount() {
|
|
607
|
+
const refundLines = this.payments
|
|
608
|
+
?.reduce((all, payment) => [...all, ...payment.refunds], [])
|
|
609
|
+
.filter(refund => refund.state !== 'Failed')
|
|
610
|
+
.reduce((all, refund) => [...all, ...refund.lines], []) ?? [];
|
|
611
|
+
return refundLines
|
|
612
|
+
.filter(i => i.orderLineId === this.line.id)
|
|
613
|
+
.reduce((sum, i) => sum + i.quantity, 0);
|
|
614
|
+
}
|
|
615
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LineRefundsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
616
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: LineRefundsComponent, selector: "vdr-line-refunds", inputs: { line: "line", payments: "payments" }, ngImport: i0, template: "<span *ngIf=\"getRefundedCount()\" [title]=\"'order.refunded-count' | translate: { count: getRefundedCount() }\">\n <clr-icon shape=\"redo\" class=\"is-solid\" dir=\"down\"></clr-icon>\n</span>\n", styles: [":host{color:var(--color-error-500)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.Dir, selector: "[dir]", inputs: ["dir"], outputs: ["dirChange"], exportAs: ["dir"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
617
|
+
}
|
|
618
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LineRefundsComponent, decorators: [{
|
|
619
|
+
type: Component,
|
|
620
|
+
args: [{ selector: 'vdr-line-refunds', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span *ngIf=\"getRefundedCount()\" [title]=\"'order.refunded-count' | translate: { count: getRefundedCount() }\">\n <clr-icon shape=\"redo\" class=\"is-solid\" dir=\"down\"></clr-icon>\n</span>\n", styles: [":host{color:var(--color-error-500)}\n"] }]
|
|
621
|
+
}], propDecorators: { line: [{
|
|
622
|
+
type: Input
|
|
623
|
+
}], payments: [{
|
|
624
|
+
type: Input
|
|
625
|
+
}] } });
|
|
626
|
+
|
|
627
|
+
class OrderTotalColumnComponent extends DataTable2ColumnComponent {
|
|
628
|
+
constructor() {
|
|
629
|
+
super(...arguments);
|
|
630
|
+
this.orderable = false;
|
|
631
|
+
}
|
|
632
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderTotalColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
633
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderTotalColumnComponent, selector: "vdr-order-total-column", exportAs: ["row"], usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
|
|
634
|
+
}
|
|
635
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderTotalColumnComponent, decorators: [{
|
|
636
|
+
type: Component,
|
|
637
|
+
args: [{
|
|
638
|
+
selector: 'vdr-order-total-column',
|
|
639
|
+
template: ``,
|
|
640
|
+
exportAs: 'row',
|
|
641
|
+
}]
|
|
642
|
+
}] });
|
|
643
|
+
|
|
644
|
+
class OrderDataTableComponent extends DataTable2Component {
|
|
645
|
+
get allColumns() {
|
|
646
|
+
return [...(this.columns ?? []), ...(this.customFieldColumns ?? []), ...(this.totalColumns ?? [])];
|
|
647
|
+
}
|
|
648
|
+
get sortedColumns() {
|
|
649
|
+
const columns = this.allColumns;
|
|
650
|
+
const dataTableConfig = this.getDataTableConfig();
|
|
651
|
+
for (const [id, index] of Object.entries(dataTableConfig[this.id].order)) {
|
|
652
|
+
const column = columns.find(c => c.id === id);
|
|
653
|
+
const currentIndex = columns.findIndex(c => c.id === id);
|
|
654
|
+
if (currentIndex !== -1 && column) {
|
|
655
|
+
columns.splice(currentIndex, 1);
|
|
656
|
+
columns.splice(index, 0, column);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return columns;
|
|
660
|
+
}
|
|
661
|
+
getPromotionLink(promotion) {
|
|
662
|
+
const id = promotion.adjustmentSource.split(':')[1];
|
|
663
|
+
return ['/marketing', 'promotions', id];
|
|
664
|
+
}
|
|
665
|
+
getCouponCodeForAdjustment(order, promotionAdjustment) {
|
|
666
|
+
const id = promotionAdjustment.adjustmentSource.split(':')[1];
|
|
667
|
+
const promotion = order.promotions.find(p => p.id === id);
|
|
668
|
+
if (promotion) {
|
|
669
|
+
return promotion.couponCode || undefined;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
getShippingNames(order) {
|
|
673
|
+
if (order.shippingLines.length) {
|
|
674
|
+
return order.shippingLines.map(shippingLine => shippingLine.shippingMethod.name).join(', ');
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
return '';
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderDataTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
681
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderDataTableComponent, selector: "vdr-order-data-table", inputs: { order: "order" }, queries: [{ propertyName: "totalColumns", predicate: OrderTotalColumnComponent }], usesInheritance: true, ngImport: i0, template: "<div class=\"bulk-actions\">\n <ng-content select=\"vdr-bulk-action-menu\"></ng-content>\n</div>\n<div class=\"table-wrapper\">\n <table\n class=\"\"\n [class.no-select]=\"disableSelect\"\n >\n <thead [class.items-selected]=\"selectionManager?.selection.length\">\n <tr class=\"heading-row\">\n <th *ngIf=\"selectionManager\" class=\"selection-col\">\n <input\n type=\"checkbox\"\n clrCheckbox\n [checked]=\"selectionManager?.areAllCurrentItemsSelected()\"\n (change)=\"onToggleAllClick()\"\n />\n </th>\n <th\n *ngFor=\"let column of visibleSortedColumns; last as isLast\"\n [class.expand]=\"column.expand\"\n >\n <div class=\"cell-content\" [ngClass]=\"column.align\">\n <vdr-ui-extension-point\n [locationId]=\"id\"\n [metadata]=\"column.id\"\n api=\"dataTable\"\n [topPx]=\"-6\"\n [leftPx]=\"-24\"\n display=\"block\"\n >\n <span>{{ column.heading }}</span>\n </vdr-ui-extension-point>\n <div *ngIf=\"column.sort as sort\" class=\"sort-toggle\">\n <button (click)=\"sort.toggleSortOrder()\" [class.active]=\"sort.sortOrder\">\n <clr-icon *ngIf=\"!sort.sortOrder\" shape=\"two-way-arrows left\"></clr-icon>\n <clr-icon *ngIf=\"sort.sortOrder === 'ASC'\" shape=\"arrow up\"></clr-icon>\n <clr-icon *ngIf=\"sort.sortOrder === 'DESC'\" shape=\"arrow down\"></clr-icon>\n </button>\n <div class=\"sort-label\" *ngIf=\"sort.sortOrder\">{{ sort.sortOrder }}</div>\n </div>\n </div>\n </th>\n <th>\n <div class=\"column-picker\">\n <vdr-data-table-colum-picker\n [uiLanguage]=\"uiLanguage$ | async\"\n [columns]=\"sortedColumns\"\n (reorder)=\"onColumnReorder($event)\"\n (resetColumns)=\"onColumnsReset()\"\n ></vdr-data-table-colum-picker>\n </div>\n </th>\n </tr>\n <tr *ngIf=\"searchComponent || customSearchTemplate || filters?.length\">\n <th\n [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\"\n class=\"filter-row\"\n [class.active]=\"showSearchFilterRow\"\n >\n <button\n class=\"button-ghost toggle-search-filter-row\"\n [class.active]=\"showSearchFilterRow\"\n (click)=\"toggleSearchFilterRow()\"\n [title]=\"'common.search-and-filter-list' | translate\"\n >\n <clr-icon shape=\"search\"></clr-icon>\n </button>\n <div class=\"filter-row-wrapper\" [class.hidden]=\"!showSearchFilterRow\">\n <ng-container *ngTemplateOutlet=\"searchComponent?.template\"></ng-container>\n <ng-container *ngTemplateOutlet=\"customSearchTemplate\"></ng-container>\n <ng-container *ngIf=\"filters\">\n <div class=\"filters\">\n <vdr-data-table-filters\n *ngFor=\"let activeFilter of filters.activeFilters\"\n [filterWithValue]=\"activeFilter\"\n [filters]=\"filters\"\n class=\"mt-1\"\n ></vdr-data-table-filters>\n <vdr-data-table-filters\n *ngIf=\"filters.length\"\n [filters]=\"filters\"\n class=\"mt-1\"\n ></vdr-data-table-filters>\n </div>\n </ng-container>\n </div>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let item of items\n | paginate\n : {\n id: id,\n itemsPerPage: itemsPerPage,\n currentPage: currentPage,\n totalItems: totalItems\n };\n index as i;\n trackBy: trackByFn\n \"\n >\n <td *ngIf=\"selectionManager\" class=\"selection-col\" [class.active]=\"activeIndex === i\">\n <input\n type=\"checkbox\"\n clrCheckbox\n [checked]=\"selectionManager?.isSelected(item)\"\n (click)=\"onRowClick(item, $event)\"\n />\n </td>\n <td *ngFor=\"let column of visibleSortedColumns\" [class.active]=\"activeIndex === i\">\n <div class=\"cell-content\" [ngClass]=\"column.align\">\n <ng-container\n *ngIf=\"customComponents.get(column.id) as componentConfig; else defaultComponent\"\n >\n <ng-container\n *ngComponentOutlet=\"\n componentConfig.config.component;\n inputs: { rowItem: item };\n injector: componentConfig.injector\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultComponent>\n <ng-container\n *ngTemplateOutlet=\"column.template; context: { item: item, index: i }\"\n ></ng-container>\n </ng-template>\n </div>\n </td>\n <td [class.active]=\"activeIndex === i\"><!-- column select --></td>\n </tr>\n <ng-container>\n <tr *ngIf=\"!items?.length\">\n <td [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\">\n <vdr-empty-placeholder [emptyStateLabel]=\"'order.order-is-empty' | translate\"></vdr-empty-placeholder>\n </td>\n </tr>\n </ng-container>\n <tr class=\"surcharge\" *ngFor=\"let surcharge of order.surcharges\">\n <td class=\"align-middle name left\" colspan=\"2\">{{ surcharge.description }}</td>\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\n <td class=\"align-middle\" [attr.colspan]=\"visibleSortedColumns.length - 4\"></td>\n <td class=\"align-middle total\">\n {{ surcharge.priceWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ surcharge.price | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n <ng-container *ngFor=\"let discount of order.discounts\">\n <tr class=\"order-adjustment\" *ngIf=\"discount.type !== 'OTHER'\">\n <td [attr.colspan]=\"visibleSortedColumns.length - 1\" class=\"\">\n <a [routerLink]=\"getPromotionLink(discount)\">{{ discount.description }}</a>\n <vdr-chip *ngIf=\"getCouponCodeForAdjustment(order, discount) as couponCode\">{{\n couponCode\n }}</vdr-chip>\n </td>\n <td class=\"\">\n {{ discount.amountWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ discount.amount | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n </ng-container>\n <tr class=\"sub-total\">\n <td class=\"\">{{ 'order.sub-total' | translate }}</td>\n <td [attr.colspan]=\"visibleSortedColumns.length - 2\"></td>\n <td class=\"clr-align-middle\">\n {{ order.subTotalWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ order.subTotal | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n <tr class=\"shipping\">\n <td class=\"\">{{ 'order.shipping' | translate }}</td>\n <td [attr.colspan]=\"visibleSortedColumns.length - 2\">\n <vdr-chip *ngFor=\"let shippingLine of order.shippingLines\" class=\"shipping-method-name\">\n {{ shippingLine.shippingMethod.name }}\n </vdr-chip>\n </td>\n <td class=\"clr-align-middle\">\n {{ order.shippingWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ order.shipping | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n <tr class=\"total\">\n <td class=\"\">{{ 'order.total' | translate }}</td>\n <td [attr.colspan]=\"visibleSortedColumns.length - 2\"></td>\n <td class=\"clr-align-middle\">\n {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ order.total | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n </tbody>\n </table>\n</div>\n", styles: [":host{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th{border-bottom:1px solid var(--color-table-header-border);color:var(--color-weight-700);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap;background-color:transparent}th,td{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1);color:var(--color-text-100)}tr td:first-of-type,tr th:first-of-type{text-align:center}@media screen and (min-width: 992px){tr td:first-of-type,tr th:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th:last-of-type,td:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr:first-of-type th:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr:last-of-type td:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody td{border-bottom:1px solid var(--color-table-row-separator)}tbody tr:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table{width:100%}table.no-select{-webkit-user-select:none;user-select:none}.column-picker{width:24px}.sort-toggle{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle button{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle button.active{color:var(--color-primary-700)}.sort-toggle .sort-label{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row{left:8px}}.toggle-search-filter-row.active{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row input{width:100%}th.filter-row.active{border-bottom:1px solid var(--color-table-header-border)}th.filter-row .filters{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link{display:block;width:100%;height:100%}td.active{background-color:var(--color-table-row-active-bg)}.cell-content{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left{justify-content:flex-start}.cell-content.center{justify-content:center}.cell-content.right{justify-content:flex-end}.selection-col{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder{width:100%}.table-footer{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count{display:none}}\n", ":host .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}:host .sub-total td{border-top:1px dashed var(--color-component-border-200)}:host .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}:host td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}:host img{border-radius:var(--border-radius-img)}:host .order-line-custom-fields{display:flex;flex-wrap:wrap}:host .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}:host .draft-qty{max-width:48px}:host .order-line-custom-field{background-color:var(--color-component-bg-100)}:host .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}:host .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}:host .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}:host .thumb img{width:50px;height:50px}:host .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}:host .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrCheckbox, selector: "[clrCheckbox],[clrToggle]" }, { kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "component", type: i1.EmptyPlaceholderComponent, selector: "vdr-empty-placeholder", inputs: ["emptyStateLabel"] }, { kind: "component", type: i1.UiExtensionPointComponent, selector: "vdr-ui-extension-point", inputs: ["locationId", "metadata", "topPx", "leftPx", "display", "api"] }, { kind: "component", type: i1.DataTableFiltersComponent, selector: "vdr-data-table-filters", inputs: ["filters", "filterWithValue"] }, { kind: "component", type: i1.DataTableColumnPickerComponent, selector: "vdr-data-table-colum-picker", inputs: ["columns", "uiLanguage"], outputs: ["reorder", "resetColumns"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i5$1.PaginatePipe, name: "paginate" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
682
|
+
}
|
|
683
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderDataTableComponent, decorators: [{
|
|
684
|
+
type: Component,
|
|
685
|
+
args: [{ selector: 'vdr-order-data-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"bulk-actions\">\n <ng-content select=\"vdr-bulk-action-menu\"></ng-content>\n</div>\n<div class=\"table-wrapper\">\n <table\n class=\"\"\n [class.no-select]=\"disableSelect\"\n >\n <thead [class.items-selected]=\"selectionManager?.selection.length\">\n <tr class=\"heading-row\">\n <th *ngIf=\"selectionManager\" class=\"selection-col\">\n <input\n type=\"checkbox\"\n clrCheckbox\n [checked]=\"selectionManager?.areAllCurrentItemsSelected()\"\n (change)=\"onToggleAllClick()\"\n />\n </th>\n <th\n *ngFor=\"let column of visibleSortedColumns; last as isLast\"\n [class.expand]=\"column.expand\"\n >\n <div class=\"cell-content\" [ngClass]=\"column.align\">\n <vdr-ui-extension-point\n [locationId]=\"id\"\n [metadata]=\"column.id\"\n api=\"dataTable\"\n [topPx]=\"-6\"\n [leftPx]=\"-24\"\n display=\"block\"\n >\n <span>{{ column.heading }}</span>\n </vdr-ui-extension-point>\n <div *ngIf=\"column.sort as sort\" class=\"sort-toggle\">\n <button (click)=\"sort.toggleSortOrder()\" [class.active]=\"sort.sortOrder\">\n <clr-icon *ngIf=\"!sort.sortOrder\" shape=\"two-way-arrows left\"></clr-icon>\n <clr-icon *ngIf=\"sort.sortOrder === 'ASC'\" shape=\"arrow up\"></clr-icon>\n <clr-icon *ngIf=\"sort.sortOrder === 'DESC'\" shape=\"arrow down\"></clr-icon>\n </button>\n <div class=\"sort-label\" *ngIf=\"sort.sortOrder\">{{ sort.sortOrder }}</div>\n </div>\n </div>\n </th>\n <th>\n <div class=\"column-picker\">\n <vdr-data-table-colum-picker\n [uiLanguage]=\"uiLanguage$ | async\"\n [columns]=\"sortedColumns\"\n (reorder)=\"onColumnReorder($event)\"\n (resetColumns)=\"onColumnsReset()\"\n ></vdr-data-table-colum-picker>\n </div>\n </th>\n </tr>\n <tr *ngIf=\"searchComponent || customSearchTemplate || filters?.length\">\n <th\n [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\"\n class=\"filter-row\"\n [class.active]=\"showSearchFilterRow\"\n >\n <button\n class=\"button-ghost toggle-search-filter-row\"\n [class.active]=\"showSearchFilterRow\"\n (click)=\"toggleSearchFilterRow()\"\n [title]=\"'common.search-and-filter-list' | translate\"\n >\n <clr-icon shape=\"search\"></clr-icon>\n </button>\n <div class=\"filter-row-wrapper\" [class.hidden]=\"!showSearchFilterRow\">\n <ng-container *ngTemplateOutlet=\"searchComponent?.template\"></ng-container>\n <ng-container *ngTemplateOutlet=\"customSearchTemplate\"></ng-container>\n <ng-container *ngIf=\"filters\">\n <div class=\"filters\">\n <vdr-data-table-filters\n *ngFor=\"let activeFilter of filters.activeFilters\"\n [filterWithValue]=\"activeFilter\"\n [filters]=\"filters\"\n class=\"mt-1\"\n ></vdr-data-table-filters>\n <vdr-data-table-filters\n *ngIf=\"filters.length\"\n [filters]=\"filters\"\n class=\"mt-1\"\n ></vdr-data-table-filters>\n </div>\n </ng-container>\n </div>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let item of items\n | paginate\n : {\n id: id,\n itemsPerPage: itemsPerPage,\n currentPage: currentPage,\n totalItems: totalItems\n };\n index as i;\n trackBy: trackByFn\n \"\n >\n <td *ngIf=\"selectionManager\" class=\"selection-col\" [class.active]=\"activeIndex === i\">\n <input\n type=\"checkbox\"\n clrCheckbox\n [checked]=\"selectionManager?.isSelected(item)\"\n (click)=\"onRowClick(item, $event)\"\n />\n </td>\n <td *ngFor=\"let column of visibleSortedColumns\" [class.active]=\"activeIndex === i\">\n <div class=\"cell-content\" [ngClass]=\"column.align\">\n <ng-container\n *ngIf=\"customComponents.get(column.id) as componentConfig; else defaultComponent\"\n >\n <ng-container\n *ngComponentOutlet=\"\n componentConfig.config.component;\n inputs: { rowItem: item };\n injector: componentConfig.injector\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultComponent>\n <ng-container\n *ngTemplateOutlet=\"column.template; context: { item: item, index: i }\"\n ></ng-container>\n </ng-template>\n </div>\n </td>\n <td [class.active]=\"activeIndex === i\"><!-- column select --></td>\n </tr>\n <ng-container>\n <tr *ngIf=\"!items?.length\">\n <td [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\">\n <vdr-empty-placeholder [emptyStateLabel]=\"'order.order-is-empty' | translate\"></vdr-empty-placeholder>\n </td>\n </tr>\n </ng-container>\n <tr class=\"surcharge\" *ngFor=\"let surcharge of order.surcharges\">\n <td class=\"align-middle name left\" colspan=\"2\">{{ surcharge.description }}</td>\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\n <td class=\"align-middle\" [attr.colspan]=\"visibleSortedColumns.length - 4\"></td>\n <td class=\"align-middle total\">\n {{ surcharge.priceWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ surcharge.price | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n <ng-container *ngFor=\"let discount of order.discounts\">\n <tr class=\"order-adjustment\" *ngIf=\"discount.type !== 'OTHER'\">\n <td [attr.colspan]=\"visibleSortedColumns.length - 1\" class=\"\">\n <a [routerLink]=\"getPromotionLink(discount)\">{{ discount.description }}</a>\n <vdr-chip *ngIf=\"getCouponCodeForAdjustment(order, discount) as couponCode\">{{\n couponCode\n }}</vdr-chip>\n </td>\n <td class=\"\">\n {{ discount.amountWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ discount.amount | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n </ng-container>\n <tr class=\"sub-total\">\n <td class=\"\">{{ 'order.sub-total' | translate }}</td>\n <td [attr.colspan]=\"visibleSortedColumns.length - 2\"></td>\n <td class=\"clr-align-middle\">\n {{ order.subTotalWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ order.subTotal | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n <tr class=\"shipping\">\n <td class=\"\">{{ 'order.shipping' | translate }}</td>\n <td [attr.colspan]=\"visibleSortedColumns.length - 2\">\n <vdr-chip *ngFor=\"let shippingLine of order.shippingLines\" class=\"shipping-method-name\">\n {{ shippingLine.shippingMethod.name }}\n </vdr-chip>\n </td>\n <td class=\"clr-align-middle\">\n {{ order.shippingWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ order.shipping | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n <tr class=\"total\">\n <td class=\"\">{{ 'order.total' | translate }}</td>\n <td [attr.colspan]=\"visibleSortedColumns.length - 2\"></td>\n <td class=\"clr-align-middle\">\n {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ order.total | localeCurrency : order.currencyCode }}\n </div>\n </td>\n <td><!-- column select --></td>\n </tr>\n </tbody>\n </table>\n</div>\n", styles: [":host{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th{border-bottom:1px solid var(--color-table-header-border);color:var(--color-weight-700);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap;background-color:transparent}th,td{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1);color:var(--color-text-100)}tr td:first-of-type,tr th:first-of-type{text-align:center}@media screen and (min-width: 992px){tr td:first-of-type,tr th:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th:last-of-type,td:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr:first-of-type th:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr:last-of-type td:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody td{border-bottom:1px solid var(--color-table-row-separator)}tbody tr:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table{width:100%}table.no-select{-webkit-user-select:none;user-select:none}.column-picker{width:24px}.sort-toggle{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle button{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle button.active{color:var(--color-primary-700)}.sort-toggle .sort-label{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row{left:8px}}.toggle-search-filter-row.active{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row input{width:100%}th.filter-row.active{border-bottom:1px solid var(--color-table-header-border)}th.filter-row .filters{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link{display:block;width:100%;height:100%}td.active{background-color:var(--color-table-row-active-bg)}.cell-content{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left{justify-content:flex-start}.cell-content.center{justify-content:center}.cell-content.right{justify-content:flex-end}.selection-col{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder{width:100%}.table-footer{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count{display:none}}\n", ":host .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}:host .sub-total td{border-top:1px dashed var(--color-component-border-200)}:host .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}:host td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}:host img{border-radius:var(--border-radius-img)}:host .order-line-custom-fields{display:flex;flex-wrap:wrap}:host .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}:host .draft-qty{max-width:48px}:host .order-line-custom-field{background-color:var(--color-component-bg-100)}:host .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}:host .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}:host .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}:host .thumb img{width:50px;height:50px}:host .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}:host .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}\n"] }]
|
|
686
|
+
}], propDecorators: { totalColumns: [{
|
|
687
|
+
type: ContentChildren,
|
|
688
|
+
args: [OrderTotalColumnComponent]
|
|
689
|
+
}], order: [{
|
|
690
|
+
type: Input
|
|
691
|
+
}] } });
|
|
692
|
+
|
|
693
|
+
class OrderTableComponent {
|
|
694
|
+
constructor() {
|
|
695
|
+
this.isDraft = false;
|
|
696
|
+
this.adjust = new EventEmitter();
|
|
697
|
+
this.remove = new EventEmitter();
|
|
698
|
+
this.orderLineCustomFieldsVisible = false;
|
|
699
|
+
this.customFieldsForLine = {};
|
|
700
|
+
}
|
|
701
|
+
get visibleOrderLineCustomFields() {
|
|
702
|
+
return this.orderLineCustomFieldsVisible ? this.orderLineCustomFields : [];
|
|
703
|
+
}
|
|
704
|
+
get showElided() {
|
|
705
|
+
return !this.orderLineCustomFieldsVisible && 0 < this.orderLineCustomFields.length;
|
|
706
|
+
}
|
|
707
|
+
ngOnInit() {
|
|
708
|
+
this.orderLineCustomFieldsVisible = this.orderLineCustomFields.length < 2;
|
|
709
|
+
this.getLineCustomFields();
|
|
710
|
+
}
|
|
711
|
+
draftInputBlur(line, quantity) {
|
|
712
|
+
if (line.quantity !== quantity) {
|
|
713
|
+
this.adjust.emit({ lineId: line.id, quantity });
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
toggleOrderLineCustomFields() {
|
|
717
|
+
this.orderLineCustomFieldsVisible = !this.orderLineCustomFieldsVisible;
|
|
718
|
+
}
|
|
719
|
+
getLineDiscounts(line) {
|
|
720
|
+
return line.discounts.filter(a => a.type === AdjustmentType.PROMOTION);
|
|
721
|
+
}
|
|
722
|
+
getLineCustomFields() {
|
|
723
|
+
for (const line of this.order.lines) {
|
|
724
|
+
const formGroup = new UntypedFormGroup({});
|
|
725
|
+
const result = this.orderLineCustomFields
|
|
726
|
+
.map(config => {
|
|
727
|
+
const value = line.customFields[config.name];
|
|
728
|
+
formGroup.addControl(config.name, new UntypedFormControl(value));
|
|
729
|
+
return {
|
|
730
|
+
config,
|
|
731
|
+
formGroup,
|
|
732
|
+
value,
|
|
733
|
+
};
|
|
734
|
+
})
|
|
735
|
+
.filter(field => (this.orderLineCustomFieldsVisible ? true : field.value != null));
|
|
736
|
+
this.customFieldsForLine[line.id] = result;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
getPromotionLink(promotion) {
|
|
740
|
+
const id = promotion.adjustmentSource.split(':')[1];
|
|
741
|
+
return ['/marketing', 'promotions', id];
|
|
742
|
+
}
|
|
743
|
+
getCouponCodeForAdjustment(order, promotionAdjustment) {
|
|
744
|
+
const id = promotionAdjustment.adjustmentSource.split(':')[1];
|
|
745
|
+
const promotion = order.promotions.find(p => p.id === id);
|
|
746
|
+
if (promotion) {
|
|
747
|
+
return promotion.couponCode || undefined;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
getShippingNames(order) {
|
|
751
|
+
if (order.shippingLines.length) {
|
|
752
|
+
return order.shippingLines.map(shippingLine => shippingLine.shippingMethod.name).join(', ');
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
return '';
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
759
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderTableComponent, selector: "vdr-order-table", inputs: { order: "order", orderLineCustomFields: "orderLineCustomFields", isDraft: "isDraft" }, outputs: { adjust: "adjust", remove: "remove" }, ngImport: i0, template: "<vdr-order-data-table id=\"order-detail-list\" [items]=\"order.lines\" [order]=\"order\">\n <vdr-dt2-column id=\"id\" [heading]=\"'common.id' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"created-at\"\n [heading]=\"'common.created-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"updated-at\"\n [heading]=\"'common.updated-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.updatedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.image' | translate\" id=\"image\">\n <ng-template let-line=\"item\">\n <div class=\"image-placeholder\">\n <img\n *ngIf=\"line.featuredAsset as asset; else imagePlaceholder\"\n [src]=\"asset | assetPreview : 'tiny'\"\n />\n <ng-template #imagePlaceholder>\n <div class=\"placeholder\">\n <clr-icon shape=\"image\" size=\"48\"></clr-icon>\n </div>\n </ng-template>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.product-name' | translate\" id=\"product-name\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.name }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.product-sku' | translate\" id=\"product-sku\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.sku }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.unit-price' | translate\" id=\"unit-price\">\n <ng-template let-line=\"item\">\n <div class=\"unit-price\">\n {{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ line.unitPrice | localeCurrency : order.currencyCode }}\n </div>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.quantity' | translate\" id=\"quantity\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <ng-container *ngIf=\"!isDraft; else draft\">\n <div class=\"flex\">\n <div\n *ngIf=\"line.orderPlacedQuantity && line.quantity !== line.orderPlacedQuantity\"\n class=\"order-placed-quantity\"\n [title]=\"'order.original-quantity-at-checkout' | translate\"\n >\n {{ line.orderPlacedQuantity }}\n </div>\n <div>{{ line.quantity }}</div>\n </div>\n </ng-container>\n <ng-template #draft>\n <div class=\"flex\">\n <input\n class=\"draft-qty\"\n type=\"number\"\n min=\"0\"\n #qtyInput\n [value]=\"line.quantity\"\n (blur)=\"draftInputBlur(line, qtyInput.valueAsNumber)\"\n />\n <button class=\"icon-button\" (click)=\"remove.emit({ lineId: line.id })\">\n <clr-icon shape=\"trash\"></clr-icon>\n </button>\n </div>\n </ng-template>\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\n <vdr-line-fulfillment\n [line]=\"line\"\n [orderState]=\"order.state\"\n [allOrderFulfillments]=\"order.fulfillments\"\n ></vdr-line-fulfillment>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-custom-field-column\n *ngFor=\"let customField of orderLineCustomFields\"\n [customField]=\"customField\"\n />\n <vdr-order-total-column [heading]=\"'order.total' | translate\" id=\"total\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <div class=\"unit-price\">\n {{ line.linePriceWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ line.linePrice | localeCurrency : order.currencyCode }}\n </div>\n </div>\n\n <ng-container *ngIf=\"getLineDiscounts(line) as discounts\">\n <vdr-dropdown *ngIf=\"discounts.length\">\n <div class=\"promotions-label\" vdrDropdownTrigger>\n {{ 'order.promotions-applied' | translate }}\n </div>\n <vdr-dropdown-menu>\n <div class=\"line-promotion\" *ngFor=\"let discount of discounts\">\n <a class=\"promotion-name\" [routerLink]=\"getPromotionLink(discount)\">{{\n discount.description\n }}</a>\n <div class=\"promotion-amount\">\n {{ discount.amountWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ discount.amount | localeCurrency : order.currencyCode }}\n </div>\n </div>\n </div>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </ng-container>\n </ng-template>\n </vdr-order-total-column>\n</vdr-order-data-table>\n", styles: [":host .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}:host .sub-total td{border-top:1px dashed var(--color-component-border-200)}:host .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}:host td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}:host img{border-radius:var(--border-radius-img)}:host .order-line-custom-fields{display:flex;flex-wrap:wrap}:host .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}:host .draft-qty{max-width:48px}:host .order-line-custom-field{background-color:var(--color-component-bg-100)}:host .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}:host .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}:host .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}:host .thumb img{width:50px;height:50px}:host .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}:host .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}::ng-deep .line-promotion{display:flex;justify-content:space-between;padding:6px 12px}::ng-deep .line-promotion .promotion-amount{margin-inline-start:12px}::ng-deep .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "component", type: i1.DataTable2ColumnComponent, selector: "vdr-dt2-column", inputs: ["id", "expand", "heading", "align", "sort", "optional", "hiddenByDefault", "orderable"], exportAs: ["row"] }, { kind: "component", type: i1.DataTableCustomFieldColumnComponent, selector: "vdr-dt2-custom-field-column", inputs: ["customField", "sorts"], exportAs: ["row"] }, { kind: "component", type: LineFulfillmentComponent, selector: "vdr-line-fulfillment", inputs: ["line", "allOrderFulfillments", "orderState"] }, { kind: "component", type: LineRefundsComponent, selector: "vdr-line-refunds", inputs: ["line", "payments"] }, { kind: "component", type: OrderDataTableComponent, selector: "vdr-order-data-table", inputs: ["order"] }, { kind: "component", type: OrderTotalColumnComponent, selector: "vdr-order-total-column", exportAs: ["row"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.AssetPreviewPipe, name: "assetPreview" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
760
|
+
}
|
|
761
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderTableComponent, decorators: [{
|
|
762
|
+
type: Component,
|
|
763
|
+
args: [{ selector: 'vdr-order-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-order-data-table id=\"order-detail-list\" [items]=\"order.lines\" [order]=\"order\">\n <vdr-dt2-column id=\"id\" [heading]=\"'common.id' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"created-at\"\n [heading]=\"'common.created-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"updated-at\"\n [heading]=\"'common.updated-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.updatedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.image' | translate\" id=\"image\">\n <ng-template let-line=\"item\">\n <div class=\"image-placeholder\">\n <img\n *ngIf=\"line.featuredAsset as asset; else imagePlaceholder\"\n [src]=\"asset | assetPreview : 'tiny'\"\n />\n <ng-template #imagePlaceholder>\n <div class=\"placeholder\">\n <clr-icon shape=\"image\" size=\"48\"></clr-icon>\n </div>\n </ng-template>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.product-name' | translate\" id=\"product-name\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.name }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.product-sku' | translate\" id=\"product-sku\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.sku }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.unit-price' | translate\" id=\"unit-price\">\n <ng-template let-line=\"item\">\n <div class=\"unit-price\">\n {{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ line.unitPrice | localeCurrency : order.currencyCode }}\n </div>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.quantity' | translate\" id=\"quantity\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <ng-container *ngIf=\"!isDraft; else draft\">\n <div class=\"flex\">\n <div\n *ngIf=\"line.orderPlacedQuantity && line.quantity !== line.orderPlacedQuantity\"\n class=\"order-placed-quantity\"\n [title]=\"'order.original-quantity-at-checkout' | translate\"\n >\n {{ line.orderPlacedQuantity }}\n </div>\n <div>{{ line.quantity }}</div>\n </div>\n </ng-container>\n <ng-template #draft>\n <div class=\"flex\">\n <input\n class=\"draft-qty\"\n type=\"number\"\n min=\"0\"\n #qtyInput\n [value]=\"line.quantity\"\n (blur)=\"draftInputBlur(line, qtyInput.valueAsNumber)\"\n />\n <button class=\"icon-button\" (click)=\"remove.emit({ lineId: line.id })\">\n <clr-icon shape=\"trash\"></clr-icon>\n </button>\n </div>\n </ng-template>\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\n <vdr-line-fulfillment\n [line]=\"line\"\n [orderState]=\"order.state\"\n [allOrderFulfillments]=\"order.fulfillments\"\n ></vdr-line-fulfillment>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-custom-field-column\n *ngFor=\"let customField of orderLineCustomFields\"\n [customField]=\"customField\"\n />\n <vdr-order-total-column [heading]=\"'order.total' | translate\" id=\"total\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <div class=\"unit-price\">\n {{ line.linePriceWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ line.linePrice | localeCurrency : order.currencyCode }}\n </div>\n </div>\n\n <ng-container *ngIf=\"getLineDiscounts(line) as discounts\">\n <vdr-dropdown *ngIf=\"discounts.length\">\n <div class=\"promotions-label\" vdrDropdownTrigger>\n {{ 'order.promotions-applied' | translate }}\n </div>\n <vdr-dropdown-menu>\n <div class=\"line-promotion\" *ngFor=\"let discount of discounts\">\n <a class=\"promotion-name\" [routerLink]=\"getPromotionLink(discount)\">{{\n discount.description\n }}</a>\n <div class=\"promotion-amount\">\n {{ discount.amountWithTax | localeCurrency : order.currencyCode }}\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ discount.amount | localeCurrency : order.currencyCode }}\n </div>\n </div>\n </div>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </ng-container>\n </ng-template>\n </vdr-order-total-column>\n</vdr-order-data-table>\n", styles: [":host .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}:host .sub-total td{border-top:1px dashed var(--color-component-border-200)}:host .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}:host td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}:host img{border-radius:var(--border-radius-img)}:host .order-line-custom-fields{display:flex;flex-wrap:wrap}:host .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}:host .draft-qty{max-width:48px}:host .order-line-custom-field{background-color:var(--color-component-bg-100)}:host .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}:host .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}:host .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}:host .thumb img{width:50px;height:50px}:host .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}:host .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}::ng-deep .line-promotion{display:flex;justify-content:space-between;padding:6px 12px}::ng-deep .line-promotion .promotion-amount{margin-inline-start:12px}::ng-deep .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}\n"] }]
|
|
764
|
+
}], propDecorators: { order: [{
|
|
765
|
+
type: Input
|
|
766
|
+
}], orderLineCustomFields: [{
|
|
767
|
+
type: Input
|
|
768
|
+
}], isDraft: [{
|
|
769
|
+
type: Input
|
|
770
|
+
}], adjust: [{
|
|
771
|
+
type: Output
|
|
772
|
+
}], remove: [{
|
|
773
|
+
type: Output
|
|
774
|
+
}] } });
|
|
775
|
+
|
|
776
|
+
class DraftOrderVariantSelectorComponent {
|
|
777
|
+
constructor(dataService) {
|
|
778
|
+
this.dataService = dataService;
|
|
779
|
+
this.addItem = new EventEmitter();
|
|
780
|
+
this.customFieldsFormGroup = new UntypedFormGroup({});
|
|
781
|
+
this.selectedVariantId$ = new Subject();
|
|
782
|
+
this.quantity = 1;
|
|
783
|
+
}
|
|
784
|
+
ngOnInit() {
|
|
785
|
+
this.selectedVariant$ = this.selectedVariantId$.pipe(switchMap(id => {
|
|
786
|
+
if (id) {
|
|
787
|
+
return this.dataService.product
|
|
788
|
+
.getProductVariant(id)
|
|
789
|
+
.mapSingle(({ productVariant }) => productVariant);
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
return [undefined];
|
|
793
|
+
}
|
|
794
|
+
}));
|
|
795
|
+
for (const customField of this.orderLineCustomFields) {
|
|
796
|
+
this.customFieldsFormGroup.addControl(customField.name, new UntypedFormControl(''));
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
addItemClick(selectedVariant) {
|
|
800
|
+
if (selectedVariant) {
|
|
801
|
+
this.addItem.emit({
|
|
802
|
+
productVariantId: selectedVariant.id,
|
|
803
|
+
quantity: this.quantity,
|
|
804
|
+
customFields: this.orderLineCustomFields.length
|
|
805
|
+
? this.customFieldsFormGroup.value
|
|
806
|
+
: undefined,
|
|
807
|
+
});
|
|
808
|
+
this.selectedVariantId$.next(undefined);
|
|
809
|
+
this.customFieldsFormGroup.reset();
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DraftOrderVariantSelectorComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
813
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DraftOrderVariantSelectorComponent, selector: "vdr-draft-order-variant-selector", inputs: { currencyCode: "currencyCode", orderLineCustomFields: "orderLineCustomFields" }, outputs: { addItem: "addItem" }, ngImport: i0, template: "<div class=\"card\">\n <div class=\"card-block\">\n <h4 class=\"card-title\">{{ 'order.add-item-to-order' | translate }}</h4>\n <vdr-product-variant-selector\n (productSelected)=\"selectedVariantId$.next($event.productVariantId)\"\n ></vdr-product-variant-selector>\n </div>\n <div class=\"card-block\" *ngIf=\"selectedVariant$ | async as selectedVariant\">\n <div class=\"variant-details\">\n <img class=\"mr-2\" [src]=\"selectedVariant.featuredAsset || selectedVariant.product.featuredAsset | assetPreview: 32\">\n <div class=\"details\">\n <div>{{ selectedVariant?.name }}</div>\n <div class=\"small\">{{ selectedVariant?.sku }}</div>\n </div>\n <div class=\"details ml-4\">\n <div class=\"small\">\n {{ 'catalog.stock-on-hand' | translate }}: {{ selectedVariant.stockOnHand }}\n </div>\n <div class=\"small\">\n {{ 'catalog.stock-allocated' | translate }}: {{ selectedVariant.stockAllocated }}\n </div>\n </div>\n <div class=\"flex-spacer\"></div>\n <div class=\"details\">\n <div>{{ selectedVariant?.priceWithTax | localeCurrency: currencyCode }}</div>\n <div class=\"small\" [title]=\"'order.net-price' | translate\">\n {{ selectedVariant?.price | localeCurrency: currencyCode }}\n </div>\n </div>\n <div>\n <input [disabled]=\"!selectedVariant\" type=\"number\" min=\"0\" [(ngModel)]=\"quantity\" />\n </div>\n <button\n [disabled]=\"!selectedVariant\"\n class=\"btn btn-small btn-primary\"\n (click)=\"addItemClick(selectedVariant)\"\n >\n {{ 'order.add-item-to-order' | translate }}\n </button>\n </div>\n <ng-container *ngIf=\"orderLineCustomFields.length\">\n <div class=\"custom-field\" *ngFor=\"let field of orderLineCustomFields\">\n <vdr-custom-field-control\n [compact]=\"true\"\n [readonly]=\"false\"\n [customField]=\"field\"\n [customFieldsFormGroup]=\"customFieldsFormGroup\"\n ></vdr-custom-field-control>\n </div>\n </ng-container>\n </div>\n</div>\n", styles: [".variant-details{display:flex;align-items:center}.variant-details img{border-radius:var(--border-radius-img);width:32px;height:32px}.variant-details .details{font-size:.65rem;line-height:.7rem}.variant-details input{width:48px;margin:0 6px}.variant-details .small{font-size:11px;color:var(--color-text-300)}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1.CustomFieldControlComponent, selector: "vdr-custom-field-control", inputs: ["entityName", "customFieldsFormGroup", "customField", "compact", "showLabel", "readonly"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "component", type: i1.ProductVariantSelectorComponent, selector: "vdr-product-variant-selector", outputs: ["productSelected"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.AssetPreviewPipe, name: "assetPreview" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
814
|
+
}
|
|
815
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DraftOrderVariantSelectorComponent, decorators: [{
|
|
816
|
+
type: Component,
|
|
817
|
+
args: [{ selector: 'vdr-draft-order-variant-selector', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"card\">\n <div class=\"card-block\">\n <h4 class=\"card-title\">{{ 'order.add-item-to-order' | translate }}</h4>\n <vdr-product-variant-selector\n (productSelected)=\"selectedVariantId$.next($event.productVariantId)\"\n ></vdr-product-variant-selector>\n </div>\n <div class=\"card-block\" *ngIf=\"selectedVariant$ | async as selectedVariant\">\n <div class=\"variant-details\">\n <img class=\"mr-2\" [src]=\"selectedVariant.featuredAsset || selectedVariant.product.featuredAsset | assetPreview: 32\">\n <div class=\"details\">\n <div>{{ selectedVariant?.name }}</div>\n <div class=\"small\">{{ selectedVariant?.sku }}</div>\n </div>\n <div class=\"details ml-4\">\n <div class=\"small\">\n {{ 'catalog.stock-on-hand' | translate }}: {{ selectedVariant.stockOnHand }}\n </div>\n <div class=\"small\">\n {{ 'catalog.stock-allocated' | translate }}: {{ selectedVariant.stockAllocated }}\n </div>\n </div>\n <div class=\"flex-spacer\"></div>\n <div class=\"details\">\n <div>{{ selectedVariant?.priceWithTax | localeCurrency: currencyCode }}</div>\n <div class=\"small\" [title]=\"'order.net-price' | translate\">\n {{ selectedVariant?.price | localeCurrency: currencyCode }}\n </div>\n </div>\n <div>\n <input [disabled]=\"!selectedVariant\" type=\"number\" min=\"0\" [(ngModel)]=\"quantity\" />\n </div>\n <button\n [disabled]=\"!selectedVariant\"\n class=\"btn btn-small btn-primary\"\n (click)=\"addItemClick(selectedVariant)\"\n >\n {{ 'order.add-item-to-order' | translate }}\n </button>\n </div>\n <ng-container *ngIf=\"orderLineCustomFields.length\">\n <div class=\"custom-field\" *ngFor=\"let field of orderLineCustomFields\">\n <vdr-custom-field-control\n [compact]=\"true\"\n [readonly]=\"false\"\n [customField]=\"field\"\n [customFieldsFormGroup]=\"customFieldsFormGroup\"\n ></vdr-custom-field-control>\n </div>\n </ng-container>\n </div>\n</div>\n", styles: [".variant-details{display:flex;align-items:center}.variant-details img{border-radius:var(--border-radius-img);width:32px;height:32px}.variant-details .details{font-size:.65rem;line-height:.7rem}.variant-details input{width:48px;margin:0 6px}.variant-details .small{font-size:11px;color:var(--color-text-300)}\n"] }]
|
|
818
|
+
}], ctorParameters: () => [{ type: i1.DataService }], propDecorators: { currencyCode: [{
|
|
819
|
+
type: Input
|
|
820
|
+
}], orderLineCustomFields: [{
|
|
821
|
+
type: Input
|
|
822
|
+
}], addItem: [{
|
|
823
|
+
type: Output
|
|
824
|
+
}] } });
|
|
825
|
+
|
|
826
|
+
class DraftOrderDetailComponent extends TypedBaseDetailComponent {
|
|
827
|
+
constructor(changeDetector, dataService, notificationService, modalService, orderTransitionService) {
|
|
828
|
+
super();
|
|
829
|
+
this.changeDetector = changeDetector;
|
|
830
|
+
this.dataService = dataService;
|
|
831
|
+
this.notificationService = notificationService;
|
|
832
|
+
this.modalService = modalService;
|
|
833
|
+
this.orderTransitionService = orderTransitionService;
|
|
834
|
+
this.customFields = this.getCustomFieldConfig('Order');
|
|
835
|
+
this.orderLineCustomFields = this.getCustomFieldConfig('OrderLine');
|
|
836
|
+
this.detailForm = new UntypedFormGroup({});
|
|
837
|
+
this.fetchHistory = new Subject();
|
|
838
|
+
this.displayCouponCodeInput = false;
|
|
839
|
+
}
|
|
840
|
+
ngOnInit() {
|
|
841
|
+
this.init();
|
|
842
|
+
this.orderLineCustomFields = this.getCustomFieldConfig('OrderLine');
|
|
843
|
+
this.eligibleShippingMethods$ = this.entity$.pipe(switchMap(order => this.dataService.order
|
|
844
|
+
.getDraftOrderEligibleShippingMethods(order.id)
|
|
845
|
+
.mapSingle(({ eligibleShippingMethodsForDraftOrder }) => eligibleShippingMethodsForDraftOrder)));
|
|
846
|
+
}
|
|
847
|
+
ngOnDestroy() {
|
|
848
|
+
this.destroy();
|
|
849
|
+
}
|
|
850
|
+
addItemToOrder(event) {
|
|
851
|
+
this.dataService.order.addItemToDraftOrder(this.id, event).subscribe(result => {
|
|
852
|
+
if (result.addItemToDraftOrder.__typename !== 'Order') {
|
|
853
|
+
this.notificationService.error(result.addItemToDraftOrder.message);
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
adjustOrderLine(event) {
|
|
858
|
+
this.dataService.order
|
|
859
|
+
.adjustDraftOrderLine(this.id, { orderLineId: event.lineId, quantity: event.quantity })
|
|
860
|
+
.subscribe(result => {
|
|
861
|
+
if (result.adjustDraftOrderLine.__typename !== 'Order') {
|
|
862
|
+
this.notificationService.error(result.adjustDraftOrderLine.message);
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
removeOrderLine(event) {
|
|
867
|
+
this.dataService.order.removeDraftOrderLine(this.id, event.lineId).subscribe(result => {
|
|
868
|
+
if (result.removeDraftOrderLine.__typename !== 'Order') {
|
|
869
|
+
this.notificationService.error(result.removeDraftOrderLine.message);
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
getOrderAddressLines(orderAddress) {
|
|
874
|
+
if (!orderAddress) {
|
|
875
|
+
return [];
|
|
876
|
+
}
|
|
877
|
+
return Object.values(orderAddress)
|
|
878
|
+
.filter(val => val !== 'OrderAddress')
|
|
879
|
+
.filter(line => !!line);
|
|
880
|
+
}
|
|
881
|
+
setCustomer() {
|
|
882
|
+
this.modalService.fromComponent(SelectCustomerDialogComponent).subscribe(result => {
|
|
883
|
+
if (this.hasId(result)) {
|
|
884
|
+
this.dataService.order
|
|
885
|
+
.setCustomerForDraftOrder(this.id, { customerId: result.id })
|
|
886
|
+
.subscribe();
|
|
887
|
+
}
|
|
888
|
+
else if (result) {
|
|
889
|
+
const { note, ...input } = result;
|
|
890
|
+
this.dataService.order.setCustomerForDraftOrder(this.id, { input }).subscribe();
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
setShippingAddress() {
|
|
895
|
+
this.entity$
|
|
896
|
+
.pipe(take(1), switchMap(order => this.modalService.fromComponent(SelectAddressDialogComponent, {
|
|
897
|
+
locals: {
|
|
898
|
+
customerId: order.customer?.id,
|
|
899
|
+
currentAddress: order.shippingAddress ?? undefined,
|
|
900
|
+
},
|
|
901
|
+
})))
|
|
902
|
+
.subscribe(result => {
|
|
903
|
+
if (result) {
|
|
904
|
+
this.dataService.order.setDraftOrderShippingAddress(this.id, result).subscribe();
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
setBillingAddress() {
|
|
909
|
+
this.entity$
|
|
910
|
+
.pipe(take(1), switchMap(order => this.modalService.fromComponent(SelectAddressDialogComponent, {
|
|
911
|
+
locals: {
|
|
912
|
+
customerId: order.customer?.id,
|
|
913
|
+
currentAddress: order.billingAddress ?? undefined,
|
|
914
|
+
},
|
|
915
|
+
})))
|
|
916
|
+
.subscribe(result => {
|
|
917
|
+
if (result) {
|
|
918
|
+
this.dataService.order.setDraftOrderBillingAddress(this.id, result).subscribe();
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
applyCouponCode(couponCode) {
|
|
923
|
+
this.dataService.order.applyCouponCodeToDraftOrder(this.id, couponCode).subscribe();
|
|
924
|
+
}
|
|
925
|
+
removeCouponCode(couponCode) {
|
|
926
|
+
this.dataService.order.removeCouponCodeFromDraftOrder(this.id, couponCode).subscribe();
|
|
927
|
+
}
|
|
928
|
+
setShippingMethod() {
|
|
929
|
+
combineLatest(this.entity$, this.eligibleShippingMethods$)
|
|
930
|
+
.pipe(take(1), switchMap(([order, methods]) => this.modalService.fromComponent(SelectShippingMethodDialogComponent, {
|
|
931
|
+
locals: {
|
|
932
|
+
eligibleShippingMethods: methods,
|
|
933
|
+
currencyCode: order.currencyCode,
|
|
934
|
+
currentSelectionId: order.shippingLines?.[0]?.shippingMethod.id,
|
|
935
|
+
},
|
|
936
|
+
})))
|
|
937
|
+
.subscribe(result => {
|
|
938
|
+
if (result) {
|
|
939
|
+
this.dataService.order.setDraftOrderShippingMethod(this.id, result).subscribe();
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
updateCustomFields(customFieldsValue) {
|
|
944
|
+
this.dataService.order
|
|
945
|
+
.updateOrderCustomFields({
|
|
946
|
+
id: this.id,
|
|
947
|
+
customFields: customFieldsValue,
|
|
948
|
+
})
|
|
949
|
+
.subscribe();
|
|
950
|
+
}
|
|
951
|
+
deleteOrder() {
|
|
952
|
+
this.dataService.order.deleteDraftOrder(this.id).subscribe(({ deleteDraftOrder }) => {
|
|
953
|
+
if (deleteDraftOrder.result === DeletionResult.DELETED) {
|
|
954
|
+
this.notificationService.success(marker('common.notify-delete-success'), {
|
|
955
|
+
entity: 'Order',
|
|
956
|
+
});
|
|
957
|
+
this.router.navigate(['/orders']);
|
|
958
|
+
}
|
|
959
|
+
else if (deleteDraftOrder.message) {
|
|
960
|
+
this.notificationService.error(deleteDraftOrder.message);
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
completeOrder() {
|
|
965
|
+
this.dataService.order
|
|
966
|
+
.transitionToState(this.id, 'ArrangingPayment')
|
|
967
|
+
.subscribe(({ transitionOrderToState }) => {
|
|
968
|
+
if (transitionOrderToState?.__typename === 'Order') {
|
|
969
|
+
this.router.navigate(['/orders', this.id]);
|
|
970
|
+
}
|
|
971
|
+
else if (transitionOrderToState?.__typename === 'OrderStateTransitionError') {
|
|
972
|
+
this.notificationService.error(transitionOrderToState.transitionError);
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
hasId(input) {
|
|
977
|
+
return typeof input === 'object' && !!input.id;
|
|
978
|
+
}
|
|
979
|
+
setFormValues(entity) {
|
|
980
|
+
// empty
|
|
981
|
+
}
|
|
982
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DraftOrderDetailComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.DataService }, { token: i1.NotificationService }, { token: i1.ModalService }, { token: OrderTransitionService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
983
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DraftOrderDetailComponent, selector: "vdr-draft-order-detail", usesInheritance: true, ngImport: i0, template: "<vdr-page-block>\n <vdr-action-bar *ngIf=\"entity$ | async as order\">\n <vdr-ab-left>\n <div class=\"flex clr-align-items-center\">\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </div>\n </vdr-ab-left>\n\n <vdr-ab-right>\n <vdr-action-bar-items locationId=\"draft-order-detail\" />\n <button\n class=\"btn btn-primary\"\n (click)=\"completeOrder()\"\n [disabled]=\"!order.customer || !order.lines.length || !order.shippingLines.length\"\n >\n <clr-icon shape=\"check\"></clr-icon>\n {{ 'order.complete-draft-order' | translate }}\n </button>\n <vdr-action-bar-dropdown-menu [alwaysShow]=\"true\" locationId=\"draft-order-detail\">\n <button type=\"button\" vdrDropdownItem (click)=\"deleteOrder()\">\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n {{ 'order.delete-draft-order' | translate }}\n </button>\n </vdr-action-bar-dropdown-menu>\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n\n<vdr-page-detail-layout *ngIf=\"entity$ | async as order\">\n <vdr-page-detail-sidebar>\n <vdr-card [title]=\"'order.customer' | translate\">\n <ng-template vdrCardControls>\n <clr-icon *ngIf=\"!order.customer\" shape=\"unknown-status\" class=\"is-warning\"></clr-icon>\n <clr-icon *ngIf=\"order.customer\" shape=\"check\" class=\"is-success\"></clr-icon>\n </ng-template>\n <vdr-customer-label\n class=\"block mb-2\"\n *ngIf=\"order.customer\"\n [customer]=\"order.customer\"\n ></vdr-customer-label>\n <button class=\"button-small\" (click)=\"setCustomer()\">\n {{ 'order.set-customer-for-order' | translate }}\n </button>\n </vdr-card>\n <vdr-card [title]=\"'order.billing-address' | translate\">\n <ng-template vdrCardControls>\n <clr-icon\n *ngIf=\"!order.billingAddress.streetLine1\"\n shape=\"unknown-status\"\n class=\"is-warning\"\n ></clr-icon>\n <clr-icon\n *ngIf=\"order.billingAddress.streetLine1\"\n shape=\"check\"\n class=\"is-success\"\n ></clr-icon>\n </ng-template>\n <vdr-formatted-address\n class=\"block mb-2\"\n *ngIf=\"order.billingAddress\"\n [address]=\"order.billingAddress\"\n ></vdr-formatted-address>\n <button class=\"button-small\" (click)=\"setBillingAddress()\">\n {{ 'order.set-billing-address' | translate }}\n </button>\n </vdr-card>\n <vdr-card [title]=\"'order.shipping' | translate\">\n <ng-template vdrCardControls>\n <clr-icon\n *ngIf=\"!order.shippingAddress.streetLine1 || !order.shippingLines.length\"\n shape=\"unknown-status\"\n class=\"is-warning\"\n ></clr-icon>\n <clr-icon\n *ngIf=\"order.shippingAddress.streetLine1 && order.shippingLines.length\"\n shape=\"check\"\n class=\"is-success\"\n ></clr-icon>\n </ng-template>\n <vdr-formatted-address\n class=\"block mb-2\"\n *ngIf=\"order.shippingAddress\"\n [address]=\"order.shippingAddress\"\n ></vdr-formatted-address>\n <button class=\"button-small mr-2\" (click)=\"setShippingAddress()\">\n {{ 'order.set-shipping-address' | translate }}\n </button>\n\n <div *ngFor=\"let shippingLine of order.shippingLines\">\n {{ shippingLine.shippingMethod.name }}\n </div>\n <button class=\"button-small\" (click)=\"setShippingMethod()\">\n {{ 'order.set-shipping-method' | translate }}\n </button>\n </vdr-card>\n <vdr-card>\n <button\n *ngIf=\"order.couponCodes.length === 0 && !displayCouponCodeInput\"\n class=\"button-small\"\n (click)=\"displayCouponCodeInput = !displayCouponCodeInput\"\n >\n {{ 'order.set-coupon-codes' | translate }}\n </button>\n <div *ngIf=\"order.couponCodes.length || displayCouponCodeInput\">\n <label>{{ 'order.set-coupon-codes' | translate }}</label>\n <vdr-coupon-code-selector\n [couponCodes]=\"order.couponCodes\"\n (addCouponCode)=\"applyCouponCode($event)\"\n (removeCouponCode)=\"removeCouponCode($event)\"\n ></vdr-coupon-code-selector>\n </div>\n </vdr-card>\n <vdr-card>\n <vdr-page-entity-info *ngIf=\"entity$ | async as entity\" [entity]=\"entity\" />\n </vdr-card>\n </vdr-page-detail-sidebar>\n <vdr-page-block>\n <vdr-card>\n <vdr-draft-order-variant-selector\n [orderLineCustomFields]=\"orderLineCustomFields\"\n [currencyCode]=\"order.currencyCode\"\n (addItem)=\"addItemToOrder($event)\"\n ></vdr-draft-order-variant-selector>\n <vdr-order-table\n [order]=\"order\"\n [orderLineCustomFields]=\"orderLineCustomFields\"\n [isDraft]=\"true\"\n (adjust)=\"adjustOrderLine($event)\"\n (remove)=\"removeOrderLine($event)\"\n ></vdr-order-table>\n </vdr-card>\n <vdr-card [title]=\"'order.tax-summary' | translate\">\n <ng-container *ngIf=\"order.taxSummary.length\">\n <table class=\"table\">\n <thead>\n <tr>\n <th>{{ 'common.description' | translate }}</th>\n <th>{{ 'order.tax-rate' | translate }}</th>\n <th>{{ 'order.tax-base' | translate }}</th>\n <th>{{ 'order.tax-total' | translate }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of order.taxSummary\">\n <td>{{ row.description }}</td>\n <td>{{ row.taxRate / 100 | percent }}</td>\n <td>{{ row.taxBase | localeCurrency : order.currencyCode }}</td>\n <td>{{ row.taxTotal | localeCurrency : order.currencyCode }}</td>\n </tr>\n </tbody>\n </table>\n </ng-container>\n </vdr-card>\n <vdr-custom-detail-component-host\n locationId=\"draft-order-detail\"\n [entity$]=\"entity$\"\n [detailForm]=\"detailForm\"\n ></vdr-custom-detail-component-host>\n\n <vdr-order-custom-fields-card\n [customFieldsConfig]=\"customFields\"\n [customFieldValues]=\"order.customFields\"\n (updateClick)=\"updateCustomFields($event)\"\n ></vdr-order-custom-fields-card>\n </vdr-page-block>\n</vdr-page-detail-layout>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["id", "for"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ActionBarComponent, selector: "vdr-action-bar" }, { kind: "component", type: i1.ActionBarLeftComponent, selector: "vdr-ab-left", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarRightComponent, selector: "vdr-ab-right", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarDropdownMenuComponent, selector: "vdr-action-bar-dropdown-menu", inputs: ["alwaysShow"] }, { kind: "component", type: i1.CustomerLabelComponent, selector: "vdr-customer-label", inputs: ["customer"] }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "component", type: i1.OrderStateLabelComponent, selector: "vdr-order-state-label", inputs: ["state"] }, { kind: "component", type: i1.FormattedAddressComponent, selector: "vdr-formatted-address", inputs: ["address"] }, { kind: "component", type: i1.ActionBarItemsComponent, selector: "vdr-action-bar-items" }, { kind: "component", type: i1.CustomDetailComponentHostComponent, selector: "vdr-custom-detail-component-host", inputs: ["locationId", "entity$", "detailForm"] }, { kind: "component", type: i1.PageBlockComponent, selector: "vdr-page-block" }, { kind: "component", type: i1.PageEntityInfoComponent, selector: "vdr-page-entity-info", inputs: ["entity"] }, { kind: "component", type: i1.PageDetailLayoutComponent, selector: "vdr-page-detail-layout" }, { kind: "component", type: i1.PageDetailSidebarComponent, selector: "vdr-page-detail-sidebar" }, { kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "directive", type: i1.CardControlsDirective, selector: "[vdrCardControls]" }, { kind: "component", type: OrderCustomFieldsCardComponent, selector: "vdr-order-custom-fields-card", inputs: ["customFieldsConfig", "customFieldValues"], outputs: ["updateClick"] }, { kind: "component", type: OrderTableComponent, selector: "vdr-order-table", inputs: ["order", "orderLineCustomFields", "isDraft"], outputs: ["adjust", "remove"] }, { kind: "component", type: DraftOrderVariantSelectorComponent, selector: "vdr-draft-order-variant-selector", inputs: ["currencyCode", "orderLineCustomFields"], outputs: ["addItem"] }, { kind: "component", type: CouponCodeSelectorComponent, selector: "vdr-coupon-code-selector", inputs: ["couponCodes", "control"], outputs: ["addCouponCode", "removeCouponCode"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.PercentPipe, name: "percent" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
984
|
+
}
|
|
985
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DraftOrderDetailComponent, decorators: [{
|
|
986
|
+
type: Component,
|
|
987
|
+
args: [{ selector: 'vdr-draft-order-detail', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-page-block>\n <vdr-action-bar *ngIf=\"entity$ | async as order\">\n <vdr-ab-left>\n <div class=\"flex clr-align-items-center\">\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </div>\n </vdr-ab-left>\n\n <vdr-ab-right>\n <vdr-action-bar-items locationId=\"draft-order-detail\" />\n <button\n class=\"btn btn-primary\"\n (click)=\"completeOrder()\"\n [disabled]=\"!order.customer || !order.lines.length || !order.shippingLines.length\"\n >\n <clr-icon shape=\"check\"></clr-icon>\n {{ 'order.complete-draft-order' | translate }}\n </button>\n <vdr-action-bar-dropdown-menu [alwaysShow]=\"true\" locationId=\"draft-order-detail\">\n <button type=\"button\" vdrDropdownItem (click)=\"deleteOrder()\">\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n {{ 'order.delete-draft-order' | translate }}\n </button>\n </vdr-action-bar-dropdown-menu>\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n\n<vdr-page-detail-layout *ngIf=\"entity$ | async as order\">\n <vdr-page-detail-sidebar>\n <vdr-card [title]=\"'order.customer' | translate\">\n <ng-template vdrCardControls>\n <clr-icon *ngIf=\"!order.customer\" shape=\"unknown-status\" class=\"is-warning\"></clr-icon>\n <clr-icon *ngIf=\"order.customer\" shape=\"check\" class=\"is-success\"></clr-icon>\n </ng-template>\n <vdr-customer-label\n class=\"block mb-2\"\n *ngIf=\"order.customer\"\n [customer]=\"order.customer\"\n ></vdr-customer-label>\n <button class=\"button-small\" (click)=\"setCustomer()\">\n {{ 'order.set-customer-for-order' | translate }}\n </button>\n </vdr-card>\n <vdr-card [title]=\"'order.billing-address' | translate\">\n <ng-template vdrCardControls>\n <clr-icon\n *ngIf=\"!order.billingAddress.streetLine1\"\n shape=\"unknown-status\"\n class=\"is-warning\"\n ></clr-icon>\n <clr-icon\n *ngIf=\"order.billingAddress.streetLine1\"\n shape=\"check\"\n class=\"is-success\"\n ></clr-icon>\n </ng-template>\n <vdr-formatted-address\n class=\"block mb-2\"\n *ngIf=\"order.billingAddress\"\n [address]=\"order.billingAddress\"\n ></vdr-formatted-address>\n <button class=\"button-small\" (click)=\"setBillingAddress()\">\n {{ 'order.set-billing-address' | translate }}\n </button>\n </vdr-card>\n <vdr-card [title]=\"'order.shipping' | translate\">\n <ng-template vdrCardControls>\n <clr-icon\n *ngIf=\"!order.shippingAddress.streetLine1 || !order.shippingLines.length\"\n shape=\"unknown-status\"\n class=\"is-warning\"\n ></clr-icon>\n <clr-icon\n *ngIf=\"order.shippingAddress.streetLine1 && order.shippingLines.length\"\n shape=\"check\"\n class=\"is-success\"\n ></clr-icon>\n </ng-template>\n <vdr-formatted-address\n class=\"block mb-2\"\n *ngIf=\"order.shippingAddress\"\n [address]=\"order.shippingAddress\"\n ></vdr-formatted-address>\n <button class=\"button-small mr-2\" (click)=\"setShippingAddress()\">\n {{ 'order.set-shipping-address' | translate }}\n </button>\n\n <div *ngFor=\"let shippingLine of order.shippingLines\">\n {{ shippingLine.shippingMethod.name }}\n </div>\n <button class=\"button-small\" (click)=\"setShippingMethod()\">\n {{ 'order.set-shipping-method' | translate }}\n </button>\n </vdr-card>\n <vdr-card>\n <button\n *ngIf=\"order.couponCodes.length === 0 && !displayCouponCodeInput\"\n class=\"button-small\"\n (click)=\"displayCouponCodeInput = !displayCouponCodeInput\"\n >\n {{ 'order.set-coupon-codes' | translate }}\n </button>\n <div *ngIf=\"order.couponCodes.length || displayCouponCodeInput\">\n <label>{{ 'order.set-coupon-codes' | translate }}</label>\n <vdr-coupon-code-selector\n [couponCodes]=\"order.couponCodes\"\n (addCouponCode)=\"applyCouponCode($event)\"\n (removeCouponCode)=\"removeCouponCode($event)\"\n ></vdr-coupon-code-selector>\n </div>\n </vdr-card>\n <vdr-card>\n <vdr-page-entity-info *ngIf=\"entity$ | async as entity\" [entity]=\"entity\" />\n </vdr-card>\n </vdr-page-detail-sidebar>\n <vdr-page-block>\n <vdr-card>\n <vdr-draft-order-variant-selector\n [orderLineCustomFields]=\"orderLineCustomFields\"\n [currencyCode]=\"order.currencyCode\"\n (addItem)=\"addItemToOrder($event)\"\n ></vdr-draft-order-variant-selector>\n <vdr-order-table\n [order]=\"order\"\n [orderLineCustomFields]=\"orderLineCustomFields\"\n [isDraft]=\"true\"\n (adjust)=\"adjustOrderLine($event)\"\n (remove)=\"removeOrderLine($event)\"\n ></vdr-order-table>\n </vdr-card>\n <vdr-card [title]=\"'order.tax-summary' | translate\">\n <ng-container *ngIf=\"order.taxSummary.length\">\n <table class=\"table\">\n <thead>\n <tr>\n <th>{{ 'common.description' | translate }}</th>\n <th>{{ 'order.tax-rate' | translate }}</th>\n <th>{{ 'order.tax-base' | translate }}</th>\n <th>{{ 'order.tax-total' | translate }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of order.taxSummary\">\n <td>{{ row.description }}</td>\n <td>{{ row.taxRate / 100 | percent }}</td>\n <td>{{ row.taxBase | localeCurrency : order.currencyCode }}</td>\n <td>{{ row.taxTotal | localeCurrency : order.currencyCode }}</td>\n </tr>\n </tbody>\n </table>\n </ng-container>\n </vdr-card>\n <vdr-custom-detail-component-host\n locationId=\"draft-order-detail\"\n [entity$]=\"entity$\"\n [detailForm]=\"detailForm\"\n ></vdr-custom-detail-component-host>\n\n <vdr-order-custom-fields-card\n [customFieldsConfig]=\"customFields\"\n [customFieldValues]=\"order.customFields\"\n (updateClick)=\"updateCustomFields($event)\"\n ></vdr-order-custom-fields-card>\n </vdr-page-block>\n</vdr-page-detail-layout>\n" }]
|
|
988
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.DataService }, { type: i1.NotificationService }, { type: i1.ModalService }, { type: OrderTransitionService }] });
|
|
989
|
+
|
|
990
|
+
class FulfillOrderDialogComponent {
|
|
991
|
+
constructor(dataService, changeDetector) {
|
|
992
|
+
this.dataService = dataService;
|
|
993
|
+
this.changeDetector = changeDetector;
|
|
994
|
+
this.fulfillmentHandlerControl = new UntypedFormControl();
|
|
995
|
+
this.fulfillmentQuantities = {};
|
|
996
|
+
}
|
|
997
|
+
ngOnInit() {
|
|
998
|
+
this.dataService.settings.getGlobalSettings().single$.subscribe(({ globalSettings }) => {
|
|
999
|
+
this.fulfillmentQuantities = this.order.lines.reduce((result, line) => {
|
|
1000
|
+
const fulfillCount = this.getFulfillableCount(line, globalSettings.trackInventory);
|
|
1001
|
+
return {
|
|
1002
|
+
...result,
|
|
1003
|
+
[line.id]: { fulfillCount, max: fulfillCount },
|
|
1004
|
+
};
|
|
1005
|
+
}, {});
|
|
1006
|
+
this.changeDetector.markForCheck();
|
|
1007
|
+
});
|
|
1008
|
+
this.dataService.shippingMethod
|
|
1009
|
+
.getShippingMethodOperations()
|
|
1010
|
+
.mapSingle(data => data.fulfillmentHandlers)
|
|
1011
|
+
.subscribe(handlers => {
|
|
1012
|
+
this.fulfillmentHandlerDef =
|
|
1013
|
+
handlers.find(h => h.code === this.order.shippingLines[0]?.shippingMethod?.fulfillmentHandlerCode) || handlers[0];
|
|
1014
|
+
this.fulfillmentHandler = configurableDefinitionToInstance(this.fulfillmentHandlerDef);
|
|
1015
|
+
this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler);
|
|
1016
|
+
this.changeDetector.markForCheck();
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
getFulfillableCount(line, globalTrackInventory) {
|
|
1020
|
+
const { trackInventory, stockOnHand } = line.productVariant;
|
|
1021
|
+
const effectiveTracInventory = trackInventory === GlobalFlag.INHERIT ? globalTrackInventory : trackInventory === GlobalFlag.TRUE;
|
|
1022
|
+
const unfulfilledCount = this.getUnfulfilledCount(line);
|
|
1023
|
+
return effectiveTracInventory ? Math.min(unfulfilledCount, stockOnHand) : unfulfilledCount;
|
|
1024
|
+
}
|
|
1025
|
+
getUnfulfilledCount(line) {
|
|
1026
|
+
const fulfilled = this.order.fulfillments
|
|
1027
|
+
?.filter(f => f.state !== 'Cancelled')
|
|
1028
|
+
.map(f => f.lines)
|
|
1029
|
+
.flat()
|
|
1030
|
+
.filter(row => row.orderLineId === line.id)
|
|
1031
|
+
.reduce((sum, row) => sum + row.quantity, 0) ?? 0;
|
|
1032
|
+
return line.quantity - fulfilled;
|
|
1033
|
+
}
|
|
1034
|
+
canSubmit() {
|
|
1035
|
+
const totalCount = Object.values(this.fulfillmentQuantities).reduce((total, { fulfillCount }) => total + fulfillCount, 0);
|
|
1036
|
+
const fulfillmentQuantityIsValid = Object.values(this.fulfillmentQuantities).every(({ fulfillCount, max }) => fulfillCount <= max);
|
|
1037
|
+
const formIsValid = configurableOperationValueIsValid(this.fulfillmentHandlerDef, this.fulfillmentHandlerControl.value) && this.fulfillmentHandlerControl.valid;
|
|
1038
|
+
return formIsValid && 0 < totalCount && fulfillmentQuantityIsValid;
|
|
1039
|
+
}
|
|
1040
|
+
select() {
|
|
1041
|
+
const lines = Object.entries(this.fulfillmentQuantities).map(([orderLineId, { fulfillCount }]) => ({
|
|
1042
|
+
orderLineId,
|
|
1043
|
+
quantity: fulfillCount,
|
|
1044
|
+
}));
|
|
1045
|
+
this.resolveWith({
|
|
1046
|
+
lines,
|
|
1047
|
+
handler: toConfigurableOperationInput(this.fulfillmentHandler, this.fulfillmentHandlerControl.value),
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
cancel() {
|
|
1051
|
+
this.resolveWith();
|
|
1052
|
+
}
|
|
1053
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillOrderDialogComponent, deps: [{ token: i1.DataService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1054
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FulfillOrderDialogComponent, selector: "vdr-fulfill-order-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.fulfill-order' | translate }}</ng-template>\n\n<div class=\"fulfillment-wrapper\">\n <div class=\"order-table\">\n <table class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th>{{ 'order.product-name' | translate }}</th>\n <th>{{ 'order.product-sku' | translate }}</th>\n <th>{{ 'order.unfulfilled' | translate }}</th>\n <th>{{ 'catalog.stock-on-hand' | translate }}</th>\n <th>{{ 'order.fulfill' | translate }}</th>\n </tr>\n </thead>\n <tr\n *ngFor=\"let line of order.lines\"\n class=\"order-line\"\n [class.ignore]=\"getUnfulfilledCount(line) === 0\"\n >\n <td class=\"align-middle thumb\">\n <img *ngIf=\"line.featuredAsset\" [src]=\"line.featuredAsset | assetPreview: 'tiny'\" />\n </td>\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\n <td class=\"align-middle quantity\">{{ getUnfulfilledCount(line) }}</td>\n <td class=\"align-middle quantity\">{{ line.productVariant.stockOnHand }}</td>\n <td class=\"align-middle fulfil\">\n <input\n *ngIf=\"fulfillmentQuantities[line.id]\"\n [disabled]=\"getUnfulfilledCount(line) === 0\"\n [(ngModel)]=\"fulfillmentQuantities[line.id].fulfillCount\"\n type=\"number\"\n [max]=\"fulfillmentQuantities[line.id].max\"\n min=\"0\"\n />\n </td>\n </tr>\n </table>\n </div>\n <div class=\"shipping-details\">\n <vdr-formatted-address [address]=\"order.shippingAddress\"></vdr-formatted-address>\n <h6>{{ 'order.shipping-method' | translate }}</h6>\n {{ order.shippingLines[0]?.shippingMethod?.name }}\n <strong>{{ order.shipping | localeCurrency: order.currencyCode }}</strong>\n <vdr-configurable-input\n [operationDefinition]=\"fulfillmentHandlerDef\"\n [operation]=\"fulfillmentHandler\"\n [formControl]=\"fulfillmentHandlerControl\"\n [removable]=\"false\"\n ></vdr-configurable-input>\n </div>\n</div>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"select()\" [disabled]=\"!canSubmit()\" class=\"btn btn-primary\">\n {{ 'order.create-fulfillment' | translate }}\n </button>\n</ng-template>\n", styles: [":host{height:100%;display:flex;min-height:64vh}:host .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}:host .sub-total td{border-top:1px dashed var(--color-component-border-200)}:host .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}:host td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}:host img{border-radius:var(--border-radius-img)}:host .order-line-custom-fields{display:flex;flex-wrap:wrap}:host .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}:host .draft-qty{max-width:48px}:host .order-line-custom-field{background-color:var(--color-component-bg-100)}:host .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}:host .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}:host .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}:host .thumb img{width:50px;height:50px}:host .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}:host .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.fulfillment-wrapper{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper{display:flex;flex-direction:row}}.fulfillment-wrapper .shipping-details{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper .shipping-details{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper .shipping-details clr-input-container{margin-top:24px}.fulfillment-wrapper .order-table{flex:1;overflow-y:auto}.fulfillment-wrapper .order-table table{margin-top:0}.fulfillment-wrapper tr.ignore{color:var(--color-grey-300)}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i1.ConfigurableInputComponent, selector: "vdr-configurable-input", inputs: ["operation", "operationDefinition", "readonly", "removable", "position", "hideDescription"], outputs: ["remove"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "component", type: i1.FormattedAddressComponent, selector: "vdr-formatted-address", inputs: ["address"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.AssetPreviewPipe, name: "assetPreview" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1055
|
+
}
|
|
1056
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillOrderDialogComponent, decorators: [{
|
|
1057
|
+
type: Component,
|
|
1058
|
+
args: [{ selector: 'vdr-fulfill-order-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.fulfill-order' | translate }}</ng-template>\n\n<div class=\"fulfillment-wrapper\">\n <div class=\"order-table\">\n <table class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th>{{ 'order.product-name' | translate }}</th>\n <th>{{ 'order.product-sku' | translate }}</th>\n <th>{{ 'order.unfulfilled' | translate }}</th>\n <th>{{ 'catalog.stock-on-hand' | translate }}</th>\n <th>{{ 'order.fulfill' | translate }}</th>\n </tr>\n </thead>\n <tr\n *ngFor=\"let line of order.lines\"\n class=\"order-line\"\n [class.ignore]=\"getUnfulfilledCount(line) === 0\"\n >\n <td class=\"align-middle thumb\">\n <img *ngIf=\"line.featuredAsset\" [src]=\"line.featuredAsset | assetPreview: 'tiny'\" />\n </td>\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\n <td class=\"align-middle quantity\">{{ getUnfulfilledCount(line) }}</td>\n <td class=\"align-middle quantity\">{{ line.productVariant.stockOnHand }}</td>\n <td class=\"align-middle fulfil\">\n <input\n *ngIf=\"fulfillmentQuantities[line.id]\"\n [disabled]=\"getUnfulfilledCount(line) === 0\"\n [(ngModel)]=\"fulfillmentQuantities[line.id].fulfillCount\"\n type=\"number\"\n [max]=\"fulfillmentQuantities[line.id].max\"\n min=\"0\"\n />\n </td>\n </tr>\n </table>\n </div>\n <div class=\"shipping-details\">\n <vdr-formatted-address [address]=\"order.shippingAddress\"></vdr-formatted-address>\n <h6>{{ 'order.shipping-method' | translate }}</h6>\n {{ order.shippingLines[0]?.shippingMethod?.name }}\n <strong>{{ order.shipping | localeCurrency: order.currencyCode }}</strong>\n <vdr-configurable-input\n [operationDefinition]=\"fulfillmentHandlerDef\"\n [operation]=\"fulfillmentHandler\"\n [formControl]=\"fulfillmentHandlerControl\"\n [removable]=\"false\"\n ></vdr-configurable-input>\n </div>\n</div>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"select()\" [disabled]=\"!canSubmit()\" class=\"btn btn-primary\">\n {{ 'order.create-fulfillment' | translate }}\n </button>\n</ng-template>\n", styles: [":host{height:100%;display:flex;min-height:64vh}:host .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}:host .sub-total td{border-top:1px dashed var(--color-component-border-200)}:host .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}:host td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}:host img{border-radius:var(--border-radius-img)}:host .order-line-custom-fields{display:flex;flex-wrap:wrap}:host .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}:host .draft-qty{max-width:48px}:host .order-line-custom-field{background-color:var(--color-component-bg-100)}:host .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}:host .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}:host .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}:host .thumb img{width:50px;height:50px}:host .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}:host .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.fulfillment-wrapper{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper{display:flex;flex-direction:row}}.fulfillment-wrapper .shipping-details{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper .shipping-details{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper .shipping-details clr-input-container{margin-top:24px}.fulfillment-wrapper .order-table{flex:1;overflow-y:auto}.fulfillment-wrapper .order-table table{margin-top:0}.fulfillment-wrapper tr.ignore{color:var(--color-grey-300)}\n"] }]
|
|
1059
|
+
}], ctorParameters: () => [{ type: i1.DataService }, { type: i0.ChangeDetectorRef }] });
|
|
1060
|
+
|
|
1061
|
+
class SimpleItemListComponent {
|
|
1062
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SimpleItemListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1063
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SimpleItemListComponent, selector: "vdr-simple-item-list", inputs: { items: "items" }, ngImport: i0, template: "<div class=\"items-list\">\n <ul>\n <li *ngFor=\"let item of items\" [title]=\"item.name\">\n <div class=\"quantity\" *ngIf=\"item.quantity != null\">{{ item.quantity }}</div>\n <clr-icon shape=\"times\" size=\"12\" *ngIf=\"item.quantity != null\"></clr-icon>\n {{ item.name }}\n </li>\n </ul>\n</div>\n", styles: [".items-list{font-size:12px}.items-list ul{margin-top:6px;list-style-type:none;margin-inline-start:2px}.items-list ul li{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list .quantity{min-width:16px;display:inline-block}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1064
|
+
}
|
|
1065
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SimpleItemListComponent, decorators: [{
|
|
1066
|
+
type: Component,
|
|
1067
|
+
args: [{ selector: 'vdr-simple-item-list', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"items-list\">\n <ul>\n <li *ngFor=\"let item of items\" [title]=\"item.name\">\n <div class=\"quantity\" *ngIf=\"item.quantity != null\">{{ item.quantity }}</div>\n <clr-icon shape=\"times\" size=\"12\" *ngIf=\"item.quantity != null\"></clr-icon>\n {{ item.name }}\n </li>\n </ul>\n</div>\n", styles: [".items-list{font-size:12px}.items-list ul{margin-top:6px;list-style-type:none;margin-inline-start:2px}.items-list ul li{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list .quantity{min-width:16px;display:inline-block}\n"] }]
|
|
1068
|
+
}], propDecorators: { items: [{
|
|
1069
|
+
type: Input
|
|
1070
|
+
}] } });
|
|
1071
|
+
|
|
1072
|
+
class FulfillmentDetailComponent {
|
|
1073
|
+
constructor(serverConfigService) {
|
|
1074
|
+
this.serverConfigService = serverConfigService;
|
|
1075
|
+
this.customFieldConfig = [];
|
|
1076
|
+
this.customFieldFormGroup = new UntypedFormGroup({});
|
|
1077
|
+
}
|
|
1078
|
+
ngOnInit() {
|
|
1079
|
+
this.customFieldConfig = this.serverConfigService.getCustomFieldsFor('Fulfillment');
|
|
1080
|
+
}
|
|
1081
|
+
ngOnChanges(changes) {
|
|
1082
|
+
this.buildCustomFieldsFormGroup();
|
|
1083
|
+
}
|
|
1084
|
+
get fulfillment() {
|
|
1085
|
+
return this.order.fulfillments && this.order.fulfillments.find(f => f.id === this.fulfillmentId);
|
|
1086
|
+
}
|
|
1087
|
+
get items() {
|
|
1088
|
+
return (this.fulfillment?.lines.map(row => ({
|
|
1089
|
+
name: this.order.lines.find(line => line.id === row.orderLineId)?.productVariant.name ?? '',
|
|
1090
|
+
quantity: row.quantity,
|
|
1091
|
+
})) ?? []);
|
|
1092
|
+
}
|
|
1093
|
+
buildCustomFieldsFormGroup() {
|
|
1094
|
+
const customFields = this.fulfillment.customFields;
|
|
1095
|
+
for (const fieldDef of this.serverConfigService.getCustomFieldsFor('Fulfillment')) {
|
|
1096
|
+
this.customFieldFormGroup.addControl(fieldDef.name, new UntypedFormControl(customFields[fieldDef.name]));
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
customFieldIsObject(customField) {
|
|
1100
|
+
return Array.isArray(customField) || isObject(customField);
|
|
1101
|
+
}
|
|
1102
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillmentDetailComponent, deps: [{ token: i1.ServerConfigService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1103
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FulfillmentDetailComponent, selector: "vdr-fulfillment-detail", inputs: { fulfillmentId: "fulfillmentId", order: "order" }, usesOnChanges: true, ngImport: i0, template: "<vdr-labeled-data [label]=\"'common.created-at' | translate\">\n {{ fulfillment?.createdAt | localeDate: 'medium' }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.fulfillment-method' | translate\">\n {{ fulfillment?.method }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"fulfillment?.trackingCode\" [label]=\"'order.tracking-code' | translate\">\n {{ fulfillment?.trackingCode }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.contents' | translate\">\n <vdr-simple-item-list [items]=\"items\"></vdr-simple-item-list>\n</vdr-labeled-data>\n<ng-container *ngFor=\"let customField of customFieldConfig\">\n <vdr-custom-field-control\n *ngIf=\"customFieldFormGroup.get(customField.name)\"\n [readonly]=\"true\"\n [compact]=\"true\"\n [customField]=\"customField\"\n [customFieldsFormGroup]=\"customFieldFormGroup\"\n ></vdr-custom-field-control>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.CustomFieldControlComponent, selector: "vdr-custom-field-control", inputs: ["entityName", "customFieldsFormGroup", "customField", "compact", "showLabel", "readonly"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: SimpleItemListComponent, selector: "vdr-simple-item-list", inputs: ["items"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1104
|
+
}
|
|
1105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillmentDetailComponent, decorators: [{
|
|
1106
|
+
type: Component,
|
|
1107
|
+
args: [{ selector: 'vdr-fulfillment-detail', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-labeled-data [label]=\"'common.created-at' | translate\">\n {{ fulfillment?.createdAt | localeDate: 'medium' }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.fulfillment-method' | translate\">\n {{ fulfillment?.method }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"fulfillment?.trackingCode\" [label]=\"'order.tracking-code' | translate\">\n {{ fulfillment?.trackingCode }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.contents' | translate\">\n <vdr-simple-item-list [items]=\"items\"></vdr-simple-item-list>\n</vdr-labeled-data>\n<ng-container *ngFor=\"let customField of customFieldConfig\">\n <vdr-custom-field-control\n *ngIf=\"customFieldFormGroup.get(customField.name)\"\n [readonly]=\"true\"\n [compact]=\"true\"\n [customField]=\"customField\"\n [customFieldsFormGroup]=\"customFieldFormGroup\"\n ></vdr-custom-field-control>\n</ng-container>\n" }]
|
|
1108
|
+
}], ctorParameters: () => [{ type: i1.ServerConfigService }], propDecorators: { fulfillmentId: [{
|
|
1109
|
+
type: Input
|
|
1110
|
+
}], order: [{
|
|
1111
|
+
type: Input
|
|
1112
|
+
}] } });
|
|
1113
|
+
|
|
1114
|
+
class FulfillmentStateLabelComponent {
|
|
1115
|
+
get chipColorType() {
|
|
1116
|
+
switch (this.state) {
|
|
1117
|
+
case 'Pending':
|
|
1118
|
+
case 'Shipped':
|
|
1119
|
+
return 'warning';
|
|
1120
|
+
case 'Delivered':
|
|
1121
|
+
return 'success';
|
|
1122
|
+
case 'Cancelled':
|
|
1123
|
+
return 'error';
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillmentStateLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1127
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FulfillmentStateLabelComponent, selector: "vdr-fulfillment-state-label", inputs: { state: "state" }, ngImport: i0, template: "<vdr-chip [title]=\"'order.payment-state' | translate\" [colorType]=\"chipColorType\">\n <clr-icon shape=\"check-circle\" *ngIf=\"state === 'Delivered'\"></clr-icon>\n {{ state | stateI18nToken | translate }}\n</vdr-chip>\n", styles: [":host{font-size:14px}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1128
|
+
}
|
|
1129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillmentStateLabelComponent, decorators: [{
|
|
1130
|
+
type: Component,
|
|
1131
|
+
args: [{ selector: 'vdr-fulfillment-state-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-chip [title]=\"'order.payment-state' | translate\" [colorType]=\"chipColorType\">\n <clr-icon shape=\"check-circle\" *ngIf=\"state === 'Delivered'\"></clr-icon>\n {{ state | stateI18nToken | translate }}\n</vdr-chip>\n", styles: [":host{font-size:14px}\n"] }]
|
|
1132
|
+
}], propDecorators: { state: [{
|
|
1133
|
+
type: Input
|
|
1134
|
+
}] } });
|
|
1135
|
+
|
|
1136
|
+
class FulfillmentCardComponent {
|
|
1137
|
+
constructor() {
|
|
1138
|
+
this.transitionState = new EventEmitter();
|
|
1139
|
+
}
|
|
1140
|
+
nextSuggestedState() {
|
|
1141
|
+
if (!this.fulfillment) {
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
const { nextStates } = this.fulfillment;
|
|
1145
|
+
const namedStateOrDefault = (targetState) => nextStates.includes(targetState) ? targetState : nextStates[0];
|
|
1146
|
+
switch (this.fulfillment?.state) {
|
|
1147
|
+
case 'Pending':
|
|
1148
|
+
return namedStateOrDefault('Shipped');
|
|
1149
|
+
case 'Shipped':
|
|
1150
|
+
return namedStateOrDefault('Delivered');
|
|
1151
|
+
default:
|
|
1152
|
+
return nextStates.find(s => s !== 'Cancelled');
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
nextOtherStates() {
|
|
1156
|
+
if (!this.fulfillment) {
|
|
1157
|
+
return [];
|
|
1158
|
+
}
|
|
1159
|
+
const suggested = this.nextSuggestedState();
|
|
1160
|
+
return this.fulfillment.nextStates.filter(s => s !== suggested);
|
|
1161
|
+
}
|
|
1162
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillmentCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1163
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FulfillmentCardComponent, selector: "vdr-fulfillment-card", inputs: { fulfillment: "fulfillment", order: "order" }, outputs: { transitionState: "transitionState" }, ngImport: i0, template: "<div class=\"card\">\n <div class=\"card-header fulfillment-header\">\n <div>{{ 'order.fulfillment' | translate }}</div>\n <div class=\"fulfillment-state\">\n <vdr-fulfillment-state-label [state]=\"fulfillment?.state\"></vdr-fulfillment-state-label>\n </div>\n </div>\n <div class=\"card-block\">\n <vdr-fulfillment-detail\n *ngIf=\"!!fulfillment\"\n [fulfillmentId]=\"fulfillment?.id\"\n [order]=\"order\"\n ></vdr-fulfillment-detail>\n </div>\n <div class=\"card-footer\" *ngIf=\"fulfillment?.nextStates.length\">\n <ng-container *ngIf=\"nextSuggestedState() as suggestedState\">\n <button class=\"btn btn-sm btn-primary\" (click)=\"transitionState.emit(suggestedState)\">\n {{ 'order.set-fulfillment-state' | translate: { state: (suggestedState | stateI18nToken | translate) } }}\n </button>\n </ng-container>\n <vdr-dropdown>\n <button class=\"icon-button\" vdrDropdownTrigger>\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <ng-container *ngFor=\"let nextState of nextOtherStates()\">\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionState.emit(nextState)\"\n >\n <ng-container *ngIf=\"nextState !== 'Cancelled'; else cancel\">\n <clr-icon shape=\"step-forward-2\"></clr-icon>\n {{ 'order.transition-to-state' | translate: { state: (nextState | stateI18nToken | translate) } }}\n </ng-container>\n <ng-template #cancel>\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\n {{ 'order.cancel-fulfillment' | translate }}\n </ng-template>\n </button>\n </ng-container>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </div>\n</div>\n", styles: [".fulfillment-header{display:flex;justify-content:space-between;align-items:center}.card-footer{display:flex;align-items:center;justify-content:flex-end}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "component", type: FulfillmentDetailComponent, selector: "vdr-fulfillment-detail", inputs: ["fulfillmentId", "order"] }, { kind: "component", type: FulfillmentStateLabelComponent, selector: "vdr-fulfillment-state-label", inputs: ["state"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1164
|
+
}
|
|
1165
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FulfillmentCardComponent, decorators: [{
|
|
1166
|
+
type: Component,
|
|
1167
|
+
args: [{ selector: 'vdr-fulfillment-card', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"card\">\n <div class=\"card-header fulfillment-header\">\n <div>{{ 'order.fulfillment' | translate }}</div>\n <div class=\"fulfillment-state\">\n <vdr-fulfillment-state-label [state]=\"fulfillment?.state\"></vdr-fulfillment-state-label>\n </div>\n </div>\n <div class=\"card-block\">\n <vdr-fulfillment-detail\n *ngIf=\"!!fulfillment\"\n [fulfillmentId]=\"fulfillment?.id\"\n [order]=\"order\"\n ></vdr-fulfillment-detail>\n </div>\n <div class=\"card-footer\" *ngIf=\"fulfillment?.nextStates.length\">\n <ng-container *ngIf=\"nextSuggestedState() as suggestedState\">\n <button class=\"btn btn-sm btn-primary\" (click)=\"transitionState.emit(suggestedState)\">\n {{ 'order.set-fulfillment-state' | translate: { state: (suggestedState | stateI18nToken | translate) } }}\n </button>\n </ng-container>\n <vdr-dropdown>\n <button class=\"icon-button\" vdrDropdownTrigger>\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <ng-container *ngFor=\"let nextState of nextOtherStates()\">\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionState.emit(nextState)\"\n >\n <ng-container *ngIf=\"nextState !== 'Cancelled'; else cancel\">\n <clr-icon shape=\"step-forward-2\"></clr-icon>\n {{ 'order.transition-to-state' | translate: { state: (nextState | stateI18nToken | translate) } }}\n </ng-container>\n <ng-template #cancel>\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\n {{ 'order.cancel-fulfillment' | translate }}\n </ng-template>\n </button>\n </ng-container>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </div>\n</div>\n", styles: [".fulfillment-header{display:flex;justify-content:space-between;align-items:center}.card-footer{display:flex;align-items:center;justify-content:flex-end}\n"] }]
|
|
1168
|
+
}], propDecorators: { fulfillment: [{
|
|
1169
|
+
type: Input
|
|
1170
|
+
}], order: [{
|
|
1171
|
+
type: Input
|
|
1172
|
+
}], transitionState: [{
|
|
1173
|
+
type: Output
|
|
1174
|
+
}] } });
|
|
1175
|
+
|
|
1176
|
+
class ModificationDetailComponent {
|
|
1177
|
+
constructor() {
|
|
1178
|
+
this.addedItems = new Map();
|
|
1179
|
+
this.removedItems = new Map();
|
|
1180
|
+
this.modifiedItems = new Set();
|
|
1181
|
+
}
|
|
1182
|
+
ngOnChanges() {
|
|
1183
|
+
const { added, removed, modified } = this.getModifiedLines();
|
|
1184
|
+
this.addedItems = added;
|
|
1185
|
+
this.removedItems = removed;
|
|
1186
|
+
this.modifiedItems = modified;
|
|
1187
|
+
}
|
|
1188
|
+
getSurcharge(id) {
|
|
1189
|
+
return this.order.surcharges.find(m => m.id === id);
|
|
1190
|
+
}
|
|
1191
|
+
getAddedItems() {
|
|
1192
|
+
return [...this.addedItems.entries()].map(([line, count]) => ({
|
|
1193
|
+
name: line.productVariant.name,
|
|
1194
|
+
quantity: count,
|
|
1195
|
+
}));
|
|
1196
|
+
}
|
|
1197
|
+
getRemovedItems() {
|
|
1198
|
+
return [...this.removedItems.entries()].map(([line, count]) => ({
|
|
1199
|
+
name: line.productVariant.name,
|
|
1200
|
+
quantity: count,
|
|
1201
|
+
}));
|
|
1202
|
+
}
|
|
1203
|
+
getModifiedItems() {
|
|
1204
|
+
return [...this.modifiedItems].map(line => ({
|
|
1205
|
+
name: line.productVariant.name,
|
|
1206
|
+
}));
|
|
1207
|
+
}
|
|
1208
|
+
getModifiedLines() {
|
|
1209
|
+
const added = new Map();
|
|
1210
|
+
const removed = new Map();
|
|
1211
|
+
const modified = new Set();
|
|
1212
|
+
for (const modificationLine of this.modification.lines || []) {
|
|
1213
|
+
const line = this.order.lines.find(l => l.id === modificationLine.orderLineId);
|
|
1214
|
+
if (!line) {
|
|
1215
|
+
continue;
|
|
1216
|
+
}
|
|
1217
|
+
if (modificationLine.quantity === 0) {
|
|
1218
|
+
modified.add(line);
|
|
1219
|
+
}
|
|
1220
|
+
else if (modificationLine.quantity < 0) {
|
|
1221
|
+
removed.set(line, -modificationLine.quantity);
|
|
1222
|
+
}
|
|
1223
|
+
else {
|
|
1224
|
+
added.set(line, modificationLine.quantity);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
return { added, removed, modified };
|
|
1228
|
+
}
|
|
1229
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModificationDetailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1230
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ModificationDetailComponent, selector: "vdr-modification-detail", inputs: { order: "order", modification: "modification" }, usesOnChanges: true, ngImport: i0, template: "<vdr-labeled-data [label]=\"'common.ID' | translate\">{{ modification.id }}</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"modification.note\" [label]=\"'order.note' | translate\">{{\n modification.note\n}}</vdr-labeled-data>\n<vdr-labeled-data *ngFor=\"let surcharge of modification.surcharges\" [label]=\"'order.surcharges' | translate\">\n {{ getSurcharge(surcharge.id)?.description }}\n {{ getSurcharge(surcharge.id)?.priceWithTax | localeCurrency: order.currencyCode }}</vdr-labeled-data\n>\n<vdr-labeled-data *ngIf=\"getAddedItems().length\" [label]=\"'order.added-items' | translate\">\n <vdr-simple-item-list [items]=\"getAddedItems()\"></vdr-simple-item-list>\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"getRemovedItems().length\" [label]=\"'order.removed-items' | translate\">\n <vdr-simple-item-list [items]=\"getRemovedItems()\"></vdr-simple-item-list>\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"getModifiedItems().length\" [label]=\"'order.modified-items' | translate\">\n <vdr-simple-item-list [items]=\"getModifiedItems()\"></vdr-simple-item-list>\n</vdr-labeled-data>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: SimpleItemListComponent, selector: "vdr-simple-item-list", inputs: ["items"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1231
|
+
}
|
|
1232
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModificationDetailComponent, decorators: [{
|
|
1233
|
+
type: Component,
|
|
1234
|
+
args: [{ selector: 'vdr-modification-detail', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-labeled-data [label]=\"'common.ID' | translate\">{{ modification.id }}</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"modification.note\" [label]=\"'order.note' | translate\">{{\n modification.note\n}}</vdr-labeled-data>\n<vdr-labeled-data *ngFor=\"let surcharge of modification.surcharges\" [label]=\"'order.surcharges' | translate\">\n {{ getSurcharge(surcharge.id)?.description }}\n {{ getSurcharge(surcharge.id)?.priceWithTax | localeCurrency: order.currencyCode }}</vdr-labeled-data\n>\n<vdr-labeled-data *ngIf=\"getAddedItems().length\" [label]=\"'order.added-items' | translate\">\n <vdr-simple-item-list [items]=\"getAddedItems()\"></vdr-simple-item-list>\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"getRemovedItems().length\" [label]=\"'order.removed-items' | translate\">\n <vdr-simple-item-list [items]=\"getRemovedItems()\"></vdr-simple-item-list>\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"getModifiedItems().length\" [label]=\"'order.modified-items' | translate\">\n <vdr-simple-item-list [items]=\"getModifiedItems()\"></vdr-simple-item-list>\n</vdr-labeled-data>\n" }]
|
|
1235
|
+
}], propDecorators: { order: [{
|
|
1236
|
+
type: Input
|
|
1237
|
+
}], modification: [{
|
|
1238
|
+
type: Input
|
|
1239
|
+
}] } });
|
|
1240
|
+
|
|
1241
|
+
const NODE_HEIGHT = 72;
|
|
1242
|
+
|
|
1243
|
+
class OrderProcessNodeComponent {
|
|
1244
|
+
constructor(elementRef) {
|
|
1245
|
+
this.elementRef = elementRef;
|
|
1246
|
+
this.active$ = new BehaviorSubject(false);
|
|
1247
|
+
this.activeTarget$ = new BehaviorSubject(false);
|
|
1248
|
+
this.isCancellable = false;
|
|
1249
|
+
// We use a class field here to prevent the
|
|
1250
|
+
// i18n extractor from extracting a "Cancelled" key
|
|
1251
|
+
this.cancelledState = 'Cancelled';
|
|
1252
|
+
}
|
|
1253
|
+
ngOnChanges(changes) {
|
|
1254
|
+
this.isCancellable = !!this.node.to.find((s) => s.name === 'Cancelled');
|
|
1255
|
+
if (changes.active) {
|
|
1256
|
+
this.active$.next(this.active);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
getPos(origin = 'top') {
|
|
1260
|
+
const rect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
1261
|
+
const nodeHeight = this.elementRef.nativeElement.querySelector('.node')?.getBoundingClientRect().height ?? 0;
|
|
1262
|
+
return {
|
|
1263
|
+
x: 10,
|
|
1264
|
+
y: this.index * NODE_HEIGHT + (origin === 'bottom' ? nodeHeight : 0),
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
getStyle() {
|
|
1268
|
+
const pos = this.getPos();
|
|
1269
|
+
return {
|
|
1270
|
+
'top.px': pos.y,
|
|
1271
|
+
'left.px': pos.x,
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessNodeComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1275
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderProcessNodeComponent, selector: "vdr-order-process-node", inputs: { node: "node", index: "index", active: "active" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"node-wrapper\" [ngStyle]=\"getStyle()\" [class.active]=\"active$ | async\">\n <div\n class=\"node\"\n [class.active-target]=\"activeTarget$ | async\"\n >\n {{ node.name | stateI18nToken | translate }}\n </div>\n <div class=\"cancelled-wrapper\" *ngIf=\"isCancellable\">\n <div class=\"cancelled-edge\">\n </div>\n <clr-icon shape=\"dot-circle\"></clr-icon>\n <div class=\"cancelled-node\">\n {{ cancelledState | stateI18nToken | translate }}\n </div>\n </div>\n</div>\n", styles: [":host{display:block}.node-wrapper{position:absolute;z-index:1;display:flex;align-items:center}.node{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon{margin-inline-start:-1px}.cancelled-node{margin-inline-start:6px}.active .cancelled-wrapper{opacity:1}.active .node{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active .cancelled-wrapper{color:var(--color-error-500)}.active .cancelled-edge{background-color:var(--color-error-500)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1276
|
+
}
|
|
1277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessNodeComponent, decorators: [{
|
|
1278
|
+
type: Component,
|
|
1279
|
+
args: [{ selector: 'vdr-order-process-node', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"node-wrapper\" [ngStyle]=\"getStyle()\" [class.active]=\"active$ | async\">\n <div\n class=\"node\"\n [class.active-target]=\"activeTarget$ | async\"\n >\n {{ node.name | stateI18nToken | translate }}\n </div>\n <div class=\"cancelled-wrapper\" *ngIf=\"isCancellable\">\n <div class=\"cancelled-edge\">\n </div>\n <clr-icon shape=\"dot-circle\"></clr-icon>\n <div class=\"cancelled-node\">\n {{ cancelledState | stateI18nToken | translate }}\n </div>\n </div>\n</div>\n", styles: [":host{display:block}.node-wrapper{position:absolute;z-index:1;display:flex;align-items:center}.node{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon{margin-inline-start:-1px}.cancelled-node{margin-inline-start:6px}.active .cancelled-wrapper{opacity:1}.active .node{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active .cancelled-wrapper{color:var(--color-error-500)}.active .cancelled-edge{background-color:var(--color-error-500)}\n"] }]
|
|
1280
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { node: [{
|
|
1281
|
+
type: Input
|
|
1282
|
+
}], index: [{
|
|
1283
|
+
type: Input
|
|
1284
|
+
}], active: [{
|
|
1285
|
+
type: Input
|
|
1286
|
+
}] } });
|
|
1287
|
+
|
|
1288
|
+
class OrderProcessEdgeComponent {
|
|
1289
|
+
ngOnInit() {
|
|
1290
|
+
this.active$ = this.from.active$
|
|
1291
|
+
.asObservable()
|
|
1292
|
+
.pipe(tap((active) => this.to.activeTarget$.next(active)));
|
|
1293
|
+
}
|
|
1294
|
+
getStyle() {
|
|
1295
|
+
const direction = this.from.index < this.to.index ? 'down' : 'up';
|
|
1296
|
+
const startPos = this.from.getPos(direction === 'down' ? 'bottom' : 'top');
|
|
1297
|
+
const endPos = this.to.getPos(direction === 'down' ? 'top' : 'bottom');
|
|
1298
|
+
const dX = Math.abs(startPos.x - endPos.x);
|
|
1299
|
+
const dY = Math.abs(startPos.y - endPos.y);
|
|
1300
|
+
const length = Math.sqrt(dX ** 2 + dY ** 2);
|
|
1301
|
+
return {
|
|
1302
|
+
'top.px': startPos.y,
|
|
1303
|
+
'left.px': startPos.x + (direction === 'down' ? 10 : 40) + this.index * 12,
|
|
1304
|
+
'height.px': length,
|
|
1305
|
+
'width.px': 1,
|
|
1306
|
+
...(direction === 'up'
|
|
1307
|
+
? {
|
|
1308
|
+
transform: 'rotateZ(180deg)',
|
|
1309
|
+
'transform-origin': 'top',
|
|
1310
|
+
}
|
|
1311
|
+
: {}),
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessEdgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1315
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderProcessEdgeComponent, selector: "vdr-order-process-edge", inputs: { from: "from", to: "to", index: "index" }, ngImport: i0, template: "<div\n [attr.data-from]=\"from.node.name\"\n [attr.data-to]=\"to.node.name\"\n [ngStyle]=\"getStyle()\"\n [class.active]=\"active$ | async\"\n class=\"edge\">\n <clr-icon shape=\"arrow\" flip=\"vertical\" class=\"arrow\"></clr-icon>\n</div>\n", styles: [".edge{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active .arrow{color:var(--color-primary-500)}.edge .arrow{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1316
|
+
}
|
|
1317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessEdgeComponent, decorators: [{
|
|
1318
|
+
type: Component,
|
|
1319
|
+
args: [{ selector: 'vdr-order-process-edge', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [attr.data-from]=\"from.node.name\"\n [attr.data-to]=\"to.node.name\"\n [ngStyle]=\"getStyle()\"\n [class.active]=\"active$ | async\"\n class=\"edge\">\n <clr-icon shape=\"arrow\" flip=\"vertical\" class=\"arrow\"></clr-icon>\n</div>\n", styles: [".edge{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active .arrow{color:var(--color-primary-500)}.edge .arrow{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}\n"] }]
|
|
1320
|
+
}], propDecorators: { from: [{
|
|
1321
|
+
type: Input
|
|
1322
|
+
}], to: [{
|
|
1323
|
+
type: Input
|
|
1324
|
+
}], index: [{
|
|
1325
|
+
type: Input
|
|
1326
|
+
}] } });
|
|
1327
|
+
|
|
1328
|
+
class OrderProcessGraphComponent {
|
|
1329
|
+
constructor(changeDetector) {
|
|
1330
|
+
this.changeDetector = changeDetector;
|
|
1331
|
+
this.setActiveState$ = new BehaviorSubject(undefined);
|
|
1332
|
+
this.nodes = [];
|
|
1333
|
+
this.edges = [];
|
|
1334
|
+
}
|
|
1335
|
+
get outerHeight() {
|
|
1336
|
+
return this.nodes.length * NODE_HEIGHT;
|
|
1337
|
+
}
|
|
1338
|
+
ngOnInit() {
|
|
1339
|
+
this.setActiveState$.next(this.initialState);
|
|
1340
|
+
this.activeState$ = this.setActiveState$.pipe(debounceTime(150));
|
|
1341
|
+
}
|
|
1342
|
+
ngOnChanges(changes) {
|
|
1343
|
+
this.populateNodes();
|
|
1344
|
+
}
|
|
1345
|
+
ngAfterViewInit() {
|
|
1346
|
+
setTimeout(() => this.populateEdges());
|
|
1347
|
+
}
|
|
1348
|
+
onMouseOver(stateName) {
|
|
1349
|
+
this.setActiveState$.next(stateName);
|
|
1350
|
+
}
|
|
1351
|
+
onMouseOut() {
|
|
1352
|
+
this.setActiveState$.next(this.initialState);
|
|
1353
|
+
}
|
|
1354
|
+
getNodeFor(state) {
|
|
1355
|
+
if (this.nodeComponents) {
|
|
1356
|
+
return this.nodeComponents.find(n => n.node.name === state);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
populateNodes() {
|
|
1360
|
+
const stateNodeMap = new Map();
|
|
1361
|
+
for (const state of this.states) {
|
|
1362
|
+
stateNodeMap.set(state.name, {
|
|
1363
|
+
name: state.name,
|
|
1364
|
+
to: [],
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
for (const [name, stateNode] of stateNodeMap.entries()) {
|
|
1368
|
+
const targets = this.states.find(s => s.name === name)?.to ?? [];
|
|
1369
|
+
for (const target of targets) {
|
|
1370
|
+
const targetNode = stateNodeMap.get(target);
|
|
1371
|
+
if (targetNode) {
|
|
1372
|
+
stateNode.to.push(targetNode);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
this.nodes = [...stateNodeMap.values()].filter(n => n.name !== 'Cancelled');
|
|
1377
|
+
}
|
|
1378
|
+
populateEdges() {
|
|
1379
|
+
for (const node of this.nodes) {
|
|
1380
|
+
const nodeCmp = this.getNodeFor(node.name);
|
|
1381
|
+
let index = 0;
|
|
1382
|
+
for (const to of node.to) {
|
|
1383
|
+
const toCmp = this.getNodeFor(to.name);
|
|
1384
|
+
if (nodeCmp && toCmp && nodeCmp !== toCmp) {
|
|
1385
|
+
this.edges.push({
|
|
1386
|
+
to: toCmp,
|
|
1387
|
+
from: nodeCmp,
|
|
1388
|
+
index,
|
|
1389
|
+
});
|
|
1390
|
+
index++;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
this.edges = [...this.edges];
|
|
1395
|
+
this.changeDetector.markForCheck();
|
|
1396
|
+
}
|
|
1397
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessGraphComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1398
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderProcessGraphComponent, selector: "vdr-order-process-graph", inputs: { states: "states", initialState: "initialState" }, host: { properties: { "style.height.px": "this.outerHeight" } }, viewQueries: [{ propertyName: "nodeComponents", predicate: OrderProcessNodeComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngFor=\"let state of nodes; let i = index\">\n <vdr-order-process-node\n [node]=\"state\"\n [index]=\"i\"\n [active]=\"(activeState$ | async) === state.name\"\n (mouseenter)=\"onMouseOver(state.name)\"\n (mouseleave)=\"onMouseOut()\"\n ></vdr-order-process-node>\n</ng-container>\n<ng-container *ngFor=\"let edge of edges\">\n <vdr-order-process-edge [from]=\"edge.from\" [to]=\"edge.to\" [index]=\"edge.index\"></vdr-order-process-edge>\n</ng-container>\n", styles: [":host{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row{display:flex}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: OrderProcessNodeComponent, selector: "vdr-order-process-node", inputs: ["node", "index", "active"] }, { kind: "component", type: OrderProcessEdgeComponent, selector: "vdr-order-process-edge", inputs: ["from", "to", "index"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1399
|
+
}
|
|
1400
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessGraphComponent, decorators: [{
|
|
1401
|
+
type: Component,
|
|
1402
|
+
args: [{ selector: 'vdr-order-process-graph', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngFor=\"let state of nodes; let i = index\">\n <vdr-order-process-node\n [node]=\"state\"\n [index]=\"i\"\n [active]=\"(activeState$ | async) === state.name\"\n (mouseenter)=\"onMouseOver(state.name)\"\n (mouseleave)=\"onMouseOut()\"\n ></vdr-order-process-node>\n</ng-container>\n<ng-container *ngFor=\"let edge of edges\">\n <vdr-order-process-edge [from]=\"edge.from\" [to]=\"edge.to\" [index]=\"edge.index\"></vdr-order-process-edge>\n</ng-container>\n", styles: [":host{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row{display:flex}\n"] }]
|
|
1403
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { states: [{
|
|
1404
|
+
type: Input
|
|
1405
|
+
}], initialState: [{
|
|
1406
|
+
type: Input
|
|
1407
|
+
}], nodeComponents: [{
|
|
1408
|
+
type: ViewChildren,
|
|
1409
|
+
args: [OrderProcessNodeComponent]
|
|
1410
|
+
}], outerHeight: [{
|
|
1411
|
+
type: HostBinding,
|
|
1412
|
+
args: ['style.height.px']
|
|
1413
|
+
}] } });
|
|
1414
|
+
|
|
1415
|
+
class OrderProcessGraphDialogComponent {
|
|
1416
|
+
constructor(serverConfigService) {
|
|
1417
|
+
this.serverConfigService = serverConfigService;
|
|
1418
|
+
this.states = [];
|
|
1419
|
+
}
|
|
1420
|
+
ngOnInit() {
|
|
1421
|
+
this.states = this.serverConfigService.getOrderProcessStates();
|
|
1422
|
+
}
|
|
1423
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessGraphDialogComponent, deps: [{ token: i1.ServerConfigService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1424
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderProcessGraphDialogComponent, selector: "vdr-order-process-graph-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.order-state-diagram' | translate }}</ng-template>\n\n<vdr-order-process-graph [states]=\"states\" [initialState]=\"activeState\"></vdr-order-process-graph>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "component", type: OrderProcessGraphComponent, selector: "vdr-order-process-graph", inputs: ["states", "initialState"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1425
|
+
}
|
|
1426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderProcessGraphDialogComponent, decorators: [{
|
|
1427
|
+
type: Component,
|
|
1428
|
+
args: [{ selector: 'vdr-order-process-graph-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.order-state-diagram' | translate }}</ng-template>\n\n<vdr-order-process-graph [states]=\"states\" [initialState]=\"activeState\"></vdr-order-process-graph>\n" }]
|
|
1429
|
+
}], ctorParameters: () => [{ type: i1.ServerConfigService }] });
|
|
1430
|
+
|
|
1431
|
+
class PaymentForRefundSelectorComponent {
|
|
1432
|
+
constructor() {
|
|
1433
|
+
this.paymentSelected = new EventEmitter();
|
|
1434
|
+
}
|
|
1435
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PaymentForRefundSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1436
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PaymentForRefundSelectorComponent, selector: "vdr-payment-for-refund-selector", inputs: { refundablePayments: "refundablePayments", order: "order" }, outputs: { paymentSelected: "paymentSelected" }, ngImport: i0, template: "<vdr-card\n [title]=\"'order.payment' | translate\"\n [class.selected]=\"payment.selected\"\n [class.unselected]=\"!payment.selected\"\n *ngFor=\"let payment of refundablePayments\"\n>\n <ng-template vdrCardControls>\n <vdr-select-toggle\n size=\"small\"\n [title]=\"'order.refund-this-payment' | translate\"\n [label]=\"'order.refund-this-payment' | translate\"\n [disabled]=\"refundablePayments.length === 1\"\n [(selected)]=\"payment.selected\"\n (selectedChange)=\"paymentSelected.emit({ payment: payment, selected: $event })\"\n ></vdr-select-toggle>\n </ng-template>\n <div class=\"form-grid\">\n <vdr-labeled-data [label]=\"'order.payment-method' | translate\">\n {{ payment.method }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.transaction-id' | translate\">\n {{ payment.transactionId }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.payment-amount' | translate\">\n {{ payment.amount | localeCurrency : order.currencyCode }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.refundable-amount' | translate\">\n {{ payment.refundableAmount | localeCurrency : order.currencyCode }}\n </vdr-labeled-data>\n </div>\n <vdr-form-field [label]=\"'order.refund-amount' | translate\">\n <vdr-currency-input\n [readonly]=\"!payment.selected\"\n [currencyCode]=\"order.currencyCode\"\n [formControl]=\"payment.amountToRefundControl\"\n ></vdr-currency-input>\n </vdr-form-field>\n</vdr-card>", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i1.CurrencyInputComponent, selector: "vdr-currency-input", inputs: ["disabled", "readonly", "value", "currencyCode"], outputs: ["valueChange"] }, { kind: "component", type: i1.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"], outputs: ["readOnlyToggleChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "component", type: i1.SelectToggleComponent, selector: "vdr-select-toggle", inputs: ["size", "selected", "hiddenWhenOff", "disabled", "label"], outputs: ["selectedChange"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "directive", type: i1.CardControlsDirective, selector: "[vdrCardControls]" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
1437
|
+
}
|
|
1438
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PaymentForRefundSelectorComponent, decorators: [{
|
|
1439
|
+
type: Component,
|
|
1440
|
+
args: [{ selector: 'vdr-payment-for-refund-selector', changeDetection: ChangeDetectionStrategy.Default, template: "<vdr-card\n [title]=\"'order.payment' | translate\"\n [class.selected]=\"payment.selected\"\n [class.unselected]=\"!payment.selected\"\n *ngFor=\"let payment of refundablePayments\"\n>\n <ng-template vdrCardControls>\n <vdr-select-toggle\n size=\"small\"\n [title]=\"'order.refund-this-payment' | translate\"\n [label]=\"'order.refund-this-payment' | translate\"\n [disabled]=\"refundablePayments.length === 1\"\n [(selected)]=\"payment.selected\"\n (selectedChange)=\"paymentSelected.emit({ payment: payment, selected: $event })\"\n ></vdr-select-toggle>\n </ng-template>\n <div class=\"form-grid\">\n <vdr-labeled-data [label]=\"'order.payment-method' | translate\">\n {{ payment.method }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.transaction-id' | translate\">\n {{ payment.transactionId }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.payment-amount' | translate\">\n {{ payment.amount | localeCurrency : order.currencyCode }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.refundable-amount' | translate\">\n {{ payment.refundableAmount | localeCurrency : order.currencyCode }}\n </vdr-labeled-data>\n </div>\n <vdr-form-field [label]=\"'order.refund-amount' | translate\">\n <vdr-currency-input\n [readonly]=\"!payment.selected\"\n [currencyCode]=\"order.currencyCode\"\n [formControl]=\"payment.amountToRefundControl\"\n ></vdr-currency-input>\n </vdr-form-field>\n</vdr-card>", styles: [":host{display:block}\n"] }]
|
|
1441
|
+
}], propDecorators: { refundablePayments: [{
|
|
1442
|
+
type: Input
|
|
1443
|
+
}], order: [{
|
|
1444
|
+
type: Input
|
|
1445
|
+
}], paymentSelected: [{
|
|
1446
|
+
type: Output
|
|
1447
|
+
}] } });
|
|
1448
|
+
|
|
1449
|
+
class RefundOrderDialogComponent {
|
|
1450
|
+
constructor(i18nService) {
|
|
1451
|
+
this.i18nService = i18nService;
|
|
1452
|
+
this.lineQuantities = {};
|
|
1453
|
+
this.refundablePayments = [];
|
|
1454
|
+
this.refundShippingLineIds = [];
|
|
1455
|
+
this.reasons = getAppConfig().cancellationReasons ?? [
|
|
1456
|
+
marker('order.refund-reason-customer-request'),
|
|
1457
|
+
marker('order.refund-reason-not-available'),
|
|
1458
|
+
];
|
|
1459
|
+
this.manuallySetRefundTotal = false;
|
|
1460
|
+
this.refundTotal = 0;
|
|
1461
|
+
this.reasons = this.reasons.map(r => this.i18nService.translate(r));
|
|
1462
|
+
}
|
|
1463
|
+
get totalRefundableAmount() {
|
|
1464
|
+
return summate(this.refundablePayments, 'refundableAmount');
|
|
1465
|
+
}
|
|
1466
|
+
get amountToRefundTotal() {
|
|
1467
|
+
return this.refundablePayments.reduce((total, payment) => total + payment.amountToRefundControl.value, 0);
|
|
1468
|
+
}
|
|
1469
|
+
lineCanBeRefundedOrCancelled(line) {
|
|
1470
|
+
const refundedCount = this.order.payments
|
|
1471
|
+
?.reduce((all, payment) => [...all, ...payment.refunds], [])
|
|
1472
|
+
.filter(refund => refund.state !== 'Failed')
|
|
1473
|
+
.reduce((all, refund) => [...all, ...refund.lines], [])
|
|
1474
|
+
.filter(refundLine => refundLine.orderLineId === line.id)
|
|
1475
|
+
.reduce((sum, refundLine) => sum + refundLine.quantity, 0) ?? 0;
|
|
1476
|
+
return refundedCount < line.orderPlacedQuantity;
|
|
1477
|
+
}
|
|
1478
|
+
ngOnInit() {
|
|
1479
|
+
this.lineQuantities = this.order.lines.reduce((result, line) => ({
|
|
1480
|
+
...result,
|
|
1481
|
+
[line.id]: {
|
|
1482
|
+
quantity: 0,
|
|
1483
|
+
refund: true,
|
|
1484
|
+
cancel: false,
|
|
1485
|
+
},
|
|
1486
|
+
}), {});
|
|
1487
|
+
this.refundablePayments = getRefundablePayments(this.order.payments);
|
|
1488
|
+
}
|
|
1489
|
+
updateRefundTotal() {
|
|
1490
|
+
if (!this.manuallySetRefundTotal) {
|
|
1491
|
+
const itemTotal = this.order.lines.reduce((total, line) => {
|
|
1492
|
+
const lineRef = this.lineQuantities[line.id];
|
|
1493
|
+
const refundCount = lineRef.quantity || 0;
|
|
1494
|
+
return total + line.proratedUnitPriceWithTax * refundCount;
|
|
1495
|
+
}, 0);
|
|
1496
|
+
const shippingTotal = this.order.shippingLines.reduce((total, line) => {
|
|
1497
|
+
if (this.refundShippingLineIds.includes(line.id)) {
|
|
1498
|
+
return total + line.discountedPriceWithTax;
|
|
1499
|
+
}
|
|
1500
|
+
else {
|
|
1501
|
+
return total;
|
|
1502
|
+
}
|
|
1503
|
+
}, 0);
|
|
1504
|
+
this.refundTotal = itemTotal + shippingTotal;
|
|
1505
|
+
}
|
|
1506
|
+
// allocate the refund total across the refundable payments
|
|
1507
|
+
const refundablePayments = this.refundablePayments.filter(p => p.selected);
|
|
1508
|
+
let refundsAllocated = 0;
|
|
1509
|
+
for (const payment of refundablePayments) {
|
|
1510
|
+
const amountToRefund = Math.min(payment.refundableAmount, this.refundTotal - refundsAllocated);
|
|
1511
|
+
payment.amountToRefundControl.setValue(amountToRefund);
|
|
1512
|
+
refundsAllocated += amountToRefund;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
toggleShippingRefund(lineId) {
|
|
1516
|
+
const index = this.refundShippingLineIds.indexOf(lineId);
|
|
1517
|
+
if (index === -1) {
|
|
1518
|
+
this.refundShippingLineIds.push(lineId);
|
|
1519
|
+
}
|
|
1520
|
+
else {
|
|
1521
|
+
this.refundShippingLineIds.splice(index, 1);
|
|
1522
|
+
}
|
|
1523
|
+
this.updateRefundTotal();
|
|
1524
|
+
}
|
|
1525
|
+
onRefundQuantityChange(orderLineId, quantity) {
|
|
1526
|
+
this.manuallySetRefundTotal = false;
|
|
1527
|
+
const selectionLine = this.lineQuantities[orderLineId];
|
|
1528
|
+
if (selectionLine) {
|
|
1529
|
+
const previousQuantity = selectionLine.quantity;
|
|
1530
|
+
if (quantity === 0) {
|
|
1531
|
+
selectionLine.cancel = false;
|
|
1532
|
+
}
|
|
1533
|
+
else if (previousQuantity === 0 && quantity > 0) {
|
|
1534
|
+
selectionLine.cancel = true;
|
|
1535
|
+
}
|
|
1536
|
+
selectionLine.quantity = quantity;
|
|
1537
|
+
this.updateRefundTotal();
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
onPaymentSelected(payment, selected) {
|
|
1541
|
+
if (selected) {
|
|
1542
|
+
const outstandingRefundAmount = this.refundTotal -
|
|
1543
|
+
this.refundablePayments
|
|
1544
|
+
.filter(p => p.id !== payment.id)
|
|
1545
|
+
.reduce((total, p) => total + p.amountToRefundControl.value, 0);
|
|
1546
|
+
if (0 < outstandingRefundAmount) {
|
|
1547
|
+
payment.amountToRefundControl.setValue(Math.min(outstandingRefundAmount, payment.refundableAmount));
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
else {
|
|
1551
|
+
payment.amountToRefundControl.setValue(0);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
isRefunding() {
|
|
1555
|
+
const result = Object.values(this.lineQuantities).reduce((isRefunding, line) => isRefunding || 0 < line.quantity, false);
|
|
1556
|
+
return result;
|
|
1557
|
+
}
|
|
1558
|
+
isCancelling() {
|
|
1559
|
+
const result = Object.values(this.lineQuantities).reduce((isCancelling, line) => isCancelling || (0 < line.quantity && line.cancel), false);
|
|
1560
|
+
return result;
|
|
1561
|
+
}
|
|
1562
|
+
canSubmit() {
|
|
1563
|
+
return 0 < this.refundTotal && this.amountToRefundTotal === this.refundTotal && !!this.reason;
|
|
1564
|
+
}
|
|
1565
|
+
select() {
|
|
1566
|
+
const refundLines = this.getOrderLineInput(() => true);
|
|
1567
|
+
const cancelLines = this.getOrderLineInput(line => line.cancel);
|
|
1568
|
+
this.resolveWith({
|
|
1569
|
+
refunds: this.refundablePayments
|
|
1570
|
+
.filter(rp => rp.selected && 0 < rp.amountToRefundControl.value)
|
|
1571
|
+
.map(payment => {
|
|
1572
|
+
return {
|
|
1573
|
+
lines: refundLines,
|
|
1574
|
+
reason: this.reason,
|
|
1575
|
+
paymentId: payment.id,
|
|
1576
|
+
amount: payment.amountToRefundControl.value,
|
|
1577
|
+
shipping: 0,
|
|
1578
|
+
adjustment: 0,
|
|
1579
|
+
};
|
|
1580
|
+
}),
|
|
1581
|
+
cancel: {
|
|
1582
|
+
lines: cancelLines,
|
|
1583
|
+
orderId: this.order.id,
|
|
1584
|
+
reason: this.reason,
|
|
1585
|
+
cancelShipping: this.refundShippingLineIds.length > 0,
|
|
1586
|
+
},
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
cancel() {
|
|
1590
|
+
this.resolveWith();
|
|
1591
|
+
}
|
|
1592
|
+
getOrderLineInput(filterFn) {
|
|
1593
|
+
return Object.entries(this.lineQuantities)
|
|
1594
|
+
.filter(([orderLineId, line]) => 0 < line.quantity && filterFn(line))
|
|
1595
|
+
.map(([orderLineId, line]) => ({
|
|
1596
|
+
orderLineId,
|
|
1597
|
+
quantity: line.quantity,
|
|
1598
|
+
}));
|
|
1599
|
+
}
|
|
1600
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RefundOrderDialogComponent, deps: [{ token: i1.I18nService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1601
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: RefundOrderDialogComponent, selector: "vdr-refund-order-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.refund-and-cancel-order' | translate }}</ng-template>\n\n<div class=\"refund-wrapper\">\n <vdr-data-table-2 id=\"refund-order\" [items]=\"order.lines\">\n <!-- Here we define all the available columns -->\n <vdr-dt2-column id=\"id\" [heading]=\"'common.id' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"created-at\" [heading]=\"'common.created-at' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"updated-at\" [heading]=\"'common.updated-at' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.updatedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.image' | translate\" id=\"image\">\n <ng-template let-line=\"item\">\n <div class=\"image-placeholder\">\n <img\n *ngIf=\"line.featuredAsset as asset; else imagePlaceholder\"\n [src]=\"asset | assetPreview : 'tiny'\"\n />\n <ng-template #imagePlaceholder>\n <div class=\"placeholder\">\n <clr-icon shape=\"image\" size=\"48\"></clr-icon>\n </div>\n </ng-template>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"product-name\" [heading]=\"'order.product-name' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.name }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"product-sku\" [heading]=\"'order.product-sku' | translate\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.sku }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"unit-price\" [heading]=\"'order.unit-price' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"prorated-unit-price\" [heading]=\"'order.prorated-unit-price' | translate\">\n <ng-template let-line=\"item\">\n {{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}\n <ng-container *ngIf=\"line.discounts as discounts\">\n <vdr-dropdown *ngIf=\"discounts.length\">\n <div class=\"promotions-label\" vdrDropdownTrigger>\n <button class=\"icon-button\"><clr-icon shape=\"info\"></clr-icon></button>\n </div>\n <vdr-dropdown-menu>\n <div class=\"line-promotion\" *ngFor=\"let discount of discounts\">\n {{ discount.description }}\n <div class=\"promotion-amount\">\n {{\n discount.amount / 100 / line.quantity\n | number : '1.0-2'\n | currency : order.currencyCode\n }}\n </div>\n </div>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </ng-container>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"quantity\" [heading]=\"'order.quantity' | translate\">\n <ng-template let-line=\"item\">\n {{ line.quantity }}\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"refund-quantity\" [heading]=\"'order.refund' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <input\n *ngIf=\"lineCanBeRefundedOrCancelled(line)\"\n [ngModel]=\"lineQuantities[line.id].quantity\"\n type=\"number\"\n [max]=\"line.quantity\"\n min=\"0\"\n (ngModelChange)=\"onRefundQuantityChange(line.id, $event)\"\n />\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"cancel\" [heading]=\"'order.return-to-stock' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <div class=\"cancel-checkbox-wrapper\">\n <label class=\"flex center\">\n <input\n type=\"checkbox\"\n *ngIf=\"lineCanBeRefundedOrCancelled(line)\"\n clrCheckbox\n [disabled]=\"0 === lineQuantities[line.id].quantity\"\n [(ngModel)]=\"lineQuantities[line.id].cancel\"\n />\n <span class=\"ml-1\">{{ 'order.return-to-stock' | translate }}</span></label\n >\n </div>\n </ng-template>\n </vdr-dt2-column>\n </vdr-data-table-2>\n\n <div class=\"refund-details mt-4\">\n <div>\n <vdr-card>\n <label class=\"flex mb-2\" *ngFor=\"let shippingLine of order.shippingLines\">\n <input type=\"checkbox\" clrCheckbox (change)=\"toggleShippingRefund(shippingLine.id)\" />\n <div class=\"ml-1\">\n {{ 'order.refund-shipping' | translate }}\n <span>{{ shippingLine.shippingMethod.name }}:</span>\n <span class=\"ml-1\"\n >{{ shippingLine.discountedPriceWithTax | localeCurrency : order.currencyCode }}\n </span>\n </div></label\n >\n <vdr-form-field [label]=\"'order.refund-cancellation-reason' | translate\" class=\"mb-2\">\n <ng-select\n [items]=\"reasons\"\n bindLabel=\"name\"\n autofocus\n [placeholder]=\"'order.refund-cancellation-reason-required' | translate\"\n bindValue=\"id\"\n [addTag]=\"true\"\n [(ngModel)]=\"reason\"\n ></ng-select>\n </vdr-form-field>\n <vdr-form-field\n [label]=\"'order.refund-total' | translate\"\n [readOnlyToggle]=\"true\"\n (readOnlyToggleChange)=\"manuallySetRefundTotal = !$event\"\n >\n <vdr-currency-input\n [readonly]=\"!manuallySetRefundTotal\"\n [currencyCode]=\"order.currencyCode\"\n [(ngModel)]=\"refundTotal\"\n (ngModelChange)=\"updateRefundTotal()\"\n ></vdr-currency-input>\n </vdr-form-field>\n </vdr-card>\n </div>\n <div class=\"\">\n <vdr-payment-for-refund-selector\n [refundablePayments]=\"refundablePayments\"\n (paymentSelected)=\"onPaymentSelected($event.payment, $event.selected)\"\n [order]=\"order\"\n ></vdr-payment-for-refund-selector>\n </div>\n </div>\n</div>\n\n<ng-template vdrDialogButtons>\n <div>\n <div class=\"errors\">\n <clr-alert\n *ngIf=\"refundTotal < 0 || totalRefundableAmount < refundTotal\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{\n 'order.refund-total-error'\n | translate\n : {\n min: 0 | currency : order.currencyCode,\n max: totalRefundableAmount | localeCurrency : order.currencyCode\n }\n }}\n </clr-alert-item>\n </clr-alert>\n <clr-alert\n *ngIf=\"amountToRefundTotal < refundTotal || refundTotal < amountToRefundTotal\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{ 'order.refund-total-warning' | translate }}\n </clr-alert-item>\n </clr-alert>\n <clr-alert\n *ngIf=\"amountToRefundTotal && !reason\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{ 'order.refund-cancellation-reason-required' | translate }}\n </clr-alert-item>\n </clr-alert>\n </div>\n <div class=\"modal-buttons\">\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"select()\" [disabled]=\"!canSubmit()\" class=\"btn btn-primary\">\n {{\n 'order.refund-with-amount'\n | translate : { amount: amountToRefundTotal | localeCurrency : order.currencyCode }\n }}\n </button>\n </div>\n </div>\n</ng-template>\n", styles: [":host{height:100%;display:flex;flex-direction:column;min-height:64vh}.refund-wrapper{flex:1;flex-direction:column}.refund-wrapper .order-table{flex:1;overflow-y:auto}.refund-wrapper .order-table table{margin-top:0}.refund-wrapper tr.ignore{color:var(--color-grey-300)}::ng-deep .refund-wrapper .table-wrapper{max-width:initial!important}.quantity-col{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper{margin-top:12px;margin-bottom:12px;display:block}.refund-details{display:flex;flex-direction:column;padding-bottom:var(--space-unit);gap:calc(var(--space-unit) * 2);justify-content:space-between}@media screen and (min-width: 992px){.refund-details{flex-direction:row}}.refund-details vdr-card.unselected{opacity:.8}.refund-details>*{flex:1}.errors{display:flex;justify-content:flex-end;gap:calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) 0}.prorated-wrapper{display:flex;justify-content:center}.line-promotion{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion .promotion-amount{margin-inline-start:12px}vdr-card.faded{opacity:.8}.modal-buttons{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}\n"], dependencies: [{ kind: "component", type: i3.ClrAlert, selector: "clr-alert", inputs: ["clrAlertSizeSmall", "clrAlertClosable", "clrAlertAppLevel", "clrCloseButtonAriaLabel", "clrAlertLightweight", "clrAlertType", "clrAlertIcon", "clrAlertClosed"], outputs: ["clrAlertClosedChange"] }, { kind: "component", type: i3.ClrAlertItem, selector: "clr-alert-item" }, { kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["id", "for"] }, { kind: "directive", type: i3.ClrCheckbox, selector: "[clrCheckbox],[clrToggle]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "component", type: i1.CurrencyInputComponent, selector: "vdr-currency-input", inputs: ["disabled", "readonly", "value", "currencyCode"], outputs: ["valueChange"] }, { kind: "component", type: i1.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"], outputs: ["readOnlyToggleChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "component", type: i1.DataTable2Component, selector: "vdr-data-table-2", inputs: ["id", "items", "itemsPerPage", "currentPage", "totalItems", "emptyStateLabel", "filters", "activeIndex"], outputs: ["pageChange", "itemsPerPageChange"] }, { kind: "component", type: i1.DataTable2ColumnComponent, selector: "vdr-dt2-column", inputs: ["id", "expand", "heading", "align", "sort", "optional", "hiddenByDefault", "orderable"], exportAs: ["row"] }, { kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "component", type: LineRefundsComponent, selector: "vdr-line-refunds", inputs: ["line", "payments"] }, { kind: "component", type: PaymentForRefundSelectorComponent, selector: "vdr-payment-for-refund-selector", inputs: ["refundablePayments", "order"], outputs: ["paymentSelected"] }, { kind: "pipe", type: i2$1.DecimalPipe, name: "number" }, { kind: "pipe", type: i2$1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.AssetPreviewPipe, name: "assetPreview" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1602
|
+
}
|
|
1603
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RefundOrderDialogComponent, decorators: [{
|
|
1604
|
+
type: Component,
|
|
1605
|
+
args: [{ selector: 'vdr-refund-order-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.refund-and-cancel-order' | translate }}</ng-template>\n\n<div class=\"refund-wrapper\">\n <vdr-data-table-2 id=\"refund-order\" [items]=\"order.lines\">\n <!-- Here we define all the available columns -->\n <vdr-dt2-column id=\"id\" [heading]=\"'common.id' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"created-at\" [heading]=\"'common.created-at' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"updated-at\" [heading]=\"'common.updated-at' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.updatedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.image' | translate\" id=\"image\">\n <ng-template let-line=\"item\">\n <div class=\"image-placeholder\">\n <img\n *ngIf=\"line.featuredAsset as asset; else imagePlaceholder\"\n [src]=\"asset | assetPreview : 'tiny'\"\n />\n <ng-template #imagePlaceholder>\n <div class=\"placeholder\">\n <clr-icon shape=\"image\" size=\"48\"></clr-icon>\n </div>\n </ng-template>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"product-name\" [heading]=\"'order.product-name' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.name }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"product-sku\" [heading]=\"'order.product-sku' | translate\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.sku }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"unit-price\" [heading]=\"'order.unit-price' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"prorated-unit-price\" [heading]=\"'order.prorated-unit-price' | translate\">\n <ng-template let-line=\"item\">\n {{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}\n <ng-container *ngIf=\"line.discounts as discounts\">\n <vdr-dropdown *ngIf=\"discounts.length\">\n <div class=\"promotions-label\" vdrDropdownTrigger>\n <button class=\"icon-button\"><clr-icon shape=\"info\"></clr-icon></button>\n </div>\n <vdr-dropdown-menu>\n <div class=\"line-promotion\" *ngFor=\"let discount of discounts\">\n {{ discount.description }}\n <div class=\"promotion-amount\">\n {{\n discount.amount / 100 / line.quantity\n | number : '1.0-2'\n | currency : order.currencyCode\n }}\n </div>\n </div>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </ng-container>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"quantity\" [heading]=\"'order.quantity' | translate\">\n <ng-template let-line=\"item\">\n {{ line.quantity }}\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"refund-quantity\" [heading]=\"'order.refund' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <input\n *ngIf=\"lineCanBeRefundedOrCancelled(line)\"\n [ngModel]=\"lineQuantities[line.id].quantity\"\n type=\"number\"\n [max]=\"line.quantity\"\n min=\"0\"\n (ngModelChange)=\"onRefundQuantityChange(line.id, $event)\"\n />\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"cancel\" [heading]=\"'order.return-to-stock' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <div class=\"cancel-checkbox-wrapper\">\n <label class=\"flex center\">\n <input\n type=\"checkbox\"\n *ngIf=\"lineCanBeRefundedOrCancelled(line)\"\n clrCheckbox\n [disabled]=\"0 === lineQuantities[line.id].quantity\"\n [(ngModel)]=\"lineQuantities[line.id].cancel\"\n />\n <span class=\"ml-1\">{{ 'order.return-to-stock' | translate }}</span></label\n >\n </div>\n </ng-template>\n </vdr-dt2-column>\n </vdr-data-table-2>\n\n <div class=\"refund-details mt-4\">\n <div>\n <vdr-card>\n <label class=\"flex mb-2\" *ngFor=\"let shippingLine of order.shippingLines\">\n <input type=\"checkbox\" clrCheckbox (change)=\"toggleShippingRefund(shippingLine.id)\" />\n <div class=\"ml-1\">\n {{ 'order.refund-shipping' | translate }}\n <span>{{ shippingLine.shippingMethod.name }}:</span>\n <span class=\"ml-1\"\n >{{ shippingLine.discountedPriceWithTax | localeCurrency : order.currencyCode }}\n </span>\n </div></label\n >\n <vdr-form-field [label]=\"'order.refund-cancellation-reason' | translate\" class=\"mb-2\">\n <ng-select\n [items]=\"reasons\"\n bindLabel=\"name\"\n autofocus\n [placeholder]=\"'order.refund-cancellation-reason-required' | translate\"\n bindValue=\"id\"\n [addTag]=\"true\"\n [(ngModel)]=\"reason\"\n ></ng-select>\n </vdr-form-field>\n <vdr-form-field\n [label]=\"'order.refund-total' | translate\"\n [readOnlyToggle]=\"true\"\n (readOnlyToggleChange)=\"manuallySetRefundTotal = !$event\"\n >\n <vdr-currency-input\n [readonly]=\"!manuallySetRefundTotal\"\n [currencyCode]=\"order.currencyCode\"\n [(ngModel)]=\"refundTotal\"\n (ngModelChange)=\"updateRefundTotal()\"\n ></vdr-currency-input>\n </vdr-form-field>\n </vdr-card>\n </div>\n <div class=\"\">\n <vdr-payment-for-refund-selector\n [refundablePayments]=\"refundablePayments\"\n (paymentSelected)=\"onPaymentSelected($event.payment, $event.selected)\"\n [order]=\"order\"\n ></vdr-payment-for-refund-selector>\n </div>\n </div>\n</div>\n\n<ng-template vdrDialogButtons>\n <div>\n <div class=\"errors\">\n <clr-alert\n *ngIf=\"refundTotal < 0 || totalRefundableAmount < refundTotal\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{\n 'order.refund-total-error'\n | translate\n : {\n min: 0 | currency : order.currencyCode,\n max: totalRefundableAmount | localeCurrency : order.currencyCode\n }\n }}\n </clr-alert-item>\n </clr-alert>\n <clr-alert\n *ngIf=\"amountToRefundTotal < refundTotal || refundTotal < amountToRefundTotal\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{ 'order.refund-total-warning' | translate }}\n </clr-alert-item>\n </clr-alert>\n <clr-alert\n *ngIf=\"amountToRefundTotal && !reason\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{ 'order.refund-cancellation-reason-required' | translate }}\n </clr-alert-item>\n </clr-alert>\n </div>\n <div class=\"modal-buttons\">\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"select()\" [disabled]=\"!canSubmit()\" class=\"btn btn-primary\">\n {{\n 'order.refund-with-amount'\n | translate : { amount: amountToRefundTotal | localeCurrency : order.currencyCode }\n }}\n </button>\n </div>\n </div>\n</ng-template>\n", styles: [":host{height:100%;display:flex;flex-direction:column;min-height:64vh}.refund-wrapper{flex:1;flex-direction:column}.refund-wrapper .order-table{flex:1;overflow-y:auto}.refund-wrapper .order-table table{margin-top:0}.refund-wrapper tr.ignore{color:var(--color-grey-300)}::ng-deep .refund-wrapper .table-wrapper{max-width:initial!important}.quantity-col{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper{margin-top:12px;margin-bottom:12px;display:block}.refund-details{display:flex;flex-direction:column;padding-bottom:var(--space-unit);gap:calc(var(--space-unit) * 2);justify-content:space-between}@media screen and (min-width: 992px){.refund-details{flex-direction:row}}.refund-details vdr-card.unselected{opacity:.8}.refund-details>*{flex:1}.errors{display:flex;justify-content:flex-end;gap:calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) 0}.prorated-wrapper{display:flex;justify-content:center}.line-promotion{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion .promotion-amount{margin-inline-start:12px}vdr-card.faded{opacity:.8}.modal-buttons{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}\n"] }]
|
|
1606
|
+
}], ctorParameters: () => [{ type: i1.I18nService }] });
|
|
1607
|
+
|
|
1608
|
+
class SettleRefundDialogComponent {
|
|
1609
|
+
constructor() {
|
|
1610
|
+
this.transactionId = '';
|
|
1611
|
+
}
|
|
1612
|
+
submit() {
|
|
1613
|
+
this.resolveWith(this.transactionId);
|
|
1614
|
+
}
|
|
1615
|
+
cancel() {
|
|
1616
|
+
this.resolveWith();
|
|
1617
|
+
}
|
|
1618
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SettleRefundDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1619
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SettleRefundDialogComponent, selector: "vdr-settle-refund-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.settle-refund' | translate }}</ng-template>\n<p class=\"instruction\">\n {{ 'order.settle-refund-manual-instructions' | translate: { method: refund.method } }}\n</p>\n<clr-input-container>\n <label>{{ 'order.transaction-id' | translate }}</label>\n <input clrInput name=\"transactionId\" [(ngModel)]=\"transactionId\" />\n</clr-input-container>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"submit()\" [disabled]=\"!transactionId\" class=\"btn btn-primary\">\n {{ 'order.settle-refund' | translate }}\n </button>\n</ng-template>\n", styles: [":host{padding-bottom:32px}.instruction{margin-top:0;margin-bottom:24px}\n"], dependencies: [{ kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["id", "for"] }, { kind: "directive", type: i3.ClrInput, selector: "[clrInput]" }, { kind: "component", type: i3.ClrInputContainer, selector: "clr-input-container" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1620
|
+
}
|
|
1621
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SettleRefundDialogComponent, decorators: [{
|
|
1622
|
+
type: Component,
|
|
1623
|
+
args: [{ selector: 'vdr-settle-refund-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.settle-refund' | translate }}</ng-template>\n<p class=\"instruction\">\n {{ 'order.settle-refund-manual-instructions' | translate: { method: refund.method } }}\n</p>\n<clr-input-container>\n <label>{{ 'order.transaction-id' | translate }}</label>\n <input clrInput name=\"transactionId\" [(ngModel)]=\"transactionId\" />\n</clr-input-container>\n\n<ng-template vdrDialogButtons>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"submit\" (click)=\"submit()\" [disabled]=\"!transactionId\" class=\"btn btn-primary\">\n {{ 'order.settle-refund' | translate }}\n </button>\n</ng-template>\n", styles: [":host{padding-bottom:32px}.instruction{margin-top:0;margin-bottom:24px}\n"] }]
|
|
1624
|
+
}] });
|
|
1625
|
+
|
|
1626
|
+
class PaymentStateLabelComponent {
|
|
1627
|
+
get chipColorType() {
|
|
1628
|
+
switch (this.state) {
|
|
1629
|
+
case 'Authorized':
|
|
1630
|
+
return 'warning';
|
|
1631
|
+
case 'Settled':
|
|
1632
|
+
return 'success';
|
|
1633
|
+
case 'Declined':
|
|
1634
|
+
case 'Cancelled':
|
|
1635
|
+
return 'error';
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PaymentStateLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1639
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PaymentStateLabelComponent, selector: "vdr-payment-state-label", inputs: { state: "state" }, ngImport: i0, template: "<vdr-chip [title]=\"'order.payment-state' | translate\" [colorType]=\"chipColorType\">\n <clr-icon shape=\"check-circle\" *ngIf=\"state === 'Settled'\"></clr-icon>\n {{ state | stateI18nToken | translate }}\n</vdr-chip>\n", styles: [":host{display:flex;font-size:14px}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1640
|
+
}
|
|
1641
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PaymentStateLabelComponent, decorators: [{
|
|
1642
|
+
type: Component,
|
|
1643
|
+
args: [{ selector: 'vdr-payment-state-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-chip [title]=\"'order.payment-state' | translate\" [colorType]=\"chipColorType\">\n <clr-icon shape=\"check-circle\" *ngIf=\"state === 'Settled'\"></clr-icon>\n {{ state | stateI18nToken | translate }}\n</vdr-chip>\n", styles: [":host{display:flex;font-size:14px}\n"] }]
|
|
1644
|
+
}], propDecorators: { state: [{
|
|
1645
|
+
type: Input
|
|
1646
|
+
}] } });
|
|
1647
|
+
|
|
1648
|
+
class RefundStateLabelComponent {
|
|
1649
|
+
get chipColorType() {
|
|
1650
|
+
switch (this.state) {
|
|
1651
|
+
case 'Pending':
|
|
1652
|
+
return 'warning';
|
|
1653
|
+
case 'Settled':
|
|
1654
|
+
return 'success';
|
|
1655
|
+
case 'Failed':
|
|
1656
|
+
return 'error';
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RefundStateLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1660
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: RefundStateLabelComponent, selector: "vdr-refund-state-label", inputs: { state: "state" }, ngImport: i0, template: "<vdr-chip [title]=\"'order.payment-state' | translate\" [colorType]=\"chipColorType\">\n <clr-icon shape=\"check-circle\" *ngIf=\"state === 'Settled'\"></clr-icon>\n {{ state | stateI18nToken | translate }}\n</vdr-chip>\n", styles: [":host{display:flex;font-size:14px}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1661
|
+
}
|
|
1662
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RefundStateLabelComponent, decorators: [{
|
|
1663
|
+
type: Component,
|
|
1664
|
+
args: [{ selector: 'vdr-refund-state-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-chip [title]=\"'order.payment-state' | translate\" [colorType]=\"chipColorType\">\n <clr-icon shape=\"check-circle\" *ngIf=\"state === 'Settled'\"></clr-icon>\n {{ state | stateI18nToken | translate }}\n</vdr-chip>\n", styles: [":host{display:flex;font-size:14px}\n"] }]
|
|
1665
|
+
}], propDecorators: { state: [{
|
|
1666
|
+
type: Input
|
|
1667
|
+
}] } });
|
|
1668
|
+
|
|
1669
|
+
class PaymentDetailComponent {
|
|
1670
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PaymentDetailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1671
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PaymentDetailComponent, selector: "vdr-payment-detail", inputs: { payment: "payment", currencyCode: "currencyCode" }, ngImport: i0, template: "<vdr-labeled-data [label]=\"'order.payment-method' | translate\">\n {{ payment.method }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.amount' | translate\">\n {{ payment.amount | localeCurrency: currencyCode }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"payment.errorMessage\" [label]=\"'order.error-message' | translate\">\n {{ payment.errorMessage }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"payment.transactionId\" [label]=\"'order.transaction-id' | translate\">\n {{ payment.transactionId }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.payment-metadata' | translate\">\n <vdr-object-tree [value]=\"payment.metadata\"></vdr-object-tree>\n</vdr-labeled-data>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.ObjectTreeComponent, selector: "vdr-object-tree", inputs: ["value", "isArrayItem"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1672
|
+
}
|
|
1673
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PaymentDetailComponent, decorators: [{
|
|
1674
|
+
type: Component,
|
|
1675
|
+
args: [{ selector: 'vdr-payment-detail', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-labeled-data [label]=\"'order.payment-method' | translate\">\n {{ payment.method }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.amount' | translate\">\n {{ payment.amount | localeCurrency: currencyCode }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"payment.errorMessage\" [label]=\"'order.error-message' | translate\">\n {{ payment.errorMessage }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"payment.transactionId\" [label]=\"'order.transaction-id' | translate\">\n {{ payment.transactionId }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.payment-metadata' | translate\">\n <vdr-object-tree [value]=\"payment.metadata\"></vdr-object-tree>\n</vdr-labeled-data>\n" }]
|
|
1676
|
+
}], propDecorators: { payment: [{
|
|
1677
|
+
type: Input
|
|
1678
|
+
}], currencyCode: [{
|
|
1679
|
+
type: Input
|
|
1680
|
+
}] } });
|
|
1681
|
+
|
|
1682
|
+
class OrderPaymentCardComponent {
|
|
1683
|
+
constructor() {
|
|
1684
|
+
this.settlePayment = new EventEmitter();
|
|
1685
|
+
this.transitionPaymentState = new EventEmitter();
|
|
1686
|
+
this.settleRefund = new EventEmitter();
|
|
1687
|
+
}
|
|
1688
|
+
refundHasMetadata(refund) {
|
|
1689
|
+
return !!refund && Object.keys(refund.metadata).length > 0;
|
|
1690
|
+
}
|
|
1691
|
+
nextOtherStates() {
|
|
1692
|
+
if (!this.payment) {
|
|
1693
|
+
return [];
|
|
1694
|
+
}
|
|
1695
|
+
return this.payment.nextStates.filter(s => s !== 'Settled' && s !== 'Error');
|
|
1696
|
+
}
|
|
1697
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderPaymentCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1698
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderPaymentCardComponent, selector: "vdr-order-payment-card", inputs: { payment: "payment", currencyCode: "currencyCode" }, outputs: { settlePayment: "settlePayment", transitionPaymentState: "transitionPaymentState", settleRefund: "settleRefund" }, ngImport: i0, template: "<div class=\"card\">\n <div class=\"card-header payment-header\">\n <div>\n {{ 'order.payment' | translate }}\n <ng-container *ngIf=\"payment.amount\">{{ payment.amount | localeCurrency : currencyCode }}</ng-container>\n </div>\n <div class=\"payment-state\">\n <vdr-payment-state-label [state]=\"payment.state\"></vdr-payment-state-label>\n </div>\n </div>\n <div class=\"card-block\">\n <vdr-payment-detail [payment]=\"payment\" [currencyCode]=\"currencyCode\"></vdr-payment-detail>\n </div>\n <ng-container *ngFor=\"let refund of payment.refunds\">\n <div class=\"refund-wrapper card-block\">\n <div class=\"card-header payment-header refund-header\">\n <clr-icon shape=\"redo\" class=\"refund-icon\" dir=\"down\"></clr-icon>\n {{ 'order.refund' | translate }} #{{ refund.id }}\n <div class=\"clr-flex-fill\"></div>\n <vdr-refund-state-label [state]=\"refund.state\"></vdr-refund-state-label>\n </div>\n <div class=\"card-block\">\n <vdr-labeled-data [label]=\"'common.created-at' | translate\">\n {{ refund.createdAt | localeDate : 'medium' }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.refund-total' | translate\">\n {{ refund.total | localeCurrency : currencyCode }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.transaction-id' | translate\" *ngIf=\"refund.transactionId\">\n {{ refund.transactionId }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.refund-reason' | translate\" *ngIf=\"refund.reason\">\n {{ refund.reason }}\n </vdr-labeled-data>\n <vdr-labeled-data\n [label]=\"'order.refund-metadata' | translate\"\n *ngIf=\"refundHasMetadata(refund)\"\n >\n <vdr-object-tree [value]=\"refund.metadata\"></vdr-object-tree>\n </vdr-labeled-data>\n </div>\n <div class=\"card-footer\" *ngIf=\"refund.state === 'Pending'\">\n <button class=\"btn btn-sm btn-primary\" (click)=\"settleRefund.emit(refund)\">\n {{ 'order.settle-refund' | translate }}\n </button>\n </div>\n </div>\n </ng-container>\n <div class=\"card-footer\" *ngIf=\"payment.nextStates.length\">\n <button\n class=\"btn btn-sm btn-primary\"\n *ngIf=\"payment.nextStates.includes('Settled')\"\n (click)=\"settlePayment.emit(payment)\"\n >\n {{ 'order.settle-payment' | translate }}\n </button>\n <vdr-dropdown>\n <button class=\"icon-button\" vdrDropdownTrigger>\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <ng-container *ngFor=\"let nextState of nextOtherStates()\">\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionPaymentState.emit({ payment: payment, state: nextState })\"\n >\n <ng-container *ngIf=\"nextState !== 'Cancelled'; else cancel\">\n <clr-icon shape=\"step-forward-2\"></clr-icon>\n {{\n 'order.transition-to-state'\n | translate : { state: (nextState | stateI18nToken | translate) }\n }}\n </ng-container>\n <ng-template #cancel>\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\n {{ 'order.cancel-payment' | translate }}\n </ng-template>\n </button>\n </ng-container>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </div>\n</div>\n", styles: [":host{display:block}.payment-header{display:flex;justify-content:space-between;align-items:center;line-break:anywhere}.refund-icon{margin-inline-end:6px;color:var(--color-grey-400)}.card-footer{display:flex;align-items:center;justify-content:flex-end}.refund-wrapper{font-size:var(--font-size-xs)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.Dir, selector: "[dir]", inputs: ["dir"], outputs: ["dirChange"], exportAs: ["dir"] }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.ObjectTreeComponent, selector: "vdr-object-tree", inputs: ["value", "isArrayItem"] }, { kind: "component", type: PaymentStateLabelComponent, selector: "vdr-payment-state-label", inputs: ["state"] }, { kind: "component", type: RefundStateLabelComponent, selector: "vdr-refund-state-label", inputs: ["state"] }, { kind: "component", type: PaymentDetailComponent, selector: "vdr-payment-detail", inputs: ["payment", "currencyCode"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1699
|
+
}
|
|
1700
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderPaymentCardComponent, decorators: [{
|
|
1701
|
+
type: Component,
|
|
1702
|
+
args: [{ selector: 'vdr-order-payment-card', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"card\">\n <div class=\"card-header payment-header\">\n <div>\n {{ 'order.payment' | translate }}\n <ng-container *ngIf=\"payment.amount\">{{ payment.amount | localeCurrency : currencyCode }}</ng-container>\n </div>\n <div class=\"payment-state\">\n <vdr-payment-state-label [state]=\"payment.state\"></vdr-payment-state-label>\n </div>\n </div>\n <div class=\"card-block\">\n <vdr-payment-detail [payment]=\"payment\" [currencyCode]=\"currencyCode\"></vdr-payment-detail>\n </div>\n <ng-container *ngFor=\"let refund of payment.refunds\">\n <div class=\"refund-wrapper card-block\">\n <div class=\"card-header payment-header refund-header\">\n <clr-icon shape=\"redo\" class=\"refund-icon\" dir=\"down\"></clr-icon>\n {{ 'order.refund' | translate }} #{{ refund.id }}\n <div class=\"clr-flex-fill\"></div>\n <vdr-refund-state-label [state]=\"refund.state\"></vdr-refund-state-label>\n </div>\n <div class=\"card-block\">\n <vdr-labeled-data [label]=\"'common.created-at' | translate\">\n {{ refund.createdAt | localeDate : 'medium' }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.refund-total' | translate\">\n {{ refund.total | localeCurrency : currencyCode }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.transaction-id' | translate\" *ngIf=\"refund.transactionId\">\n {{ refund.transactionId }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.refund-reason' | translate\" *ngIf=\"refund.reason\">\n {{ refund.reason }}\n </vdr-labeled-data>\n <vdr-labeled-data\n [label]=\"'order.refund-metadata' | translate\"\n *ngIf=\"refundHasMetadata(refund)\"\n >\n <vdr-object-tree [value]=\"refund.metadata\"></vdr-object-tree>\n </vdr-labeled-data>\n </div>\n <div class=\"card-footer\" *ngIf=\"refund.state === 'Pending'\">\n <button class=\"btn btn-sm btn-primary\" (click)=\"settleRefund.emit(refund)\">\n {{ 'order.settle-refund' | translate }}\n </button>\n </div>\n </div>\n </ng-container>\n <div class=\"card-footer\" *ngIf=\"payment.nextStates.length\">\n <button\n class=\"btn btn-sm btn-primary\"\n *ngIf=\"payment.nextStates.includes('Settled')\"\n (click)=\"settlePayment.emit(payment)\"\n >\n {{ 'order.settle-payment' | translate }}\n </button>\n <vdr-dropdown>\n <button class=\"icon-button\" vdrDropdownTrigger>\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <ng-container *ngFor=\"let nextState of nextOtherStates()\">\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionPaymentState.emit({ payment: payment, state: nextState })\"\n >\n <ng-container *ngIf=\"nextState !== 'Cancelled'; else cancel\">\n <clr-icon shape=\"step-forward-2\"></clr-icon>\n {{\n 'order.transition-to-state'\n | translate : { state: (nextState | stateI18nToken | translate) }\n }}\n </ng-container>\n <ng-template #cancel>\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\n {{ 'order.cancel-payment' | translate }}\n </ng-template>\n </button>\n </ng-container>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </div>\n</div>\n", styles: [":host{display:block}.payment-header{display:flex;justify-content:space-between;align-items:center;line-break:anywhere}.refund-icon{margin-inline-end:6px;color:var(--color-grey-400)}.card-footer{display:flex;align-items:center;justify-content:flex-end}.refund-wrapper{font-size:var(--font-size-xs)}\n"] }]
|
|
1703
|
+
}], propDecorators: { payment: [{
|
|
1704
|
+
type: Input
|
|
1705
|
+
}], currencyCode: [{
|
|
1706
|
+
type: Input
|
|
1707
|
+
}], settlePayment: [{
|
|
1708
|
+
type: Output
|
|
1709
|
+
}], transitionPaymentState: [{
|
|
1710
|
+
type: Output
|
|
1711
|
+
}], settleRefund: [{
|
|
1712
|
+
type: Output
|
|
1713
|
+
}] } });
|
|
1714
|
+
|
|
1715
|
+
class OrderHistoryEntryHostComponent {
|
|
1716
|
+
constructor(historyEntryComponentService) {
|
|
1717
|
+
this.historyEntryComponentService = historyEntryComponentService;
|
|
1718
|
+
this.expandClick = new EventEmitter();
|
|
1719
|
+
}
|
|
1720
|
+
ngOnInit() {
|
|
1721
|
+
const componentType = this.historyEntryComponentService.getComponent(this.entry.type);
|
|
1722
|
+
const componentRef = this.portalRef.createComponent(componentType);
|
|
1723
|
+
componentRef.instance.entry = this.entry;
|
|
1724
|
+
componentRef.instance.order = this.order;
|
|
1725
|
+
this.instance = componentRef.instance;
|
|
1726
|
+
this.componentRef = componentRef;
|
|
1727
|
+
}
|
|
1728
|
+
ngOnDestroy() {
|
|
1729
|
+
this.componentRef?.destroy();
|
|
1730
|
+
}
|
|
1731
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderHistoryEntryHostComponent, deps: [{ token: i1.HistoryEntryComponentService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1732
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderHistoryEntryHostComponent, selector: "vdr-order-history-entry-host", inputs: { entry: "entry", order: "order", expanded: "expanded" }, outputs: { expandClick: "expandClick" }, viewQueries: [{ propertyName: "portalRef", first: true, predicate: ["portal"], descendants: true, read: ViewContainerRef, static: true }], exportAs: ["historyEntry"], ngImport: i0, template: `<vdr-timeline-entry
|
|
1733
|
+
[displayType]="instance.getDisplayType(entry)"
|
|
1734
|
+
[iconShape]="instance.getIconShape && instance.getIconShape(entry)"
|
|
1735
|
+
[createdAt]="entry.createdAt"
|
|
1736
|
+
[name]="instance.getName && instance.getName(entry)"
|
|
1737
|
+
[featured]="instance.isFeatured(entry)"
|
|
1738
|
+
[collapsed]="!expanded && !instance.isFeatured(entry)"
|
|
1739
|
+
(expandClick)="expandClick.emit()"
|
|
1740
|
+
>
|
|
1741
|
+
<div #portal></div>
|
|
1742
|
+
</vdr-timeline-entry>`, isInline: true, dependencies: [{ kind: "component", type: i1.TimelineEntryComponent, selector: "vdr-timeline-entry", inputs: ["displayType", "createdAt", "name", "featured", "iconShape", "isFirst", "isLast", "collapsed"], outputs: ["expandClick"] }] }); }
|
|
1743
|
+
}
|
|
1744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderHistoryEntryHostComponent, decorators: [{
|
|
1745
|
+
type: Component,
|
|
1746
|
+
args: [{
|
|
1747
|
+
selector: 'vdr-order-history-entry-host',
|
|
1748
|
+
template: `<vdr-timeline-entry
|
|
1749
|
+
[displayType]="instance.getDisplayType(entry)"
|
|
1750
|
+
[iconShape]="instance.getIconShape && instance.getIconShape(entry)"
|
|
1751
|
+
[createdAt]="entry.createdAt"
|
|
1752
|
+
[name]="instance.getName && instance.getName(entry)"
|
|
1753
|
+
[featured]="instance.isFeatured(entry)"
|
|
1754
|
+
[collapsed]="!expanded && !instance.isFeatured(entry)"
|
|
1755
|
+
(expandClick)="expandClick.emit()"
|
|
1756
|
+
>
|
|
1757
|
+
<div #portal></div>
|
|
1758
|
+
</vdr-timeline-entry>`,
|
|
1759
|
+
exportAs: 'historyEntry',
|
|
1760
|
+
}]
|
|
1761
|
+
}], ctorParameters: () => [{ type: i1.HistoryEntryComponentService }], propDecorators: { entry: [{
|
|
1762
|
+
type: Input
|
|
1763
|
+
}], order: [{
|
|
1764
|
+
type: Input
|
|
1765
|
+
}], expanded: [{
|
|
1766
|
+
type: Input
|
|
1767
|
+
}], expandClick: [{
|
|
1768
|
+
type: Output
|
|
1769
|
+
}], portalRef: [{
|
|
1770
|
+
type: ViewChild,
|
|
1771
|
+
args: ['portal', { static: true, read: ViewContainerRef }]
|
|
1772
|
+
}] } });
|
|
1773
|
+
|
|
1774
|
+
class OrderHistoryComponent {
|
|
1775
|
+
constructor(historyEntryComponentService) {
|
|
1776
|
+
this.historyEntryComponentService = historyEntryComponentService;
|
|
1777
|
+
this.addNote = new EventEmitter();
|
|
1778
|
+
this.updateNote = new EventEmitter();
|
|
1779
|
+
this.deleteNote = new EventEmitter();
|
|
1780
|
+
this.note = '';
|
|
1781
|
+
this.noteIsPrivate = true;
|
|
1782
|
+
this.expanded = false;
|
|
1783
|
+
this.type = HistoryEntryType;
|
|
1784
|
+
}
|
|
1785
|
+
hasCustomComponent(type) {
|
|
1786
|
+
return !!this.historyEntryComponentService.getComponent(type);
|
|
1787
|
+
}
|
|
1788
|
+
getDisplayType(entry) {
|
|
1789
|
+
if (entry.type === HistoryEntryType.ORDER_STATE_TRANSITION) {
|
|
1790
|
+
if (entry.data.to === 'Delivered') {
|
|
1791
|
+
return 'success';
|
|
1792
|
+
}
|
|
1793
|
+
if (entry.data.to === 'Cancelled') {
|
|
1794
|
+
return 'error';
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
if (entry.type === HistoryEntryType.ORDER_FULFILLMENT_TRANSITION) {
|
|
1798
|
+
if (entry.data.to === 'Delivered') {
|
|
1799
|
+
return 'success';
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
if (entry.type === HistoryEntryType.ORDER_PAYMENT_TRANSITION) {
|
|
1803
|
+
if (entry.data.to === 'Declined' || entry.data.to === 'Cancelled') {
|
|
1804
|
+
return 'error';
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
if (entry.type === HistoryEntryType.ORDER_CANCELLATION) {
|
|
1808
|
+
return 'warning';
|
|
1809
|
+
}
|
|
1810
|
+
if (entry.type === HistoryEntryType.ORDER_REFUND_TRANSITION) {
|
|
1811
|
+
return 'warning';
|
|
1812
|
+
}
|
|
1813
|
+
return 'default';
|
|
1814
|
+
}
|
|
1815
|
+
getTimelineIcon(entry) {
|
|
1816
|
+
if (entry.type === HistoryEntryType.ORDER_STATE_TRANSITION) {
|
|
1817
|
+
if (entry.data.to === 'Delivered') {
|
|
1818
|
+
return ['success-standard', 'is-solid'];
|
|
1819
|
+
}
|
|
1820
|
+
if (entry.data.to === 'Cancelled') {
|
|
1821
|
+
return 'ban';
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
if (entry.type === HistoryEntryType.ORDER_PAYMENT_TRANSITION) {
|
|
1825
|
+
if (entry.data.to === 'Settled') {
|
|
1826
|
+
return 'credit-card';
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
if (entry.type === HistoryEntryType.ORDER_REFUND_TRANSITION) {
|
|
1830
|
+
if (entry.data.to === 'Settled') {
|
|
1831
|
+
return 'credit-card';
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
if (entry.type === HistoryEntryType.ORDER_NOTE) {
|
|
1835
|
+
return 'note';
|
|
1836
|
+
}
|
|
1837
|
+
if (entry.type === HistoryEntryType.ORDER_MODIFIED) {
|
|
1838
|
+
return 'pencil';
|
|
1839
|
+
}
|
|
1840
|
+
if (entry.type === HistoryEntryType.ORDER_CUSTOMER_UPDATED) {
|
|
1841
|
+
return 'switch';
|
|
1842
|
+
}
|
|
1843
|
+
if (entry.type === HistoryEntryType.ORDER_FULFILLMENT_TRANSITION) {
|
|
1844
|
+
if (entry.data.to === 'Shipped') {
|
|
1845
|
+
return 'truck';
|
|
1846
|
+
}
|
|
1847
|
+
if (entry.data.to === 'Delivered') {
|
|
1848
|
+
return 'truck';
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
isFeatured(entry) {
|
|
1853
|
+
switch (entry.type) {
|
|
1854
|
+
case HistoryEntryType.ORDER_STATE_TRANSITION: {
|
|
1855
|
+
return (entry.data.to === 'Delivered' ||
|
|
1856
|
+
entry.data.to === 'Cancelled' ||
|
|
1857
|
+
entry.data.to === 'Settled');
|
|
1858
|
+
}
|
|
1859
|
+
case HistoryEntryType.ORDER_REFUND_TRANSITION:
|
|
1860
|
+
return entry.data.to === 'Settled';
|
|
1861
|
+
case HistoryEntryType.ORDER_PAYMENT_TRANSITION:
|
|
1862
|
+
return entry.data.to === 'Settled' || entry.data.to === 'Cancelled';
|
|
1863
|
+
case HistoryEntryType.ORDER_FULFILLMENT_TRANSITION:
|
|
1864
|
+
return entry.data.to === 'Delivered' || entry.data.to === 'Shipped';
|
|
1865
|
+
case HistoryEntryType.ORDER_NOTE:
|
|
1866
|
+
case HistoryEntryType.ORDER_MODIFIED:
|
|
1867
|
+
case HistoryEntryType.ORDER_CUSTOMER_UPDATED:
|
|
1868
|
+
return true;
|
|
1869
|
+
default:
|
|
1870
|
+
return false;
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
getFulfillment(entry) {
|
|
1874
|
+
if ((entry.type === HistoryEntryType.ORDER_FULFILLMENT ||
|
|
1875
|
+
entry.type === HistoryEntryType.ORDER_FULFILLMENT_TRANSITION) &&
|
|
1876
|
+
this.order.fulfillments) {
|
|
1877
|
+
return this.order.fulfillments.find(f => f.id === entry.data.fulfillmentId);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
getPayment(entry) {
|
|
1881
|
+
if (entry.type === HistoryEntryType.ORDER_PAYMENT_TRANSITION && this.order.payments) {
|
|
1882
|
+
return this.order.payments.find(p => p.id === entry.data.paymentId);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
getRefund(entry) {
|
|
1886
|
+
if (entry.type === HistoryEntryType.ORDER_REFUND_TRANSITION && this.order.payments) {
|
|
1887
|
+
const allRefunds = this.order.payments.reduce((refunds, payment) => refunds.concat(payment.refunds), []);
|
|
1888
|
+
return allRefunds.find(r => r.id === entry.data.refundId);
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
getCancelledQuantity(entry) {
|
|
1892
|
+
return entry.data.lines.reduce((total, line) => total + line.quantity, 0);
|
|
1893
|
+
}
|
|
1894
|
+
getCancelledItems(cancellationLines) {
|
|
1895
|
+
const itemMap = new Map();
|
|
1896
|
+
for (const line of this.order.lines) {
|
|
1897
|
+
const cancellationLine = cancellationLines.find(l => l.orderLineId === line.id);
|
|
1898
|
+
if (cancellationLine) {
|
|
1899
|
+
const count = itemMap.get(line.productVariant.name);
|
|
1900
|
+
itemMap.set(line.productVariant.name, cancellationLine.quantity);
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
return Array.from(itemMap.entries()).map(([name, quantity]) => ({ name, quantity }));
|
|
1904
|
+
}
|
|
1905
|
+
getModification(id) {
|
|
1906
|
+
return this.order.modifications.find(m => m.id === id);
|
|
1907
|
+
}
|
|
1908
|
+
getName(entry) {
|
|
1909
|
+
const { administrator } = entry;
|
|
1910
|
+
if (administrator) {
|
|
1911
|
+
return `${administrator.firstName} ${administrator.lastName}`;
|
|
1912
|
+
}
|
|
1913
|
+
else {
|
|
1914
|
+
const customer = this.order.customer;
|
|
1915
|
+
if (customer) {
|
|
1916
|
+
return `${customer.firstName} ${customer.lastName}`;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
return '';
|
|
1920
|
+
}
|
|
1921
|
+
addNoteToOrder() {
|
|
1922
|
+
this.addNote.emit({ note: this.note, isPublic: !this.noteIsPrivate });
|
|
1923
|
+
this.note = '';
|
|
1924
|
+
this.noteIsPrivate = true;
|
|
1925
|
+
}
|
|
1926
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderHistoryComponent, deps: [{ token: i1.HistoryEntryComponentService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1927
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderHistoryComponent, selector: "vdr-order-history", inputs: { order: "order", history: "history" }, outputs: { addNote: "addNote", updateNote: "updateNote", deleteNote: "deleteNote" }, ngImport: i0, template: "<div class=\"entry-list\" [class.expanded]=\"expanded\">\n <vdr-timeline-entry iconShape=\"note\" displayType=\"muted\" [featured]=\"true\" [isFirst]=\"true\">\n <div class=\"note-entry\">\n <textarea [(ngModel)]=\"note\" name=\"note\" class=\"note\"></textarea>\n <button class=\"btn btn-secondary\" [disabled]=\"!note\" (click)=\"addNoteToOrder()\">\n {{ 'common.add-note' | translate }}\n </button>\n </div>\n <div class=\"visibility-select\">\n <clr-checkbox-wrapper>\n <input type=\"checkbox\" clrCheckbox [(ngModel)]=\"noteIsPrivate\" />\n <label>{{ 'order.note-is-private' | translate }}</label>\n </clr-checkbox-wrapper>\n <span *ngIf=\"noteIsPrivate\" class=\"private\">\n {{ 'order.note-only-visible-to-administrators' | translate }}\n </span>\n <span *ngIf=\"!noteIsPrivate\" class=\"public\">\n {{ 'order.note-visible-to-customer' | translate }}\n </span>\n </div>\n </vdr-timeline-entry>\n <ng-container *ngFor=\"let entry of history\">\n <vdr-order-history-entry-host\n *ngIf=\"hasCustomComponent(entry.type); else defaultComponents\"\n [order]=\"order\"\n [entry]=\"entry\"\n [expanded]=\"expanded\"\n (expandClick)=\"expanded = !expanded\"\n ></vdr-order-history-entry-host>\n <ng-template #defaultComponents>\n <vdr-timeline-entry\n [displayType]=\"getDisplayType(entry)\"\n [iconShape]=\"getTimelineIcon(entry)\"\n [createdAt]=\"entry.createdAt\"\n [name]=\"getName(entry)\"\n [featured]=\"isFeatured(entry)\"\n [collapsed]=\"!expanded && !isFeatured(entry)\"\n (expandClick)=\"expanded = !expanded\"\n >\n <ng-container [ngSwitch]=\"entry.type\">\n <ng-container *ngSwitchCase=\"type.ORDER_STATE_TRANSITION\">\n <div class=\"title\" *ngIf=\"entry.data.to === 'Delivered'\">\n {{ 'order.history-order-fulfilled' | translate }}\n </div>\n <div class=\"title\" *ngIf=\"entry.data.to === 'Cancelled'\">\n {{ 'order.history-order-cancelled' | translate }}\n </div>\n <ng-template [ngIf]=\"entry.data.to !== 'Cancelled' && entry.data.to !== 'Delivered'\">\n {{\n 'order.history-order-transition'\n | translate : { from: entry.data.from, to: entry.data.to }\n }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_MODIFIED\">\n <div class=\"title\">\n {{ 'order.history-order-modified' | translate }}\n </div>\n <div\n class=\"flex items-center\"\n *ngIf=\"getModification(entry.data.modificationId) as modification\"\n >\n {{ 'order.modify-order-price-difference' | translate }}:\n <strong>{{\n modification.priceChange | localeCurrency : order.currencyCode\n }}</strong>\n <vdr-chip colorType=\"success\" class=\"mx-1\" *ngIf=\"modification.isSettled\">{{\n 'order.modification-settled' | translate\n }}</vdr-chip>\n <vdr-chip colorType=\"error\" class=\"mx-1\" *ngIf=\"!modification.isSettled\">{{\n 'order.modification-not-settled' | translate\n }}</vdr-chip>\n <vdr-history-entry-detail>\n <vdr-modification-detail\n [order]=\"order\"\n [modification]=\"modification\"\n ></vdr-modification-detail>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_PAYMENT_TRANSITION\">\n <ng-container *ngIf=\"entry.data.to === 'Settled'; else regularPaymentTransition\">\n <div class=\"title\">\n {{ 'order.history-payment-settled' | translate }}\n </div>\n <div class=\"flex items-center\">\n <vdr-chip *ngIf=\"getPayment(entry) as payment\" class=\"mr-1\">{{\n payment.amount | localeCurrency : order.currencyCode\n }}</vdr-chip>\n <vdr-history-entry-detail *ngIf=\"getPayment(entry) as payment\">\n <vdr-payment-detail\n [payment]=\"payment\"\n [currencyCode]=\"order.currencyCode\"\n ></vdr-payment-detail>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n <ng-template #regularPaymentTransition>\n {{\n 'order.history-payment-transition'\n | translate\n : {\n from: entry.data.from,\n to: entry.data.to,\n id: getPayment(entry)?.transactionId\n }\n }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_REFUND_TRANSITION\">\n <ng-container *ngIf=\"entry.data.to === 'Settled'; else regularRefundTransition\">\n <ng-container *ngIf=\"getRefund(entry) as refund\">\n <div class=\"title\">{{ 'order.refund' | translate }} #{{ refund.id }}</div>\n <div class=\"flex items-center\">\n <vdr-chip colorType=\"warning\" class=\"mr-1\">{{\n refund.total | localeCurrency : order.currencyCode\n }}</vdr-chip>\n <vdr-history-entry-detail>\n <vdr-labeled-data [label]=\"'order.cancellation-reason' | translate\">\n {{ entry.data.reason }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.contents' | translate\">\n <vdr-simple-item-list\n [items]=\"getCancelledItems(refund.lines)\"\n ></vdr-simple-item-list>\n </vdr-labeled-data>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n </ng-container>\n <ng-template #regularRefundTransition>\n {{\n 'order.history-refund-transition'\n | translate\n : {\n from: entry.data.from,\n to: entry.data.to,\n id: entry.data.refundId\n }\n }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_CANCELLATION\">\n {{\n 'order.history-items-cancelled'\n | translate : { count: getCancelledQuantity(entry) }\n }}\n <vdr-history-entry-detail *ngIf=\"getCancelledItems(entry.data.lines) as items\">\n <vdr-labeled-data [label]=\"'order.cancellation-reason' | translate\">\n {{ entry.data.reason }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.contents' | translate\">\n <vdr-simple-item-list [items]=\"items\"></vdr-simple-item-list>\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.shipping-cancelled' | translate\">\n {{ entry.data.shippingCancelled }}\n </vdr-labeled-data>\n </vdr-history-entry-detail>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT\">\n {{ 'order.history-fulfillment-created' | translate }}\n <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n <vdr-fulfillment-detail\n [fulfillmentId]=\"fulfillment.id\"\n [order]=\"order\"\n ></vdr-fulfillment-detail>\n </vdr-history-entry-detail>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT_TRANSITION\">\n <ng-container *ngIf=\"entry.data.to === 'Delivered'\">\n <div class=\"title\">\n {{ 'order.history-fulfillment-delivered' | translate }}\n </div>\n {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n </ng-container>\n <ng-container *ngIf=\"entry.data.to === 'Shipped'\">\n <div class=\"title\">\n {{ 'order.history-fulfillment-shipped' | translate }}\n </div>\n {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n </ng-container>\n <ng-container *ngIf=\"entry.data.to !== 'Delivered' && entry.data.to !== 'Shipped'\">\n {{\n 'order.history-fulfillment-transition'\n | translate : { from: entry.data.from, to: entry.data.to }\n }}\n </ng-container>\n <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n <vdr-fulfillment-detail\n [fulfillmentId]=\"fulfillment.id\"\n [order]=\"order\"\n ></vdr-fulfillment-detail>\n </vdr-history-entry-detail>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_NOTE\">\n <div class=\"flex\">\n <div class=\"note-text\">\n <span *ngIf=\"entry.isPublic\" class=\"note-visibility public\">{{\n 'common.public' | translate\n }}</span>\n <span *ngIf=\"!entry.isPublic\" class=\"note-visibility private\">{{\n 'common.private' | translate\n }}</span>\n {{ entry.data.note }}\n </div>\n <div class=\"flex-spacer\"></div>\n <vdr-dropdown>\n <button class=\"button-small ml-1\" vdrDropdownTrigger>\n <clr-icon shape=\"ellipsis-vertical\" size=\"12\"></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <button\n vdrDropdownItem\n (click)=\"updateNote.emit(entry)\"\n [disabled]=\"!('UpdateOrder' | hasPermission)\"\n >\n <clr-icon shape=\"edit\"></clr-icon>\n {{ 'common.edit' | translate }}\n </button>\n <div class=\"dropdown-divider\"></div>\n <button\n vdrDropdownItem\n (click)=\"deleteNote.emit(entry)\"\n [disabled]=\"!('UpdateOrder' | hasPermission)\"\n >\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n {{ 'common.delete' | translate }}\n </button>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_COUPON_APPLIED\">\n {{ 'order.history-coupon-code-applied' | translate }}:\n <vdr-chip>\n <a [routerLink]=\"['/marketing', 'promotions', entry.data.promotionId]\">{{\n entry.data.couponCode\n }}</a>\n </vdr-chip>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_COUPON_REMOVED\">\n {{ 'order.history-coupon-code-removed' | translate }}:\n <vdr-chip\n ><span class=\"cancelled-coupon-code\">{{ entry.data.couponCode }}</span></vdr-chip\n >\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_CUSTOMER_UPDATED\">\n <div class=\"title\">\n {{\n 'order.history-customer-updated'\n | translate : { newCustomerName: entry.data.newCustomerName }\n }}\n </div>\n <div class=\"flex\">\n <div class=\"note-text\">\n {{ entry.data.note }}\n </div>\n <div class=\"flex-spacer\"></div>\n <vdr-history-entry-detail>\n <vdr-labeled-data [label]=\"'order.previous-customer' | translate\">\n <a\n *ngIf=\"entry.data.previousCustomerId\"\n class=\"button-ghost\"\n [routerLink]=\"[\n '/customer',\n 'customers',\n entry.data.previousCustomerId\n ]\"\n >\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon>\n <span>{{ entry.data.previousCustomerName }}</span>\n <clr-icon shape=\"arrow right\"></clr-icon>\n </a>\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.new-customer' | translate\">\n <a\n *ngIf=\"entry.data.newCustomerId\"\n class=\"button-ghost\"\n [routerLink]=\"['/customer', 'customers', entry.data.newCustomerId]\"\n >\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon>\n <span>{{ entry.data.newCustomerName }}</span>\n <clr-icon shape=\"arrow right\"></clr-icon>\n </a>\n </vdr-labeled-data>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <div class=\"title\">\n {{ entry.type | translate }}\n </div>\n <vdr-history-entry-detail *ngIf=\"entry.data\">\n <vdr-object-tree [value]=\"entry.data\"></vdr-object-tree>\n </vdr-history-entry-detail>\n </ng-container>\n </ng-container>\n </vdr-timeline-entry>\n </ng-template>\n </ng-container>\n\n <vdr-timeline-entry [isLast]=\"true\" [createdAt]=\"order.createdAt\" [featured]=\"true\">\n <div class=\"title\">\n {{ 'order.history-order-created' | translate }}\n </div>\n </vdr-timeline-entry>\n</div>\n", styles: [":host{display:block}.entry-list{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry{display:flex;align-items:center}.note-entry .note{flex:1}.note-entry button{margin:0}.visibility-select{display:flex;justify-content:space-between;align-items:baseline}.visibility-select .public{color:var(--color-warning-700)}.visibility-select .private{color:var(--color-success-700)}textarea.note{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text{color:var(--color-grey-800);white-space:pre-wrap;max-width:580px}.cancelled-coupon-code{text-decoration:line-through}.note-visibility{text-transform:lowercase}.note-visibility.public{color:var(--color-warning-700)}.note-visibility.private{color:var(--color-success-700)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["id", "for"] }, { kind: "directive", type: i3.ClrCheckbox, selector: "[clrCheckbox],[clrToggle]" }, { kind: "component", type: i3.ClrCheckboxWrapper, selector: "clr-checkbox-wrapper,clr-toggle-wrapper" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.ObjectTreeComponent, selector: "vdr-object-tree", inputs: ["value", "isArrayItem"] }, { kind: "component", type: i1.TimelineEntryComponent, selector: "vdr-timeline-entry", inputs: ["displayType", "createdAt", "name", "featured", "iconShape", "isFirst", "isLast", "collapsed"], outputs: ["expandClick"] }, { kind: "component", type: i1.HistoryEntryDetailComponent, selector: "vdr-history-entry-detail" }, { kind: "component", type: FulfillmentDetailComponent, selector: "vdr-fulfillment-detail", inputs: ["fulfillmentId", "order"] }, { kind: "component", type: PaymentDetailComponent, selector: "vdr-payment-detail", inputs: ["payment", "currencyCode"] }, { kind: "component", type: SimpleItemListComponent, selector: "vdr-simple-item-list", inputs: ["items"] }, { kind: "component", type: ModificationDetailComponent, selector: "vdr-modification-detail", inputs: ["order", "modification"] }, { kind: "component", type: OrderHistoryEntryHostComponent, selector: "vdr-order-history-entry-host", inputs: ["entry", "order", "expanded"], outputs: ["expandClick"], exportAs: ["historyEntry"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.HasPermissionPipe, name: "hasPermission" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1928
|
+
}
|
|
1929
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderHistoryComponent, decorators: [{
|
|
1930
|
+
type: Component,
|
|
1931
|
+
args: [{ selector: 'vdr-order-history', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"entry-list\" [class.expanded]=\"expanded\">\n <vdr-timeline-entry iconShape=\"note\" displayType=\"muted\" [featured]=\"true\" [isFirst]=\"true\">\n <div class=\"note-entry\">\n <textarea [(ngModel)]=\"note\" name=\"note\" class=\"note\"></textarea>\n <button class=\"btn btn-secondary\" [disabled]=\"!note\" (click)=\"addNoteToOrder()\">\n {{ 'common.add-note' | translate }}\n </button>\n </div>\n <div class=\"visibility-select\">\n <clr-checkbox-wrapper>\n <input type=\"checkbox\" clrCheckbox [(ngModel)]=\"noteIsPrivate\" />\n <label>{{ 'order.note-is-private' | translate }}</label>\n </clr-checkbox-wrapper>\n <span *ngIf=\"noteIsPrivate\" class=\"private\">\n {{ 'order.note-only-visible-to-administrators' | translate }}\n </span>\n <span *ngIf=\"!noteIsPrivate\" class=\"public\">\n {{ 'order.note-visible-to-customer' | translate }}\n </span>\n </div>\n </vdr-timeline-entry>\n <ng-container *ngFor=\"let entry of history\">\n <vdr-order-history-entry-host\n *ngIf=\"hasCustomComponent(entry.type); else defaultComponents\"\n [order]=\"order\"\n [entry]=\"entry\"\n [expanded]=\"expanded\"\n (expandClick)=\"expanded = !expanded\"\n ></vdr-order-history-entry-host>\n <ng-template #defaultComponents>\n <vdr-timeline-entry\n [displayType]=\"getDisplayType(entry)\"\n [iconShape]=\"getTimelineIcon(entry)\"\n [createdAt]=\"entry.createdAt\"\n [name]=\"getName(entry)\"\n [featured]=\"isFeatured(entry)\"\n [collapsed]=\"!expanded && !isFeatured(entry)\"\n (expandClick)=\"expanded = !expanded\"\n >\n <ng-container [ngSwitch]=\"entry.type\">\n <ng-container *ngSwitchCase=\"type.ORDER_STATE_TRANSITION\">\n <div class=\"title\" *ngIf=\"entry.data.to === 'Delivered'\">\n {{ 'order.history-order-fulfilled' | translate }}\n </div>\n <div class=\"title\" *ngIf=\"entry.data.to === 'Cancelled'\">\n {{ 'order.history-order-cancelled' | translate }}\n </div>\n <ng-template [ngIf]=\"entry.data.to !== 'Cancelled' && entry.data.to !== 'Delivered'\">\n {{\n 'order.history-order-transition'\n | translate : { from: entry.data.from, to: entry.data.to }\n }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_MODIFIED\">\n <div class=\"title\">\n {{ 'order.history-order-modified' | translate }}\n </div>\n <div\n class=\"flex items-center\"\n *ngIf=\"getModification(entry.data.modificationId) as modification\"\n >\n {{ 'order.modify-order-price-difference' | translate }}:\n <strong>{{\n modification.priceChange | localeCurrency : order.currencyCode\n }}</strong>\n <vdr-chip colorType=\"success\" class=\"mx-1\" *ngIf=\"modification.isSettled\">{{\n 'order.modification-settled' | translate\n }}</vdr-chip>\n <vdr-chip colorType=\"error\" class=\"mx-1\" *ngIf=\"!modification.isSettled\">{{\n 'order.modification-not-settled' | translate\n }}</vdr-chip>\n <vdr-history-entry-detail>\n <vdr-modification-detail\n [order]=\"order\"\n [modification]=\"modification\"\n ></vdr-modification-detail>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_PAYMENT_TRANSITION\">\n <ng-container *ngIf=\"entry.data.to === 'Settled'; else regularPaymentTransition\">\n <div class=\"title\">\n {{ 'order.history-payment-settled' | translate }}\n </div>\n <div class=\"flex items-center\">\n <vdr-chip *ngIf=\"getPayment(entry) as payment\" class=\"mr-1\">{{\n payment.amount | localeCurrency : order.currencyCode\n }}</vdr-chip>\n <vdr-history-entry-detail *ngIf=\"getPayment(entry) as payment\">\n <vdr-payment-detail\n [payment]=\"payment\"\n [currencyCode]=\"order.currencyCode\"\n ></vdr-payment-detail>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n <ng-template #regularPaymentTransition>\n {{\n 'order.history-payment-transition'\n | translate\n : {\n from: entry.data.from,\n to: entry.data.to,\n id: getPayment(entry)?.transactionId\n }\n }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_REFUND_TRANSITION\">\n <ng-container *ngIf=\"entry.data.to === 'Settled'; else regularRefundTransition\">\n <ng-container *ngIf=\"getRefund(entry) as refund\">\n <div class=\"title\">{{ 'order.refund' | translate }} #{{ refund.id }}</div>\n <div class=\"flex items-center\">\n <vdr-chip colorType=\"warning\" class=\"mr-1\">{{\n refund.total | localeCurrency : order.currencyCode\n }}</vdr-chip>\n <vdr-history-entry-detail>\n <vdr-labeled-data [label]=\"'order.cancellation-reason' | translate\">\n {{ entry.data.reason }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.contents' | translate\">\n <vdr-simple-item-list\n [items]=\"getCancelledItems(refund.lines)\"\n ></vdr-simple-item-list>\n </vdr-labeled-data>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n </ng-container>\n <ng-template #regularRefundTransition>\n {{\n 'order.history-refund-transition'\n | translate\n : {\n from: entry.data.from,\n to: entry.data.to,\n id: entry.data.refundId\n }\n }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_CANCELLATION\">\n {{\n 'order.history-items-cancelled'\n | translate : { count: getCancelledQuantity(entry) }\n }}\n <vdr-history-entry-detail *ngIf=\"getCancelledItems(entry.data.lines) as items\">\n <vdr-labeled-data [label]=\"'order.cancellation-reason' | translate\">\n {{ entry.data.reason }}\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.contents' | translate\">\n <vdr-simple-item-list [items]=\"items\"></vdr-simple-item-list>\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.shipping-cancelled' | translate\">\n {{ entry.data.shippingCancelled }}\n </vdr-labeled-data>\n </vdr-history-entry-detail>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT\">\n {{ 'order.history-fulfillment-created' | translate }}\n <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n <vdr-fulfillment-detail\n [fulfillmentId]=\"fulfillment.id\"\n [order]=\"order\"\n ></vdr-fulfillment-detail>\n </vdr-history-entry-detail>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT_TRANSITION\">\n <ng-container *ngIf=\"entry.data.to === 'Delivered'\">\n <div class=\"title\">\n {{ 'order.history-fulfillment-delivered' | translate }}\n </div>\n {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n </ng-container>\n <ng-container *ngIf=\"entry.data.to === 'Shipped'\">\n <div class=\"title\">\n {{ 'order.history-fulfillment-shipped' | translate }}\n </div>\n {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n </ng-container>\n <ng-container *ngIf=\"entry.data.to !== 'Delivered' && entry.data.to !== 'Shipped'\">\n {{\n 'order.history-fulfillment-transition'\n | translate : { from: entry.data.from, to: entry.data.to }\n }}\n </ng-container>\n <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n <vdr-fulfillment-detail\n [fulfillmentId]=\"fulfillment.id\"\n [order]=\"order\"\n ></vdr-fulfillment-detail>\n </vdr-history-entry-detail>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_NOTE\">\n <div class=\"flex\">\n <div class=\"note-text\">\n <span *ngIf=\"entry.isPublic\" class=\"note-visibility public\">{{\n 'common.public' | translate\n }}</span>\n <span *ngIf=\"!entry.isPublic\" class=\"note-visibility private\">{{\n 'common.private' | translate\n }}</span>\n {{ entry.data.note }}\n </div>\n <div class=\"flex-spacer\"></div>\n <vdr-dropdown>\n <button class=\"button-small ml-1\" vdrDropdownTrigger>\n <clr-icon shape=\"ellipsis-vertical\" size=\"12\"></clr-icon>\n </button>\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n <button\n vdrDropdownItem\n (click)=\"updateNote.emit(entry)\"\n [disabled]=\"!('UpdateOrder' | hasPermission)\"\n >\n <clr-icon shape=\"edit\"></clr-icon>\n {{ 'common.edit' | translate }}\n </button>\n <div class=\"dropdown-divider\"></div>\n <button\n vdrDropdownItem\n (click)=\"deleteNote.emit(entry)\"\n [disabled]=\"!('UpdateOrder' | hasPermission)\"\n >\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n {{ 'common.delete' | translate }}\n </button>\n </vdr-dropdown-menu>\n </vdr-dropdown>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_COUPON_APPLIED\">\n {{ 'order.history-coupon-code-applied' | translate }}:\n <vdr-chip>\n <a [routerLink]=\"['/marketing', 'promotions', entry.data.promotionId]\">{{\n entry.data.couponCode\n }}</a>\n </vdr-chip>\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_COUPON_REMOVED\">\n {{ 'order.history-coupon-code-removed' | translate }}:\n <vdr-chip\n ><span class=\"cancelled-coupon-code\">{{ entry.data.couponCode }}</span></vdr-chip\n >\n </ng-container>\n <ng-container *ngSwitchCase=\"type.ORDER_CUSTOMER_UPDATED\">\n <div class=\"title\">\n {{\n 'order.history-customer-updated'\n | translate : { newCustomerName: entry.data.newCustomerName }\n }}\n </div>\n <div class=\"flex\">\n <div class=\"note-text\">\n {{ entry.data.note }}\n </div>\n <div class=\"flex-spacer\"></div>\n <vdr-history-entry-detail>\n <vdr-labeled-data [label]=\"'order.previous-customer' | translate\">\n <a\n *ngIf=\"entry.data.previousCustomerId\"\n class=\"button-ghost\"\n [routerLink]=\"[\n '/customer',\n 'customers',\n entry.data.previousCustomerId\n ]\"\n >\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon>\n <span>{{ entry.data.previousCustomerName }}</span>\n <clr-icon shape=\"arrow right\"></clr-icon>\n </a>\n </vdr-labeled-data>\n <vdr-labeled-data [label]=\"'order.new-customer' | translate\">\n <a\n *ngIf=\"entry.data.newCustomerId\"\n class=\"button-ghost\"\n [routerLink]=\"['/customer', 'customers', entry.data.newCustomerId]\"\n >\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon>\n <span>{{ entry.data.newCustomerName }}</span>\n <clr-icon shape=\"arrow right\"></clr-icon>\n </a>\n </vdr-labeled-data>\n </vdr-history-entry-detail>\n </div>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <div class=\"title\">\n {{ entry.type | translate }}\n </div>\n <vdr-history-entry-detail *ngIf=\"entry.data\">\n <vdr-object-tree [value]=\"entry.data\"></vdr-object-tree>\n </vdr-history-entry-detail>\n </ng-container>\n </ng-container>\n </vdr-timeline-entry>\n </ng-template>\n </ng-container>\n\n <vdr-timeline-entry [isLast]=\"true\" [createdAt]=\"order.createdAt\" [featured]=\"true\">\n <div class=\"title\">\n {{ 'order.history-order-created' | translate }}\n </div>\n </vdr-timeline-entry>\n</div>\n", styles: [":host{display:block}.entry-list{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry{display:flex;align-items:center}.note-entry .note{flex:1}.note-entry button{margin:0}.visibility-select{display:flex;justify-content:space-between;align-items:baseline}.visibility-select .public{color:var(--color-warning-700)}.visibility-select .private{color:var(--color-success-700)}textarea.note{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text{color:var(--color-grey-800);white-space:pre-wrap;max-width:580px}.cancelled-coupon-code{text-decoration:line-through}.note-visibility{text-transform:lowercase}.note-visibility.public{color:var(--color-warning-700)}.note-visibility.private{color:var(--color-success-700)}\n"] }]
|
|
1932
|
+
}], ctorParameters: () => [{ type: i1.HistoryEntryComponentService }], propDecorators: { order: [{
|
|
1933
|
+
type: Input
|
|
1934
|
+
}], history: [{
|
|
1935
|
+
type: Input
|
|
1936
|
+
}], addNote: [{
|
|
1937
|
+
type: Output
|
|
1938
|
+
}], updateNote: [{
|
|
1939
|
+
type: Output
|
|
1940
|
+
}], deleteNote: [{
|
|
1941
|
+
type: Output
|
|
1942
|
+
}] } });
|
|
1943
|
+
|
|
1944
|
+
const GET_SELLER_ORDERS = gql `
|
|
1945
|
+
query GetSellerOrders($orderId: ID!) {
|
|
1946
|
+
order(id: $orderId) {
|
|
1947
|
+
id
|
|
1948
|
+
sellerOrders {
|
|
1949
|
+
id
|
|
1950
|
+
code
|
|
1951
|
+
state
|
|
1952
|
+
orderPlacedAt
|
|
1953
|
+
currencyCode
|
|
1954
|
+
totalWithTax
|
|
1955
|
+
channels {
|
|
1956
|
+
id
|
|
1957
|
+
code
|
|
1958
|
+
seller {
|
|
1959
|
+
id
|
|
1960
|
+
name
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
`;
|
|
1967
|
+
|
|
1968
|
+
class SellerOrdersCardComponent {
|
|
1969
|
+
constructor(router, dataService, channelService) {
|
|
1970
|
+
this.router = router;
|
|
1971
|
+
this.dataService = dataService;
|
|
1972
|
+
this.channelService = channelService;
|
|
1973
|
+
}
|
|
1974
|
+
ngOnInit() {
|
|
1975
|
+
this.sellerOrders$ = this.dataService
|
|
1976
|
+
.query(GET_SELLER_ORDERS, {
|
|
1977
|
+
orderId: this.orderId,
|
|
1978
|
+
})
|
|
1979
|
+
.mapSingle(({ order }) => order?.sellerOrders ?? []);
|
|
1980
|
+
}
|
|
1981
|
+
getSeller(order) {
|
|
1982
|
+
const sellerChannel = order.channels.find(channel => channel.code !== DEFAULT_CHANNEL_CODE);
|
|
1983
|
+
return sellerChannel?.seller;
|
|
1984
|
+
}
|
|
1985
|
+
navigateToSellerOrder(order) {
|
|
1986
|
+
this.router.navigate(['/orders', order.id]);
|
|
1987
|
+
}
|
|
1988
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SellerOrdersCardComponent, deps: [{ token: i1$1.Router }, { token: i1.DataService }, { token: i1.ChannelService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1989
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SellerOrdersCardComponent, selector: "vdr-seller-orders-card", inputs: { orderId: "orderId" }, ngImport: i0, template: "<vdr-card [title]=\"'order.seller-orders' | translate\">\n <div class=\"form-grid\">\n <div *ngFor=\"let order of sellerOrders$ | async\">\n <a [routerLink]=\"['seller-orders', order.id]\" class=\"button-ghost mb-1\"\n >{{ order.code }} <clr-icon shape=\"arrow right\"></clr-icon\n ></a>\n <vdr-labeled-data [label]=\"'order.state' | translate\">\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </vdr-labeled-data>\n <vdr-labeled-data *ngIf=\"getSeller(order) as seller\" [label]=\"'common.seller' | translate\">\n {{ seller.name }}\n </vdr-labeled-data>\n <vdr-labeled-data *ngIf=\"getSeller(order) as seller\" [label]=\"'order.total' | translate\">\n {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n </vdr-labeled-data>\n </div>\n </div>\n</vdr-card>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.OrderStateLabelComponent, selector: "vdr-order-state-label", inputs: ["state"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1990
|
+
}
|
|
1991
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SellerOrdersCardComponent, decorators: [{
|
|
1992
|
+
type: Component,
|
|
1993
|
+
args: [{ selector: 'vdr-seller-orders-card', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-card [title]=\"'order.seller-orders' | translate\">\n <div class=\"form-grid\">\n <div *ngFor=\"let order of sellerOrders$ | async\">\n <a [routerLink]=\"['seller-orders', order.id]\" class=\"button-ghost mb-1\"\n >{{ order.code }} <clr-icon shape=\"arrow right\"></clr-icon\n ></a>\n <vdr-labeled-data [label]=\"'order.state' | translate\">\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </vdr-labeled-data>\n <vdr-labeled-data *ngIf=\"getSeller(order) as seller\" [label]=\"'common.seller' | translate\">\n {{ seller.name }}\n </vdr-labeled-data>\n <vdr-labeled-data *ngIf=\"getSeller(order) as seller\" [label]=\"'order.total' | translate\">\n {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n </vdr-labeled-data>\n </div>\n </div>\n</vdr-card>\n", styles: [":host{display:block}\n"] }]
|
|
1994
|
+
}], ctorParameters: () => [{ type: i1$1.Router }, { type: i1.DataService }, { type: i1.ChannelService }], propDecorators: { orderId: [{
|
|
1995
|
+
type: Input
|
|
1996
|
+
}] } });
|
|
1997
|
+
|
|
1998
|
+
const ORDER_DETAIL_QUERY = gql `
|
|
1999
|
+
query OrderDetailQuery($id: ID!) {
|
|
2000
|
+
order(id: $id) {
|
|
2001
|
+
...OrderDetail
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
${ORDER_DETAIL_FRAGMENT}
|
|
2005
|
+
`;
|
|
2006
|
+
const SET_ORDER_CUSTOMER_MUTATION = gql `
|
|
2007
|
+
mutation SetOrderCustomer($input: SetOrderCustomerInput!) {
|
|
2008
|
+
setOrderCustomer(input: $input) {
|
|
2009
|
+
id
|
|
2010
|
+
customer {
|
|
2011
|
+
id
|
|
2012
|
+
firstName
|
|
2013
|
+
lastName
|
|
2014
|
+
emailAddress
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
`;
|
|
2019
|
+
class OrderDetailComponent extends TypedBaseDetailComponent {
|
|
2020
|
+
constructor(changeDetector, dataService, notificationService, modalService, orderTransitionService, formBuilder) {
|
|
2021
|
+
super();
|
|
2022
|
+
this.changeDetector = changeDetector;
|
|
2023
|
+
this.dataService = dataService;
|
|
2024
|
+
this.notificationService = notificationService;
|
|
2025
|
+
this.modalService = modalService;
|
|
2026
|
+
this.orderTransitionService = orderTransitionService;
|
|
2027
|
+
this.formBuilder = formBuilder;
|
|
2028
|
+
this.customFields = this.getCustomFieldConfig('Order');
|
|
2029
|
+
this.orderLineCustomFields = this.getCustomFieldConfig('OrderLine');
|
|
2030
|
+
this.detailForm = new FormGroup({
|
|
2031
|
+
customFields: this.formBuilder.group(getCustomFieldsDefaults(this.customFields)),
|
|
2032
|
+
});
|
|
2033
|
+
this.fetchHistory = new Subject();
|
|
2034
|
+
this.defaultStates = [
|
|
2035
|
+
'AddingItems',
|
|
2036
|
+
'ArrangingPayment',
|
|
2037
|
+
'PaymentAuthorized',
|
|
2038
|
+
'PaymentSettled',
|
|
2039
|
+
'PartiallyShipped',
|
|
2040
|
+
'Shipped',
|
|
2041
|
+
'PartiallyDelivered',
|
|
2042
|
+
'Delivered',
|
|
2043
|
+
'Cancelled',
|
|
2044
|
+
'Modifying',
|
|
2045
|
+
'ArrangingAdditionalPayment',
|
|
2046
|
+
];
|
|
2047
|
+
}
|
|
2048
|
+
ngOnInit() {
|
|
2049
|
+
this.init();
|
|
2050
|
+
this.entity$.pipe(take(1)).subscribe(order => {
|
|
2051
|
+
if (order.state === 'Modifying') {
|
|
2052
|
+
this.router.navigate(['./', 'modify'], { relativeTo: this.route });
|
|
2053
|
+
}
|
|
2054
|
+
});
|
|
2055
|
+
this.history$ = this.fetchHistory.pipe(startWith(null), switchMap(() => this.dataService.order
|
|
2056
|
+
.getOrderHistory(this.id, {
|
|
2057
|
+
sort: {
|
|
2058
|
+
createdAt: SortOrder.DESC,
|
|
2059
|
+
},
|
|
2060
|
+
})
|
|
2061
|
+
.mapStream(data => data.order?.history.items)));
|
|
2062
|
+
this.nextStates$ = this.entity$.pipe(map(order => {
|
|
2063
|
+
const isInCustomState = !this.defaultStates.includes(order.state);
|
|
2064
|
+
return isInCustomState
|
|
2065
|
+
? order.nextStates
|
|
2066
|
+
: order.nextStates.filter(s => !this.defaultStates.includes(s));
|
|
2067
|
+
}));
|
|
2068
|
+
}
|
|
2069
|
+
ngOnDestroy() {
|
|
2070
|
+
this.destroy();
|
|
2071
|
+
}
|
|
2072
|
+
openStateDiagram() {
|
|
2073
|
+
this.entity$
|
|
2074
|
+
.pipe(take(1), switchMap(order => this.modalService.fromComponent(OrderProcessGraphDialogComponent, {
|
|
2075
|
+
closable: true,
|
|
2076
|
+
locals: {
|
|
2077
|
+
activeState: order.state,
|
|
2078
|
+
},
|
|
2079
|
+
})))
|
|
2080
|
+
.subscribe();
|
|
2081
|
+
}
|
|
2082
|
+
setOrderCustomer() {
|
|
2083
|
+
this.modalService
|
|
2084
|
+
.fromComponent(SelectCustomerDialogComponent, {
|
|
2085
|
+
locals: {
|
|
2086
|
+
canCreateNew: false,
|
|
2087
|
+
includeNoteInput: true,
|
|
2088
|
+
title: marker('order.assign-order-to-another-customer'),
|
|
2089
|
+
},
|
|
2090
|
+
})
|
|
2091
|
+
.pipe(switchMap(result => {
|
|
2092
|
+
function isExisting(input) {
|
|
2093
|
+
return typeof input === 'object' && !!input.id;
|
|
2094
|
+
}
|
|
2095
|
+
if (isExisting(result)) {
|
|
2096
|
+
return this.dataService.mutate(SetOrderCustomerDocument, {
|
|
2097
|
+
input: {
|
|
2098
|
+
customerId: result.id,
|
|
2099
|
+
orderId: this.id,
|
|
2100
|
+
note: result.note,
|
|
2101
|
+
},
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
else {
|
|
2105
|
+
return EMPTY;
|
|
2106
|
+
}
|
|
2107
|
+
}), switchMap(result => this.refetchOrder(result)))
|
|
2108
|
+
.subscribe(result => {
|
|
2109
|
+
if (result) {
|
|
2110
|
+
this.notificationService.success(marker('order.set-customer-success'));
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
transitionToState(state) {
|
|
2115
|
+
this.dataService.order.transitionToState(this.id, state).subscribe(({ transitionOrderToState }) => {
|
|
2116
|
+
switch (transitionOrderToState?.__typename) {
|
|
2117
|
+
case 'Order':
|
|
2118
|
+
this.notificationService.success(marker('order.transitioned-to-state-success'), { state });
|
|
2119
|
+
this.fetchHistory.next();
|
|
2120
|
+
break;
|
|
2121
|
+
case 'OrderStateTransitionError':
|
|
2122
|
+
this.notificationService.error(transitionOrderToState.transitionError);
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
manuallyTransitionToState(order) {
|
|
2127
|
+
this.orderTransitionService
|
|
2128
|
+
.manuallyTransitionToState({
|
|
2129
|
+
orderId: order.id,
|
|
2130
|
+
nextStates: order.nextStates,
|
|
2131
|
+
cancellable: true,
|
|
2132
|
+
message: marker('order.manually-transition-to-state-message'),
|
|
2133
|
+
retry: 0,
|
|
2134
|
+
})
|
|
2135
|
+
.subscribe();
|
|
2136
|
+
}
|
|
2137
|
+
transitionToModifying() {
|
|
2138
|
+
this.dataService.order
|
|
2139
|
+
.transitionToState(this.id, 'Modifying')
|
|
2140
|
+
.subscribe(({ transitionOrderToState }) => {
|
|
2141
|
+
switch (transitionOrderToState?.__typename) {
|
|
2142
|
+
case 'Order':
|
|
2143
|
+
this.router.navigate(['./modify'], { relativeTo: this.route });
|
|
2144
|
+
break;
|
|
2145
|
+
case 'OrderStateTransitionError':
|
|
2146
|
+
this.notificationService.error(transitionOrderToState.transitionError);
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
}
|
|
2150
|
+
updateCustomFields() {
|
|
2151
|
+
this.dataService.order
|
|
2152
|
+
.updateOrderCustomFields({
|
|
2153
|
+
id: this.id,
|
|
2154
|
+
customFields: this.detailForm.value.customFields,
|
|
2155
|
+
})
|
|
2156
|
+
.subscribe(() => {
|
|
2157
|
+
this.notificationService.success(marker('common.notify-update-success'), { entity: 'Order' });
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
getOrderAddressLines(orderAddress) {
|
|
2161
|
+
if (!orderAddress) {
|
|
2162
|
+
return [];
|
|
2163
|
+
}
|
|
2164
|
+
return Object.values(orderAddress)
|
|
2165
|
+
.filter(val => val !== 'OrderAddress')
|
|
2166
|
+
.filter(line => !!line);
|
|
2167
|
+
}
|
|
2168
|
+
settlePayment(payment) {
|
|
2169
|
+
this.dataService.order.settlePayment(payment.id).subscribe(({ settlePayment }) => {
|
|
2170
|
+
switch (settlePayment.__typename) {
|
|
2171
|
+
case 'Payment':
|
|
2172
|
+
if (settlePayment.state === 'Settled') {
|
|
2173
|
+
this.notificationService.success(marker('order.settle-payment-success'));
|
|
2174
|
+
}
|
|
2175
|
+
else {
|
|
2176
|
+
this.notificationService.error(marker('order.settle-payment-error'));
|
|
2177
|
+
}
|
|
2178
|
+
this.dataService.order.getOrder(this.id).single$.subscribe();
|
|
2179
|
+
this.fetchHistory.next();
|
|
2180
|
+
break;
|
|
2181
|
+
case 'OrderStateTransitionError':
|
|
2182
|
+
case 'PaymentStateTransitionError':
|
|
2183
|
+
case 'SettlePaymentError':
|
|
2184
|
+
this.notificationService.error(settlePayment.message);
|
|
2185
|
+
}
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
transitionPaymentState({ payment, state }) {
|
|
2189
|
+
if (state === 'Cancelled') {
|
|
2190
|
+
this.dataService.order.cancelPayment(payment.id).subscribe(({ cancelPayment }) => {
|
|
2191
|
+
switch (cancelPayment.__typename) {
|
|
2192
|
+
case 'Payment':
|
|
2193
|
+
this.notificationService.success(marker('order.transitioned-payment-to-state-success'), {
|
|
2194
|
+
state,
|
|
2195
|
+
});
|
|
2196
|
+
this.dataService.order.getOrder(this.id).single$.subscribe();
|
|
2197
|
+
this.fetchHistory.next();
|
|
2198
|
+
break;
|
|
2199
|
+
case 'PaymentStateTransitionError':
|
|
2200
|
+
this.notificationService.error(cancelPayment.transitionError);
|
|
2201
|
+
break;
|
|
2202
|
+
case 'CancelPaymentError':
|
|
2203
|
+
this.notificationService.error(cancelPayment.paymentErrorMessage);
|
|
2204
|
+
break;
|
|
2205
|
+
}
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
else {
|
|
2209
|
+
this.dataService.order
|
|
2210
|
+
.transitionPaymentToState(payment.id, state)
|
|
2211
|
+
.subscribe(({ transitionPaymentToState }) => {
|
|
2212
|
+
switch (transitionPaymentToState.__typename) {
|
|
2213
|
+
case 'Payment':
|
|
2214
|
+
this.notificationService.success(marker('order.transitioned-payment-to-state-success'), {
|
|
2215
|
+
state,
|
|
2216
|
+
});
|
|
2217
|
+
this.dataService.order.getOrder(this.id).single$.subscribe();
|
|
2218
|
+
this.fetchHistory.next();
|
|
2219
|
+
break;
|
|
2220
|
+
case 'PaymentStateTransitionError':
|
|
2221
|
+
this.notificationService.error(transitionPaymentToState.message);
|
|
2222
|
+
break;
|
|
2223
|
+
}
|
|
2224
|
+
});
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
canAddFulfillment(order) {
|
|
2228
|
+
const allFulfillmentLines = (order.fulfillments ?? [])
|
|
2229
|
+
.filter(fulfillment => fulfillment.state !== 'Cancelled')
|
|
2230
|
+
.reduce((all, fulfillment) => [...all, ...fulfillment.lines], []);
|
|
2231
|
+
let allItemsFulfilled = true;
|
|
2232
|
+
for (const line of order.lines) {
|
|
2233
|
+
const totalFulfilledCount = allFulfillmentLines
|
|
2234
|
+
.filter(row => row.orderLineId === line.id)
|
|
2235
|
+
.reduce((sum, row) => sum + row.quantity, 0);
|
|
2236
|
+
if (totalFulfilledCount < line.quantity) {
|
|
2237
|
+
allItemsFulfilled = false;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
return (!allItemsFulfilled &&
|
|
2241
|
+
!this.hasUnsettledModifications(order) &&
|
|
2242
|
+
this.outstandingPaymentAmount(order) === 0 &&
|
|
2243
|
+
(order.nextStates.includes('Shipped') ||
|
|
2244
|
+
order.nextStates.includes('PartiallyShipped') ||
|
|
2245
|
+
order.nextStates.includes('Delivered')));
|
|
2246
|
+
}
|
|
2247
|
+
hasUnsettledModifications(order) {
|
|
2248
|
+
return 0 < order.modifications.filter(m => !m.isSettled).length;
|
|
2249
|
+
}
|
|
2250
|
+
getOutstandingModificationAmount(order) {
|
|
2251
|
+
return summate(order.modifications.filter(m => !m.isSettled), 'priceChange');
|
|
2252
|
+
}
|
|
2253
|
+
outstandingPaymentAmount(order) {
|
|
2254
|
+
const paymentIsValid = (p) => p.state !== 'Cancelled' && p.state !== 'Declined' && p.state !== 'Error';
|
|
2255
|
+
let amountCovered = 0;
|
|
2256
|
+
for (const payment of order.payments?.filter(paymentIsValid) ?? []) {
|
|
2257
|
+
const refunds = payment.refunds.filter(r => r.state !== 'Failed') ?? [];
|
|
2258
|
+
const refundsTotal = summate(refunds, 'total');
|
|
2259
|
+
amountCovered += payment.amount - refundsTotal;
|
|
2260
|
+
}
|
|
2261
|
+
return order.totalWithTax - amountCovered;
|
|
2262
|
+
}
|
|
2263
|
+
addManualPayment(order) {
|
|
2264
|
+
const priorState = order.state;
|
|
2265
|
+
this.modalService
|
|
2266
|
+
.fromComponent(AddManualPaymentDialogComponent, {
|
|
2267
|
+
closable: true,
|
|
2268
|
+
locals: {
|
|
2269
|
+
outstandingAmount: this.outstandingPaymentAmount(order),
|
|
2270
|
+
currencyCode: order.currencyCode,
|
|
2271
|
+
},
|
|
2272
|
+
})
|
|
2273
|
+
.pipe(switchMap(result => {
|
|
2274
|
+
if (result) {
|
|
2275
|
+
return this.dataService.order.addManualPaymentToOrder({
|
|
2276
|
+
orderId: this.id,
|
|
2277
|
+
transactionId: result.transactionId,
|
|
2278
|
+
method: result.method,
|
|
2279
|
+
metadata: result.metadata || {},
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
else {
|
|
2283
|
+
return EMPTY;
|
|
2284
|
+
}
|
|
2285
|
+
}), switchMap(({ addManualPaymentToOrder }) => {
|
|
2286
|
+
switch (addManualPaymentToOrder.__typename) {
|
|
2287
|
+
case 'Order':
|
|
2288
|
+
this.notificationService.success(marker('order.add-payment-to-order-success'));
|
|
2289
|
+
if (priorState === 'ArrangingAdditionalPayment') {
|
|
2290
|
+
return this.orderTransitionService.transitionToPreModifyingState(order.id, order.nextStates);
|
|
2291
|
+
}
|
|
2292
|
+
else {
|
|
2293
|
+
return of('PaymentSettled');
|
|
2294
|
+
}
|
|
2295
|
+
case 'ManualPaymentStateError':
|
|
2296
|
+
this.notificationService.error(addManualPaymentToOrder.message);
|
|
2297
|
+
return EMPTY;
|
|
2298
|
+
default:
|
|
2299
|
+
return EMPTY;
|
|
2300
|
+
}
|
|
2301
|
+
}))
|
|
2302
|
+
.subscribe(result => {
|
|
2303
|
+
if (result) {
|
|
2304
|
+
this.refetchOrder({ result });
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
fulfillOrder() {
|
|
2309
|
+
this.entity$
|
|
2310
|
+
.pipe(take(1), switchMap(order => this.modalService.fromComponent(FulfillOrderDialogComponent, {
|
|
2311
|
+
size: 'xl',
|
|
2312
|
+
locals: {
|
|
2313
|
+
order,
|
|
2314
|
+
},
|
|
2315
|
+
})), switchMap(input => {
|
|
2316
|
+
if (input) {
|
|
2317
|
+
return this.dataService.order.createFulfillment(input);
|
|
2318
|
+
}
|
|
2319
|
+
else {
|
|
2320
|
+
return of(undefined);
|
|
2321
|
+
}
|
|
2322
|
+
}), switchMap(result => this.refetchOrder(result).pipe(mapTo(result))))
|
|
2323
|
+
.subscribe(result => {
|
|
2324
|
+
if (result) {
|
|
2325
|
+
const { addFulfillmentToOrder } = result;
|
|
2326
|
+
switch (addFulfillmentToOrder.__typename) {
|
|
2327
|
+
case 'Fulfillment':
|
|
2328
|
+
this.notificationService.success(marker('order.create-fulfillment-success'));
|
|
2329
|
+
break;
|
|
2330
|
+
case 'EmptyOrderLineSelectionError':
|
|
2331
|
+
case 'InsufficientStockOnHandError':
|
|
2332
|
+
case 'ItemsAlreadyFulfilledError':
|
|
2333
|
+
case 'InvalidFulfillmentHandlerError':
|
|
2334
|
+
this.notificationService.error(addFulfillmentToOrder.message);
|
|
2335
|
+
break;
|
|
2336
|
+
case 'FulfillmentStateTransitionError':
|
|
2337
|
+
this.notificationService.error(addFulfillmentToOrder.transitionError);
|
|
2338
|
+
break;
|
|
2339
|
+
case 'CreateFulfillmentError':
|
|
2340
|
+
this.notificationService.error(addFulfillmentToOrder.fulfillmentHandlerError);
|
|
2341
|
+
break;
|
|
2342
|
+
case undefined:
|
|
2343
|
+
this.notificationService.error(JSON.stringify(addFulfillmentToOrder));
|
|
2344
|
+
break;
|
|
2345
|
+
default:
|
|
2346
|
+
assertNever(addFulfillmentToOrder);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
transitionFulfillment(id, state) {
|
|
2352
|
+
this.dataService.order
|
|
2353
|
+
.transitionFulfillmentToState(id, state)
|
|
2354
|
+
.pipe(switchMap(result => this.refetchOrder(result)))
|
|
2355
|
+
.subscribe(() => {
|
|
2356
|
+
this.notificationService.success(marker('order.successfully-updated-fulfillment'));
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
cancelOrRefund(order) {
|
|
2360
|
+
const isRefundable = this.orderHasSettledPayments(order);
|
|
2361
|
+
if (order.state === 'PaymentAuthorized' || order.active === true || !isRefundable) {
|
|
2362
|
+
this.cancelOrder(order);
|
|
2363
|
+
}
|
|
2364
|
+
else {
|
|
2365
|
+
this.refundOrder(order);
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
settleRefund(refund) {
|
|
2369
|
+
this.modalService
|
|
2370
|
+
.fromComponent(SettleRefundDialogComponent, {
|
|
2371
|
+
size: 'md',
|
|
2372
|
+
locals: {
|
|
2373
|
+
refund,
|
|
2374
|
+
},
|
|
2375
|
+
})
|
|
2376
|
+
.pipe(switchMap(transactionId => {
|
|
2377
|
+
if (transactionId) {
|
|
2378
|
+
return this.dataService.order.settleRefund({
|
|
2379
|
+
transactionId,
|
|
2380
|
+
id: refund.id,
|
|
2381
|
+
}, this.id);
|
|
2382
|
+
}
|
|
2383
|
+
else {
|
|
2384
|
+
return of(undefined);
|
|
2385
|
+
}
|
|
2386
|
+
}))
|
|
2387
|
+
.subscribe(result => {
|
|
2388
|
+
if (result) {
|
|
2389
|
+
this.notificationService.success(marker('order.settle-refund-success'));
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
addNote(event) {
|
|
2394
|
+
const { note, isPublic } = event;
|
|
2395
|
+
this.dataService.order
|
|
2396
|
+
.addNoteToOrder({
|
|
2397
|
+
id: this.id,
|
|
2398
|
+
note,
|
|
2399
|
+
isPublic,
|
|
2400
|
+
})
|
|
2401
|
+
.pipe(switchMap(result => this.refetchOrder(result)))
|
|
2402
|
+
.subscribe(result => {
|
|
2403
|
+
this.notificationService.success(marker('common.notify-create-success'), {
|
|
2404
|
+
entity: 'Note',
|
|
2405
|
+
});
|
|
2406
|
+
});
|
|
2407
|
+
}
|
|
2408
|
+
updateNote(entry) {
|
|
2409
|
+
this.modalService
|
|
2410
|
+
.fromComponent(EditNoteDialogComponent, {
|
|
2411
|
+
closable: true,
|
|
2412
|
+
locals: {
|
|
2413
|
+
displayPrivacyControls: true,
|
|
2414
|
+
note: entry.data.note,
|
|
2415
|
+
noteIsPrivate: !entry.isPublic,
|
|
2416
|
+
},
|
|
2417
|
+
})
|
|
2418
|
+
.pipe(switchMap(result => {
|
|
2419
|
+
if (result) {
|
|
2420
|
+
return this.dataService.order.updateOrderNote({
|
|
2421
|
+
noteId: entry.id,
|
|
2422
|
+
isPublic: !result.isPrivate,
|
|
2423
|
+
note: result.note,
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
else {
|
|
2427
|
+
return EMPTY;
|
|
2428
|
+
}
|
|
2429
|
+
}))
|
|
2430
|
+
.subscribe(result => {
|
|
2431
|
+
this.fetchHistory.next();
|
|
2432
|
+
this.notificationService.success(marker('common.notify-update-success'), {
|
|
2433
|
+
entity: 'Note',
|
|
2434
|
+
});
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
deleteNote(entry) {
|
|
2438
|
+
return this.modalService
|
|
2439
|
+
.dialog({
|
|
2440
|
+
title: marker('common.confirm-delete-note'),
|
|
2441
|
+
body: entry.data.note,
|
|
2442
|
+
buttons: [
|
|
2443
|
+
{ type: 'secondary', label: marker('common.cancel') },
|
|
2444
|
+
{ type: 'danger', label: marker('common.delete'), returnValue: true },
|
|
2445
|
+
],
|
|
2446
|
+
})
|
|
2447
|
+
.pipe(switchMap(res => (res ? this.dataService.order.deleteOrderNote(entry.id) : EMPTY)))
|
|
2448
|
+
.subscribe(() => {
|
|
2449
|
+
this.fetchHistory.next();
|
|
2450
|
+
this.notificationService.success(marker('common.notify-delete-success'), {
|
|
2451
|
+
entity: 'Note',
|
|
2452
|
+
});
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
orderHasSettledPayments(order) {
|
|
2456
|
+
return !!order.payments?.find(p => p.state === 'Settled');
|
|
2457
|
+
}
|
|
2458
|
+
cancelOrder(order) {
|
|
2459
|
+
this.modalService
|
|
2460
|
+
.fromComponent(CancelOrderDialogComponent, {
|
|
2461
|
+
size: 'xl',
|
|
2462
|
+
locals: {
|
|
2463
|
+
order,
|
|
2464
|
+
},
|
|
2465
|
+
})
|
|
2466
|
+
.pipe(switchMap(input => {
|
|
2467
|
+
if (input) {
|
|
2468
|
+
return this.dataService.order.cancelOrder(input);
|
|
2469
|
+
}
|
|
2470
|
+
else {
|
|
2471
|
+
return of(undefined);
|
|
2472
|
+
}
|
|
2473
|
+
}), switchMap(result => this.refetchOrder(result)))
|
|
2474
|
+
.subscribe(result => {
|
|
2475
|
+
if (result) {
|
|
2476
|
+
this.notificationService.success(marker('order.cancelled-order-success'));
|
|
2477
|
+
}
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
refundOrder(order) {
|
|
2481
|
+
this.modalService
|
|
2482
|
+
.fromComponent(RefundOrderDialogComponent, {
|
|
2483
|
+
size: 'xl',
|
|
2484
|
+
locals: {
|
|
2485
|
+
order,
|
|
2486
|
+
},
|
|
2487
|
+
})
|
|
2488
|
+
.pipe(switchMap(input => {
|
|
2489
|
+
if (!input) {
|
|
2490
|
+
return of(undefined);
|
|
2491
|
+
}
|
|
2492
|
+
if (input.cancel.lines?.length) {
|
|
2493
|
+
return this.dataService.order.cancelOrder(input.cancel).pipe(map(res => {
|
|
2494
|
+
const result = res.cancelOrder;
|
|
2495
|
+
switch (result.__typename) {
|
|
2496
|
+
case 'Order':
|
|
2497
|
+
this.refetchOrder(result).subscribe();
|
|
2498
|
+
this.notificationService.success(marker('order.cancelled-order-items-success'), {
|
|
2499
|
+
count: summate(input.cancel.lines, 'quantity'),
|
|
2500
|
+
});
|
|
2501
|
+
return input;
|
|
2502
|
+
case 'CancelActiveOrderError':
|
|
2503
|
+
case 'QuantityTooGreatError':
|
|
2504
|
+
case 'MultipleOrderError':
|
|
2505
|
+
case 'OrderStateTransitionError':
|
|
2506
|
+
case 'EmptyOrderLineSelectionError':
|
|
2507
|
+
this.notificationService.error(result.message);
|
|
2508
|
+
return undefined;
|
|
2509
|
+
}
|
|
2510
|
+
}));
|
|
2511
|
+
}
|
|
2512
|
+
else {
|
|
2513
|
+
return [input];
|
|
2514
|
+
}
|
|
2515
|
+
}), switchMap(input => {
|
|
2516
|
+
if (!input) {
|
|
2517
|
+
return of(undefined);
|
|
2518
|
+
}
|
|
2519
|
+
if (input.refunds.length) {
|
|
2520
|
+
return forkJoin(input.refunds.map(refund => this.dataService.order.refundOrder(refund).pipe(map(res => res.refundOrder))));
|
|
2521
|
+
}
|
|
2522
|
+
else {
|
|
2523
|
+
return [undefined];
|
|
2524
|
+
}
|
|
2525
|
+
}))
|
|
2526
|
+
.subscribe(results => {
|
|
2527
|
+
for (const result of results ?? []) {
|
|
2528
|
+
if (result) {
|
|
2529
|
+
switch (result.__typename) {
|
|
2530
|
+
case 'Refund':
|
|
2531
|
+
if (result.state === 'Failed') {
|
|
2532
|
+
this.notificationService.error(marker('order.refund-order-failed'));
|
|
2533
|
+
}
|
|
2534
|
+
else {
|
|
2535
|
+
this.notificationService.success(marker('order.refund-order-success'));
|
|
2536
|
+
}
|
|
2537
|
+
break;
|
|
2538
|
+
case 'AlreadyRefundedError':
|
|
2539
|
+
case 'NothingToRefundError':
|
|
2540
|
+
case 'PaymentOrderMismatchError':
|
|
2541
|
+
case 'RefundOrderStateError':
|
|
2542
|
+
case 'RefundStateTransitionError':
|
|
2543
|
+
this.notificationService.error(result.message);
|
|
2544
|
+
break;
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
this.refetchOrder(results?.[0]).subscribe();
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
refetchOrder(result) {
|
|
2552
|
+
this.fetchHistory.next();
|
|
2553
|
+
if (result) {
|
|
2554
|
+
return this.dataService.order.getOrder(this.id).single$;
|
|
2555
|
+
}
|
|
2556
|
+
else {
|
|
2557
|
+
return of(undefined);
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
setFormValues(entity) {
|
|
2561
|
+
if (this.customFields.length) {
|
|
2562
|
+
this.setCustomFieldFormValues(this.customFields, this.detailForm.get(['customFields']), entity);
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderDetailComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.DataService }, { token: i1.NotificationService }, { token: i1.ModalService }, { token: OrderTransitionService }, { token: i2.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2566
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderDetailComponent, selector: "vdr-order-detail", usesInheritance: true, ngImport: i0, template: "<vdr-page-block>\n <vdr-action-bar *ngIf=\"entity$ | async as order\">\n <vdr-ab-left> </vdr-ab-left>\n\n <vdr-ab-right>\n <vdr-action-bar-items locationId=\"order-detail\"></vdr-action-bar-items>\n <button\n class=\"button primary mr-1\"\n *ngIf=\"\n order.type !== 'Aggregate' &&\n (order.state === 'ArrangingPayment' ||\n order.state === 'ArrangingAdditionalPayment') &&\n (hasUnsettledModifications(order) ||\n 0 < outstandingPaymentAmount(order))\n \"\n (click)=\"addManualPayment(order)\"\n >\n {{ \"order.add-payment-to-order\" | translate }}\n ({{\n outstandingPaymentAmount(order) | localeCurrency : order.currencyCode\n }})\n </button>\n <button\n class=\"button primary mr-1\"\n *ngIf=\"\n order.type !== 'Aggregate' &&\n order.active === false &&\n order.state !== 'ArrangingAdditionalPayment' &&\n order.state !== 'ArrangingPayment' &&\n 0 < outstandingPaymentAmount(order)\n \"\n (click)=\"transitionToState('ArrangingAdditionalPayment')\"\n >\n {{ \"order.arrange-additional-payment\" | translate }}\n </button>\n <button\n *ngIf=\"order.type !== 'Aggregate'\"\n class=\"button primary mr-1\"\n (click)=\"fulfillOrder()\"\n [disabled]=\"!canAddFulfillment(order)\"\n >\n {{ \"order.fulfill-order\" | translate }}\n </button>\n <vdr-action-bar-dropdown-menu\n [alwaysShow]=\"true\"\n locationId=\"order-detail\"\n >\n <ng-container\n *ngIf=\"\n order.type !== 'Aggregate' && order.nextStates.includes('Modifying')\n \"\n >\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionToModifying()\"\n >\n <clr-icon shape=\"pencil\"></clr-icon>\n {{ \"order.modify-order\" | translate }}\n </button>\n <div class=\"dropdown-divider\"></div>\n </ng-container>\n <button\n type=\"button\"\n vdrDropdownItem\n *ngIf=\"\n order.type !== 'Aggregate' && order.nextStates.includes('Cancelled')\n \"\n (click)=\"cancelOrRefund(order)\"\n >\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\n <ng-container *ngIf=\"orderHasSettledPayments(order); else cancelOnly\">\n {{ \"order.refund-and-cancel-order\" | translate }}\n </ng-container>\n <ng-template #cancelOnly>\n {{ \"order.cancel-order\" | translate }}\n </ng-template>\n </button>\n\n <ng-container *ngIf=\"(nextStates$ | async)?.length\">\n <div class=\"dropdown-divider\"></div>\n <button\n *ngFor=\"let nextState of nextStates$ | async\"\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionToState(nextState)\"\n >\n <clr-icon shape=\"step-forward-2\"></clr-icon>\n {{\n \"order.transition-to-state\"\n | translate\n : { state: (nextState | stateI18nToken | translate) }\n }}\n </button>\n </ng-container>\n <div class=\"dropdown-divider\"></div>\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"manuallyTransitionToState(order)\"\n >\n <clr-icon shape=\"step-forward-2\" class=\"is-warning\"></clr-icon>\n {{ \"order.manually-transition-to-state\" | translate }}\n </button>\n </vdr-action-bar-dropdown-menu>\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n\n<vdr-page-detail-layout *ngIf=\"entity$ | async as order\">\n <vdr-page-detail-sidebar>\n <vdr-card [title]=\"'order.state' | translate\">\n <ng-template vdrCardControls>\n <button\n class=\"button-small\"\n (click)=\"openStateDiagram()\"\n [title]=\"'order.order-state-diagram' | translate\"\n >\n <clr-icon shape=\"list\"></clr-icon>\n </button>\n </ng-template>\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </vdr-card>\n <vdr-card [title]=\"'order.customer' | translate\">\n <ng-template vdrCardControls>\n <button\n *vdrIfPermissions=\"['UpdateOrder', 'ReadCustomer']\"\n class=\"button-small\"\n (click)=\"setOrderCustomer()\"\n [title]=\"'order.assign-order-to-another-customer' | translate\"\n >\n <clr-icon shape=\"switch\"></clr-icon>\n </button>\n </ng-template>\n <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\n <vdr-labeled-data\n class=\"mt-2\"\n [label]=\"'order.shipping-address' | translate\"\n *ngIf=\"getOrderAddressLines(order.shippingAddress).length\"\n >\n <vdr-formatted-address\n [address]=\"order.shippingAddress\"\n class=\"mt-1\"\n ></vdr-formatted-address>\n </vdr-labeled-data>\n <vdr-labeled-data\n [label]=\"'order.billing-address' | translate\"\n *ngIf=\"getOrderAddressLines(order.billingAddress).length\"\n >\n <vdr-formatted-address\n [address]=\"order.billingAddress\"\n class=\"mt-1\"\n ></vdr-formatted-address>\n </vdr-labeled-data>\n </vdr-card>\n <vdr-card\n [title]=\"'order.payments' | translate\"\n *ngIf=\"order.payments?.length\"\n >\n <vdr-order-payment-card\n *ngFor=\"let payment of order.payments\"\n [currencyCode]=\"order.currencyCode\"\n [payment]=\"payment\"\n (settlePayment)=\"settlePayment($event)\"\n (transitionPaymentState)=\"transitionPaymentState($event)\"\n (settleRefund)=\"settleRefund($event)\"\n ></vdr-order-payment-card>\n </vdr-card>\n <vdr-card *ngIf=\"order.fulfillments?.length\">\n <vdr-fulfillment-card\n *ngFor=\"let fulfillment of order.fulfillments\"\n [fulfillment]=\"fulfillment\"\n [order]=\"order\"\n (transitionState)=\"transitionFulfillment(fulfillment.id, $event)\"\n ></vdr-fulfillment-card>\n </vdr-card>\n <vdr-card>\n <vdr-page-entity-info\n *ngIf=\"entity$ | async as entity\"\n [entity]=\"entity\"\n />\n </vdr-card>\n </vdr-page-detail-sidebar>\n\n <vdr-page-block>\n <vdr-seller-orders-card\n class=\"mb-2\"\n *ngIf=\"order.sellerOrders.length\"\n [orderId]=\"order.id\"\n ></vdr-seller-orders-card>\n <vdr-card [paddingX]=\"false\">\n <vdr-order-table\n [order]=\"order\"\n [orderLineCustomFields]=\"orderLineCustomFields\"\n ></vdr-order-table>\n </vdr-card>\n <vdr-card [title]=\"'order.tax-summary' | translate\" [paddingX]=\"false\">\n <table class=\"table\">\n <thead>\n <tr>\n <th>{{ \"common.description\" | translate }}</th>\n <th>{{ \"order.tax-rate\" | translate }}</th>\n <th>{{ \"order.tax-base\" | translate }}</th>\n <th>{{ \"order.tax-total\" | translate }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of order.taxSummary\">\n <td>{{ row.description }}</td>\n <td>{{ row.taxRate / 100 | percent : \"0.0-2\" }}</td>\n <td>{{ row.taxBase | localeCurrency : order.currencyCode }}</td>\n <td>{{ row.taxTotal | localeCurrency : order.currencyCode }}</td>\n </tr>\n </tbody>\n </table>\n </vdr-card>\n <vdr-card\n [title]=\"'common.custom-fields' | translate\"\n *ngIf=\"customFields.length\"\n >\n <vdr-tabbed-custom-fields\n entityName=\"Order\"\n [customFields]=\"customFields\"\n [customFieldsFormGroup]=\"detailForm.get('customFields')\"\n [readonly]=\"!('UpdateOrder' | hasPermission)\"\n />\n <button\n style=\"margin-top: 1rem\"\n class=\"button primary\"\n (click)=\"updateCustomFields()\"\n [disabled]=\"\n detailForm.get('customFields')?.pristine ||\n detailForm.get('customFields')?.invalid\n \"\n >\n {{ \"common.update\" | translate }}\n </button>\n </vdr-card>\n <vdr-custom-detail-component-host\n locationId=\"order-detail\"\n [entity$]=\"entity$\"\n [detailForm]=\"detailForm\"\n ></vdr-custom-detail-component-host>\n\n <vdr-card [title]=\"'order.order-history' | translate\">\n <vdr-order-history\n [order]=\"order\"\n [history]=\"history$ | async\"\n (addNote)=\"addNote($event)\"\n (updateNote)=\"updateNote($event)\"\n (deleteNote)=\"deleteNote($event)\"\n ></vdr-order-history>\n </vdr-card>\n </vdr-page-block>\n</vdr-page-detail-layout>\n", styles: [".shipping-address{list-style-type:none;line-height:1.3em}.order-cards h6{margin-top:6px;color:var(--color-text-200)}vdr-order-payment-card+vdr-order-payment-card{margin-top:calc(var(--space-unit) * 2)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ActionBarComponent, selector: "vdr-action-bar" }, { kind: "component", type: i1.ActionBarLeftComponent, selector: "vdr-ab-left", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarRightComponent, selector: "vdr-ab-right", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarDropdownMenuComponent, selector: "vdr-action-bar-dropdown-menu", inputs: ["alwaysShow"] }, { kind: "component", type: i1.CustomerLabelComponent, selector: "vdr-customer-label", inputs: ["customer"] }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "component", type: i1.OrderStateLabelComponent, selector: "vdr-order-state-label", inputs: ["state"] }, { kind: "component", type: i1.FormattedAddressComponent, selector: "vdr-formatted-address", inputs: ["address"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "directive", type: i1.IfPermissionsDirective, selector: "[vdrIfPermissions]", inputs: ["vdrIfPermissions", "vdrIfPermissionsElse"] }, { kind: "component", type: i1.ActionBarItemsComponent, selector: "vdr-action-bar-items" }, { kind: "component", type: i1.TabbedCustomFieldsComponent, selector: "vdr-tabbed-custom-fields", inputs: ["entityName", "customFields", "customFieldsFormGroup", "readonly", "compact", "showLabel"] }, { kind: "component", type: i1.CustomDetailComponentHostComponent, selector: "vdr-custom-detail-component-host", inputs: ["locationId", "entity$", "detailForm"] }, { kind: "component", type: i1.PageBlockComponent, selector: "vdr-page-block" }, { kind: "component", type: i1.PageEntityInfoComponent, selector: "vdr-page-entity-info", inputs: ["entity"] }, { kind: "component", type: i1.PageDetailLayoutComponent, selector: "vdr-page-detail-layout" }, { kind: "component", type: i1.PageDetailSidebarComponent, selector: "vdr-page-detail-sidebar" }, { kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "directive", type: i1.CardControlsDirective, selector: "[vdrCardControls]" }, { kind: "component", type: OrderPaymentCardComponent, selector: "vdr-order-payment-card", inputs: ["payment", "currencyCode"], outputs: ["settlePayment", "transitionPaymentState", "settleRefund"] }, { kind: "component", type: OrderHistoryComponent, selector: "vdr-order-history", inputs: ["order", "history"], outputs: ["addNote", "updateNote", "deleteNote"] }, { kind: "component", type: FulfillmentCardComponent, selector: "vdr-fulfillment-card", inputs: ["fulfillment", "order"], outputs: ["transitionState"] }, { kind: "component", type: OrderTableComponent, selector: "vdr-order-table", inputs: ["order", "orderLineCustomFields", "isDraft"], outputs: ["adjust", "remove"] }, { kind: "component", type: SellerOrdersCardComponent, selector: "vdr-seller-orders-card", inputs: ["orderId"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.PercentPipe, name: "percent" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.HasPermissionPipe, name: "hasPermission" }, { kind: "pipe", type: i1.StateI18nTokenPipe, name: "stateI18nToken" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2567
|
+
}
|
|
2568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderDetailComponent, decorators: [{
|
|
2569
|
+
type: Component,
|
|
2570
|
+
args: [{ selector: 'vdr-order-detail', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-page-block>\n <vdr-action-bar *ngIf=\"entity$ | async as order\">\n <vdr-ab-left> </vdr-ab-left>\n\n <vdr-ab-right>\n <vdr-action-bar-items locationId=\"order-detail\"></vdr-action-bar-items>\n <button\n class=\"button primary mr-1\"\n *ngIf=\"\n order.type !== 'Aggregate' &&\n (order.state === 'ArrangingPayment' ||\n order.state === 'ArrangingAdditionalPayment') &&\n (hasUnsettledModifications(order) ||\n 0 < outstandingPaymentAmount(order))\n \"\n (click)=\"addManualPayment(order)\"\n >\n {{ \"order.add-payment-to-order\" | translate }}\n ({{\n outstandingPaymentAmount(order) | localeCurrency : order.currencyCode\n }})\n </button>\n <button\n class=\"button primary mr-1\"\n *ngIf=\"\n order.type !== 'Aggregate' &&\n order.active === false &&\n order.state !== 'ArrangingAdditionalPayment' &&\n order.state !== 'ArrangingPayment' &&\n 0 < outstandingPaymentAmount(order)\n \"\n (click)=\"transitionToState('ArrangingAdditionalPayment')\"\n >\n {{ \"order.arrange-additional-payment\" | translate }}\n </button>\n <button\n *ngIf=\"order.type !== 'Aggregate'\"\n class=\"button primary mr-1\"\n (click)=\"fulfillOrder()\"\n [disabled]=\"!canAddFulfillment(order)\"\n >\n {{ \"order.fulfill-order\" | translate }}\n </button>\n <vdr-action-bar-dropdown-menu\n [alwaysShow]=\"true\"\n locationId=\"order-detail\"\n >\n <ng-container\n *ngIf=\"\n order.type !== 'Aggregate' && order.nextStates.includes('Modifying')\n \"\n >\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionToModifying()\"\n >\n <clr-icon shape=\"pencil\"></clr-icon>\n {{ \"order.modify-order\" | translate }}\n </button>\n <div class=\"dropdown-divider\"></div>\n </ng-container>\n <button\n type=\"button\"\n vdrDropdownItem\n *ngIf=\"\n order.type !== 'Aggregate' && order.nextStates.includes('Cancelled')\n \"\n (click)=\"cancelOrRefund(order)\"\n >\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\n <ng-container *ngIf=\"orderHasSettledPayments(order); else cancelOnly\">\n {{ \"order.refund-and-cancel-order\" | translate }}\n </ng-container>\n <ng-template #cancelOnly>\n {{ \"order.cancel-order\" | translate }}\n </ng-template>\n </button>\n\n <ng-container *ngIf=\"(nextStates$ | async)?.length\">\n <div class=\"dropdown-divider\"></div>\n <button\n *ngFor=\"let nextState of nextStates$ | async\"\n type=\"button\"\n vdrDropdownItem\n (click)=\"transitionToState(nextState)\"\n >\n <clr-icon shape=\"step-forward-2\"></clr-icon>\n {{\n \"order.transition-to-state\"\n | translate\n : { state: (nextState | stateI18nToken | translate) }\n }}\n </button>\n </ng-container>\n <div class=\"dropdown-divider\"></div>\n <button\n type=\"button\"\n vdrDropdownItem\n (click)=\"manuallyTransitionToState(order)\"\n >\n <clr-icon shape=\"step-forward-2\" class=\"is-warning\"></clr-icon>\n {{ \"order.manually-transition-to-state\" | translate }}\n </button>\n </vdr-action-bar-dropdown-menu>\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n\n<vdr-page-detail-layout *ngIf=\"entity$ | async as order\">\n <vdr-page-detail-sidebar>\n <vdr-card [title]=\"'order.state' | translate\">\n <ng-template vdrCardControls>\n <button\n class=\"button-small\"\n (click)=\"openStateDiagram()\"\n [title]=\"'order.order-state-diagram' | translate\"\n >\n <clr-icon shape=\"list\"></clr-icon>\n </button>\n </ng-template>\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </vdr-card>\n <vdr-card [title]=\"'order.customer' | translate\">\n <ng-template vdrCardControls>\n <button\n *vdrIfPermissions=\"['UpdateOrder', 'ReadCustomer']\"\n class=\"button-small\"\n (click)=\"setOrderCustomer()\"\n [title]=\"'order.assign-order-to-another-customer' | translate\"\n >\n <clr-icon shape=\"switch\"></clr-icon>\n </button>\n </ng-template>\n <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\n <vdr-labeled-data\n class=\"mt-2\"\n [label]=\"'order.shipping-address' | translate\"\n *ngIf=\"getOrderAddressLines(order.shippingAddress).length\"\n >\n <vdr-formatted-address\n [address]=\"order.shippingAddress\"\n class=\"mt-1\"\n ></vdr-formatted-address>\n </vdr-labeled-data>\n <vdr-labeled-data\n [label]=\"'order.billing-address' | translate\"\n *ngIf=\"getOrderAddressLines(order.billingAddress).length\"\n >\n <vdr-formatted-address\n [address]=\"order.billingAddress\"\n class=\"mt-1\"\n ></vdr-formatted-address>\n </vdr-labeled-data>\n </vdr-card>\n <vdr-card\n [title]=\"'order.payments' | translate\"\n *ngIf=\"order.payments?.length\"\n >\n <vdr-order-payment-card\n *ngFor=\"let payment of order.payments\"\n [currencyCode]=\"order.currencyCode\"\n [payment]=\"payment\"\n (settlePayment)=\"settlePayment($event)\"\n (transitionPaymentState)=\"transitionPaymentState($event)\"\n (settleRefund)=\"settleRefund($event)\"\n ></vdr-order-payment-card>\n </vdr-card>\n <vdr-card *ngIf=\"order.fulfillments?.length\">\n <vdr-fulfillment-card\n *ngFor=\"let fulfillment of order.fulfillments\"\n [fulfillment]=\"fulfillment\"\n [order]=\"order\"\n (transitionState)=\"transitionFulfillment(fulfillment.id, $event)\"\n ></vdr-fulfillment-card>\n </vdr-card>\n <vdr-card>\n <vdr-page-entity-info\n *ngIf=\"entity$ | async as entity\"\n [entity]=\"entity\"\n />\n </vdr-card>\n </vdr-page-detail-sidebar>\n\n <vdr-page-block>\n <vdr-seller-orders-card\n class=\"mb-2\"\n *ngIf=\"order.sellerOrders.length\"\n [orderId]=\"order.id\"\n ></vdr-seller-orders-card>\n <vdr-card [paddingX]=\"false\">\n <vdr-order-table\n [order]=\"order\"\n [orderLineCustomFields]=\"orderLineCustomFields\"\n ></vdr-order-table>\n </vdr-card>\n <vdr-card [title]=\"'order.tax-summary' | translate\" [paddingX]=\"false\">\n <table class=\"table\">\n <thead>\n <tr>\n <th>{{ \"common.description\" | translate }}</th>\n <th>{{ \"order.tax-rate\" | translate }}</th>\n <th>{{ \"order.tax-base\" | translate }}</th>\n <th>{{ \"order.tax-total\" | translate }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of order.taxSummary\">\n <td>{{ row.description }}</td>\n <td>{{ row.taxRate / 100 | percent : \"0.0-2\" }}</td>\n <td>{{ row.taxBase | localeCurrency : order.currencyCode }}</td>\n <td>{{ row.taxTotal | localeCurrency : order.currencyCode }}</td>\n </tr>\n </tbody>\n </table>\n </vdr-card>\n <vdr-card\n [title]=\"'common.custom-fields' | translate\"\n *ngIf=\"customFields.length\"\n >\n <vdr-tabbed-custom-fields\n entityName=\"Order\"\n [customFields]=\"customFields\"\n [customFieldsFormGroup]=\"detailForm.get('customFields')\"\n [readonly]=\"!('UpdateOrder' | hasPermission)\"\n />\n <button\n style=\"margin-top: 1rem\"\n class=\"button primary\"\n (click)=\"updateCustomFields()\"\n [disabled]=\"\n detailForm.get('customFields')?.pristine ||\n detailForm.get('customFields')?.invalid\n \"\n >\n {{ \"common.update\" | translate }}\n </button>\n </vdr-card>\n <vdr-custom-detail-component-host\n locationId=\"order-detail\"\n [entity$]=\"entity$\"\n [detailForm]=\"detailForm\"\n ></vdr-custom-detail-component-host>\n\n <vdr-card [title]=\"'order.order-history' | translate\">\n <vdr-order-history\n [order]=\"order\"\n [history]=\"history$ | async\"\n (addNote)=\"addNote($event)\"\n (updateNote)=\"updateNote($event)\"\n (deleteNote)=\"deleteNote($event)\"\n ></vdr-order-history>\n </vdr-card>\n </vdr-page-block>\n</vdr-page-detail-layout>\n", styles: [".shipping-address{list-style-type:none;line-height:1.3em}.order-cards h6{margin-top:6px;color:var(--color-text-200)}vdr-order-payment-card+vdr-order-payment-card{margin-top:calc(var(--space-unit) * 2)}\n"] }]
|
|
2571
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.DataService }, { type: i1.NotificationService }, { type: i1.ModalService }, { type: OrderTransitionService }, { type: i2.FormBuilder }] });
|
|
2572
|
+
|
|
2573
|
+
class OrderModificationSummaryComponent {
|
|
2574
|
+
get adjustedLines() {
|
|
2575
|
+
return (this.modifyOrderInput.adjustOrderLines || [])
|
|
2576
|
+
.map(l => {
|
|
2577
|
+
const line = this.orderSnapshot.lines.find(line => line.id === l.orderLineId);
|
|
2578
|
+
if (line) {
|
|
2579
|
+
const delta = l.quantity - line.quantity;
|
|
2580
|
+
const sign = delta === 0 ? '' : delta > 0 ? '+' : '-';
|
|
2581
|
+
return delta
|
|
2582
|
+
? `${sign}${Math.abs(delta)} ${line.productVariant.name}`
|
|
2583
|
+
: line.productVariant.name;
|
|
2584
|
+
}
|
|
2585
|
+
})
|
|
2586
|
+
.filter(notNullOrUndefined);
|
|
2587
|
+
}
|
|
2588
|
+
getModifiedFields(formGroup) {
|
|
2589
|
+
if (!formGroup.dirty) {
|
|
2590
|
+
return '';
|
|
2591
|
+
}
|
|
2592
|
+
return Object.entries(formGroup.controls)
|
|
2593
|
+
.map(([key, control]) => {
|
|
2594
|
+
if (control.dirty) {
|
|
2595
|
+
return key;
|
|
2596
|
+
}
|
|
2597
|
+
})
|
|
2598
|
+
.filter(notNullOrUndefined)
|
|
2599
|
+
.join(', ');
|
|
2600
|
+
}
|
|
2601
|
+
getUpdatedShippingMethodLines() {
|
|
2602
|
+
return Object.entries(this.updatedShippingMethods || {})
|
|
2603
|
+
.map(([lineId, shippingMethod]) => {
|
|
2604
|
+
const previousMethod = this.orderSnapshot.shippingLines.find(l => l.id === lineId);
|
|
2605
|
+
if (!previousMethod) {
|
|
2606
|
+
return;
|
|
2607
|
+
}
|
|
2608
|
+
const previousName = previousMethod.shippingMethod.name || previousMethod.shippingMethod.code;
|
|
2609
|
+
const newName = shippingMethod.name || shippingMethod.code;
|
|
2610
|
+
return `${previousName} -> ${newName}`;
|
|
2611
|
+
})
|
|
2612
|
+
.filter(notNullOrUndefined);
|
|
2613
|
+
}
|
|
2614
|
+
get couponCodeChanges() {
|
|
2615
|
+
const originalCodes = this.orderSnapshot.couponCodes || [];
|
|
2616
|
+
const newCodes = this.couponCodesControl.value || [];
|
|
2617
|
+
const addedCodes = newCodes.filter(c => !originalCodes.includes(c)).map(c => `+ ${c}`);
|
|
2618
|
+
const removedCodes = originalCodes.filter(c => !newCodes.includes(c)).map(c => `- ${c}`);
|
|
2619
|
+
return [...addedCodes, ...removedCodes];
|
|
2620
|
+
}
|
|
2621
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderModificationSummaryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2622
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderModificationSummaryComponent, selector: "vdr-order-modification-summary", inputs: { orderSnapshot: "orderSnapshot", modifyOrderInput: "modifyOrderInput", addedLines: "addedLines", shippingAddressForm: "shippingAddressForm", billingAddressForm: "billingAddressForm", updatedShippingMethods: "updatedShippingMethods", couponCodesControl: "couponCodesControl" }, ngImport: i0, template: "<vdr-labeled-data\n *ngIf=\"modifyOrderInput.adjustOrderLines?.length\"\n [label]=\"\n 'order.modification-adjusting-lines'\n | translate : { count: modifyOrderInput.adjustOrderLines?.length }\n \"\n>\n <div *ngFor=\"let line of adjustedLines\" class=\"mb-1\">\n {{ line }}\n </div>\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"modifyOrderInput.addItems?.length\"\n [label]=\"\n 'order.modification-adding-items'\n | translate : { count: modifyOrderInput.addItems?.length }\n \"\n>\n <div *ngFor=\"let item of addedLines\">\n {{ item.productVariant.name }} x {{ item.quantity }}\n </div>\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"modifyOrderInput.surcharges?.length\"\n [label]=\"\n 'order.modification-adding-surcharges'\n | translate : { count: modifyOrderInput.surcharges?.length }\n \"\n>\n <div *ngFor=\"let surcharge of modifyOrderInput.surcharges\" class=\"mb-1\">\n {{ surcharge.description }}: {{ surcharge.price | localeCurrency : orderSnapshot.currencyCode }}\n </div>\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"getModifiedFields(shippingAddressForm) as updatedShippingFields\"\n [label]=\"'order.modification-updating-shipping-address' | translate\"\n>\n {{ updatedShippingFields }}\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"getModifiedFields(billingAddressForm) as updatedBillingFields\"\n [label]=\"'order.modification-updating-billing-address' | translate\"\n>\n {{ updatedBillingFields }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"couponCodeChanges.length\" [label]=\"'order.set-coupon-codes' | translate\">\n <div *ngFor=\"let change of couponCodeChanges\" class=\"mb-1\">{{ change }}</div>\n</vdr-labeled-data>\n<ng-container *ngIf=\"getUpdatedShippingMethodLines() as updatedShippingMethods\">\n <vdr-labeled-data *ngIf=\"updatedShippingMethods.length\" [label]=\"'order.shipping-method' | translate\">\n <div *ngFor=\"let change of updatedShippingMethods\" class=\"mb-1\">{{ change }}</div>\n </vdr-labeled-data>\n</ng-container>", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2623
|
+
}
|
|
2624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderModificationSummaryComponent, decorators: [{
|
|
2625
|
+
type: Component,
|
|
2626
|
+
args: [{ selector: 'vdr-order-modification-summary', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-labeled-data\n *ngIf=\"modifyOrderInput.adjustOrderLines?.length\"\n [label]=\"\n 'order.modification-adjusting-lines'\n | translate : { count: modifyOrderInput.adjustOrderLines?.length }\n \"\n>\n <div *ngFor=\"let line of adjustedLines\" class=\"mb-1\">\n {{ line }}\n </div>\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"modifyOrderInput.addItems?.length\"\n [label]=\"\n 'order.modification-adding-items'\n | translate : { count: modifyOrderInput.addItems?.length }\n \"\n>\n <div *ngFor=\"let item of addedLines\">\n {{ item.productVariant.name }} x {{ item.quantity }}\n </div>\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"modifyOrderInput.surcharges?.length\"\n [label]=\"\n 'order.modification-adding-surcharges'\n | translate : { count: modifyOrderInput.surcharges?.length }\n \"\n>\n <div *ngFor=\"let surcharge of modifyOrderInput.surcharges\" class=\"mb-1\">\n {{ surcharge.description }}: {{ surcharge.price | localeCurrency : orderSnapshot.currencyCode }}\n </div>\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"getModifiedFields(shippingAddressForm) as updatedShippingFields\"\n [label]=\"'order.modification-updating-shipping-address' | translate\"\n>\n {{ updatedShippingFields }}\n</vdr-labeled-data>\n<vdr-labeled-data\n *ngIf=\"getModifiedFields(billingAddressForm) as updatedBillingFields\"\n [label]=\"'order.modification-updating-billing-address' | translate\"\n>\n {{ updatedBillingFields }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"couponCodeChanges.length\" [label]=\"'order.set-coupon-codes' | translate\">\n <div *ngFor=\"let change of couponCodeChanges\" class=\"mb-1\">{{ change }}</div>\n</vdr-labeled-data>\n<ng-container *ngIf=\"getUpdatedShippingMethodLines() as updatedShippingMethods\">\n <vdr-labeled-data *ngIf=\"updatedShippingMethods.length\" [label]=\"'order.shipping-method' | translate\">\n <div *ngFor=\"let change of updatedShippingMethods\" class=\"mb-1\">{{ change }}</div>\n </vdr-labeled-data>\n</ng-container>" }]
|
|
2627
|
+
}], propDecorators: { orderSnapshot: [{
|
|
2628
|
+
type: Input
|
|
2629
|
+
}], modifyOrderInput: [{
|
|
2630
|
+
type: Input
|
|
2631
|
+
}], addedLines: [{
|
|
2632
|
+
type: Input
|
|
2633
|
+
}], shippingAddressForm: [{
|
|
2634
|
+
type: Input
|
|
2635
|
+
}], billingAddressForm: [{
|
|
2636
|
+
type: Input
|
|
2637
|
+
}], updatedShippingMethods: [{
|
|
2638
|
+
type: Input
|
|
2639
|
+
}], couponCodesControl: [{
|
|
2640
|
+
type: Input
|
|
2641
|
+
}] } });
|
|
2642
|
+
|
|
2643
|
+
var OrderEditResultType;
|
|
2644
|
+
(function (OrderEditResultType) {
|
|
2645
|
+
OrderEditResultType[OrderEditResultType["Refund"] = 0] = "Refund";
|
|
2646
|
+
OrderEditResultType[OrderEditResultType["Payment"] = 1] = "Payment";
|
|
2647
|
+
OrderEditResultType[OrderEditResultType["PriceUnchanged"] = 2] = "PriceUnchanged";
|
|
2648
|
+
OrderEditResultType[OrderEditResultType["Cancel"] = 3] = "Cancel";
|
|
2649
|
+
})(OrderEditResultType || (OrderEditResultType = {}));
|
|
2650
|
+
class OrderEditsPreviewDialogComponent {
|
|
2651
|
+
get priceDifference() {
|
|
2652
|
+
return this.order.totalWithTax - this.orderSnapshot.totalWithTax;
|
|
2653
|
+
}
|
|
2654
|
+
get amountToRefundTotal() {
|
|
2655
|
+
return this.refundablePayments.reduce((total, payment) => total + payment.amountToRefundControl.value, 0);
|
|
2656
|
+
}
|
|
2657
|
+
ngOnInit() {
|
|
2658
|
+
this.refundNote = this.modifyOrderInput.note || '';
|
|
2659
|
+
this.refundablePayments = getRefundablePayments(this.order.payments || []);
|
|
2660
|
+
this.refundablePayments.forEach(rp => {
|
|
2661
|
+
rp.amountToRefundControl.addValidators(Validators.max(this.priceDifference * -1));
|
|
2662
|
+
});
|
|
2663
|
+
if (this.priceDifference < 0 && this.refundablePayments.length) {
|
|
2664
|
+
this.onPaymentSelected(this.refundablePayments[0], true);
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
onPaymentSelected(payment, selected) {
|
|
2668
|
+
if (selected) {
|
|
2669
|
+
const outstandingRefundAmount = this.priceDifference * -1 -
|
|
2670
|
+
this.refundablePayments
|
|
2671
|
+
.filter(p => p.id !== payment.id)
|
|
2672
|
+
.reduce((total, p) => total + p.amountToRefundControl.value, 0);
|
|
2673
|
+
if (0 < outstandingRefundAmount) {
|
|
2674
|
+
payment.amountToRefundControl.setValue(Math.min(outstandingRefundAmount, payment.refundableAmount));
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
else {
|
|
2678
|
+
payment.amountToRefundControl.setValue(0);
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
refundsCoverDifference() {
|
|
2682
|
+
return this.priceDifference * -1 === this.amountToRefundTotal;
|
|
2683
|
+
}
|
|
2684
|
+
cancel() {
|
|
2685
|
+
this.resolveWith({
|
|
2686
|
+
result: OrderEditResultType.Cancel,
|
|
2687
|
+
});
|
|
2688
|
+
}
|
|
2689
|
+
submit() {
|
|
2690
|
+
if (0 < this.priceDifference) {
|
|
2691
|
+
this.resolveWith({
|
|
2692
|
+
result: OrderEditResultType.Payment,
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
else if (this.priceDifference < 0) {
|
|
2696
|
+
this.resolveWith({
|
|
2697
|
+
result: OrderEditResultType.Refund,
|
|
2698
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2699
|
+
refunds: this.refundablePayments
|
|
2700
|
+
.filter(rp => rp.selected && 0 < rp.amountToRefundControl.value)
|
|
2701
|
+
.map(payment => {
|
|
2702
|
+
return {
|
|
2703
|
+
reason: this.refundNote || this.modifyOrderInput.note,
|
|
2704
|
+
paymentId: payment.id,
|
|
2705
|
+
amount: payment.amountToRefundControl.value,
|
|
2706
|
+
};
|
|
2707
|
+
}),
|
|
2708
|
+
});
|
|
2709
|
+
}
|
|
2710
|
+
else {
|
|
2711
|
+
this.resolveWith({
|
|
2712
|
+
result: OrderEditResultType.PriceUnchanged,
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderEditsPreviewDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2717
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderEditsPreviewDialogComponent, selector: "vdr-order-edits-preview-dialog", ngImport: i0, template: "<ng-template vdrDialogTitle>{{ 'order.confirm-modifications' | translate }}</ng-template>\n<vdr-order-table\n [order]=\"order\"\n [orderLineCustomFields]=\"orderLineCustomFields\"\n class=\"order-edits-preview-table\"\n></vdr-order-table>\n<div class=\"payments-wrapper mb-2\">\n <div class=\"flex-spacer\">\n <vdr-payment-for-refund-selector\n *ngIf=\"priceDifference < 0\"\n class=\"\"\n [refundablePayments]=\"refundablePayments\"\n (paymentSelected)=\"onPaymentSelected($event.payment, $event.selected)\"\n [order]=\"order\"\n ></vdr-payment-for-refund-selector>\n </div>\n <div class=\"flex-spacer\">\n <vdr-card [title]=\"'order.modify-order' | translate\">\n <vdr-order-modification-summary\n [orderSnapshot]=\"orderSnapshot\"\n [modifyOrderInput]=\"modifyOrderInput\"\n [addedLines]=\"addedLines\"\n [shippingAddressForm]=\"shippingAddressForm\"\n [billingAddressForm]=\"billingAddressForm\"\n [couponCodesControl]=\"couponCodesControl\"\n [updatedShippingMethods]=\"updatedShippingMethods\"\n ></vdr-order-modification-summary>\n <vdr-labeled-data [label]=\"'order.note' | translate\">\n {{ modifyOrderInput.note || '-' }}\n </vdr-labeled-data>\n <vdr-form-field\n [label]=\"'order.refund-cancellation-reason' | translate\"\n *ngIf=\"priceDifference < 0\"\n >\n <textarea [(ngModel)]=\"refundNote\" name=\"refundNote\" required></textarea>\n </vdr-form-field>\n </vdr-card>\n </div>\n</div>\n<ng-template vdrDialogButtons>\n <div>\n <div class=\"errors\">\n <clr-alert\n class=\"mb-1\"\n *ngIf=\"priceDifference < 0 && !refundsCoverDifference()\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{ 'order.refund-total-warning' | translate }}\n </clr-alert-item>\n </clr-alert>\n </div>\n <div class=\"modal-buttons\">\n <clr-alert class=\"\" [clrAlertType]=\"'primary'\" [clrAlertClosable]=\"false\">\n <clr-alert-item>\n {{ 'order.modify-order-price-difference' | translate }}\n {{ 0 < priceDifference ? '+' : ''\n }}{{ priceDifference | localeCurrency : order.currencyCode }}\n </clr-alert-item>\n </clr-alert>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">\n {{ 'common.cancel' | translate }}\n </button>\n <button\n type=\"submit\"\n (click)=\"submit()\"\n [disabled]=\"priceDifference < 0 ? !refundsCoverDifference() : false\"\n class=\"btn btn-primary\"\n >\n {{ 'common.confirm' | translate }}\n </button>\n </div>\n </div>\n</ng-template>\n", styles: ["::ng-deep .order-edits-preview-table .table-wrapper{max-width:initial!important}.payments-wrapper{display:flex;gap:calc(var(--space-unit) * 2)}.modal-buttons{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}\n"], dependencies: [{ kind: "component", type: i3.ClrAlert, selector: "clr-alert", inputs: ["clrAlertSizeSmall", "clrAlertClosable", "clrAlertAppLevel", "clrCloseButtonAriaLabel", "clrAlertLightweight", "clrAlertType", "clrAlertIcon", "clrAlertClosed"], outputs: ["clrAlertClosedChange"] }, { kind: "component", type: i3.ClrAlertItem, selector: "clr-alert-item" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"], outputs: ["readOnlyToggleChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "directive", type: i1.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "directive", type: i1.DialogTitleDirective, selector: "[vdrDialogTitle]" }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "component", type: OrderTableComponent, selector: "vdr-order-table", inputs: ["order", "orderLineCustomFields", "isDraft"], outputs: ["adjust", "remove"] }, { kind: "component", type: PaymentForRefundSelectorComponent, selector: "vdr-payment-for-refund-selector", inputs: ["refundablePayments", "order"], outputs: ["paymentSelected"] }, { kind: "component", type: OrderModificationSummaryComponent, selector: "vdr-order-modification-summary", inputs: ["orderSnapshot", "modifyOrderInput", "addedLines", "shippingAddressForm", "billingAddressForm", "updatedShippingMethods", "couponCodesControl"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2718
|
+
}
|
|
2719
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderEditsPreviewDialogComponent, decorators: [{
|
|
2720
|
+
type: Component,
|
|
2721
|
+
args: [{ selector: 'vdr-order-edits-preview-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vdrDialogTitle>{{ 'order.confirm-modifications' | translate }}</ng-template>\n<vdr-order-table\n [order]=\"order\"\n [orderLineCustomFields]=\"orderLineCustomFields\"\n class=\"order-edits-preview-table\"\n></vdr-order-table>\n<div class=\"payments-wrapper mb-2\">\n <div class=\"flex-spacer\">\n <vdr-payment-for-refund-selector\n *ngIf=\"priceDifference < 0\"\n class=\"\"\n [refundablePayments]=\"refundablePayments\"\n (paymentSelected)=\"onPaymentSelected($event.payment, $event.selected)\"\n [order]=\"order\"\n ></vdr-payment-for-refund-selector>\n </div>\n <div class=\"flex-spacer\">\n <vdr-card [title]=\"'order.modify-order' | translate\">\n <vdr-order-modification-summary\n [orderSnapshot]=\"orderSnapshot\"\n [modifyOrderInput]=\"modifyOrderInput\"\n [addedLines]=\"addedLines\"\n [shippingAddressForm]=\"shippingAddressForm\"\n [billingAddressForm]=\"billingAddressForm\"\n [couponCodesControl]=\"couponCodesControl\"\n [updatedShippingMethods]=\"updatedShippingMethods\"\n ></vdr-order-modification-summary>\n <vdr-labeled-data [label]=\"'order.note' | translate\">\n {{ modifyOrderInput.note || '-' }}\n </vdr-labeled-data>\n <vdr-form-field\n [label]=\"'order.refund-cancellation-reason' | translate\"\n *ngIf=\"priceDifference < 0\"\n >\n <textarea [(ngModel)]=\"refundNote\" name=\"refundNote\" required></textarea>\n </vdr-form-field>\n </vdr-card>\n </div>\n</div>\n<ng-template vdrDialogButtons>\n <div>\n <div class=\"errors\">\n <clr-alert\n class=\"mb-1\"\n *ngIf=\"priceDifference < 0 && !refundsCoverDifference()\"\n [clrAlertType]=\"'danger'\"\n [clrAlertClosable]=\"false\"\n >\n <clr-alert-item>\n {{ 'order.refund-total-warning' | translate }}\n </clr-alert-item>\n </clr-alert>\n </div>\n <div class=\"modal-buttons\">\n <clr-alert class=\"\" [clrAlertType]=\"'primary'\" [clrAlertClosable]=\"false\">\n <clr-alert-item>\n {{ 'order.modify-order-price-difference' | translate }}\n {{ 0 < priceDifference ? '+' : ''\n }}{{ priceDifference | localeCurrency : order.currencyCode }}\n </clr-alert-item>\n </clr-alert>\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">\n {{ 'common.cancel' | translate }}\n </button>\n <button\n type=\"submit\"\n (click)=\"submit()\"\n [disabled]=\"priceDifference < 0 ? !refundsCoverDifference() : false\"\n class=\"btn btn-primary\"\n >\n {{ 'common.confirm' | translate }}\n </button>\n </div>\n </div>\n</ng-template>\n", styles: ["::ng-deep .order-edits-preview-table .table-wrapper{max-width:initial!important}.payments-wrapper{display:flex;gap:calc(var(--space-unit) * 2)}.modal-buttons{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}\n"] }]
|
|
2722
|
+
}] });
|
|
2723
|
+
|
|
2724
|
+
class OrderEditorComponent extends TypedBaseDetailComponent {
|
|
2725
|
+
constructor(dataService, notificationService, modalService, orderTransitionService, changeDetectorRef) {
|
|
2726
|
+
super();
|
|
2727
|
+
this.dataService = dataService;
|
|
2728
|
+
this.notificationService = notificationService;
|
|
2729
|
+
this.modalService = modalService;
|
|
2730
|
+
this.orderTransitionService = orderTransitionService;
|
|
2731
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
2732
|
+
this.detailForm = new UntypedFormGroup({});
|
|
2733
|
+
this.couponCodesControl = new FormControl([]);
|
|
2734
|
+
this.modifyOrderInput = {
|
|
2735
|
+
dryRun: true,
|
|
2736
|
+
orderId: '',
|
|
2737
|
+
addItems: [],
|
|
2738
|
+
adjustOrderLines: [],
|
|
2739
|
+
surcharges: [],
|
|
2740
|
+
note: '',
|
|
2741
|
+
refunds: [],
|
|
2742
|
+
updateShippingAddress: {},
|
|
2743
|
+
updateBillingAddress: {},
|
|
2744
|
+
};
|
|
2745
|
+
this.surchargeForm = new FormGroup({
|
|
2746
|
+
description: new FormControl('', Validators.minLength(1)),
|
|
2747
|
+
sku: new FormControl(''),
|
|
2748
|
+
price: new FormControl(0),
|
|
2749
|
+
priceIncludesTax: new FormControl(true),
|
|
2750
|
+
taxRate: new FormControl(0),
|
|
2751
|
+
taxDescription: new FormControl(''),
|
|
2752
|
+
});
|
|
2753
|
+
this.shippingAddressForm = new FormGroup({
|
|
2754
|
+
fullName: new FormControl(''),
|
|
2755
|
+
company: new FormControl(''),
|
|
2756
|
+
streetLine1: new FormControl(''),
|
|
2757
|
+
streetLine2: new FormControl(''),
|
|
2758
|
+
city: new FormControl(''),
|
|
2759
|
+
province: new FormControl(''),
|
|
2760
|
+
postalCode: new FormControl(''),
|
|
2761
|
+
countryCode: new FormControl(''),
|
|
2762
|
+
phoneNumber: new FormControl(''),
|
|
2763
|
+
});
|
|
2764
|
+
this.billingAddressForm = new FormGroup({
|
|
2765
|
+
fullName: new FormControl(''),
|
|
2766
|
+
company: new FormControl(''),
|
|
2767
|
+
streetLine1: new FormControl(''),
|
|
2768
|
+
streetLine2: new FormControl(''),
|
|
2769
|
+
city: new FormControl(''),
|
|
2770
|
+
province: new FormControl(''),
|
|
2771
|
+
postalCode: new FormControl(''),
|
|
2772
|
+
countryCode: new FormControl(''),
|
|
2773
|
+
phoneNumber: new FormControl(''),
|
|
2774
|
+
});
|
|
2775
|
+
this.note = '';
|
|
2776
|
+
this.recalculateShipping = true;
|
|
2777
|
+
this.editingShippingAddress = false;
|
|
2778
|
+
this.editingBillingAddress = false;
|
|
2779
|
+
this.updatedShippingMethods = {};
|
|
2780
|
+
this.addedVariants = new Map();
|
|
2781
|
+
}
|
|
2782
|
+
ngOnInit() {
|
|
2783
|
+
this.init();
|
|
2784
|
+
this.addressCustomFields = this.getCustomFieldConfig('Address');
|
|
2785
|
+
this.modifyOrderInput.orderId = this.route.snapshot.paramMap.get('id');
|
|
2786
|
+
this.orderLineCustomFields = this.getCustomFieldConfig('OrderLine');
|
|
2787
|
+
this.entity$.pipe(take(1)).subscribe(order => {
|
|
2788
|
+
this.orderSnapshot = this.createOrderSnapshot(order);
|
|
2789
|
+
if (order.couponCodes.length) {
|
|
2790
|
+
this.couponCodesControl.setValue(order.couponCodes);
|
|
2791
|
+
}
|
|
2792
|
+
this.surchargeForm.reset();
|
|
2793
|
+
for (const [name, control] of Object.entries(this.shippingAddressForm.controls)) {
|
|
2794
|
+
control.setValue(order.shippingAddress?.[name]);
|
|
2795
|
+
}
|
|
2796
|
+
this.addAddressCustomFieldsFormGroup(this.shippingAddressForm, order.shippingAddress);
|
|
2797
|
+
for (const [name, control] of Object.entries(this.billingAddressForm.controls)) {
|
|
2798
|
+
control.setValue(order.billingAddress?.[name]);
|
|
2799
|
+
}
|
|
2800
|
+
this.addAddressCustomFieldsFormGroup(this.billingAddressForm, order.billingAddress);
|
|
2801
|
+
this.orderLineCustomFieldsFormArray = new UntypedFormArray([]);
|
|
2802
|
+
for (const line of order.lines) {
|
|
2803
|
+
const formGroup = new UntypedFormGroup({});
|
|
2804
|
+
for (const { name } of this.orderLineCustomFields) {
|
|
2805
|
+
formGroup.addControl(name, new UntypedFormControl(line.customFields[name]));
|
|
2806
|
+
}
|
|
2807
|
+
formGroup.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(value => {
|
|
2808
|
+
let modifyRow = this.modifyOrderInput.adjustOrderLines.find(l => l.orderLineId === line.id);
|
|
2809
|
+
if (!modifyRow) {
|
|
2810
|
+
modifyRow = {
|
|
2811
|
+
orderLineId: line.id,
|
|
2812
|
+
quantity: line.quantity,
|
|
2813
|
+
};
|
|
2814
|
+
this.modifyOrderInput.adjustOrderLines.push(modifyRow);
|
|
2815
|
+
}
|
|
2816
|
+
if (this.orderLineCustomFields.length) {
|
|
2817
|
+
modifyRow.customFields = value;
|
|
2818
|
+
}
|
|
2819
|
+
});
|
|
2820
|
+
this.orderLineCustomFieldsFormArray.push(formGroup);
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
this.addItemCustomFieldsFormArray = new UntypedFormArray([]);
|
|
2824
|
+
this.addItemCustomFieldsForm = new UntypedFormGroup({});
|
|
2825
|
+
for (const customField of this.orderLineCustomFields) {
|
|
2826
|
+
this.addItemCustomFieldsForm.addControl(customField.name, new UntypedFormControl());
|
|
2827
|
+
}
|
|
2828
|
+
this.availableCountries$ = this.dataService.settings
|
|
2829
|
+
.getAvailableCountries()
|
|
2830
|
+
.mapSingle(result => result.countries.items)
|
|
2831
|
+
.pipe(shareReplay(1));
|
|
2832
|
+
this.dataService.order
|
|
2833
|
+
.getOrderHistory(this.id, {
|
|
2834
|
+
take: 1,
|
|
2835
|
+
sort: {
|
|
2836
|
+
createdAt: SortOrder.DESC,
|
|
2837
|
+
},
|
|
2838
|
+
filter: { type: { eq: HistoryEntryType.ORDER_STATE_TRANSITION } },
|
|
2839
|
+
})
|
|
2840
|
+
.single$.subscribe(({ order }) => {
|
|
2841
|
+
this.previousState = order?.history.items[0].data.from;
|
|
2842
|
+
});
|
|
2843
|
+
this.uiLanguage$ = this.dataService.client
|
|
2844
|
+
.uiState()
|
|
2845
|
+
.stream$.pipe(map(({ uiState }) => uiState.language));
|
|
2846
|
+
}
|
|
2847
|
+
ngOnDestroy() {
|
|
2848
|
+
this.destroy();
|
|
2849
|
+
}
|
|
2850
|
+
get addedLines() {
|
|
2851
|
+
const getSinglePriceValue = (price) => price.__typename === 'SinglePrice' ? price.value : 0;
|
|
2852
|
+
return (this.modifyOrderInput.addItems || [])
|
|
2853
|
+
.map(row => {
|
|
2854
|
+
const variantInfo = this.addedVariants.get(row.productVariantId);
|
|
2855
|
+
if (variantInfo) {
|
|
2856
|
+
return {
|
|
2857
|
+
id: this.getIdForAddedItem(row),
|
|
2858
|
+
featuredAsset: variantInfo.productAsset,
|
|
2859
|
+
productVariant: {
|
|
2860
|
+
id: variantInfo.productVariantId,
|
|
2861
|
+
name: variantInfo.productVariantName,
|
|
2862
|
+
sku: variantInfo.sku,
|
|
2863
|
+
},
|
|
2864
|
+
unitPrice: getSinglePriceValue(variantInfo.price),
|
|
2865
|
+
unitPriceWithTax: getSinglePriceValue(variantInfo.priceWithTax),
|
|
2866
|
+
quantity: row.quantity,
|
|
2867
|
+
};
|
|
2868
|
+
}
|
|
2869
|
+
})
|
|
2870
|
+
.filter(notNullOrUndefined);
|
|
2871
|
+
}
|
|
2872
|
+
getIdForAddedItem(row) {
|
|
2873
|
+
return `added-${row.productVariantId}-${JSON.stringify(row.customFields || {})}`;
|
|
2874
|
+
}
|
|
2875
|
+
transitionToPriorState(order) {
|
|
2876
|
+
this.orderTransitionService
|
|
2877
|
+
.transitionToPreModifyingState(order.id, order.nextStates)
|
|
2878
|
+
.subscribe(result => {
|
|
2879
|
+
this.router.navigate(['..'], { relativeTo: this.route });
|
|
2880
|
+
});
|
|
2881
|
+
}
|
|
2882
|
+
hasModifications() {
|
|
2883
|
+
const { addItems, adjustOrderLines, surcharges } = this.modifyOrderInput;
|
|
2884
|
+
return (!!addItems?.length ||
|
|
2885
|
+
!!surcharges?.length ||
|
|
2886
|
+
!!adjustOrderLines?.length ||
|
|
2887
|
+
(this.shippingAddressForm.dirty && this.shippingAddressForm.valid) ||
|
|
2888
|
+
(this.billingAddressForm.dirty && this.billingAddressForm.valid) ||
|
|
2889
|
+
this.couponCodesControl.dirty ||
|
|
2890
|
+
Object.entries(this.updatedShippingMethods).length > 0);
|
|
2891
|
+
}
|
|
2892
|
+
isLineModified(line) {
|
|
2893
|
+
return !!this.modifyOrderInput.adjustOrderLines?.find(l => l.orderLineId === line.id && l.quantity !== line.quantity);
|
|
2894
|
+
}
|
|
2895
|
+
getInitialLineQuantity(lineId) {
|
|
2896
|
+
const adjustedLine = this.modifyOrderInput.adjustOrderLines?.find(l => l.orderLineId === lineId);
|
|
2897
|
+
if (adjustedLine) {
|
|
2898
|
+
return adjustedLine.quantity;
|
|
2899
|
+
}
|
|
2900
|
+
const addedLine = this.modifyOrderInput.addItems?.find(l => this.getIdForAddedItem(l) === lineId);
|
|
2901
|
+
if (addedLine) {
|
|
2902
|
+
return addedLine.quantity ?? 1;
|
|
2903
|
+
}
|
|
2904
|
+
const line = this.orderSnapshot.lines.find(l => l.id === lineId);
|
|
2905
|
+
return line ? line.quantity : 1;
|
|
2906
|
+
}
|
|
2907
|
+
updateLineQuantity(line, quantity) {
|
|
2908
|
+
const { adjustOrderLines } = this.modifyOrderInput;
|
|
2909
|
+
if (this.isAddedLine(line)) {
|
|
2910
|
+
const row = this.modifyOrderInput.addItems?.find(l => l.productVariantId === line.productVariant.id);
|
|
2911
|
+
if (row) {
|
|
2912
|
+
row.quantity = +quantity;
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
else {
|
|
2916
|
+
let row = adjustOrderLines?.find(l => l.orderLineId === line.id);
|
|
2917
|
+
if (row && +quantity === line.quantity) {
|
|
2918
|
+
// Remove the modification if the quantity is the same as
|
|
2919
|
+
// the original order
|
|
2920
|
+
adjustOrderLines?.splice(adjustOrderLines?.indexOf(row), 1);
|
|
2921
|
+
}
|
|
2922
|
+
if (!row) {
|
|
2923
|
+
row = { orderLineId: line.id, quantity: +quantity };
|
|
2924
|
+
adjustOrderLines?.push(row);
|
|
2925
|
+
}
|
|
2926
|
+
row.quantity = +quantity;
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
isAddedLine(line) {
|
|
2930
|
+
return line.id.startsWith('added-');
|
|
2931
|
+
}
|
|
2932
|
+
updateAddedItemQuantity(item, quantity) {
|
|
2933
|
+
const row = this.modifyOrderInput.addItems?.find(l => l.productVariantId === item.productVariant.id);
|
|
2934
|
+
if (row) {
|
|
2935
|
+
row.quantity = +quantity;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
trackByProductVariantId(index, item) {
|
|
2939
|
+
return item.productVariant.id;
|
|
2940
|
+
}
|
|
2941
|
+
getSelectedItemPrice(result) {
|
|
2942
|
+
switch (result?.priceWithTax.__typename) {
|
|
2943
|
+
case 'SinglePrice':
|
|
2944
|
+
return result.priceWithTax.value;
|
|
2945
|
+
default:
|
|
2946
|
+
return 0;
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
addItemToOrder(result) {
|
|
2950
|
+
if (!result) {
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
const customFields = this.orderLineCustomFields.length
|
|
2954
|
+
? this.addItemCustomFieldsForm.value
|
|
2955
|
+
: undefined;
|
|
2956
|
+
let row = this.modifyOrderInput.addItems?.find(l => this.isMatchingAddItemRow(l, result, customFields));
|
|
2957
|
+
if (!row) {
|
|
2958
|
+
row = { productVariantId: result.productVariantId, quantity: 1 };
|
|
2959
|
+
if (customFields) {
|
|
2960
|
+
row.customFields = customFields;
|
|
2961
|
+
}
|
|
2962
|
+
this.modifyOrderInput.addItems?.push(row);
|
|
2963
|
+
}
|
|
2964
|
+
else {
|
|
2965
|
+
row.quantity++;
|
|
2966
|
+
}
|
|
2967
|
+
if (customFields) {
|
|
2968
|
+
const formGroup = new UntypedFormGroup({});
|
|
2969
|
+
for (const [key, value] of Object.entries(customFields)) {
|
|
2970
|
+
formGroup.addControl(key, new UntypedFormControl(value));
|
|
2971
|
+
}
|
|
2972
|
+
this.addItemCustomFieldsFormArray.push(formGroup);
|
|
2973
|
+
formGroup.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(value => {
|
|
2974
|
+
if (row) {
|
|
2975
|
+
row.customFields = value;
|
|
2976
|
+
}
|
|
2977
|
+
});
|
|
2978
|
+
}
|
|
2979
|
+
this.addItemCustomFieldsForm.reset({});
|
|
2980
|
+
this.addItemSelectedVariant = undefined;
|
|
2981
|
+
this.addedVariants.set(result.productVariantId, result);
|
|
2982
|
+
}
|
|
2983
|
+
getShippingLineDetails(shippingLine) {
|
|
2984
|
+
const updatedMethod = this.updatedShippingMethods[shippingLine.id];
|
|
2985
|
+
if (updatedMethod) {
|
|
2986
|
+
return {
|
|
2987
|
+
name: updatedMethod.name || updatedMethod.code,
|
|
2988
|
+
price: updatedMethod.priceWithTax,
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2991
|
+
else {
|
|
2992
|
+
return {
|
|
2993
|
+
name: shippingLine.shippingMethod.name || shippingLine.shippingMethod.code,
|
|
2994
|
+
price: shippingLine.discountedPriceWithTax,
|
|
2995
|
+
};
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
setShippingMethod(shippingLineId) {
|
|
2999
|
+
const currentShippingMethod = this.updatedShippingMethods[shippingLineId] ??
|
|
3000
|
+
this.entity?.shippingLines.find(l => l.id === shippingLineId)?.shippingMethod;
|
|
3001
|
+
if (!currentShippingMethod) {
|
|
3002
|
+
return;
|
|
3003
|
+
}
|
|
3004
|
+
this.dataService.order
|
|
3005
|
+
.getDraftOrderEligibleShippingMethods(this.id)
|
|
3006
|
+
.mapSingle(({ eligibleShippingMethodsForDraftOrder }) => eligibleShippingMethodsForDraftOrder)
|
|
3007
|
+
.pipe(switchMap(methods => this.modalService
|
|
3008
|
+
.fromComponent(SelectShippingMethodDialogComponent, {
|
|
3009
|
+
locals: {
|
|
3010
|
+
eligibleShippingMethods: methods,
|
|
3011
|
+
currencyCode: this.entity?.currencyCode,
|
|
3012
|
+
currentSelectionId: currentShippingMethod.id,
|
|
3013
|
+
},
|
|
3014
|
+
})
|
|
3015
|
+
.pipe(map(result => {
|
|
3016
|
+
if (result) {
|
|
3017
|
+
return methods.find(method => method.id === result);
|
|
3018
|
+
}
|
|
3019
|
+
}))))
|
|
3020
|
+
.subscribe(result => {
|
|
3021
|
+
if (result) {
|
|
3022
|
+
this.updatedShippingMethods[shippingLineId] = result;
|
|
3023
|
+
this.changeDetectorRef.markForCheck();
|
|
3024
|
+
}
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
isMatchingAddItemRow(row, result, customFields) {
|
|
3028
|
+
return (row.productVariantId === result.productVariantId &&
|
|
3029
|
+
JSON.stringify(row.customFields) === JSON.stringify(customFields));
|
|
3030
|
+
}
|
|
3031
|
+
removeAddedItem(id) {
|
|
3032
|
+
this.modifyOrderInput.addItems = this.modifyOrderInput.addItems?.filter(l => {
|
|
3033
|
+
const itemId = this.getIdForAddedItem(l);
|
|
3034
|
+
return itemId !== id;
|
|
3035
|
+
});
|
|
3036
|
+
}
|
|
3037
|
+
getSurchargePrices(surcharge) {
|
|
3038
|
+
const priceWithTax = surcharge.priceIncludesTax
|
|
3039
|
+
? surcharge.price
|
|
3040
|
+
: Math.round(surcharge.price * ((100 + (surcharge.taxRate || 0)) / 100));
|
|
3041
|
+
const price = surcharge.priceIncludesTax
|
|
3042
|
+
? Math.round(surcharge.price / ((100 + (surcharge.taxRate || 0)) / 100))
|
|
3043
|
+
: surcharge.price;
|
|
3044
|
+
return {
|
|
3045
|
+
price,
|
|
3046
|
+
priceWithTax,
|
|
3047
|
+
};
|
|
3048
|
+
}
|
|
3049
|
+
addSurcharge(value) {
|
|
3050
|
+
this.modifyOrderInput.surcharges?.push(value);
|
|
3051
|
+
this.surchargeForm.reset({
|
|
3052
|
+
price: 0,
|
|
3053
|
+
priceIncludesTax: true,
|
|
3054
|
+
taxRate: 0,
|
|
3055
|
+
});
|
|
3056
|
+
}
|
|
3057
|
+
removeSurcharge(index) {
|
|
3058
|
+
this.modifyOrderInput.surcharges?.splice(index, 1);
|
|
3059
|
+
}
|
|
3060
|
+
previewAndModify(order) {
|
|
3061
|
+
const modifyOrderInput = {
|
|
3062
|
+
...this.modifyOrderInput,
|
|
3063
|
+
adjustOrderLines: this.modifyOrderInput.adjustOrderLines.map(line => transformRelationCustomFieldInputs(simpleDeepClone(line), this.orderLineCustomFields)),
|
|
3064
|
+
};
|
|
3065
|
+
const input = {
|
|
3066
|
+
...modifyOrderInput,
|
|
3067
|
+
...(this.billingAddressForm.dirty ? { updateBillingAddress: this.billingAddressForm.value } : {}),
|
|
3068
|
+
...(this.shippingAddressForm.dirty
|
|
3069
|
+
? { updateShippingAddress: this.shippingAddressForm.value }
|
|
3070
|
+
: {}),
|
|
3071
|
+
dryRun: true,
|
|
3072
|
+
couponCodes: this.couponCodesControl.dirty ? this.couponCodesControl.value : undefined,
|
|
3073
|
+
note: this.note ?? '',
|
|
3074
|
+
options: {
|
|
3075
|
+
recalculateShipping: this.recalculateShipping,
|
|
3076
|
+
},
|
|
3077
|
+
};
|
|
3078
|
+
if (Object.entries(this.updatedShippingMethods).length) {
|
|
3079
|
+
input.shippingMethodIds = order.shippingLines.map(l => this.updatedShippingMethods[l.id]
|
|
3080
|
+
? this.updatedShippingMethods[l.id].id
|
|
3081
|
+
: l.shippingMethod.id);
|
|
3082
|
+
}
|
|
3083
|
+
this.dataService.order
|
|
3084
|
+
.modifyOrder(input)
|
|
3085
|
+
.pipe(switchMap(({ modifyOrder }) => {
|
|
3086
|
+
switch (modifyOrder.__typename) {
|
|
3087
|
+
case 'Order':
|
|
3088
|
+
return this.modalService.fromComponent(OrderEditsPreviewDialogComponent, {
|
|
3089
|
+
size: 'xl',
|
|
3090
|
+
closable: false,
|
|
3091
|
+
locals: {
|
|
3092
|
+
order: modifyOrder,
|
|
3093
|
+
orderSnapshot: this.orderSnapshot,
|
|
3094
|
+
orderLineCustomFields: this.orderLineCustomFields,
|
|
3095
|
+
modifyOrderInput: input,
|
|
3096
|
+
addedLines: this.addedLines,
|
|
3097
|
+
shippingAddressForm: this.shippingAddressForm,
|
|
3098
|
+
billingAddressForm: this.billingAddressForm,
|
|
3099
|
+
couponCodesControl: this.couponCodesControl,
|
|
3100
|
+
updatedShippingMethods: this.updatedShippingMethods,
|
|
3101
|
+
},
|
|
3102
|
+
});
|
|
3103
|
+
case 'InsufficientStockError':
|
|
3104
|
+
case 'NegativeQuantityError':
|
|
3105
|
+
case 'NoChangesSpecifiedError':
|
|
3106
|
+
case 'OrderLimitError':
|
|
3107
|
+
case 'OrderModificationStateError':
|
|
3108
|
+
case 'PaymentMethodMissingError':
|
|
3109
|
+
case 'RefundPaymentIdMissingError':
|
|
3110
|
+
case 'CouponCodeLimitError':
|
|
3111
|
+
case 'CouponCodeExpiredError':
|
|
3112
|
+
case 'IneligibleShippingMethodError':
|
|
3113
|
+
case 'CouponCodeInvalidError': {
|
|
3114
|
+
this.notificationService.error(modifyOrder.message);
|
|
3115
|
+
return of(false);
|
|
3116
|
+
}
|
|
3117
|
+
case null:
|
|
3118
|
+
case undefined:
|
|
3119
|
+
return of(false);
|
|
3120
|
+
default:
|
|
3121
|
+
assertNever(modifyOrder);
|
|
3122
|
+
}
|
|
3123
|
+
}), switchMap(result => {
|
|
3124
|
+
if (!result || result.result === OrderEditResultType.Cancel) {
|
|
3125
|
+
// re-fetch so that the preview values get overwritten in the cache.
|
|
3126
|
+
return this.dataService.order.getOrder(this.id).mapSingle(() => false);
|
|
3127
|
+
}
|
|
3128
|
+
else {
|
|
3129
|
+
// Do the modification
|
|
3130
|
+
const wetRunInput = {
|
|
3131
|
+
...input,
|
|
3132
|
+
dryRun: false,
|
|
3133
|
+
};
|
|
3134
|
+
if (result.result === OrderEditResultType.Refund) {
|
|
3135
|
+
wetRunInput.refunds = result.refunds;
|
|
3136
|
+
}
|
|
3137
|
+
return this.dataService.order.modifyOrder(wetRunInput).pipe(switchMap(({ modifyOrder }) => {
|
|
3138
|
+
if (modifyOrder.__typename === 'Order') {
|
|
3139
|
+
const priceDelta = modifyOrder.totalWithTax - this.orderSnapshot.totalWithTax;
|
|
3140
|
+
const nextState = 0 < priceDelta ? 'ArrangingAdditionalPayment' : this.previousState;
|
|
3141
|
+
return this.dataService.order
|
|
3142
|
+
.transitionToState(order.id, nextState)
|
|
3143
|
+
.pipe(mapTo(true));
|
|
3144
|
+
}
|
|
3145
|
+
else {
|
|
3146
|
+
this.notificationService.error(modifyOrder.message);
|
|
3147
|
+
return EMPTY;
|
|
3148
|
+
}
|
|
3149
|
+
}));
|
|
3150
|
+
}
|
|
3151
|
+
}))
|
|
3152
|
+
.subscribe(result => {
|
|
3153
|
+
if (result) {
|
|
3154
|
+
this.router.navigate(['../'], { relativeTo: this.route });
|
|
3155
|
+
}
|
|
3156
|
+
});
|
|
3157
|
+
}
|
|
3158
|
+
addAddressCustomFieldsFormGroup(parentFormGroup, address) {
|
|
3159
|
+
if (address && this.addressCustomFields.length) {
|
|
3160
|
+
const addressCustomFieldsFormGroup = new UntypedFormGroup({});
|
|
3161
|
+
for (const customFieldDef of this.addressCustomFields) {
|
|
3162
|
+
const name = customFieldDef.name;
|
|
3163
|
+
const value = address.customFields?.[name];
|
|
3164
|
+
addressCustomFieldsFormGroup.addControl(name, new UntypedFormControl(value));
|
|
3165
|
+
}
|
|
3166
|
+
parentFormGroup.addControl('customFields', addressCustomFieldsFormGroup);
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
createOrderSnapshot(order) {
|
|
3170
|
+
return {
|
|
3171
|
+
totalWithTax: order.totalWithTax,
|
|
3172
|
+
currencyCode: order.currencyCode,
|
|
3173
|
+
couponCodes: order.couponCodes,
|
|
3174
|
+
lines: [...order.lines].map(line => ({ ...line })),
|
|
3175
|
+
shippingLines: [...order.shippingLines].map(line => ({ ...line })),
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
setFormValues(entity, languageCode) {
|
|
3179
|
+
/* not used */
|
|
3180
|
+
}
|
|
3181
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderEditorComponent, deps: [{ token: i1.DataService }, { token: i1.NotificationService }, { token: i1.ModalService }, { token: OrderTransitionService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3182
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderEditorComponent, selector: "vdr-order-editor", usesInheritance: true, ngImport: i0, template: "<vdr-page-block>\n <vdr-action-bar *ngIf=\"entity$ | async as order\">\n <vdr-ab-left>\n <div class=\"flex clr-align-items-center\"></div>\n </vdr-ab-left>\n\n <vdr-ab-right>\n <button class=\"btn btn-secondary\" (click)=\"transitionToPriorState(order)\">\n {{ 'order.cancel-modification' | translate }}\n </button>\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n\n<vdr-page-detail-layout *ngIf=\"entity as order\">\n <vdr-page-detail-sidebar>\n <vdr-card [title]=\"'order.modification-summary' | translate\">\n <vdr-order-modification-summary\n [orderSnapshot]=\"orderSnapshot\"\n [modifyOrderInput]=\"modifyOrderInput\"\n [addedLines]=\"addedLines\"\n [shippingAddressForm]=\"shippingAddressForm\"\n [billingAddressForm]=\"billingAddressForm\"\n [couponCodesControl]=\"couponCodesControl\"\n [updatedShippingMethods]=\"updatedShippingMethods\"\n ></vdr-order-modification-summary>\n\n <div *ngIf=\"!hasModifications()\" class=\"no-modifications\">\n {{ 'order.no-modifications-made' | translate }}\n </div>\n\n <div class=\"summary-controls\">\n <vdr-form-field [label]=\"'order.note' | translate\">\n <textarea\n [(ngModel)]=\"note\"\n name=\"note\"\n required\n [disabled]=\"!hasModifications()\"\n ></textarea>\n </vdr-form-field>\n <label class=\"flex items-center\">\n <input\n type=\"checkbox\"\n [(ngModel)]=\"recalculateShipping\"\n [disabled]=\"!hasModifications()\"\n />\n <div class=\"ml-1\">{{ 'order.modification-recalculate-shipping' | translate }}</div>\n </label>\n <button\n class=\"btn btn-primary mt-2\"\n [disabled]=\"!hasModifications()\"\n (click)=\"previewAndModify(order)\"\n >\n {{ 'order.preview-changes' | translate }}\n </button>\n </div>\n </vdr-card>\n <vdr-card [title]=\"'order.set-coupon-codes' | translate\">\n <vdr-coupon-code-selector [control]=\"couponCodesControl\"></vdr-coupon-code-selector>\n </vdr-card>\n <vdr-card [title]=\"'order.shipping-address' | translate\">\n <ng-template vdrCardControls>\n <button\n class=\"button-small\"\n [title]=\"'order.edit-shipping-address' | translate\"\n (click)=\"editingShippingAddress = !editingShippingAddress\"\n >\n <clr-icon shape=\"edit\"></clr-icon>\n </button>\n </ng-template>\n <vdr-formatted-address\n *ngIf=\"!editingShippingAddress\"\n [address]=\"shippingAddressForm.value\"\n ></vdr-formatted-address>\n <vdr-address-form\n *ngIf=\"editingShippingAddress\"\n [formGroup]=\"shippingAddressForm\"\n [availableCountries]=\"availableCountries$ | async\"\n [customFields]=\"addressCustomFields\"\n ></vdr-address-form>\n </vdr-card>\n <vdr-card [title]=\"'order.billing-address' | translate\">\n <ng-template vdrCardControls>\n <button\n class=\"button-small\"\n [title]=\"'order.edit-billing-address' | translate\"\n (click)=\"editingBillingAddress = !editingBillingAddress\"\n >\n <clr-icon shape=\"edit\"></clr-icon>\n </button>\n </ng-template>\n <vdr-formatted-address\n *ngIf=\"!editingBillingAddress\"\n [address]=\"billingAddressForm.value\"\n ></vdr-formatted-address>\n <vdr-address-form\n *ngIf=\"editingBillingAddress\"\n [formGroup]=\"billingAddressForm\"\n [availableCountries]=\"availableCountries$ | async\"\n [customFields]=\"addressCustomFields\"\n ></vdr-address-form>\n </vdr-card>\n </vdr-page-detail-sidebar>\n\n <vdr-page-block>\n <vdr-card [paddingX]=\"false\">\n <vdr-data-table-2 id=\"modify-order\" class=\"order-table\" [items]=\"order.lines.concat(addedLines)\">\n <!-- Here we define all the available columns -->\n <vdr-dt2-column id=\"id\" [heading]=\"'common.id' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"created-at\"\n [heading]=\"'common.created-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"updated-at\"\n [heading]=\"'common.updated-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.updatedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.image' | translate\" id=\"image\">\n <ng-template let-line=\"item\">\n <div class=\"image-placeholder\">\n <img\n *ngIf=\"line.featuredAsset as asset; else imagePlaceholder\"\n [src]=\"asset | assetPreview : 'tiny'\"\n />\n <ng-template #imagePlaceholder>\n <div class=\"placeholder\">\n <clr-icon shape=\"image\" size=\"48\"></clr-icon>\n </div>\n </ng-template>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"product-name\"\n [heading]=\"'order.product-name' | translate\"\n [optional]=\"false\"\n >\n <ng-template let-line=\"item\">\n {{ line.productVariant.name }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"product-sku\" [heading]=\"'order.product-sku' | translate\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.sku }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"unit-price\" [heading]=\"'order.unit-price' | translate\">\n <ng-template let-line=\"item\">\n <div class=\"text-center\">\n <div>{{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}</div>\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ line.unitPrice | localeCurrency : order.currencyCode }}\n </div>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"quantity\" [heading]=\"'order.quantity' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <input\n type=\"number\"\n class=\"draft-qty mr-1\"\n min=\"0\"\n [value]=\"getInitialLineQuantity(line.id)\"\n (input)=\"updateLineQuantity(line, $event.target.value)\"\n />\n <button\n class=\"button-small\"\n *ngIf=\"isAddedLine(line)\"\n (click)=\"removeAddedItem(line.id)\"\n >\n <clr-icon shape=\"trash\"></clr-icon>\n </button>\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\n <vdr-line-fulfillment\n [line]=\"line\"\n [allOrderFulfillments]=\"order.fulfillments\"\n [orderState]=\"order.state\"\n ></vdr-line-fulfillment>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n *ngFor=\"let customField of orderLineCustomFields\"\n [id]=\"customField.name\"\n [heading]=\"customField | customFieldLabel : (uiLanguage$ | async)\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\" let-index=\"index\">\n <vdr-custom-field-control\n [compact]=\"true\"\n [entityName]=\"'OrderLine'\"\n [customField]=\"customField\"\n [customFieldsFormGroup]=\"orderLineCustomFieldsFormArray.at(index)\"\n />\n </ng-template>\n </vdr-dt2-column>\n </vdr-data-table-2>\n </vdr-card>\n <vdr-card [title]=\"'order.add-item-to-order' | translate\">\n <vdr-product-variant-selector class=\"mb-4\" (productSelected)=\"addItemSelectedVariant = $event\">\n </vdr-product-variant-selector>\n <div class=\"flex\">\n <div>\n <div *ngIf=\"addItemSelectedVariant\" class=\"flex mb-4\">\n <img\n *ngIf=\"addItemSelectedVariant.productAsset as asset\"\n [src]=\"asset | assetPreview : 'tiny'\"\n class=\"mr-4 add-item-thumb\"\n />\n <div>\n <strong class=\"mr-4\">{{ addItemSelectedVariant.productVariantName }}</strong>\n <small>{{ addItemSelectedVariant.sku }}</small>\n <div>\n {{\n getSelectedItemPrice(addItemSelectedVariant)\n | localeCurrency : order.currencyCode\n }}\n </div>\n </div>\n </div>\n <div class=\"form-grid\" *ngIf=\"addItemSelectedVariant\">\n <ng-container *ngFor=\"let customField of orderLineCustomFields\">\n <vdr-custom-field-control\n [readonly]=\"!addItemSelectedVariant\"\n [customField]=\"customField\"\n [customFieldsFormGroup]=\"addItemCustomFieldsForm\"\n entityName=\"OrderLine\"\n [compact]=\"true\"\n ></vdr-custom-field-control>\n </ng-container>\n </div>\n </div>\n <div class=\"flex-spacer\"></div>\n <div>\n <button\n *ngIf=\"addItemSelectedVariant\"\n class=\"btn btn-secondary\"\n [disabled]=\"!addItemSelectedVariant || addItemCustomFieldsForm.invalid\"\n (click)=\"addItemToOrder(addItemSelectedVariant)\"\n >\n {{ 'order.add-item-to-order' | translate }}\n </button>\n </div>\n </div>\n </vdr-card>\n <vdr-card [title]=\"'order.shipping' | translate\">\n <div *ngFor=\"let shippingLine of order.shippingLines\" class=\"flex items-center\">\n <ng-container *ngIf=\"getShippingLineDetails(shippingLine) as details\">\n <div>{{ details.name }}:</div>\n <div class=\"mx-1\">\n {{ details.price | localeCurrency : order.currencyCode }}\n </div>\n <button class=\"button-small\" (click)=\"setShippingMethod(shippingLine.id)\">\n {{ 'order.set-shipping-method' | translate }}\n </button>\n </ng-container>\n </div>\n </vdr-card>\n <vdr-card [title]=\"'order.add-surcharge' | translate\">\n <form [formGroup]=\"surchargeForm\" (submit)=\"addSurcharge(surchargeForm.value)\">\n <div class=\"form-grid\">\n <vdr-form-field [label]=\"'common.description' | translate\" for=\"description\"\n ><input id=\"description\" type=\"text\" formControlName=\"description\"\n /></vdr-form-field>\n <vdr-form-field [label]=\"'order.product-sku' | translate\" for=\"sku\"\n ><input id=\"sku\" type=\"text\" formControlName=\"sku\"\n /></vdr-form-field>\n <vdr-form-field [label]=\"'common.price' | translate\" for=\"price\">\n <vdr-currency-input\n [currencyCode]=\"order.currencyCode\"\n id=\"price\"\n formControlName=\"price\"\n ></vdr-currency-input>\n </vdr-form-field>\n <vdr-form-field\n [label]=\"\n 'catalog.price-includes-tax-at'\n | translate : { rate: surchargeForm.get('taxRate')?.value ?? 0 }\n \"\n for=\"priceIncludesTax\"\n ><input\n id=\"priceIncludesTax\"\n type=\"checkbox\"\n clrCheckbox\n formControlName=\"priceIncludesTax\"\n /></vdr-form-field>\n <vdr-form-field [label]=\"'order.tax-rate' | translate\" for=\"taxRate\">\n <vdr-affixed-input suffix=\"%\"\n ><input id=\"taxRate\" type=\"number\" min=\"0\" max=\"100\" formControlName=\"taxRate\"\n /></vdr-affixed-input>\n </vdr-form-field>\n <vdr-form-field [label]=\"'order.tax-description' | translate\" for=\"taxDescription\"\n ><input id=\"taxDescription\" type=\"text\" formControlName=\"taxDescription\"\n /></vdr-form-field>\n </div>\n <button\n class=\"btn btn-secondary mt-2\"\n [disabled]=\"\n surchargeForm.invalid ||\n surchargeForm.pristine ||\n surchargeForm.get('price')?.value === 0 ||\n !surchargeForm.get('description')?.value\n \"\n >\n {{ 'order.add-surcharge' | translate }}\n </button>\n </form>\n </vdr-card>\n </vdr-page-block>\n</vdr-page-detail-layout>\n", styles: [".order-table .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table .sub-total td{border-top:1px dashed var(--color-component-border-200)}.order-table .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table img{border-radius:var(--border-radius-img)}.order-table .order-line-custom-fields{display:flex;flex-wrap:wrap}.order-table .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}.order-table .draft-qty{max-width:48px}.order-table .order-line-custom-field{background-color:var(--color-component-bg-100)}.order-table .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}.order-table .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}.order-table .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table .thumb img{width:50px;height:50px}.order-table .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}.order-table .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.order-table tr.modified td{background-color:var(--color-warning-100)}.order-table .order-line-custom-field{text-align:start}.add-item-thumb{max-width:50px}.no-modifications{color:var(--color-grey-400)}.summary-controls{border-top:1px solid var(--color-weight-200);margin-top:calc(var(--space-unit) * 2);padding-top:calc(var(--space-unit) * 1)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["id", "for"] }, { kind: "directive", type: i3.ClrCheckbox, selector: "[clrCheckbox],[clrToggle]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i1.ActionBarComponent, selector: "vdr-action-bar" }, { kind: "component", type: i1.ActionBarLeftComponent, selector: "vdr-ab-left", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarRightComponent, selector: "vdr-ab-right", inputs: ["grow"] }, { kind: "component", type: i1.AffixedInputComponent, selector: "vdr-affixed-input", inputs: ["prefix", "suffix"] }, { kind: "component", type: i1.CurrencyInputComponent, selector: "vdr-currency-input", inputs: ["disabled", "readonly", "value", "currencyCode"], outputs: ["valueChange"] }, { kind: "component", type: i1.CustomFieldControlComponent, selector: "vdr-custom-field-control", inputs: ["entityName", "customFieldsFormGroup", "customField", "compact", "showLabel", "readonly"] }, { kind: "component", type: i1.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"], outputs: ["readOnlyToggleChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select, vdr-currency-input" }, { kind: "component", type: i1.FormattedAddressComponent, selector: "vdr-formatted-address", inputs: ["address"] }, { kind: "component", type: i1.ProductVariantSelectorComponent, selector: "vdr-product-variant-selector", outputs: ["productSelected"] }, { kind: "component", type: i1.AddressFormComponent, selector: "vdr-address-form", inputs: ["customFields", "formGroup", "availableCountries"] }, { kind: "component", type: i1.DataTable2Component, selector: "vdr-data-table-2", inputs: ["id", "items", "itemsPerPage", "currentPage", "totalItems", "emptyStateLabel", "filters", "activeIndex"], outputs: ["pageChange", "itemsPerPageChange"] }, { kind: "component", type: i1.DataTable2ColumnComponent, selector: "vdr-dt2-column", inputs: ["id", "expand", "heading", "align", "sort", "optional", "hiddenByDefault", "orderable"], exportAs: ["row"] }, { kind: "component", type: i1.PageBlockComponent, selector: "vdr-page-block" }, { kind: "component", type: i1.PageDetailLayoutComponent, selector: "vdr-page-detail-layout" }, { kind: "component", type: i1.PageDetailSidebarComponent, selector: "vdr-page-detail-sidebar" }, { kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "directive", type: i1.CardControlsDirective, selector: "[vdrCardControls]" }, { kind: "component", type: LineFulfillmentComponent, selector: "vdr-line-fulfillment", inputs: ["line", "allOrderFulfillments", "orderState"] }, { kind: "component", type: LineRefundsComponent, selector: "vdr-line-refunds", inputs: ["line", "payments"] }, { kind: "component", type: CouponCodeSelectorComponent, selector: "vdr-coupon-code-selector", inputs: ["couponCodes", "control"], outputs: ["addCouponCode", "removeCouponCode"] }, { kind: "component", type: OrderModificationSummaryComponent, selector: "vdr-order-modification-summary", inputs: ["orderSnapshot", "modifyOrderInput", "addedLines", "shippingAddressForm", "billingAddressForm", "updatedShippingMethods", "couponCodesControl"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.CustomFieldLabelPipe, name: "customFieldLabel" }, { kind: "pipe", type: i1.AssetPreviewPipe, name: "assetPreview" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3183
|
+
}
|
|
3184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderEditorComponent, decorators: [{
|
|
3185
|
+
type: Component,
|
|
3186
|
+
args: [{ selector: 'vdr-order-editor', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-page-block>\n <vdr-action-bar *ngIf=\"entity$ | async as order\">\n <vdr-ab-left>\n <div class=\"flex clr-align-items-center\"></div>\n </vdr-ab-left>\n\n <vdr-ab-right>\n <button class=\"btn btn-secondary\" (click)=\"transitionToPriorState(order)\">\n {{ 'order.cancel-modification' | translate }}\n </button>\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n\n<vdr-page-detail-layout *ngIf=\"entity as order\">\n <vdr-page-detail-sidebar>\n <vdr-card [title]=\"'order.modification-summary' | translate\">\n <vdr-order-modification-summary\n [orderSnapshot]=\"orderSnapshot\"\n [modifyOrderInput]=\"modifyOrderInput\"\n [addedLines]=\"addedLines\"\n [shippingAddressForm]=\"shippingAddressForm\"\n [billingAddressForm]=\"billingAddressForm\"\n [couponCodesControl]=\"couponCodesControl\"\n [updatedShippingMethods]=\"updatedShippingMethods\"\n ></vdr-order-modification-summary>\n\n <div *ngIf=\"!hasModifications()\" class=\"no-modifications\">\n {{ 'order.no-modifications-made' | translate }}\n </div>\n\n <div class=\"summary-controls\">\n <vdr-form-field [label]=\"'order.note' | translate\">\n <textarea\n [(ngModel)]=\"note\"\n name=\"note\"\n required\n [disabled]=\"!hasModifications()\"\n ></textarea>\n </vdr-form-field>\n <label class=\"flex items-center\">\n <input\n type=\"checkbox\"\n [(ngModel)]=\"recalculateShipping\"\n [disabled]=\"!hasModifications()\"\n />\n <div class=\"ml-1\">{{ 'order.modification-recalculate-shipping' | translate }}</div>\n </label>\n <button\n class=\"btn btn-primary mt-2\"\n [disabled]=\"!hasModifications()\"\n (click)=\"previewAndModify(order)\"\n >\n {{ 'order.preview-changes' | translate }}\n </button>\n </div>\n </vdr-card>\n <vdr-card [title]=\"'order.set-coupon-codes' | translate\">\n <vdr-coupon-code-selector [control]=\"couponCodesControl\"></vdr-coupon-code-selector>\n </vdr-card>\n <vdr-card [title]=\"'order.shipping-address' | translate\">\n <ng-template vdrCardControls>\n <button\n class=\"button-small\"\n [title]=\"'order.edit-shipping-address' | translate\"\n (click)=\"editingShippingAddress = !editingShippingAddress\"\n >\n <clr-icon shape=\"edit\"></clr-icon>\n </button>\n </ng-template>\n <vdr-formatted-address\n *ngIf=\"!editingShippingAddress\"\n [address]=\"shippingAddressForm.value\"\n ></vdr-formatted-address>\n <vdr-address-form\n *ngIf=\"editingShippingAddress\"\n [formGroup]=\"shippingAddressForm\"\n [availableCountries]=\"availableCountries$ | async\"\n [customFields]=\"addressCustomFields\"\n ></vdr-address-form>\n </vdr-card>\n <vdr-card [title]=\"'order.billing-address' | translate\">\n <ng-template vdrCardControls>\n <button\n class=\"button-small\"\n [title]=\"'order.edit-billing-address' | translate\"\n (click)=\"editingBillingAddress = !editingBillingAddress\"\n >\n <clr-icon shape=\"edit\"></clr-icon>\n </button>\n </ng-template>\n <vdr-formatted-address\n *ngIf=\"!editingBillingAddress\"\n [address]=\"billingAddressForm.value\"\n ></vdr-formatted-address>\n <vdr-address-form\n *ngIf=\"editingBillingAddress\"\n [formGroup]=\"billingAddressForm\"\n [availableCountries]=\"availableCountries$ | async\"\n [customFields]=\"addressCustomFields\"\n ></vdr-address-form>\n </vdr-card>\n </vdr-page-detail-sidebar>\n\n <vdr-page-block>\n <vdr-card [paddingX]=\"false\">\n <vdr-data-table-2 id=\"modify-order\" class=\"order-table\" [items]=\"order.lines.concat(addedLines)\">\n <!-- Here we define all the available columns -->\n <vdr-dt2-column id=\"id\" [heading]=\"'common.id' | translate\" [hiddenByDefault]=\"true\">\n <ng-template let-line=\"item\">\n {{ line.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"created-at\"\n [heading]=\"'common.created-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"updated-at\"\n [heading]=\"'common.updated-at' | translate\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\">\n {{ line.updatedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.image' | translate\" id=\"image\">\n <ng-template let-line=\"item\">\n <div class=\"image-placeholder\">\n <img\n *ngIf=\"line.featuredAsset as asset; else imagePlaceholder\"\n [src]=\"asset | assetPreview : 'tiny'\"\n />\n <ng-template #imagePlaceholder>\n <div class=\"placeholder\">\n <clr-icon shape=\"image\" size=\"48\"></clr-icon>\n </div>\n </ng-template>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n id=\"product-name\"\n [heading]=\"'order.product-name' | translate\"\n [optional]=\"false\"\n >\n <ng-template let-line=\"item\">\n {{ line.productVariant.name }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"product-sku\" [heading]=\"'order.product-sku' | translate\">\n <ng-template let-line=\"item\">\n {{ line.productVariant.sku }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"unit-price\" [heading]=\"'order.unit-price' | translate\">\n <ng-template let-line=\"item\">\n <div class=\"text-center\">\n <div>{{ line.unitPriceWithTax | localeCurrency : order.currencyCode }}</div>\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\n {{ line.unitPrice | localeCurrency : order.currencyCode }}\n </div>\n </div>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column id=\"quantity\" [heading]=\"'order.quantity' | translate\" [optional]=\"false\">\n <ng-template let-line=\"item\">\n <input\n type=\"number\"\n class=\"draft-qty mr-1\"\n min=\"0\"\n [value]=\"getInitialLineQuantity(line.id)\"\n (input)=\"updateLineQuantity(line, $event.target.value)\"\n />\n <button\n class=\"button-small\"\n *ngIf=\"isAddedLine(line)\"\n (click)=\"removeAddedItem(line.id)\"\n >\n <clr-icon shape=\"trash\"></clr-icon>\n </button>\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\n <vdr-line-fulfillment\n [line]=\"line\"\n [allOrderFulfillments]=\"order.fulfillments\"\n [orderState]=\"order.state\"\n ></vdr-line-fulfillment>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column\n *ngFor=\"let customField of orderLineCustomFields\"\n [id]=\"customField.name\"\n [heading]=\"customField | customFieldLabel : (uiLanguage$ | async)\"\n [hiddenByDefault]=\"true\"\n >\n <ng-template let-line=\"item\" let-index=\"index\">\n <vdr-custom-field-control\n [compact]=\"true\"\n [entityName]=\"'OrderLine'\"\n [customField]=\"customField\"\n [customFieldsFormGroup]=\"orderLineCustomFieldsFormArray.at(index)\"\n />\n </ng-template>\n </vdr-dt2-column>\n </vdr-data-table-2>\n </vdr-card>\n <vdr-card [title]=\"'order.add-item-to-order' | translate\">\n <vdr-product-variant-selector class=\"mb-4\" (productSelected)=\"addItemSelectedVariant = $event\">\n </vdr-product-variant-selector>\n <div class=\"flex\">\n <div>\n <div *ngIf=\"addItemSelectedVariant\" class=\"flex mb-4\">\n <img\n *ngIf=\"addItemSelectedVariant.productAsset as asset\"\n [src]=\"asset | assetPreview : 'tiny'\"\n class=\"mr-4 add-item-thumb\"\n />\n <div>\n <strong class=\"mr-4\">{{ addItemSelectedVariant.productVariantName }}</strong>\n <small>{{ addItemSelectedVariant.sku }}</small>\n <div>\n {{\n getSelectedItemPrice(addItemSelectedVariant)\n | localeCurrency : order.currencyCode\n }}\n </div>\n </div>\n </div>\n <div class=\"form-grid\" *ngIf=\"addItemSelectedVariant\">\n <ng-container *ngFor=\"let customField of orderLineCustomFields\">\n <vdr-custom-field-control\n [readonly]=\"!addItemSelectedVariant\"\n [customField]=\"customField\"\n [customFieldsFormGroup]=\"addItemCustomFieldsForm\"\n entityName=\"OrderLine\"\n [compact]=\"true\"\n ></vdr-custom-field-control>\n </ng-container>\n </div>\n </div>\n <div class=\"flex-spacer\"></div>\n <div>\n <button\n *ngIf=\"addItemSelectedVariant\"\n class=\"btn btn-secondary\"\n [disabled]=\"!addItemSelectedVariant || addItemCustomFieldsForm.invalid\"\n (click)=\"addItemToOrder(addItemSelectedVariant)\"\n >\n {{ 'order.add-item-to-order' | translate }}\n </button>\n </div>\n </div>\n </vdr-card>\n <vdr-card [title]=\"'order.shipping' | translate\">\n <div *ngFor=\"let shippingLine of order.shippingLines\" class=\"flex items-center\">\n <ng-container *ngIf=\"getShippingLineDetails(shippingLine) as details\">\n <div>{{ details.name }}:</div>\n <div class=\"mx-1\">\n {{ details.price | localeCurrency : order.currencyCode }}\n </div>\n <button class=\"button-small\" (click)=\"setShippingMethod(shippingLine.id)\">\n {{ 'order.set-shipping-method' | translate }}\n </button>\n </ng-container>\n </div>\n </vdr-card>\n <vdr-card [title]=\"'order.add-surcharge' | translate\">\n <form [formGroup]=\"surchargeForm\" (submit)=\"addSurcharge(surchargeForm.value)\">\n <div class=\"form-grid\">\n <vdr-form-field [label]=\"'common.description' | translate\" for=\"description\"\n ><input id=\"description\" type=\"text\" formControlName=\"description\"\n /></vdr-form-field>\n <vdr-form-field [label]=\"'order.product-sku' | translate\" for=\"sku\"\n ><input id=\"sku\" type=\"text\" formControlName=\"sku\"\n /></vdr-form-field>\n <vdr-form-field [label]=\"'common.price' | translate\" for=\"price\">\n <vdr-currency-input\n [currencyCode]=\"order.currencyCode\"\n id=\"price\"\n formControlName=\"price\"\n ></vdr-currency-input>\n </vdr-form-field>\n <vdr-form-field\n [label]=\"\n 'catalog.price-includes-tax-at'\n | translate : { rate: surchargeForm.get('taxRate')?.value ?? 0 }\n \"\n for=\"priceIncludesTax\"\n ><input\n id=\"priceIncludesTax\"\n type=\"checkbox\"\n clrCheckbox\n formControlName=\"priceIncludesTax\"\n /></vdr-form-field>\n <vdr-form-field [label]=\"'order.tax-rate' | translate\" for=\"taxRate\">\n <vdr-affixed-input suffix=\"%\"\n ><input id=\"taxRate\" type=\"number\" min=\"0\" max=\"100\" formControlName=\"taxRate\"\n /></vdr-affixed-input>\n </vdr-form-field>\n <vdr-form-field [label]=\"'order.tax-description' | translate\" for=\"taxDescription\"\n ><input id=\"taxDescription\" type=\"text\" formControlName=\"taxDescription\"\n /></vdr-form-field>\n </div>\n <button\n class=\"btn btn-secondary mt-2\"\n [disabled]=\"\n surchargeForm.invalid ||\n surchargeForm.pristine ||\n surchargeForm.get('price')?.value === 0 ||\n !surchargeForm.get('description')?.value\n \"\n >\n {{ 'order.add-surcharge' | translate }}\n </button>\n </form>\n </vdr-card>\n </vdr-page-block>\n</vdr-page-detail-layout>\n", styles: [".order-table .is-cancelled td{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table .sub-total td{border-top:1px dashed var(--color-component-border-200)}.order-table .total td{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table td.custom-fields-row{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table img{border-radius:var(--border-radius-img)}.order-table .order-line-custom-fields{display:flex;flex-wrap:wrap}.order-table .order-line-custom-fields .custom-field{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}.order-table .draft-qty{max-width:48px}.order-table .order-line-custom-field{background-color:var(--color-component-bg-100)}.order-table .order-line-custom-field .custom-field-ellipsis{color:var(--color-text-300)}.order-table .net-price{font-size:11px;color:var(--color-text-300);line-height:14px}.order-table .promotions-label{text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table .thumb img{width:50px;height:50px}.order-table .shipping-method-name{font-size:var(--font-size-xs);margin-inline-end:2px}.order-table .order-placed-quantity{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.order-table tr.modified td{background-color:var(--color-warning-100)}.order-table .order-line-custom-field{text-align:start}.add-item-thumb{max-width:50px}.no-modifications{color:var(--color-grey-400)}.summary-controls{border-top:1px solid var(--color-weight-200);margin-top:calc(var(--space-unit) * 2);padding-top:calc(var(--space-unit) * 1)}\n"] }]
|
|
3187
|
+
}], ctorParameters: () => [{ type: i1.DataService }, { type: i1.NotificationService }, { type: i1.ModalService }, { type: OrderTransitionService }, { type: i0.ChangeDetectorRef }] });
|
|
3188
|
+
|
|
3189
|
+
class OrderListComponent extends TypedBaseListComponent {
|
|
3190
|
+
constructor(serverConfigService, channelService) {
|
|
3191
|
+
super();
|
|
3192
|
+
this.serverConfigService = serverConfigService;
|
|
3193
|
+
this.channelService = channelService;
|
|
3194
|
+
this.orderStates = this.serverConfigService.getOrderProcessStates().map(item => item.name);
|
|
3195
|
+
this.OrderType = OrderType;
|
|
3196
|
+
this.customFields = this.getCustomFieldConfig('Order');
|
|
3197
|
+
this.filters = this.createFilterCollection()
|
|
3198
|
+
.addIdFilter()
|
|
3199
|
+
.addDateFilters()
|
|
3200
|
+
.addFilter({
|
|
3201
|
+
name: 'active',
|
|
3202
|
+
type: { kind: 'boolean' },
|
|
3203
|
+
label: marker('order.filter-is-active'),
|
|
3204
|
+
filterField: 'active',
|
|
3205
|
+
})
|
|
3206
|
+
.addFilter({
|
|
3207
|
+
name: 'totalWithTax',
|
|
3208
|
+
type: { kind: 'number', inputType: 'currency', currencyCode: 'USD' },
|
|
3209
|
+
label: marker('order.total'),
|
|
3210
|
+
filterField: 'totalWithTax',
|
|
3211
|
+
})
|
|
3212
|
+
.addFilter({
|
|
3213
|
+
name: 'state',
|
|
3214
|
+
type: {
|
|
3215
|
+
kind: 'select',
|
|
3216
|
+
options: this.orderStates.map(s => ({ value: s, label: getOrderStateTranslationToken(s) })),
|
|
3217
|
+
},
|
|
3218
|
+
label: marker('order.state'),
|
|
3219
|
+
filterField: 'state',
|
|
3220
|
+
})
|
|
3221
|
+
.addFilter({
|
|
3222
|
+
name: 'type',
|
|
3223
|
+
type: {
|
|
3224
|
+
kind: 'select',
|
|
3225
|
+
options: [
|
|
3226
|
+
{ value: OrderType.Regular, label: marker('order.order-type-regular') },
|
|
3227
|
+
{ value: OrderType.Aggregate, label: marker('order.order-type-aggregate') },
|
|
3228
|
+
{ value: OrderType.Seller, label: marker('order.order-type-seller') },
|
|
3229
|
+
],
|
|
3230
|
+
},
|
|
3231
|
+
label: marker('order.order-type'),
|
|
3232
|
+
filterField: 'type',
|
|
3233
|
+
})
|
|
3234
|
+
.addFilter({
|
|
3235
|
+
name: 'orderPlacedAt',
|
|
3236
|
+
type: { kind: 'dateRange' },
|
|
3237
|
+
label: marker('order.placed-at'),
|
|
3238
|
+
filterField: 'orderPlacedAt',
|
|
3239
|
+
})
|
|
3240
|
+
.addFilter({
|
|
3241
|
+
name: 'customerLastName',
|
|
3242
|
+
type: { kind: 'text' },
|
|
3243
|
+
label: marker('customer.last-name'),
|
|
3244
|
+
filterField: 'customerLastName',
|
|
3245
|
+
})
|
|
3246
|
+
.addFilter({
|
|
3247
|
+
name: 'transactionId',
|
|
3248
|
+
type: { kind: 'text' },
|
|
3249
|
+
label: marker('order.transaction-id'),
|
|
3250
|
+
filterField: 'transactionId',
|
|
3251
|
+
})
|
|
3252
|
+
.addCustomFieldFilters(this.customFields)
|
|
3253
|
+
.connectToRoute(this.route);
|
|
3254
|
+
this.sorts = this.createSortCollection()
|
|
3255
|
+
.defaultSort('updatedAt', 'DESC')
|
|
3256
|
+
.addSort({ name: 'id' })
|
|
3257
|
+
.addSort({ name: 'createdAt' })
|
|
3258
|
+
.addSort({ name: 'updatedAt' })
|
|
3259
|
+
.addSort({ name: 'orderPlacedAt' })
|
|
3260
|
+
.addSort({ name: 'customerLastName' })
|
|
3261
|
+
.addSort({ name: 'state' })
|
|
3262
|
+
.addSort({ name: 'totalWithTax' })
|
|
3263
|
+
.addCustomFieldSorts(this.customFields)
|
|
3264
|
+
.connectToRoute(this.route);
|
|
3265
|
+
this.canCreateDraftOrder = false;
|
|
3266
|
+
this.activeChannelIsDefaultChannel = false;
|
|
3267
|
+
super.configure({
|
|
3268
|
+
document: GetOrderListDocument,
|
|
3269
|
+
getItems: result => result.orders,
|
|
3270
|
+
setVariables: (skip, take) => this.createQueryOptions(skip, take, this.searchTermControl.value),
|
|
3271
|
+
refreshListOnChanges: [this.filters.valueChanges, this.sorts.valueChanges],
|
|
3272
|
+
});
|
|
3273
|
+
this.canCreateDraftOrder = !!this.serverConfigService
|
|
3274
|
+
.getOrderProcessStates()
|
|
3275
|
+
.find(state => state.name === 'Created')
|
|
3276
|
+
?.to.includes('Draft');
|
|
3277
|
+
}
|
|
3278
|
+
ngOnInit() {
|
|
3279
|
+
super.ngOnInit();
|
|
3280
|
+
const isDefaultChannel$ = this.channelService.defaultChannelIsActive$.pipe(tap(isDefault => (this.activeChannelIsDefaultChannel = isDefault)));
|
|
3281
|
+
super.refreshListOnChanges(this.filters.valueChanges, this.sorts.valueChanges, isDefaultChannel$);
|
|
3282
|
+
}
|
|
3283
|
+
createQueryOptions(
|
|
3284
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
3285
|
+
skip, take, searchTerm) {
|
|
3286
|
+
let filterInput = this.filters.createFilterInput();
|
|
3287
|
+
if (this.activeChannelIsDefaultChannel) {
|
|
3288
|
+
filterInput = {
|
|
3289
|
+
...(filterInput ?? {}),
|
|
3290
|
+
};
|
|
3291
|
+
}
|
|
3292
|
+
if (searchTerm) {
|
|
3293
|
+
filterInput = {
|
|
3294
|
+
code: {
|
|
3295
|
+
contains: searchTerm,
|
|
3296
|
+
},
|
|
3297
|
+
customerLastName: {
|
|
3298
|
+
contains: searchTerm,
|
|
3299
|
+
},
|
|
3300
|
+
transactionId: {
|
|
3301
|
+
contains: searchTerm,
|
|
3302
|
+
},
|
|
3303
|
+
};
|
|
3304
|
+
}
|
|
3305
|
+
return {
|
|
3306
|
+
options: {
|
|
3307
|
+
skip,
|
|
3308
|
+
take,
|
|
3309
|
+
filter: {
|
|
3310
|
+
...(filterInput ?? {}),
|
|
3311
|
+
},
|
|
3312
|
+
filterOperator: searchTerm ? LogicalOperator.OR : LogicalOperator.AND,
|
|
3313
|
+
sort: this.sorts.createSortInput(),
|
|
3314
|
+
},
|
|
3315
|
+
};
|
|
3316
|
+
}
|
|
3317
|
+
getShippingNames(order) {
|
|
3318
|
+
if (order.shippingLines.length) {
|
|
3319
|
+
return order.shippingLines.map(shippingLine => shippingLine.shippingMethod.name).join(', ');
|
|
3320
|
+
}
|
|
3321
|
+
else {
|
|
3322
|
+
return '';
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderListComponent, deps: [{ token: i1.ServerConfigService }, { token: i1.ChannelService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3326
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: OrderListComponent, selector: "vdr-order-list", usesInheritance: true, ngImport: i0, template: "<vdr-page-block>\n <vdr-action-bar>\n <vdr-ab-right>\n <vdr-action-bar-items locationId=\"order-list\" />\n <ng-container *ngIf=\"canCreateDraftOrder\">\n <a class=\"btn\" *vdrIfPermissions=\"['CreateOrder']\" [routerLink]=\"['./draft/create']\">\n <clr-icon shape=\"plus\"></clr-icon>\n {{ 'catalog.create-draft-order' | translate }}\n </a>\n </ng-container>\n <vdr-action-bar-dropdown-menu locationId=\"order-list\" />\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n<vdr-data-table-2\n class=\"mt-2\"\n id=\"order-list\"\n [items]=\"items$ | async\"\n [itemsPerPage]=\"itemsPerPage$ | async\"\n [totalItems]=\"totalItems$ | async\"\n [currentPage]=\"currentPage$ | async\"\n [filters]=\"filters\"\n (pageChange)=\"setPageNumber($event)\"\n (itemsPerPageChange)=\"setItemsPerPage($event)\"\n>\n <vdr-bulk-action-menu\n locationId=\"order-list\"\n [hostComponent]=\"this\"\n [selectionManager]=\"selectionManager\"\n ></vdr-bulk-action-menu>\n <vdr-dt2-search\n [searchTermControl]=\"searchTermControl\"\n [searchTermPlaceholder]=\"'order.search-by-order-filters' | translate\"\n />\n <vdr-dt2-column [heading]=\"'common.id' | translate\" id=\"id\" [hiddenByDefault]=\"true\" [sort]=\"sorts.get('id')\">\n <ng-template let-order=\"item\">\n {{ order.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.created-at' | translate\" id=\"created-at\" [hiddenByDefault]=\"true\">\n <ng-template let-order=\"item\">\n {{ order.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.code' | translate\" id=\"code\" [optional]=\"false\">\n <ng-template let-order=\"item\">\n <a class=\"button-ghost\" [routerLink]=\"order.state === 'Draft' ? ['./draft', order.id] : ['./', order.id]\"\n ><span>{{ order.code }}</span>\n <clr-icon shape=\"arrow right\"></clr-icon>\n </a>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.customer' | translate\" id=\"customer\" [sort]=\"sorts.get('customerLastName')\">\n <ng-template let-order=\"item\">\n <vdr-customer-label\n [customer]=\"order.customer\"\n (click)=\"$event.stopPropagation()\"\n ></vdr-customer-label>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.order-type' | translate\" id=\"order-type\" [hiddenByDefault]=\"true\">\n <ng-template let-order=\"item\">\n <vdr-chip *ngIf=\"order.type === OrderType.Regular\">{{ 'order.order-type-regular' | translate }}</vdr-chip>\n <vdr-chip *ngIf=\"order.type === OrderType.Aggregate\">{{ 'order.order-type-aggregate' | translate }}</vdr-chip>\n <vdr-chip *ngIf=\"order.type === OrderType.Seller\">{{ 'order.order-type-seller' | translate }}</vdr-chip>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.state' | translate\" id=\"state\" [sort]=\"sorts.get('state')\">\n <ng-template let-order=\"item\">\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.total' | translate\" id=\"total\" [sort]=\"sorts.get('totalWithTax')\">\n <ng-template let-order=\"item\">\n {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.updated-at' | translate\" id=\"updated-at\">\n <ng-template let-order=\"item\">\n {{ order.updatedAt | timeAgo }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.placed-at' | translate\" id=\"placed-at\" [sort]=\"sorts.get('orderPlacedAt')\">\n <ng-template let-order=\"item\">\n {{ order.orderPlacedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.shipping' | translate\" id=\"shipping\">\n <ng-template let-order=\"item\">\n {{ getShippingNames(order) }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-custom-field-column\n *ngFor=\"let customField of customFields\"\n [customField]=\"customField\"\n [sorts]=\"sorts\"\n />\n</vdr-data-table-2>\n", styles: [".search-form{display:flex;flex-direction:column;align-items:baseline;width:100%;max-width:100vw;margin-bottom:6px}.filter-presets{max-width:90vw;overflow-x:auto}.search-input{margin-top:6px;min-width:300px}.custom-filters{overflow:hidden;max-height:0;padding-bottom:6px}.custom-filters.expanded{max-height:initial}.custom-filters>form{display:flex;flex-direction:column;align-items:center}.custom-filters>form>div{width:100%}ng-select{flex:1;min-width:200px;height:36px}ng-select ::ng-deep .ng-select-container{height:36px}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.ActionBarComponent, selector: "vdr-action-bar" }, { kind: "component", type: i1.ActionBarRightComponent, selector: "vdr-ab-right", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarDropdownMenuComponent, selector: "vdr-action-bar-dropdown-menu", inputs: ["alwaysShow"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "component", type: i1.CustomerLabelComponent, selector: "vdr-customer-label", inputs: ["customer"] }, { kind: "component", type: i1.OrderStateLabelComponent, selector: "vdr-order-state-label", inputs: ["state"] }, { kind: "directive", type: i1.IfPermissionsDirective, selector: "[vdrIfPermissions]", inputs: ["vdrIfPermissions", "vdrIfPermissionsElse"] }, { kind: "component", type: i1.ActionBarItemsComponent, selector: "vdr-action-bar-items" }, { kind: "component", type: i1.BulkActionMenuComponent, selector: "vdr-bulk-action-menu", inputs: ["locationId", "selectionManager", "hostComponent"] }, { kind: "component", type: i1.DataTable2Component, selector: "vdr-data-table-2", inputs: ["id", "items", "itemsPerPage", "currentPage", "totalItems", "emptyStateLabel", "filters", "activeIndex"], outputs: ["pageChange", "itemsPerPageChange"] }, { kind: "component", type: i1.DataTable2ColumnComponent, selector: "vdr-dt2-column", inputs: ["id", "expand", "heading", "align", "sort", "optional", "hiddenByDefault", "orderable"], exportAs: ["row"] }, { kind: "component", type: i1.DataTable2SearchComponent, selector: "vdr-dt2-search", inputs: ["searchTermControl", "searchTermPlaceholder"] }, { kind: "component", type: i1.DataTableCustomFieldColumnComponent, selector: "vdr-dt2-custom-field-column", inputs: ["customField", "sorts"], exportAs: ["row"] }, { kind: "component", type: i1.PageBlockComponent, selector: "vdr-page-block" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.TimeAgoPipe, name: "timeAgo" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3327
|
+
}
|
|
3328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderListComponent, decorators: [{
|
|
3329
|
+
type: Component,
|
|
3330
|
+
args: [{ selector: 'vdr-order-list', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-page-block>\n <vdr-action-bar>\n <vdr-ab-right>\n <vdr-action-bar-items locationId=\"order-list\" />\n <ng-container *ngIf=\"canCreateDraftOrder\">\n <a class=\"btn\" *vdrIfPermissions=\"['CreateOrder']\" [routerLink]=\"['./draft/create']\">\n <clr-icon shape=\"plus\"></clr-icon>\n {{ 'catalog.create-draft-order' | translate }}\n </a>\n </ng-container>\n <vdr-action-bar-dropdown-menu locationId=\"order-list\" />\n </vdr-ab-right>\n </vdr-action-bar>\n</vdr-page-block>\n<vdr-data-table-2\n class=\"mt-2\"\n id=\"order-list\"\n [items]=\"items$ | async\"\n [itemsPerPage]=\"itemsPerPage$ | async\"\n [totalItems]=\"totalItems$ | async\"\n [currentPage]=\"currentPage$ | async\"\n [filters]=\"filters\"\n (pageChange)=\"setPageNumber($event)\"\n (itemsPerPageChange)=\"setItemsPerPage($event)\"\n>\n <vdr-bulk-action-menu\n locationId=\"order-list\"\n [hostComponent]=\"this\"\n [selectionManager]=\"selectionManager\"\n ></vdr-bulk-action-menu>\n <vdr-dt2-search\n [searchTermControl]=\"searchTermControl\"\n [searchTermPlaceholder]=\"'order.search-by-order-filters' | translate\"\n />\n <vdr-dt2-column [heading]=\"'common.id' | translate\" id=\"id\" [hiddenByDefault]=\"true\" [sort]=\"sorts.get('id')\">\n <ng-template let-order=\"item\">\n {{ order.id }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.created-at' | translate\" id=\"created-at\" [hiddenByDefault]=\"true\">\n <ng-template let-order=\"item\">\n {{ order.createdAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.code' | translate\" id=\"code\" [optional]=\"false\">\n <ng-template let-order=\"item\">\n <a class=\"button-ghost\" [routerLink]=\"order.state === 'Draft' ? ['./draft', order.id] : ['./', order.id]\"\n ><span>{{ order.code }}</span>\n <clr-icon shape=\"arrow right\"></clr-icon>\n </a>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.customer' | translate\" id=\"customer\" [sort]=\"sorts.get('customerLastName')\">\n <ng-template let-order=\"item\">\n <vdr-customer-label\n [customer]=\"order.customer\"\n (click)=\"$event.stopPropagation()\"\n ></vdr-customer-label>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.order-type' | translate\" id=\"order-type\" [hiddenByDefault]=\"true\">\n <ng-template let-order=\"item\">\n <vdr-chip *ngIf=\"order.type === OrderType.Regular\">{{ 'order.order-type-regular' | translate }}</vdr-chip>\n <vdr-chip *ngIf=\"order.type === OrderType.Aggregate\">{{ 'order.order-type-aggregate' | translate }}</vdr-chip>\n <vdr-chip *ngIf=\"order.type === OrderType.Seller\">{{ 'order.order-type-seller' | translate }}</vdr-chip>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.state' | translate\" id=\"state\" [sort]=\"sorts.get('state')\">\n <ng-template let-order=\"item\">\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.total' | translate\" id=\"total\" [sort]=\"sorts.get('totalWithTax')\">\n <ng-template let-order=\"item\">\n {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'common.updated-at' | translate\" id=\"updated-at\">\n <ng-template let-order=\"item\">\n {{ order.updatedAt | timeAgo }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.placed-at' | translate\" id=\"placed-at\" [sort]=\"sorts.get('orderPlacedAt')\">\n <ng-template let-order=\"item\">\n {{ order.orderPlacedAt | localeDate : 'short' }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-column [heading]=\"'order.shipping' | translate\" id=\"shipping\">\n <ng-template let-order=\"item\">\n {{ getShippingNames(order) }}\n </ng-template>\n </vdr-dt2-column>\n <vdr-dt2-custom-field-column\n *ngFor=\"let customField of customFields\"\n [customField]=\"customField\"\n [sorts]=\"sorts\"\n />\n</vdr-data-table-2>\n", styles: [".search-form{display:flex;flex-direction:column;align-items:baseline;width:100%;max-width:100vw;margin-bottom:6px}.filter-presets{max-width:90vw;overflow-x:auto}.search-input{margin-top:6px;min-width:300px}.custom-filters{overflow:hidden;max-height:0;padding-bottom:6px}.custom-filters.expanded{max-height:initial}.custom-filters>form{display:flex;flex-direction:column;align-items:center}.custom-filters>form>div{width:100%}ng-select{flex:1;min-width:200px;height:36px}ng-select ::ng-deep .ng-select-container{height:36px}\n"] }]
|
|
3331
|
+
}], ctorParameters: () => [{ type: i1.ServerConfigService }, { type: i1.ChannelService }] });
|
|
3332
|
+
|
|
3333
|
+
class RefundDetailComponent {
|
|
3334
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RefundDetailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3335
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: RefundDetailComponent, selector: "vdr-refund-detail", inputs: { refund: "refund", currencyCode: "currencyCode" }, ngImport: i0, template: "<vdr-labeled-data [label]=\"'order.amount' | translate\">\n {{ refund.total | localeCurrency: currencyCode }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"refund.transactionId\" [label]=\"'order.transaction-id' | translate\">\n {{ refund.transactionId }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.payment-metadata' | translate\">\n <vdr-object-tree [value]=\"refund.metadata\"></vdr-object-tree>\n</vdr-labeled-data>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.ObjectTreeComponent, selector: "vdr-object-tree", inputs: ["value", "isArrayItem"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3336
|
+
}
|
|
3337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RefundDetailComponent, decorators: [{
|
|
3338
|
+
type: Component,
|
|
3339
|
+
args: [{ selector: 'vdr-refund-detail', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-labeled-data [label]=\"'order.amount' | translate\">\n {{ refund.total | localeCurrency: currencyCode }}\n</vdr-labeled-data>\n<vdr-labeled-data *ngIf=\"refund.transactionId\" [label]=\"'order.transaction-id' | translate\">\n {{ refund.transactionId }}\n</vdr-labeled-data>\n<vdr-labeled-data [label]=\"'order.payment-metadata' | translate\">\n <vdr-object-tree [value]=\"refund.metadata\"></vdr-object-tree>\n</vdr-labeled-data>\n" }]
|
|
3340
|
+
}], propDecorators: { refund: [{
|
|
3341
|
+
type: Input
|
|
3342
|
+
}], currencyCode: [{
|
|
3343
|
+
type: Input
|
|
3344
|
+
}] } });
|
|
3345
|
+
|
|
3346
|
+
const GET_CUSTOMER_ADDRESSES = gql `
|
|
3347
|
+
query GetCustomerAddresses($customerId: ID!) {
|
|
3348
|
+
customer(id: $customerId) {
|
|
3349
|
+
id
|
|
3350
|
+
addresses {
|
|
3351
|
+
...Address
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
${ADDRESS_FRAGMENT}
|
|
3356
|
+
`;
|
|
3357
|
+
|
|
3358
|
+
const GET_ORDER_STATE = gql `
|
|
3359
|
+
query GetOrderState($id: ID!) {
|
|
3360
|
+
order(id: $id) {
|
|
3361
|
+
id
|
|
3362
|
+
state
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
`;
|
|
3366
|
+
class OrderGuard {
|
|
3367
|
+
constructor(dataService, router) {
|
|
3368
|
+
this.dataService = dataService;
|
|
3369
|
+
this.router = router;
|
|
3370
|
+
}
|
|
3371
|
+
canActivate(route, state) {
|
|
3372
|
+
const isDraft = state.url.includes('orders/draft');
|
|
3373
|
+
const isModifying = state.url.includes('/modify');
|
|
3374
|
+
const id = route.paramMap.get('id');
|
|
3375
|
+
if (isDraft) {
|
|
3376
|
+
if (id === 'create') {
|
|
3377
|
+
return this.dataService.order
|
|
3378
|
+
.createDraftOrder()
|
|
3379
|
+
.pipe(map(({ createDraftOrder }) => this.router.parseUrl(`/orders/draft/${createDraftOrder.id}`)));
|
|
3380
|
+
}
|
|
3381
|
+
else {
|
|
3382
|
+
return true;
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
else {
|
|
3386
|
+
return (this.dataService
|
|
3387
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3388
|
+
.query(GET_ORDER_STATE, { id: id })
|
|
3389
|
+
.single$.pipe(map(({ order }) => {
|
|
3390
|
+
if (order?.state === 'Modifying' && !isModifying) {
|
|
3391
|
+
return this.router.parseUrl(`/orders/${id}/modify`);
|
|
3392
|
+
}
|
|
3393
|
+
else {
|
|
3394
|
+
return true;
|
|
3395
|
+
}
|
|
3396
|
+
})));
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderGuard, deps: [{ token: i1.DataService }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3400
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderGuard, providedIn: 'root' }); }
|
|
3401
|
+
}
|
|
3402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderGuard, decorators: [{
|
|
3403
|
+
type: Injectable,
|
|
3404
|
+
args: [{
|
|
3405
|
+
providedIn: 'root',
|
|
3406
|
+
}]
|
|
3407
|
+
}], ctorParameters: () => [{ type: i1.DataService }, { type: i1$1.Router }] });
|
|
3408
|
+
|
|
3409
|
+
const createRoutes = (pageService) => [
|
|
3410
|
+
{
|
|
3411
|
+
path: '',
|
|
3412
|
+
component: PageComponent,
|
|
3413
|
+
pathMatch: 'full',
|
|
3414
|
+
data: {
|
|
3415
|
+
locationId: 'order-list',
|
|
3416
|
+
breadcrumb: marker('breadcrumb.orders'),
|
|
3417
|
+
},
|
|
3418
|
+
children: pageService.getPageTabRoutes('order-list'),
|
|
3419
|
+
},
|
|
3420
|
+
{
|
|
3421
|
+
path: 'draft/:id',
|
|
3422
|
+
component: PageComponent,
|
|
3423
|
+
canActivate: [OrderGuard],
|
|
3424
|
+
data: {
|
|
3425
|
+
locationId: 'draft-order-detail',
|
|
3426
|
+
breadcrumb: { label: marker('breadcrumb.orders'), link: ['../'] },
|
|
3427
|
+
},
|
|
3428
|
+
children: pageService.getPageTabRoutes('draft-order-detail'),
|
|
3429
|
+
},
|
|
3430
|
+
{
|
|
3431
|
+
path: ':id',
|
|
3432
|
+
component: PageComponent,
|
|
3433
|
+
canActivate: [OrderGuard],
|
|
3434
|
+
data: {
|
|
3435
|
+
locationId: 'order-detail',
|
|
3436
|
+
breadcrumb: { label: marker('breadcrumb.orders'), link: ['../'] },
|
|
3437
|
+
},
|
|
3438
|
+
children: pageService.getPageTabRoutes('order-detail'),
|
|
3439
|
+
},
|
|
3440
|
+
{
|
|
3441
|
+
path: ':aggregateOrderId/seller-orders/:id',
|
|
3442
|
+
component: PageComponent,
|
|
3443
|
+
canActivate: [OrderGuard],
|
|
3444
|
+
data: {
|
|
3445
|
+
locationId: 'order-detail',
|
|
3446
|
+
breadcrumb: { label: marker('breadcrumb.orders'), link: ['../'] },
|
|
3447
|
+
},
|
|
3448
|
+
children: pageService.getPageTabRoutes('order-detail'),
|
|
3449
|
+
},
|
|
3450
|
+
{
|
|
3451
|
+
path: ':id/modify',
|
|
3452
|
+
component: PageComponent,
|
|
3453
|
+
canActivate: [OrderGuard],
|
|
3454
|
+
data: {
|
|
3455
|
+
locationId: 'modify-order',
|
|
3456
|
+
breadcrumb: { label: marker('breadcrumb.orders'), link: ['../'] },
|
|
3457
|
+
},
|
|
3458
|
+
children: pageService.getPageTabRoutes('modify-order'),
|
|
3459
|
+
},
|
|
3460
|
+
];
|
|
3461
|
+
|
|
3462
|
+
class OrderModule {
|
|
3463
|
+
static { this.hasRegisteredTabsAndBulkActions = false; }
|
|
3464
|
+
constructor(pageService) {
|
|
3465
|
+
if (OrderModule.hasRegisteredTabsAndBulkActions) {
|
|
3466
|
+
return;
|
|
3467
|
+
}
|
|
3468
|
+
pageService.registerPageTab({
|
|
3469
|
+
priority: 0,
|
|
3470
|
+
location: 'order-list',
|
|
3471
|
+
tab: marker('order.orders'),
|
|
3472
|
+
route: '',
|
|
3473
|
+
component: OrderListComponent,
|
|
3474
|
+
});
|
|
3475
|
+
pageService.registerPageTab({
|
|
3476
|
+
priority: 0,
|
|
3477
|
+
location: 'order-detail',
|
|
3478
|
+
tab: marker('order.order'),
|
|
3479
|
+
route: '',
|
|
3480
|
+
component: detailComponentWithResolver({
|
|
3481
|
+
component: OrderDetailComponent,
|
|
3482
|
+
query: OrderDetailQueryDocument,
|
|
3483
|
+
entityKey: 'order',
|
|
3484
|
+
getBreadcrumbs: entity => entity?.type !== OrderType.Seller || !entity?.aggregateOrder
|
|
3485
|
+
? [
|
|
3486
|
+
{
|
|
3487
|
+
label: `${entity?.code}`,
|
|
3488
|
+
link: [entity?.id],
|
|
3489
|
+
},
|
|
3490
|
+
]
|
|
3491
|
+
: [
|
|
3492
|
+
{
|
|
3493
|
+
label: `${entity?.aggregateOrder?.code}`,
|
|
3494
|
+
link: ['/orders/', entity?.aggregateOrder?.id],
|
|
3495
|
+
},
|
|
3496
|
+
{
|
|
3497
|
+
label: marker('breadcrumb.seller-orders'),
|
|
3498
|
+
link: ['/orders/', entity?.aggregateOrder?.id],
|
|
3499
|
+
},
|
|
3500
|
+
{
|
|
3501
|
+
label: `${entity?.code}`,
|
|
3502
|
+
link: [entity?.id],
|
|
3503
|
+
},
|
|
3504
|
+
],
|
|
3505
|
+
}),
|
|
3506
|
+
});
|
|
3507
|
+
pageService.registerPageTab({
|
|
3508
|
+
priority: 0,
|
|
3509
|
+
location: 'draft-order-detail',
|
|
3510
|
+
tab: marker('order.order'),
|
|
3511
|
+
route: '',
|
|
3512
|
+
component: detailComponentWithResolver({
|
|
3513
|
+
component: DraftOrderDetailComponent,
|
|
3514
|
+
query: OrderDetailQueryDocument,
|
|
3515
|
+
entityKey: 'order',
|
|
3516
|
+
getBreadcrumbs: entity => [
|
|
3517
|
+
{
|
|
3518
|
+
label: marker('order.draft-order'),
|
|
3519
|
+
link: [entity?.id],
|
|
3520
|
+
},
|
|
3521
|
+
],
|
|
3522
|
+
}),
|
|
3523
|
+
});
|
|
3524
|
+
pageService.registerPageTab({
|
|
3525
|
+
priority: 0,
|
|
3526
|
+
location: 'modify-order',
|
|
3527
|
+
tab: marker('order.order'),
|
|
3528
|
+
route: '',
|
|
3529
|
+
component: detailComponentWithResolver({
|
|
3530
|
+
component: OrderEditorComponent,
|
|
3531
|
+
query: OrderDetailQueryDocument,
|
|
3532
|
+
entityKey: 'order',
|
|
3533
|
+
getBreadcrumbs: entity => [
|
|
3534
|
+
{
|
|
3535
|
+
label: entity?.code || 'order',
|
|
3536
|
+
link: ['/orders/', entity?.id],
|
|
3537
|
+
},
|
|
3538
|
+
{
|
|
3539
|
+
label: marker('breadcrumb.modifying-order'),
|
|
3540
|
+
link: [entity?.id],
|
|
3541
|
+
},
|
|
3542
|
+
],
|
|
3543
|
+
}),
|
|
3544
|
+
});
|
|
3545
|
+
OrderModule.hasRegisteredTabsAndBulkActions = true;
|
|
3546
|
+
}
|
|
3547
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderModule, deps: [{ token: i1.PageService }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3548
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: OrderModule, declarations: [OrderListComponent,
|
|
3549
|
+
OrderDetailComponent,
|
|
3550
|
+
FulfillOrderDialogComponent,
|
|
3551
|
+
LineFulfillmentComponent,
|
|
3552
|
+
RefundOrderDialogComponent,
|
|
3553
|
+
CancelOrderDialogComponent,
|
|
3554
|
+
PaymentStateLabelComponent,
|
|
3555
|
+
LineRefundsComponent,
|
|
3556
|
+
OrderPaymentCardComponent,
|
|
3557
|
+
RefundStateLabelComponent,
|
|
3558
|
+
SettleRefundDialogComponent,
|
|
3559
|
+
OrderHistoryComponent,
|
|
3560
|
+
FulfillmentDetailComponent,
|
|
3561
|
+
PaymentDetailComponent,
|
|
3562
|
+
SimpleItemListComponent,
|
|
3563
|
+
OrderCustomFieldsCardComponent,
|
|
3564
|
+
OrderProcessGraphComponent,
|
|
3565
|
+
OrderProcessNodeComponent,
|
|
3566
|
+
OrderProcessEdgeComponent,
|
|
3567
|
+
OrderProcessGraphDialogComponent,
|
|
3568
|
+
FulfillmentStateLabelComponent,
|
|
3569
|
+
FulfillmentCardComponent,
|
|
3570
|
+
OrderEditorComponent,
|
|
3571
|
+
OrderTableComponent,
|
|
3572
|
+
OrderEditsPreviewDialogComponent,
|
|
3573
|
+
ModificationDetailComponent,
|
|
3574
|
+
AddManualPaymentDialogComponent,
|
|
3575
|
+
OrderStateSelectDialogComponent,
|
|
3576
|
+
DraftOrderDetailComponent,
|
|
3577
|
+
DraftOrderVariantSelectorComponent,
|
|
3578
|
+
SelectCustomerDialogComponent,
|
|
3579
|
+
SelectAddressDialogComponent,
|
|
3580
|
+
CouponCodeSelectorComponent,
|
|
3581
|
+
SelectShippingMethodDialogComponent,
|
|
3582
|
+
OrderHistoryEntryHostComponent,
|
|
3583
|
+
SellerOrdersCardComponent,
|
|
3584
|
+
OrderDataTableComponent,
|
|
3585
|
+
OrderTotalColumnComponent,
|
|
3586
|
+
PaymentForRefundSelectorComponent,
|
|
3587
|
+
OrderModificationSummaryComponent,
|
|
3588
|
+
RefundDetailComponent], imports: [SharedModule, i1$1.RouterModule], exports: [OrderCustomFieldsCardComponent] }); }
|
|
3589
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderModule, providers: [
|
|
3590
|
+
{
|
|
3591
|
+
provide: ROUTES,
|
|
3592
|
+
useFactory: (pageService) => createRoutes(pageService),
|
|
3593
|
+
multi: true,
|
|
3594
|
+
deps: [PageService],
|
|
3595
|
+
},
|
|
3596
|
+
], imports: [SharedModule, RouterModule.forChild([])] }); }
|
|
3597
|
+
}
|
|
3598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderModule, decorators: [{
|
|
3599
|
+
type: NgModule,
|
|
3600
|
+
args: [{
|
|
3601
|
+
imports: [SharedModule, RouterModule.forChild([])],
|
|
3602
|
+
providers: [
|
|
3603
|
+
{
|
|
3604
|
+
provide: ROUTES,
|
|
3605
|
+
useFactory: (pageService) => createRoutes(pageService),
|
|
3606
|
+
multi: true,
|
|
3607
|
+
deps: [PageService],
|
|
3608
|
+
},
|
|
3609
|
+
],
|
|
3610
|
+
declarations: [
|
|
3611
|
+
OrderListComponent,
|
|
3612
|
+
OrderDetailComponent,
|
|
3613
|
+
FulfillOrderDialogComponent,
|
|
3614
|
+
LineFulfillmentComponent,
|
|
3615
|
+
RefundOrderDialogComponent,
|
|
3616
|
+
CancelOrderDialogComponent,
|
|
3617
|
+
PaymentStateLabelComponent,
|
|
3618
|
+
LineRefundsComponent,
|
|
3619
|
+
OrderPaymentCardComponent,
|
|
3620
|
+
RefundStateLabelComponent,
|
|
3621
|
+
SettleRefundDialogComponent,
|
|
3622
|
+
OrderHistoryComponent,
|
|
3623
|
+
FulfillmentDetailComponent,
|
|
3624
|
+
PaymentDetailComponent,
|
|
3625
|
+
SimpleItemListComponent,
|
|
3626
|
+
OrderCustomFieldsCardComponent,
|
|
3627
|
+
OrderProcessGraphComponent,
|
|
3628
|
+
OrderProcessNodeComponent,
|
|
3629
|
+
OrderProcessEdgeComponent,
|
|
3630
|
+
OrderProcessGraphDialogComponent,
|
|
3631
|
+
FulfillmentStateLabelComponent,
|
|
3632
|
+
FulfillmentCardComponent,
|
|
3633
|
+
OrderEditorComponent,
|
|
3634
|
+
OrderTableComponent,
|
|
3635
|
+
OrderEditsPreviewDialogComponent,
|
|
3636
|
+
ModificationDetailComponent,
|
|
3637
|
+
AddManualPaymentDialogComponent,
|
|
3638
|
+
OrderStateSelectDialogComponent,
|
|
3639
|
+
DraftOrderDetailComponent,
|
|
3640
|
+
DraftOrderVariantSelectorComponent,
|
|
3641
|
+
SelectCustomerDialogComponent,
|
|
3642
|
+
SelectAddressDialogComponent,
|
|
3643
|
+
CouponCodeSelectorComponent,
|
|
3644
|
+
SelectShippingMethodDialogComponent,
|
|
3645
|
+
OrderHistoryEntryHostComponent,
|
|
3646
|
+
SellerOrdersCardComponent,
|
|
3647
|
+
OrderDataTableComponent,
|
|
3648
|
+
OrderTotalColumnComponent,
|
|
3649
|
+
PaymentForRefundSelectorComponent,
|
|
3650
|
+
OrderModificationSummaryComponent,
|
|
3651
|
+
RefundDetailComponent,
|
|
3652
|
+
],
|
|
3653
|
+
exports: [OrderCustomFieldsCardComponent],
|
|
3654
|
+
}]
|
|
3655
|
+
}], ctorParameters: () => [{ type: i1.PageService }] });
|
|
3656
|
+
|
|
3657
|
+
// This file was generated by the build-public-api.ts script
|
|
3658
|
+
|
|
3659
|
+
/**
|
|
3660
|
+
* Generated bundle index. Do not edit.
|
|
3661
|
+
*/
|
|
3662
|
+
|
|
3663
|
+
export { AddManualPaymentDialogComponent, CancelOrderDialogComponent, CouponCodeSelectorComponent, DraftOrderDetailComponent, DraftOrderVariantSelectorComponent, FulfillOrderDialogComponent, FulfillmentCardComponent, FulfillmentDetailComponent, FulfillmentStateLabelComponent, GET_COUPON_CODE_SELECTOR_PROMOTION_LIST, GET_CUSTOMER_ADDRESSES, GET_ORDER_STATE, GET_SELLER_ORDERS, LineFulfillmentComponent, LineRefundsComponent, ModificationDetailComponent, NODE_HEIGHT, ORDER_DETAIL_QUERY, OrderCustomFieldsCardComponent, OrderDataTableComponent, OrderDetailComponent, OrderEditResultType, OrderEditorComponent, OrderEditsPreviewDialogComponent, OrderGuard, OrderHistoryComponent, OrderHistoryEntryHostComponent, OrderListComponent, OrderModificationSummaryComponent, OrderModule, OrderPaymentCardComponent, OrderProcessEdgeComponent, OrderProcessGraphComponent, OrderProcessGraphDialogComponent, OrderProcessNodeComponent, OrderStateSelectDialogComponent, OrderTableComponent, OrderTotalColumnComponent, OrderTransitionService, PaymentDetailComponent, PaymentForRefundSelectorComponent, PaymentStateLabelComponent, RefundDetailComponent, RefundOrderDialogComponent, RefundStateLabelComponent, SET_ORDER_CUSTOMER_MUTATION, SelectAddressDialogComponent, SelectCustomerDialogComponent, SelectShippingMethodDialogComponent, SellerOrdersCardComponent, SettleRefundDialogComponent, SimpleItemListComponent, createRoutes, getRefundablePayments };
|
|
3664
|
+
//# sourceMappingURL=deenruv-admin-ui-order.mjs.map
|