@colijnit/transaction 256.1.37 → 256.1.39

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 +269 -57
  2. package/bundles/colijnit-transaction.umd.js.map +1 -1
  3. package/colijnit-transaction-256.1.39.tgz +0 -0
  4. package/colijnit-transaction.metadata.json +1 -1
  5. package/esm2015/lib/component/transaction-button-bar/transaction-button-bar.component.js +35 -26
  6. package/esm2015/lib/component/transaction-header-fields/transaction-header-remaining-amount.component.js +27 -8
  7. package/esm2015/lib/component/transaction-internal/transaction-internal.component.js +1 -6
  8. package/esm2015/lib/component/transaction-line/transaction-invoice-line/transaction-invoice-line-base.component.js +13 -6
  9. package/esm2015/lib/component/transaction-line/transaction-order-delivery-line/transaction-order-delivery-line-base.component.js +13 -6
  10. package/esm2015/lib/component/transaction-quick-access/transaction-quick-access-overview/transaction-quick-access-overview.component.js +6 -2
  11. package/esm2015/lib/component/transaction-quick-access/transaction-quick-access-send-method-base.component.js +24 -1
  12. package/esm2015/lib/enum/transaction-cfg-name.enum.js +3 -1
  13. package/esm2015/lib/service/transaction-connector-adapter.service.js +13 -1
  14. package/esm2015/lib/service/transaction-connector.service.js +6 -1
  15. package/esm2015/lib/service/transaction.service.js +6 -1
  16. package/esm2015/lib/transaction-version.js +3 -3
  17. package/fesm2015/colijnit-transaction.js +135 -50
  18. package/fesm2015/colijnit-transaction.js.map +1 -1
  19. package/lib/component/transaction-button-bar/transaction-button-bar.component.d.ts +4 -3
  20. package/lib/component/transaction-header-fields/transaction-header-remaining-amount.component.d.ts +4 -1
  21. package/lib/component/transaction-line/transaction-invoice-line/transaction-invoice-line-base.component.d.ts +1 -0
  22. package/lib/component/transaction-line/transaction-order-delivery-line/transaction-order-delivery-line-base.component.d.ts +1 -0
  23. package/lib/component/transaction-quick-access/transaction-quick-access-send-method-base.component.d.ts +8 -1
  24. package/lib/enum/transaction-cfg-name.enum.d.ts +3 -1
  25. package/lib/service/transaction-connector-adapter.service.d.ts +1 -0
  26. package/lib/service/transaction-connector.service.d.ts +1 -0
  27. package/lib/service/transaction.service.d.ts +1 -0
  28. package/package.json +1 -1
@@ -33,8 +33,8 @@
33
33
  function Version() {
34
34
  this.name = "@colijnit/transaction";
35
35
  this.description = "Colijn IT transaction package";
36
- this.symVer = "256.1.37";
37
- this.publishDate = "3-1-2025 18:06:32";
36
+ this.symVer = "256.1.39";
37
+ this.publishDate = "7-1-2025 10:00:50";
38
38
  }
39
39
  return Version;
40
40
  }());
@@ -53,7 +53,7 @@
53
53
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
54
54
  PERFORMANCE OF THIS SOFTWARE.
55
55
  ***************************************************************************** */
56
- /* global Reflect, Promise */
56
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
57
57
  var extendStatics = function (d, b) {
58
58
  extendStatics = Object.setPrototypeOf ||
59
59
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -189,8 +189,8 @@
189
189
  }
