@colijnit/transaction 12.1.178 → 12.1.179

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 (28) hide show
  1. package/bundles/colijnit-transaction.umd.js +214 -167
  2. package/bundles/colijnit-transaction.umd.js.map +1 -1
  3. package/colijnit-transaction.metadata.json +1 -1
  4. package/esm2015/lib/component/checkout/checkout-overview-relation-edit/checkout-overview-relation-edit.component.js +45 -3
  5. package/esm2015/lib/component/checkout/checkout.component.js +10 -9
  6. package/esm2015/lib/component/transaction-card/transaction-card/transaction-card.component.js +1 -1
  7. package/esm2015/lib/component/transaction-card/transaction-card-sales-overview/transaction-card-sales-overview.module.js +15 -15
  8. package/esm2015/lib/component/transaction-header/transaction-header-popup/transaction-header-popup-relation.component.js +2 -2
  9. package/esm2015/lib/component/transaction-line/transaction-line/transaction-line.component.js +1 -1
  10. package/esm2015/lib/component/transaction-lines-side-panel/transaction-lines-side-panel/transaction-lines-side-panel.component.js +1 -1
  11. package/esm2015/lib/component/transaction-search/transaction-filter/transaction-filter/transaction-filter.component.js +3 -3
  12. package/esm2015/lib/component/transaction-search/transaction-search-grid/transaction-search-grid/transaction-search-grid.component.js +3 -3
  13. package/esm2015/lib/component/transaction-search/transaction-search-tile/transaction-search-tile/transaction-search-tile.component.js +3 -3
  14. package/esm2015/lib/component/transaction-tags/transaction-tags.component.js +17 -6
  15. package/esm2015/lib/service/pending-reason.service.js +6 -6
  16. package/esm2015/lib/service/relation-suggestions.service.js +3 -2
  17. package/esm2015/lib/service/transaction-base.service.js +5 -3
  18. package/esm2015/lib/service/transaction.service.js +37 -50
  19. package/esm2015/lib/transaction-version.js +3 -3
  20. package/fesm2015/colijnit-transaction.js +117 -75
  21. package/fesm2015/colijnit-transaction.js.map +1 -1
  22. package/lib/component/checkout/checkout-overview-relation-edit/checkout-overview-relation-edit.component.d.ts +4 -0
  23. package/lib/component/transaction-search/transaction-filter/transaction-filter/transaction-filter.component.d.ts +2 -2
  24. package/lib/component/transaction-search/transaction-search-grid/transaction-search-grid/transaction-search-grid.component.d.ts +3 -3
  25. package/lib/component/transaction-search/transaction-search-tile/transaction-search-tile/transaction-search-tile.component.d.ts +3 -3
  26. package/lib/component/transaction-tags/transaction-tags.component.d.ts +4 -1
  27. package/lib/service/relation-suggestions.service.d.ts +1 -1
  28. package/package.json +1 -1
@@ -31,8 +31,8 @@
31
31
  function Version() {
32
32
  this.name = "@colijnit/transaction";
33
33
  this.description = "Colijn IT transaction package";
34
- this.symVer = "12.1.178";
35
- this.publishDate = "27-12-2023 17:14:05";
34
+ this.symVer = "12.1.179";
35
+ this.publishDate = "28-12-2023 18:39:19";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -10309,13 +10309,14 @@
10309
10309
  })];
10310
10310
  case 1:
10311
10311
  response = _a.sent();
10312
- if (response && response.isSuccess) {
10313
- this.resetLockTransaction();
10314
- if (rememberTransaction) {
10315
- this.rememberCurrentTransaction(response);
10316
- }
10317
- }
10318
- return [2 /*return*/, response];
10312
+ if (!(response && response.isSuccess)) return [3 /*break*/, 3];
10313
+ this.resetLockTransaction();
10314
+ if (!rememberTransaction) return [3 /*break*/, 3];
10315
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
10316
+ case 2:
10317
+ _a.sent();
10318
+ _a.label = 3;
10319
+ case 3: return [2 /*return*/, response];
10319
10320
  }
10320
10321
  });
10321
10322
  });
@@ -10514,21 +10515,23 @@
10514
10515
  this._setAmount();
10515
10516
  this._checkHeaderStatus();
10516
10517
  this.checkRefTransaction(); // todo: get from the header status
