@vendure/admin-ui 1.6.3 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/bundles/vendure-admin-ui-catalog.umd.js +196 -20
  2. package/bundles/vendure-admin-ui-catalog.umd.js.map +1 -1
  3. package/bundles/vendure-admin-ui-core.umd.js +309 -327
  4. package/bundles/vendure-admin-ui-core.umd.js.map +1 -1
  5. package/bundles/vendure-admin-ui-customer.umd.js +39 -18
  6. package/bundles/vendure-admin-ui-customer.umd.js.map +1 -1
  7. package/bundles/vendure-admin-ui-order.umd.js +179 -137
  8. package/bundles/vendure-admin-ui-order.umd.js.map +1 -1
  9. package/catalog/components/generate-product-variants/generate-product-variants.component.d.ts +3 -3
  10. package/catalog/components/option-value-input/option-value-input.component.d.ts +20 -8
  11. package/catalog/components/product-variants-editor/product-variants-editor.component.d.ts +10 -3
  12. package/catalog/vendure-admin-ui-catalog.metadata.json +1 -1
  13. package/core/common/generated-types.d.ts +91 -19
  14. package/core/common/utilities/configurable-operation-utils.d.ts +4 -2
  15. package/core/common/version.d.ts +1 -1
  16. package/core/data/definitions/order-definitions.d.ts +2 -0
  17. package/core/data/definitions/product-definitions.d.ts +1 -0
  18. package/core/data/providers/order-data.service.d.ts +1 -0
  19. package/core/data/providers/product-data.service.d.ts +1 -0
  20. package/core/shared/components/custom-field-control/custom-field-control.component.d.ts +6 -2
  21. package/core/shared/components/data-table/data-table.component.d.ts +5 -2
  22. package/core/shared/components/facet-value-selector/facet-value-selector.component.d.ts +2 -1
  23. package/core/shared/dynamic-form-inputs/facet-value-form-input/facet-value-form-input.component.d.ts +2 -0
  24. package/core/shared/dynamic-form-inputs/register-dynamic-input-components.d.ts +2 -1
  25. package/core/shared/dynamic-form-inputs/select-form-input/select-form-input.component.d.ts +10 -2
  26. package/core/shared/pipes/custom-field-label.pipe.d.ts +4 -10
  27. package/core/vendure-admin-ui-core.metadata.json +1 -1
  28. package/customer/components/customer-group-list/customer-group-list.component.d.ts +6 -4
  29. package/customer/vendure-admin-ui-customer.metadata.json +1 -1
  30. package/esm2015/catalog/components/generate-product-variants/generate-product-variants.component.js +12 -5
  31. package/esm2015/catalog/components/option-value-input/option-value-input.component.js +62 -12
  32. package/esm2015/catalog/components/product-variants-editor/product-variants-editor.component.js +109 -11
  33. package/esm2015/core/common/generated-types.js +2 -1
  34. package/esm2015/core/common/introspection-result.js +191 -255
  35. package/esm2015/core/common/utilities/configurable-operation-utils.js +13 -10
  36. package/esm2015/core/common/version.js +2 -2
  37. package/esm2015/core/components/app-shell/app-shell.component.js +1 -1
  38. package/esm2015/core/components/main-nav/main-nav.component.js +1 -1
  39. package/esm2015/core/data/definitions/order-definitions.js +445 -431
  40. package/esm2015/core/data/definitions/product-definitions.js +9 -1
  41. package/esm2015/core/data/providers/order-data.service.js +7 -2
  42. package/esm2015/core/data/providers/product-data.service.js +5 -2
  43. package/esm2015/core/shared/components/custom-field-control/custom-field-control.component.js +9 -3
  44. package/esm2015/core/shared/components/data-table/data-table.component.js +9 -2
  45. package/esm2015/core/shared/components/facet-value-selector/facet-value-selector.component.js +5 -2
  46. package/esm2015/core/shared/dynamic-form-inputs/facet-value-form-input/facet-value-form-input.component.js +11 -2
  47. package/esm2015/core/shared/dynamic-form-inputs/select-form-input/select-form-input.component.js +15 -2
  48. package/esm2015/core/shared/pipes/custom-field-label.pipe.js +4 -19
  49. package/esm2015/customer/components/customer-group-list/customer-group-list.component.js +25 -12
  50. package/esm2015/order/components/fulfill-order-dialog/fulfill-order-dialog.component.js +3 -2
  51. package/esm2015/order/components/fulfillment-detail/fulfillment-detail.component.js +9 -18
  52. package/esm2015/order/components/line-fulfillment/line-fulfillment.component.js +10 -21
  53. package/esm2015/order/components/order-custom-fields-card/order-custom-fields-card.component.js +30 -4
  54. package/esm2015/order/components/order-detail/order-detail.component.js +79 -38
  55. package/esm2015/order/components/order-list/order-list.component.js +22 -15
  56. package/esm2015/order/components/order-payment-card/order-payment-card.component.js +2 -2
  57. package/esm2015/order/components/order-table/order-table.component.js +10 -2
  58. package/fesm2015/vendure-admin-ui-catalog.js +177 -22
  59. package/fesm2015/vendure-admin-ui-catalog.js.map +1 -1
  60. package/fesm2015/vendure-admin-ui-core.js +725 -733
  61. package/fesm2015/vendure-admin-ui-core.js.map +1 -1
  62. package/fesm2015/vendure-admin-ui-customer.js +23 -11
  63. package/fesm2015/vendure-admin-ui-customer.js.map +1 -1
  64. package/fesm2015/vendure-admin-ui-order.js +155 -94
  65. package/fesm2015/vendure-admin-ui-order.js.map +1 -1
  66. package/order/components/line-fulfillment/line-fulfillment.component.d.ts +2 -2
  67. package/order/components/modification-detail/modification-detail.component.d.ts +1 -1
  68. package/order/components/order-custom-fields-card/order-custom-fields-card.component.d.ts +4 -2
  69. package/order/components/order-list/order-list.component.d.ts +1 -0
  70. package/order/components/order-table/order-table.component.d.ts +1 -0
  71. package/order/vendure-admin-ui-order.metadata.json +1 -1
  72. package/package.json +2 -2
  73. package/static/i18n-messages/cs.json +6 -2
  74. package/static/i18n-messages/de.json +6 -2
  75. package/static/i18n-messages/en.json +8 -3
  76. package/static/i18n-messages/es.json +6 -2
  77. package/static/i18n-messages/fr.json +6 -2
  78. package/static/i18n-messages/it.json +6 -2
  79. package/static/i18n-messages/pl.json +6 -2
  80. package/static/i18n-messages/pt_BR.json +6 -2
  81. package/static/i18n-messages/pt_PT.json +6 -2
  82. package/static/i18n-messages/ru.json +6 -2
  83. package/static/i18n-messages/uk.json +6 -2
  84. package/static/i18n-messages/zh_Hans.json +6 -2
  85. package/static/i18n-messages/zh_Hant.json +6 -2
  86. package/static/styles/_variables.scss +3 -0
  87. package/static/styles/global/_sass-overrides.scss +3 -0
  88. package/static/styles/global/_utilities.scss +1 -0
  89. package/static/styles/styles.scss +1 -0
  90. package/static/styles/ui-extension-theme.scss +1 -0
  91. package/static/theme.min.css +1 -1