190
190
  function __generator(thisArg, body) {
191
191
  var _ = { label: 0, sent: function () { if (t[0] & 1)
192
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
193
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
192
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
193
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
194
194
  function verb(n) { return function (v) { return step([n, v]); }; }
195
195
  function step(op) {
196
196
  if (f)
@@ -345,9 +345,13 @@
345
345
  if (!Symbol.asyncIterator)
346
346
  throw new TypeError("Symbol.asyncIterator is not defined.");
347
347
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
348
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
349
- function verb(n) { if (g[n])
350
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
348
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
349
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
350
+ function verb(n, f) { if (g[n]) {
351
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
352
+ if (f)
353
+ i[n] = f(i[n]);
354
+ } }
351
355
  function resume(n, v) { try {
352
356
  step(g[n](v));
353
357
  }
@@ -388,14 +392,24 @@
388
392
  }) : function (o, v) {
389
393
  o["default"] = v;
390
394
  };
395
+ var ownKeys = function (o) {
396
+ ownKeys = Object.getOwnPropertyNames || function (o) {
397
+ var ar = [];
398
+ for (var k in o)
399
+ if (Object.prototype.hasOwnProperty.call(o, k))
400
+ ar[ar.length] = k;
401
+ return ar;
402
+ };
403
+ return ownKeys(o);
404
+ };
391
405
  function __importStar(mod) {
392
406
  if (mod && mod.__esModule)
393
407
  return mod;
394
408
  var result = {};
395
409
  if (mod != null)
396
- for (var k in mod)
397
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
398
- __createBinding(result, mod, k);
410
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
411
+ if (k[i] !== "default")
412
+ __createBinding(result, mod, k[i]);
399
413
  __setModuleDefault(result, mod);
400
414
  return result;
401
415
  }
@@ -423,12 +437,91 @@
423
437
  throw new TypeError("Cannot use 'in' operator on non-object");
424
438
  return typeof state === "function" ? receiver === state : state.has(receiver);
425
439
  }
440
+ function __addDisposableResource(env, value, async) {
441
+ if (value !== null && value !== void 0) {
442
+ if (typeof value !== "object" && typeof value !== "function")
443
+ throw new TypeError("Object expected.");
444
+ var dispose, inner;
445
+ if (async) {
446
+ if (!Symbol.asyncDispose)
447
+ throw new TypeError("Symbol.asyncDispose is not defined.");
448
+ dispose = value[Symbol.asyncDispose];
449
+ }
450
+ if (dispose === void 0) {
451
+ if (!Symbol.dispose)
452
+ throw new TypeError("Symbol.dispose is not defined.");
453
+ dispose = value[Symbol.dispose];
454
+ if (async)
455
+ inner = dispose;
456
+ }
457
+ if (typeof dispose !== "function")
458
+ throw new TypeError("Object not disposable.");
459
+ if (inner)
460
+ dispose = function () { try {
461
+ inner.call(this);
462
+ }
463
+ catch (e) {
464
+ return Promise.reject(e);
465
+ } };
466
+ env.stack.push({ value: value, dispose: dispose, async: async });
467
+ }
468
+ else if (async) {
469
+ env.stack.push({ async: true });
470
+ }
471
+ return value;
472
+ }
473
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
474
+ var e = new Error(message);
475
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
476
+ };
477
+ function __disposeResources(env) {
478
+ function fail(e) {
479
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
480
+ env.hasError = true;
481
+ }
482
+ var r, s = 0;
483
+ function next() {
484
+ while (r = env.stack.pop()) {
485
+ try {
486
+ if (!r.async && s === 1)
487
+ return s = 0, env.stack.push(r), Promise.resolve().then(next);
488
+ if (r.dispose) {
489
+ var result = r.dispose.call(r.value);
490
+ if (r.async)
491
+ return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
492
+ }
493
+ else
494
+ s |= 1;
495
+ }
496
+ catch (e) {
497
+ fail(e);
498
+ }
499
+ }
500
+ if (s === 1)
501
+ return env.hasError ? Promise.reject(env.error) : Promise.resolve();
502
+ if (env.hasError)
503
+ throw env.error;
504
+ }
505
+ return next();
506
+ }
507
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
508
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
509
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
510
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
511
+ });
512
+ }
513
+ return path;
514
+ }
426
515
  var tslib_es6 = {
427
516
  __extends: __extends,
428
517
  __assign: __assign,
429
518
  __rest: __rest,
430
519
  __decorate: __decorate,
431
520
  __param: __param,
521
+ __esDecorate: __esDecorate,
522
+ __runInitializers: __runInitializers,
523
+ __propKey: __propKey,
524
+ __setFunctionName: __setFunctionName,
432
525
  __metadata: __metadata,
433
526
  __awaiter: __awaiter,
434
527
  __generator: __generator,
@@ -449,6 +542,9 @@
449
542
  __classPrivateFieldGet: __classPrivateFieldGet,
450
543
  __classPrivateFieldSet: __classPrivateFieldSet,
451
544
  __classPrivateFieldIn: __classPrivateFieldIn,
545
+ __addDisposableResource: __addDisposableResource,
546
+ __disposeResources: __disposeResources,
547
+ __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
452
548
  };
453
549
 
454
550
  var AppPopupButtonType;
@@ -9447,6 +9543,26 @@
9447
9543
  }
9448
9544
  }, 500);
9449
9545
  };
