@colijnit/transaction 257.1.1 → 257.1.2

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 +261 -164
  2. package/bundles/colijnit-transaction.umd.js.map +1 -1
  3. package/colijnit-transaction.metadata.json +1 -1
  4. package/esm2015/lib/component/core/base/transaction-lines-base.component.js +41 -4
  5. package/esm2015/lib/component/purchase-confirmation-lines/purchase-confirmation-lines.component.js +10 -2
  6. package/esm2015/lib/component/transaction-line/transaction-purchase-order-line/transaction-purchase-order-line-base.component.js +2 -2
  7. package/esm2015/lib/component/transaction-line-purchase-confirmation/transaction-line-purchase-confirmation.component.js +37 -21
  8. package/esm2015/lib/component/transaction-line-side-panel/transaction-line-side-panel.component.js +16 -14
  9. package/esm2015/lib/component/transaction-line-side-panel-purchase/transaction-line-side-panel-purchase.component.js +4 -36
  10. package/esm2015/lib/component/transaction-lines/transaction-lines.component.js +8 -37
  11. package/esm2015/lib/component/transaction-lines-popup/transaction-lines-popup.component.js +15 -10
  12. package/esm2015/lib/model/transaction-line-view-model.js +7 -0
  13. package/esm2015/lib/service/line-selection.service.js +18 -3
  14. package/esm2015/lib/service/purchase-confirmation.service.js +48 -1
  15. package/esm2015/lib/transaction-version.js +3 -3
  16. package/fesm2015/colijnit-transaction.js +235 -162
  17. package/fesm2015/colijnit-transaction.js.map +1 -1
  18. package/lib/component/core/base/transaction-lines-base.component.d.ts +23 -2
  19. package/lib/component/transaction-line-purchase-confirmation/transaction-line-purchase-confirmation.component.d.ts +16 -9
  20. package/lib/component/transaction-line-side-panel/transaction-line-side-panel.component.d.ts +5 -4
  21. package/lib/component/transaction-line-side-panel-purchase/transaction-line-side-panel-purchase.component.d.ts +0 -19
  22. package/lib/component/transaction-lines/transaction-lines.component.d.ts +1 -19
  23. package/lib/component/transaction-lines-popup/style/_layout.scss +4 -0
  24. package/lib/component/transaction-lines-popup/transaction-lines-popup.component.d.ts +3 -1
  25. package/lib/model/transaction-line-view-model.d.ts +7 -0
  26. package/lib/service/line-selection.service.d.ts +6 -0
  27. package/lib/service/purchase-confirmation.service.d.ts +14 -4
  28. package/package.json +1 -1
@@ -283,8 +283,8 @@ class Version {
283
283
  constructor() {
284
284
  this.name = "@colijnit/transaction";
285
285
  this.description = "Colijn IT transaction package";
286
- this.symVer = "257.1.1";
287
- this.publishDate = "15-1-2025 17:49:15";
286
+ this.symVer = "257.1.2";
287
+ this.publishDate = "16-1-2025 18:39:46";
288
288
  }
289
289
  }
290
290
 
@@ -18422,6 +18422,13 @@ class ColorUtils {
18422
18422
  }
18423
18423
  }
18424
18424
 
18425
+ class TransactionLineViewModel {
18426
+ constructor(l) {
18427
+ this.showColor = false;
18428
+ this.line = l;
18429
+ }
18430
+ }
18431
+
18425
18432
  class PurchaseConfirmationService {
18426
18433
  constructor(_transactionConnectorService, _transactionEventService) {
18427
18434
  this._transactionConnectorService = _transactionConnectorService;
@@ -18431,6 +18438,19 @@ class PurchaseConfirmationService {
18431
18438
  this.confirmationAnalysisResult = [];
18432
18439
  this.ordersTotal = new BehaviorSubject(0);
18433
18440
  this.ordersTotalObservable = this.ordersTotal.asObservable();
18441
+ this.transactionLinesViewModels = [];
18442
+ this._transactionLines = [];
18443
+ this._subs = [];
18444
+ this._subs.push(this._transactionEventService.orderConfirmationDropped.subscribe((data) => {
18445
+ this._updateViewModels(data);
18446
+ }));
18447
+ }
18448
+ set transactionLines(value) {
18449
+ this._transactionLines = value;
18450
+ this._prepareViewModels();
18451
+ }
18452
+ get transactionLines() {
18453
+ return this._transactionLines;
18434
18454
  }
18435
18455
  set confirmationAnalysisId(value) {
18436
18456
  this._confirmationAnalysisId = value;
@@ -18442,6 +18462,9 @@ class PurchaseConfirmationService {
18442
18462
  setOrdersTotal(value) {
18443
18463
  this.ordersTotal.next(value);
18444
18464
  }
18465
+ ngOnDestroy() {
18466
+ this._subs.forEach(s => s.unsubscribe());
18467
+ }
18445
18468
  reset() {
18446
18469
  this.confirmationAnalysisId = undefined;
18447
18470
  this._transactionEventService.orderConfirmationDropped.next(undefined);
@@ -18497,6 +18520,36 @@ class PurchaseConfirmationService {
18497
18520
  }
18498
18521
  });
18499
18522
  }
18523
+ _updateViewModels(data) {
18524
+ if (data) {
18525
+ this.transactionLinesViewModels.forEach(vm => {
18526
+ if (vm.line && vm.line.lineNr === data.lineNr) {
18527
+ vm.line.linkedAnalysisResultId = data.analysisResultId;
18528
+ vm.showColor = true;
18529
+ vm.color = data.color;
18530
+ }
18531
+ else if (vm.line && vm.line.linkedAnalysisResultId === data.analysisResultId) {
18532
+ vm.line.linkedAnalysisResultId = undefined;
18533
+ vm.showColor = false;
18534
+ vm.color = "";
18535
+ }
18536
+ });
18537
+ }
18538
+ else {
18539
+ this.transactionLinesViewModels.forEach(vm => {
18540
+ vm.line.linkedAnalysisResultId = undefined;
18541
+ vm.showColor = false;
18542
+ vm.color = "";
18543
+ });
18544
+ }
18545
+ }
18546
+ _prepareViewModels() {
18547
+ this.transactionLinesViewModels.length = 0;
18548
+ this._transactionLines.forEach(t => {
18549
+ const viewModel = new TransactionLineViewModel(t);
18550
+ this.transactionLinesViewModels.push(viewModel);
18551
+ });
18552
+ }
18500
18553
  }
18501
18554
  PurchaseConfirmationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PurchaseConfirmationService_Factory() { return new PurchaseConfirmationService(i0.ɵɵinject(TransactionConnectorService), i0.ɵɵinject(TransactionEventService)); }, token: PurchaseConfirmationService, providedIn: "root" });