10517
- if (!this.getRelationOnRememberCurrentTransaction) return [3 /*break*/, 4];
10518
- if (!(this.currentTransaction.transactionInfo.relation && this.currentTransaction.transactionInfo.relation.relationId)) return [3 /*break*/, 3];
10518
+ if (!this.getRelationOnRememberCurrentTransaction) return [3 /*break*/, 5];
10519
+ if (!(this.currentTransaction.transactionInfo.relation && this.currentTransaction.transactionInfo.relation.relationId)) return [3 /*break*/, 4];
10520
+ if (!(!this.relation || this.relation.relationId !== this.currentTransaction.transactionInfo.relation.relationId)) return [3 /*break*/, 3];
10519
10521
  return [4 /*yield*/, this._getRelation(this.currentTransaction.transactionInfo.relation)];
10520
10522
  case 2:
10521
10523
  _a.sent();
10522
- return [3 /*break*/, 4];
10523
- case 3:
10524
+ _a.label = 3;
10525
+ case 3: return [3 /*break*/, 5];
10526
+ case 4:
10524
10527
  this.relation = new customerFullObject_bo.CustomerFullObject();
10525
10528
  this.relation.type = relationNameKind_enum.RelationNameKind.Private;
10526
- _a.label = 4;
10527
- case 4:
10529
+ _a.label = 5;
10530
+ case 5:
10528
10531
  this.transactionUpdated.next(this.currentTransaction);
10529
10532
  this.transactionEventService.transactionSet.next(this.currentTransaction);
10530
10533
  return [4 /*yield*/, this._handleAfterRememberCurrentTransaction()];
10531
- case 5:
10534
+ case 6:
10532
10535
  _a.sent();
10533
10536
  return [2 /*return*/];
10534
10537
  }
@@ -10752,15 +10755,15 @@
10752
10755
  return [3 /*break*/, 1];
10753
10756
  case 5:
10754
10757
  hasPendingReasons = response.headerOperationStatuses.filter(function (los) { return los.pendingReason !== "REASON_NONE"; }).length > 0;
10755
- if (!hasPendingReasons) {
10756
- if ((this.autoSave && saveTransaction) || overrideSave) {
10757
- return [2 /*return*/, this.saveTransactionAndCommit(response)];
10758
- }
10759
- else { // just replace transaction object
10760
- this.rememberCurrentTransaction(response);
10761
- }
10762
- }
10763
- return [2 /*return*/, success];
10758
+ if (!!hasPendingReasons) return [3 /*break*/, 8];
10759
+ if (!((this.autoSave && saveTransaction) || overrideSave)) return [3 /*break*/, 6];
10760
+ return [2 /*return*/, this.saveTransactionAndCommit(response)];
10761
+ case 6: // just replace transaction object
10762
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
10763
+ case 7:
10764
+ _b.sent();
10765
+ _b.label = 8;
10766
+ case 8: return [2 /*return*/, success];
10764
10767
  }
10765
10768
  });
10766
10769
  });
@@ -10807,25 +10810,24 @@
10807
10810
  return [3 /*break*/, 1];
10808
10811
  case 4:
10809
10812
  hasPendingReasons = response.lineOperationStatuses.filter(function (los) { return los.pendingReason !== "REASON_NONE"; }).length > 0;
10810
- if (!hasPendingReasons) {
10811
- if (this.transactionLineAdded) {
10812
- try {
10813
- this.transactionEventService.transactionLineAdded.next(response.lineOperationStatuses[0].lineNr);
10814
- }
10815
- catch (e) {
10816
- }
10817
- this.transactionLineAdded = false;
10813
+ if (!!hasPendingReasons) return [3 /*break*/, 7];
10814
+ if (this.transactionLineAdded) {
10815
+ try {
10816
+ this.transactionEventService.transactionLineAdded.next(response.lineOperationStatuses[0].lineNr);
10818
10817
  }
10819
- if (this.autoSave && saveTransaction) {
10820
- return [2 /*return*/, this.saveTransactionAndCommit(response)];
10821
- }
10822
- else {
10823
- if (rememberTransaction) {
10824
- this.rememberCurrentTransaction(response);
10825
- }
10818
+ catch (e) {
10826
10819
  }
10820
+ this.transactionLineAdded = false;
10827
10821
  }
10828
- return [2 /*return*/, success];
10822
+ if (!(this.autoSave && saveTransaction)) return [3 /*break*/, 5];
10823
+ return [2 /*return*/, this.saveTransactionAndCommit(response)];
10824
+ case 5:
10825
+ if (!rememberTransaction) return [3 /*break*/, 7];
10826
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
10827
+ case 6:
10828
+ _a.sent();
10829
+ _a.label = 7;
10830
+ case 7: return [2 /*return*/, success];
10829
10831
  }
10830
10832
  });