@@ -546,7 +546,8 @@
546
546
  return effectiveTracInventory ? Math.min(unfulfilledCount, stockOnHand) : unfulfilledCount;
547
547
  };
548
548
  FulfillOrderDialogComponent.prototype.getUnfulfilledCount = function (line) {
549
- var fulfilled = line.items.reduce(function (sum, item) { return sum + (item.fulfillment ? 1 : 0); }, 0);
549
+ var _a, _b;
550
+ var fulfilled = (_b = (_a = line.fulfillments) === null || _a === void 0 ? void 0 : _a.map(function (f) { return f.summary; }).flat().filter(function (row) { return row.orderLine.id === line.id; }).reduce(function (sum, row) { return sum + row.quantity; }, 0)) !== null && _b !== void 0 ? _b : 0;
550
551
  return line.quantity - fulfilled;
551
552
  };
552
553
  FulfillOrderDialogComponent.prototype.canSubmit = function () {
@@ -653,66 +654,34 @@
653
654
  });
654
655
  Object.defineProperty(FulfillmentDetailComponent.prototype, "items", {
655
656
  get: function () {
656
- var e_1, _b, e_2, _c;
657
- var _a;
658
- var itemMap = new Map();
659
- var fulfillmentItemIds = (_a = this.fulfillment) === null || _a === void 0 ? void 0 : _a.orderItems.map(function (i) { return i.id; });
660
- try {
661
- for (var _d = __values(this.order.lines), _e = _d.next(); !_e.done; _e = _d.next()) {
662
- var line = _e.value;
663
- try {
664
- for (var _f = (e_2 = void 0, __values(line.items)), _g = _f.next(); !_g.done; _g = _f.next()) {
665
- var item = _g.value;
666
- if (fulfillmentItemIds === null || fulfillmentItemIds === void 0 ? void 0 : fulfillmentItemIds.includes(item.id)) {
667
- var count = itemMap.get(line.productVariant.name);
668
- if (count != null) {
669
- itemMap.set(line.productVariant.name, count + 1);
670
- }
671
- else {
672
- itemMap.set(line.productVariant.name, 1);
673
- }
674
- }
675
- }
676
- }
677
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
678
- finally {
679
- try {
680
- if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
681
- }
682
- finally { if (e_2) throw e_2.error; }
683
- }
684
- }
685
- }
686
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
687
- finally {
688
- try {
689
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
690
- }
691
- finally { if (e_1) throw e_1.error; }
692
- }
693
- return Array.from(itemMap.entries()).map(function (_b) {
694
- var _c = __read(_b, 2), name = _c[0], quantity = _c[1];
695
- return ({ name: name, quantity: quantity });
696
- });
657
+ var _this = this;
658
+ var _a, _b;
659
+ return ((_b = (_a = this.fulfillment) === null || _a === void 0 ? void 0 : _a.summary.map(function (row) {
660
+ var _a, _b;
661
+ return {
662
+ name: (_b = (_a = _this.order.lines.find(function (line) { return line.id === row.orderLine.id; })) === null || _a === void 0 ? void 0 : _a.productVariant.name) !== null && _b !== void 0 ? _b : '',
663
+ quantity: row.quantity,
664
+ };
665
+ })) !== null && _b !== void 0 ? _b : []);
697
666
  },
698
667
  enumerable: false,
699
668
  configurable: true
700
669
  });
