@vendure/admin-ui 1.7.4 → 1.8.1

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.
Files changed (228) hide show
  1. package/bundles/vendure-admin-ui-catalog.umd.js +902 -74
  2. package/bundles/vendure-admin-ui-catalog.umd.js.map +1 -1
  3. package/bundles/vendure-admin-ui-core.umd.js +2392 -820
  4. package/bundles/vendure-admin-ui-core.umd.js.map +1 -1
  5. package/bundles/vendure-admin-ui-customer.umd.js +4 -3
  6. package/bundles/vendure-admin-ui-customer.umd.js.map +1 -1
  7. package/bundles/vendure-admin-ui-dashboard.umd.js +3 -1
  8. package/bundles/vendure-admin-ui-dashboard.umd.js.map +1 -1
  9. package/bundles/vendure-admin-ui-order.umd.js +781 -175
  10. package/bundles/vendure-admin-ui-order.umd.js.map +1 -1
  11. package/bundles/vendure-admin-ui-settings.umd.js +5 -4
  12. package/bundles/vendure-admin-ui-settings.umd.js.map +1 -1
  13. package/bundles/vendure-admin-ui-system.umd.js +1 -1
  14. package/catalog/catalog.module.d.ts +3 -0
  15. package/catalog/components/assign-to-channel-dialog/assign-to-channel-dialog.component.d.ts +17 -0
  16. package/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.component.d.ts +38 -0
  17. package/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.graphql.d.ts +4 -0
  18. package/catalog/components/collection-list/collection-list-bulk-actions.d.ts +6 -0
  19. package/catalog/components/collection-list/collection-list.component.d.ts +7 -5
  20. package/catalog/components/collection-tree/collection-tree-node.component.d.ts +8 -4
  21. package/catalog/components/collection-tree/collection-tree.component.d.ts +2 -1
  22. package/catalog/components/facet-list/facet-list-bulk-actions.d.ts +5 -0
  23. package/catalog/components/facet-list/facet-list.component.d.ts +2 -1
  24. package/catalog/components/product-list/product-list-bulk-actions.d.ts +6 -0
  25. package/catalog/components/product-list/product-list.component.d.ts +2 -1
  26. package/catalog/public_api.d.ts +6 -0
  27. package/catalog/vendure-admin-ui-catalog.metadata.json +1 -1
  28. package/core/common/component-registry-types.d.ts +1 -1
  29. package/core/common/generated-types.d.ts +609 -3
  30. package/core/common/utilities/bulk-action-utils.d.ts +19 -0
  31. package/core/common/utilities/selection-manager.d.ts +7 -0
  32. package/core/common/version.d.ts +1 -1
  33. package/core/data/definitions/collection-definitions.d.ts +3 -0
  34. package/core/data/definitions/facet-definitions.d.ts +3 -0
  35. package/core/data/definitions/order-definitions.d.ts +12 -0
  36. package/core/data/definitions/product-definitions.d.ts +1 -0
  37. package/core/data/providers/collection-data.service.d.ts +4 -1
  38. package/core/data/providers/facet-data.service.d.ts +4 -1
  39. package/core/data/providers/order-data.service.d.ts +18 -1
  40. package/core/data/providers/product-data.service.d.ts +1 -0
  41. package/core/providers/bulk-action-registry/bulk-action-registry.service.d.ts +6 -0
  42. package/core/providers/bulk-action-registry/bulk-action-types.d.ts +149 -0
  43. package/core/providers/bulk-action-registry/register-bulk-action.d.ts +53 -0
  44. package/core/providers/modal/modal.service.d.ts +2 -0
  45. package/core/providers/nav-builder/nav-builder-types.d.ts +1 -0
  46. package/core/public_api.d.ts +18 -1
  47. package/core/shared/components/asset-gallery/asset-gallery.component.d.ts +3 -3
  48. package/core/shared/components/bulk-action-menu/bulk-action-menu.component.d.ts +29 -0
  49. package/core/shared/components/data-table/data-table.component.d.ts +26 -7
  50. package/core/shared/components/dropdown/dropdown-menu.component.d.ts +1 -0
  51. package/core/shared/components/radio-card/radio-card-fieldset.component.d.ts +21 -0
  52. package/core/shared/components/radio-card/radio-card.component.d.ts +19 -0
  53. package/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.component.d.ts +28 -0
  54. package/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.service.d.ts +31 -0
  55. package/core/shared/components/rich-text-editor/prosemirror/custom-nodes.d.ts +4 -0
  56. package/core/shared/components/rich-text-editor/prosemirror/inputrules.d.ts +5 -5
  57. package/core/shared/components/rich-text-editor/prosemirror/menu/links.d.ts +1 -1
  58. package/core/shared/components/rich-text-editor/prosemirror/menu/menu-common.d.ts +12 -0
  59. package/core/shared/components/rich-text-editor/prosemirror/menu/menu-plugin.d.ts +9 -0
  60. package/core/shared/components/rich-text-editor/prosemirror/menu/sub-menu-with-icon.d.ts +14 -0
  61. package/core/shared/components/rich-text-editor/prosemirror/plugins/image-plugin.d.ts +7 -0
  62. package/core/shared/components/rich-text-editor/prosemirror/plugins/link-select-plugin.d.ts +1 -1
  63. package/core/shared/components/rich-text-editor/prosemirror/plugins/raw-editor-plugin.d.ts +7 -0
  64. package/core/shared/components/rich-text-editor/prosemirror/plugins/tables-plugin.d.ts +13 -0
  65. package/core/shared/components/rich-text-editor/prosemirror/prosemirror.service.d.ts +7 -3
  66. package/core/shared/components/rich-text-editor/prosemirror/types.d.ts +0 -2
  67. package/core/shared/components/rich-text-editor/raw-html-dialog/raw-html-dialog.component.d.ts +18 -0
  68. package/core/shared/components/rich-text-editor/rich-text-editor.component.d.ts +6 -2
  69. package/core/shared/dynamic-form-inputs/code-editor-form-input/base-code-editor-form-input.component.d.ts +27 -0
  70. package/core/shared/dynamic-form-inputs/code-editor-form-input/html-editor-form-input.component.d.ts +19 -0
  71. package/core/shared/dynamic-form-inputs/code-editor-form-input/json-editor-form-input.component.d.ts +5 -17
  72. package/core/shared/dynamic-form-inputs/register-dynamic-input-components.d.ts +2 -1
  73. package/core/vendure-admin-ui-core.metadata.json +1 -1
  74. package/customer/components/customer-group-member-list/customer-group-member-list.component.d.ts +11 -4
  75. package/customer/vendure-admin-ui-customer.metadata.json +1 -1
  76. package/esm2015/catalog/catalog.module.js +25 -2
  77. package/esm2015/catalog/components/assign-products-to-channel-dialog/assign-products-to-channel-dialog.component.js +4 -1
  78. package/esm2015/catalog/components/assign-to-channel-dialog/assign-to-channel-dialog.component.js +51 -0
  79. package/esm2015/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.component.js +89 -0
  80. package/esm2015/catalog/components/bulk-add-facet-values-dialog/bulk-add-facet-values-dialog.graphql.js +69 -0
  81. package/esm2015/catalog/components/collection-detail/collection-detail.component.js +3 -3
  82. package/esm2015/catalog/components/collection-list/collection-list-bulk-actions.js +147 -0
  83. package/esm2015/catalog/components/collection-list/collection-list.component.js +17 -8
  84. package/esm2015/catalog/components/collection-tree/collection-tree-node.component.js +16 -7
  85. package/esm2015/catalog/components/collection-tree/collection-tree.component.js +3 -2
  86. package/esm2015/catalog/components/facet-list/facet-list-bulk-actions.js +208 -0
  87. package/esm2015/catalog/components/facet-list/facet-list.component.js +13 -4
  88. package/esm2015/catalog/components/product-detail/product-detail.component.js +35 -23
  89. package/esm2015/catalog/components/product-list/product-list-bulk-actions.js +173 -0
  90. package/esm2015/catalog/components/product-list/product-list.component.js +10 -5
  91. package/esm2015/catalog/components/product-variants-list/product-variants-list.component.js +2 -2
  92. package/esm2015/catalog/providers/routing/collection-resolver.js +2 -1
  93. package/esm2015/catalog/public_api.js +7 -1
  94. package/esm2015/core/common/component-registry-types.js +1 -1
  95. package/esm2015/core/common/generated-types.js +5 -1
  96. package/esm2015/core/common/introspection-result.js +296 -191
  97. package/esm2015/core/common/utilities/bulk-action-utils.js +44 -0
  98. package/esm2015/core/common/utilities/selection-manager.js +33 -1
  99. package/esm2015/core/common/version.js +2 -2
  100. package/esm2015/core/components/breadcrumb/breadcrumb.component.js +1 -1
  101. package/esm2015/core/data/definitions/collection-definitions.js +30 -1
  102. package/esm2015/core/data/definitions/facet-definitions.js +31 -1
  103. package/esm2015/core/data/definitions/order-definitions.js +114 -1
  104. package/esm2015/core/data/definitions/product-definitions.js +15 -1
  105. package/esm2015/core/data/providers/collection-data.service.js +17 -2
  106. package/esm2015/core/data/providers/customer-data.service.js +8 -4
  107. package/esm2015/core/data/providers/facet-data.service.js +18 -2
  108. package/esm2015/core/data/providers/order-data.service.js +38 -2
  109. package/esm2015/core/data/providers/product-data.service.js +7 -2
  110. package/esm2015/core/data/utils/remove-readonly-custom-fields.js +5 -1
  111. package/esm2015/core/providers/bulk-action-registry/bulk-action-registry.service.js +27 -0
  112. package/esm2015/core/providers/bulk-action-registry/bulk-action-types.js +2 -0
  113. package/esm2015/core/providers/bulk-action-registry/register-bulk-action.js +63 -0
  114. package/esm2015/core/providers/dashboard-widget/dashboard-widget.service.js +1 -4
  115. package/esm2015/core/providers/modal/modal.service.js +2 -1
  116. package/esm2015/core/providers/nav-builder/nav-builder-types.js +1 -1
  117. package/esm2015/core/public_api.js +19 -2
  118. package/esm2015/core/shared/components/action-bar/action-bar.component.js +4 -8
  119. package/esm2015/core/shared/components/asset-gallery/asset-gallery.component.js +2 -2
  120. package/esm2015/core/shared/components/bulk-action-menu/bulk-action-menu.component.js +99 -0
  121. package/esm2015/core/shared/components/data-table/data-table.component.js +64 -15
  122. package/esm2015/core/shared/components/dropdown/dropdown-menu.component.js +4 -3
  123. package/esm2015/core/shared/components/facet-value-selector/facet-value-selector.component.js +2 -2
  124. package/esm2015/core/shared/components/language-selector/language-selector.component.js +2 -2
  125. package/esm2015/core/shared/components/order-state-label/order-state-label.component.js +2 -1
  126. package/esm2015/core/shared/components/product-search-input/product-search-input.component.js +1 -1
  127. package/esm2015/core/shared/components/product-selector/product-selector.component.js +1 -1
  128. package/esm2015/core/shared/components/radio-card/radio-card-fieldset.component.js +57 -0
  129. package/esm2015/core/shared/components/radio-card/radio-card.component.js +54 -0
  130. package/esm2015/core/shared/components/rich-text-editor/external-image-dialog/external-image-dialog.component.js +2 -2
  131. package/esm2015/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.component.js +140 -0
  132. package/esm2015/core/shared/components/rich-text-editor/prosemirror/context-menu/context-menu.service.js +45 -0
  133. package/esm2015/core/shared/components/rich-text-editor/prosemirror/custom-nodes.js +60 -0
  134. package/esm2015/core/shared/components/rich-text-editor/prosemirror/menu/links.js +4 -4
  135. package/esm2015/core/shared/components/rich-text-editor/prosemirror/menu/menu-common.js +23 -1
  136. package/esm2015/core/shared/components/rich-text-editor/prosemirror/menu/menu-plugin.js +12 -0
  137. package/esm2015/core/shared/components/rich-text-editor/prosemirror/menu/menu.js +73 -18
  138. package/esm2015/core/shared/components/rich-text-editor/prosemirror/menu/sub-menu-with-icon.js +16 -0
  139. package/esm2015/core/shared/components/rich-text-editor/prosemirror/plugins/image-plugin.js +100 -0
  140. package/esm2015/core/shared/components/rich-text-editor/prosemirror/plugins/raw-editor-plugin.js +97 -0
  141. package/esm2015/core/shared/components/rich-text-editor/prosemirror/plugins/tables-plugin.js +166 -0
  142. package/esm2015/core/shared/components/rich-text-editor/prosemirror/prosemirror.service.js +47 -17
  143. package/esm2015/core/shared/components/rich-text-editor/prosemirror/types.js +1 -1
  144. package/esm2015/core/shared/components/rich-text-editor/raw-html-dialog/raw-html-dialog.component.js +57 -0
  145. package/esm2015/core/shared/components/rich-text-editor/rich-text-editor.component.js +20 -9
  146. package/esm2015/core/shared/components/simple-dialog/simple-dialog.component.js +2 -2
  147. package/esm2015/core/shared/dynamic-form-inputs/code-editor-form-input/base-code-editor-form-input.component.js +59 -0
  148. package/esm2015/core/shared/dynamic-form-inputs/code-editor-form-input/html-editor-form-input.component.js +66 -0
  149. package/esm2015/core/shared/dynamic-form-inputs/code-editor-form-input/json-editor-form-input.component.js +47 -84
  150. package/esm2015/core/shared/dynamic-form-inputs/dynamic-form-input/dynamic-form-input.component.js +3 -3
  151. package/esm2015/core/shared/dynamic-form-inputs/register-dynamic-input-components.js +3 -1
  152. package/esm2015/core/shared/pipes/state-i18n-token.pipe.js +2 -1
  153. package/esm2015/core/shared/shared.module.js +13 -1
  154. package/esm2015/customer/components/customer-group-list/customer-group-list.component.js +2 -2
  155. package/esm2015/customer/components/customer-group-member-list/customer-group-member-list.component.js +6 -6
  156. package/esm2015/customer/components/customer-list/customer-list.component.js +2 -2
  157. package/esm2015/dashboard/dashboard.module.js +6 -2
  158. package/esm2015/order/components/coupon-code-selector/coupon-code-selector.component.js +42 -0
  159. package/esm2015/order/components/draft-order-detail/draft-order-detail.component.js +195 -0
  160. package/esm2015/order/components/draft-order-variant-selector/draft-order-variant-selector.component.js +59 -0
  161. package/esm2015/order/components/order-detail/order-detail.component.js +2 -2
  162. package/esm2015/order/components/order-editor/order-editor.component.js +5 -11
  163. package/esm2015/order/components/order-list/order-list.component.js +20 -4
  164. package/esm2015/order/components/order-table/order-table.component.js +16 -5
  165. package/esm2015/order/components/select-address-dialog/select-address-dialog.component.js +91 -0
  166. package/esm2015/order/components/select-address-dialog/select-address-dialog.graphql.js +14 -0
  167. package/esm2015/order/components/select-customer-dialog/select-customer-dialog.component.js +59 -0
  168. package/esm2015/order/components/select-shipping-method-dialog/select-shipping-method-dialog.component.js +30 -0
  169. package/esm2015/order/order.module.js +13 -1
  170. package/esm2015/order/order.routes.js +26 -7
  171. package/esm2015/order/providers/routing/order-resolver.js +29 -12
  172. package/esm2015/order/providers/routing/order.guard.js +41 -0
  173. package/esm2015/order/public_api.js +9 -1
  174. package/esm2015/settings/components/country-list/country-list.component.js +2 -2
  175. package/esm2015/settings/components/profile/profile.component.js +2 -2
  176. package/esm2015/settings/components/zone-list/zone-list.component.js +2 -2
  177. package/esm2015/settings/components/zone-member-list/zone-member-list.component.js +2 -2
  178. package/esm2015/system/components/health-check/health-check.component.js +1 -1
  179. package/fesm2015/vendure-admin-ui-catalog.js +835 -61
  180. package/fesm2015/vendure-admin-ui-catalog.js.map +1 -1
  181. package/fesm2015/vendure-admin-ui-core.js +3122 -1514
  182. package/fesm2015/vendure-admin-ui-core.js.map +1 -1
  183. package/fesm2015/vendure-admin-ui-customer.js +7 -7
  184. package/fesm2015/vendure-admin-ui-customer.js.map +1 -1
  185. package/fesm2015/vendure-admin-ui-dashboard.js +5 -1
  186. package/fesm2015/vendure-admin-ui-dashboard.js.map +1 -1
  187. package/fesm2015/vendure-admin-ui-order.js +780 -232
  188. package/fesm2015/vendure-admin-ui-order.js.map +1 -1
  189. package/fesm2015/vendure-admin-ui-settings.js +4 -4
  190. package/fesm2015/vendure-admin-ui-settings.js.map +1 -1
  191. package/fesm2015/vendure-admin-ui-system.js +1 -1
  192. package/order/components/coupon-code-selector/coupon-code-selector.component.d.ts +18 -0
  193. package/order/components/draft-order-detail/draft-order-detail.component.d.ts +49 -0
  194. package/order/components/draft-order-variant-selector/draft-order-variant-selector.component.d.ts +21 -0
  195. package/order/components/order-editor/order-editor.component.d.ts +1 -6
  196. package/order/components/order-list/order-list.component.d.ts +1 -0
  197. package/order/components/order-table/order-table.component.d.ts +11 -2
  198. package/order/components/select-address-dialog/select-address-dialog.component.d.ts +24 -0
  199. package/order/components/select-address-dialog/select-address-dialog.graphql.d.ts +1 -0
  200. package/order/components/select-customer-dialog/select-customer-dialog.component.d.ts +22 -0
  201. package/order/components/select-shipping-method-dialog/select-shipping-method-dialog.component.d.ts +16 -0
  202. package/order/providers/routing/order-resolver.d.ts +8 -5
  203. package/order/providers/routing/order.guard.d.ts +9 -0
  204. package/order/public_api.d.ts +8 -0
  205. package/order/vendure-admin-ui-order.metadata.json +1 -1
  206. package/package.json +13 -12
  207. package/settings/components/zone-member-list/zone-member-list.component.d.ts +3 -1
  208. package/settings/vendure-admin-ui-settings.metadata.json +1 -1
  209. package/static/i18n-messages/cs.json +33 -0
  210. package/static/i18n-messages/de.json +33 -0
  211. package/static/i18n-messages/en.json +36 -4
  212. package/static/i18n-messages/es.json +33 -0
  213. package/static/i18n-messages/fr.json +33 -0
  214. package/static/i18n-messages/it.json +33 -0
  215. package/static/i18n-messages/pl.json +33 -0
  216. package/static/i18n-messages/pt_BR.json +33 -0
  217. package/static/i18n-messages/pt_PT.json +33 -0
  218. package/static/i18n-messages/ru.json +33 -0
  219. package/static/i18n-messages/uk.json +33 -0
  220. package/static/i18n-messages/zh_Hans.json +33 -0
  221. package/static/i18n-messages/zh_Hant.json +33 -0
  222. package/static/styles/global/_forms.scss +4 -2
  223. package/static/styles/global/_overrides.scss +1 -1
  224. package/static/styles/global/_utilities.scss +4 -0
  225. package/static/theme.min.css +1 -1
  226. package/system/vendure-admin-ui-system.metadata.json +1 -1
  227. package/core/shared/components/rich-text-editor/prosemirror/menu/images.d.ts +0 -4
  228. package/esm2015/core/shared/components/rich-text-editor/prosemirror/menu/images.js +0 -36
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@vendure/admin-ui/core'), require('@biesbjerg/ngx-translate-extract-marker'), require('@vendure/common/lib/shared-utils'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@vendure/common/lib/simple-deep-clone')) :
3
- typeof define === 'function' && define.amd ? define('@vendure/admin-ui/order', ['exports', '@angular/core', '@angular/forms', '@vendure/admin-ui/core', '@biesbjerg/ngx-translate-extract-marker', '@vendure/common/lib/shared-utils', '@angular/router', 'rxjs', 'rxjs/operators', '@vendure/common/lib/simple-deep-clone'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.vendure = global.vendure || {}, global.vendure['admin-ui'] = global.vendure['admin-ui'] || {}, global.vendure['admin-ui'].order = {}), global.ng.core, global.ng.forms, global.vendure['admin-ui'].core, global.ngxTranslateExtractMarker, global.sharedUtils, global.ng.router, global.rxjs, global.rxjs.operators, global.simpleDeepClone));
5
- }(this, (function (exports, i0, forms, i1, ngxTranslateExtractMarker, sharedUtils, i1$1, rxjs, operators, simpleDeepClone) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@vendure/admin-ui/core'), require('@biesbjerg/ngx-translate-extract-marker'), require('rxjs'), require('rxjs/operators'), require('@angular/router'), require('@vendure/common/lib/pick'), require('apollo-angular'), require('@vendure/common/lib/shared-utils'), require('@vendure/common/lib/simple-deep-clone')) :
3
+ typeof define === 'function' && define.amd ? define('@vendure/admin-ui/order', ['exports', '@angular/core', '@angular/forms', '@vendure/admin-ui/core', '@biesbjerg/ngx-translate-extract-marker', 'rxjs', 'rxjs/operators', '@angular/router', '@vendure/common/lib/pick', 'apollo-angular', '@vendure/common/lib/shared-utils', '@vendure/common/lib/simple-deep-clone'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.vendure = global.vendure || {}, global.vendure['admin-ui'] = global.vendure['admin-ui'] || {}, global.vendure['admin-ui'].order = {}), global.ng.core, global.ng.forms, global.vendure['admin-ui'].core, global.ngxTranslateExtractMarker, global.rxjs, global.rxjs.operators, global.ng.router, global.pick, global.apolloAngular, global.sharedUtils, global.simpleDeepClone));
5
+ }(this, (function (exports, i0, forms, i1, ngxTranslateExtractMarker, rxjs, operators, i1$1, pick, apolloAngular, sharedUtils, simpleDeepClone) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -510,6 +510,645 @@
510
510
  { type: i1.I18nService }
511
511
  ]; };