9546
+ TransactionConnectorAdapterService.prototype.getTermsAndConditionsForm = function (transId) {
9547
+ return __awaiter(this, void 0, void 0, function () {
9548
+ var response;
9549
+ return __generator(this, function (_a) {
9550
+ switch (_a.label) {
9551
+ case 0: return [4 /*yield*/, this.connector.getTermsAndConditionsForm(transId, true)];
9552
+ case 1:
9553
+ response = _a.sent();
9554
+ if (response && response.validationResult && response.validationResult.success) {
9555
+ return [2 /*return*/, response.resultObject];
9556
+ }
9557
+ else {
9558
+ this._handleExceptionFromResponse(response);
9559
+ return [2 /*return*/, null];
9560
+ }
9561
+ return [2 /*return*/];
9562
+ }
9563
+ });
9564
+ });
9565
+ };
9450
9566
  TransactionConnectorAdapterService.prototype._openPdfContent = function (content) {
9451
9567
  if (content) {
9452
9568
  try {
@@ -11770,6 +11886,13 @@
11770
11886
  });
11771
11887
  });
11772
11888
  };
11889
+ TransactionConnectorService.prototype.getTermsAndConditionsForm = function (transId) {
11890
+ return __awaiter(this, void 0, void 0, function () {
11891
+ return __generator(this, function (_a) {
11892
+ return [2 /*return*/, this._adapterService.getTermsAndConditionsForm(transId)];
11893
+ });
11894
+ });
11895
+ };
11773
11896
  return TransactionConnectorService;
11774
11897
  }());
11775
11898
  TransactionConnectorService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TransactionConnectorService_Factory() { return new TransactionConnectorService(i0__namespace.ɵɵinject(TransactionConnectorAdapterService), i0__namespace.ɵɵinject(TransactionSelectSingleCacheService), i0__namespace.ɵɵinject(TransactionSelectMultipleCacheService), i0__namespace.ɵɵinject(TransactionSelectMultipleParameterizedCacheService), i0__namespace.ɵɵinject(TransactionSelectSingleParameterizedCacheService)); }, token: TransactionConnectorService, providedIn: "root" });
@@ -12040,6 +12163,8 @@
12040
12163
  TransactionCfgName["HeaderProductDetails"] = "headerProductDetails";
12041
12164
  TransactionCfgName["HeaderOrderDetails"] = "headerOrderDetails";
12042
12165
  TransactionCfgName["HeaderPurchaseDetails"] = "headerPurchaseDetails";
12166
+ TransactionCfgName["IsDocSignEnabled"] = "isDocSignEnabled";
12167
+ TransactionCfgName["IsAdditionalDocEnabled"] = "isAdditionalDocEnabled";
12043
12168
  })(exports.TransactionCfgName || (exports.TransactionCfgName = {}));
12044
12169
 
12045
12170
  var TransactionScreenConfigurationService = /** @class */ (function (_super) {
@@ -19208,6 +19333,16 @@
19208
19333
  });
19209
19334
  });
19210
19335
  };
