@colijnit/transaction 256.1.6 → 256.1.7

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 (22) hide show
  1. package/bundles/colijnit-transaction.umd.js +112 -78
  2. package/bundles/colijnit-transaction.umd.js.map +1 -1
  3. package/colijnit-transaction.metadata.json +1 -1
  4. package/esm2015/lib/component/add-product/add-product.component.js +5 -5
  5. package/esm2015/lib/component/dialog/catalog/dialog-catalog/dialog-catalog.component.js +9 -2
  6. package/esm2015/lib/component/dialog/transaction-line/dialog-transaction-line-warehouse-cc/dialog-direct-sell.component.js +87 -68
  7. package/esm2015/lib/component/transaction-header-fields/transaction-header-deposit-amount.component.js +16 -11
  8. package/esm2015/lib/component/transaction-line-fields/transaction-line-supplier-button.component.js +2 -2
  9. package/esm2015/lib/service/transaction-connector-adapter.service.js +5 -5
  10. package/esm2015/lib/service/transaction-connector.service.js +5 -5
  11. package/esm2015/lib/service/transaction.service.js +11 -11
  12. package/esm2015/lib/transaction-version.js +3 -3
  13. package/fesm2015/colijnit-transaction.js +132 -103
  14. package/fesm2015/colijnit-transaction.js.map +1 -1
  15. package/lib/component/dialog/catalog/dialog-catalog/dialog-catalog.component.d.ts +5 -1
  16. package/lib/component/dialog/transaction-line/dialog-transaction-line-warehouse-cc/dialog-direct-sell.component.d.ts +8 -4
  17. package/lib/service/transaction-connector-adapter.service.d.ts +2 -2
  18. package/lib/service/transaction-connector.service.d.ts +2 -2
  19. package/lib/service/transaction.service.d.ts +5 -5
  20. package/package.json +1 -1
  21. package/colijnit-transaction-256.1.4.tgz +0 -0
  22. package/colijnit-transaction-256.1.5.tgz +0 -0
@@ -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.6";
37
- this.publishDate = "28-10-2024 10:33:24";
36
+ this.symVer = "256.1.7";
37
+ this.publishDate = "29-10-2024 18:11:52";
38
38
  }
39
39
  return Version;
40
40
  }());
@@ -3845,12 +3845,13 @@
3845
3845
  });
3846
3846
  });
3847
3847
  };