512
512
 
513
+ var CouponCodeSelectorComponent = /** @class */ (function () {
514
+ function CouponCodeSelectorComponent(dataService) {
515
+ this.dataService = dataService;
516
+ this.addCouponCode = new i0.EventEmitter();
517
+ this.removeCouponCode = new i0.EventEmitter();
518
+ this.couponCodeInput$ = new rxjs.Subject();
519
+ }
520
+ CouponCodeSelectorComponent.prototype.ngOnInit = function () {
521
+ var _this = this;
522
+ var _a;
523
+ this.availableCouponCodes$ = rxjs.concat(this.couponCodeInput$.pipe(operators.distinctUntilChanged(), operators.switchMap(function (term) { return _this.dataService.promotion.getPromotions(10, 0, {
524
+ couponCode: { contains: term },
525
+ }).single$; }), operators.map(function (_b) {
526
+ var promotions = _b.promotions;
527
+ // tslint:disable-next-line:no-non-null-assertion
528
+ return promotions.items.map(function (p) { return ({ code: p.couponCode, promotionName: p.name }); });
529
+ }), operators.startWith([])));
530
+ if (!this.control) {
531
+ this.control = new forms.FormControl((_a = this.couponCodes) !== null && _a !== void 0 ? _a : []);
532
+ }
533
+ };
534
+ return CouponCodeSelectorComponent;
535
+ }());
536
+ CouponCodeSelectorComponent.decorators = [
537
+ { type: i0.Component, args: [{
538
+ selector: 'vdr-coupon-code-selector',
539
+ template: "<ng-select\r\n [items]=\"availableCouponCodes$ | async\"\r\n appendTo=\"body\"\r\n bindLabel=\"code\"\r\n bindValue=\"code\"\r\n [addTag]=\"false\"\r\n [multiple]=\"true\"\r\n [hideSelected]=\"true\"\r\n [minTermLength]=\"2\"\r\n typeToSearchText=\"\"\r\n [typeahead]=\"couponCodeInput$\"\r\n [formControl]=\"control\"\r\n (add)=\"addCouponCode.emit($event.code)\"\r\n (remove)=\"removeCouponCode.emit($event.value?.code)\"\r\n>\r\n <ng-template ng-option-tmp let-item=\"item\">\r\n <vdr-chip>{{ item.code }}</vdr-chip>\r\n {{ item.promotionName }}\r\n </ng-template>\r\n</ng-select>\r\n",
540
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
541
+ styles: [""]
542
+ },] }
543
+ ];
544
+ CouponCodeSelectorComponent.ctorParameters = function () { return [
545
+ { type: i1.DataService }
546
+ ]; };
547
+ CouponCodeSelectorComponent.propDecorators = {
548
+ couponCodes: [{ type: i0.Input }],
549
+ control: [{ type: i0.Input }],
550
+ addCouponCode: [{ type: i0.Output }],
551
+ removeCouponCode: [{ type: i0.Output }]
552
+ };
553
+
554
+ var OrderStateSelectDialogComponent = /** @class */ (function () {
555
+ function OrderStateSelectDialogComponent() {
556
+ this.nextStates = [];
557
+ this.message = '';
558
+ this.selectedState = '';
559
+ }
560
+ OrderStateSelectDialogComponent.prototype.select = function () {
561
+ if (this.selectedState) {
562
+ this.resolveWith(this.selectedState);
563
+ }
564
+ };
565
+ OrderStateSelectDialogComponent.prototype.cancel = function () {
566
+ this.resolveWith();
567
+ };
568
+ return OrderStateSelectDialogComponent;
569
+ }());
570
+ OrderStateSelectDialogComponent.decorators = [
571
+ { type: i0.Component, args: [{
572
+ selector: 'vdr-order-state-select-dialog',
573
+ template: "<ng-template vdrDialogTitle>{{ 'order.select-state' | translate }}</ng-template>\r\n<p>{{ message | translate }}</p>\r\n<clr-select-container>\r\n <select clrSelect name=\"state\" [(ngModel)]=\"selectedState\">\r\n <option *ngFor=\"let state of nextStates\" [value]=\"state\">\r\n {{ state | stateI18nToken | translate }}\r\n </option>\r\n </select>\r\n</clr-select-container>\r\n<ng-template vdrDialogButtons>\r\n <button type=\"submit\" *ngIf=\"cancellable\" (click)=\"cancel()\" class=\"btn btn-secondary\">\r\n {{ 'common.cancel' | translate }}\r\n </button>\r\n <button type=\"submit\" (click)=\"select()\" class=\"btn btn-primary\" [disabled]=\"!selectedState\">\r\n {{ 'order.transition-to-state' | translate: { state: (selectedState | stateI18nToken | translate) } }}\r\n </button>\r\n</ng-template>\r\n",
574
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
575
+ styles: [""]
576
+ },] }
577
+ ];
578
+
579
+ var OrderTransitionService = /** @class */ (function () {
580
+ function OrderTransitionService(dataService, modalService, notificationService, i18nService) {
581
+ this.dataService = dataService;
582
+ this.modalService = modalService;
583
+ this.notificationService = notificationService;
584
+ this.i18nService = i18nService;
585
+ }
586
+ /**
587
+ * Attempts to transition the Order to the last state it was in before it was transitioned
588
+ * to the "Modifying" state. If this fails, a manual prompt is used.
589
+ */
590
+ OrderTransitionService.prototype.transitionToPreModifyingState = function (orderId, nextStates) {
591
+ var _this = this;
592
+ return this.getPreModifyingState(orderId).pipe(operators.switchMap(function (state) {
593
+ var manualTransitionOptions = {
594
+ orderId: orderId,
595
+ nextStates: nextStates,
596
+ message: _this.i18nService.translate(ngxTranslateExtractMarker.marker('order.unable-to-transition-to-state-try-another'), { state: state }),
597
+ cancellable: false,
598
+ retry: 10,
599
+ };
600
+ if (state) {
601
+ return _this.transitionToStateOrThrow(orderId, state).pipe(operators.catchError(function (err) { return _this.manuallyTransitionToState(manualTransitionOptions); }));
602
+ }
603
+ else {
604
+ return _this.manuallyTransitionToState(manualTransitionOptions);
605
+ }
606
+ }));
607
+ };
608
+ /**
609
+ * Displays a modal for manually selecting the next state.
610
+ */
611
+ OrderTransitionService.prototype.manuallyTransitionToState = function (options) {
612
+ var _this = this;
613
+ return this.modalService
614
+ .fromComponent(OrderStateSelectDialogComponent, {
615
+ locals: {
616
+ nextStates: options.nextStates,
617
+ cancellable: options.cancellable,
618
+ message: options.message,
619
+ },
620
+ closable: false,
621
+ size: 'md',
622
+ })
623
+ .pipe(operators.switchMap(function (result) {
624
+ if (result) {
625
+ return _this.transitionToStateOrThrow(options.orderId, result);
626
+ }
627
+ else {
628
+ if (!options.cancellable) {
629
+ throw new Error("An order state must be selected");
630
+ }
631
+ else {
632
+ return rxjs.EMPTY;
633
+ }
634
+ }
635
+ }), operators.retryWhen(function (errors) { return errors.pipe(operators.delay(2000), operators.take(options.retry)); }));
636
+ };
637
+ /**
638
+ * Attempts to get the last state the Order was in before it was transitioned
639
+ * to the "Modifying" state.
640
+ */
641
+ OrderTransitionService.prototype.getPreModifyingState = function (orderId) {
642
+ return this.dataService.order
643
+ .getOrderHistory(orderId, {
644
+ filter: {
645
+ type: {
646
+ eq: i1.HistoryEntryType.ORDER_STATE_TRANSITION,
647
+ },
648
+ },
649
+ sort: {
650
+ createdAt: i1.SortOrder.DESC,
651
+ },
652
+ })
653
+ .mapSingle(function (result) { return result.order; })
654
+ .pipe(operators.map(function (result) {
655
+ var item = result === null || result === void 0 ? void 0 : result.history.items.find(function (i) { return i.data.to === 'Modifying'; });
656
+ if (item) {
657
+ return item.data.from;
658
+ }
659
+ else {
660
+ return;
661
+ }
662
+ }));
663
+ };
664
+ OrderTransitionService.prototype.transitionToStateOrThrow = function (orderId, state) {
665
+ var _this = this;
666
+ return this.dataService.order.transitionToState(orderId, state).pipe(operators.map(function (_a) {
667
+ var transitionOrderToState = _a.transitionOrderToState;
668
+ switch (transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.__typename) {
669
+ case 'Order':
670
+ return transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.state;
671
+ case 'OrderStateTransitionError':
672
+ _this.notificationService.error(transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.transitionError);
673
+ throw new Error(transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.transitionError);
674
+ }
675
+ }));
676
+ };
677
+ return OrderTransitionService;
678
+ }());
679
+ OrderTransitionService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function OrderTransitionService_Factory() { return new OrderTransitionService(i0__namespace.ɵɵinject(i1__namespace.DataService), i0__namespace.ɵɵinject(i1__namespace.ModalService), i0__namespace.ɵɵinject(i1__namespace.NotificationService), i0__namespace.ɵɵinject(i1__namespace.I18nService)); }, token: OrderTransitionService, providedIn: "root" });
680
+ OrderTransitionService.decorators = [
681
+ { type: i0.Injectable, args: [{
682
+ providedIn: 'root',
683
+ },] }
684
+ ];
685
+ OrderTransitionService.ctorParameters = function () { return [
686
+ { type: i1.DataService },
687
+ { type: i1.ModalService },
688
+ { type: i1.NotificationService },
689
+ { type: i1.I18nService }
690
+ ]; };
691
+
692
+ var GET_CUSTOMER_ADDRESSES = apolloAngular.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query GetCustomerAddresses($customerId: ID!) {\n customer(id: $customerId) {\n id\n addresses {\n ...Address\n }\n }\n }\n ", "\n"], ["\n query GetCustomerAddresses($customerId: ID!) {\n customer(id: $customerId) {\n id\n addresses {\n ...Address\n }\n }\n }\n ", "\n"])), i1.ADDRESS_FRAGMENT);
693
+ var templateObject_1;
694
+
695
+ var SelectAddressDialogComponent = /** @class */ (function () {
696
+ function SelectAddressDialogComponent(dataService, formBuilder) {
697
+ this.dataService = dataService;
698
+ this.formBuilder = formBuilder;
699
+ this.useExisting = true;
700
+ this.createNew = false;
701
+ }
702
+ SelectAddressDialogComponent.prototype.ngOnInit = function () {
703
+ var _this = this;
704
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
705
+ this.addressForm = this.formBuilder.group({
706
+ fullName: [(_b = (_a = this.currentAddress) === null || _a === void 0 ? void 0 : _a.fullName) !== null && _b !== void 0 ? _b : ''],
707
+ company: [(_d = (_c = this.currentAddress) === null || _c === void 0 ? void 0 : _c.company) !== null && _d !== void 0 ? _d : ''],
708
+ streetLine1: [(_f = (_e = this.currentAddress) === null || _e === void 0 ? void 0 : _e.streetLine1) !== null && _f !== void 0 ? _f : '', forms.Validators.required],
709
+ streetLine2: [(_h = (_g = this.currentAddress) === null || _g === void 0 ? void 0 : _g.streetLine2) !== null && _h !== void 0 ? _h : ''],
710
+ city: [(_k = (_j = this.currentAddress) === null || _j === void 0 ? void 0 : _j.city) !== null && _k !== void 0 ? _k : '', forms.Validators.required],
711
+ province: [(_m = (_l = this.currentAddress) === null || _l === void 0 ? void 0 : _l.province) !== null && _m !== void 0 ? _m : ''],
712
+ postalCode: [(_p = (_o = this.currentAddress) === null || _o === void 0 ? void 0 : _o.postalCode) !== null && _p !== void 0 ? _p : '', forms.Validators.required],
713
+ countryCode: [(_r = (_q = this.currentAddress) === null || _q === void 0 ? void 0 : _q.countryCode) !== null && _r !== void 0 ? _r : '', forms.Validators.required],
714
+ phoneNumber: [(_t = (_s = this.currentAddress) === null || _s === void 0 ? void 0 : _s.phoneNumber) !== null && _t !== void 0 ? _t : ''],
715
+ });
716
+ this.useExisting = !!this.customerId;
717
+ this.addresses$ = this.customerId
718
+ ? this.dataService
719
+ .query(GET_CUSTOMER_ADDRESSES, { customerId: this.customerId })
720
+ .mapSingle(function (_u) {
721
+ var customer = _u.customer;
722
+ var _a;
723
+ return (_a = customer === null || customer === void 0 ? void 0 : customer.addresses) !== null && _a !== void 0 ? _a : [];
724
+ })
725
+ .pipe(operators.tap(function (addresses) {
726
+ if (_this.currentAddress) {
727
+ _this.selectedAddress = addresses.find(function (a) {
728
+ var _a, _b;
729
+ return a.streetLine1 === ((_a = _this.currentAddress) === null || _a === void 0 ? void 0 : _a.streetLine1) &&
730
+ a.postalCode === ((_b = _this.currentAddress) === null || _b === void 0 ? void 0 : _b.postalCode);
731
+ });
732
+ }
733
+ if (addresses.length === 0) {
734
+ _this.createNew = true;
735
+ _this.useExisting = false;
736
+ }
737
+ }))
738
+ : rxjs.of([]);
739
+ this.availableCountries$ = this.dataService.settings
740
+ .getAvailableCountries()
741
+ .mapSingle(function (_u) {
742
+ var countries = _u.countries;
743
+ return countries.items;
744
+ });
745
+ };
746
+ SelectAddressDialogComponent.prototype.trackByFn = function (item) {
747
+ return item.id;
748
+ };
749
+ SelectAddressDialogComponent.prototype.addressIdFn = function (item) {
750
+ return item.streetLine1 + item.postalCode;
751
+ };
752
+ SelectAddressDialogComponent.prototype.cancel = function () {
753
+ this.resolveWith();
754
+ };
755
+ SelectAddressDialogComponent.prototype.select = function () {
756
+ if (this.useExisting && this.selectedAddress) {
757
+ this.resolveWith(Object.assign(Object.assign({}, pick.pick(this.selectedAddress, [
758
+ 'fullName',
759
+ 'company',
760
+ 'streetLine1',
761
+ 'streetLine2',
762
+ 'city',
763
+ 'province',
764
+ 'phoneNumber',
765
+ 'postalCode',
766
+ ])), { countryCode: this.selectedAddress.country.code }));
767
+ }
768
+ if (this.createNew && this.addressForm.valid) {
769
+ var formValue = this.addressForm.value;
770
+ this.resolveWith(formValue);
771
+ }
772
+ };
773
+ return SelectAddressDialogComponent;
774
+ }());
775
+ SelectAddressDialogComponent.decorators = [
776
+ { type: i0.Component, args: [{
777
+ selector: 'vdr-select-address-dialog',
778
+ template: "<ng-template vdrDialogTitle>{{ 'order.select-address' | translate }}</ng-template>\r\n\r\n<clr-tabs *ngIf=\"addresses$ | async as addresses\">\r\n <clr-tab *ngIf=\"customerId && addresses.length\">\r\n <button clrTabLink>{{ 'order.existing-address' | translate }}</button>\r\n <ng-template [(clrIfActive)]=\"useExisting\">\r\n <clr-tab-content>\r\n <vdr-radio-card-fieldset\r\n class=\"block mt4\"\r\n [idFn]=\"addressIdFn\"\r\n [selectedItemId]=\"selectedAddress && addressIdFn(selectedAddress)\"\r\n (selectItem)=\"selectedAddress = $event\"\r\n >\r\n <vdr-radio-card *ngFor=\"let address of addresses\" [item]=\"address\">\r\n <vdr-formatted-address [address]=\"address\"></vdr-formatted-address>\r\n </vdr-radio-card>\r\n </vdr-radio-card-fieldset>\r\n </clr-tab-content>\r\n </ng-template>\r\n </clr-tab>\r\n <clr-tab>\r\n <button clrTabLink>{{ 'customer.create-new-address' | translate }}</button>\r\n\r\n <ng-template [(clrIfActive)]=\"createNew\">\r\n <clr-tab-content>\r\n <vdr-address-form\r\n [formGroup]=\"addressForm\"\r\n [availableCountries]=\"availableCountries$ | async\"\r\n ></vdr-address-form>\r\n </clr-tab-content>\r\n </ng-template>\r\n </clr-tab>\r\n</clr-tabs>\r\n\r\n<ng-template vdrDialogButtons>\r\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\r\n <button\r\n type=\"submit\"\r\n (click)=\"select()\"\r\n [disabled]=\"(useExisting && !selectedAddress) || (createNew && addressForm.invalid)\"\r\n class=\"btn btn-primary\"\r\n >\r\n {{ 'common.okay' | translate }}\r\n </button>\r\n</ng-template>\r\n",
779
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
780
+ styles: [""]
781
+ },] }
782
+ ];
783
+ SelectAddressDialogComponent.ctorParameters = function () { return [
784
+ { type: i1.DataService },
785
+ { type: forms.FormBuilder }
786
+ ]; };
787
+
788
+ var SelectCustomerDialogComponent = /** @class */ (function () {
789
+ function SelectCustomerDialogComponent(dataService, formBuilder) {
790
+ this.dataService = dataService;
791
+ this.formBuilder = formBuilder;
792
+ this.isLoading = false;
793
+ this.input$ = new rxjs.Subject();
794
+ this.selectedCustomer = [];
795
+ this.useExisting = true;
796
+ this.createNew = false;
797
+ this.customerForm = this.formBuilder.group({
798
+ title: '',
799
+ firstName: ['', forms.Validators.required],
800
+ lastName: ['', forms.Validators.required],
801
+ phoneNumber: '',
802
+ emailAddress: ['', [forms.Validators.required, forms.Validators.email]],
803
+ });
804
+ }
805
+ SelectCustomerDialogComponent.prototype.ngOnInit = function () {
806
+ var _this = this;
807
+ this.customers$ = rxjs.concat(rxjs.of([]), // default items
808
+ this.input$.pipe(operators.debounceTime(200), operators.distinctUntilChanged(), operators.tap(function () { return (_this.isLoading = true); }), operators.switchMap(function (term) { return _this.dataService.customer
809
+ .getCustomerList(10, 0, term)
810
+ .mapStream(function (_a) {
811
+ var customers = _a.customers;
812
+ return customers.items;
813
+ })
814
+ .pipe(operators.catchError(function () { return rxjs.of([]); }), // empty list on error
815
+ operators.tap(function () { return (_this.isLoading = false); })); })));
816
+ };
817
+ SelectCustomerDialogComponent.prototype.trackByFn = function (item) {
818
+ return item.id;
819
+ };
820
+ SelectCustomerDialogComponent.prototype.cancel = function () {
821
+ this.resolveWith();
822
+ };
823
+ SelectCustomerDialogComponent.prototype.select = function () {
824
+ if (this.useExisting && this.selectedCustomer.length === 1) {
825
+ this.resolveWith(this.selectedCustomer[0]);
826
+ }
827
+ if (this.createNew && this.customerForm.valid) {
828
+ var formValue = this.customerForm.value;
829
+ this.resolveWith(formValue);
830
+ }
831
+ };
832
+ return SelectCustomerDialogComponent;
833
+ }());
834
+ SelectCustomerDialogComponent.decorators = [
835
+ { type: i0.Component, args: [{
836
+ selector: 'vdr-select-customer-dialog',
837
+ template: "<ng-template vdrDialogTitle>{{ 'order.set-customer-for-order' | translate }}</ng-template>\r\n\r\n<clr-tabs>\r\n <clr-tab>\r\n <button clrTabLink>{{ 'order.existing-customer' | translate }}</button>\r\n\r\n <ng-template [(clrIfActive)]=\"useExisting\">\r\n <clr-tab-content>\r\n <ng-select\r\n [items]=\"customers$ | async\"\r\n appendTo=\"body\"\r\n bindLabel=\"name\"\r\n [addTag]=\"false\"\r\n [multiple]=\"true\"\r\n [hideSelected]=\"true\"\r\n [trackByFn]=\"trackByFn\"\r\n [minTermLength]=\"2\"\r\n [loading]=\"isLoading\"\r\n [typeahead]=\"input$\"\r\n [(ngModel)]=\"selectedCustomer\"\r\n class=\"mt4\"\r\n >\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon\r\n ><span class=\"ml2 mr2\">{{ item.firstName }} {{ item.lastName }}</span>\r\n <vdr-chip>{{ item.emailAddress }}</vdr-chip>\r\n </ng-template>\r\n <ng-template ng-option-tmp let-item=\"item\">\r\n <clr-icon shape=\"user\" class=\"is-solid\"></clr-icon\r\n ><span class=\"ml2 mr2\">{{ item.firstName }} {{ item.lastName }}</span>\r\n <vdr-chip>{{ item.emailAddress }}</vdr-chip>\r\n </ng-template>\r\n </ng-select>\r\n </clr-tab-content>\r\n </ng-template>\r\n </clr-tab>\r\n <clr-tab>\r\n <button clrTabLink>{{ 'customer.create-new-customer' | translate }}</button>\r\n\r\n <ng-template [(clrIfActive)]=\"createNew\">\r\n <clr-tab-content>\r\n <form [formGroup]=\"customerForm\">\r\n <vdr-form-field [label]=\"'customer.title' | translate\" for=\"title\">\r\n <input id=\"title\" type=\"text\" formControlName=\"title\" />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'customer.first-name' | translate\" for=\"firstName\">\r\n <input id=\"firstName\" type=\"text\" formControlName=\"firstName\" />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'customer.last-name' | translate\" for=\"lastName\">\r\n <input id=\"lastName\" type=\"text\" formControlName=\"lastName\" />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'customer.email-address' | translate\" for=\"emailAddress\">\r\n <input id=\"emailAddress\" type=\"text\" formControlName=\"emailAddress\" />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'customer.phone-number' | translate\" for=\"phoneNumber\">\r\n <input id=\"phoneNumber\" type=\"text\" formControlName=\"phoneNumber\" />\r\n </vdr-form-field>\r\n </form>\r\n </clr-tab-content>\r\n </ng-template>\r\n </clr-tab>\r\n</clr-tabs>\r\n\r\n<ng-template vdrDialogButtons>\r\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\r\n <button\r\n type=\"submit\"\r\n (click)=\"select()\"\r\n [disabled]=\"(useExisting && selectedCustomer.length === 0) || (createNew && customerForm.invalid)\"\r\n class=\"btn btn-primary\"\r\n >\r\n {{ 'common.okay' | translate }}\r\n </button>\r\n</ng-template>\r\n",
838
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
839
+ styles: [""]
840
+ },] }
841
+ ];
842
+ SelectCustomerDialogComponent.ctorParameters = function () { return [
843
+ { type: i1.DataService },
844
+ { type: forms.FormBuilder }
845
+ ]; };
846
+
847
+ var SelectShippingMethodDialogComponent = /** @class */ (function () {
848
+ function SelectShippingMethodDialogComponent() {
849
+ }
850
+ SelectShippingMethodDialogComponent.prototype.ngOnInit = function () {
851
+ var _this = this;
852
+ if (this.currentSelectionId) {
853
+ this.selectedMethod = this.eligibleShippingMethods.find(function (m) { return m.id === _this.currentSelectionId; });
854
+ }
855
+ };
856
+ SelectShippingMethodDialogComponent.prototype.methodIdFn = function (item) {
857
+ return item.id;
858
+ };
859
+ SelectShippingMethodDialogComponent.prototype.cancel = function () {
860
+ this.resolveWith();
861
+ };
862
+ SelectShippingMethodDialogComponent.prototype.select = function () {
863
+ if (this.selectedMethod) {
864
+ this.resolveWith(this.selectedMethod.id);
865
+ }
866
+ };
867
+ return SelectShippingMethodDialogComponent;
868
+ }());
869
+ SelectShippingMethodDialogComponent.decorators = [
870
+ { type: i0.Component, args: [{
871
+ selector: 'vdr-select-shipping-method-dialog',
872
+ template: "<ng-template vdrDialogTitle>{{ 'order.select-shipping-method' | translate }}</ng-template>\r\n<vdr-radio-card-fieldset\r\n [idFn]=\"methodIdFn\"\r\n [selectedItemId]=\"selectedMethod?.id\"\r\n (selectItem)=\"selectedMethod = $event\"\r\n>\r\n <vdr-radio-card *ngFor=\"let quote of eligibleShippingMethods\" [item]=\"quote\">\r\n <div class=\"result-details\">\r\n <vdr-labeled-data [label]=\"'settings.shipping-method' | translate\">\r\n {{ quote.name }}\r\n </vdr-labeled-data>\r\n <div class=\"price-row\">\r\n <vdr-labeled-data [label]=\"'common.price' | translate\">\r\n {{ quote.price | localeCurrency: currencyCode }}\r\n </vdr-labeled-data>\r\n <vdr-labeled-data [label]=\"'common.price-with-tax' | translate\">\r\n {{ quote.priceWithTax | localeCurrency: currencyCode }}\r\n </vdr-labeled-data>\r\n </div>\r\n <vdr-object-tree *ngIf=\"quote.metadata\" [value]=\"quote.metadata\"></vdr-object-tree>\r\n </div>\r\n </vdr-radio-card>\r\n</vdr-radio-card-fieldset>\r\n\r\n<ng-template vdrDialogButtons>\r\n <button type=\"button\" class=\"btn\" (click)=\"cancel()\">{{ 'common.cancel' | translate }}</button>\r\n <button\r\n type=\"submit\"\r\n (click)=\"select()\"\r\n [disabled]=\"!selectedMethod\"\r\n class=\"btn btn-primary\"\r\n >\r\n {{ 'common.okay' | translate }}\r\n </button>\r\n</ng-template>\r\n",
873
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
874
+ styles: [""]
875
+ },] }
876
+ ];
877
+ SelectShippingMethodDialogComponent.ctorParameters = function () { return []; };
878
+
879
+ var DraftOrderDetailComponent = /** @class */ (function (_super) {
880
+ __extends(DraftOrderDetailComponent, _super);
881
+ function DraftOrderDetailComponent(router, route, serverConfigService, changeDetector, dataService, notificationService, modalService, orderTransitionService) {
882
+ var _this = _super.call(this, route, router, serverConfigService, dataService) || this;
883
+ _this.changeDetector = changeDetector;
884
+ _this.dataService = dataService;
885
+ _this.notificationService = notificationService;
886
+ _this.modalService = modalService;
887
+ _this.orderTransitionService = orderTransitionService;
888
+ _this.detailForm = new forms.FormGroup({});
889
+ _this.fetchHistory = new rxjs.Subject();
890
+ _this.displayCouponCodeInput = false;
891
+ return _this;
892
+ }
893
+ DraftOrderDetailComponent.prototype.ngOnInit = function () {
894
+ var _this = this;
895
+ this.init();
896
+ this.orderLineCustomFields = this.getCustomFieldConfig('OrderLine');
897
+ this.eligibleShippingMethods$ = this.entity$.pipe(operators.switchMap(function (order) { return _this.dataService.order
898
+ .getDraftOrderEligibleShippingMethods(order.id)
899
+ .mapSingle(function (_c) {
900
+ var eligibleShippingMethodsForDraftOrder = _c.eligibleShippingMethodsForDraftOrder;
901
+ return eligibleShippingMethodsForDraftOrder;
902
+ }); }));
903
+ this.customFields = this.getCustomFieldConfig('Order');
904
+ this.orderLineCustomFields = this.getCustomFieldConfig('OrderLine');
905
+ };
906
+ DraftOrderDetailComponent.prototype.ngOnDestroy = function () {
907
+ this.destroy();
908
+ };
909
+ DraftOrderDetailComponent.prototype.addItemToOrder = function (event) {
910
+ var _this = this;
911
+ this.dataService.order.addItemToDraftOrder(this.id, event).subscribe(function (result) {
912
+ if (result.addItemToDraftOrder.__typename !== 'Order') {
913
+ _this.notificationService.error(result.addItemToDraftOrder.message);
914
+ }
915
+ });
916
+ };
917
+ DraftOrderDetailComponent.prototype.adjustOrderLine = function (event) {
918
+ var _this = this;
919
+ this.dataService.order
920
+ .adjustDraftOrderLine(this.id, { orderLineId: event.lineId, quantity: event.quantity })
921
+ .subscribe(function (result) {
922
+ if (result.adjustDraftOrderLine.__typename !== 'Order') {
923
+ _this.notificationService.error(result.adjustDraftOrderLine.message);
924
+ }
925
+ });
926
+ };
927
+ DraftOrderDetailComponent.prototype.removeOrderLine = function (event) {
928
+ var _this = this;
929
+ this.dataService.order.removeDraftOrderLine(this.id, event.lineId).subscribe(function (result) {
930
+ if (result.removeDraftOrderLine.__typename !== 'Order') {
931
+ _this.notificationService.error(result.removeDraftOrderLine.message);
932
+ }
933
+ });
934
+ };
935
+ DraftOrderDetailComponent.prototype.getOrderAddressLines = function (orderAddress) {
936
+ if (!orderAddress) {
937
+ return [];
938
+ }
939
+ return Object.values(orderAddress)
940
+ .filter(function (val) { return val !== 'OrderAddress'; })
941
+ .filter(function (line) { return !!line; });
942
+ };
943
+ DraftOrderDetailComponent.prototype.setCustomer = function () {
944
+ var _this = this;
945
+ this.modalService.fromComponent(SelectCustomerDialogComponent).subscribe(function (result) {
946
+ if (_this.hasId(result)) {
947
+ _this.dataService.order
948
+ .setCustomerForDraftOrder(_this.id, { customerId: result.id })
949
+ .subscribe();
950
+ }
951
+ else if (result) {
952
+ _this.dataService.order.setCustomerForDraftOrder(_this.id, { input: result }).subscribe();
953
+ }
954
+ });
955
+ };
956
+ DraftOrderDetailComponent.prototype.setShippingAddress = function () {
957
+ var _this = this;
958
+ this.entity$
959
+ .pipe(operators.take(1), operators.switchMap(function (order) {
960
+ var _a, _b;
961
+ return _this.modalService.fromComponent(SelectAddressDialogComponent, {
962
+ locals: {
963
+ customerId: (_a = order.customer) === null || _a === void 0 ? void 0 : _a.id,
964
+ currentAddress: (_b = order.shippingAddress) !== null && _b !== void 0 ? _b : undefined,
965
+ },
966
+ });
967
+ }))
968
+ .subscribe(function (result) {
969
+ if (result) {
970
+ _this.dataService.order.setDraftOrderShippingAddress(_this.id, result).subscribe();
971
+ }
972
+ });
973
+ };
974
+ DraftOrderDetailComponent.prototype.setBillingAddress = function () {
975
+ var _this = this;
976
+ this.entity$
977
+ .pipe(operators.take(1), operators.switchMap(function (order) {
978
+ var _a, _b;
979
+ return _this.modalService.fromComponent(SelectAddressDialogComponent, {
980
+ locals: {
981
+ customerId: (_a = order.customer) === null || _a === void 0 ? void 0 : _a.id,
982
+ currentAddress: (_b = order.billingAddress) !== null && _b !== void 0 ? _b : undefined,
983
+ },
984
+ });
985
+ }))
986
+ .subscribe(function (result) {
987
+ if (result) {
988
+ _this.dataService.order.setDraftOrderBillingAddress(_this.id, result).subscribe();
989
+ }
990
+ });
991
+ };
992
+ DraftOrderDetailComponent.prototype.applyCouponCode = function (couponCode) {
993
+ this.dataService.order.applyCouponCodeToDraftOrder(this.id, couponCode).subscribe();
994
+ };
995
+ DraftOrderDetailComponent.prototype.removeCouponCode = function (couponCode) {
996
+ this.dataService.order.removeCouponCodeFromDraftOrder(this.id, couponCode).subscribe();
997
+ };
998
+ DraftOrderDetailComponent.prototype.setShippingMethod = function () {
999
+ var _this = this;
1000
+ rxjs.combineLatest(this.entity$, this.eligibleShippingMethods$)
1001
+ .pipe(operators.take(1), operators.switchMap(function (_c) {
1002
+ var _d = __read(_c, 2), order = _d[0], methods = _d[1];
1003
+ var _a, _b;
1004
+ return _this.modalService.fromComponent(SelectShippingMethodDialogComponent, {
1005
+ locals: {
1006
+ eligibleShippingMethods: methods,
1007
+ currencyCode: order.currencyCode,
1008
+ currentSelectionId: (_b = (_a = order.shippingLines) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.shippingMethod.id,
1009
+ },
1010
+ });
1011
+ }))
1012
+ .subscribe(function (result) {
1013
+ if (result) {
1014
+ _this.dataService.order.setDraftOrderShippingMethod(_this.id, result).subscribe();
1015
+ }
1016
+ });
1017
+ };
1018
+ DraftOrderDetailComponent.prototype.updateCustomFields = function (customFieldsValue) {
1019
+ this.dataService.order
1020
+ .updateOrderCustomFields({
1021
+ id: this.id,
1022
+ customFields: customFieldsValue,
1023
+ })
1024
+ .subscribe();
1025
+ };
1026
+ DraftOrderDetailComponent.prototype.deleteOrder = function () {
1027
+ var _this = this;
1028
+ this.dataService.order.deleteDraftOrder(this.id).subscribe(function (_c) {
1029
+ var deleteDraftOrder = _c.deleteDraftOrder;
1030
+ if (deleteDraftOrder.result === i1.DeletionResult.DELETED) {
1031
+ _this.notificationService.success(ngxTranslateExtractMarker.marker('common.notify-delete-success'), {
1032
+ entity: 'Order',
1033
+ });
1034
+ _this.router.navigate(['/orders']);
1035
+ }
1036
+ else if (deleteDraftOrder.message) {
1037
+ _this.notificationService.error(deleteDraftOrder.message);
1038
+ }
1039
+ });
1040
+ };
1041
+ DraftOrderDetailComponent.prototype.completeOrder = function () {
1042
+ var _this = this;
1043
+ this.dataService.order
1044
+ .transitionToState(this.id, 'ArrangingPayment')
1045
+ .subscribe(function (_c) {
1046
+ var transitionOrderToState = _c.transitionOrderToState;
1047
+ if ((transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.__typename) === 'Order') {
1048
+ _this.router.navigate(['/orders', _this.id]);
1049
+ }
1050
+ else if ((transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.__typename) === 'OrderStateTransitionError') {
1051
+ _this.notificationService.error(transitionOrderToState.transitionError);
1052
+ }
1053
+ });
1054
+ };
1055
+ DraftOrderDetailComponent.prototype.hasId = function (input) {
1056
+ return typeof input === 'object' && !!input.id;
1057
+ };
1058
+ DraftOrderDetailComponent.prototype.setFormValues = function (entity) {
1059
+ // empty
1060
+ };
1061
+ return DraftOrderDetailComponent;
1062
+ }(i1.BaseDetailComponent));
1063
+ DraftOrderDetailComponent.decorators = [
1064
+ { type: i0.Component, args: [{
1065
+ selector: 'vdr-draft-order-detail',
1066
+ template: "<vdr-action-bar *ngIf=\"entity$ | async as order\">\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <button\r\n class=\"btn btn-primary\"\r\n (click)=\"completeOrder()\"\r\n [disabled]=\"!order.customer || !order.lines.length || !order.shippingLines.length\"\r\n >\r\n <clr-icon shape=\"check\"></clr-icon>\r\n {{ 'order.complete-draft-order' | translate }}\r\n </button>\r\n <vdr-dropdown>\r\n <button class=\"icon-button\" vdrDropdownTrigger>\r\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <button type=\"button\" class=\"btn\" vdrDropdownItem (click)=\"deleteOrder()\">\r\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\r\n {{ 'order.delete-draft-order' | translate }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<div *ngIf=\"entity$ | async as order\">\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col-lg-8\">\r\n <vdr-draft-order-variant-selector\r\n [orderLineCustomFields]=\"orderLineCustomFields\"\r\n [currencyCode]=\"order.currencyCode\"\r\n (addItem)=\"addItemToOrder($event)\"\r\n ></vdr-draft-order-variant-selector>\r\n <vdr-order-table\r\n [order]=\"order\"\r\n [orderLineCustomFields]=\"orderLineCustomFields\"\r\n [isDraft]=\"true\"\r\n (adjust)=\"adjustOrderLine($event)\"\r\n (remove)=\"removeOrderLine($event)\"\r\n ></vdr-order-table>\r\n <div class=\"flex\">\r\n <button\r\n *ngIf=\"order.couponCodes.length === 0 && !displayCouponCodeInput\"\r\n class=\"btn btn-link btn-sm mr2\"\r\n (click)=\"displayCouponCodeInput = !displayCouponCodeInput\"\r\n >\r\n {{ 'order.set-coupon-codes' | translate }}\r\n </button>\r\n <div *ngIf=\"order.couponCodes.length || displayCouponCodeInput\">\r\n <label>{{ 'order.set-coupon-codes' | translate }}</label>\r\n <vdr-coupon-code-selector\r\n [couponCodes]=\"order.couponCodes\"\r\n (addCouponCode)=\"applyCouponCode($event)\"\r\n (removeCouponCode)=\"removeCouponCode($event)\"\r\n ></vdr-coupon-code-selector>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"order.taxSummary.length\">\r\n <h4>{{ 'order.tax-summary' | translate }}</h4>\r\n <table class=\"table\">\r\n <thead>\r\n <tr>\r\n <th>{{ 'common.description' | translate }}</th>\r\n <th>{{ 'order.tax-rate' | translate }}</th>\r\n <th>{{ 'order.tax-base' | translate }}</th>\r\n <th>{{ 'order.tax-total' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let row of order.taxSummary\">\r\n <td>{{ row.description }}</td>\r\n <td>{{ row.taxRate / 100 | percent }}</td>\r\n <td>{{ row.taxBase | localeCurrency: order.currencyCode }}</td>\r\n <td>{{ row.taxTotal | localeCurrency: order.currencyCode }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </ng-container>\r\n </div>\r\n <div class=\"clr-col-lg-4 order-cards\">\r\n <div class=\"card\">\r\n <div class=\"card-header\">\r\n <clr-icon *ngIf=\"!order.customer\" shape=\"unknown-status\" class=\"is-warning\"></clr-icon>\r\n <clr-icon *ngIf=\"order.customer\" shape=\"check\" class=\"is-success\"></clr-icon>\r\n {{ 'order.customer' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <div class=\"card-text\">\r\n <vdr-customer-label\r\n class=\"block mb2\"\r\n *ngIf=\"order.customer\"\r\n [customer]=\"order.customer\"\r\n ></vdr-customer-label>\r\n <button class=\"btn btn-link btn-sm\" (click)=\"setCustomer()\">\r\n {{ 'order.set-customer-for-order' | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"card-block\">\r\n <h4 class=\"card-title\">\r\n <clr-icon\r\n *ngIf=\"!order.billingAddress.streetLine1\"\r\n shape=\"unknown-status\"\r\n class=\"is-warning\"\r\n ></clr-icon>\r\n <clr-icon\r\n *ngIf=\"order.billingAddress.streetLine1\"\r\n shape=\"check\"\r\n class=\"is-success\"\r\n ></clr-icon>\r\n {{ 'order.billing-address' | translate }}\r\n </h4>\r\n <div class=\"card-text\">\r\n <vdr-formatted-address\r\n class=\"block mb2\"\r\n *ngIf=\"order.billingAddress\"\r\n [address]=\"order.billingAddress\"\r\n ></vdr-formatted-address>\r\n <button class=\"btn btn-link btn-sm\" (click)=\"setBillingAddress()\">\r\n {{ 'order.set-billing-address' | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"card\">\r\n <div class=\"card-header\">\r\n <clr-icon\r\n *ngIf=\"!order.shippingAddress.streetLine1 || !order.shippingLines.length\"\r\n shape=\"unknown-status\"\r\n class=\"is-warning\"\r\n ></clr-icon>\r\n <clr-icon\r\n *ngIf=\"order.shippingAddress.streetLine1 && order.shippingLines.length\"\r\n shape=\"check\"\r\n class=\"is-success\"\r\n ></clr-icon>\r\n {{ 'order.shipping' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <div class=\"card-text\">\r\n <vdr-formatted-address\r\n class=\"block mb2\"\r\n *ngIf=\"order.shippingAddress\"\r\n [address]=\"order.shippingAddress\"\r\n ></vdr-formatted-address>\r\n <button class=\"btn btn-link btn-sm\" (click)=\"setShippingAddress()\">\r\n {{ 'order.set-shipping-address' | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"card-block\">\r\n <div class=\"card-text\">\r\n <div *ngFor=\"let shippingLine of order.shippingLines\">\r\n {{ shippingLine.shippingMethod.name }}\r\n </div>\r\n <button class=\"btn btn-link btn-sm\" (click)=\"setShippingMethod()\">\r\n {{ 'order.set-shipping-method' | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <vdr-order-custom-fields-card\r\n [customFieldsConfig]=\"customFields\"\r\n [customFieldValues]=\"order.customFields\"\r\n (updateClick)=\"updateCustomFields($event)\"\r\n ></vdr-order-custom-fields-card>\r\n </div>\r\n </div>\r\n</div>\r\n",
1067
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1068
+ styles: [""]
1069
+ },] }
1070
+ ];
1071
+ DraftOrderDetailComponent.ctorParameters = function () { return [
1072
+ { type: i1$1.Router },
1073
+ { type: i1$1.ActivatedRoute },
1074
+ { type: i1.ServerConfigService },
1075
+ { type: i0.ChangeDetectorRef },
1076
+ { type: i1.DataService },
1077
+ { type: i1.NotificationService },
1078
+ { type: i1.ModalService },
1079
+ { type: OrderTransitionService }
1080
+ ]; };
1081
+
1082
+ var DraftOrderVariantSelectorComponent = /** @class */ (function () {
1083
+ function DraftOrderVariantSelectorComponent(dataService) {
1084
+ this.dataService = dataService;
1085
+ this.addItem = new i0.EventEmitter();
1086
+ this.customFieldsFormGroup = new forms.FormGroup({});
1087
+ this.selectedVariantId$ = new rxjs.Subject();
1088
+ this.quantity = 1;
1089
+ }
1090
+ DraftOrderVariantSelectorComponent.prototype.ngOnInit = function () {
1091
+ var e_1, _a;
1092
+ var _this = this;
1093
+ this.selectedVariant$ = this.selectedVariantId$.pipe(operators.switchMap(function (id) {
1094
+ if (id) {
1095
+ return _this.dataService.product
1096
+ .getProductVariant(id)
1097
+ .mapSingle(function (_a) {
1098
+ var productVariant = _a.productVariant;
1099
+ return productVariant;
1100
+ });
1101
+ }
1102
+ else {
1103
+ return [undefined];
1104
+ }
1105
+ }));
1106
+ try {
1107
+ for (var _b = __values(this.orderLineCustomFields), _c = _b.next(); !_c.done; _c = _b.next()) {
1108
+ var customField = _c.value;
1109
+ this.customFieldsFormGroup.addControl(customField.name, new forms.FormControl(''));
1110
+ }
1111
+ }
1112
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1113
+ finally {
1114
+ try {
1115
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1116
+ }
1117
+ finally { if (e_1) throw e_1.error; }
1118
+ }
1119
+ };
1120
+ DraftOrderVariantSelectorComponent.prototype.addItemClick = function (selectedVariant) {
1121
+ if (selectedVariant) {
1122
+ this.addItem.emit({
1123
+ productVariantId: selectedVariant.id,
1124
+ quantity: this.quantity,
1125
+ customFields: this.orderLineCustomFields.length
1126
+ ? this.customFieldsFormGroup.value
1127
+ : undefined,
1128
+ });
1129
+ this.selectedVariantId$.next(undefined);
1130
+ this.customFieldsFormGroup.reset();
1131
+ }
1132
+ };
1133
+ return DraftOrderVariantSelectorComponent;
1134
+ }());
1135
+ DraftOrderVariantSelectorComponent.decorators = [
1136
+ { type: i0.Component, args: [{
1137
+ selector: 'vdr-draft-order-variant-selector',
1138
+ template: "<div class=\"card\">\r\n <div class=\"card-block\">\r\n <h4 class=\"card-title\">{{ 'order.add-item-to-order' | translate }}</h4>\r\n <vdr-product-selector\r\n (productSelected)=\"selectedVariantId$.next($event.productVariantId)\"\r\n ></vdr-product-selector>\r\n </div>\r\n <div class=\"card-block\" *ngIf=\"selectedVariant$ | async as selectedVariant\">\r\n <div class=\"variant-details\">\r\n <img class=\"mr2\" [src]=\"selectedVariant.featuredAsset || selectedVariant.product.featuredAsset | assetPreview: 32\">\r\n <div class=\"details\">\r\n <div>{{ selectedVariant?.name }}</div>\r\n <div class=\"small\">{{ selectedVariant?.sku }}</div>\r\n </div>\r\n <div class=\"details ml4\">\r\n <div class=\"small\">\r\n {{ 'catalog.stock-on-hand' | translate }}: {{ selectedVariant.stockOnHand }}\r\n </div>\r\n <div class=\"small\">\r\n {{ 'catalog.stock-allocated' | translate }}: {{ selectedVariant.stockAllocated }}\r\n </div>\r\n </div>\r\n <div class=\"flex-spacer\"></div>\r\n <div class=\"details\">\r\n <div>{{ selectedVariant?.priceWithTax | localeCurrency: currencyCode }}</div>\r\n <div class=\"small\" [title]=\"'order.net-price' | translate\">\r\n {{ selectedVariant?.price | localeCurrency: currencyCode }}\r\n </div>\r\n </div>\r\n <div>\r\n <input [disabled]=\"!selectedVariant\" type=\"number\" min=\"0\" [(ngModel)]=\"quantity\" />\r\n </div>\r\n <button\r\n [disabled]=\"!selectedVariant\"\r\n class=\"btn btn-small btn-primary\"\r\n (click)=\"addItemClick(selectedVariant)\"\r\n >\r\n {{ 'order.add-item-to-order' | translate }}\r\n </button>\r\n </div>\r\n <ng-container *ngIf=\"orderLineCustomFields.length\">\r\n <div class=\"custom-field\" *ngFor=\"let field of orderLineCustomFields\">\r\n <vdr-custom-field-control\r\n [compact]=\"true\"\r\n [readonly]=\"false\"\r\n [customField]=\"field\"\r\n [customFieldsFormGroup]=\"customFieldsFormGroup\"\r\n ></vdr-custom-field-control>\r\n </div>\r\n </ng-container>\r\n </div>\r\n</div>\r\n",
1139
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1140
+ 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"]
1141
+ },] }
1142
+ ];
1143
+ DraftOrderVariantSelectorComponent.ctorParameters = function () { return [
1144
+ { type: i1.DataService }
1145
+ ]; };
1146
+ DraftOrderVariantSelectorComponent.propDecorators = {
1147
+ currencyCode: [{ type: i0.Input }],
1148
+ orderLineCustomFields: [{ type: i0.Input }],
1149
+ addItem: [{ type: i0.Output }]
1150
+ };
1151
+
513
1152
  var FulfillOrderDialogComponent = /** @class */ (function () {
514
1153
  function FulfillOrderDialogComponent(dataService, changeDetector) {
515
1154
  this.dataService = dataService;
@@ -992,144 +1631,6 @@
992
1631
  updateClick: [{ type: i0.Output }]
993
1632
  };
994
1633
 
995
- var OrderStateSelectDialogComponent = /** @class */ (function () {
996
- function OrderStateSelectDialogComponent() {
997
- this.nextStates = [];
998
- this.message = '';
999
- this.selectedState = '';
1000
- }
1001
- OrderStateSelectDialogComponent.prototype.select = function () {
1002
- if (this.selectedState) {
1003
- this.resolveWith(this.selectedState);
1004
- }
1005
- };
1006
- OrderStateSelectDialogComponent.prototype.cancel = function () {
1007
- this.resolveWith();
1008
- };
1009
- return OrderStateSelectDialogComponent;
1010
- }());
1011
- OrderStateSelectDialogComponent.decorators = [
1012
- { type: i0.Component, args: [{
1013
- selector: 'vdr-order-state-select-dialog',
1014
- template: "<ng-template vdrDialogTitle>{{ 'order.select-state' | translate }}</ng-template>\r\n<p>{{ message | translate }}</p>\r\n<clr-select-container>\r\n <select clrSelect name=\"state\" [(ngModel)]=\"selectedState\">\r\n <option *ngFor=\"let state of nextStates\" [value]=\"state\">\r\n {{ state | stateI18nToken | translate }}\r\n </option>\r\n </select>\r\n</clr-select-container>\r\n<ng-template vdrDialogButtons>\r\n <button type=\"submit\" *ngIf=\"cancellable\" (click)=\"cancel()\" class=\"btn btn-secondary\">\r\n {{ 'common.cancel' | translate }}\r\n </button>\r\n <button type=\"submit\" (click)=\"select()\" class=\"btn btn-primary\" [disabled]=\"!selectedState\">\r\n {{ 'order.transition-to-state' | translate: { state: (selectedState | stateI18nToken | translate) } }}\r\n </button>\r\n</ng-template>\r\n",
1015
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1016
- styles: [""]
1017
- },] }
1018
- ];
1019
-
1020
- var OrderTransitionService = /** @class */ (function () {
1021
- function OrderTransitionService(dataService, modalService, notificationService, i18nService) {
1022
- this.dataService = dataService;
1023
- this.modalService = modalService;
1024
- this.notificationService = notificationService;
1025
- this.i18nService = i18nService;
1026
- }
1027
- /**
1028
- * Attempts to transition the Order to the last state it was in before it was transitioned
1029
- * to the "Modifying" state. If this fails, a manual prompt is used.
1030
- */
1031
- OrderTransitionService.prototype.transitionToPreModifyingState = function (orderId, nextStates) {
1032
- var _this = this;
1033
- return this.getPreModifyingState(orderId).pipe(operators.switchMap(function (state) {
1034
- var manualTransitionOptions = {
1035
- orderId: orderId,
1036
- nextStates: nextStates,
1037
- message: _this.i18nService.translate(ngxTranslateExtractMarker.marker('order.unable-to-transition-to-state-try-another'), { state: state }),
1038
- cancellable: false,
1039
- retry: 10,
1040
- };
1041
- if (state) {
1042
- return _this.transitionToStateOrThrow(orderId, state).pipe(operators.catchError(function (err) { return _this.manuallyTransitionToState(manualTransitionOptions); }));
1043
- }
1044
- else {
1045
- return _this.manuallyTransitionToState(manualTransitionOptions);
1046
- }
1047
- }));
1048
- };
1049
- /**
1050
- * Displays a modal for manually selecting the next state.
1051
- */
1052
- OrderTransitionService.prototype.manuallyTransitionToState = function (options) {
1053
- var _this = this;
1054
- return this.modalService
1055
- .fromComponent(OrderStateSelectDialogComponent, {
1056
- locals: {
1057
- nextStates: options.nextStates,
1058
- cancellable: options.cancellable,
1059
- message: options.message,
1060
- },
1061
- closable: false,
1062
- size: 'md',
1063
- })
1064
- .pipe(operators.switchMap(function (result) {
1065
- if (result) {
1066
- return _this.transitionToStateOrThrow(options.orderId, result);
1067
- }
1068
- else {
1069
- if (!options.cancellable) {
1070
- throw new Error("An order state must be selected");
1071
- }
1072
- else {
1073
- return rxjs.EMPTY;
1074
- }
1075
- }
1076
- }), operators.retryWhen(function (errors) { return errors.pipe(operators.delay(2000), operators.take(options.retry)); }));
1077
- };
1078
- /**
1079
- * Attempts to get the last state the Order was in before it was transitioned
1080
- * to the "Modifying" state.
1081
- */
1082
- OrderTransitionService.prototype.getPreModifyingState = function (orderId) {
1083
- return this.dataService.order
1084
- .getOrderHistory(orderId, {
1085
- filter: {
1086
- type: {
1087
- eq: i1.HistoryEntryType.ORDER_STATE_TRANSITION,
1088
- },
1089
- },
1090
- sort: {
1091
- createdAt: i1.SortOrder.DESC,
1092
- },
1093
- })
1094
- .mapSingle(function (result) { return result.order; })
1095
- .pipe(operators.map(function (result) {
1096
- var item = result === null || result === void 0 ? void 0 : result.history.items.find(function (i) { return i.data.to === 'Modifying'; });
1097
- if (item) {
1098
- return item.data.from;
1099
- }
1100
- else {
1101
- return;
1102
- }
1103
- }));
1104
- };
1105
- OrderTransitionService.prototype.transitionToStateOrThrow = function (orderId, state) {
1106
- var _this = this;
1107
- return this.dataService.order.transitionToState(orderId, state).pipe(operators.map(function (_a) {
1108
- var transitionOrderToState = _a.transitionOrderToState;
1109
- switch (transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.__typename) {
1110
- case 'Order':
1111
- return transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.state;
1112
- case 'OrderStateTransitionError':
1113
- _this.notificationService.error(transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.transitionError);
1114
- throw new Error(transitionOrderToState === null || transitionOrderToState === void 0 ? void 0 : transitionOrderToState.transitionError);
1115
- }
1116
- }));
1117
- };
1118
- return OrderTransitionService;
1119
- }());
1120
- OrderTransitionService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function OrderTransitionService_Factory() { return new OrderTransitionService(i0__namespace.ɵɵinject(i1__namespace.DataService), i0__namespace.ɵɵinject(i1__namespace.ModalService), i0__namespace.ɵɵinject(i1__namespace.NotificationService), i0__namespace.ɵɵinject(i1__namespace.I18nService)); }, token: OrderTransitionService, providedIn: "root" });
1121
- OrderTransitionService.decorators = [
1122
- { type: i0.Injectable, args: [{
1123
- providedIn: 'root',
1124
- },] }
1125
- ];
1126
- OrderTransitionService.ctorParameters = function () { return [
1127
- { type: i1.DataService },
1128
- { type: i1.ModalService },
1129
- { type: i1.NotificationService },
1130
- { type: i1.I18nService }
1131
- ]; };
1132
-
1133
1634
  var OrderProcessGraphDialogComponent = /** @class */ (function () {
1134
1635
  function OrderProcessGraphDialogComponent(serverConfigService) {
1135
1636
  this.serverConfigService = serverConfigService;
@@ -1895,7 +2396,7 @@
1895
2396
  OrderDetailComponent.decorators = [
1896
2397
  { type: i0.Component, args: [{
1897
2398
  selector: 'vdr-order-detail',
1898
- template: "<vdr-action-bar *ngIf=\"entity$ | async as order\">\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <vdr-order-state-label [state]=\"order.state\">\r\n <button\r\n class=\"icon-button\"\r\n (click)=\"openStateDiagram()\"\r\n [title]=\"'order.order-state-diagram' | translate\"\r\n >\r\n <clr-icon shape=\"list\"></clr-icon>\r\n </button>\r\n </vdr-order-state-label>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"order-detail\"></vdr-action-bar-items>\r\n <button\r\n class=\"btn btn-primary\"\r\n *ngIf=\"\r\n (order.state === 'ArrangingPayment' || order.state === 'ArrangingAdditionalPayment') &&\r\n (hasUnsettledModifications(order) || 0 < outstandingPaymentAmount(order))\r\n \"\r\n (click)=\"addManualPayment(order)\"\r\n >\r\n {{ 'order.add-payment-to-order' | translate }}\r\n ({{ outstandingPaymentAmount(order) | localeCurrency: order.currencyCode }})\r\n </button>\r\n <button\r\n class=\"btn btn-primary\"\r\n *ngIf=\"\r\n order.active === false &&\r\n order.state !== 'ArrangingAdditionalPayment' &&\r\n 0 < outstandingPaymentAmount(order)\r\n \"\r\n (click)=\"transitionToState('ArrangingAdditionalPayment')\"\r\n >\r\n {{ 'order.arrange-additional-payment' | translate }}\r\n </button>\r\n <button class=\"btn btn-primary\" (click)=\"fulfillOrder()\" [disabled]=\"!canAddFulfillment(order)\">\r\n {{ 'order.fulfill-order' | translate }}\r\n </button>\r\n <vdr-dropdown>\r\n <button class=\"icon-button\" vdrDropdownTrigger>\r\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <ng-container *ngIf=\"order.nextStates.includes('Modifying')\">\r\n <button type=\"button\" class=\"btn\" vdrDropdownItem (click)=\"transitionToModifying()\">\r\n <clr-icon shape=\"pencil\"></clr-icon>\r\n {{ 'order.modify-order' | translate }}\r\n </button>\r\n <div class=\"dropdown-divider\"></div>\r\n </ng-container>\r\n <button\r\n type=\"button\"\r\n class=\"btn\"\r\n vdrDropdownItem\r\n *ngIf=\"order.nextStates.includes('Cancelled')\"\r\n (click)=\"cancelOrRefund(order)\"\r\n >\r\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\r\n <ng-container *ngIf=\"orderHasSettledPayments(order); else cancelOnly\">\r\n {{ 'order.refund-and-cancel-order' | translate }}\r\n </ng-container>\r\n <ng-template #cancelOnly>\r\n {{ 'order.cancel-order' | translate }}\r\n </ng-template>\r\n </button>\r\n\r\n <ng-container *ngIf=\"(nextStates$ | async)?.length\">\r\n <div class=\"dropdown-divider\"></div>\r\n <button\r\n *ngFor=\"let nextState of nextStates$ | async\"\r\n type=\"button\"\r\n class=\"btn\"\r\n vdrDropdownItem\r\n (click)=\"transitionToState(nextState)\"\r\n >\r\n <clr-icon shape=\"step-forward-2\"></clr-icon>\r\n {{\r\n 'order.transition-to-state'\r\n | translate: { state: (nextState | stateI18nToken | translate) }\r\n }}\r\n </button>\r\n </ng-container>\r\n <div class=\"dropdown-divider\"></div>\r\n <button type=\"button\" class=\"btn\" vdrDropdownItem (click)=\"manuallyTransitionToState(order)\">\r\n <clr-icon shape=\"step-forward-2\" class=\"is-warning\"></clr-icon>\r\n {{ 'order.manually-transition-to-state' | translate }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<div *ngIf=\"entity$ | async as order\">\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col-lg-8\">\r\n <vdr-order-table\r\n [order]=\"order\"\r\n [orderLineCustomFields]=\"orderLineCustomFields\"\r\n ></vdr-order-table>\r\n <h4>{{ 'order.tax-summary' | translate }}</h4>\r\n <table class=\"table\">\r\n <thead>\r\n <tr>\r\n <th>{{ 'common.description' | translate }}</th>\r\n <th>{{ 'order.tax-rate' | translate }}</th>\r\n <th>{{ 'order.tax-base' | translate }}</th>\r\n <th>{{ 'order.tax-total' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let row of order.taxSummary\">\r\n <td>{{ row.description }}</td>\r\n <td>{{ row.taxRate / 100 | percent }}</td>\r\n <td>{{ row.taxBase | localeCurrency: order.currencyCode }}</td>\r\n <td>{{ row.taxTotal | localeCurrency: order.currencyCode }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <vdr-custom-detail-component-host\r\n locationId=\"order-detail\"\r\n [entity$]=\"entity$\"\r\n [detailForm]=\"detailForm\"\r\n ></vdr-custom-detail-component-host>\r\n\r\n <vdr-order-history\r\n [order]=\"order\"\r\n [history]=\"history$ | async\"\r\n (addNote)=\"addNote($event)\"\r\n (updateNote)=\"updateNote($event)\"\r\n (deleteNote)=\"deleteNote($event)\"\r\n ></vdr-order-history>\r\n </div>\r\n <div class=\"clr-col-lg-4 order-cards\">\r\n <vdr-order-custom-fields-card\r\n [customFieldsConfig]=\"customFields\"\r\n [customFieldValues]=\"order.customFields\"\r\n (updateClick)=\"updateCustomFields($event)\"\r\n ></vdr-order-custom-fields-card>\r\n <div class=\"card\">\r\n <div class=\"card-header\">\r\n {{ 'order.customer' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <div class=\"card-text\">\r\n <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\r\n <h6 *ngIf=\"getOrderAddressLines(order.shippingAddress).length\">\r\n {{ 'order.shipping-address' | translate }}\r\n </h6>\r\n <vdr-formatted-address [address]=\"order.shippingAddress\"></vdr-formatted-address>\r\n <h6 *ngIf=\"getOrderAddressLines(order.billingAddress).length\">\r\n {{ 'order.billing-address' | translate }}\r\n </h6>\r\n <vdr-formatted-address [address]=\"order.billingAddress\"></vdr-formatted-address>\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"order.payments && order.payments.length\">\r\n <vdr-order-payment-card\r\n *ngFor=\"let payment of order.payments\"\r\n [currencyCode]=\"order.currencyCode\"\r\n [payment]=\"payment\"\r\n (settlePayment)=\"settlePayment($event)\"\r\n (transitionPaymentState)=\"transitionPaymentState($event)\"\r\n (settleRefund)=\"settleRefund($event)\"\r\n ></vdr-order-payment-card>\r\n </ng-container>\r\n <ng-container *ngFor=\"let fulfillment of order.fulfillments\">\r\n <vdr-fulfillment-card\r\n [fulfillment]=\"fulfillment\"\r\n [order]=\"order\"\r\n (transitionState)=\"transitionFulfillment(fulfillment.id, $event)\"\r\n ></vdr-fulfillment-card>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</div>\r\n",
2399
+ template: "<vdr-action-bar *ngIf=\"entity$ | async as order\">\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <vdr-order-state-label [state]=\"order.state\">\r\n <button\r\n class=\"icon-button\"\r\n (click)=\"openStateDiagram()\"\r\n [title]=\"'order.order-state-diagram' | translate\"\r\n >\r\n <clr-icon shape=\"list\"></clr-icon>\r\n </button>\r\n </vdr-order-state-label>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"order-detail\"></vdr-action-bar-items>\r\n <button\r\n class=\"btn btn-primary\"\r\n *ngIf=\"\r\n (order.state === 'ArrangingPayment' || order.state === 'ArrangingAdditionalPayment') &&\r\n (hasUnsettledModifications(order) || 0 < outstandingPaymentAmount(order))\r\n \"\r\n (click)=\"addManualPayment(order)\"\r\n >\r\n {{ 'order.add-payment-to-order' | translate }}\r\n ({{ outstandingPaymentAmount(order) | localeCurrency: order.currencyCode }})\r\n </button>\r\n <button\r\n class=\"btn btn-primary\"\r\n *ngIf=\"\r\n order.active === false &&\r\n order.state !== 'ArrangingAdditionalPayment' &&\r\n order.state !== 'ArrangingPayment' &&\r\n 0 < outstandingPaymentAmount(order)\r\n \"\r\n (click)=\"transitionToState('ArrangingAdditionalPayment')\"\r\n >\r\n {{ 'order.arrange-additional-payment' | translate }}\r\n </button>\r\n <button class=\"btn btn-primary\" (click)=\"fulfillOrder()\" [disabled]=\"!canAddFulfillment(order)\">\r\n {{ 'order.fulfill-order' | translate }}\r\n </button>\r\n <vdr-dropdown>\r\n <button class=\"icon-button\" vdrDropdownTrigger>\r\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <ng-container *ngIf=\"order.nextStates.includes('Modifying')\">\r\n <button type=\"button\" class=\"btn\" vdrDropdownItem (click)=\"transitionToModifying()\">\r\n <clr-icon shape=\"pencil\"></clr-icon>\r\n {{ 'order.modify-order' | translate }}\r\n </button>\r\n <div class=\"dropdown-divider\"></div>\r\n </ng-container>\r\n <button\r\n type=\"button\"\r\n class=\"btn\"\r\n vdrDropdownItem\r\n *ngIf=\"order.nextStates.includes('Cancelled')\"\r\n (click)=\"cancelOrRefund(order)\"\r\n >\r\n <clr-icon shape=\"error-standard\" class=\"is-error\"></clr-icon>\r\n <ng-container *ngIf=\"orderHasSettledPayments(order); else cancelOnly\">\r\n {{ 'order.refund-and-cancel-order' | translate }}\r\n </ng-container>\r\n <ng-template #cancelOnly>\r\n {{ 'order.cancel-order' | translate }}\r\n </ng-template>\r\n </button>\r\n\r\n <ng-container *ngIf=\"(nextStates$ | async)?.length\">\r\n <div class=\"dropdown-divider\"></div>\r\n <button\r\n *ngFor=\"let nextState of nextStates$ | async\"\r\n type=\"button\"\r\n class=\"btn\"\r\n vdrDropdownItem\r\n (click)=\"transitionToState(nextState)\"\r\n >\r\n <clr-icon shape=\"step-forward-2\"></clr-icon>\r\n {{\r\n 'order.transition-to-state'\r\n | translate: { state: (nextState | stateI18nToken | translate) }\r\n }}\r\n </button>\r\n </ng-container>\r\n <div class=\"dropdown-divider\"></div>\r\n <button type=\"button\" class=\"btn\" vdrDropdownItem (click)=\"manuallyTransitionToState(order)\">\r\n <clr-icon shape=\"step-forward-2\" class=\"is-warning\"></clr-icon>\r\n {{ 'order.manually-transition-to-state' | translate }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<div *ngIf=\"entity$ | async as order\">\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col-lg-8\">\r\n <vdr-order-table\r\n [order]=\"order\"\r\n [orderLineCustomFields]=\"orderLineCustomFields\"\r\n ></vdr-order-table>\r\n <h4>{{ 'order.tax-summary' | translate }}</h4>\r\n <table class=\"table\">\r\n <thead>\r\n <tr>\r\n <th>{{ 'common.description' | translate }}</th>\r\n <th>{{ 'order.tax-rate' | translate }}</th>\r\n <th>{{ 'order.tax-base' | translate }}</th>\r\n <th>{{ 'order.tax-total' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let row of order.taxSummary\">\r\n <td>{{ row.description }}</td>\r\n <td>{{ row.taxRate / 100 | percent }}</td>\r\n <td>{{ row.taxBase | localeCurrency: order.currencyCode }}</td>\r\n <td>{{ row.taxTotal | localeCurrency: order.currencyCode }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <vdr-custom-detail-component-host\r\n locationId=\"order-detail\"\r\n [entity$]=\"entity$\"\r\n [detailForm]=\"detailForm\"\r\n ></vdr-custom-detail-component-host>\r\n\r\n <vdr-order-history\r\n [order]=\"order\"\r\n [history]=\"history$ | async\"\r\n (addNote)=\"addNote($event)\"\r\n (updateNote)=\"updateNote($event)\"\r\n (deleteNote)=\"deleteNote($event)\"\r\n ></vdr-order-history>\r\n </div>\r\n <div class=\"clr-col-lg-4 order-cards\">\r\n <vdr-order-custom-fields-card\r\n [customFieldsConfig]=\"customFields\"\r\n [customFieldValues]=\"order.customFields\"\r\n (updateClick)=\"updateCustomFields($event)\"\r\n ></vdr-order-custom-fields-card>\r\n <div class=\"card\">\r\n <div class=\"card-header\">\r\n {{ 'order.customer' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <div class=\"card-text\">\r\n <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\r\n <h6 *ngIf=\"getOrderAddressLines(order.shippingAddress).length\">\r\n {{ 'order.shipping-address' | translate }}\r\n </h6>\r\n <vdr-formatted-address [address]=\"order.shippingAddress\"></vdr-formatted-address>\r\n <h6 *ngIf=\"getOrderAddressLines(order.billingAddress).length\">\r\n {{ 'order.billing-address' | translate }}\r\n </h6>\r\n <vdr-formatted-address [address]=\"order.billingAddress\"></vdr-formatted-address>\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"order.payments && order.payments.length\">\r\n <vdr-order-payment-card\r\n *ngFor=\"let payment of order.payments\"\r\n [currencyCode]=\"order.currencyCode\"\r\n [payment]=\"payment\"\r\n (settlePayment)=\"settlePayment($event)\"\r\n (transitionPaymentState)=\"transitionPaymentState($event)\"\r\n (settleRefund)=\"settleRefund($event)\"\r\n ></vdr-order-payment-card>\r\n </ng-container>\r\n <ng-container *ngFor=\"let fulfillment of order.fulfillments\">\r\n <vdr-fulfillment-card\r\n [fulfillment]=\"fulfillment\"\r\n [order]=\"order\"\r\n (transitionState)=\"transitionFulfillment(fulfillment.id, $event)\"\r\n ></vdr-fulfillment-card>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</div>\r\n",
1899
2400
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1900
2401
  styles: [".shipping-address{list-style-type:none;line-height:1.3em}.order-cards h6{margin-top:6px;color:var(--color-text-200)}\n"]
1901
2402
  },] }
@@ -1976,7 +2477,6 @@
1976
2477
  _this.notificationService = notificationService;
1977
2478
  _this.modalService = modalService;
1978
2479
  _this.orderTransitionService = orderTransitionService;
1979
- _this.couponCodeInput$ = new rxjs.Subject();
1980
2480
  _this.detailForm = new forms.FormGroup({});
1981
2481
  _this.couponCodesControl = new forms.FormControl();
1982
2482
  _this.modifyOrderInput = {
@@ -2106,13 +2606,6 @@
2106
2606
  finally { if (e_2) throw e_2.error; }
2107
2607
  }
2108
2608
  });
2109
- this.availableCouponCodes$ = rxjs.concat(this.couponCodeInput$.pipe(operators.distinctUntilChanged(), operators.switchMap(function (term) { return _this.dataService.promotion.getPromotions(10, 0, {
2110
- couponCode: { contains: term },
2111
- }).single$; }), operators.map(function (_u) {
2112
- var promotions = _u.promotions;
2113
- // tslint:disable-next-line:no-non-null-assertion
2114
- return promotions.items.map(function (p) { return ({ code: p.couponCode, promotionName: p.name }); });
2115
- }), operators.startWith([])));
2116
2609
  this.addItemCustomFieldsFormArray = new forms.FormArray([]);
2117
2610
  this.addItemCustomFieldsForm = new forms.FormGroup({});
2118
2611
  try {
@@ -2397,9 +2890,9 @@
2397
2890
  OrderEditorComponent.decorators = [
2398
2891
  { type: i0.Component, args: [{
2399
2892
  selector: 'vdr-order-editor',
2400
- template: "<vdr-action-bar *ngIf=\"entity$ | async as order\">\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <button class=\"btn btn-secondary\" (click)=\"transitionToPriorState(order)\">\r\n {{ 'order.cancel-modification' | translate }}\r\n </button>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<div *ngIf=\"entity$ | async as order\">\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col-lg-8\">\r\n <table class=\"order-table table\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>{{ 'order.product-name' | translate }}</th>\r\n <th>{{ 'order.product-sku' | translate }}</th>\r\n <th>{{ 'order.unit-price' | translate }}</th>\r\n <th>{{ 'order.quantity' | translate }}</th>\r\n <th *ngIf=\"orderLineCustomFields.length\">{{ 'common.custom-fields' | translate }}</th>\r\n <th>{{ 'order.total' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n *ngFor=\"let line of order.lines; let i = index\"\r\n class=\"order-line\"\r\n [class.is-cancelled]=\"line.quantity === 0\"\r\n [class.modified]=\"isLineModified(line)\"\r\n >\r\n <td class=\"align-middle thumb\">\r\n <img\r\n *ngIf=\"line.featuredAsset\"\r\n [src]=\"line.featuredAsset | assetPreview: 'tiny'\"\r\n />\r\n </td>\r\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\r\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\r\n <td class=\"align-middle unit-price\">\r\n {{ line.unitPriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.unitPrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n <td class=\"align-middle quantity\">\r\n <input\r\n type=\"number\"\r\n min=\"0\"\r\n [value]=\"line.quantity\"\r\n (input)=\"updateLineQuantity(line, $event.target.value)\"\r\n />\r\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\r\n <vdr-line-fulfillment\r\n [line]=\"line\"\r\n [orderState]=\"order.state\"\r\n ></vdr-line-fulfillment>\r\n </td>\r\n <td *ngIf=\"orderLineCustomFields.length\" class=\"order-line-custom-field align-middle\">\r\n <vdr-tabbed-custom-fields\r\n entityName=\"OrderLine\"\r\n [customFields]=\"orderLineCustomFields\"\r\n [customFieldsFormGroup]=\"orderLineCustomFieldsFormArray.get([i])\"\r\n [compact]=\"true\"\r\n ></vdr-tabbed-custom-fields>\r\n </td>\r\n <td class=\"align-middle total\">\r\n {{ line.linePriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.linePrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngFor=\"let addedLine of addedLines; trackBy: trackByProductVariantId; let i = index\"\r\n class=\"modified\"\r\n >\r\n <td class=\"align-middle thumb\">\r\n <img\r\n *ngIf=\"addedLine.productAsset\"\r\n [src]=\"addedLine.productAsset | assetPreview: 'tiny'\"\r\n />\r\n </td>\r\n <td class=\"align-middle name\">{{ addedLine.productVariantName }}</td>\r\n <td class=\"align-middle sku\">{{ addedLine.sku }}</td>\r\n <td class=\"align-middle unit-price\">\r\n {{ addedLine.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ addedLine.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n <td class=\"align-middle quantity\">\r\n <input\r\n type=\"number\"\r\n min=\"0\"\r\n [value]=\"addedLine.quantity\"\r\n (input)=\"updateAddedItemQuantity(addedLine, $event.target.value)\"\r\n />\r\n <button class=\"icon-button\" (click)=\"removeAddedItem(i)\">\r\n <clr-icon shape=\"trash\"></clr-icon>\r\n </button>\r\n </td>\r\n <td *ngIf=\"orderLineCustomFields.length\" class=\"order-line-custom-field align-middle\">\r\n <ng-container *ngFor=\"let customField of orderLineCustomFields\">\r\n <vdr-custom-field-control\r\n [customField]=\"customField\"\r\n [customFieldsFormGroup]=\"addItemCustomFieldsFormArray.get([i])\"\r\n entityName=\"OrderLine\"\r\n [compact]=\"true\"\r\n ></vdr-custom-field-control>\r\n </ng-container>\r\n </td>\r\n <td class=\"align-middle total\">\r\n {{\r\n (addedLine.priceWithTax * addedLine.quantity) / 100\r\n | currency: order.currencyCode\r\n }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{\r\n (addedLine.price * addedLine.quantity) / 100\r\n | currency: order.currencyCode\r\n }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class=\"surcharge\" *ngFor=\"let surcharge of order.surcharges\">\r\n <td class=\"align-middle name left\" colspan=\"2\">{{ surcharge.description }}</td>\r\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\r\n <td class=\"align-middle\"></td>\r\n <td></td>\r\n <td *ngIf=\"orderLineCustomFields.length\"></td>\r\n <td class=\"align-middle total\">\r\n {{ surcharge.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ surcharge.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr\r\n class=\"surcharge modified\"\r\n *ngFor=\"let surcharge of modifyOrderInput.surcharges; let i = index\"\r\n >\r\n <td class=\"align-middle name left\" colspan=\"2\">\r\n {{ surcharge.description }}\r\n <button class=\"icon-button\" (click)=\"removeSurcharge(i)\">\r\n <clr-icon shape=\"trash\"></clr-icon>\r\n </button>\r\n </td>\r\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\r\n <td class=\"align-middle\"></td>\r\n <td></td>\r\n <td *ngIf=\"orderLineCustomFields.length\"></td>\r\n <td class=\"align-middle total\">\r\n <ng-container *ngIf=\"getSurchargePrices(surcharge) as surchargePrice\">\r\n {{ surchargePrice.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ surchargePrice.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n <tr class=\"shipping\">\r\n <td class=\"left clr-align-middle\">{{ 'order.shipping' | translate }}</td>\r\n <td class=\"clr-align-middle\">{{ order.shippingLines[0]?.shippingMethod?.name }}</td>\r\n <td colspan=\"3\"></td>\r\n <td *ngIf=\"orderLineCustomFields.length\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.shippingWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.shipping | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <h4 class=\"mb2\">{{ 'order.modifications' | translate }}</h4>\r\n <clr-accordion>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.add-item-to-order' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <vdr-product-selector class=\"mb4\" (productSelected)=\"addItemSelectedVariant = $event\">\r\n </vdr-product-selector>\r\n <div *ngIf=\"addItemSelectedVariant\" class=\"flex mb4\">\r\n <img\r\n *ngIf=\"addItemSelectedVariant.productAsset as asset\"\r\n [src]=\"asset | assetPreview: 'tiny'\"\r\n class=\"mr4\"\r\n />\r\n <div>\r\n <strong class=\"mr4\">{{ addItemSelectedVariant.productVariantName }}</strong>\r\n <small>{{ addItemSelectedVariant.sku }}</small>\r\n <div>\r\n {{\r\n getSelectedItemPrice(addItemSelectedVariant)\r\n | localeCurrency: order.currencyCode\r\n }}\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container *ngFor=\"let customField of orderLineCustomFields\">\r\n <vdr-custom-field-control\r\n [readonly]=\"!addItemSelectedVariant\"\r\n [customField]=\"customField\"\r\n [customFieldsFormGroup]=\"addItemCustomFieldsForm\"\r\n entityName=\"OrderLine\"\r\n [compact]=\"true\"\r\n ></vdr-custom-field-control>\r\n </ng-container>\r\n <button\r\n class=\"btn btn-secondary\"\r\n [disabled]=\"!addItemSelectedVariant || addItemCustomFieldsForm.invalid\"\r\n (click)=\"addItemToOrder(addItemSelectedVariant)\"\r\n >\r\n {{ 'order.add-item-to-order' | translate }}\r\n </button>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.set-coupon-codes' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <ng-select\r\n [items]=\"availableCouponCodes$ | async\"\r\n appendTo=\"body\"\r\n bindLabel=\"code\"\r\n bindValue=\"code\"\r\n [addTag]=\"false\"\r\n [multiple]=\"true\"\r\n [hideSelected]=\"true\"\r\n [minTermLength]=\"2\"\r\n typeToSearchText=\"\"\r\n [typeahead]=\"couponCodeInput$\"\r\n [formControl]=\"couponCodesControl\"\r\n >\r\n <ng-template ng-option-tmp let-item=\"item\">\r\n <vdr-chip>{{ item.code }}</vdr-chip>\r\n {{ item.promotionName }}\r\n </ng-template>\r\n </ng-select>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.add-surcharge' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <form [formGroup]=\"surchargeForm\" (submit)=\"addSurcharge(surchargeForm.value)\">\r\n <vdr-form-field [label]=\"'common.description' | translate\" for=\"description\"\r\n ><input id=\"description\" type=\"text\" formControlName=\"description\"\r\n /></vdr-form-field>\r\n <vdr-form-field [label]=\"'order.product-sku' | translate\" for=\"sku\"\r\n ><input id=\"sku\" type=\"text\" formControlName=\"sku\"\r\n /></vdr-form-field>\r\n <vdr-form-field [label]=\"'common.price' | translate\" for=\"price\">\r\n <vdr-currency-input\r\n [currencyCode]=\"order.currencyCode\"\r\n id=\"price\"\r\n formControlName=\"price\"\r\n ></vdr-currency-input>\r\n </vdr-form-field>\r\n <vdr-form-field\r\n [label]=\"\r\n 'catalog.price-includes-tax-at'\r\n | translate: { rate: surchargeForm.get('taxRate')?.value }\r\n \"\r\n for=\"priceIncludesTax\"\r\n ><input\r\n id=\"priceIncludesTax\"\r\n type=\"checkbox\"\r\n clrCheckbox\r\n formControlName=\"priceIncludesTax\"\r\n /></vdr-form-field>\r\n <vdr-form-field [label]=\"'order.tax-rate' | translate\" for=\"taxRate\">\r\n <vdr-affixed-input suffix=\"%\"\r\n ><input\r\n id=\"taxRate\"\r\n type=\"number\"\r\n min=\"0\"\r\n max=\"100\"\r\n formControlName=\"taxRate\"\r\n /></vdr-affixed-input>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'order.tax-description' | translate\" for=\"taxDescription\"\r\n ><input id=\"taxDescription\" type=\"text\" formControlName=\"taxDescription\"\r\n /></vdr-form-field>\r\n <button\r\n class=\"btn btn-secondary\"\r\n [disabled]=\"\r\n surchargeForm.invalid ||\r\n surchargeForm.pristine ||\r\n surchargeForm.get('price')?.value === 0\r\n \"\r\n >\r\n {{ 'order.add-surcharge' | translate }}\r\n </button>\r\n </form>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.edit-shipping-address' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <vdr-address-form\r\n [formGroup]=\"shippingAddressForm\"\r\n [availableCountries]=\"availableCountries$ | async\"\r\n [customFields]=\"addressCustomFields\"\r\n ></vdr-address-form>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.edit-billing-address' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <vdr-address-form\r\n [formGroup]=\"billingAddressForm\"\r\n [availableCountries]=\"availableCountries$ | async\"\r\n [customFields]=\"addressCustomFields\"\r\n ></vdr-address-form>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n </clr-accordion>\r\n </div>\r\n <div class=\"clr-col-lg-4 order-cards\">\r\n <div class=\"card\">\r\n <div class=\"card-header\">\r\n {{ 'order.modification-summary' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <ul>\r\n <li *ngIf=\"modifyOrderInput.addItems?.length\">\r\n {{\r\n 'order.modification-adding-items'\r\n | translate: { count: modifyOrderInput.addItems?.length }\r\n }}\r\n </li>\r\n <li *ngIf=\"modifyOrderInput.adjustOrderLines?.length\">\r\n {{\r\n 'order.modification-adjusting-lines'\r\n | translate: { count: modifyOrderInput.adjustOrderLines?.length }\r\n }}\r\n </li>\r\n <li *ngIf=\"modifyOrderInput.surcharges?.length\">\r\n {{\r\n 'order.modification-adding-surcharges'\r\n | translate: { count: modifyOrderInput.surcharges?.length }\r\n }}\r\n </li>\r\n <li *ngIf=\"shippingAddressForm.dirty\">\r\n {{ 'order.modification-updating-shipping-address' | translate }}\r\n </li>\r\n <li *ngIf=\"billingAddressForm.dirty\">\r\n {{ 'order.modification-updating-billing-address' | translate }}\r\n </li>\r\n </ul>\r\n </div>\r\n <div class=\"card-block\">\r\n <label class=\"clr-control-label\">{{ 'order.note' | translate }}</label>\r\n <textarea [(ngModel)]=\"note\" name=\"note\" clrTextarea required></textarea>\r\n <clr-checkbox-wrapper class=\"\">\r\n <input type=\"checkbox\" clrCheckbox [(ngModel)]=\"recalculateShipping\" />\r\n <label>{{ 'order.modification-recalculate-shipping' | translate }}</label>\r\n </clr-checkbox-wrapper>\r\n </div>\r\n <div class=\"card-footer\">\r\n <button\r\n class=\"btn btn-primary\"\r\n [disabled]=\"!canPreviewChanges()\"\r\n (click)=\"previewAndModify(order)\"\r\n >\r\n {{ 'order.preview-changes' | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n",
2893
+ template: "<vdr-action-bar *ngIf=\"entity$ | async as order\">\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <button class=\"btn btn-secondary\" (click)=\"transitionToPriorState(order)\">\r\n {{ 'order.cancel-modification' | translate }}\r\n </button>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<div *ngIf=\"entity$ | async as order\">\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col-lg-8\">\r\n <table class=\"order-table table\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>{{ 'order.product-name' | translate }}</th>\r\n <th>{{ 'order.product-sku' | translate }}</th>\r\n <th>{{ 'order.unit-price' | translate }}</th>\r\n <th>{{ 'order.quantity' | translate }}</th>\r\n <th *ngIf=\"orderLineCustomFields.length\">{{ 'common.custom-fields' | translate }}</th>\r\n <th>{{ 'order.total' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n *ngFor=\"let line of order.lines; let i = index\"\r\n class=\"order-line\"\r\n [class.is-cancelled]=\"line.quantity === 0\"\r\n [class.modified]=\"isLineModified(line)\"\r\n >\r\n <td class=\"align-middle thumb\">\r\n <img\r\n *ngIf=\"line.featuredAsset\"\r\n [src]=\"line.featuredAsset | assetPreview: 'tiny'\"\r\n />\r\n </td>\r\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\r\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\r\n <td class=\"align-middle unit-price\">\r\n {{ line.unitPriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.unitPrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n <td class=\"align-middle quantity\">\r\n <input\r\n type=\"number\"\r\n min=\"0\"\r\n [value]=\"line.quantity\"\r\n (input)=\"updateLineQuantity(line, $event.target.value)\"\r\n />\r\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\r\n <vdr-line-fulfillment\r\n [line]=\"line\"\r\n [orderState]=\"order.state\"\r\n ></vdr-line-fulfillment>\r\n </td>\r\n <td *ngIf=\"orderLineCustomFields.length\" class=\"order-line-custom-field align-middle\">\r\n <vdr-tabbed-custom-fields\r\n entityName=\"OrderLine\"\r\n [customFields]=\"orderLineCustomFields\"\r\n [customFieldsFormGroup]=\"orderLineCustomFieldsFormArray.get([i])\"\r\n [compact]=\"true\"\r\n ></vdr-tabbed-custom-fields>\r\n </td>\r\n <td class=\"align-middle total\">\r\n {{ line.linePriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.linePrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr\r\n *ngFor=\"let addedLine of addedLines; trackBy: trackByProductVariantId; let i = index\"\r\n class=\"modified\"\r\n >\r\n <td class=\"align-middle thumb\">\r\n <img\r\n *ngIf=\"addedLine.productAsset\"\r\n [src]=\"addedLine.productAsset | assetPreview: 'tiny'\"\r\n />\r\n </td>\r\n <td class=\"align-middle name\">{{ addedLine.productVariantName }}</td>\r\n <td class=\"align-middle sku\">{{ addedLine.sku }}</td>\r\n <td class=\"align-middle unit-price\">\r\n {{ addedLine.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ addedLine.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n <td class=\"align-middle quantity\">\r\n <input\r\n type=\"number\"\r\n min=\"0\"\r\n [value]=\"addedLine.quantity\"\r\n (input)=\"updateAddedItemQuantity(addedLine, $event.target.value)\"\r\n />\r\n <button class=\"icon-button\" (click)=\"removeAddedItem(i)\">\r\n <clr-icon shape=\"trash\"></clr-icon>\r\n </button>\r\n </td>\r\n <td *ngIf=\"orderLineCustomFields.length\" class=\"order-line-custom-field align-middle\">\r\n <ng-container *ngFor=\"let customField of orderLineCustomFields\">\r\n <vdr-custom-field-control\r\n [customField]=\"customField\"\r\n [customFieldsFormGroup]=\"addItemCustomFieldsFormArray.get([i])\"\r\n entityName=\"OrderLine\"\r\n [compact]=\"true\"\r\n ></vdr-custom-field-control>\r\n </ng-container>\r\n </td>\r\n <td class=\"align-middle total\">\r\n {{\r\n (addedLine.priceWithTax * addedLine.quantity) / 100\r\n | currency: order.currencyCode\r\n }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{\r\n (addedLine.price * addedLine.quantity) / 100\r\n | currency: order.currencyCode\r\n }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class=\"surcharge\" *ngFor=\"let surcharge of order.surcharges\">\r\n <td class=\"align-middle name left\" colspan=\"2\">{{ surcharge.description }}</td>\r\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\r\n <td class=\"align-middle\"></td>\r\n <td></td>\r\n <td *ngIf=\"orderLineCustomFields.length\"></td>\r\n <td class=\"align-middle total\">\r\n {{ surcharge.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ surcharge.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr\r\n class=\"surcharge modified\"\r\n *ngFor=\"let surcharge of modifyOrderInput.surcharges; let i = index\"\r\n >\r\n <td class=\"align-middle name left\" colspan=\"2\">\r\n {{ surcharge.description }}\r\n <button class=\"icon-button\" (click)=\"removeSurcharge(i)\">\r\n <clr-icon shape=\"trash\"></clr-icon>\r\n </button>\r\n </td>\r\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\r\n <td class=\"align-middle\"></td>\r\n <td></td>\r\n <td *ngIf=\"orderLineCustomFields.length\"></td>\r\n <td class=\"align-middle total\">\r\n <ng-container *ngIf=\"getSurchargePrices(surcharge) as surchargePrice\">\r\n {{ surchargePrice.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ surchargePrice.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n <tr class=\"shipping\">\r\n <td class=\"left clr-align-middle\">{{ 'order.shipping' | translate }}</td>\r\n <td class=\"clr-align-middle\">{{ order.shippingLines[0]?.shippingMethod?.name }}</td>\r\n <td colspan=\"3\"></td>\r\n <td *ngIf=\"orderLineCustomFields.length\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.shippingWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.shipping | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <h4 class=\"mb2\">{{ 'order.modifications' | translate }}</h4>\r\n <clr-accordion>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.add-item-to-order' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <vdr-product-selector class=\"mb4\" (productSelected)=\"addItemSelectedVariant = $event\">\r\n </vdr-product-selector>\r\n <div *ngIf=\"addItemSelectedVariant\" class=\"flex mb4\">\r\n <img\r\n *ngIf=\"addItemSelectedVariant.productAsset as asset\"\r\n [src]=\"asset | assetPreview: 'tiny'\"\r\n class=\"mr4\"\r\n />\r\n <div>\r\n <strong class=\"mr4\">{{ addItemSelectedVariant.productVariantName }}</strong>\r\n <small>{{ addItemSelectedVariant.sku }}</small>\r\n <div>\r\n {{\r\n getSelectedItemPrice(addItemSelectedVariant)\r\n | localeCurrency: order.currencyCode\r\n }}\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container *ngFor=\"let customField of orderLineCustomFields\">\r\n <vdr-custom-field-control\r\n [readonly]=\"!addItemSelectedVariant\"\r\n [customField]=\"customField\"\r\n [customFieldsFormGroup]=\"addItemCustomFieldsForm\"\r\n entityName=\"OrderLine\"\r\n [compact]=\"true\"\r\n ></vdr-custom-field-control>\r\n </ng-container>\r\n <button\r\n class=\"btn btn-secondary\"\r\n [disabled]=\"!addItemSelectedVariant || addItemCustomFieldsForm.invalid\"\r\n (click)=\"addItemToOrder(addItemSelectedVariant)\"\r\n >\r\n {{ 'order.add-item-to-order' | translate }}\r\n </button>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.set-coupon-codes' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <vdr-coupon-code-selector\r\n [control]=\"couponCodesControl\"\r\n ></vdr-coupon-code-selector>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.add-surcharge' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <form [formGroup]=\"surchargeForm\" (submit)=\"addSurcharge(surchargeForm.value)\">\r\n <vdr-form-field [label]=\"'common.description' | translate\" for=\"description\"\r\n ><input id=\"description\" type=\"text\" formControlName=\"description\"\r\n /></vdr-form-field>\r\n <vdr-form-field [label]=\"'order.product-sku' | translate\" for=\"sku\"\r\n ><input id=\"sku\" type=\"text\" formControlName=\"sku\"\r\n /></vdr-form-field>\r\n <vdr-form-field [label]=\"'common.price' | translate\" for=\"price\">\r\n <vdr-currency-input\r\n [currencyCode]=\"order.currencyCode\"\r\n id=\"price\"\r\n formControlName=\"price\"\r\n ></vdr-currency-input>\r\n </vdr-form-field>\r\n <vdr-form-field\r\n [label]=\"\r\n 'catalog.price-includes-tax-at'\r\n | translate: { rate: surchargeForm.get('taxRate')?.value }\r\n \"\r\n for=\"priceIncludesTax\"\r\n ><input\r\n id=\"priceIncludesTax\"\r\n type=\"checkbox\"\r\n clrCheckbox\r\n formControlName=\"priceIncludesTax\"\r\n /></vdr-form-field>\r\n <vdr-form-field [label]=\"'order.tax-rate' | translate\" for=\"taxRate\">\r\n <vdr-affixed-input suffix=\"%\"\r\n ><input\r\n id=\"taxRate\"\r\n type=\"number\"\r\n min=\"0\"\r\n max=\"100\"\r\n formControlName=\"taxRate\"\r\n /></vdr-affixed-input>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'order.tax-description' | translate\" for=\"taxDescription\"\r\n ><input id=\"taxDescription\" type=\"text\" formControlName=\"taxDescription\"\r\n /></vdr-form-field>\r\n <button\r\n class=\"btn btn-secondary\"\r\n [disabled]=\"\r\n surchargeForm.invalid ||\r\n surchargeForm.pristine ||\r\n surchargeForm.get('price')?.value === 0\r\n \"\r\n >\r\n {{ 'order.add-surcharge' | translate }}\r\n </button>\r\n </form>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.edit-shipping-address' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <vdr-address-form\r\n [formGroup]=\"shippingAddressForm\"\r\n [availableCountries]=\"availableCountries$ | async\"\r\n [customFields]=\"addressCustomFields\"\r\n ></vdr-address-form>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n <clr-accordion-panel>\r\n <clr-accordion-title>{{ 'order.edit-billing-address' | translate }}</clr-accordion-title>\r\n <clr-accordion-content *clrIfExpanded>\r\n <vdr-address-form\r\n [formGroup]=\"billingAddressForm\"\r\n [availableCountries]=\"availableCountries$ | async\"\r\n [customFields]=\"addressCustomFields\"\r\n ></vdr-address-form>\r\n </clr-accordion-content>\r\n </clr-accordion-panel>\r\n </clr-accordion>\r\n </div>\r\n <div class=\"clr-col-lg-4 order-cards\">\r\n <div class=\"card\">\r\n <div class=\"card-header\">\r\n {{ 'order.modification-summary' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <ul>\r\n <li *ngIf=\"modifyOrderInput.addItems?.length\">\r\n {{\r\n 'order.modification-adding-items'\r\n | translate: { count: modifyOrderInput.addItems?.length }\r\n }}\r\n </li>\r\n <li *ngIf=\"modifyOrderInput.adjustOrderLines?.length\">\r\n {{\r\n 'order.modification-adjusting-lines'\r\n | translate: { count: modifyOrderInput.adjustOrderLines?.length }\r\n }}\r\n </li>\r\n <li *ngIf=\"modifyOrderInput.surcharges?.length\">\r\n {{\r\n 'order.modification-adding-surcharges'\r\n | translate: { count: modifyOrderInput.surcharges?.length }\r\n }}\r\n </li>\r\n <li *ngIf=\"shippingAddressForm.dirty\">\r\n {{ 'order.modification-updating-shipping-address' | translate }}\r\n </li>\r\n <li *ngIf=\"billingAddressForm.dirty\">\r\n {{ 'order.modification-updating-billing-address' | translate }}\r\n </li>\r\n </ul>\r\n </div>\r\n <div class=\"card-block\">\r\n <label class=\"clr-control-label\">{{ 'order.note' | translate }}</label>\r\n <textarea [(ngModel)]=\"note\" name=\"note\" clrTextarea required></textarea>\r\n <clr-checkbox-wrapper class=\"\">\r\n <input type=\"checkbox\" clrCheckbox [(ngModel)]=\"recalculateShipping\" />\r\n <label>{{ 'order.modification-recalculate-shipping' | translate }}</label>\r\n </clr-checkbox-wrapper>\r\n </div>\r\n <div class=\"card-footer\">\r\n <button\r\n class=\"btn btn-primary\"\r\n [disabled]=\"!canPreviewChanges()\"\r\n (click)=\"previewAndModify(order)\"\r\n >\r\n {{ 'order.preview-changes' | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n",
2401
2894
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2402
- 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:bold;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 .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-right:18px}.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)}.order-table .promotions-label{-webkit-text-decoration:underline dotted var(--color-text-200);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 tr.modified td{background-color:var(--color-warning-100)}.order-table .order-line-custom-field{text-align:start}\n"]
2895
+ 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:bold;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-right: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)}.order-table .promotions-label{-webkit-text-decoration:underline dotted var(--color-text-200);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 tr.modified td{background-color:var(--color-warning-100)}.order-table .order-line-custom-field{text-align:start}\n"]
2403
2896
  },] }
2404
2897
  ];
2405
2898
  OrderEditorComponent.ctorParameters = function () { return [
@@ -2593,7 +3086,9 @@
2593
3086
  var OrderListComponent = /** @class */ (function (_super) {
2594
3087
  __extends(OrderListComponent, _super);
2595
3088
  function OrderListComponent(serverConfigService, dataService, localStorageService, router, route) {
2596
- var _this = _super.call(this, router, route) || this;
3089
+ var _this = this;
3090
+ var _a;
3091
+ _this = _super.call(this, router, route) || this;
2597
3092
  _this.serverConfigService = serverConfigService;
2598
3093
  _this.dataService = dataService;
2599
3094
  _this.localStorageService = localStorageService;
@@ -2607,7 +3102,7 @@
2607
3102
  label: ngxTranslateExtractMarker.marker('order.filter-preset-open'),
2608
3103
  config: {
2609
3104
  active: false,
2610
- states: _this.orderStates.filter(function (s) { return s !== 'Delivered' && s !== 'Cancelled' && s !== 'Shipped'; }),
3105
+ states: _this.orderStates.filter(function (s) { return s !== 'Delivered' && s !== 'Cancelled' && s !== 'Shipped' && s !== 'Draft'; }),
2611
3106
  },
2612
3107
  },
2613
3108
  {
@@ -2633,7 +3128,16 @@
2633
3128
  active: true,
2634
3129
  },
2635
3130
  },
3131
+ {
3132
+ name: 'draft',
3133
+ label: ngxTranslateExtractMarker.marker('order.filter-preset-draft'),
3134
+ config: {
3135
+ active: false,
3136
+ states: ['Draft'],
3137
+ },
3138
+ },
2636
3139
  ];
3140
+ _this.canCreateDraftOrder = false;
2637
3141
  _super.prototype.setQueryFn.call(_this,
2638
3142
  // tslint:disable-next-line:no-shadowed-variable
2639
3143
  function (take, skip) { return _this.dataService.order.getOrders({ take: take, skip: skip }).refetchOnChannelChange(); }, function (data) { return data.orders; },
@@ -2643,6 +3147,12 @@
2643
3147
  if (lastFilters) {
2644
3148
  _this.setQueryParam(lastFilters, { replaceUrl: true });
2645
3149
  }
3150
+ _this.canCreateDraftOrder = !!((_a = _this.serverConfigService
3151
+ .getOrderProcessStates()
3152
+ .find(function (state) { return state.name === 'Created'; })) === null || _a === void 0 ? void 0 : _a.to.includes('Draft'));
3153
+ if (!_this.canCreateDraftOrder) {
3154
+ _this.filterPresets = _this.filterPresets.filter(function (p) { return p.name !== 'draft'; });
3155
+ }
2646
3156
  return _this;
2647
3157
  }
2648
3158
  OrderListComponent.prototype.ngOnInit = function () {
@@ -2769,9 +3279,9 @@
2769
3279
  OrderListComponent.decorators = [
2770
3280
  { type: i0.Component, args: [{
2771
3281
  selector: 'vdr-order-list',
2772
- template: "<vdr-action-bar>\r\n <vdr-ab-left>\r\n <div class=\"search-form\">\r\n <div class=\"btn-group btn-outline-primary\" *ngIf=\"activePreset$ | async as activePreset\">\r\n <button\r\n class=\"btn\"\r\n *ngFor=\"let preset of filterPresets\"\r\n [class.btn-primary]=\"activePreset === preset.name\"\r\n (click)=\"selectFilterPreset(preset.name)\"\r\n >\r\n {{ preset.label | translate }}\r\n </button>\r\n <button\r\n class=\"btn\"\r\n [class.btn-primary]=\"activePreset === 'custom'\"\r\n (click)=\"selectFilterPreset('custom')\"\r\n >\r\n {{ 'order.filter-custom' | translate }}\r\n <clr-icon shape=\"angle down\"></clr-icon>\r\n </button>\r\n </div>\r\n <input\r\n type=\"text\"\r\n name=\"searchTerm\"\r\n [formControl]=\"searchControl\"\r\n [placeholder]=\"'order.search-by-order-filters' | translate\"\r\n class=\"search-input\"\r\n />\r\n </div>\r\n <div class=\"custom-filters\" [class.expanded]=\"(activePreset$ | async) === 'custom'\">\r\n <form [formGroup]=\"customFilterForm\">\r\n <div class=\"flex align-center\">\r\n <ng-select\r\n [items]=\"orderStates\"\r\n appendTo=\"body\"\r\n [addTag]=\"false\"\r\n [multiple]=\"true\"\r\n formControlName=\"states\"\r\n [placeholder]=\"'state.all-orders' | translate\"\r\n [clearable]=\"true\"\r\n [searchable]=\"false\"\r\n >\r\n <ng-template ng-option-tmp let-item=\"item\">{{ item | stateI18nToken | translate }}</ng-template>\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <span class=\"ng-value-label\"> {{ item | stateI18nToken | translate }}</span>\r\n <span class=\"ng-value-icon right\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\r\n </ng-template>\r\n </ng-select>\r\n <button\r\n class=\"btn btn-secondary\"\r\n [disabled]=\"customFilterForm.pristine\"\r\n (click)=\"applyCustomFilters()\"\r\n >\r\n {{ 'order.apply-filters' | translate }}\r\n <clr-icon shape=\"filter\"></clr-icon>\r\n </button>\r\n </div>\r\n <div class=\"flex\">\r\n <div>\r\n <label>{{ 'order.placed-at-start' | translate }}</label>\r\n <vdr-datetime-picker formControlName=\"placedAtStart\"></vdr-datetime-picker>\r\n </div>\r\n <div>\r\n <label>{{ 'order.placed-at-end' | translate }}</label>\r\n <vdr-datetime-picker formControlName=\"placedAtEnd\"></vdr-datetime-picker>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n </vdr-ab-left>\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"order-list\"></vdr-action-bar-items>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<vdr-data-table\r\n [items]=\"items$ | async\"\r\n [itemsPerPage]=\"itemsPerPage$ | async\"\r\n [totalItems]=\"totalItems$ | async\"\r\n [currentPage]=\"currentPage$ | async\"\r\n (pageChange)=\"setPageNumber($event)\"\r\n (itemsPerPageChange)=\"setItemsPerPage($event)\"\r\n>\r\n <vdr-dt-column>{{ 'common.code' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.customer' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.state' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.total' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'common.updated-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.placed-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.shipping' | translate }}</vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <ng-template let-order=\"item\">\r\n <td class=\"left align-middle\">{{ order.code }}</td>\r\n <td class=\"left align-middle\">\r\n <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\r\n </td>\r\n <td class=\"left align-middle\">\r\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\r\n </td>\r\n <td class=\"left align-middle\">{{ order.totalWithTax | localeCurrency: order.currencyCode }}</td>\r\n <td class=\"left align-middle\">{{ order.updatedAt | timeAgo }}</td>\r\n <td class=\"left align-middle\">{{ order.orderPlacedAt | localeDate: 'medium' }}</td>\r\n <td class=\"left align-middle\">{{ getShippingNames(order) }}</td>\r\n <td class=\"right align-middle\">\r\n <vdr-table-row-action\r\n iconShape=\"shopping-cart\"\r\n [label]=\"'common.open' | translate\"\r\n [linkTo]=\"order.state === 'Modifying' ? ['./', order.id, 'modify'] : ['./', order.id]\"\r\n ></vdr-table-row-action>\r\n </td>\r\n </ng-template>\r\n</vdr-data-table>\r\n",
3282
+ template: "<vdr-action-bar>\r\n <vdr-ab-left>\r\n <div class=\"search-form\">\r\n <div class=\"filter-presets btn-group btn-outline-primary\" *ngIf=\"activePreset$ | async as activePreset\">\r\n <button\r\n class=\"btn\"\r\n *ngFor=\"let preset of filterPresets\"\r\n [class.btn-primary]=\"activePreset === preset.name\"\r\n (click)=\"selectFilterPreset(preset.name)\"\r\n >\r\n {{ preset.label | translate }}\r\n </button>\r\n <button\r\n class=\"btn\"\r\n [class.btn-primary]=\"activePreset === 'custom'\"\r\n (click)=\"selectFilterPreset('custom')\"\r\n >\r\n {{ 'order.filter-custom' | translate }}\r\n <clr-icon shape=\"angle down\"></clr-icon>\r\n </button>\r\n </div>\r\n <input\r\n type=\"text\"\r\n name=\"searchTerm\"\r\n [formControl]=\"searchControl\"\r\n [placeholder]=\"'order.search-by-order-filters' | translate\"\r\n class=\"search-input\"\r\n />\r\n </div>\r\n <div class=\"custom-filters\" [class.expanded]=\"(activePreset$ | async) === 'custom'\">\r\n <form [formGroup]=\"customFilterForm\">\r\n <div class=\"flex align-center\">\r\n <ng-select\r\n [items]=\"orderStates\"\r\n appendTo=\"body\"\r\n [addTag]=\"false\"\r\n [multiple]=\"true\"\r\n formControlName=\"states\"\r\n [placeholder]=\"'state.all-orders' | translate\"\r\n [clearable]=\"true\"\r\n [searchable]=\"false\"\r\n >\r\n <ng-template ng-option-tmp let-item=\"item\">{{\r\n item | stateI18nToken | translate\r\n }}</ng-template>\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <span class=\"ng-value-label\"> {{ item | stateI18nToken | translate }}</span>\r\n <span class=\"ng-value-icon right\" (click)=\"clear(item)\" aria-hidden=\"true\"\r\n >\u00D7</span\r\n >\r\n </ng-template>\r\n </ng-select>\r\n <button\r\n class=\"btn btn-secondary\"\r\n [disabled]=\"customFilterForm.pristine\"\r\n (click)=\"applyCustomFilters()\"\r\n >\r\n {{ 'order.apply-filters' | translate }}\r\n <clr-icon shape=\"filter\"></clr-icon>\r\n </button>\r\n </div>\r\n <div class=\"flex\">\r\n <div>\r\n <label>{{ 'order.placed-at-start' | translate }}</label>\r\n <vdr-datetime-picker formControlName=\"placedAtStart\"></vdr-datetime-picker>\r\n </div>\r\n <div>\r\n <label>{{ 'order.placed-at-end' | translate }}</label>\r\n <vdr-datetime-picker formControlName=\"placedAtEnd\"></vdr-datetime-picker>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n </vdr-ab-left>\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"order-list\"></vdr-action-bar-items>\r\n <ng-container *ngIf=\"canCreateDraftOrder\">\r\n <a class=\"btn btn-primary mt1\" *vdrIfPermissions=\"['CreateOrder']\" [routerLink]=\"['./draft/create']\">\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'catalog.create-draft-order' | translate }}\r\n </a>\r\n </ng-container>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<vdr-data-table\r\n [items]=\"items$ | async\"\r\n [itemsPerPage]=\"itemsPerPage$ | async\"\r\n [totalItems]=\"totalItems$ | async\"\r\n [currentPage]=\"currentPage$ | async\"\r\n (pageChange)=\"setPageNumber($event)\"\r\n (itemsPerPageChange)=\"setItemsPerPage($event)\"\r\n>\r\n <vdr-dt-column>{{ 'common.code' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.customer' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.state' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.total' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'common.updated-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.placed-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'order.shipping' | translate }}</vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <ng-template let-order=\"item\">\r\n <td class=\"left align-middle\">{{ order.code }}</td>\r\n <td class=\"left align-middle\">\r\n <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\r\n </td>\r\n <td class=\"left align-middle\">\r\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\r\n </td>\r\n <td class=\"left align-middle\">{{ order.totalWithTax | localeCurrency: order.currencyCode }}</td>\r\n <td class=\"left align-middle\">{{ order.updatedAt | timeAgo }}</td>\r\n <td class=\"left align-middle\">{{ order.orderPlacedAt | localeDate: 'medium' }}</td>\r\n <td class=\"left align-middle\">{{ getShippingNames(order) }}</td>\r\n <td class=\"right align-middle\">\r\n <vdr-table-row-action\r\n iconShape=\"shopping-cart\"\r\n [label]=\"'common.open' | translate\"\r\n [linkTo]=\"\r\n order.state === 'Modifying'\r\n ? ['./', order.id, 'modify']\r\n : order.state === 'Draft'\r\n ? ['./draft', order.id]\r\n : ['./', order.id]\r\n \"\r\n ></vdr-table-row-action>\r\n </td>\r\n </ng-template>\r\n</vdr-data-table>\r\n",
2773
3283
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2774
- styles: [".search-form{display:flex;flex-direction:column;align-items:baseline;width:100%;margin-bottom:6px}@media screen and (min-width: 768px){.search-form{flex-direction:row}}.search-input{margin-left:6px;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"]
3284
+ 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"]
2775
3285
  },] }
2776
3286
  ];
2777
3287
  OrderListComponent.ctorParameters = function () { return [
@@ -3062,6 +3572,9 @@
3062
3572
 
3063
3573
  var OrderTableComponent = /** @class */ (function () {
3064
3574
  function OrderTableComponent() {
3575
+ this.isDraft = false;
3576
+ this.adjust = new i0.EventEmitter();
3577
+ this.remove = new i0.EventEmitter();
3065
3578
  this.orderLineCustomFieldsVisible = false;
3066
3579
  this.customFieldsForLine = {};
3067
3580
  }
@@ -3083,6 +3596,11 @@
3083
3596
  this.orderLineCustomFieldsVisible = this.orderLineCustomFields.length < 2;
3084
3597
  this.getLineCustomFields();
3085
3598
  };
3599
+ OrderTableComponent.prototype.draftInputBlur = function (line, quantity) {
3600
+ if (line.quantity !== quantity) {
3601
+ this.adjust.emit({ lineId: line.id, quantity: quantity });
3602
+ }
3603
+ };
3086
3604
  OrderTableComponent.prototype.toggleOrderLineCustomFields = function () {
3087
3605
  this.orderLineCustomFieldsVisible = !this.orderLineCustomFieldsVisible;
3088
3606
  };
@@ -3148,14 +3666,17 @@
3148
3666
  OrderTableComponent.decorators = [
3149
3667
  { type: i0.Component, args: [{
3150
3668
  selector: 'vdr-order-table',
3151
- template: "<table class=\"order-table table\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>{{ 'order.product-name' | translate }}</th>\r\n <th>{{ 'order.product-sku' | translate }}</th>\r\n <th>{{ 'order.unit-price' | translate }}</th>\r\n <th>{{ 'order.quantity' | translate }}</th>\r\n <th>{{ 'order.total' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <ng-container *ngFor=\"let line of order.lines\">\r\n <tr class=\"order-line\" [class.is-cancelled]=\"line.quantity === 0\">\r\n <td class=\"align-middle thumb\">\r\n <img *ngIf=\"line.featuredAsset\" [src]=\"line.featuredAsset | assetPreview: 'tiny'\" />\r\n </td>\r\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\r\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\r\n <td class=\"align-middle unit-price\">\r\n {{ line.unitPriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.unitPrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n <td class=\"align-middle quantity\">\r\n {{ line.quantity }}\r\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\r\n <vdr-line-fulfillment [line]=\"line\" [orderState]=\"order.state\"></vdr-line-fulfillment>\r\n </td>\r\n <td class=\"align-middle total\">\r\n {{ line.linePriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.linePrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n\r\n <ng-container *ngIf=\"getLineDiscounts(line) as discounts\">\r\n <vdr-dropdown *ngIf=\"discounts.length\">\r\n <div class=\"promotions-label\" vdrDropdownTrigger>\r\n {{ 'order.promotions-applied' | translate }}\r\n </div>\r\n <vdr-dropdown-menu>\r\n <div class=\"line-promotion\" *ngFor=\"let discount of discounts\">\r\n <a class=\"promotion-name\" [routerLink]=\"getPromotionLink(discount)\">{{\r\n discount.description\r\n }}</a>\r\n <div class=\"promotion-amount\">\r\n {{ discount.amountWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ discount.amount | localeCurrency: order.currencyCode }}\r\n </div>\r\n </div>\r\n </div>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n <ng-container *ngIf=\"customFieldsForLine[line.id] as customFields\">\r\n <tr *ngIf=\"customFields.length\">\r\n <td colspan=\"6\" class=\"custom-fields-row\">\r\n <div class=\"order-line-custom-fields\">\r\n <div class=\"custom-field\" *ngFor=\"let field of customFields\">\r\n <vdr-custom-field-control\r\n [compact]=\"true\"\r\n [readonly]=\"true\"\r\n [customField]=\"field.config\"\r\n [customFieldsFormGroup]=\"field.formGroup\"\r\n ></vdr-custom-field-control>\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n <tr class=\"surcharge\" *ngFor=\"let surcharge of order.surcharges\">\r\n <td class=\"align-middle name left\" colspan=\"2\">{{ surcharge.description }}</td>\r\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\r\n <td class=\"align-middle\" colspan=\"2\"></td>\r\n <td class=\"align-middle total\">\r\n {{ surcharge.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ surcharge.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <ng-container *ngFor=\"let discount of order.discounts\">\r\n <tr class=\"order-adjustment\" *ngIf=\"discount.type !== 'OTHER'\">\r\n <td colspan=\"5\" class=\"left clr-align-middle\">\r\n <a [routerLink]=\"getPromotionLink(discount)\">{{ discount.description }}</a>\r\n <vdr-chip *ngIf=\"getCouponCodeForAdjustment(order, discount) as couponCode\">{{\r\n couponCode\r\n }}</vdr-chip>\r\n </td>\r\n <td class=\"clr-align-middle\">\r\n {{ discount.amountWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ discount.amount | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n <tr class=\"sub-total\">\r\n <td class=\"left clr-align-middle\">{{ 'order.sub-total' | translate }}</td>\r\n <td colspan=\"4\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.subTotalWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.subTotal | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class=\"shipping\">\r\n <td class=\"left clr-align-middle\">{{ 'order.shipping' | translate }}</td>\r\n <td class=\"clr-align-middle\">{{ getShippingNames(order) }}</td>\r\n <td colspan=\"3\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.shippingWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.shipping | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class=\"total\">\r\n <td class=\"left clr-align-middle\">{{ 'order.total' | translate }}</td>\r\n <td colspan=\"4\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.totalWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.total | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n",
3669
+ template: "<table class=\"order-table table\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>{{ 'order.product-name' | translate }}</th>\r\n <th>{{ 'order.product-sku' | translate }}</th>\r\n <th>{{ 'order.unit-price' | translate }}</th>\r\n <th>{{ 'order.quantity' | translate }}</th>\r\n <th>{{ 'order.total' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <ng-container *ngFor=\"let line of order.lines\">\r\n <tr class=\"order-line\" [class.is-cancelled]=\"line.quantity === 0\">\r\n <td class=\"align-middle thumb\">\r\n <img *ngIf=\"line.featuredAsset\" [src]=\"line.featuredAsset | assetPreview: 'tiny'\" />\r\n </td>\r\n <td class=\"align-middle name\">{{ line.productVariant.name }}</td>\r\n <td class=\"align-middle sku\">{{ line.productVariant.sku }}</td>\r\n <td class=\"align-middle unit-price\">\r\n {{ line.unitPriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.unitPrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n <td class=\"align-middle quantity\">\r\n <ng-container *ngIf=\"!isDraft; else draft\">\r\n {{ line.quantity }}\r\n </ng-container>\r\n <ng-template #draft>\r\n <div class=\"flex\">\r\n <input\r\n class=\"draft-qty\"\r\n type=\"number\"\r\n min=\"0\"\r\n #qtyInput\r\n [value]=\"line.quantity\"\r\n (blur)=\"draftInputBlur(line, qtyInput.valueAsNumber)\"\r\n />\r\n <button class=\"icon-button\" (click)=\"remove.emit({ lineId: line.id })\">\r\n <clr-icon shape=\"trash\"></clr-icon>\r\n </button>\r\n </div>\r\n </ng-template>\r\n <vdr-line-refunds [line]=\"line\" [payments]=\"order.payments\"></vdr-line-refunds>\r\n <vdr-line-fulfillment [line]=\"line\" [orderState]=\"order.state\"></vdr-line-fulfillment>\r\n </td>\r\n <td class=\"align-middle total\">\r\n {{ line.linePriceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ line.linePrice | localeCurrency: order.currencyCode }}\r\n </div>\r\n\r\n <ng-container *ngIf=\"getLineDiscounts(line) as discounts\">\r\n <vdr-dropdown *ngIf=\"discounts.length\">\r\n <div class=\"promotions-label\" vdrDropdownTrigger>\r\n {{ 'order.promotions-applied' | translate }}\r\n </div>\r\n <vdr-dropdown-menu>\r\n <div class=\"line-promotion\" *ngFor=\"let discount of discounts\">\r\n <a class=\"promotion-name\" [routerLink]=\"getPromotionLink(discount)\">{{\r\n discount.description\r\n }}</a>\r\n <div class=\"promotion-amount\">\r\n {{ discount.amountWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ discount.amount | localeCurrency: order.currencyCode }}\r\n </div>\r\n </div>\r\n </div>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n <ng-container *ngIf=\"customFieldsForLine[line.id] as customFields\">\r\n <tr *ngIf=\"customFields.length\">\r\n <td colspan=\"6\" class=\"custom-fields-row\">\r\n <div class=\"order-line-custom-fields\">\r\n <div class=\"custom-field\" *ngFor=\"let field of customFields\">\r\n <vdr-custom-field-control\r\n [compact]=\"true\"\r\n [readonly]=\"true\"\r\n [customField]=\"field.config\"\r\n [customFieldsFormGroup]=\"field.formGroup\"\r\n ></vdr-custom-field-control>\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </ng-container>\r\n <tr class=\"surcharge\" *ngFor=\"let surcharge of order.surcharges\">\r\n <td class=\"align-middle name left\" colspan=\"2\">{{ surcharge.description }}</td>\r\n <td class=\"align-middle sku\">{{ surcharge.sku }}</td>\r\n <td class=\"align-middle\" colspan=\"2\"></td>\r\n <td class=\"align-middle total\">\r\n {{ surcharge.priceWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ surcharge.price | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <ng-container *ngFor=\"let discount of order.discounts\">\r\n <tr class=\"order-adjustment\" *ngIf=\"discount.type !== 'OTHER'\">\r\n <td colspan=\"5\" class=\"left clr-align-middle\">\r\n <a [routerLink]=\"getPromotionLink(discount)\">{{ discount.description }}</a>\r\n <vdr-chip *ngIf=\"getCouponCodeForAdjustment(order, discount) as couponCode\">{{\r\n couponCode\r\n }}</vdr-chip>\r\n </td>\r\n <td class=\"clr-align-middle\">\r\n {{ discount.amountWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ discount.amount | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n <tr class=\"sub-total\">\r\n <td class=\"left clr-align-middle\">{{ 'order.sub-total' | translate }}</td>\r\n <td colspan=\"4\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.subTotalWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.subTotal | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class=\"shipping\">\r\n <td class=\"left clr-align-middle\">{{ 'order.shipping' | translate }}</td>\r\n <td class=\"clr-align-middle\">{{ getShippingNames(order) }}</td>\r\n <td colspan=\"3\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.shippingWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.shipping | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class=\"total\">\r\n <td class=\"left clr-align-middle\">{{ 'order.total' | translate }}</td>\r\n <td colspan=\"4\"></td>\r\n <td class=\"clr-align-middle\">\r\n {{ order.totalWithTax | localeCurrency: order.currencyCode }}\r\n <div class=\"net-price\" [title]=\"'order.net-price' | translate\">\r\n {{ order.total | localeCurrency: order.currencyCode }}\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n",
3152
3670
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3153
- 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:bold;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 .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-right:18px}.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)}.order-table .promotions-label{-webkit-text-decoration:underline dotted var(--color-text-200);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}::ng-deep .line-promotion{display:flex;justify-content:space-between;padding:6px 12px}::ng-deep .line-promotion .promotion-amount{margin-left:12px}::ng-deep .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}\n"]
3671
+ 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:bold;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-right: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)}.order-table .promotions-label{-webkit-text-decoration:underline dotted var(--color-text-200);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}::ng-deep .line-promotion{display:flex;justify-content:space-between;padding:6px 12px}::ng-deep .line-promotion .promotion-amount{margin-left:12px}::ng-deep .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}\n"]
3154
3672
  },] }
3155
3673
  ];