10831
10833
  });
@@ -11026,9 +11028,16 @@
11026
11028
  var _this = this;
11027
11029
  return __generator(this, function (_a) {
11028
11030
  this.cancelAddTransactionLine(uuid)
11029
- .then(function (response) {
11030
- _this.rememberCurrentTransaction(response);
11031
- });
11031
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
11032
+ return __generator(this, function (_a) {
11033
+ switch (_a.label) {
11034
+ case 0: return [4 /*yield*/, this.rememberCurrentTransaction(response)];
11035
+ case 1:
11036
+ _a.sent();
11037
+ return [2 /*return*/];
11038
+ }
11039
+ });
11040
+ }); });
11032
11041
  return [2 /*return*/];
11033
11042
  });
11034
11043
  });
@@ -11983,7 +11992,7 @@
11983
11992
  };
11984
11993
  TransactionService.prototype.saveRelation = function () {
11985
11994
  return __awaiter(this, void 0, void 0, function () {
11986
- var _a, locked, _b, response;
11995
+ var _a, locked, _b;
11987
11996
  return __generator(this, function (_c) {
11988
11997
  switch (_c.label) {
11989
11998
  case 0:
@@ -12011,7 +12020,7 @@
12011
12020
  if (!(!this.currentTransaction.transactionInfo.relation || (this.currentTransaction.transactionInfo.relation.relationId !== this.relation.relationId))) return [3 /*break*/, 8];
12012
12021
  return [4 /*yield*/, this.addRelationToTransaction(this.relation.relationId)];
12013
12022
  case 7:
12014
- response = _c.sent();
12023
+ _c.sent();
12015
12024
  _c.label = 8;
12016
12025
  case 8: return [2 /*return*/, true];
12017
12026
  }
@@ -12029,27 +12038,24 @@
12029
12038
  };
12030
12039
  TransactionService.prototype.createSalesOrder = function (request) {
12031
12040
  return __awaiter(this, void 0, void 0, function () {
12032
- var _this = this;
12041
+ var response;
12033
12042
  return __generator(this, function (_a) {
12034
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
12035
- var _this = this;
12036
- return __generator(this, function (_a) {
12037
- switch (_a.label) {
12038
- case 0: return [4 /*yield*/, this.checkBranch()];
12039
- case 1:
12040
- _a.sent();
12041
- if (!this.currentBranch) {
12042
- return [2 /*return*/, reject()];
12043
- }
12044
- request.branchNr = this.currentBranch;
12045
- this.connector.createSalesOrder(request).then(function (response) {
12046
- _this.rememberCurrentTransaction(response);
12047
- resolve(true);
12048
- });
12049
- return [2 /*return*/];
12050
- }
12051
- });
12052
- }); })];
12043
+ switch (_a.label) {
12044
+ case 0: return [4 /*yield*/, this.checkBranch()];
12045
+ case 1:
12046
+ _a.sent();
12047
+ if (!this.currentBranch) {
12048
+ return [2 /*return*/, false];
12049
+ }
12050
+ request.branchNr = this.currentBranch;
12051
+ return [4 /*yield*/, this.connector.createSalesOrder(request)];
12052
+ case 2:
12053
+ response = _a.sent();
12054
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12055
+ case 3:
12056
+ _a.sent();
12057
+ return [2 /*return*/, true];
12058
+ }
12053
12059
  });
12054
12060
  });
12055
12061
  };
@@ -12079,53 +12085,47 @@
12079
12085
  };