3848
- TransactionConnectorAdapterService.prototype.addTransactionLine = function (uuid, articleNo, quantity, aboveLineNr, belowLineNr) {
3848
+ TransactionConnectorAdapterService.prototype.addTransactionLine = function (uuid, articleNo, quantity, aboveLineNr, belowLineNr, showLoader) {
3849
+ if (showLoader === void 0) { showLoader = false; }
3849
3850
  return __awaiter(this, void 0, void 0, function () {
3850
3851
  var _this = this;
3851
3852
  return __generator(this, function (_a) {
3852
3853
  return [2 /*return*/, new Promise(function (resolve, reject) {
3853
- return _this.connector.addTransactionLine(uuid, articleNo, quantity, aboveLineNr, belowLineNr).then(function (result) {
3854
+ return _this.connector.addTransactionLine(uuid, articleNo, quantity, aboveLineNr, belowLineNr, showLoader).then(function (result) {
3854
3855
  if (result.validationResult && result.validationResult.success) {
3855
3856
  resolve(_this._boFactory.makeWithRawBackendData(transactionInfoResponse_bo.TransactionInfoResponse, result.resultObject));
3856
3857
  }
@@ -8149,12 +8150,13 @@
8149
8150
  });
8150
8151
  });
8151
8152
  };
8152
- TransactionConnectorAdapterService.prototype.addExternalCatalogArticlesToTransaction = function (uuid, catalogId, rawData) {
8153
+ TransactionConnectorAdapterService.prototype.addExternalCatalogArticlesToTransaction = function (uuid, catalogId, rawData, showLoader) {
8154
+ if (showLoader === void 0) { showLoader = false; }
8153
8155
  return __awaiter(this, void 0, void 0, function () {
8154
8156
  var response;
8155
8157
  return __generator(this, function (_a) {
8156
8158
  switch (_a.label) {
8157
- case 0: return [4 /*yield*/, this.connector.addExternalCatalogArticlesToTransaction(uuid, catalogId, rawData)];
8159
+ case 0: return [4 /*yield*/, this.connector.addExternalCatalogArticlesToTransaction(uuid, catalogId, rawData, showLoader)];
8158
8160
  case 1:
8159
8161
  response = _a.sent();
8160
8162
  if (response && response.validationResult && response.validationResult.success) {
@@ -9477,10 +9479,11 @@
9477
9479
  });
9478
9480
  });
9479
9481
  };
9480
- TransactionConnectorService.prototype.addTransactionLine = function (uuid, articleNo, quantity, aboveLineNr, belowLineNr) {
9482
+ TransactionConnectorService.prototype.addTransactionLine = function (uuid, articleNo, quantity, aboveLineNr, belowLineNr, showLoader) {
9483
+ if (showLoader === void 0) { showLoader = false; }
9481
9484
  return __awaiter(this, void 0, void 0, function () {
9482
9485
  return __generator(this, function (_a) {
9483
- return [2 /*return*/, this._adapterService.addTransactionLine(uuid, articleNo, quantity, aboveLineNr, belowLineNr)];
9486
+ return [2 /*return*/, this._adapterService.addTransactionLine(uuid, articleNo, quantity, aboveLineNr, belowLineNr, showLoader)];
9484
9487
  });
9485
9488
  });
9486
9489
  };
@@ -11180,11 +11183,12 @@
11180
11183
  });
11181
11184
  });
11182
11185
  };
11183
- TransactionConnectorService.prototype.addExternalCatalogArticlesToTransaction = function (uuid, catalogId, rawData) {
11186
+ TransactionConnectorService.prototype.addExternalCatalogArticlesToTransaction = function (uuid, catalogId, rawData, showLoader) {
11187
+ if (showLoader === void 0) { showLoader = false; }
11184
11188
  return __awaiter(this, void 0, void 0, function () {
11185
11189
  return __generator(this, function (_a) {
11186
11190
  switch (_a.label) {
11187
- case 0: return [4 /*yield*/, this._adapterService.addExternalCatalogArticlesToTransaction(uuid, catalogId, rawData)];
11191
+ case 0: return [4 /*yield*/, this._adapterService.addExternalCatalogArticlesToTransaction(uuid, catalogId, rawData, showLoader)];
11188
11192
  case 1: return [2 /*return*/, _a.sent()];
11189
11193
  }
11190
11194
  });
@@ -16060,16 +16064,17 @@
16060
16064
  });
16061
16065
  });
16062
16066
  };
16063
- TransactionService.prototype.addArticle = function (articleNo, quantity, aboveLineNr, belowLineNr, saveTransaction) {
16067
+ TransactionService.prototype.addArticle = function (articleNo, quantity, aboveLineNr, belowLineNr, saveTransaction, showLoader) {
16064
16068
  if (quantity === void 0) { quantity = 1; }
16065
16069
  if (aboveLineNr === void 0) { aboveLineNr = 0; }
16066
16070
  if (belowLineNr === void 0) { belowLineNr = 0; }
16067
16071
  if (saveTransaction === void 0) { saveTransaction = true; }
16072
+ if (showLoader === void 0) { showLoader = false; }
16068
16073
  return __awaiter(this, void 0, void 0, function () {
16069
16074
  var response;
16070
16075
  return __generator(this, function (_a) {
16071
16076
  switch (_a.label) {
16072
- case 0: return [4 /*yield*/, this.addTransactionLine(articleNo, quantity, aboveLineNr, belowLineNr)];
16077
+ case 0: return [4 /*yield*/, this.addTransactionLine(articleNo, quantity, aboveLineNr, belowLineNr, showLoader)];
16073
16078
  case 1:
16074
16079
  response = _a.sent();
16075
16080
  if (response !== null) {
@@ -16084,10 +16089,11 @@
16084
16089
  });
16085
16090
  });
16086
16091
  };
16087
- TransactionService.prototype.addTransactionLine = function (articleNo, quantity, aboveLineNr, belowLineNr) {
16092
+ TransactionService.prototype.addTransactionLine = function (articleNo, quantity, aboveLineNr, belowLineNr, showLoader) {
16088
16093
  if (quantity === void 0) { quantity = 1; }
16089
16094
  if (aboveLineNr === void 0) { aboveLineNr = 0; }
16090
16095
  if (belowLineNr === void 0) { belowLineNr = 0; }
16096
+ if (showLoader === void 0) { showLoader = false; }
16091
16097
  return __awaiter(this, void 0, void 0, function () {
16092
16098
  var created, lockSuccess, response;
16093
16099
  return __generator(this, function (_a) {
@@ -16103,7 +16109,7 @@
16103
16109
  lockSuccess = _a.sent();
16104
16110
  if (!lockSuccess) return [3 /*break*/, 4];
16105
16111
  this.transactionLineAdded = true;
16106
- return [4 /*yield*/, this.connector.addTransactionLine(this.currentTransaction.transactionInfo.uuid, articleNo, quantity, aboveLineNr, belowLineNr)];
16112
+ return [4 /*yield*/, this.connector.addTransactionLine(this.currentTransaction.transactionInfo.uuid, articleNo, quantity, aboveLineNr, belowLineNr, showLoader)];
16107
16113
  case 3:
16108
16114
  response = _a.sent();
16109
16115
  return [2 /*return*/, response];
@@ -16131,11 +16137,12 @@
16131
16137
  });
16132
16138
  });
16133
16139
  };
16134
- TransactionService.prototype.addExternalCatalogArticle = function (request) {
16140
+ TransactionService.prototype.addExternalCatalogArticle = function (request, showLoader) {
16141
+ if (showLoader === void 0) { showLoader = false; }
16135
16142
  return __awaiter(this, void 0, void 0, function () {
16136
16143
  return __generator(this, function (_a) {
16137
16144
  switch (_a.label) {
16138
- case 0: return [4 /*yield*/, this.addExternalCatalogArticleWithRawData(request.catalogId, request.articleJson)];
16145
+ case 0: return [4 /*yield*/, this.addExternalCatalogArticleWithRawData(request.catalogId, request.articleJson, showLoader)];
16139
16146
  case 1:
16140
16147
  _a.sent();
16141
16148
  return [2 /*return*/];
@@ -16143,14 +16150,15 @@
16143
16150
  });
16144
16151
  });
16145
16152
  };
16146
- TransactionService.prototype.addExternalCatalogArticleFromGoodId = function (jsonArticleString) {
16153
+ TransactionService.prototype.addExternalCatalogArticleFromGoodId = function (jsonArticleString, showLoader) {
16154
+ if (showLoader === void 0) { showLoader = false; }
16147
16155
  return __awaiter(this, void 0, void 0, function () {
16148
16156
  var jsonArticleObject, response, handled;
16149
16157
  return __generator(this, function (_a) {
16150
16158
  switch (_a.label) {
16151
16159
  case 0:
16152
16160
  jsonArticleObject = JSON.parse(jsonArticleString);
16153
- return [4 /*yield*/, this.addTransactionLine(jsonArticleObject.sku, jsonArticleObject.quantity)];
16161
+ return [4 /*yield*/, this.addTransactionLine(jsonArticleObject.sku, jsonArticleObject.quantity, 0, 0, showLoader)];
16154
16162
  case 1:
16155
16163
  response = _a.sent();
16156
16164
  return [4 /*yield*/, this.handleLineOperationStatuses(response, true)];
@@ -16166,7 +16174,8 @@
16166
16174
  });
16167
16175
  });
16168
16176
  };
16169
- TransactionService.prototype.addExternalCatalogArticleWithRawData = function (catalogId, jsonArticleString) {
16177
+ TransactionService.prototype.addExternalCatalogArticleWithRawData = function (catalogId, jsonArticleString, showLoader) {
16178
+ if (showLoader === void 0) { showLoader = false; }
16170
16179
  return __awaiter(this, void 0, void 0, function () {
16171
16180
  var created, lockSuccess, response;
16172
16181
  return __generator(this, function (_a) {
@@ -16182,7 +16191,7 @@
16182
16191
  lockSuccess = _a.sent();
16183
16192
  if (!lockSuccess) return [3 /*break*/, 5];
16184
16193
  this.transactionLineAdded = true;
16185
- return [4 /*yield*/, this.connector.addExternalCatalogArticlesToTransaction(this.currentTransaction.transactionInfo.uuid, catalogId, jsonArticleString)];
16194
+ return [4 /*yield*/, this.connector.addExternalCatalogArticlesToTransaction(this.currentTransaction.transactionInfo.uuid, catalogId, jsonArticleString, showLoader)];
16186
16195
  case 3:
16187
16196
  response = _a.sent();
16188
16197
  return [4 /*yield*/, this.handleLineOperationStatuses(response, true)];
@@ -32110,7 +32119,7 @@
32110
32119
  };
32111
32120
  TransactionLineSupplierButtonComponent.prototype._getSupplierDescription = function () {
32112
32121
  var _this = this;
32113
- if (this.transactionLine && this.transactionLine.isArticle && this.transactionLine.supplierDescription === undefined && this.visible) {
32122
+ if (this.transactionLine && this.transactionLine.isArticle && this.transactionLine.supplierDescription === undefined) {
32114
32123
  this._relationService.getRelationById(this.transactionLine.supplierId).then(function (relations) {
32115
32124
  var relation = relations && relations.length > 0 ? relations[0] : null;
32116
32125
  _this.transactionLine.supplierDescription = relation ? relation.displayName : "";
@@ -39226,7 +39235,7 @@
39226
39235
  TransactionHeaderDepositAmountComponent.decorators = [
39227
39236
  { type: i0.Component, args: [{
39228
39237
  selector: "co-transaction-header-deposit-amount",
39229
- template: "\n <span *ngIf=\"(!editMode || headerReadonly) && !defaultEditMode\" [textContent]=\"(transactionInfo.depositAmount | coCurrency) || '...'\" [tooltip]=\"tooltipMessage\"></span>\n <co-input-text #input *ngIf=\"editMode || defaultEditMode\"\n [type]=\"'number'\"\n [placeholder]=\"showLabel ? ('DOWNPAYMENT' | localize) : ''\"\n [showSaveCancel]=\"!headerReadonly\"\n [hidden]=\"hidden\"\n [readonly]=\"readonly || headerReadonly\"\n [model]=\"transactionInfo.depositAmount\"\n (blur)=\"editMode = false\"\n ></co-input-text>\n ",
39238
+ template: "\n <span\n *ngIf=\"(!editMode || headerReadonly) && !defaultEditMode\"\n [textContent]=\"(transactionInfo.depositAmount | coCurrency) || '...'\"\n [tooltip]=\"tooltipMessage\">\n </span>\n <co-input-text\n #input\n *ngIf=\"editMode || defaultEditMode\"\n [placeholder]=\"showLabel ? ('DOWNPAYMENT' | localize) : ''\"\n [showSaveCancel]=\"!headerReadonly\"\n [hidden]=\"hidden\"\n [readonly]=\"readonly || headerReadonly\"\n [model]=\"transactionInfo.depositAmount | coCurrency\"\n (blur)=\"editMode = false\">\n </co-input-text>\n ",
39230
39239
  providers: [{
39231
39240
  provide: corecomponents_v12.SCREEN_CONFIG_ADAPTER_COMPONENT_INTERFACE_NAME,
39232
39241
  useExisting: i0.forwardRef(function () { return TransactionHeaderDepositAmountComponent; })
@@ -40458,13 +40467,15 @@
40458
40467
  ]; };
40459
40468
 
40460
40469
  var DialogCatalogComponent = /** @class */ (function () {
40461
- function DialogCatalogComponent(_transactionService, _catalogService, _catalogEventService, _articleService, _dialogService, _screenConfigService, iconCacheService) {
40470
+ function DialogCatalogComponent(_transactionService, _catalogService, _catalogEventService, _articleService, _dialogService, _screenConfigService, _productConnectorAdapterService, _transactionEventService, iconCacheService) {
40462
40471
  this._transactionService = _transactionService;
40463
40472
  this._catalogService = _catalogService;
40464
40473
  this._catalogEventService = _catalogEventService;
40465
40474
  this._articleService = _articleService;
40466
40475
  this._dialogService = _dialogService;
40467
40476
  this._screenConfigService = _screenConfigService;
40477
+ this._productConnectorAdapterService = _productConnectorAdapterService;
40478
+ this._transactionEventService = _transactionEventService;
40468
40479
  this.iconCacheService = iconCacheService;
40469
40480
  this.icons = Icon;
40470
40481
  this.handleAddArticleInternally = true;
@@ -40511,6 +40522,8 @@
40511
40522
  case 3:
40512
40523
  this._subs.push(this._catalogEventService.stockDetailsClick.subscribe(function (article) {
40513
40524
  _this.handleStockButtonClick(article);
40525
+ }), this._productConnectorAdapterService.showLoader.subscribe(function (show) {
40526
+ _this._transactionEventService.showLoader.next(show);
40514
40527
  }));
40515
40528
  return [2 /*return*/];
40516
40529
  }
@@ -40691,6 +40704,8 @@
40691
40704
  { type: ArticleService },
40692
40705
  { type: DialogService },
40693
40706
  { type: CatalogScreenConfigurationService },
40707
+ { type: product.ProductConnectorAdapterService },
40708
+ { type: TransactionEventService },
40694
40709
  { type: IconCacheService }
40695
40710
  ]; };
40696
40711
  DialogCatalogComponent.propDecorators = {
@@ -52250,7 +52265,7 @@
52250
52265
  if (!(typeof data.article === 'string')) return [3 /*break*/, 3];
52251
52266
  article = JSON.parse(data.article);
52252
52267
  if (!(article.selectorData && article.selectorData.compositions)) return [3 /*break*/, 2];
52253
- return [4 /*yield*/, this.transactionService.addArticle(article.selectorData.compositions[0].compositionArticleNo, data.quantity, 0, 0 /*, lastArticle*/)];
52268
+ return [4 /*yield*/, this.transactionService.addArticle(article.selectorData.compositions[0].compositionArticleNo, data.quantity, 0, 0, true, true)];
52254
52269
  case 1:
52255
52270
  _a.sent();
52256
52271
  _a.label = 2;
@@ -52258,7 +52273,7 @@
52258
52273
  case 3:
52259
52274
  articleNr = data.article['articleNr'] || data.article['articleNumber'] || data.article['articleNo'];
52260
52275
  if (!articleNr) return [3 /*break*/, 5];
52261
- return [4 /*yield*/, this.transactionService.addArticle(articleNr, data.quantity, 0, 0 /*, lastArticle*/)];
52276
+ return [4 /*yield*/, this.transactionService.addArticle(articleNr, data.quantity, 0, 0, true, true)];
52262
52277
  case 4:
52263
52278
  _a.sent();
52264
52279
  _a.label = 5;
@@ -52328,7 +52343,7 @@
52328
52343
  request.catalogId = iFrameFeedbackObject.catalog;
52329
52344
  request.catalogType = iFrameFeedbackObject.sourceType;
52330
52345
  request.articleJson = iFrameFeedbackObject.jsonString;
52331
- return [4 /*yield*/, this.transactionService.addExternalCatalogArticle(request)];
52346
+ return [4 /*yield*/, this.transactionService.addExternalCatalogArticle(request, true)];
52332
52347
  case 1:
52333
52348
  _a.sent();
52334
52349
  return [2 /*return*/];
@@ -52347,7 +52362,7 @@
52347
52362
  request.catalogId = data.catalog;
52348
52363
  request.catalogType = externalCatalogTypes_enum.ExternalCatalogTypes.CatalogFarm;
52349
52364
  request.articleJson = data.jsonString;
52350
- return [4 /*yield*/, this.transactionService.addExternalCatalogArticle(request)];
52365
+ return [4 /*yield*/, this.transactionService.addExternalCatalogArticle(request, true)];
52351
52366
  case 1:
52352
52367
  _a.sent();
52353
52368
  return [2 /*return*/];
@@ -55730,40 +55745,9 @@
55730
55745
  this.showDirectSellModal = new i0.EventEmitter();
55731
55746
  this.icons = Icon;
55732
55747
  this.directSellSuppliers = [];
55733
- this.supplierStockRowSelected = false;
55734
- this.tempObject = {
55735
- articleNumber: 'articleNumber 123',
55736
- availableStock: 10,
55737
- supplierStockForecasts: [
55738
- {
55739
- purchaseOrderNumber: 1,
55740
- amount: 11,
55741
- amountReserved: 7,
55742
- amountAvailable: 4,
55743
- deliveryDate: new Date(),
55744
- confirmedDeliveryDate: new Date(),
55745
- arrivalDate: new Date()
55746
- },
55747
- {
55748
- purchaseOrderNumber: 2,
55749
- amount: 14,
55750
- amountReserved: 7,
55751
- amountAvailable: 7,
55752
- deliveryDate: new Date(),
55753
- confirmedDeliveryDate: new Date(),
55754
- arrivalDate: new Date()
55755
- },
55756
- {
55757
- purchaseOrderNumber: 3,
55758
- amount: 5,
55759
- amountReserved: 1,
55760
- amountAvailable: 4,
55761
- deliveryDate: new Date(),
55762
- confirmedDeliveryDate: new Date(),
55763
- arrivalDate: new Date()
55764
- }
55765
- ]
55766
- };
55748
+ this.availableStockCollection = new supplierArticleStockForecast.SupplierArticleStockForecast();
55749
+ this.formValid = false;
55750
+ this.fromStock = false;
55767
55751
  }
55768
55752
  DialogDirectSellComponent.prototype.ngOnInit = function () {
55769
55753
  this._getDirectSellSuppliers();
@@ -55771,36 +55755,83 @@
55771
55755
  DialogDirectSellComponent.prototype.hideModal = function () {
55772
55756
  this.showDirectSellModal.emit(false);
55773
55757
  };
55774
- DialogDirectSellComponent.prototype.handleSupplierChanged = function (supplier) {
55758
+ DialogDirectSellComponent.prototype.handleSupplierChanged = function () {
55775
55759
  this._getAvailableStock();
55776
55760
  };
55777
- DialogDirectSellComponent.prototype.handleChecked = function (event, row, index) {
55761
+ DialogDirectSellComponent.prototype.onStockChecked = function (event) {
55762
+ var _a;
55763
+ event.preventDefault();
55764
+ event.stopPropagation();
55765
+ if (this.selectedSupplier && ((_a = this.availableStockCollection.supplierStockForecasts) === null || _a === void 0 ? void 0 : _a.length) > 0) {
55766
+ this.checkboxes.forEach(function (po) { return po.model = false; });
55767
+ }
55768
+ this.fromStock = !this.fromStock;
55769
+ if (this.fromStock) {
55770
+ this.selectedForecast = null;
55771
+ }
55772
+ this.formValid = this.fromStock;
55773
+ };
55774
+ DialogDirectSellComponent.prototype.toggleStockChecked = function (event) {
55775
+ var _a;
55776
+ if (this.selectedSupplier && ((_a = this.availableStockCollection.supplierStockForecasts) === null || _a === void 0 ? void 0 : _a.length) > 0) {
55777
+ this.checkboxes.forEach(function (po) { return po.model = false; });
55778
+ }
55779
+ this.formValid = event;
55780
+ };
55781
+ DialogDirectSellComponent.prototype.handleChecked = function (index, selectedForecast, event) {
55782
+ var _a;
55778
55783
  event.preventDefault();
55779
55784
  event.stopPropagation();
55780
- var checkbox = this.checkboxes.toArray()[index];
55781
- checkbox.model = !checkbox.model;
55785
+ if (this.selectedSupplier && ((_a = this.availableStockCollection.supplierStockForecasts) === null || _a === void 0 ? void 0 : _a.length) > 0) {
55786
+ this.checkboxes.forEach(function (po) { return po.model = false; });
55787
+ }
55788
+ var selectedCheckbox = this.checkboxes.toArray()[index];
55789
+ selectedCheckbox.model = !selectedCheckbox.model;
55790
+ if (selectedCheckbox.model) {
55791
+ this.selectedForecast = selectedForecast;
55792
+ }
55793
+ this.fromStock = false;
55794
+ this.formValid = selectedCheckbox.model;
55795
+ };
55796
+ DialogDirectSellComponent.prototype.toggleForecastChecked = function (event) {
55797
+ var _a;
55798
+ if (this.selectedSupplier && ((_a = this.availableStockCollection.supplierStockForecasts) === null || _a === void 0 ? void 0 : _a.length) > 0) {
55799
+ this.checkboxes.forEach(function (po) { return po.model = false; });
55800
+ }
55801
+ this.fromStock = false;
55802
+ this.formValid = event;
55782
55803
  };
55783
55804
  DialogDirectSellComponent.prototype.onOkClick = function () {
55784
55805
  var changeLineDirectSellRequest = {
55785
55806
  transactionUuid: this.transactionUuid,
55786
55807
  lineUuid: this.lineUuid,
55787
- newDirectSell: true
55808
+ newDirectSell: !this.fromStock,
55809
+ newSupplierId: this.selectedSupplier.relationId,
55810
+ newPurchaseOrderNumber: this.fromStock ? null : this.selectedForecast.purchaseOrderNumber.toString(),
55811
+ newStockForecastDeliveryDate: this.fromStock ? null : this.selectedForecast.deliveryDate
55788
55812
  };
55789
- // this.transactionService.changeLineDirectSell(changeLineDirectSellRequest).then((response) => {
55790
- // console.log(response);
55791
- // });
55813
+ this.transactionService.changeLineDirectSell(changeLineDirectSellRequest).then(function (response) {
55814
+ console.log(response);
55815
+ });
55792
55816
  this.hideModal();
55793
55817
  };
55794
55818
  DialogDirectSellComponent.prototype._getAvailableStock = function () {
55795
55819
  return __awaiter(this, void 0, void 0, function () {
55796
- return __generator(this, function (_a) {
55797
- // TODO this method doesn't retrieve any data for now, until we fix ESB instance as this is a call to a third party
55798
- // await this.transactionService.getAvailableStockForSupplier(this.goodId, this.selectedSupplier.relationId).then((availableStock) => {
55799
- // this.availableStockCollection = availableStock;
55800
- // });
55801
- // For now, we will use dummy data
55802
- this.availableStockCollection = this.tempObject;
55803
- return [2 /*return*/];
55820
+ var _this = this;
55821
+ return __generator(this, function (_b) {
55822
+ switch (_b.label) {
55823
+ case 0:
55824
+ // TODO this method doesn't retrieve any data for now, until we fix ESB instance as this is a call to a third party
55825
+ return [4 /*yield*/, this.transactionService.getAvailableStockForSupplier(this.goodId, this.selectedSupplier.relationId).then(function (availableStock) {
55826
+ if (availableStock) {
55827
+ _this.availableStockCollection = availableStock;
55828
+ }
55829
+ })];
55830
+ case 1:
55831
+ // TODO this method doesn't retrieve any data for now, until we fix ESB instance as this is a call to a third party
55832
+ _b.sent();
55833
+ return [2 /*return*/];
55834
+ }
55804
55835
  });
55805
55836
  });
55806
55837
  };
@@ -55808,6 +55839,9 @@
55808
55839
  var _this = this;
55809
55840
  this._relationService.getDirectSellSuppliers().then(function (suppliers) {
55810
55841
  _this.directSellSuppliers = suppliers;
55842
+ if (_this.directSellSuppliers.length === 1) {
55843
+ _this.selectedSupplier = _this.directSellSuppliers[0];
55844
+ }
55811
55845
  });
55812
55846
  };
55813
55847
  return DialogDirectSellComponent;
@@ -55815,7 +55849,7 @@
55815
55849
  DialogDirectSellComponent.decorators = [
55816
55850
  { type: i0.Component, args: [{
55817
55851
  selector: 'co-dialog-sell',
55818
- template: "\n <co-dialog\n class=\"direct-sell-modal\"\n [showCloseIcon]=\"true\"\n [modal]=\"true\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n (closeClick)=\"hideModal()\">\n <div class=\"supplier-list-wrapper flex\">\n <co-list-of-values\n class=\"supplier-list\"\n label=\"Direct Sell Supplier\"\n [required]=\"true\"\n [noClickFocus]=\"true\"\n [searchPlaceholder]=\"'SEARCH' | localize\"\n [collection]=\"directSellSuppliers\"\n [displayField]=\"'supplierName'\"\n [(model)]=\"selectedSupplier\"\n (modelChange)=\"handleSupplierChanged($event)\">\n </co-list-of-values>\n </div>\n\n <div class=\"available-stock checkbox-list-wrapper\" *ngIf=\"selectedSupplier\">\n <div class=\"checkbox-list-item\">\n <div class=\"cell\">\n <div class=\"checkbox-wrapper\">\n <co-input-checkbox [model]=\"false\"></co-input-checkbox>\n </div>\n </div>\n <div class=\"cell\">Uit vooraad</div>\n <div class=\"cell\"><strong>{{availableStockCollection.availableStock}}</strong></div>\n </div>\n </div>\n\n <div class=\"forecast-table\" *ngIf=\"selectedSupplier\">\n <div class=\"forecast-table-header\">\n <div class=\"cell\"></div>\n <div class=\"cell\">Order</div>\n <div class=\"cell\">Beschikbaar</div>\n <div class=\"cell\">Leverdatum</div>\n <div class=\"cell\">Leverdatum Bevestigd</div>\n <div class=\"cell\">Aankomst Datum</div>\n </div>\n\n <div class=\"checkbox-list-wrapper co-small-scrollbar\">\n <div\n *ngFor=\"let row of availableStockCollection.supplierStockForecasts; let i = index\"\n #scrollingItem\n class=\"checkbox-list-item\"\n [class.checked]=\"checkbox.model\"\n (click)=\"handleChecked($event, row, i)\">\n <div class=\"cell\">\n <div class=\"checkbox-wrapper\">\n <co-input-checkbox #checkbox [model]=\"false\"></co-input-checkbox>\n </div>\n </div>\n <div class=\"cell\">{{row.purchaseOrderNumber}}</div>\n <div class=\"cell\">{{row.amount}}</div>\n <div class=\"cell\">{{row.deliveryDate | date}}</div>\n <div class=\"cell\">{{row.confirmedDeliveryDate | date}}</div>\n <div class=\"cell\">{{row.arrivalDate | date}}</div>\n </div>\n </div>\n </div>\n </co-dialog>\n <ng-template #headerTemplate>\n <co-icon [iconData]=\"iconCacheService.getIcon(icons.IndustryRegular)\"></co-icon>\n <div class=\"co-dialog-header-title\" [textContent]=\"'CASH_ON_DELIVERY' | localize\"></div>\n </ng-template>\n <ng-template #footerTemplate>\n <div class=\"co-dialog-footer-button-wrapper\">\n <co-button\n class=\"save-button\"\n [disabled]=\"true\"\n [iconData]=\"iconCacheService.getIcon(icons.CheckDuotone)\"\n (click)=\"onOkClick()\">\n </co-button>\n <co-button\n class=\"close-button\"\n [iconData]=\"iconCacheService.getIcon(icons.Crossskinny)\"\n (click)=\"hideModal()\">\n </co-button>\n <co-button\n class=\"close-button\"\n [iconData]=\"iconCacheService.getIcon(icons.TrashCanLight)\"\n (click)=\"hideModal()\">\n </co-button>\n </div>\n </ng-template>\n ",
55852
+ template: "\n <co-dialog\n class=\"direct-sell-modal\"\n [showCloseIcon]=\"true\"\n [modal]=\"true\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n (closeClick)=\"hideModal()\">\n <div class=\"supplier-list-wrapper flex\">\n <co-list-of-values\n class=\"supplier-list\"\n [label]=\"'FROM_SUPPLIER' | localize\"\n [required]=\"true\"\n [noClickFocus]=\"true\"\n [searchPlaceholder]=\"'SEARCH' | localize\"\n [collection]=\"directSellSuppliers\"\n [displayField]=\"'supplierName'\"\n [(model)]=\"selectedSupplier\"\n (modelChange)=\"handleSupplierChanged()\">\n </co-list-of-values>\n </div>\n\n <div class=\"available-stock checkbox-list-wrapper\" *ngIf=\"selectedSupplier\">\n <div\n class=\"checkbox-list-item\"\n [class.checked]=\"fromStock\"\n (click)=\"onStockChecked($event)\">\n <div class=\"cell\">\n <div class=\"checkbox-wrapper\">\n <co-input-checkbox\n [(model)]=\"fromStock\"\n (modelChange)=\"toggleStockChecked($event)\">\n </co-input-checkbox>\n </div>\n </div>\n <div class=\"cell\">Uit vooraad</div>\n <div class=\"cell\"><strong>{{ availableStockCollection.availableStock }}</strong></div>\n </div>\n </div>\n\n <div class=\"forecast-table\"\n *ngIf=\"selectedSupplier && availableStockCollection.supplierStockForecasts?.length > 0\">\n <div class=\"forecast-table-header\">\n <div class=\"cell\"></div>\n <div class=\"cell\">Order</div>\n <div class=\"cell\">Beschikbaar</div>\n <div class=\"cell\">Leverdatum</div>\n <div class=\"cell\">Leverdatum Bevestigd</div>\n <div class=\"cell\">Aankomst Datum</div>\n </div>\n\n <div class=\"checkbox-list-wrapper co-small-scrollbar\">\n <div\n *ngFor=\"let row of availableStockCollection.supplierStockForecasts; let i = index\"\n #scrollingItem\n class=\"checkbox-list-item\"\n [class.checked]=\"checkbox.model\"\n (click)=\"handleChecked(i, row, $event)\">\n <div class=\"cell\">\n <div class=\"checkbox-wrapper\">\n <co-input-checkbox\n #checkbox\n [(model)]=\"checkbox.model\"\n (modelChange)=\"toggleForecastChecked($event)\">\n </co-input-checkbox>\n </div>\n </div>\n <div class=\"cell\">{{ row.purchaseOrderNumber }}</div>\n <div class=\"cell\">{{ row.amount }}</div>\n <div class=\"cell\">{{ row.deliveryDate | date }}</div>\n <div class=\"cell\">{{ row.confirmedDeliveryDate | date }}</div>\n <div class=\"cell\">{{ row.arrivalDate | date }}</div>\n </div>\n </div>\n </div>\n </co-dialog>\n <ng-template #headerTemplate>\n <co-icon [iconData]=\"iconCacheService.getIcon(icons.IndustryRegular)\"></co-icon>\n <div class=\"co-dialog-header-title\" [textContent]=\"'DIRECT_SELL' | localize\"></div>\n </ng-template>\n <ng-template #footerTemplate>\n <div class=\"co-dialog-footer-button-wrapper\">\n <co-button\n class=\"save-button\"\n [disabled]=\"!formValid\"\n [iconData]=\"iconCacheService.getIcon(icons.CheckDuotone)\"\n (click)=\"onOkClick()\">\n </co-button>\n <co-button\n class=\"close-button\"\n [iconData]=\"iconCacheService.getIcon(icons.Crossskinny)\"\n (click)=\"hideModal()\">\n </co-button>\n </div>\n </ng-template>\n ",
55819
55853
  encapsulation: i0.ViewEncapsulation.None
55820
55854
  },] }
55821
55855
  ];