3156
3674
  OrderTableComponent.propDecorators = {
3157
3675
  order: [{ type: i0.Input }],
3158
- orderLineCustomFields: [{ type: i0.Input }]
3676
+ orderLineCustomFields: [{ type: i0.Input }],
3677
+ isDraft: [{ type: i0.Input }],
3678
+ adjust: [{ type: i0.Output }],
3679
+ remove: [{ type: i0.Output }]
3159
3680
  };
3160
3681
 
3161
3682
  var PaymentDetailComponent = /** @class */ (function () {
@@ -3259,20 +3780,34 @@
3259
3780
  /**
3260
3781
  * Resolves the id from the path into a Customer entity.
3261
3782
  */
3262
- var OrderResolver = /** @class */ (function (_super) {
3263
- __extends(OrderResolver, _super);
3783
+ var OrderResolver = /** @class */ (function () {
3264
3784
  function OrderResolver(router, dataService) {
3265
- return _super.call(this, router, {
3266
- __typename: 'Order',
3267
- id: '',
3268
- code: '',
3269
- createdAt: '',
3270
- updatedAt: '',
3271
- total: 0,
3272
- }, function (id) { return dataService.order.getOrder(id).mapStream(function (data) { return data.order; }); }) || this;
3785
+ this.router = router;
3786
+ this.dataService = dataService;
3273
3787
  }
3788
+ /** @internal */
3789
+ OrderResolver.prototype.resolve = function (route, state) {
3790
+ var _this = this;
3791
+ var id = route.paramMap.get('id');
3792
+ // Complete the entity stream upon navigating away
3793
+ var navigateAway$ = this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.ActivationStart; }));
3794
+ var stream = this.dataService.order
3795
+ .getOrder(id)
3796
+ .mapStream(function (data) { return data.order; })
3797
+ .pipe(operators.switchMap(function (order) {
3798
+ if ((order === null || order === void 0 ? void 0 : order.state) === 'Draft' && route.component !== DraftOrderDetailComponent) {
3799
+ // Make sure Draft orders only get displayed with the DraftOrderDetailComponent
3800
+ _this.router.navigate(['/orders/draft', id]);
3801
+ return rxjs.EMPTY;
3802
+ }
3803
+ else {
3804
+ return [order];
3805
+ }
3806
+ }), operators.takeUntil(navigateAway$), operators.filter(sharedUtils.notNullOrUndefined), operators.shareReplay(1));
3807
+ return stream.pipe(operators.take(1), operators.map(function () { return stream; }));
3808
+ };
3274
3809
  return OrderResolver;
3275
- }(i1.BaseEntityResolver));
3810
+ }());
3276
3811
  OrderResolver.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function OrderResolver_Factory() { return new OrderResolver(i0__namespace.ɵɵinject(i1__namespace$1.Router), i0__namespace.ɵɵinject(i1__namespace.DataService)); }, token: OrderResolver, providedIn: "root" });