12080
12086
  TransactionService.prototype.createPurchaseOrder = function (request) {
12081
12087
  return __awaiter(this, void 0, void 0, function () {
12082
- var _this = this;
12088
+ var response;
12083
12089
  return __generator(this, function (_a) {
12084
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
12085
- var _this = this;
12086
- return __generator(this, function (_a) {
12087
- switch (_a.label) {
12088
- case 0: return [4 /*yield*/, this.checkBranch()];
12089
- case 1:
12090
- _a.sent();
12091
- if (!this.currentBranch) {
12092
- return [2 /*return*/, reject()];
12093
- }
12094
- request.branchNr = this.currentBranch;
12095
- this.connector.createPurchaseOrder(request).then(function (response) {
12096
- _this.rememberCurrentTransaction(response);
12097
- resolve(true);
12098
- });
12099
- return [2 /*return*/];
12100
- }
12101
- });
12102
- }); })];
12090
+ switch (_a.label) {
12091
+ case 0: return [4 /*yield*/, this.checkBranch()];
12092
+ case 1:
12093
+ _a.sent();
12094
+ if (!this.currentBranch) {
12095
+ return [2 /*return*/, false];
12096
+ }
12097
+ request.branchNr = this.currentBranch;
12098
+ return [4 /*yield*/, this.connector.createPurchaseOrder(request)];
12099
+ case 2:
12100
+ response = _a.sent();
12101
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12102
+ case 3:
12103
+ _a.sent();
12104
+ return [2 /*return*/, true];
12105
+ }
12103
12106
  });
12104
12107
  });
12105
12108
  };
12106
12109
  TransactionService.prototype.createServiceOrder = function (request) {
12107
12110
  return __awaiter(this, void 0, void 0, function () {
12108
- var _this = this;
12111
+ var response;
12109
12112
  return __generator(this, function (_a) {
12110
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
12111
- var _this = this;
12112
- return __generator(this, function (_a) {
12113
- switch (_a.label) {
12114
- case 0: return [4 /*yield*/, this.checkBranch()];
12115
- case 1:
12116
- _a.sent();
12117
- if (!this.currentBranch) {
12118
- return [2 /*return*/, reject()];
12119
- }
12120
- request.branchNr = this.currentBranch;
12121
- this.connector.createServiceOrder(request).then(function (response) {
12122
- _this.rememberCurrentTransaction(response);
12123
- resolve(true);
12124
- });
12125
- return [2 /*return*/];
12126
- }
12127
- });
12128
- }); })];
12113
+ switch (_a.label) {
12114
+ case 0: return [4 /*yield*/, this.checkBranch()];
12115
+ case 1:
12116
+ _a.sent();
12117
+ if (!this.currentBranch) {
12118
+ return [2 /*return*/, false];
12119
+ }
12120
+ request.branchNr = this.currentBranch;
12121
+ return [4 /*yield*/, this.connector.createServiceOrder(request)];
12122
+ case 2:
12123
+ response = _a.sent();
12124
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12125
+ case 3:
12126
+ _a.sent();
12127
+ return [2 /*return*/, true];
12128
+ }
12129
12129
  });
12130
12130
  });
12131
12131
  };
@@ -12144,10 +12144,17 @@
12144
12144
  return [2 /*return*/, reject()];
12145
12145
  }
12146
12146
  request.branchNr = this.currentBranch;
12147
- this.connector.createSalesQuotation(request).then(function (response) {
12148
- _this.rememberCurrentTransaction(response);
12149
- resolve(true);
12150
- });
12147
+ this.connector.createSalesQuotation(request).then(function (response) { return __awaiter(_this, void 0, void 0, function () {
12148
+ return __generator(this, function (_a) {
12149
+ switch (_a.label) {
12150
+ case 0: return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12151
+ case 1:
12152
+ _a.sent();
12153
+ resolve(true);
12154
+ return [2 /*return*/];
12155
+ }
12156
+ });
12157
+ }); });
12151
12158
  return [2 /*return*/];
12152
12159
  }
12153
12160
  });
@@ -12169,10 +12176,10 @@
12169
12176
  return [4 /*yield*/, this.connector.addRelationToTransaction(this.currentTransaction.transactionInfo.uuid, relationId)];
12170
12177
  case 2:
12171
12178
  response = _a.sent();
12172
- if (response) {
12173
- return [2 /*return*/, this.handleHeaderOperationStatuses(response)];
12174
- }
12175
- return [2 /*return*/, false];
12179
+ if (!response) return [3 /*break*/, 4];
12180
+ return [4 /*yield*/, this.handleHeaderOperationStatuses(response)];
12181
+ case 3: return [2 /*return*/, _a.sent()];
12182
+ case 4: return [2 /*return*/, false];
12176
12183
  }
