@colijnit/transaction 12.1.178 → 12.1.180

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 (44) hide show
  1. package/bundles/colijnit-transaction.umd.js +282 -189
  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-header-fields/transaction-header-administrative-relation.component.js +4 -4
  10. package/esm2015/lib/component/transaction-header-fields/transaction-header-currency.component.js +4 -4
  11. package/esm2015/lib/component/transaction-header-fields/transaction-header-delivery-method.component.js +4 -1
  12. package/esm2015/lib/component/transaction-header-fields/transaction-header-sales-person.component.js +4 -4
  13. package/esm2015/lib/component/transaction-line/transaction-invoice-line/transaction-invoice-line-base.component.js +2 -1
  14. package/esm2015/lib/component/transaction-line/transaction-line/transaction-line.component.js +1 -1
  15. package/esm2015/lib/component/transaction-line/transaction-order-delivery-line/transaction-order-delivery-line-base.component.js +2 -1
  16. package/esm2015/lib/component/transaction-lines-side-panel/transaction-lines-side-panel/transaction-lines-side-panel.component.js +1 -1
  17. package/esm2015/lib/component/transaction-quick-access/transaction-quick-access-invoice/transaction-quick-access-invoice.component.js +2 -2
  18. package/esm2015/lib/component/transaction-quick-access/transaction-quick-access-order-delivery/transaction-quick-access-order-delivery.component.js +2 -2
  19. package/esm2015/lib/component/transaction-search/transaction-filter/transaction-filter/transaction-filter.component.js +3 -3
  20. package/esm2015/lib/component/transaction-search/transaction-search-grid/transaction-search-grid/transaction-search-grid.component.js +3 -3
  21. package/esm2015/lib/component/transaction-search/transaction-search-tile/transaction-search-tile/transaction-search-tile.component.js +3 -3
  22. package/esm2015/lib/component/transaction-tags/transaction-tags.component.js +32 -17
  23. package/esm2015/lib/service/pending-reason.service.js +6 -6
  24. package/esm2015/lib/service/relation-suggestions.service.js +3 -2
  25. package/esm2015/lib/service/transaction-base.service.js +5 -3
  26. package/esm2015/lib/service/transaction-connector-adapter.service.js +17 -1
  27. package/esm2015/lib/service/transaction-connector.service.js +6 -1
  28. package/esm2015/lib/service/transaction.service.js +43 -56
  29. package/esm2015/lib/transaction-version.js +3 -3
  30. package/fesm2015/colijnit-transaction.js +167 -95
  31. package/fesm2015/colijnit-transaction.js.map +1 -1
  32. package/lib/component/checkout/checkout-overview-relation-edit/checkout-overview-relation-edit.component.d.ts +4 -0
  33. package/lib/component/transaction-header-fields/transaction-header-administrative-relation.component.d.ts +1 -1
  34. package/lib/component/transaction-header-fields/transaction-header-currency.component.d.ts +1 -1
  35. package/lib/component/transaction-header-fields/transaction-header-sales-person.component.d.ts +1 -1
  36. package/lib/component/transaction-search/transaction-filter/transaction-filter/transaction-filter.component.d.ts +2 -2
  37. package/lib/component/transaction-search/transaction-search-grid/transaction-search-grid/transaction-search-grid.component.d.ts +3 -3
  38. package/lib/component/transaction-search/transaction-search-tile/transaction-search-tile/transaction-search-tile.component.d.ts +3 -3
  39. package/lib/component/transaction-tags/transaction-tags.component.d.ts +13 -8
  40. package/lib/service/relation-suggestions.service.d.ts +1 -1
  41. package/lib/service/transaction-connector-adapter.service.d.ts +1 -0
  42. package/lib/service/transaction-connector.service.d.ts +1 -0
  43. package/lib/service/transaction.service.d.ts +1 -1
  44. 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.180";
35
+ this.publishDate = "29-12-2023 17:08:18";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -4522,6 +4522,31 @@
4522
4522
  });
4523
4523
  });
4524
4524
  };