3277
3812
  OrderResolver.decorators = [
3278
3813
  { type: i0.Injectable, args: [{
@@ -3284,11 +3819,52 @@
3284
3819
  { type: i1.DataService }
3285
3820
  ]; };
3286
3821
 
3822
+ var OrderGuard = /** @class */ (function () {
3823
+ function OrderGuard(dataService, router) {
3824
+ this.dataService = dataService;
3825
+ this.router = router;
3826
+ }
3827
+ OrderGuard.prototype.canActivate = function (route, state) {
3828
+ var _this = this;
3829
+ var isDraft = state.url.includes('orders/draft');
3830
+ var id = route.paramMap.get('id');
3831
+ if (isDraft) {
3832
+ if (id === 'create') {
3833
+ return this.dataService.order
3834
+ .createDraftOrder()
3835
+ .pipe(operators.map(function (_a) {
3836
+ var createDraftOrder = _a.createDraftOrder;
3837
+ return _this.router.parseUrl("/orders/draft/" + createDraftOrder.id);
3838
+ }));
3839
+ }
3840
+ else {
3841
+ return true;
3842
+ }
3843
+ }
3844
+ else {
3845
+ return true;
3846
+ }
3847
+ };
3848
+ return OrderGuard;
3849
+ }());
3850
+ OrderGuard.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function OrderGuard_Factory() { return new OrderGuard(i0__namespace.ɵɵinject(i1__namespace.DataService), i0__namespace.ɵɵinject(i1__namespace$1.Router)); }, token: OrderGuard, providedIn: "root" });
3851
+ OrderGuard.decorators = [
3852
+ { type: i0.Injectable, args: [{
3853
+ providedIn: 'root',
3854
+ },] }
3855
+ ];
3856
+ OrderGuard.ctorParameters = function () { return [
3857
+ { type: i1.DataService },
3858
+ { type: i1$1.Router }
3859
+ ]; };
3860
+
3287
3861
  var ɵ0 = {
3288
3862
  breadcrumb: ngxTranslateExtractMarker.marker('breadcrumb.orders'),
3289
3863
  }, ɵ1 = {
3290
3864
  breadcrumb: orderBreadcrumb,
3291
3865
  }, ɵ2 = {
3866
+ breadcrumb: orderBreadcrumb,
3867
+ }, ɵ3 = {
3292
3868
  breadcrumb: modifyingOrderBreadcrumb,
3293
3869
  };