19336
+ TransactionService.prototype.getTermsAndConditionsForm = function (transId) {
19337
+ return __awaiter(this, void 0, void 0, function () {
19338
+ return __generator(this, function (_a) {
19339
+ switch (_a.label) {
19340
+ case 0: return [4 /*yield*/, this.connector.getTermsAndConditionsForm(transId)];
19341
+ case 1: return [2 /*return*/, _a.sent()];
19342
+ }
19343
+ });
19344
+ });
19345
+ };
19211
19346
  TransactionService.prototype._handleBeforeRememberCurrentTransaction = function (transactionInfoResponse) {
19212
19347
  return __awaiter(this, void 0, void 0, function () {
19213
19348
  return __generator(this, function (_a) {
@@ -24061,6 +24196,8 @@
24061
24196
  _this.showSendMethodDialog = false;
24062
24197
  _this.sendMethods = i10.sendMethodsWithIcon;
24063
24198
  _this.historicReports = [];
24199
+ _this.additionalFileContents = '';
24200
+ _this.additionalFileName = '';
24064
24201
  return _this;
24065
24202
  }
24066
24203
  TransactionQuickAccessSendMethodBaseComponent.prototype.ngOnInit = function () {
@@ -24069,6 +24206,11 @@
24069
24206
  this._getDefaultSendMethod();
24070
24207
  this._getEmailLayouts();
24071
24208
  this._getPrintLayouts();
24209
+ this.isDocSignEnabled = this.screenConfigService.getObjectConfigurationFor(this.cfgNames.IsDocSignEnabled).immediatelyVisible();
24210
+ this.isAdditionalDocEnabled = this.screenConfigService.getObjectConfigurationFor(this.cfgNames.IsAdditionalDocEnabled).immediatelyVisible();
24211
+ if (this.isAdditionalDocEnabled) {
24212
+ this._getTermsAndConditionsForm();
24213
+ }
24072
24214
  };
24073
24215
  TransactionQuickAccessSendMethodBaseComponent.prototype.transactionSet = function () {
24074
24216
  this.reportDocumentEmailRequest.transId = this.transactionInfo.id;
@@ -24170,6 +24312,26 @@
24170
24312
  TransactionQuickAccessSendMethodBaseComponent.prototype.commitAndRefreshTransaction = function () {
24171
24313
  this.transactionService.commitAndRefreshTransaction();
24172
24314
  };
24315
+ TransactionQuickAccessSendMethodBaseComponent.prototype.upsertDocument = function (doc) {
24316
+ return __awaiter(this, void 0, void 0, function () {
24317
+ var response;
24318
+ return __generator(this, function (_a) {
24319
+ switch (_a.label) {
24320
+ case 0: return [4 /*yield*/, this.transactionService.mergeDocumentOnTransaction(this.transactionInfo.id.toString(), doc)];
24321
+ case 1:
24322
+ response = _a.sent();
24323
+ if (!response) return [3 /*break*/, 3];
24324
+ this.showSendMethodDialog = false;
24325
+ return [4 /*yield*/, this.dialogService.showToast('DATA_SAVED', true)];
24326
+ case 2:
24327
+ _a.sent();
24328
+ this.dialogService.hideToastAfterMs(2000);
24329
+ _a.label = 3;
24330
+ case 3: return [2 /*return*/];
24331
+ }
24332
+ });
24333
+ });
24334
+ };
24173
24335
  TransactionQuickAccessSendMethodBaseComponent.prototype._getPrinters = function () {
24174
24336
  var _this = this;
24175
24337
  this.transactionService.getPrinters().then(function (printerList) {
@@ -24221,6 +24383,13 @@
24221
24383
  }
24222
24384
  });
24223
24385
  };
24386
+ TransactionQuickAccessSendMethodBaseComponent.prototype._getTermsAndConditionsForm = function () {
24387
+ var _this = this;
24388
+ this.transactionService.getTermsAndConditionsForm(this.transactionInfo.id).then(function (result) {
24389
+ _this.additionalFileContents = result;
24390
+ _this.additionalFileName = _this.transactionInfo.transactionKind + '_' + _this.transactionInfo.transactionNr.toString();
24391
+ });
24392
+ };
24224
24393
  return TransactionQuickAccessSendMethodBaseComponent;
24225
24394
  }(TransactionHeaderBaseComponent));
24226
24395
  TransactionQuickAccessSendMethodBaseComponent.decorators = [
@@ -24597,7 +24766,7 @@
24597
24766
  TransactionQuickAccessOverviewComponent.decorators = [
24598
24767
  { type: i0.Component, args: [{
24599
24768
  selector: "co-transaction-quick-access-overview",
24600
- template: "\n <co-quick-send-button\n [defaultMethodIcon]=\"defaultSendMethodIcon\"\n [showLoader]=\"showLoader\"\n (sendIconClicked)=\"handleSend(defaultSendMethod)\"\n (openSendMethodDialog)=\"showSendMethodDialog = true\"\n ></co-quick-send-button>\n <co-transaction-send-documents\n [historicReports]=\"historicReports\"\n [transactionTypeCategory]=\"transactionTypeCategory.SalesOrderOverview\"\n ></co-transaction-send-documents>\n <co-send-method-dialog *ngIf=\"showSendMethodDialog\"\n [headerTitle]=\"'Verzendmethode'\"\n [printerList]=\"printerList\"\n [defaultSendMethod]=\"defaultSendMethod\"\n [visibleMethods]=\"[sendMethodType.Print, sendMethodType.Email, sendMethodType.Pdf]\"\n [emailAddresses]=\"emailAddresses\"\n [emailLayouts]=\"emailLayouts\"\n [printLayouts]=\"printLayouts\"\n [isDocSignEnabled]=\"true\"\n [(reportingDocumentEmailRequest)]=\"reportDocumentEmailRequest\"\n [(reportingDocumentPrintRequest)]=\"reportDocumentPrintRequest\"\n [(reportingDocumentPdfRequest)]=\"reportDocumentPdfRequest\"\n (closeClick)=\"showSendMethodDialog = false\"\n (okClick)=\"handleSendMethodOkClick($event)\"\n ></co-send-method-dialog>\n <co-digital-signature\n [documentId]=\"signatureDocumentId\"\n (documentStored)=\"commitAndRefreshTransaction()\"\n ></co-digital-signature>\n ",
24769
+ template: "\n <co-quick-send-button\n [defaultMethodIcon]=\"defaultSendMethodIcon\"\n [showLoader]=\"showLoader\"\n (sendIconClicked)=\"handleSend(defaultSendMethod)\"\n (openSendMethodDialog)=\"showSendMethodDialog = true\"\n ></co-quick-send-button>\n <co-transaction-send-documents\n [historicReports]=\"historicReports\"\n [transactionTypeCategory]=\"transactionTypeCategory.SalesOrderOverview\"\n ></co-transaction-send-documents>\n <co-send-method-dialog *ngIf=\"showSendMethodDialog\"\n [headerTitle]=\"'Verzendmethode'\"\n [printerList]=\"printerList\"\n [defaultSendMethod]=\"defaultSendMethod\"\n [visibleMethods]=\"[sendMethodType.Print, sendMethodType.Email, sendMethodType.Pdf]\"\n [emailAddresses]=\"emailAddresses\"\n [emailLayouts]=\"emailLayouts\"\n [printLayouts]=\"printLayouts\"\n [isDocSignEnabled]=\"isDocSignEnabled\"\n [isAdditionalDocEnabled]=\"isAdditionalDocEnabled\"\n [additionalFileContents]=\"additionalFileContents\"\n [additionalFileName]=\"additionalFileName\"\n [(reportingDocumentEmailRequest)]=\"reportDocumentEmailRequest\"\n [(reportingDocumentPrintRequest)]=\"reportDocumentPrintRequest\"\n [(reportingDocumentPdfRequest)]=\"reportDocumentPdfRequest\"\n (additionalFileChangeEvent)=\"upsertDocument($event)\"\n (closeClick)=\"showSendMethodDialog = false\"\n (okClick)=\"handleSendMethodOkClick($event)\"\n ></co-send-method-dialog>\n <co-digital-signature\n [documentId]=\"signatureDocumentId\"\n (documentStored)=\"commitAndRefreshTransaction()\"\n ></co-digital-signature>\n ",
24601
24770
  encapsulation: i0.ViewEncapsulation.None
24602
24771
  },] }
24603
24772
  ];
@@ -24942,6 +25111,7 @@
24942
25111
  function TransactionOrderDeliveryLineBaseComponent() {
24943
25112
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
24944
25113
  _this._subscriptions = [];
25114
+ _this._initialized = false;
24945
25115
  _this.showCheckbox = false;
24946
25116
  _this.checkboxReadonly = false;
24947
25117
  _this.localAmountSelected = 0;
@@ -24959,6 +25129,7 @@
24959
25129
  }
24960
25130
  _this.detectChanges();
24961
25131
  }));