4525
+ TransactionConnectorAdapterService.prototype.changeHeaderTransactionCurrency = function (uuid, currencyCode) {
4526
+ return __awaiter(this, void 0, void 0, function () {
4527
+ var request, response;
4528
+ return __generator(this, function (_a) {
4529
+ switch (_a.label) {
4530
+ case 0:
4531
+ request = {
4532
+ transactionUuid: uuid,
4533
+ newCurrencyCode: currencyCode
4534
+ };
4535
+ return [4 /*yield*/, this.connector.changeHeaderCurrency(request)];
4536
+ case 1:
4537
+ response = _a.sent();
4538
+ if (response && response.validationResult && response.validationResult.success) {
4539
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(transactionInfoResponse_bo.TransactionInfoResponse, response.resultObject)];
4540
+ }
4541
+ else {
4542
+ this._handleExceptionFromResponse(response);
4543
+ return [2 /*return*/, null];
4544
+ }
4545
+ return [2 /*return*/];
4546
+ }
4547
+ });
4548
+ });
4549
+ };
4525
4550
  TransactionConnectorAdapterService.prototype.changeHeaderTransactionMarketing = function (uuid, code) {
4526
4551
  return __awaiter(this, void 0, void 0, function () {
4527
4552
  var request, response;
@@ -7781,6 +7806,13 @@
7781
7806
  });
7782
7807
  });
7783
7808
  };
7809
+ TransactionConnectorService.prototype.changeHeaderTransactionCurrency = function (uuid, currencyCode) {
7810
+ return __awaiter(this, void 0, void 0, function () {
7811
+ return __generator(this, function (_a) {
7812
+ return [2 /*return*/, this._adapterService.changeHeaderTransactionCurrency(uuid, currencyCode)];
7813
+ });
7814
+ });
7815
+ };
7784
7816
  TransactionConnectorService.prototype.changeHeaderTransactionMarketing = function (uuid, code) {
7785
7817
  return __awaiter(this, void 0, void 0, function () {
7786
7818
  return __generator(this, function (_a) {
@@ -10309,13 +10341,14 @@
10309
10341
  })];
10310
10342
  case 1:
10311
10343
  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];
10344
+ if (!(response && response.isSuccess)) return [3 /*break*/, 3];
10345
+ this.resetLockTransaction();
10346
+ if (!rememberTransaction) return [3 /*break*/, 3];
10347
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
10348
+ case 2:
10349
+ _a.sent();
10350
+ _a.label = 3;
10351
+ case 3: return [2 /*return*/, response];
10319
10352
  }
10320
10353
  });
10321
10354
  });
@@ -10514,21 +10547,23 @@
10514
10547
  this._setAmount();
10515
10548
  this._checkHeaderStatus();
10516
10549
  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];
10550
+ if (!this.getRelationOnRememberCurrentTransaction) return [3 /*break*/, 5];
10551
+ if (!(this.currentTransaction.transactionInfo.relation && this.currentTransaction.transactionInfo.relation.relationId)) return [3 /*break*/, 4];
10552
+ if (!(!this.relation || this.relation.relationId !== this.currentTransaction.transactionInfo.relation.relationId)) return [3 /*break*/, 3];
10519
10553
  return [4 /*yield*/, this._getRelation(this.currentTransaction.transactionInfo.relation)];
10520
10554
  case 2:
10521
10555
  _a.sent();
10522
- return [3 /*break*/, 4];
10523
- case 3:
10556
+ _a.label = 3;
10557
+ case 3: return [3 /*break*/, 5];
10558
+ case 4:
10524
10559
  this.relation = new customerFullObject_bo.CustomerFullObject();
10525
10560
  this.relation.type = relationNameKind_enum.RelationNameKind.Private;
10526
- _a.label = 4;
10527
- case 4:
10561
+ _a.label = 5;
10562
+ case 5:
10528
10563
  this.transactionUpdated.next(this.currentTransaction);
10529
10564
  this.transactionEventService.transactionSet.next(this.currentTransaction);
10530
10565
  return [4 /*yield*/, this._handleAfterRememberCurrentTransaction()];
10531
- case 5:
10566
+ case 6:
10532
10567
  _a.sent();
10533
10568
  return [2 /*return*/];
10534
10569
  }
@@ -10752,15 +10787,15 @@
10752
10787
  return [3 /*break*/, 1];
10753
10788
  case 5:
10754
10789
  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];
10790
+ if (!!hasPendingReasons) return [3 /*break*/, 8];
10791
+ if (!((this.autoSave && saveTransaction) || overrideSave)) return [3 /*break*/, 6];
10792
+ return [2 /*return*/, this.saveTransactionAndCommit(response)];
10793
+ case 6: // just replace transaction object
10794
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
10795
+ case 7:
10796
+ _b.sent();
10797
+ _b.label = 8;
10798
+ case 8: return [2 /*return*/, success];
10764
10799
  }
10765
10800
  });
10766
10801
  });