3294
3870
  var orderRoutes = [
@@ -3297,19 +3873,34 @@
3297
3873
  component: OrderListComponent,
3298
3874
  data: ɵ0,
3299
3875
  },
3876
+ {
3877
+ path: 'draft/:id',
3878
+ component: DraftOrderDetailComponent,
3879
+ resolve: {
3880
+ entity: OrderResolver,
3881
+ },
3882
+ canActivate: [OrderGuard],
3883
+ canDeactivate: [i1.CanDeactivateDetailGuard],
3884
+ data: ɵ1,
3885
+ },
3300
3886
  {
3301
3887
  path: ':id',
3302
3888
  component: OrderDetailComponent,
3303
- resolve: i1.createResolveData(OrderResolver),
3889
+ resolve: {
3890
+ entity: OrderResolver,
3891
+ },
3892
+ canActivate: [OrderGuard],
3304
3893
  canDeactivate: [i1.CanDeactivateDetailGuard],
3305
- data: ɵ1,
3894
+ data: ɵ2,
3306
3895
  },
3307
3896
  {
3308
3897
  path: ':id/modify',
3309
3898
  component: OrderEditorComponent,
3310
- resolve: i1.createResolveData(OrderResolver),
3899
+ resolve: {
3900
+ entity: OrderResolver,
3901
+ },
3311
3902
  // canDeactivate: [CanDeactivateDetailGuard],
3312
- data: ɵ2,
3903
+ data: ɵ3,
3313
3904
  },