701
670
  FulfillmentDetailComponent.prototype.buildCustomFieldsFormGroup = function () {
702
- var e_3, _b;
671
+ var e_1, _c;
703
672
  var customFields = this.fulfillment.customFields;
704
673
  try {
705
- for (var _c = __values(this.serverConfigService.getCustomFieldsFor('Fulfillment')), _d = _c.next(); !_d.done; _d = _c.next()) {
706
- var fieldDef = _d.value;
674
+ for (var _d = __values(this.serverConfigService.getCustomFieldsFor('Fulfillment')), _e = _d.next(); !_e.done; _e = _d.next()) {
675
+ var fieldDef = _e.value;
707
676
  this.customFieldFormGroup.addControl(fieldDef.name, new forms.FormControl(customFields[fieldDef.name]));
708
677
  }
709
678
  }
710
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
679
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
711
680
  finally {
712
681
  try {
713
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
682
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
714
683
  }
715
- finally { if (e_3) throw e_3.error; }
684
+ finally { if (e_1) throw e_1.error; }
716
685
  }
717
686
  };
718
687
  FulfillmentDetailComponent.prototype.customFieldIsObject = function (customField) {
@@ -784,7 +753,8 @@
784
753
  * Returns the number of items in an OrderLine which are fulfilled.
785
754
  */
786
755
  LineFulfillmentComponent.prototype.getDeliveredCount = function (line) {
787
- return line.items.reduce(function (sum, item) { return sum + (item.fulfillment ? 1 : 0); }, 0);
756
+ var _a, _b;
757
+ return ((_b = (_a = line.fulfillments) === null || _a === void 0 ? void 0 : _a.reduce(function (sum, fulfillment) { var _a, _b; return sum + ((_b = (_a = fulfillment.summary.find(function (s) { return s.orderLine.id === line.id; })) === null || _a === void 0 ? void 0 : _a.quantity) !== null && _b !== void 0 ? _b : 0); }, 0)) !== null && _b !== void 0 ? _b : 0);
788
758
  };
789
759
  LineFulfillmentComponent.prototype.getFulfillmentStatus = function (fulfilledCount, lineQuantity) {
790
760
  if (fulfilledCount === lineQuantity) {
@@ -796,39 +766,15 @@
796
766
  return 'none';
797
767
  };
798
768
  LineFulfillmentComponent.prototype.getFulfillments = function (line) {
799
- var e_1, _a;
800
- var counts = {};
801
- try {
802
- for (var _b = __values(line.items), _c = _b.next(); !_c.done; _c = _b.next()) {
803
- var item = _c.value;
804
- if (item.fulfillment) {
805
- if (counts[item.fulfillment.id] === undefined) {
806
- counts[item.fulfillment.id] = 1;
807
- }
808
- else {
809
- counts[item.fulfillment.id]++;
810
- }
811
- }
812
- }
813
- }
814
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
815
- finally {
816
- try {
817
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
818
- }
819
- finally { if (e_1) throw e_1.error; }
820
- }
821
- var all = line.items.reduce(function (fulfillments, item) {
822
- return item.fulfillment ? __spreadArray(__spreadArray([], __read(fulfillments)), [item.fulfillment]) : fulfillments;
823
- }, []);
824
- return Object.entries(counts).map(function (_a) {
825
- var _b = __read(_a, 2), id = _b[0], count = _b[1];
769
+ var _a, _b;
770
+ return ((_b = (_a = line.fulfillments) === null || _a === void 0 ? void 0 : _a.map(function (fulfillment) {
771
+ var _a;
772
+ var summaryLine = fulfillment.summary.find(function (s) { return s.orderLine.id === line.id; });
826
773
  return {
827
- count: count,
828
- // tslint:disable-next-line:no-non-null-assertion
829
- fulfillment: all.find(function (f) { return f.id === id; }),
774
+ count: (_a = summaryLine === null || summaryLine === void 0 ? void 0 : summaryLine.quantity) !== null && _a !== void 0 ? _a : 0,
775
+ fulfillment: fulfillment,
830
776
  };
831
- });
777
+ })) !== null && _b !== void 0 ? _b : []);
832
778
  };
833
779
  return LineFulfillmentComponent;
834
780
  }());
@@ -973,8 +919,9 @@
973
919
  };