@@ -10807,25 +10842,24 @@
10807
10842
  return [3 /*break*/, 1];
10808
10843
  case 4:
10809
10844
  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;
10845
+ if (!!hasPendingReasons) return [3 /*break*/, 7];
10846
+ if (this.transactionLineAdded) {
10847
+ try {
10848
+ this.transactionEventService.transactionLineAdded.next(response.lineOperationStatuses[0].lineNr);
10818
10849
  }
10819
- if (this.autoSave && saveTransaction) {
10820
- return [2 /*return*/, this.saveTransactionAndCommit(response)];
10821
- }
10822
- else {
10823
- if (rememberTransaction) {
10824
- this.rememberCurrentTransaction(response);
10825
- }
10850
+ catch (e) {
10826
10851
  }
10852
+ this.transactionLineAdded = false;
10827
10853
  }
10828
- return [2 /*return*/, success];
10854
+ if (!(this.autoSave && saveTransaction)) return [3 /*break*/, 5];
10855
+ return [2 /*return*/, this.saveTransactionAndCommit(response)];
10856
+ case 5:
10857
+ if (!rememberTransaction) return [3 /*break*/, 7];
10858
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
10859
+ case 6:
10860
+ _a.sent();
10861
+ _a.label = 7;
10862
+ case 7: return [2 /*return*/, success];
10829
10863
  }
10830
10864
  });
10831
10865
  });
@@ -11026,9 +11060,16 @@
11026
11060
  var _this = this;
11027
11061
  return __generator(this, function (_a) {
11028
11062
  this.cancelAddTransactionLine(uuid)
11029
- .then(function (response) {
11030
- _this.rememberCurrentTransaction(response);
11031
- });
11063
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
11064
+ return __generator(this, function (_a) {
11065
+ switch (_a.label) {
11066
+ case 0: return [4 /*yield*/, this.rememberCurrentTransaction(response)];
11067
+ case 1:
11068
+ _a.sent();
11069
+ return [2 /*return*/];
11070
+ }
11071
+ });
11072
+ }); });
11032
11073
  return [2 /*return*/];
11033
11074
  });
11034
11075
  });
@@ -11584,15 +11625,20 @@
11584
11625
  });
11585
11626
  });
11586
11627
  };
11587
- TransactionService.prototype.updateHeaderTransactionCurrency = function (uuid, currencyId, saveTransaction) {
11628
+ TransactionService.prototype.updateHeaderTransactionCurrency = function (uuid, currencyCode, saveTransaction) {
11588
11629
  return __awaiter(this, void 0, void 0, function () {
11630
+ var response;
11589
11631
  return __generator(this, function (_a) {
11590
- // not in middletier yet
11591
- // const response: TransactionInfoResponse | boolean = await this.connector.changeHeaderTransactionCurrency(uuid, currencyId);
11592
- // if (response) {
11593
- // return this.handleHeaderOperationStatuses(response);
11594
- // }
11595
- return [2 /*return*/, true];
11632
+ switch (_a.label) {
11633
+ case 0: return [4 /*yield*/, this.connector.changeHeaderTransactionCurrency(uuid, currencyCode)];
11634
+ case 1:
11635
+ response = _a.sent();
11636
+ if (response) {
11637
+ this.transactionDirty = true;
11638
+ return [2 /*return*/, this.handleHeaderOperationStatuses(response, saveTransaction)];
11639
+ }
11640
+ return [2 /*return*/, true];
11641
+ }
11596
11642
  });
11597
11643
  });
11598
11644
  };
@@ -11983,7 +12029,7 @@
11983
12029
  };
11984
12030
  TransactionService.prototype.saveRelation = function () {
11985
12031
  return __awaiter(this, void 0, void 0, function () {
11986
- var _a, locked, _b, response;
12032
+ var _a, locked, _b;
11987
12033
  return __generator(this, function (_c) {
11988
12034
  switch (_c.label) {
11989
12035
  case 0:
@@ -12011,7 +12057,7 @@
12011
12057
  if (!(!this.currentTransaction.transactionInfo.relation || (this.currentTransaction.transactionInfo.relation.relationId !== this.relation.relationId))) return [3 /*break*/, 8];
12012
12058
  return [4 /*yield*/, this.addRelationToTransaction(this.relation.relationId)];
12013
12059
  case 7:
12014
- response = _c.sent();
12060
+ _c.sent();
12015
12061
  _c.label = 8;
12016
12062
  case 8: return [2 /*return*/, true];
12017
12063
  }
@@ -12029,27 +12075,24 @@
12029
12075
  };
12030
12076
  TransactionService.prototype.createSalesOrder = function (request) {
12031
12077
  return __awaiter(this, void 0, void 0, function () {
12032
- var _this = this;
12078
+ var response;
12033
12079
  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
- }); })];
12080
+ switch (_a.label) {
12081
+ case 0: return [4 /*yield*/, this.checkBranch()];
12082
+ case 1:
12083
+ _a.sent();
12084
+ if (!this.currentBranch) {
12085
+ return [2 /*return*/, false];
12086
+ }
12087
+ request.branchNr = this.currentBranch;
12088
+ return [4 /*yield*/, this.connector.createSalesOrder(request)];
12089
+ case 2:
12090
+ response = _a.sent();
12091
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12092
+ case 3:
12093
+ _a.sent();
12094
+ return [2 /*return*/, true];
12095
+ }
12053
12096
  });