3314
3905
  ];
3315
3906
  function orderBreadcrumb(data, params) {
@@ -3367,6 +3958,12 @@
3367
3958
  ModificationDetailComponent,
3368
3959
  AddManualPaymentDialogComponent,
3369
3960
  OrderStateSelectDialogComponent,
3961
+ DraftOrderDetailComponent,
3962
+ DraftOrderVariantSelectorComponent,
3963
+ SelectCustomerDialogComponent,
3964
+ SelectAddressDialogComponent,
3965
+ CouponCodeSelectorComponent,
3966
+ SelectShippingMethodDialogComponent,
3370
3967
  ],
3371
3968
  },] }
3372
3969
  ];
@@ -3379,10 +3976,14 @@
3379
3976
 
3380
3977
  exports.AddManualPaymentDialogComponent = AddManualPaymentDialogComponent;
3381
3978
  exports.CancelOrderDialogComponent = CancelOrderDialogComponent;
3979
+ exports.CouponCodeSelectorComponent = CouponCodeSelectorComponent;
3980
+ exports.DraftOrderDetailComponent = DraftOrderDetailComponent;
3981
+ exports.DraftOrderVariantSelectorComponent = DraftOrderVariantSelectorComponent;
3382
3982
  exports.FulfillOrderDialogComponent = FulfillOrderDialogComponent;