25132
+ this._initialized = true;
24962
25133
  this._checkCheckbox();
24963
25134
  this._checkAmounts();
24964
25135
  };
@@ -25021,7 +25192,7 @@
25021
25192
  this._checkAmounts();
25022
25193
  };
25023
25194
  TransactionOrderDeliveryLineBaseComponent.prototype._checkCheckbox = function () {
25024
- if (this.transactionInfo && this.transactionLine) {
25195
+ if (this._initialized && this.transactionInfo && this.transactionLine) {
25025
25196
  if (this.transactionInfo.allowPartialDelivery) {
25026
25197
  this.showCheckbox = this.lineQuantityToDeliver !== 0 && !this.lineIsDelivered;
25027
25198
  this.checkboxReadonly = !this.showCheckbox;
@@ -25029,15 +25200,20 @@
25029
25200
  }
25030
25201
  else {
25031
25202
  this.showCheckbox = this.canAllLinesBeDelivered && !this.lineIsDelivered;
25032
- this.selected = true;
25033
- this.checkboxReadonly = true;
25034
- this.transactionEventService.lineSelectedForDelivery.next({ lineUuid: this.transactionLine.uuid, selected: this.transactionLine.selected });
25203
+ if (this.showCheckbox) {
25204
+ this.selected = true;
25205
+ this.checkboxReadonly = true;
25206
+ this.transactionEventService.lineSelectedForDelivery.next({
25207
+ lineUuid: this.transactionLine.uuid,
25208
+ selected: this.transactionLine.selected
25209
+ });
25210
+ }
25035
25211
  }
25036
25212
  this.detectChanges();
25037
25213
  }
25038
25214
  };
25039
25215
  TransactionOrderDeliveryLineBaseComponent.prototype._checkAmounts = function () {
25040
- if (this.transactionInfo && this.transactionLine) {
25216
+ if (this._initialized && this.transactionInfo && this.transactionLine) {
25041
25217
  if (this.transactionInfo.allowPartialDelivery) {
25042
25218
  this.localAmountSelected = this.transactionLine.selected ? this.transactionLine.amountSelected : this.transactionLineService.lineQuantityToDeliver;
25043
25219
  }
@@ -26870,6 +27046,7 @@
26870
27046
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
26871
27047
  _this.category = TransactionTypeCategory;
26872
27048
  _this._subscriptions = [];
27049
+ _this._initialized = false;
26873
27050
  _this.showCheckbox = false;
26874
27051
  _this.checkboxReadonly = false;
26875
27052
  _this.localAmountSelected = 0;
@@ -26887,6 +27064,7 @@
26887
27064
  }
26888
27065
  _this.detectChanges();
26889
27066
  }));