12054
12097
  });
12055
12098
  };
@@ -12079,53 +12122,47 @@
12079
12122
  };
12080
12123
  TransactionService.prototype.createPurchaseOrder = function (request) {
12081
12124
  return __awaiter(this, void 0, void 0, function () {
12082
- var _this = this;
12125
+ var response;
12083
12126
  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
- }); })];
12127
+ switch (_a.label) {
12128
+ case 0: return [4 /*yield*/, this.checkBranch()];
12129
+ case 1:
12130
+ _a.sent();
12131
+ if (!this.currentBranch) {
12132
+ return [2 /*return*/, false];
12133
+ }
12134
+ request.branchNr = this.currentBranch;
12135
+ return [4 /*yield*/, this.connector.createPurchaseOrder(request)];
12136
+ case 2:
12137
+ response = _a.sent();
12138
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12139
+ case 3:
12140
+ _a.sent();
12141
+ return [2 /*return*/, true];
12142
+ }
12103
12143
  });
12104
12144
  });
12105
12145
  };
12106
12146
  TransactionService.prototype.createServiceOrder = function (request) {
12107
12147
  return __awaiter(this, void 0, void 0, function () {
12108
- var _this = this;
12148
+ var response;
12109
12149
  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
- }); })];
12150
+ switch (_a.label) {
12151
+ case 0: return [4 /*yield*/, this.checkBranch()];
12152
+ case 1:
12153
+ _a.sent();
12154
+ if (!this.currentBranch) {
12155
+ return [2 /*return*/, false];
12156
+ }
12157
+ request.branchNr = this.currentBranch;
12158
+ return [4 /*yield*/, this.connector.createServiceOrder(request)];
12159
+ case 2:
12160
+ response = _a.sent();
12161
+ return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12162
+ case 3:
12163
+ _a.sent();
12164
+ return [2 /*return*/, true];
12165
+ }
12129
12166
  });
12130
12167
  });
12131
12168
  };
@@ -12144,10 +12181,17 @@
12144
12181
  return [2 /*return*/, reject()];
12145
12182
  }
12146
12183
  request.branchNr = this.currentBranch;
12147
- this.connector.createSalesQuotation(request).then(function (response) {
12148
- _this.rememberCurrentTransaction(response);
12149
- resolve(true);
12150
- });
12184
+ this.connector.createSalesQuotation(request).then(function (response) { return __awaiter(_this, void 0, void 0, function () {
12185
+ return __generator(this, function (_a) {
12186
+ switch (_a.label) {
12187
+ case 0: return [4 /*yield*/, this.rememberCurrentTransaction(response)];
12188
+ case 1:
12189
+ _a.sent();
12190
+ resolve(true);
12191
+ return [2 /*return*/];
12192
+ }
12193
+ });
12194
+ }); });
12151
12195
  return [2 /*return*/];
12152
12196
  }
12153
12197
  });
@@ -12169,10 +12213,10 @@
12169
12213
  return [4 /*yield*/, this.connector.addRelationToTransaction(this.currentTransaction.transactionInfo.uuid, relationId)];
12170
12214
  case 2:
12171
12215
  response = _a.sent();
12172
- if (response) {
12173
- return [2 /*return*/, this.handleHeaderOperationStatuses(response)];
12174
- }
12175
- return [2 /*return*/, false];
12216
+ if (!response) return [3 /*break*/, 4];
12217
+ return [4 /*yield*/, this.handleHeaderOperationStatuses(response)];
12218
+ case 3: return [2 /*return*/, _a.sent()];
12219
+ case 4: return [2 /*return*/, false];
12176
12220
  }