3383
3983
  exports.FulfillmentCardComponent = FulfillmentCardComponent;
3384
3984
  exports.FulfillmentDetailComponent = FulfillmentDetailComponent;
3385
3985
  exports.FulfillmentStateLabelComponent = FulfillmentStateLabelComponent;
3986
+ exports.GET_CUSTOMER_ADDRESSES = GET_CUSTOMER_ADDRESSES;
3386
3987
  exports.LineFulfillmentComponent = LineFulfillmentComponent;
3387
3988
  exports.LineRefundsComponent = LineRefundsComponent;
3388
3989
  exports.ModificationDetailComponent = ModificationDetailComponent;
@@ -3391,6 +3992,7 @@
3391
3992
  exports.OrderDetailComponent = OrderDetailComponent;
3392
3993
  exports.OrderEditorComponent = OrderEditorComponent;
3393
3994
  exports.OrderEditsPreviewDialogComponent = OrderEditsPreviewDialogComponent;
3995
+ exports.OrderGuard = OrderGuard;
3394
3996
  exports.OrderHistoryComponent = OrderHistoryComponent;
3395
3997
  exports.OrderListComponent = OrderListComponent;
3396
3998
  exports.OrderModule = OrderModule;
@@ -3407,6 +4009,9 @@
3407
4009
  exports.PaymentStateLabelComponent = PaymentStateLabelComponent;
3408
4010
  exports.RefundOrderDialogComponent = RefundOrderDialogComponent;
3409
4011
  exports.RefundStateLabelComponent = RefundStateLabelComponent;
4012
+ exports.SelectAddressDialogComponent = SelectAddressDialogComponent;
4013
+ exports.SelectCustomerDialogComponent = SelectCustomerDialogComponent;
4014
+ exports.SelectShippingMethodDialogComponent = SelectShippingMethodDialogComponent;
3410
4015
  exports.SettleRefundDialogComponent = SettleRefundDialogComponent;
3411
4016
  exports.SimpleItemListComponent = SimpleItemListComponent;
3412
4017
  exports.modifyingOrderBreadcrumb = modifyingOrderBreadcrumb;
@@ -3415,6 +4020,7 @@
3415
4020
  exports.ɵ0 = ɵ0;
3416
4021
  exports.ɵ1 = ɵ1;
3417
4022
  exports.ɵ2 = ɵ2;
4023
+ exports.ɵ3 = ɵ3;
3418
4024
 
3419
4025
  Object.defineProperty(exports, '__esModule', { value: true });
3420
4026