12177
12184
  });
12178
12185
  });
@@ -13970,30 +13977,27 @@
13970
13977
  };
13971
13978
  TransactionService.prototype._checkAndCreateTransaction = function () {
13972
13979
  return __awaiter(this, void 0, void 0, function () {
13973
- var createMethod_1;
13980
+ var createMethod, request;
13974
13981
  return __generator(this, function (_a) {
13975
- if (!this.currentTransaction || !this.currentTransaction.transactionInfo || !this.currentTransaction.transactionInfo.transactionNr) {
13976
- createMethod_1 = this._createTransactionMethods.get(this.transactionKind);
13977
- if (createMethod_1) {
13978
- return [2 /*return*/, new Promise(function (resolve) {
13979
- var request = new createTransactionRequest.CreateTransactionRequest();
13980
- createMethod_1(request)
13981
- .then(function () {
13982
- resolve(true);
13983
- })
13984
- .catch(function () {
13985
- resolve(false);
13986
- });
13987
- })];
13988
- }
13989
- else {
13982
+ switch (_a.label) {
13983
+ case 0:
13984
+ if (!(!this.currentTransaction || !this.currentTransaction.transactionInfo || !this.currentTransaction.transactionInfo.transactionNr)) return [3 /*break*/, 4];
13985
+ createMethod = this._createTransactionMethods.get(this.transactionKind);
13986
+ if (!createMethod) return [3 /*break*/, 2];
13987
+ request = new createTransactionRequest.CreateTransactionRequest();
13988
+ this.getRelationOnRememberCurrentTransaction = false;
13989
+ return [4 /*yield*/, createMethod(request)];
13990
+ case 1:
13991
+ _a.sent();
13992
+ this.getRelationOnRememberCurrentTransaction = true;
13993
+ return [2 /*return*/, true];
13994
+ case 2:
13990
13995
  rxjs.throwError("Failed to create transaction");
13991
- }
13992
- }
13993
- else {
13994
- return [2 /*return*/, Promise.resolve(true)];
13996
+ return [2 /*return*/, false];
13997
+ case 3: return [3 /*break*/, 5];
13998
+ case 4: return [2 /*return*/, true];
13999
+ case 5: return [2 /*return*/];
13995
14000
  }
13996
- return [2 /*return*/];
13997
14001
  });
13998
14002
  });
13999
14003
  };
@@ -14176,34 +14180,24 @@
14176
14180
  };