12177
12221
  });
12178
12222
  });
@@ -13970,30 +14014,27 @@
13970
14014
  };
13971
14015
  TransactionService.prototype._checkAndCreateTransaction = function () {
13972
14016
  return __awaiter(this, void 0, void 0, function () {
13973
- var createMethod_1;
14017
+ var createMethod, request;
13974
14018
  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 {
14019
+ switch (_a.label) {
14020
+ case 0:
14021
+ if (!(!this.currentTransaction || !this.currentTransaction.transactionInfo || !this.currentTransaction.transactionInfo.transactionNr)) return [3 /*break*/, 4];
14022
+ createMethod = this._createTransactionMethods.get(this.transactionKind);
14023
+ if (!createMethod) return [3 /*break*/, 2];
14024
+ request = new createTransactionRequest.CreateTransactionRequest();
14025
+ this.getRelationOnRememberCurrentTransaction = false;
14026
+ return [4 /*yield*/, createMethod(request)];
14027
+ case 1:
14028
+ _a.sent();
14029
+ this.getRelationOnRememberCurrentTransaction = true;
14030
+ return [2 /*return*/, true];
14031
+ case 2:
13990
14032
  rxjs.throwError("Failed to create transaction");
13991
- }
13992
- }
13993
- else {
13994
- return [2 /*return*/, Promise.resolve(true)];
14033
+ return [2 /*return*/, false];
14034
+ case 3: return [3 /*break*/, 5];
14035
+ case 4: return [2 /*return*/, true];
14036
+ case 5: return [2 /*return*/];
13995
14037
  }
13996
- return [2 /*return*/];
13997
14038
  });
13998
14039
  });
13999
14040
  };
@@ -14176,34 +14217,24 @@
14176
14217
  };