18502
18555
  PurchaseConfirmationService.decorators = [
@@ -21856,7 +21909,7 @@ class TransactionPurchaseOrderLineBaseComponent extends TransactionLineBaseCompo
21856
21909
  try {
21857
21910
  const droppedData = JSON.parse(event.dataTransfer.getData('orderconfirmationanalysis'));
21858
21911
  this._purchaseConfirmationService.linkAnalysisToTransactionLine(this.transactionLine, droppedData);
21859
- this.changeDetector.markForCheck();
21912
+ this.detectChanges();
21860
21913
  }
21861
21914
  catch (e) {
21862
21915
  }
@@ -33348,20 +33401,98 @@ TransactionTextLineModule.decorators = [
33348
33401
  },] }
33349
33402
  ];
33350
33403
 
33404
+ class LineSelectionService {
33405
+ constructor(_transactionEventService, _transactionService) {
33406
+ this._transactionEventService = _transactionEventService;
33407
+ this._transactionService = _transactionService;
33408
+ this.selectedTransactionLineChanged = new BehaviorSubject(undefined);
33409
+ this._subs = [];
33410
+ this._selectedLineUuidsForDelivery = [];
33411
+ this._selectedLineUuidsForInvoice = [];
33412
+ this._selectedTransactionLine = new TransactionLineInfo();
33413
+ this._subs.push(this._transactionEventService.transactionLineChanged.subscribe((line) => {
33414
+ if (this.selectedTransactionLine && line.lineNr === this.selectedTransactionLine.lineNr) {
33415
+ this.selectedTransactionLine = line;
33416
+ }
33417
+ }), this._transactionEventService.lineSelectedForDelivery.subscribe((data) => {
33418
+ if (this._checkAllLinesSelectedForDelivery(data)) {
33419
+ this._selectedLineUuidsForDelivery.length = 0;
33420
+ this._transactionEventService.allLinesSelectedForDelivery.next();
33421
+ }
33422
+ }), this._transactionEventService.lineSelectedForInvoice.subscribe((data) => {
33423
+ if (this._checkAllLinesSelectedForInvoice(data)) {
33424
+ this._selectedLineUuidsForInvoice.length = 0;
33425
+ this._transactionEventService.allLinesSelectedForInvoice.next();
33426
+ }
33427
+ }));
33428
+ }
33429
+ set selectedTransactionLine(value) {
33430
+ this._selectedTransactionLine = value;
33431
+ this.selectedTransactionLineChanged.next(this._selectedTransactionLine);
33432
+ }
33433
+ get selectedTransactionLine() {
33434
+ return this._selectedTransactionLine;
33435
+ }
33436
+ ngOnDestroy() {
33437
+ this._subs.forEach(s => s.unsubscribe());
33438
+ }
33439
+ _checkAllLinesSelectedForDelivery(data) {
33440
+ if (data && data.lineUuid) {
33441
+ if (!data.selected) {
33442
+ return true;
33443
+ }
33444
+ this._selectedLineUuidsForDelivery.push(data.lineUuid);
33445
+ let transactionLinesForDelivery = this._transactionService.currentTransaction.transactionLines.filter(l => l.articleLineStatus && l.articleLineStatus.quantityToDeliver !== 0);
33446
+ if (this._transactionService.currentTransaction.deliveryCostLines) {
33447
+ transactionLinesForDelivery = transactionLinesForDelivery.concat(this._transactionService.currentTransaction.deliveryCostLines);
33448
+ }
33449
+ const notFound = transactionLinesForDelivery.filter(l => this._selectedLineUuidsForDelivery.indexOf(l.uuid) < 0);
33450
+ return notFound.length === 0;
33451
+ }
33452
+ return false;
33453
+ }
33454
+ _checkAllLinesSelectedForInvoice(data) {
33455
+ if (data && data.lineUuid) {
33456
+ if (!data.selected) {
33457
+ return true;
33458
+ }
33459
+ this._selectedLineUuidsForInvoice.push(data.lineUuid);
33460
+ let transactionLinesForInvoice = this._transactionService.currentTransaction.transactionLines.filter(l => l.articleLineStatus && l.articleLineStatus.quantityToInvoice !== 0);
33461
+ if (this._transactionService.currentTransaction.deliveryCostLines) {
33462
+ transactionLinesForInvoice = transactionLinesForInvoice.concat(this._transactionService.currentTransaction.deliveryCostLines);
33463
+ }
33464
+ const notFound = transactionLinesForInvoice.filter(l => this._selectedLineUuidsForInvoice.indexOf(l.uuid) < 0);
33465
+ return notFound.length === 0;
33466
+ }
33467
+ return false;
33468
+ }
33469
+ }
33470
+ LineSelectionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LineSelectionService_Factory() { return new LineSelectionService(i0.ɵɵinject(TransactionEventService), i0.ɵɵinject(TransactionService)); }, token: LineSelectionService, providedIn: "root" });
33471
+ LineSelectionService.decorators = [
33472
+ { type: Injectable, args: [{
33473
+ providedIn: 'root'
33474
+ },] }
33475
+ ];
33476
+ LineSelectionService.ctorParameters = () => [
33477
+ { type: TransactionEventService },
33478
+ { type: TransactionService }
33479
+ ];
33480
+
33351
33481
  class TransactionLineSidePanelComponent {
33352
- constructor(_service, _transactionHeaderService, _transactionLineService, _transactionEventService, _transactionMappingService, _purchaseConfirmationService) {
33482
+ constructor(_service, _transactionHeaderService, _transactionLineService, _transactionEventService, _transactionMappingService, _purchaseConfirmationService, _lineSelectionService, _changeDetector) {
33353
33483
  this._service = _service;
33354
33484
  this._transactionHeaderService = _transactionHeaderService;
33355
33485
  this._transactionLineService = _transactionLineService;
33356
33486
  this._transactionEventService = _transactionEventService;
33357
33487
  this._transactionMappingService = _transactionMappingService;
33358
33488
  this._purchaseConfirmationService = _purchaseConfirmationService;
33489
+ this._lineSelectionService = _lineSelectionService;
33490
+ this._changeDetector = _changeDetector;
33359
33491
  this.icons = Icon;
33360
33492
  this.categories = TransactionTypeCategory;
33361
33493
  this.transactionTypes = TransactionKind;
33362
33494
  this.TransactionTypeCategory = TransactionTypeCategory;
33363
33495
  this.wide = false;
33364
- this.transactionLine = new TransactionLineInfo();
33365
33496
  this.cancelClick = new EventEmitter();
33366
33497
  this._subs = [];
33367
33498
  }
@@ -33375,10 +33506,14 @@ class TransactionLineSidePanelComponent {
33375
33506
  return this._transactionHeaderService.transactionInfo;
33376
33507
  }
33377
33508
  ngOnInit() {
33378
- this._transactionLineService.transactionLine = this.transactionLine;
33379
33509
  this.activeCategoryButton = this._transactionMappingService.getButtonBar(this._transactionHeaderService.transactionKind)
33380
33510
  .find((button) => button.category === this.activeCategory);
33381
- this._subs.push(this._purchaseConfirmationService.ordersTotalObservable.subscribe((value) => {
33511
+ this._subs.push(this._lineSelectionService.selectedTransactionLineChanged.subscribe((line) => {
33512
+ if (line) {
33513
+ this._transactionLineService.transactionLine = line;
33514
+ this._changeDetector.detectChanges();
33515
+ }
33516
+ }), this._purchaseConfirmationService.ordersTotalObservable.subscribe((value) => {
33382
33517
  this.ordersTotal = value;
33383
33518
  }));
33384
33519
  }
@@ -33415,11 +33550,7 @@ TransactionLineSidePanelComponent.decorators = [
33415
33550
  <div class="transaction-line-side-panel-content co-small-scrollbar">
33416
33551
  <ng-container [ngSwitch]="transactionInfo.transactionKind">
33417
33552
  <ng-container *ngSwitchCase="transactionTypes.PurchaseOrder">
33418
- <co-transaction-line-side-panel-purchase
33419
- [categoryType]="activeCategory"
33420
- [transactionLine]="transactionLine"
33421
- [transactionInfo]="transaction.transactionInfo"
33422
- ></co-transaction-line-side-panel-purchase>
33553
+ <co-transaction-line-side-panel-purchase [categoryType]="activeCategory"></co-transaction-line-side-panel-purchase>
33423
33554
  </ng-container>
33424
33555
  <ng-container *ngSwitchCase="transactionTypes.SalesOrder">
33425
33556
  <co-transaction-line-side-panel-sales [categoryType]="activeCategory"></co-transaction-line-side-panel-sales>
@@ -33450,12 +33581,13 @@ TransactionLineSidePanelComponent.ctorParameters = () => [
33450
33581
  { type: TransactionLineService },
33451
33582
  { type: TransactionEventService },
33452
33583
  { type: TransactionMappingService },
33453
- { type: PurchaseConfirmationService }
33584
+ { type: PurchaseConfirmationService },
33585
+ { type: LineSelectionService },
33586
+ { type: ChangeDetectorRef }
33454
33587
  ];
33455
33588
  TransactionLineSidePanelComponent.propDecorators = {
33456
33589
  wide: [{ type: Input }],
33457
33590
  activeCategory: [{ type: Input }],
33458
- transactionLine: [{ type: Input }],
33459
33591
  cancelClick: [{ type: Output }],
33460
33592
  showClass: [{ type: HostBinding, args: ["class.co-transaction-line-side-panel",] }]
33461
33593
  };
@@ -34393,28 +34525,12 @@ TransactionConfirmationHistoryModule.decorators = [
34393
34525
  ];
34394
34526
 
34395
34527
  class TransactionLineSidePanelPurchaseComponent {
34396
- constructor(_service, _transactionEventService) {
34397
- this._service = _service;
34398
- this._transactionEventService = _transactionEventService;
34528
+ constructor() {
34399
34529
  this.categories = TransactionTypeCategory;
34400
- this.transactionInfo = new TransactionInfo();
34401
- this.transactionLine = new TransactionLineInfo();
34402
- this.quantityToReceiveChange = new EventEmitter();
34403
- this.goodsReceiptStatus = new GoodsReceiptHistory();
34404
- this.selectedLineDocBatchArray = new DocDeliveryBatch();
34405
- this.isDocBatchSaved = false;
34406
- this.editingMode = false;
34407
34530
  }
34408
34531
  showClass() {
34409
34532
  return true;
34410
34533
  }
34411
- fillInputOnClick(data) {
34412
- this.selectedLineDocBatchArray = data;
34413
- this.editingMode = true;
34414
- }
34415
- docBatchSaved(data) {
34416
- this.isDocBatchSaved = data;
34417
- }
34418
34534
  }
34419
34535
  TransactionLineSidePanelPurchaseComponent.decorators = [
34420
34536
  { type: Component, args: [{
@@ -34422,10 +34538,7 @@ TransactionLineSidePanelPurchaseComponent.decorators = [
34422
34538
  template: `
34423
34539
  <ng-container [ngSwitch]="categoryType">
34424
34540
  <ng-container *ngSwitchCase="categories.PurchaseOrderOrderConfirmation">
34425
- <co-transaction-line-purchase-confirmation
34426
- [transactionInfo]="transactionInfo"
34427
- [transactionLine]="transactionLine"
34428
- ></co-transaction-line-purchase-confirmation>
34541
+ <co-transaction-line-purchase-confirmation></co-transaction-line-purchase-confirmation>
34429
34542
  </ng-container>
34430
34543
  <ng-container *ngSwitchCase="categories.PurchaseOrderReceivedGoods">
34431
34544
  <co-transaction-line-purchase-receive-goods></co-transaction-line-purchase-receive-goods>
@@ -34438,15 +34551,8 @@ TransactionLineSidePanelPurchaseComponent.decorators = [
34438
34551
  encapsulation: ViewEncapsulation.None
34439
34552
  },] }
34440
34553
  ];
34441
- TransactionLineSidePanelPurchaseComponent.ctorParameters = () => [
34442
- { type: TransactionService },
34443
- { type: TransactionEventService }
34444
- ];
34445
34554
  TransactionLineSidePanelPurchaseComponent.propDecorators = {
34446
- transactionInfo: [{ type: Input }],
34447
- transactionLine: [{ type: Input }],
34448
34555
  categoryType: [{ type: Input }],
34449
- quantityToReceiveChange: [{ type: Output }],
34450
34556
  showClass: [{ type: HostBinding, args: ["class.co-transaction-line-side-panel-purchase",] }]
34451
34557
  };
34452
34558
 
@@ -34898,17 +35004,21 @@ TransactionLinePurchaseReceiveGoodsModule.decorators = [
34898
35004
  },] }
34899
35005
  ];
34900
35006
 
34901
- class TransactionLinePurchaseConfirmationComponent {
34902
- constructor(transactionHeaderService, iconCacheService, purchaseConfirmationService, _transactionEventService, _transactionService) {
35007
+ class TransactionLinePurchaseConfirmationComponent extends TransactionLineBaseComponent {
35008
+ constructor(transactionHeaderService, transactionLineService, transactionEventService, service, iconCacheService, transactionScreenConfigurationService, purchaseConfirmationService, dictionaryService, imageService, changeDetector) {
35009
+ super(transactionHeaderService, transactionLineService, transactionEventService, iconCacheService, transactionScreenConfigurationService, imageService, dictionaryService, service, changeDetector);
34903
35010
  this.transactionHeaderService = transactionHeaderService;
35011
+ this.transactionLineService = transactionLineService;
35012
+ this.transactionEventService = transactionEventService;
35013
+ this.service = service;
34904
35014
  this.iconCacheService = iconCacheService;
35015
+ this.transactionScreenConfigurationService = transactionScreenConfigurationService;
34905
35016
  this.purchaseConfirmationService = purchaseConfirmationService;
34906
- this._transactionEventService = _transactionEventService;
34907
- this._transactionService = _transactionService;
35017
+ this.dictionaryService = dictionaryService;
35018
+ this.imageService = imageService;
35019
+ this.changeDetector = changeDetector;
34908
35020
  this.icons = Icon;
34909
35021
  this.transactionTypeCategory = TransactionTypeCategory;
34910
- this.transactionInfo = new TransactionInfo();
34911
- this.transactionLine = new TransactionLineInfo();
34912
35022
  this.docDeliveryBatch = new DocDeliveryBatch();
34913
35023
  this.filteredDocBatchArray = [];
34914
35024
  this.maxDocAmount = 0;
@@ -34920,12 +35030,12 @@ class TransactionLinePurchaseConfirmationComponent {
34920
35030
  return true;
34921
35031
  }
34922
35032
  ngOnInit() {
34923
- this._subs.push(this._transactionEventService.transactionLineChanged.subscribe((line) => {
35033
+ super.ngOnInit();
35034
+ this._subs.push(this.transactionEventService.transactionLineChanged.subscribe((line) => {
34924
35035
  if (line.lineNr === this.transactionLine.lineNr) {
34925
- this.transactionLine = line;
34926
35036
  this._updateBatchArray();
34927
35037
  }
34928
- }), this._transactionEventService.orderConfirmationReset.subscribe(() => {
35038
+ }), this.transactionEventService.orderConfirmationReset.subscribe(() => {
34929
35039
  this.showPurchaseConfirmationAI = false;
34930
35040
  }), this.purchaseConfirmationService.confirmationNeeded.subscribe((needed) => {
34931
35041
  this.showPurchaseConfirmationAI = needed;
@@ -34935,6 +35045,7 @@ class TransactionLinePurchaseConfirmationComponent {
34935
35045
  }
34936
35046
  ngOnDestroy() {
34937
35047
  this._subs.forEach(s => s.unsubscribe());
35048
+ super.ngOnDestroy();
34938
35049
  }
34939
35050
  handleSaveDetailsEdit() {
34940
35051
  return __awaiter(this, void 0, void 0, function* () {
@@ -34954,7 +35065,7 @@ class TransactionLinePurchaseConfirmationComponent {
34954
35065
  this.transactionLine.purchasePortalLine.docBatchArray.push(this.docDeliveryBatch);
34955
35066
  }
34956
35067
  this.transactionLine.purchasePortalLine.docKind = 'IB';
34957
- const success = yield this._transactionService.updatePurchasePortalLines(this.transactionInfo.id, this.transactionInfo.version, this.transactionLine.purchasePortalLine);
35068
+ const success = yield this.transactionService.updatePurchasePortalLines(this.transactionInfo.id, this.transactionInfo.version, this.transactionLine.purchasePortalLine);
34958
35069
  if (success) {
34959
35070
  this._initNewDocDeliveryBatch();
34960
35071
  this.confirmingOrder = false;
@@ -34969,7 +35080,7 @@ class TransactionLinePurchaseConfirmationComponent {
34969
35080
  return __awaiter(this, void 0, void 0, function* () {
34970
35081
  row.deleteLine = 'T';
34971
35082
  this.transactionLine.purchasePortalLine.docKind = 'IB';
34972
- const success = yield this._transactionService.updatePurchasePortalLines(this.transactionInfo.id, this.transactionInfo.version, this.transactionLine.purchasePortalLine);
35083
+ const success = yield this.transactionService.updatePurchasePortalLines(this.transactionInfo.id, this.transactionInfo.version, this.transactionLine.purchasePortalLine);
34973
35084
  if (success) {
34974
35085
  this._initNewDocDeliveryBatch();
34975
35086
  }
@@ -34986,7 +35097,12 @@ class TransactionLinePurchaseConfirmationComponent {
34986
35097
  handleDeliveryBatchChange() {
34987
35098
  this._setMaxDocAmount();
34988
35099
  }
35100
+ transactionLineSet() {
35101
+ super.transactionLineSet();
35102
+ this._updateBatchArray();
35103
+ }
34989
35104
  _updateBatchArray() {
35105
+ this._initNewDocDeliveryBatch();
34990
35106
  this.filteredDocBatchArray = this.transactionLine.purchasePortalLine.docBatchArray.filter(value => value.historical.toLowerCase() === 'h' && value.docAmount >= 0);
34991
35107
  this._setMaxDocAmount();
34992
35108
  }
@@ -35019,8 +35135,8 @@ class TransactionLinePurchaseConfirmationComponent {
35019
35135
  .forEach((d => {
35020
35136
  alreadyConfirmed = alreadyConfirmed + d.docAmount;
35021
35137
  }));
35022
- this.docDeliveryBatch.docAmount = this.transactionLine.amount - alreadyConfirmed;
35023
- this.docDeliveryBatch.confirmedPrice = +this.transactionLine.purchasePortalLine.netOrderPrice;
35138
+ this.docDeliveryBatch.docAmount = (this.transactionLine.amount !== undefined ? this.transactionLine.amount : 0) - alreadyConfirmed;
35139
+ this.docDeliveryBatch.confirmedPrice = this.transactionLine.purchasePortalLine.netOrderPrice ? +this.transactionLine.purchasePortalLine.netOrderPrice : 0;
35024
35140
  this._setMaxDocAmount();
35025
35141
  }
35026
35142
  }
@@ -35114,14 +35230,17 @@ TransactionLinePurchaseConfirmationComponent.decorators = [
35114
35230
  ];
35115
35231
  TransactionLinePurchaseConfirmationComponent.ctorParameters = () => [
35116
35232
  { type: TransactionHeaderService },
35233
+ { type: TransactionLineService },
35234
+ { type: TransactionEventService },
35235
+ { type: TransactionService },
35117
35236
  { type: IconCacheService },
35237
+ { type: TransactionScreenConfigurationService },
35118
35238
  { type: PurchaseConfirmationService },
35119
- { type: TransactionEventService },
35120
- { type: TransactionService }
35239
+ { type: DictionaryService },
35240
+ { type: TransactionImageService },
35241
+ { type: ChangeDetectorRef }
35121
35242
  ];
35122
35243
  TransactionLinePurchaseConfirmationComponent.propDecorators = {
35123
- transactionInfo: [{ type: Input }],
35124
- transactionLine: [{ type: Input }],
35125
35244
  showClass: [{ type: HostBinding, args: ['class.co-transaction-line-purchase-confirmation',] }]
35126
35245
  };
35127
35246
 
@@ -35284,8 +35403,8 @@ TransactionLabeledPriceInputModule.decorators = [
35284
35403
  ];
35285
35404
 
35286
35405
  class TransactionLinesPopupComponent {
35287
- constructor() {
35288
- this.transactionLines = [];
35406
+ constructor(purchaseConfirmationService) {
35407
+ this.purchaseConfirmationService = purchaseConfirmationService;
35289
35408
  this.clickOutside = new EventEmitter();
35290
35409
  this.transactionLineClick = new EventEmitter();
35291
35410
  }
@@ -35303,18 +35422,20 @@ TransactionLinesPopupComponent.decorators = [
35303
35422
  (clickOutside)="clickOutside.emit()">
35304
35423
  <table>
35305
35424
  <tr>
35425
+ <th class="color"></th>
35306
35426
  <th class="line-nr right-align" [textContent]="'LINE_NR' | localize"></th>
35307
35427
  <th class="article-nr" [textContent]="'ARTICLE_NR' | localize"></th>
35308
35428
  <th class="article-nr" [textContent]="'DESCRIPTION' | localize"></th>
35309
35429
  <th class="amount right-align" [textContent]="'AMOUNT' | localize"></th>
35310
35430
  <th class="price right-align" [textContent]="'PRICE' | localize"></th>
35311
35431
  </tr>
35312
- <tr class="transaction-line" *ngFor="let transactionLine of transactionLines" (click)="transactionLineClick.emit(transactionLine)">
35313
- <td class="right-align" [textContent]="transactionLine.lineNr"></td>
35314
- <td [textContent]="transactionLine.articleNumber"></td>
35315
- <td [textContent]="transactionLine.goodDescription"></td>
35316
- <td class="right-align" [textContent]="transactionLine.amount"></td>
35317
- <td class="right-align" [textContent]="transactionLine.price | coCurrency: true"></td>
35432
+ <tr class="transaction-line" *ngFor="let viewModel of purchaseConfirmationService.transactionLinesViewModels" (click)="transactionLineClick.emit(viewModel.line)">
35433
+ <td class="color" [style.background-color]="viewModel.color"></td>
35434
+ <td class="right-align" [textContent]="viewModel.line.lineNr"></td>
35435
+ <td [textContent]="viewModel.line.articleNumber"></td>
35436
+ <td [textContent]="viewModel.line.goodDescription"></td>
35437
+ <td class="right-align" [textContent]="viewModel.line.amount"></td>
35438
+ <td class="right-align" [textContent]="viewModel.line.price | coCurrency: true"></td>
35318
35439
  </tr>
35319
35440
  </table>
35320
35441
  </div>
@@ -35322,8 +35443,10 @@ TransactionLinesPopupComponent.decorators = [
35322
35443
  encapsulation: ViewEncapsulation.None
35323
35444
  },] }
35324
35445
  ];
35446
+ TransactionLinesPopupComponent.ctorParameters = () => [
35447
+ { type: PurchaseConfirmationService }
35448
+ ];
35325
35449
  TransactionLinesPopupComponent.propDecorators = {
35326
- transactionLines: [{ type: Input }],
35327
35450
  parentForOverlay: [{ type: Input }],
35328
35451
  clickOutside: [{ type: Output }],
35329
35452
  transactionLineClick: [{ type: Output }],
@@ -35352,6 +35475,13 @@ class PurchaseConfirmationLinesComponent {
35352
35475
  this._transaction = value;
35353
35476
  if (this._transaction && this._transaction.transactionLines) {
35354
35477
  this.transactionLines = this._transaction.transactionLines.filter(tl => tl.isArticle);
35478
+ // create the list of transaction lines without a reference to the original ones
35479
+ this._purchaseConfirmationService.transactionLines.length = 0;
35480
+ const transLines = [];
35481
+ this.transactionLines.forEach(t => {
35482
+ transLines.push(Object.assign(new TransactionLineInfo(), t));
35483
+ });
35484
+ this._purchaseConfirmationService.transactionLines = transLines;
35355
35485
  }
35356
35486
  }
35357
35487
  get transaction() {
@@ -35410,7 +35540,7 @@ class PurchaseConfirmationLinesComponent {
35410
35540
  showPopup(element, confirmationVM) {
35411
35541
  if (confirmationVM && confirmationVM.confirmation) {
35412
35542
  this.currentConfirmationViewModel = confirmationVM;
35413
- this._popupComponentRef = this._overlayService.createComponent(TransactionLinesPopupComponent, { parentForOverlay: element, transactionLines: this.transactionLines }, {
35543
+ this._popupComponentRef = this._overlayService.createComponent(TransactionLinesPopupComponent, { parentForOverlay: element }, {
35414
35544
  transactionLineClick: (line) => this._handleTransactionLineClick(line, this.currentConfirmationViewModel.confirmation),
35415
35545
  clickOutside: () => this.hidePopup()
35416
35546
  });
@@ -45374,8 +45504,18 @@ TransactionLineModule.decorators = [
45374
45504
  ];
45375
45505
 
45376
45506
  class TransactionLinesBaseComponent extends TransactionHeaderBaseComponent {
45377
- constructor() {
45378
- super(...arguments);
45507
+ constructor(transactionHeaderService, transactionEventService, service, iconCacheService, transactionScreenConfigurationService, dictionaryService, imageService, changeDetector, purchaseConfirmationService, lineSelectionService) {
45508
+ super(transactionHeaderService, transactionEventService, iconCacheService, transactionScreenConfigurationService, imageService, dictionaryService, service, changeDetector);
45509
+ this.transactionHeaderService = transactionHeaderService;
45510
+ this.transactionEventService = transactionEventService;
45511
+ this.service = service;
45512
+ this.iconCacheService = iconCacheService;
45513
+ this.transactionScreenConfigurationService = transactionScreenConfigurationService;
45514
+ this.dictionaryService = dictionaryService;
45515
+ this.imageService = imageService;
45516
+ this.changeDetector = changeDetector;
45517
+ this.purchaseConfirmationService = purchaseConfirmationService;
45518
+ this.lineSelectionService = lineSelectionService;
45379
45519
  this.icons = Icon;
45380
45520
  this.category = TransactionTypeCategory;
45381
45521
  this.saveTransactionLine = new EventEmitter();
@@ -45394,6 +45534,12 @@ class TransactionLinesBaseComponent extends TransactionHeaderBaseComponent {
45394
45534
  get activeCategory() {
45395
45535
  return this._activeCategory;
45396
45536
  }
45537
+ set selectedTransactionLine(value) {
45538
+ this.lineSelectionService.selectedTransactionLine = value;
45539
+ }
45540
+ get selectedTransactionLine() {
45541
+ return this.lineSelectionService.selectedTransactionLine;
45542
+ }
45397
45543
  ngOnInit() {
45398
45544
  super.ngOnInit();
45399
45545
  this._subscriptions.push(this.transactionEventService.transactionLineDraggedOver.subscribe((lineNr) => {
@@ -45464,23 +45610,26 @@ class TransactionLinesBaseComponent extends TransactionHeaderBaseComponent {
45464
45610
  TransactionLinesBaseComponent.decorators = [
45465
45611
  { type: Directive }
45466
45612
  ];
45613
+ TransactionLinesBaseComponent.ctorParameters = () => [
45614
+ { type: TransactionHeaderService },
45615
+ { type: TransactionEventService },
45616
+ { type: TransactionService },
45617
+ { type: IconCacheService },
45618
+ { type: TransactionScreenConfigurationService },
45619
+ { type: DictionaryService },
45620
+ { type: TransactionImageService },
45621
+ { type: ChangeDetectorRef },
45622
+ { type: PurchaseConfirmationService },
45623
+ { type: LineSelectionService }
45624
+ ];
45467
45625
  TransactionLinesBaseComponent.propDecorators = {
45468
45626
  activeCategory: [{ type: Input }],
45469
45627
  saveTransactionLine: [{ type: Output }]
45470
45628
  };
45471
45629
 
45472
45630
  class TransactionLinesComponent extends TransactionLinesBaseComponent {
45473
- constructor(transactionHeaderService, transactionEventService, service, iconCacheService, transactionScreenConfigurationService, dictionaryService, imageService, changeDetector, _purchaseConfirmationService) {
45474
- super(transactionHeaderService, transactionEventService, iconCacheService, transactionScreenConfigurationService, imageService, dictionaryService, service, changeDetector);
45475
- this.transactionHeaderService = transactionHeaderService;
45476
- this.transactionEventService = transactionEventService;
45477
- this.service = service;
45478
- this.iconCacheService = iconCacheService;
45479
- this.transactionScreenConfigurationService = transactionScreenConfigurationService;
45480
- this.dictionaryService = dictionaryService;
45481
- this.imageService = imageService;
45482
- this.changeDetector = changeDetector;
45483
- this._purchaseConfirmationService = _purchaseConfirmationService;
45631
+ constructor() {
45632
+ super(...arguments);
45484
45633
  this.customerPortal = false;
45485
45634
  this.showSidePanel = false;
45486
45635
  this.showSidePanelForConfirmationAI = false;
@@ -45492,7 +45641,7 @@ class TransactionLinesComponent extends TransactionLinesBaseComponent {
45492
45641
  }
45493
45642
  ngOnInit() {
45494
45643
  super.ngOnInit();
45495
- this._subs.push(this._purchaseConfirmationService.confirmationNeeded.subscribe((needed) => {
45644
+ this._subs.push(this.purchaseConfirmationService.confirmationNeeded.subscribe((needed) => {
45496
45645
  if (needed) {
45497
45646
  this.showSidePanelForConfirmationAI = true;
45498
45647
  this.showSidePanel = true;
@@ -45516,7 +45665,8 @@ class TransactionLinesComponent extends TransactionLinesBaseComponent {
45516
45665
  }
45517
45666
  _checkActiveLine() {
45518
45667
  if (this.showSidePanelForConfirmationAI && this.transactionLines && this.transactionLines.length > 0) {
45519
- this.activeTransactionLine = this.transactionLines[0];
45668
+ // this.activeTransactionLine = this.transactionLines[0];
45669
+ this.lineSelectionService.selectedTransactionLine = this.transactionLines[0];
45520
45670
  }
45521
45671
  }
45522
45672
  }
@@ -45584,10 +45734,8 @@ TransactionLinesComponent.decorators = [
45584
45734
  </div>
45585
45735
  </ng-container>
45586
45736
  </div>
45587
- <co-transaction-line-side-panel *ngIf="showSidePanel" clickOutside
45737
+ <co-transaction-line-side-panel *ngIf="showSidePanel"
45588
45738
  [activeCategory]="activeCategory"
45589
- [transactionLine]="activeTransactionLine"
45590
- (clickOutside)="showSidePanel = false"
45591
45739
  (cancelClick)="showSidePanel = false">
45592
45740
  </co-transaction-line-side-panel>
45593
45741
  `,
@@ -45595,17 +45743,6 @@ TransactionLinesComponent.decorators = [
45595
45743
  changeDetection: ChangeDetectionStrategy.OnPush
45596
45744
  },] }
45597
45745
  ];
45598
- TransactionLinesComponent.ctorParameters = () => [
45599
- { type: TransactionHeaderService },
45600
- { type: TransactionEventService },
45601
- { type: TransactionService },
45602
- { type: IconCacheService },
45603
- { type: TransactionScreenConfigurationService },
45604
- { type: DictionaryService },
45605
- { type: TransactionImageService },
45606
- { type: ChangeDetectorRef },
45607
- { type: PurchaseConfirmationService }
45608
- ];
45609
45746
  TransactionLinesComponent.propDecorators = {
45610
45747
  showClass: [{ type: HostBinding, args: ["class.co-transaction-lines",] }],
45611
45748
  customerPortal: [{ type: Input }]
@@ -53423,70 +53560,6 @@ ShoppingCartComponent.propDecorators = {
53423
53560
  showClass: [{ type: HostBinding, args: ['class.co-shopping-cart',] }]
53424
53561
  };
53425
53562
 
53426
- class LineSelectionService {
53427
- constructor(_transactionEventService, _transactionService) {
53428
- this._transactionEventService = _transactionEventService;
53429
- this._transactionService = _transactionService;
53430
- this._subs = [];
53431
- this._selectedLineUuidsForDelivery = [];
53432
- this._selectedLineUuidsForInvoice = [];
53433
- this._subs.push(this._transactionEventService.lineSelectedForDelivery.subscribe((data) => {
53434
- if (this._checkAllLinesSelectedForDelivery(data)) {
53435
- this._selectedLineUuidsForDelivery.length = 0;
53436
- this._transactionEventService.allLinesSelectedForDelivery.next();
53437
- }
53438
- }), this._transactionEventService.lineSelectedForInvoice.subscribe((data) => {
53439
- if (this._checkAllLinesSelectedForInvoice(data)) {
53440
- this._selectedLineUuidsForInvoice.length = 0;
53441
- this._transactionEventService.allLinesSelectedForInvoice.next();
53442
- }
53443
- }));
53444
- }
53445
- ngOnDestroy() {
53446
- this._subs.forEach(s => s.unsubscribe());
53447
- }
53448
- _checkAllLinesSelectedForDelivery(data) {
53449
- if (data && data.lineUuid) {
53450
- if (!data.selected) {
53451
- return true;
53452
- }
53453
- this._selectedLineUuidsForDelivery.push(data.lineUuid);
53454
- let transactionLinesForDelivery = this._transactionService.currentTransaction.transactionLines.filter(l => l.articleLineStatus && l.articleLineStatus.quantityToDeliver !== 0);
53455
- if (this._transactionService.currentTransaction.deliveryCostLines) {
53456
- transactionLinesForDelivery = transactionLinesForDelivery.concat(this._transactionService.currentTransaction.deliveryCostLines);
53457
- }
53458
- const notFound = transactionLinesForDelivery.filter(l => this._selectedLineUuidsForDelivery.indexOf(l.uuid) < 0);
53459
- return notFound.length === 0;
53460
- }
53461
- return false;
53462
- }
53463
- _checkAllLinesSelectedForInvoice(data) {
53464
- if (data && data.lineUuid) {
53465
- if (!data.selected) {
53466
- return true;
53467
- }
53468
- this._selectedLineUuidsForInvoice.push(data.lineUuid);
53469
- let transactionLinesForInvoice = this._transactionService.currentTransaction.transactionLines.filter(l => l.articleLineStatus && l.articleLineStatus.quantityToInvoice !== 0);
53470
- if (this._transactionService.currentTransaction.deliveryCostLines) {
53471
- transactionLinesForInvoice = transactionLinesForInvoice.concat(this._transactionService.currentTransaction.deliveryCostLines);
53472
- }
53473
- const notFound = transactionLinesForInvoice.filter(l => this._selectedLineUuidsForInvoice.indexOf(l.uuid) < 0);
53474
- return notFound.length === 0;
53475
- }
53476
- return false;
53477
- }
53478
- }
53479
- LineSelectionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LineSelectionService_Factory() { return new LineSelectionService(i0.ɵɵinject(TransactionEventService), i0.ɵɵinject(TransactionService)); }, token: LineSelectionService, providedIn: "root" });
53480
- LineSelectionService.decorators = [
53481
- { type: Injectable, args: [{
53482
- providedIn: "root"
53483
- },] }
53484
- ];
53485
- LineSelectionService.ctorParameters = () => [
53486
- { type: TransactionEventService },
53487
- { type: TransactionService }
53488
- ];
53489
-
53490
53563
  class TransactionInternalComponent {
53491
53564
  constructor(iconCacheService, service, transactionEventService, _transactionConnectorService, _transactionEventService, _screenConfigurationService, _dialogService, _purchaseConfirmationService, _deliveryPlanningService, _transactionBaseService, _changeDetector, _transactionHeaderService, _lineSelection //Do not remove this. While it is not directly used it has its own important subscriptions.
53492
53565
  ) {