14177
14181
  CheckoutComponent.prototype.handleCreateTransaction = function (event) {
14178
14182
  return __awaiter(this, void 0, void 0, function () {
14179
- var success, _a, saveSuccess;
14180
- return __generator(this, function (_b) {
14181
- switch (_b.label) {
14183
+ var saveSuccess;
14184
+ return __generator(this, function (_a) {
14185
+ switch (_a.label) {
14182
14186
  case 0:
14183
- success = true;
14184
- _a = this.stepper.activeStep === 0;
14185
- if (!_a) return [3 /*break*/, 2];
14187
+ if (!(this.stepper.activeStep === 0)) return [3 /*break*/, 5];
14186
14188
  return [4 /*yield*/, this.handleRelationValidation()];
14187
14189
  case 1:
14188
- _a = (_b.sent());
14189
- _b.label = 2;
14190
- case 2:
14191
- if (!_a) return [3 /*break*/, 5];
14192
- return [4 /*yield*/, this.service.saveRelation()];
14193
- case 3:
14194
- success = _b.sent();
14195
- if (!(success && this.transactionType !== this.transKind.SalesQuotation)) return [3 /*break*/, 5];
14190
+ if (!_a.sent()) return [3 /*break*/, 4];
14191
+ if (!(this.transactionType !== this.transKind.SalesQuotation)) return [3 /*break*/, 3];
14196
14192
  return [4 /*yield*/, this.service.updateHeaderTransactionDefinitive(this.service.currentTransaction.transactionInfo.uuid, true, true)];
14197
- case 4:
14198
- _b.sent();
14199
- _b.label = 5;
14200
- case 5:
14201
- if (!success) {
14202
- return [2 /*return*/];
14203
- }
14204
- return [4 /*yield*/, this.service.saveTransactionAndCommit()];
14193
+ case 2:
14194
+ _a.sent();
14195
+ _a.label = 3;
14196
+ case 3: return [3 /*break*/, 5];
14197
+ case 4: return [2 /*return*/];
14198
+ case 5: return [4 /*yield*/, this.service.saveTransactionAndCommit()];
14205
14199
  case 6:
14206
- saveSuccess = _b.sent();
14200
+ saveSuccess = _a.sent();
14207
14201
  if (saveSuccess) {
14208
14202
  this.handleTransactionFinished(this.service.currentTransaction.transactionInfo.transactionNr);
14209
14203
  }
@@ -14516,8 +14510,9 @@
14516
14510
  this._componentRef.destroy();
14517
14511
  }
14518
14512
  };
14519
- RelationSuggestionsService.prototype.init = function () {
14513
+ RelationSuggestionsService.prototype.init = function (relationKind) {
14520
14514
  var _this = this;
14515
+ this.relationKind = relationKind;
14521
14516
  if (this._componentRef) {
14522
14517
  this._componentRef.destroy();
14523
14518
  }
@@ -14642,7 +14637,7 @@
14642
14637
  if (this._relation instanceof customerFullObject_bo.CustomerFullObject) {
14643
14638
  this.customerGroup = this._relation.customerGroup;
14644
14639
  }
14645
- this.address = this._relation.getFirstAddressOrCreateNew();
14640
+ this.address = this._getFirstActiveAddressOrCreateNew(this._relation);
14646
14641
  if (this.address) {
14647
14642
  this.deliveryAddressNawNr = this.address.nawNr;
14648
14643
  this.deliveryAddressChange.emit(this.deliveryAddressNawNr);
@@ -14674,7 +14669,7 @@
14674
14669
  return __awaiter(this, void 0, void 0, function () {
14675
14670
  var _this = this;
14676
14671
  return __generator(this, function (_a) {
14677
- this._suggestionsService.init();
14672
+ this._suggestionsService.init(this._relationKind);
14678
14673
  this._subs.push(this._screenConfigService.configSet.subscribe(function (configObjects) {
14679
14674
  if (configObjects && configObjects.length > 0) {
14680
14675
  _this.showPreferences = _this._screenConfigService.getObjectConfigurationFor(_this.cfgNames.RelationPreferencesHeader).immediatelyVisible();
@@ -14784,6 +14779,48 @@
14784
14779
  this.invoiceAddressNawNr = this.deliveryAddressNawNr;
14785
14780
  this.invoiceAddressChange.next(this.invoiceAddressNawNr);
14786
14781
  };
14782
+ CheckoutOverviewRelationEditComponent.prototype._getFirstActiveAddressOrCreateNew = function (relation) {
14783
+ if (!relation.addresses || relation.addresses.length === 0) {
14784
+ return this._createNewAddress(relation);
14785
+ }
14786
+ var firstAvailableAddress = this._getFirstAddress(relation, [
14787
+ addressType_enum.AddressType.DeliveryAddress,
14788
+ addressType_enum.AddressType.BillingAddress,
14789
+ addressType_enum.AddressType.VisitingAddress,
14790
+ addressType_enum.AddressType.MailingAddress,
14791
+ addressType_enum.AddressType.NursingAddress
14792
+ ]);
14793
+ return firstAvailableAddress ? firstAvailableAddress : this._createNewAddress(relation);
14794
+ };
14795
+ CheckoutOverviewRelationEditComponent.prototype._getFirstAddress = function (relation, order) {
14796
+ if (order === void 0) { order = []; }
14797
+ var activeAddresses = relation.addresses.filter(function (a) { return a.isActive; });
14798
+ var len = order.length;
14799
+ for (var i = 0; i < len; i++) {
14800
+ var address = this._getFirstAddressOfType(activeAddresses, order[i]);
14801
+ if (address) {
14802
+ return address;
14803
+ }
14804
+ }
14805
+ };
14806
+ CheckoutOverviewRelationEditComponent.prototype._getFirstAddressOfType = function (addresses, type) {
14807
+ if (addresses) {
14808
+ var len = addresses.length;
14809
+ for (var i = 0; i < len; i++) {
14810
+ if (addresses[i].addressType === type) {
14811
+ return addresses[i];
14812
+ }
14813
+ }
14814
+ }
14815
+ };
14816
+ CheckoutOverviewRelationEditComponent.prototype._createNewAddress = function (relation) {
14817
+ var address = new address_bo.Address();
14818
+ address.addressType = addressType_enum.AddressType.DeliveryAddress;
14819
+ address.startDate = new Date();
14820
+ address.sequence = relation.getNextAddressSequence();
14821
+ relation.addresses.push(address);
14822
+ return address;
14823
+ };
14787
14824
  CheckoutOverviewRelationEditComponent.prototype._setCountryNameToAddress = function (address) {
14788
14825
  return __awaiter(this, void 0, void 0, function () {
14789
14826
  var country;
@@ -30063,7 +30100,7 @@
30063
30100
  var _this = this;
30064
30101
  return __generator(this, function (_a) {
30065
30102
  _super.ngOnInit.call(this);
30066
- this._suggestionsService.init();
30103
+ this._suggestionsService.init(this.relation.relationType);
30067
30104
  this.subs.push(this.screenConfigService.configSet.subscribe(function (configObjects) {
30068
30105
  if (configObjects && configObjects.length > 0) {
30069
30106
  _this.categories.length = 0;
@@ -41778,10 +41815,11 @@
41778
41815
  ];
41779
41816
 
41780
41817
  var TransactionTagsComponent = /** @class */ (function () {
41781
- function TransactionTagsComponent(_transactionService, _transactionEventService, iconCacheService) {
41818
+ function TransactionTagsComponent(_transactionService, _transactionEventService, _transactionConnectorService, iconCacheService) {
41782
41819
  var _this = this;
41783
41820
  this._transactionService = _transactionService;
41784
41821
  this._transactionEventService = _transactionEventService;
41822
+ this._transactionConnectorService = _transactionConnectorService;
41785
41823
  this.iconCacheService = iconCacheService;
41786
41824
  this.icons = Icon;
41787
41825
  this.tags = [];
@@ -41790,11 +41828,17 @@
41790
41828
  this.showEditTagsDialog = false;
41791
41829
  this._table = tableName_enum.TableName.Transactions;
41792
41830
  this._subs = [];
41831
+ this._loaded = false;
41793
41832
  this._subs.push(this._transactionEventService.transactionSet.subscribe(function (transaction) {
41794
41833
  if (transaction && transaction.transactionInfo.id) {
41795
41834
  _this._key = transaction.transactionInfo.transactionNr.toString();
41796
41835
  _this._getJoinedTags();
41797
41836
  }
41837
+ }), this._transactionConnectorService.connectionInitialized.subscribe(function (initialized) {
41838
+ if (initialized) {
41839
+ _this._loaded = true;
41840
+ _this._getJoinedTags();
41841
+ }
41798
41842
  }));
41799
41843
  }
41800
41844
  TransactionTagsComponent.prototype.showClass = function () {
@@ -41805,10 +41849,12 @@
41805
41849
  };
41806
41850
  TransactionTagsComponent.prototype._getJoinedTags = function () {
41807
41851
  var _this = this;
41808
- this._transactionService.getJoinedTags(this._table, this._key).then(function (tags) {
41809
- _this.tags = tags;
41810
- _this.editingTags = __spreadArray([], __read(tags));
41811
- });
41852
+ if (this._key && this._loaded && this.tags.length === 0) {
41853
+ this._transactionService.getJoinedTags(this._table, this._key).then(function (tags) {
41854
+ _this.tags = tags;
41855
+ _this.editingTags = __spreadArray([], __read(tags));
41856
+ });
41857
+ }
41812
41858
  };
41813
41859
  TransactionTagsComponent.prototype._getTabCategory = function () {
41814
41860
  switch (this._transactionService.transactionKind) {
@@ -41870,6 +41916,7 @@
41870
41916
  TransactionTagsComponent.ctorParameters = function () { return [
41871
41917
  { type: TransactionService },
41872
41918
  { type: TransactionEventService },
41919
+ { type: TransactionConnectorService },
41873
41920
  { type: IconCacheService }
41874
41921
  ]; };
41875
41922
  TransactionTagsComponent.propDecorators = {