14177
14218
  CheckoutComponent.prototype.handleCreateTransaction = function (event) {
14178
14219
  return __awaiter(this, void 0, void 0, function () {
14179
- var success, _a, saveSuccess;
14180
- return __generator(this, function (_b) {
14181
- switch (_b.label) {
14220
+ var saveSuccess;
14221
+ return __generator(this, function (_a) {
14222
+ switch (_a.label) {
14182
14223
  case 0:
14183
- success = true;
14184
- _a = this.stepper.activeStep === 0;
14185
- if (!_a) return [3 /*break*/, 2];
14224
+ if (!(this.stepper.activeStep === 0)) return [3 /*break*/, 5];
14186
14225
  return [4 /*yield*/, this.handleRelationValidation()];
14187
14226
  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];
14227
+ if (!_a.sent()) return [3 /*break*/, 4];
14228
+ if (!(this.transactionType !== this.transKind.SalesQuotation)) return [3 /*break*/, 3];
14196
14229
  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()];
14230
+ case 2:
14231
+ _a.sent();
14232
+ _a.label = 3;
14233
+ case 3: return [3 /*break*/, 5];
14234
+ case 4: return [2 /*return*/];
14235
+ case 5: return [4 /*yield*/, this.service.saveTransactionAndCommit()];
14205
14236
  case 6:
14206
- saveSuccess = _b.sent();
14237
+ saveSuccess = _a.sent();
14207
14238
  if (saveSuccess) {
14208
14239
  this.handleTransactionFinished(this.service.currentTransaction.transactionInfo.transactionNr);
14209
14240
  }
@@ -14516,8 +14547,9 @@
14516
14547
  this._componentRef.destroy();
14517
14548
  }
14518
14549
  };
14519
- RelationSuggestionsService.prototype.init = function () {
14550
+ RelationSuggestionsService.prototype.init = function (relationKind) {
14520
14551
  var _this = this;
14552
+ this.relationKind = relationKind;
14521
14553
  if (this._componentRef) {
14522
14554
  this._componentRef.destroy();
14523
14555
  }
@@ -14642,7 +14674,7 @@
14642
14674
  if (this._relation instanceof customerFullObject_bo.CustomerFullObject) {
14643
14675
  this.customerGroup = this._relation.customerGroup;
14644
14676
  }
14645
- this.address = this._relation.getFirstAddressOrCreateNew();
14677
+ this.address = this._getFirstActiveAddressOrCreateNew(this._relation);
14646
14678
  if (this.address) {
14647
14679
  this.deliveryAddressNawNr = this.address.nawNr;
14648
14680
  this.deliveryAddressChange.emit(this.deliveryAddressNawNr);
@@ -14674,7 +14706,7 @@
14674
14706
  return __awaiter(this, void 0, void 0, function () {
14675
14707
  var _this = this;
14676
14708
  return __generator(this, function (_a) {
14677
- this._suggestionsService.init();
14709
+ this._suggestionsService.init(this._relationKind);
14678
14710
  this._subs.push(this._screenConfigService.configSet.subscribe(function (configObjects) {
14679
14711
  if (configObjects && configObjects.length > 0) {
14680
14712
  _this.showPreferences = _this._screenConfigService.getObjectConfigurationFor(_this.cfgNames.RelationPreferencesHeader).immediatelyVisible();
@@ -14784,6 +14816,48 @@
14784
14816
  this.invoiceAddressNawNr = this.deliveryAddressNawNr;
14785
14817
  this.invoiceAddressChange.next(this.invoiceAddressNawNr);
14786
14818
  };
14819
+ CheckoutOverviewRelationEditComponent.prototype._getFirstActiveAddressOrCreateNew = function (relation) {
14820
+ if (!relation.addresses || relation.addresses.length === 0) {
14821
+ return this._createNewAddress(relation);
14822
+ }
14823
+ var firstAvailableAddress = this._getFirstAddress(relation, [
14824
+ addressType_enum.AddressType.DeliveryAddress,
14825
+ addressType_enum.AddressType.BillingAddress,
14826
+ addressType_enum.AddressType.VisitingAddress,
14827
+ addressType_enum.AddressType.MailingAddress,
14828
+ addressType_enum.AddressType.NursingAddress
14829
+ ]);
14830
+ return firstAvailableAddress ? firstAvailableAddress : this._createNewAddress(relation);
14831
+ };
14832
+ CheckoutOverviewRelationEditComponent.prototype._getFirstAddress = function (relation, order) {
14833
+ if (order === void 0) { order = []; }
14834
+ var activeAddresses = relation.addresses.filter(function (a) { return a.isActive; });
14835
+ var len = order.length;
14836
+ for (var i = 0; i < len; i++) {
14837
+ var address = this._getFirstAddressOfType(activeAddresses, order[i]);
14838
+ if (address) {
14839
+ return address;
14840
+ }
14841
+ }
14842
+ };
14843
+ CheckoutOverviewRelationEditComponent.prototype._getFirstAddressOfType = function (addresses, type) {
14844
+ if (addresses) {
14845
+ var len = addresses.length;
14846
+ for (var i = 0; i < len; i++) {
14847
+ if (addresses[i].addressType === type) {
14848
+ return addresses[i];
14849
+ }
14850
+ }
14851
+ }
14852
+ };
14853
+ CheckoutOverviewRelationEditComponent.prototype._createNewAddress = function (relation) {
14854
+ var address = new address_bo.Address();
14855
+ address.addressType = addressType_enum.AddressType.DeliveryAddress;
14856
+ address.startDate = new Date();
14857
+ address.sequence = relation.getNextAddressSequence();
14858
+ relation.addresses.push(address);
14859
+ return address;
14860
+ };
14787
14861
  CheckoutOverviewRelationEditComponent.prototype._setCountryNameToAddress = function (address) {
14788
14862
  return __awaiter(this, void 0, void 0, function () {
14789
14863
  var country;
@@ -19015,6 +19089,7 @@
19015
19089
  this.showCheckbox = this.canAllLinesBeDelivered && !this.lineIsDelivered;
19016
19090
  this.selected = true;
19017
19091
  this.checkboxReadonly = true;
19092
+ this.transactionEventService.lineSelectedForDelivery.next({ lineUuid: this.transactionLine.uuid, selected: this.transactionLine.selected });
19018
19093
  }
19019
19094
  this.detectChanges();
19020
19095
  }
@@ -19080,7 +19155,7 @@
19080
19155
  this._subs.push(this.transactionEventService.allLinesSelectedForDelivery.subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
19081
19156
  return __generator(this, function (_a) {
19082
19157
  switch (_a.label) {
19083
- case 0: return [4 /*yield*/, this.transactionService.updateQuantitySelectedForAllLines(this.transaction, this.allSelected)];
19158
+ case 0: return [4 /*yield*/, this.transactionService.updateQuantitySelectedForAllLines(this.transaction, this.allSelected || !this.transactionInfo.allowPartialDelivery)];
19084
19159
  case 1:
19085
19160
  _a.sent();
19086
19161
  return [2 /*return*/];
@@ -20233,7 +20308,7 @@
20233
20308
  this._subs.push(this.transactionEventService.allLinesSelectedForInvoice.subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
20234
20309
  return __generator(this, function (_a) {
20235
20310
  switch (_a.label) {
20236
- case 0: return [4 /*yield*/, this.transactionService.updateQuantitySelectedForAllLines(this.transaction, this.allSelected)];
20311
+ case 0: return [4 /*yield*/, this.transactionService.updateQuantitySelectedForAllLines(this.transaction, this.allSelected || !this.transactionInfo.allowPartialDelivery)];
20237
20312
  case 1:
20238
20313
  _a.sent();
20239
20314
  return [2 /*return*/];
@@ -20448,6 +20523,7 @@
20448
20523
  this.showCheckbox = this.canAllLinesBeInvoiced && !this.lineIsInvoiced;
20449
20524
  this.selected = true;
20450
20525
  this.checkboxReadonly = true;
20526
+ this.transactionEventService.lineSelectedForInvoice.next({ lineUuid: this.transactionLine.uuid, selected: this.transactionLine.selected });
20451
20527
  }
20452
20528
  this.detectChanges();
20453
20529
  }
@@ -29363,6 +29439,9 @@
29363
29439
  };
29364
29440
  TransactionHeaderDeliveryMethodComponent.prototype.transactionInfoSet = function () {
29365
29441
  _super.prototype.transactionInfoSet.call(this);
29442
+ if (!this.transactionInfo.headerInfoStatus) {
29443
+ return;
29444
+ }
29366
29445
  this.headerReadonly = this.headerReadonly || this.transactionInfo.headerInfoStatus.isFullyDelivered || this.transactionInfo.headerInfoStatus.isFullyInvoiced;
29367
29446
  if (this.transactionInfo.headerInfoStatus.isFullyDelivered) {
29368
29447
  this.addHeaderTooltipMessage(this.dictionaryService.get("COMPLETELY_DELIVERED"));
@@ -30063,7 +30142,7 @@
30063
30142
  var _this = this;
30064
30143
  return __generator(this, function (_a) {
30065
30144
  _super.ngOnInit.call(this);
30066
- this._suggestionsService.init();
30145
+ this._suggestionsService.init(this.relation.relationType);
30067
30146
  this.subs.push(this.screenConfigService.configSet.subscribe(function (configObjects) {
30068
30147
  if (configObjects && configObjects.length > 0) {
30069
30148
  _this.categories.length = 0;
@@ -30594,13 +30673,13 @@
30594
30673
  return __generator(this, function (_a) {
30595
30674
  switch (_a.label) {
30596
30675
  case 0:
30597
- if (!(this.transactionInfo.salesPerson !== relation)) return [3 /*break*/, 2];
30676
+ if (!(this.transactionInfo.salesPerson !== relation.relationId)) return [3 /*break*/, 2];
30598
30677
  oldSalesPerson = this.transactionInfo.salesPerson;
30599
- return [4 /*yield*/, this.transactionService.updateHeaderTransactionSalesPerson(this.transactionInfo.uuid, relation, this.lockAndSave)];
30678
+ return [4 /*yield*/, this.transactionService.updateHeaderTransactionSalesPerson(this.transactionInfo.uuid, relation.relationId, this.lockAndSave)];
30600
30679
  case 1:
30601
30680
  success = _a.sent();
30602
30681
  if (!success) {
30603
- this.transactionInfo.salesPerson = relation;
30682
+ this.transactionInfo.salesPerson = relation.relationId;
30604
30683
  this._setSalesPerson();
30605
30684
  return [2 /*return*/, success];
30606
30685
  }
@@ -30684,13 +30763,13 @@
30684
30763
  return __generator(this, function (_a) {
30685
30764
  switch (_a.label) {
30686
30765
  case 0:
30687
- if (!(this.transactionInfo.admCoordinator !== relation)) return [3 /*break*/, 2];
30766
+ if (!(this.transactionInfo.admCoordinator !== relation.relationId)) return [3 /*break*/, 2];
30688
30767
  oldAdm = this.transactionInfo.admCoordinator;
30689
- return [4 /*yield*/, this.transactionService.updateHeaderTransactionAdmCoordinator(this.transactionInfo.uuid, relation, this.lockAndSave)];
30768
+ return [4 /*yield*/, this.transactionService.updateHeaderTransactionAdmCoordinator(this.transactionInfo.uuid, relation.relationId, this.lockAndSave)];
30690
30769
  case 1:
30691
30770
  success = _a.sent();
30692
30771
  if (!success) {
30693
- this.transactionInfo.admCoordinator = relation;
30772
+ this.transactionInfo.admCoordinator = relation.relationId;
30694
30773
  this._setRelationModel();
30695
30774
  return [2 /*return*/, success];
30696
30775
  }
@@ -30873,12 +30952,12 @@
30873
30952
  return __generator(this, function (_a) {
30874
30953
  switch (_a.label) {
30875
30954
  case 0:
30876
- if (!(this.transactionInfo.currencyId !== currency)) return [3 /*break*/, 2];
30877
- return [4 /*yield*/, this.transactionService.updateHeaderTransactionCurrency(this.transactionInfo.uuid, currency, this.lockAndSave)];
30955
+ if (!(this.transactionInfo.currencyId !== currency.id)) return [3 /*break*/, 2];
30956
+ return [4 /*yield*/, this.transactionService.updateHeaderTransactionCurrency(this.transactionInfo.uuid, currency.code, this.lockAndSave)];
30878
30957
  case 1:
30879
30958
  success = _a.sent();
30880
30959
  if (!success) {
30881
- this.transactionInfo.currencyId = currency;
30960
+ this.transactionInfo.currencyId = currency.id;
30882
30961
  this._setCurrencyModel();
30883
30962
  return [2 /*return*/, success];
30884
30963
  }
@@ -41778,10 +41857,10 @@
41778
41857
  ];
41779
41858
 
41780
41859
  var TransactionTagsComponent = /** @class */ (function () {
41781
- function TransactionTagsComponent(_transactionService, _transactionEventService, iconCacheService) {
41782
- var _this = this;
41860
+ function TransactionTagsComponent(_transactionService, _transactionEventService, _transactionConnectorService, iconCacheService) {
41783
41861
  this._transactionService = _transactionService;
41784
41862
  this._transactionEventService = _transactionEventService;
41863
+ this._transactionConnectorService = _transactionConnectorService;
41785
41864
  this.iconCacheService = iconCacheService;
41786
41865
  this.icons = Icon;
41787
41866
  this.tags = [];
@@ -41790,25 +41869,38 @@
41790
41869
  this.showEditTagsDialog = false;
41791
41870
  this._table = tableName_enum.TableName.Transactions;
41792
41871
  this._subs = [];
41872
+ this._loaded = false;
41873
+ this._loading = false;
41874
+ }
41875
+ TransactionTagsComponent.prototype.showClass = function () {
41876
+ return true;
41877
+ };
41878
+ TransactionTagsComponent.prototype.ngOnInit = function () {
41879
+ var _this = this;
41793
41880
  this._subs.push(this._transactionEventService.transactionSet.subscribe(function (transaction) {
41794
41881
  if (transaction && transaction.transactionInfo.id) {
41795
41882
  _this._key = transaction.transactionInfo.transactionNr.toString();
41796
41883
  _this._getJoinedTags();
41797
41884
  }
41885
+ }), this._transactionConnectorService.connectionInitialized.subscribe(function (initialized) {
41886
+ if (initialized) {
41887
+ _this._loaded = true;
41888
+ _this._getJoinedTags();
41889
+ }
41798
41890
  }));
41799
- }
41800
- TransactionTagsComponent.prototype.showClass = function () {
41801
- return true;
41802
41891
  };
41803
41892
  TransactionTagsComponent.prototype.ngOnDestroy = function () {
41804
41893
  this._subs.forEach(function (s) { return s.unsubscribe(); });
41805
41894
  };
41806
41895
  TransactionTagsComponent.prototype._getJoinedTags = function () {
41807
41896
  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
- });
41897
+ if (this._key && this._loaded && this.tags.length === 0 && !this._loading) {
41898
+ this._loading = true;
41899
+ this._transactionService.getJoinedTags(this._table, this._key).then(function (tags) {
41900
+ _this.tags = tags;
41901
+ _this.editingTags = __spreadArray([], __read(tags));
41902
+ });
41903
+ }
41812
41904
  };
41813
41905
  TransactionTagsComponent.prototype._getTabCategory = function () {
41814
41906
  switch (this._transactionService.transactionKind) {
@@ -41870,6 +41962,7 @@
41870
41962
  TransactionTagsComponent.ctorParameters = function () { return [
41871
41963
  { type: TransactionService },
41872
41964
  { type: TransactionEventService },
41965
+ { type: TransactionConnectorService },
41873
41966
  { type: IconCacheService }
41874
41967
  ]; };
41875
41968
  TransactionTagsComponent.propDecorators = {