27067
+ this._initialized = true;
26890
27068
  this._checkCheckbox();
26891
27069
  this._checkAmounts();
26892
27070
  };
@@ -26941,7 +27119,7 @@
26941
27119
  });
26942
27120
  };
26943
27121
  TransactionInvoiceLineBaseComponent.prototype._checkCheckbox = function () {
26944
- if (this.transactionInfo && this.transactionLine) {
27122
+ if (this._initialized && this.transactionInfo && this.transactionLine) {
26945
27123
  if (this.transactionInfo.allowPartialDelivery) {
26946
27124
  this.showCheckbox = (this.lineQuantityToInvoice !== 0 && !this.lineIsInvoiced);
26947
27125
  this.checkboxReadonly = !this.showCheckbox;
@@ -26949,15 +27127,20 @@
26949
27127
  }
26950
27128
  else {
26951
27129
  this.showCheckbox = this.canAllLinesBeInvoiced && !this.lineIsInvoiced;
26952
- this.selected = true;
26953
- this.checkboxReadonly = true;
26954
- this.transactionEventService.lineSelectedForInvoice.next({ lineUuid: this.transactionLine.uuid, selected: this.transactionLine.selected });
27130
+ if (this.showCheckbox) {
27131
+ this.selected = true;
27132
+ this.checkboxReadonly = true;
27133
+ this.transactionEventService.lineSelectedForInvoice.next({
27134
+ lineUuid: this.transactionLine.uuid,
27135
+ selected: this.transactionLine.selected
27136
+ });
27137
+ }
26955
27138
  }
26956
27139
  this.detectChanges();
26957
27140
  }
26958
27141
  };
26959
27142
  TransactionInvoiceLineBaseComponent.prototype._checkAmounts = function () {
26960
- if (this.transactionInfo && this.transactionLine) {
27143
+ if (this._initialized && this.transactionInfo && this.transactionLine) {
26961
27144
  if (this.transactionInfo.allowPartialDelivery) {
26962
27145
  this.localAmountSelected = this.transactionLine.selected ? this.transactionLine.amountSelected : this.transactionLineService.lineQuantityToInvoice;
26963
27146
  }
@@ -36431,9 +36614,10 @@
36431
36614
  ];
36432
36615
 
36433
36616
  var TransactionButtonBarComponent = /** @class */ (function () {
36434
- function TransactionButtonBarComponent(iconCacheService, transactionService, _transactionService, _mappingService, _changeDetector) {
36617
+ function TransactionButtonBarComponent(iconCacheService, transactionService, _transactionHeaderService, _transactionService, _mappingService, _changeDetector) {
36435
36618
  this.iconCacheService = iconCacheService;
36436
36619
  this.transactionService = transactionService;
36620
+ this._transactionHeaderService = _transactionHeaderService;
36437
36621
  this._transactionService = _transactionService;
36438
36622
  this._mappingService = _mappingService;
36439
36623
  this._changeDetector = _changeDetector;
@@ -36448,7 +36632,6 @@
36448
36632
  this.categories = TransactionTypeCategory;
36449
36633
  this.icons = Icon;
36450
36634
  this.transactionBarDirection = TransactionBarDirection.Vertical;
36451
- this.TransactionTypeCategory = TransactionTypeCategory;
36452
36635
  this.sidePanel = false;
36453
36636
  this.direction = TransactionBarDirection.Horizontal;
36454
36637
  this.buttonClicked = new i0.EventEmitter();
@@ -36512,20 +36695,35 @@
36512
36695
  this._subs.forEach(function (s) { return s.unsubscribe(); });
36513
36696
  };
36514
36697
  TransactionButtonBarComponent.prototype.selectCategory = function (idx) {
36515
- var _this = this;
36516
- if (idx > -1) {
36517
- var buttonRubric = this.buttons[idx].category;
36518
- this._transactionService.activeRubric = buttonRubric;
36519
- }
36520
- else {
36521
- idx = this.buttons.findIndex(function (b) { return b.category === _this._transactionService.activeRubric; });
36522
- }
36523
- this._selectedCategory = this.buttons[Math.max(idx, 0)].category;
36524
- this.buttonClicked.next(this.buttons[Math.max(idx, 0)]);
36525
- if (this._selectedCategory === TransactionTypeCategory.SalesOrderDeliveryNote || this._selectedCategory === TransactionTypeCategory.SalesOrderInvoice) {
36526
- this.transactionService.remainingAmount = 0;
36527
- }
36528
- this._detectChanges();
36698
+ return __awaiter(this, void 0, void 0, function () {
36699
+ var buttonRubric;
36700
+ var _this = this;
36701
+ return __generator(this, function (_a) {
36702
+ switch (_a.label) {
36703
+ case 0:
36704
+ if (idx > -1) {
36705
+ buttonRubric = this.buttons[idx].category;
36706
+ this._transactionService.activeRubric = buttonRubric;
36707
+ }
36708
+ else {
36709
+ idx = this.buttons.findIndex(function (b) { return b.category === _this._transactionService.activeRubric; });
36710
+ }
36711
+ this._selectedCategory = this.buttons[Math.max(idx, 0)].category;
36712
+ if (!((this._selectedCategory === this.categories.SalesOrderDeliveryNote || this._selectedCategory === this.categories.SalesOrderInvoice) && this._transactionHeaderService.transactionInfo)) return [3 /*break*/, 2];
36713
+ return [4 /*yield*/, this._transactionService.updateQuantitySelectNone(this._transactionHeaderService.transactionInfo.uuid, false, true)];
36714
+ case 1:
36715
+ _a.sent();
36716
+ _a.label = 2;
36717
+ case 2:
36718
+ this.buttonClicked.next(this.buttons[Math.max(idx, 0)]);
36719
+ if (this._selectedCategory === TransactionTypeCategory.SalesOrderDeliveryNote || this._selectedCategory === TransactionTypeCategory.SalesOrderInvoice) {
36720
+ this.transactionService.remainingAmount = 0;
36721
+ }
36722
+ this._detectChanges();
36723
+ return [2 /*return*/];
36724
+ }
36725
+ });
36726
+ });
36529
36727
  };
36530
36728
  TransactionButtonBarComponent.prototype.handleButtonClicked = function (modifiedButton) {
36531
36729
  this.selectedCategory = modifiedButton.category;
@@ -36544,7 +36742,7 @@
36544
36742
  TransactionButtonBarComponent.decorators = [
36545
36743
  { type: i0.Component, args: [{
36546
36744
  selector: "co-transaction-button-bar",
36547
- template: "\n <div class=\"button-bar-wrapper\" [class.vertical]=\"direction === transactionBarDirection\">\n <co-transaction-button-bar-button *ngFor=\"let button of buttons; let index = index; trackBy: trackButton\"\n [screenConfigurationObject]=\"button.cfgName\"\n [transactionInfoResponse]=\"transactionInfoResponse\"\n [component]=\"button.component\"\n [hideButtonLoader]=\"hideButtonLoader\"\n [class.hide]=\"direction === transactionBarDirection && button.category !== TransactionTypeCategory.SalesOrderDeliveryNote\"\n [class.selected]=\"selectedCategory === button.category\"\n [title]=\"button.title\"\n [iconName]=\"button.icon\"\n (buttonClicked)=\"handleButtonClicked($event)\"\n (click)=\"selectCategory(index)\"\n ></co-transaction-button-bar-button>\n </div>\n ",
36745
+ template: "\n <div class=\"button-bar-wrapper\" [class.vertical]=\"direction === transactionBarDirection\">\n <co-transaction-button-bar-button *ngFor=\"let button of buttons; let index = index; trackBy: trackButton\"\n [screenConfigurationObject]=\"button.cfgName\"\n [transactionInfoResponse]=\"transactionInfoResponse\"\n [component]=\"button.component\"\n [hideButtonLoader]=\"hideButtonLoader\"\n [class.hide]=\"direction === transactionBarDirection && button.category !== categories.SalesOrderDeliveryNote\"\n [class.selected]=\"selectedCategory === button.category\"\n [title]=\"button.title\"\n [iconName]=\"button.icon\"\n (buttonClicked)=\"handleButtonClicked($event)\"\n (click)=\"selectCategory(index)\"\n ></co-transaction-button-bar-button>\n </div>\n ",
36548
36746
  encapsulation: i0.ViewEncapsulation.None,
36549
36747
  changeDetection: i0.ChangeDetectionStrategy.Default
36550
36748
  },] }
@@ -36552,6 +36750,7 @@
36552
36750
  TransactionButtonBarComponent.ctorParameters = function () { return [
36553
36751
  { type: IconCacheService },
36554
36752
  { type: TransactionService },
36753
+ { type: TransactionHeaderService },
36555
36754
  { type: TransactionService },
36556
36755
  { type: TransactionMappingService },
36557
36756
  { type: i0.ChangeDetectorRef }
@@ -53235,17 +53434,8 @@
53235
53434
  TransactionInternalComponent.prototype.handleButtonBarButtonClicked = function (button) {
53236
53435
  return __awaiter(this, void 0, void 0, function () {
53237
53436
  return __generator(this, function (_b) {
53238
- switch (_b.label) {
53239
- case 0:
53240
- if (!(this.activeCategory !== button.category && this.transaction)) return [3 /*break*/, 2];
53241
- return [4 /*yield*/, this.service.updateQuantitySelectNone(this.transaction.transactionInfo.uuid, false, false)];
53242
- case 1:
53243
- _b.sent();
53244
- _b.label = 2;
53245
- case 2:
53246
- this.activeCategory = button.category;
53247
- return [2 /*return*/];
53248
- }
53437
+ this.activeCategory = button.category;
53438
+ return [2 /*return*/];
53249
53439
  });
53250
53440
  });
53251
53441
  };
@@ -53900,8 +54090,9 @@
53900
54090
  };
53901
54091
 
53902
54092
  var TransactionHeaderRemainingAmountComponent = /** @class */ (function () {
53903
- function TransactionHeaderRemainingAmountComponent(transactionService, _transactionEventService, _paymentConnectorService) {
54093
+ function TransactionHeaderRemainingAmountComponent(transactionService, _transactionHeaderService, _transactionEventService, _paymentConnectorService) {
53904
54094
  this.transactionService = transactionService;
54095
+ this._transactionHeaderService = _transactionHeaderService;
53905
54096
  this._transactionEventService = _transactionEventService;
53906
54097
  this._paymentConnectorService = _paymentConnectorService;
53907
54098
  this.remainingAmountChange = new i0.EventEmitter();
@@ -53912,18 +54103,38 @@
53912
54103
  var _this = this;
53913
54104
  this._subs.push(this._transactionEventService.quantitySelectedLineChanged.subscribe(function (changed) {
53914
54105
  if (changed && !_this.transactionService.manualSaveParam) {
53915
- var request = new calculateAmountToPayRequest.CalculateAmountToPayRequest();
53916
- request.transactionUuid = _this.transactionUuid;
53917
- _this._paymentConnectorService.calculateAmountToPayWithLineSelection(request).then(function (data) {
53918
- _this.transactionService.remainingAmount = data ? data.amountToPay : 0;
53919
- _this.remainingAmountChange.next(data ? data.amountToPay : 0);
53920
- });
54106
+ _this._recalculatePayment();
53921
54107
  }
54108
+ }), this._transactionEventService.transactionPaymentDone.subscribe(function () {
54109
+ _this._recalculatePayment();
53922
54110
  }));
53923
54111
  };
53924
54112
  TransactionHeaderRemainingAmountComponent.prototype.ngOnDestroy = function () {
53925
54113
  this._subs.forEach(function (s) { return s.unsubscribe(); });
53926
54114
  };
54115
+ TransactionHeaderRemainingAmountComponent.prototype._recalculatePayment = function () {
54116
+ return __awaiter(this, void 0, void 0, function () {
54117
+ var request;
54118
+ var _this = this;
54119
+ return __generator(this, function (_a) {
54120
+ request = new calculateAmountToPayRequest.CalculateAmountToPayRequest();
54121
+ request.transactionUuid = this.transactionUuid;
54122
+ if (this._transactionHeaderService.transactionInfo.allowPartialDelivery) {
54123
+ this._paymentConnectorService.calculateAmountToPayWithLineSelection(request).then(function (data) {
54124
+ _this.transactionService.remainingAmount = data ? data.amountToPay : 0;
54125
+ _this.remainingAmountChange.next(data ? data.amountToPay : 0);
54126
+ });
54127
+ }
54128
+ else {
54129
+ this._paymentConnectorService.calculateAmountToPay(request).then(function (data) {
54130
+ _this.transactionService.remainingAmount = data ? data.amountToPay : 0;
54131
+ _this.remainingAmountChange.next(data ? data.amountToPay : 0);
54132
+ });
54133
+ }
54134
+ return [2 /*return*/];
54135
+ });
54136
+ });
54137
+ };
53927
54138
  return TransactionHeaderRemainingAmountComponent;
53928
54139
  }());
53929
54140
  TransactionHeaderRemainingAmountComponent.decorators = [
@@ -53939,6 +54150,7 @@
53939
54150
  ];
53940
54151
  TransactionHeaderRemainingAmountComponent.ctorParameters = function () { return [
53941
54152
  { type: TransactionService },
54153
+ { type: TransactionHeaderService },
53942
54154
  { type: TransactionEventService },
53943
54155
  { type: TransactionPaymentConnectorService }
53944
54156
  ]; };