974
920
 
975
921
  var OrderCustomFieldsCardComponent = /** @class */ (function () {
976
- function OrderCustomFieldsCardComponent(formBuilder) {
922
+ function OrderCustomFieldsCardComponent(formBuilder, modalService) {
977
923
  this.formBuilder = formBuilder;
924
+ this.modalService = modalService;
978
925
  this.customFieldsConfig = [];
979
926
  this.customFieldValues = {};
980
927
  this.updateClick = new i0.EventEmitter();
@@ -1002,18 +949,42 @@
1002
949
  this.customFieldForm.markAsPristine();
1003
950
  this.editable = false;
1004
951
  };
952
+ OrderCustomFieldsCardComponent.prototype.onCancelClick = function () {
953
+ var _this = this;
954
+ if (this.customFieldForm.dirty) {
955
+ this.modalService
956
+ .dialog({
957
+ title: ngxTranslateExtractMarker.marker('catalog.confirm-cancel'),
958
+ buttons: [
959
+ { type: 'secondary', label: ngxTranslateExtractMarker.marker('common.keep-editing') },
960
+ { type: 'danger', label: ngxTranslateExtractMarker.marker('common.discard-changes'), returnValue: true },
961
+ ],
962
+ })
963
+ .subscribe(function (result) {
964
+ if (result) {
965
+ _this.customFieldForm.reset();
966
+ _this.customFieldForm.markAsPristine();
967
+ _this.editable = false;
968
+ }
969
+ });
970
+ }
971
+ else {
972
+ this.editable = false;
973
+ }
974
+ };
1005
975
  return OrderCustomFieldsCardComponent;
1006
976
  }());
1007
977
  OrderCustomFieldsCardComponent.decorators = [
1008
978
  { type: i0.Component, args: [{
1009
979
  selector: 'vdr-order-custom-fields-card',
1010
- template: "<div class=\"card\" *ngIf=\"customFieldsConfig.length\">\r\n <div class=\"card-header\">\r\n {{ 'common.custom-fields' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <div class=\"card-text custom-field-form\" [class.editable]=\"editable\">\r\n <ng-container *ngFor=\"let customField of customFieldsConfig\">\r\n <vdr-custom-field-control\r\n entityName=\"Order\"\r\n [customFieldsFormGroup]=\"customFieldForm\"\r\n [compact]=\"true\"\r\n [readonly]=\"customField.readonly || !editable\"\r\n [customField]=\"customField\"\r\n ></vdr-custom-field-control>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"card-footer\">\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"editable = true\" *ngIf=\"!editable\">\r\n <clr-icon shape=\"pencil\"></clr-icon>\r\n {{ 'common.edit' | translate }}\r\n </button>\r\n <button\r\n class=\"btn btn-sm btn-primary\"\r\n (click)=\"onUpdateClick()\"\r\n *ngIf=\"editable\"\r\n [disabled]=\"customFieldForm.pristine || customFieldForm.invalid\"\r\n >\r\n <clr-icon shape=\"check\"></clr-icon>\r\n {{ 'common.update' | translate }}\r\n </button>\r\n </div>\r\n</div>\r\n",
980
+ template: "<div class=\"card\" *ngIf=\"customFieldsConfig.length\">\r\n <div class=\"card-header\">\r\n {{ 'common.custom-fields' | translate }}\r\n </div>\r\n <div class=\"card-block\">\r\n <div class=\"card-text custom-field-form\" [class.editable]=\"editable\">\r\n <vdr-tabbed-custom-fields\r\n entityName=\"Order\"\r\n [customFields]=\"customFieldsConfig\"\r\n [customFieldsFormGroup]=\"customFieldForm\"\r\n [readonly]=\"!editable\"\r\n [compact]=\"true\"\r\n ></vdr-tabbed-custom-fields>\r\n </div>\r\n </div>\r\n <div class=\"card-footer\">\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"editable = true\" *ngIf=\"!editable\">\r\n <clr-icon shape=\"pencil\"></clr-icon>\r\n {{ 'common.edit' | translate }}\r\n </button>\r\n <button\r\n class=\"btn btn-sm btn-primary\"\r\n (click)=\"onUpdateClick()\"\r\n *ngIf=\"editable\"\r\n [disabled]=\"customFieldForm.pristine || customFieldForm.invalid\"\r\n >\r\n <clr-icon shape=\"check\"></clr-icon>\r\n {{ 'common.update' | translate }}\r\n </button>\r\n <button\r\n class=\"btn btn-sm btn-secondary\"\r\n (click)=\"onCancelClick()\"\r\n *ngIf=\"editable\"\r\n >\r\n <clr-icon shape=\"times\"></clr-icon>\r\n {{ 'common.cancel' | translate }}\r\n </button>\r\n </div>\r\n</div>\r\n",
1011
981
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1012
982
  styles: ["vdr-custom-field-control{margin-bottom:6px;display:block}.custom-field-form ::ng-deep .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable ::ng-deep .clr-control-label{color:inherit}\n"]
1013
983
  },] }
1014
984
  ];
1015
985
  OrderCustomFieldsCardComponent.ctorParameters = function () { return [
1016
- { type: forms.FormBuilder }
986
+ { type: forms.FormBuilder },
987
+ { type: i1.ModalService }
1017
988
  ]; };
1018
989
  OrderCustomFieldsCardComponent.propDecorators = {
1019
990
  customFieldsConfig: [{ type: i0.Input }],
@@ -1504,28 +1475,72 @@
1504
1475
  OrderDetailComponent.prototype.transitionPaymentState = function (_d) {
1505
1476
  var _this = this;
1506
1477
  var payment = _d.payment, state = _d.state;
1507
- this.dataService.order
1508
- .transitionPaymentToState(payment.id, state)
1509
- .subscribe(function (_d) {
1510
- var transitionPaymentToState = _d.transitionPaymentToState;
1511
- switch (transitionPaymentToState.__typename) {
1512
- case 'Payment':
1513
- _this.notificationService.success(ngxTranslateExtractMarker.marker('order.transitioned-payment-to-state-success'), {
1514
- state: state,
1515
- });
1516
- _this.dataService.order.getOrder(_this.id).single$.subscribe();
1517
- _this.fetchHistory.next();
1518
- break;
1519
- case 'PaymentStateTransitionError':
1520
- _this.notificationService.error(transitionPaymentToState.message);
1521
- break;
1522
- }
1523
- });
1478
+ if (state === 'Cancelled') {
1479
+ this.dataService.order.cancelPayment(payment.id).subscribe(function (_d) {
1480
+ var cancelPayment = _d.cancelPayment;
1481
+ switch (cancelPayment.__typename) {
1482
+ case 'Payment':
1483
+ _this.notificationService.success(ngxTranslateExtractMarker.marker('order.transitioned-payment-to-state-success'), {
1484
+ state: state,
1485
+ });
1486
+ _this.dataService.order.getOrder(_this.id).single$.subscribe();
1487
+ _this.fetchHistory.next();
1488
+ break;
1489
+ case 'PaymentStateTransitionError':
1490
+ _this.notificationService.error(cancelPayment.transitionError);
1491
+ break;
1492
+ case 'CancelPaymentError':
1493
+ _this.notificationService.error(cancelPayment.paymentErrorMessage);
1494
+ break;
1495
+ }
1496
+ });
1497
+ }
1498
+ else {
1499
+ this.dataService.order
1500
+ .transitionPaymentToState(payment.id, state)
1501
+ .subscribe(function (_d) {
1502
+ var transitionPaymentToState = _d.transitionPaymentToState;
1503
+ switch (transitionPaymentToState.__typename) {
1504
+ case 'Payment':
1505
+ _this.notificationService.success(ngxTranslateExtractMarker.marker('order.transitioned-payment-to-state-success'), {
1506
+ state: state,
1507
+ });
1508
+ _this.dataService.order.getOrder(_this.id).single$.subscribe();
1509
+ _this.fetchHistory.next();
1510
+ break;
1511
+ case 'PaymentStateTransitionError':
1512
+ _this.notificationService.error(transitionPaymentToState.message);
1513
+ break;
1514
+ }
1515
+ });
1516
+ }
1524
1517
  };
1525
1518
  OrderDetailComponent.prototype.canAddFulfillment = function (order) {
1526
- var allItemsFulfilled = order.lines
1527
- .reduce(function (items, line) { return __spreadArray(__spreadArray([], __read(items)), __read(line.items)); }, [])
1528
- .every(function (item) { return !!item.fulfillment || item.cancelled; });
1519
+ var e_1, _d;
1520
+ var _a;
1521
+ var allFulfillmentSummaryRows = ((_a = order.fulfillments) !== null && _a !== void 0 ? _a : []).reduce(function (all, fulfillment) { return __spreadArray(__spreadArray([], __read(all)), __read(fulfillment.summary)); }, []);
1522
+ var allItemsFulfilled = true;
1523
+ var _loop_1 = function (line) {
1524
+ var totalFulfilledCount = allFulfillmentSummaryRows
1525
+ .filter(function (row) { return row.orderLine.id === line.id; })
1526
+ .reduce(function (sum, row) { return sum + row.quantity; }, 0);
1527
+ if (totalFulfilledCount < line.quantity) {
1528
+ allItemsFulfilled = false;
1529
+ }
1530
+ };
1531
+ try {
1532
+ for (var _e = __values(order.lines), _f = _e.next(); !_f.done; _f = _e.next()) {
1533
+ var line = _f.value;
1534
+ _loop_1(line);
1535
+ }
1536
+ }
1537
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1538
+ finally {
1539
+ try {
1540
+ if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
1541
+ }
1542
+ finally { if (e_1) throw e_1.error; }
1543
+ }
1529
1544
  return (!allItemsFulfilled &&
1530
1545
  !this.hasUnsettledModifications(order) &&
1531
1546
  this.outstandingPaymentAmount(order) === 0 &&
@@ -1540,7 +1555,7 @@
1540
1555
  return sharedUtils.summate(order.modifications.filter(function (m) { return !m.isSettled; }), 'priceChange');
1541
1556
  };
1542
1557
  OrderDetailComponent.prototype.outstandingPaymentAmount = function (order) {
1543
- var e_1, _d;
1558
+ var e_2, _d;
1544
1559
  var _a, _b, _c;
1545
1560
  var paymentIsValid = function (p) { return p.state !== 'Cancelled' && p.state !== 'Declined' && p.state !== 'Error'; };
1546
1561
  var amountCovered = 0;
@@ -1552,12 +1567,12 @@
1552
1567
  amountCovered += payment.amount - refundsTotal;
1553
1568
  }
1554
1569
  }
1555
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1570
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1556
1571
  finally {
1557
1572
  try {
1558
1573
  if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
1559
1574
  }
1560
- finally { if (e_1) throw e_1.error; }
1575
+ finally { if (e_2) throw e_2.error; }
1561
1576
  }
1562
1577
  return order.totalWithTax - amountCovered;
1563
1578
  };
@@ -1806,26 +1821,43 @@
1806
1821
  if (!input) {
1807
1822
  return rxjs.of(undefined);
1808
1823
  }
1809
- var operations = [];
1824
+ if ((_a = input.cancel.lines) === null || _a === void 0 ? void 0 : _a.length) {
1825
+ return _this.dataService.order.cancelOrder(input.cancel).pipe(operators.map(function (res) {
1826
+ var result = res.cancelOrder;
1827
+ switch (result.__typename) {
1828
+ case 'Order':
1829
+ _this.refetchOrder(result).subscribe();
1830
+ _this.notificationService.success(ngxTranslateExtractMarker.marker('order.cancelled-order-success'));
1831
+ return input;
1832
+ case 'CancelActiveOrderError':
1833
+ case 'QuantityTooGreatError':
1834
+ case 'MultipleOrderError':
1835
+ case 'OrderStateTransitionError':
1836
+ case 'EmptyOrderLineSelectionError':
1837
+ _this.notificationService.error(result.message);
1838
+ return undefined;
1839
+ }
1840
+ }));
1841
+ }
1842
+ else {
1843
+ return [input];
1844
+ }
1845
+ }), operators.switchMap(function (input) {
1846
+ if (!input) {
1847
+ return rxjs.of(undefined);
1848
+ }
1810
1849
  if (input.refund.lines.length) {
1811
- operations.push(_this.dataService.order
1850
+ return _this.dataService.order
1812
1851
  .refundOrder(input.refund)
1813
- .pipe(operators.map(function (res) { return res.refundOrder; })));
1852
+ .pipe(operators.map(function (res) { return res.refundOrder; }));
1814
1853
  }
1815
- if ((_a = input.cancel.lines) === null || _a === void 0 ? void 0 : _a.length) {
1816
- operations.push(_this.dataService.order
1817
- .cancelOrder(input.cancel)
1818
- .pipe(operators.map(function (res) { return res.cancelOrder; })));
1854
+ else {
1855
+ return [undefined];
1819
1856
  }
1820
- return rxjs.merge.apply(void 0, __spreadArray([], __read(operations)));
1821
1857
  }))
1822
1858
  .subscribe(function (result) {
1823
1859
  if (result) {
1824
1860
  switch (result.__typename) {
1825
- case 'Order':
1826
- _this.refetchOrder(result).subscribe();
1827
- _this.notificationService.success(ngxTranslateExtractMarker.marker('order.cancelled-order-success'));
1828
- break;
1829
1861
  case 'Refund':
1830
1862
  _this.refetchOrder(result).subscribe();
1831
1863
  if (result.state === 'Failed') {
@@ -1835,11 +1867,6 @@
1835
1867
  _this.notificationService.success(ngxTranslateExtractMarker.marker('order.refund-order-success'));
1836
1868
  }
1837
1869
  break;
1838
- case 'QuantityTooGreatError':
1839
- case 'MultipleOrderError':
1840
- case 'OrderStateTransitionError':
1841
- case 'CancelActiveOrderError':
1842
- case 'EmptyOrderLineSelectionError':
1843
1870
  case 'AlreadyRefundedError':
1844
1871
  case 'NothingToRefundError':
1845
1872
  case 'PaymentOrderMismatchError':
@@ -2567,6 +2594,7 @@
2567
2594
  _this.serverConfigService = serverConfigService;
2568
2595
  _this.dataService = dataService;
2569
2596
  _this.localStorageService = localStorageService;
2597
+ _this.searchControl = new forms.FormControl('');
2570
2598
  _this.searchOrderCodeControl = new forms.FormControl('');
2571
2599
  _this.searchLastNameControl = new forms.FormControl('');
2572
2600
  _this.orderStates = _this.serverConfigService.getOrderProcessStates().map(function (item) { return item.name; });
@@ -2607,7 +2635,7 @@
2607
2635
  // tslint:disable-next-line:no-shadowed-variable
2608
2636
  function (take, skip) { return _this.dataService.order.getOrders({ take: take, skip: skip }).refetchOnChannelChange(); }, function (data) { return data.orders; },
2609
2637
  // tslint:disable-next-line:no-shadowed-variable
2610
- function (skip, take) { return _this.createQueryOptions(skip, take, _this.searchOrderCodeControl.value, _this.searchLastNameControl.value, _this.route.snapshot.queryParamMap.get('filter') || 'open'); });
2638
+ function (skip, take) { return _this.createQueryOptions(skip, take, _this.searchControl.value, _this.route.snapshot.queryParamMap.get('filter') || 'open'); });
2611
2639
  var lastFilters = _this.localStorageService.get('orderListLastCustomFilters');
2612
2640
  if (lastFilters) {
2613
2641
  _this.setQueryParam(lastFilters, { replaceUrl: true });
@@ -2619,7 +2647,7 @@
2619
2647
  var _a;
2620
2648
  _super.prototype.ngOnInit.call(this);
2621
2649
  this.activePreset$ = this.route.queryParamMap.pipe(operators.map(function (qpm) { return qpm.get('filter') || 'open'; }), operators.distinctUntilChanged());
2622
- var searchTerms$ = rxjs.merge(this.searchOrderCodeControl.valueChanges, this.searchLastNameControl.valueChanges).pipe(operators.filter(function (value) { return 2 < value.length || value.length === 0; }), operators.debounceTime(250));
2650
+ var searchTerms$ = rxjs.merge(this.searchControl.valueChanges).pipe(operators.filter(function (value) { return 2 < value.length || value.length === 0; }), operators.debounceTime(250));
2623
2651
  rxjs.merge(searchTerms$, this.route.queryParamMap)
2624
2652
  .pipe(operators.takeUntil(this.destroy$))
2625
2653
  .subscribe(function (val) {
@@ -2652,11 +2680,12 @@
2652
2680
  };
2653
2681
  OrderListComponent.prototype.createQueryOptions = function (
2654
2682
  // tslint:disable-next-line:no-shadowed-variable
2655
- skip, take, orderCodeSearchTerm, customerNameSearchTerm, activeFilterPreset) {
2683
+ skip, take, searchTerm, activeFilterPreset) {
2656
2684
  var _a;
2657
2685
  var filterConfig = this.filterPresets.find(function (p) { return p.name === activeFilterPreset; });
2658
2686
  // tslint:disable-next-line:no-shadowed-variable
2659
2687
  var filter = {};
2688
+ var filterOperator = i1.LogicalOperator.AND;
2660
2689
  if (filterConfig) {
2661
2690
  if (filterConfig.config.active != null) {
2662
2691
  filter.active = {
@@ -2698,15 +2727,19 @@
2698
2727
  };
2699
2728
  }
2700
2729
  }
2701
- if (customerNameSearchTerm) {
2702
- filter.customerLastName = {
2703
- contains: customerNameSearchTerm,
2704
- };
2705
- }
2706
- if (orderCodeSearchTerm) {
2707
- filter.code = {
2708
- contains: orderCodeSearchTerm,
2730
+ if (searchTerm) {
2731
+ filter = {
2732
+ customerLastName: {
2733
+ contains: searchTerm,
2734
+ },
2735
+ transactionId: {
2736
+ contains: searchTerm,
2737
+ },
2738
+ code: {
2739
+ contains: searchTerm,
2740
+ },
2709
2741
  };
2742
+ filterOperator = i1.LogicalOperator.OR;
2710
2743
  }
2711
2744
  return {
2712
2745
  options: {
@@ -2716,6 +2749,7 @@
2716
2749
  sort: {
2717
2750
  updatedAt: i1.SortOrder.DESC,
2718
2751
  },
2752
+ filterOperator: filterOperator,
2719
2753
  },
2720
2754
  };
2721
2755
  };
@@ -2732,7 +2766,7 @@
2732
2766
  OrderListComponent.decorators = [
2733
2767
  { type: i0.Component, args: [{
2734
2768
  selector: 'vdr-order-list',
2735
- 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\r\n <input\r\n type=\"text\"\r\n name=\"searchTerm\"\r\n [formControl]=\"searchOrderCodeControl\"\r\n [placeholder]=\"'order.search-by-order-code' | translate\"\r\n class=\"search-input\"\r\n />\r\n <input\r\n type=\"text\"\r\n name=\"searchTerm\"\r\n [formControl]=\"searchLastNameControl\"\r\n [placeholder]=\"'order.search-by-customer-last-name' | 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",
2769
+ 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",
2736
2770
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2737
2771
  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"]
2738
2772
  },] }
@@ -2758,7 +2792,7 @@
2758
2792
  if (!this.payment) {
2759
2793
  return [];
2760
2794
  }
2761
- return this.payment.nextStates.filter(function (s) { return s !== 'Settled'; });
2795
+ return this.payment.nextStates.filter(function (s) { return s !== 'Settled' && s !== 'Error'; });
2762
2796
  };
2763
2797
  return OrderPaymentCardComponent;
2764
2798
  }());
@@ -3098,12 +3132,20 @@
3098
3132
  return promotion.couponCode || undefined;
3099
3133
  }
3100
3134
  };
3135
+ OrderTableComponent.prototype.getShippingNames = function (order) {
3136
+ if (order.shippingLines.length) {
3137
+ return order.shippingLines.map(function (shippingLine) { return shippingLine.shippingMethod.name; }).join(', ');
3138
+ }
3139
+ else {
3140
+ return '';
3141
+ }
3142
+ };
3101
3143
  return OrderTableComponent;
3102
3144
  }());
3103
3145
  OrderTableComponent.decorators = [
3104
3146
  { type: i0.Component, args: [{
3105
3147
  selector: 'vdr-order-table',
3106
- 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\">{{ order.shippingLines[0]?.shippingMethod?.name }}</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",
3148
+ 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",
3107
3149
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3108
3150
  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"]
3109
3151
  },] }