@senior-agronegocio/angular-components 0.0.9883 → 0.0.9885
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.
- package/bundles/senior-agronegocio-angular-components.umd.js +124 -66
- package/bundles/senior-agronegocio-angular-components.umd.js.map +1 -1
- package/bundles/senior-agronegocio-angular-components.umd.min.js +2 -2
- package/bundles/senior-agronegocio-angular-components.umd.min.js.map +1 -1
- package/components/modal-invoice-pj/for-fixation/modal-invoice-pj-for-fixation.component.d.ts +6 -5
- package/components/modal-invoice-pj/modal-shared-imports.d.ts +4 -7
- package/components/modal-invoice-pj/services/agro-invoice/interfaces.d.ts +2 -1
- package/components/modal-invoice-pj/services/producer-invoice-fixation/producer-invoice-dto.d.ts +15 -0
- package/components/modal-invoice-pj/services/producer-invoice-fixation/producer-invoice.service.d.ts +18 -0
- package/esm2015/components/event-control-board/event-control-board.component.js +2 -1
- package/esm2015/components/modal-invoice-pj/for-fixation/modal-invoice-pj-for-fixation.component.js +43 -25
- package/esm2015/components/modal-invoice-pj/modal-invoice-pj-base.class.js +9 -4
- package/esm2015/components/modal-invoice-pj/services/agro-invoice/interfaces.js +1 -1
- package/esm2015/components/modal-invoice-pj/services/producer-invoice-fixation/producer-invoice-dto.js +1 -0
- package/esm2015/components/modal-invoice-pj/services/producer-invoice-fixation/producer-invoice.service.js +63 -0
- package/esm2015/services/i18n/pt-BR.js +2 -2
- package/esm2015/services/producer-invoice/producer-invoice.service.js +4 -37
- package/esm5/components/event-control-board/event-control-board.component.js +2 -1
- package/esm5/components/modal-invoice-pj/for-fixation/modal-invoice-pj-for-fixation.component.js +52 -28
- package/esm5/components/modal-invoice-pj/modal-invoice-pj-base.class.js +15 -4
- package/esm5/components/modal-invoice-pj/services/agro-invoice/interfaces.js +1 -1
- package/esm5/components/modal-invoice-pj/services/producer-invoice-fixation/producer-invoice-dto.js +1 -0
- package/esm5/components/modal-invoice-pj/services/producer-invoice-fixation/producer-invoice.service.js +71 -0
- package/esm5/services/i18n/pt-BR.js +2 -2
- package/esm5/services/producer-invoice/producer-invoice.service.js +4 -42
- package/fesm2015/senior-agronegocio-angular-components.js +101 -58
- package/fesm2015/senior-agronegocio-angular-components.js.map +1 -1
- package/fesm5/senior-agronegocio-angular-components.js +124 -66
- package/fesm5/senior-agronegocio-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/services/producer-invoice/producer-invoice.service.d.ts +1 -4
|
@@ -815,7 +815,7 @@ var ptBR = {
|
|
|
815
815
|
"agro.angular_components.ORIGINATION_CREATE_EFFECTIVE_BALANCE": "Emissão de saldo efetivo",
|
|
816
816
|
"agro.angular_components.PRODUCER_NET_VALUE_EFFECTIVE_BALANCE_CONFIRMATION": "Confirmação de saldo efetivo",
|
|
817
817
|
"agro.angular_components.CLOSE_INVOICE_FIXATION": "Fechamento de NF",
|
|
818
|
-
"agro.angular_components.INVOICE_CLOSE_INVOICE": "
|
|
818
|
+
"agro.angular_components.INVOICE_CLOSE_INVOICE": "Fechamento de NF",
|
|
819
819
|
"agro.angular_components.ORIGINATION_CREATE_EFFECTIVE_CONFIRMATION": "Confirmação efetiva",
|
|
820
820
|
"agro.angular_components.ORIGINATION_CREATE_PROVISIONAL_BALANCE": "Saldo provisório",
|
|
821
821
|
"agro.angular_components.CLOSE_INVOICE_TRANSFER": "Fechamento de NF",
|
|
@@ -5602,43 +5602,6 @@ var ProducerInvoiceService = /** @class */ (function (_super) {
|
|
|
5602
5602
|
_this.translate = translate;
|
|
5603
5603
|
return _this;
|
|
5604
5604
|
}
|
|
5605
|
-
ProducerInvoiceService.prototype.getTotalLinkedInInvoices = function (invoiceId, fixationId) {
|
|
5606
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5607
|
-
var filter;
|
|
5608
|
-
var _this = this;
|
|
5609
|
-
return __generator(this, function (_a) {
|
|
5610
|
-
filter = "fixationItem.fixation.id eq '" + fixationId + "' " + ("and invoiceId in ('" + invoiceId.join("','") + "') ");
|
|
5611
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
5612
|
-
_this.list({
|
|
5613
|
-
filterQuery: filter,
|
|
5614
|
-
size: AGRO_NUMBERS.ONE_HUNDRED,
|
|
5615
|
-
}).subscribe({
|
|
5616
|
-
next: function (data) {
|
|
5617
|
-
var invoiceList = data.contents;
|
|
5618
|
-
var producerInvoice = new Map();
|
|
5619
|
-
if (invoiceList.length) {
|
|
5620
|
-
invoiceList.forEach(function (invoice) {
|
|
5621
|
-
var _a;
|
|
5622
|
-
producerInvoice.set(invoice.invoiceId, ((_a = producerInvoice.get(invoice.invoiceId)) !== null && _a !== void 0 ? _a : 0) + invoice.linkedValue);
|
|
5623
|
-
});
|
|
5624
|
-
}
|
|
5625
|
-
resolve(Array.from(producerInvoice.entries()).map(function (_a) {
|
|
5626
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
5627
|
-
return {
|
|
5628
|
-
invoiceId: key,
|
|
5629
|
-
totalLinked: value,
|
|
5630
|
-
};
|
|
5631
|
-
}));
|
|
5632
|
-
},
|
|
5633
|
-
error: function (err) { return reject(new Error(typeof err === 'string' ? err : JSON.stringify(err))); },
|
|
5634
|
-
});
|
|
5635
|
-
})];
|
|
5636
|
-
});
|
|
5637
|
-
});
|
|
5638
|
-
};
|
|
5639
|
-
ProducerInvoiceService.prototype.deleteAllProducerInvoice = function (fixationId) {
|
|
5640
|
-
return this.http.post(this.actionsUrl + "/deleteAllProducerInvoice", { fixationId: fixationId }).pipe(this.defaultCatch());
|
|
5641
|
-
};
|
|
5642
5605
|
ProducerInvoiceService.ctorParameters = function () { return [
|
|
5643
5606
|
{ type: HttpClient },
|
|
5644
5607
|
{ type: MessageService },
|
|
@@ -6427,6 +6390,7 @@ var EventControlBoardComponent = /** @class */ (function () {
|
|
|
6427
6390
|
EventControlBoardComponent.prototype.getEventLabel = function (detail) {
|
|
6428
6391
|
var _a;
|
|
6429
6392
|
var eventLabel = (_a = this.eventItem.find(function (e) { return e.value === detail.eventOperation; })) === null || _a === void 0 ? void 0 : _a.label;
|
|
6393
|
+
console.log('Getting label for event operation:', eventLabel);
|
|
6430
6394
|
if (eventLabel) {
|
|
6431
6395
|
return this.translate.instant(eventLabel);
|
|
6432
6396
|
}
|
|
@@ -7603,6 +7567,7 @@ var ModalInvoicePjBase = /** @class */ (function () {
|
|
|
7603
7567
|
this.gridLoading = true;
|
|
7604
7568
|
this.dontHaveAnyInvoice = false;
|
|
7605
7569
|
this.updateCurrentParams(event);
|
|
7570
|
+
var numberSearchValue = searchValue ? AgroNumberUtils.getNearInteger(searchValue) : null;
|
|
7606
7571
|
var filterBody = {
|
|
7607
7572
|
filter: {
|
|
7608
7573
|
companyId: companyId,
|
|
@@ -7611,6 +7576,7 @@ var ModalInvoicePjBase = /** @class */ (function () {
|
|
|
7611
7576
|
ruralEstateIds: [ruralEstateId],
|
|
7612
7577
|
multiProducts: false,
|
|
7613
7578
|
productId: this.options.productId,
|
|
7579
|
+
number: numberSearchValue,
|
|
7614
7580
|
},
|
|
7615
7581
|
pageRequest: {
|
|
7616
7582
|
offset: this.currentParams.page,
|
|
@@ -7622,11 +7588,20 @@ var ModalInvoicePjBase = /** @class */ (function () {
|
|
|
7622
7588
|
},
|
|
7623
7589
|
};
|
|
7624
7590
|
if (searchValue) {
|
|
7625
|
-
searchValue =
|
|
7591
|
+
searchValue = numberSearchValue.toString();
|
|
7626
7592
|
}
|
|
7627
7593
|
this.invoiceService
|
|
7628
7594
|
.invoiceLookupFilter(filterBody)
|
|
7629
|
-
.pipe(takeUntil(this.ngUnsubscribe),
|
|
7595
|
+
.pipe(takeUntil(this.ngUnsubscribe), switchMap(function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
7596
|
+
return __generator(this, function (_a) {
|
|
7597
|
+
switch (_a.label) {
|
|
7598
|
+
case 0: return [4 /*yield*/, this.adaptResult(result)];
|
|
7599
|
+
case 1:
|
|
7600
|
+
_a.sent();
|
|
7601
|
+
return [2 /*return*/, result];
|
|
7602
|
+
}
|
|
7603
|
+
});
|
|
7604
|
+
}); }), finalize(function () {
|
|
7630
7605
|
_this.gridLoading = false;
|
|
7631
7606
|
}))
|
|
7632
7607
|
.subscribe(function (result) {
|
|
@@ -7859,6 +7834,66 @@ var ModalInvoicePjForTransferModule = /** @class */ (function () {
|
|
|
7859
7834
|
return ModalInvoicePjForTransferModule;
|
|
7860
7835
|
}());
|
|
7861
7836
|
|
|
7837
|
+
var ProducerInvoiceService$1 = /** @class */ (function (_super) {
|
|
7838
|
+
__extends(ProducerInvoiceService, _super);
|
|
7839
|
+
function ProducerInvoiceService(http, messageService, translate) {
|
|
7840
|
+
var _this = _super.call(this, http, messageService, "agro/fixation/entities/producerInvoice", "agro/fixation/actions", "agro/fixation/queries", translate) || this;
|
|
7841
|
+
_this.http = http;
|
|
7842
|
+
_this.messageService = messageService;
|
|
7843
|
+
_this.translate = translate;
|
|
7844
|
+
return _this;
|
|
7845
|
+
}
|
|
7846
|
+
ProducerInvoiceService.prototype.getTotalLinkedInInvoices = function (invoiceId, fixationId) {
|
|
7847
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7848
|
+
var filter;
|
|
7849
|
+
var _this = this;
|
|
7850
|
+
return __generator(this, function (_a) {
|
|
7851
|
+
filter = "fixationItem.fixation.id eq '" + fixationId + "' " + ("and externalInvoiceId in ('" + invoiceId.join("','") + "') ");
|
|
7852
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
7853
|
+
_this.list({
|
|
7854
|
+
filterQuery: filter,
|
|
7855
|
+
size: 100
|
|
7856
|
+
}).subscribe({
|
|
7857
|
+
next: function (data) {
|
|
7858
|
+
var invoiceList = data.contents;
|
|
7859
|
+
var producerInvoice = new Map();
|
|
7860
|
+
if (invoiceList.length) {
|
|
7861
|
+
invoiceList.forEach(function (invoice) {
|
|
7862
|
+
var _a;
|
|
7863
|
+
producerInvoice.set(invoice.invoiceId, ((_a = producerInvoice.get(invoice.invoiceId)) !== null && _a !== void 0 ? _a : 0) + invoice.linkedValue);
|
|
7864
|
+
});
|
|
7865
|
+
}
|
|
7866
|
+
resolve(Array.from(producerInvoice.entries()).map(function (_a) {
|
|
7867
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
7868
|
+
return {
|
|
7869
|
+
invoiceId: key,
|
|
7870
|
+
totalLinked: value
|
|
7871
|
+
};
|
|
7872
|
+
}));
|
|
7873
|
+
},
|
|
7874
|
+
error: function (err) { return reject(err instanceof Error ? err : new Error(String(err))); }
|
|
7875
|
+
});
|
|
7876
|
+
})];
|
|
7877
|
+
});
|
|
7878
|
+
});
|
|
7879
|
+
};
|
|
7880
|
+
ProducerInvoiceService.prototype.deleteAllProducerInvoice = function (fixationId) {
|
|
7881
|
+
return this.http.post(this.actionsUrl + "/deleteAllProducerInvoice", { fixationId: fixationId }).pipe(this.defaultCatch());
|
|
7882
|
+
};
|
|
7883
|
+
ProducerInvoiceService.ctorParameters = function () { return [
|
|
7884
|
+
{ type: HttpClient },
|
|
7885
|
+
{ type: MessageService },
|
|
7886
|
+
{ type: LibTranslationService }
|
|
7887
|
+
]; };
|
|
7888
|
+
ProducerInvoiceService.ɵprov = ɵɵdefineInjectable({ factory: function ProducerInvoiceService_Factory() { return new ProducerInvoiceService(ɵɵinject(HttpClient), ɵɵinject(MessageService), ɵɵinject(LibTranslationService)); }, token: ProducerInvoiceService, providedIn: "root" });
|
|
7889
|
+
ProducerInvoiceService = __decorate([
|
|
7890
|
+
Injectable({
|
|
7891
|
+
providedIn: 'root'
|
|
7892
|
+
})
|
|
7893
|
+
], ProducerInvoiceService);
|
|
7894
|
+
return ProducerInvoiceService;
|
|
7895
|
+
}(AgroEntityService));
|
|
7896
|
+
|
|
7862
7897
|
var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
7863
7898
|
__extends(ModalInvoicePjForFixationComponent, _super);
|
|
7864
7899
|
function ModalInvoicePjForFixationComponent(translationService, invoiceService, localeService, kilogramPipe, currencyPipe, producerInvoiceService, messageService, datePipe) {
|
|
@@ -7872,12 +7907,17 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
7872
7907
|
_this.messageService = messageService;
|
|
7873
7908
|
_this.datePipe = datePipe;
|
|
7874
7909
|
_this.whenSelectInvoices = new EventEmitter();
|
|
7910
|
+
registerLocaleData(localePt);
|
|
7875
7911
|
return _this;
|
|
7876
7912
|
}
|
|
7877
7913
|
ModalInvoicePjForFixationComponent.prototype.ngOnInit = function () {
|
|
7878
7914
|
var _this = this;
|
|
7879
7915
|
this.defineGridColumns();
|
|
7880
|
-
this.gridFieldValuesMap = __assign(__assign({}, this.gridFieldValuesMap), { series: function (row) { return (row === null || row === void 0 ? void 0 : row.seriesLegal) || (row === null || row === void 0 ? void 0 : row.series) || row.series; }, totalValue: function (row) {
|
|
7916
|
+
this.gridFieldValuesMap = __assign(__assign({}, this.gridFieldValuesMap), { series: function (row) { return (row === null || row === void 0 ? void 0 : row.seriesLegal) || (row === null || row === void 0 ? void 0 : row.series) || row.series; }, totalValue: function (row) {
|
|
7917
|
+
return _this.currencyPipe.transform(_this.getTotalValue(row) || 0, 'BRL', 'symbol', undefined, 'pt-BR');
|
|
7918
|
+
}, linkedValue: function (row) {
|
|
7919
|
+
return _this.currencyPipe.transform((row === null || row === void 0 ? void 0 : row.linkedValue) || 0, 'BRL', 'symbol', undefined, 'pt-BR');
|
|
7920
|
+
} });
|
|
7881
7921
|
_super.prototype.ngOnInit.call(this);
|
|
7882
7922
|
};
|
|
7883
7923
|
ModalInvoicePjForFixationComponent.prototype.defineGridColumns = function () {
|
|
@@ -7899,7 +7939,7 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
7899
7939
|
};
|
|
7900
7940
|
ModalInvoicePjForFixationComponent.prototype.beforeAdd = function (selectedInvoices) {
|
|
7901
7941
|
if (selectedInvoices === null || selectedInvoices === void 0 ? void 0 : selectedInvoices.length) {
|
|
7902
|
-
this.linkSelectedInvoicesInFixationItem();
|
|
7942
|
+
this.linkSelectedInvoicesInFixationItem(selectedInvoices);
|
|
7903
7943
|
}
|
|
7904
7944
|
return of(EMPTY).toPromise();
|
|
7905
7945
|
};
|
|
@@ -7914,20 +7954,20 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
7914
7954
|
}
|
|
7915
7955
|
_super.prototype.open.call(this);
|
|
7916
7956
|
};
|
|
7917
|
-
ModalInvoicePjForFixationComponent.prototype.linkSelectedInvoicesInFixationItem = function () {
|
|
7957
|
+
ModalInvoicePjForFixationComponent.prototype.linkSelectedInvoicesInFixationItem = function (selectedInvoices) {
|
|
7918
7958
|
return __awaiter(this, void 0, void 0, function () {
|
|
7919
7959
|
var entities;
|
|
7920
7960
|
var _this = this;
|
|
7921
7961
|
return __generator(this, function (_a) {
|
|
7922
7962
|
switch (_a.label) {
|
|
7923
|
-
case 0: return [4 /*yield*/, this.isValidAndSetLinkedValueInInvoices()];
|
|
7963
|
+
case 0: return [4 /*yield*/, this.isValidAndSetLinkedValueInInvoices(selectedInvoices)];
|
|
7924
7964
|
case 1:
|
|
7925
7965
|
if (!(_a.sent())) {
|
|
7926
7966
|
this.gridLoading = false;
|
|
7927
7967
|
return [2 /*return*/];
|
|
7928
7968
|
}
|
|
7929
7969
|
entities = []
|
|
7930
|
-
.concat.apply([], __spread(
|
|
7970
|
+
.concat.apply([], __spread(selectedInvoices.map(function (invoice) {
|
|
7931
7971
|
return _this.options.fixationItems.map(function (fixationItem) {
|
|
7932
7972
|
var requiredValue = (fixationItem.requiredValue || 0) - (fixationItem.totalValueInvoices || 0);
|
|
7933
7973
|
if (invoice.remainingValue <= 0 || requiredValue <= 0) {
|
|
@@ -7938,11 +7978,11 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
7938
7978
|
var body = {
|
|
7939
7979
|
series: invoice === null || invoice === void 0 ? void 0 : invoice.series,
|
|
7940
7980
|
number: String(invoice === null || invoice === void 0 ? void 0 : invoice.number),
|
|
7941
|
-
|
|
7981
|
+
externalInvoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.externalInvoiceId,
|
|
7942
7982
|
linkedValue: valueToBeLinked,
|
|
7943
|
-
totalValue: invoice
|
|
7983
|
+
totalValue: _this.getTotalValue(invoice),
|
|
7944
7984
|
issuanceDate: invoice === null || invoice === void 0 ? void 0 : invoice.issuanceDate,
|
|
7945
|
-
fixationItem: fixationItem,
|
|
7985
|
+
fixationItem: { id: fixationItem === null || fixationItem === void 0 ? void 0 : fixationItem.id },
|
|
7946
7986
|
};
|
|
7947
7987
|
fixationItem.totalValueInvoices = (fixationItem.totalValueInvoices || 0) + valueToBeLinked;
|
|
7948
7988
|
return body;
|
|
@@ -7968,19 +8008,25 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
7968
8008
|
});
|
|
7969
8009
|
});
|
|
7970
8010
|
};
|
|
7971
|
-
ModalInvoicePjForFixationComponent.prototype.isValidAndSetLinkedValueInInvoices = function () {
|
|
8011
|
+
ModalInvoicePjForFixationComponent.prototype.isValidAndSetLinkedValueInInvoices = function (selectedInvoices) {
|
|
7972
8012
|
return __awaiter(this, void 0, void 0, function () {
|
|
7973
8013
|
var valorLinked, isValid;
|
|
7974
8014
|
var _this = this;
|
|
7975
8015
|
return __generator(this, function (_a) {
|
|
7976
8016
|
switch (_a.label) {
|
|
7977
|
-
case 0: return [4 /*yield*/, this.producerInvoiceService.getTotalLinkedInInvoices(
|
|
8017
|
+
case 0: return [4 /*yield*/, this.producerInvoiceService.getTotalLinkedInInvoices(selectedInvoices.map(function (invoice) { return invoice.externalInvoiceId; }), this.options.fixationId)];
|
|
7978
8018
|
case 1:
|
|
7979
8019
|
valorLinked = _a.sent();
|
|
8020
|
+
selectedInvoices.forEach(function (invoice) {
|
|
8021
|
+
if (!invoice.totalValue) {
|
|
8022
|
+
invoice.totalValue = _this.getTotalValue(invoice);
|
|
8023
|
+
}
|
|
8024
|
+
});
|
|
7980
8025
|
isValid = true;
|
|
7981
|
-
|
|
8026
|
+
selectedInvoices.forEach(function (invoice) {
|
|
7982
8027
|
var _a;
|
|
7983
|
-
invoice.linkedValue =
|
|
8028
|
+
invoice.linkedValue =
|
|
8029
|
+
((_a = valorLinked.find(function (linked) { return linked.externalInvoiceId === invoice.externalInvoiceId; })) === null || _a === void 0 ? void 0 : _a.totalLinked) || 0;
|
|
7984
8030
|
if (invoice.linkedValue >= invoice.totalValue) {
|
|
7985
8031
|
_this.messageService.add({
|
|
7986
8032
|
severity: 'warn',
|
|
@@ -7997,9 +8043,13 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
7997
8043
|
});
|
|
7998
8044
|
};
|
|
7999
8045
|
ModalInvoicePjForFixationComponent.prototype.adaptResult = function (result) {
|
|
8046
|
+
var _a;
|
|
8000
8047
|
return __awaiter(this, void 0, void 0, function () {
|
|
8001
|
-
return __generator(this, function (
|
|
8002
|
-
|
|
8048
|
+
return __generator(this, function (_b) {
|
|
8049
|
+
switch (_b.label) {
|
|
8050
|
+
case 0: return [4 /*yield*/, this.updateLinkedValueInGrid(((_a = result === null || result === void 0 ? void 0 : result.result) === null || _a === void 0 ? void 0 : _a.invoices) || [])];
|
|
8051
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
8052
|
+
}
|
|
8003
8053
|
});
|
|
8004
8054
|
});
|
|
8005
8055
|
};
|
|
@@ -8007,21 +8057,20 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
8007
8057
|
this.options.fixationItems = [];
|
|
8008
8058
|
return _super.prototype.cancel.call(this);
|
|
8009
8059
|
};
|
|
8010
|
-
ModalInvoicePjForFixationComponent.prototype.updateLinkedValueInGrid = function (
|
|
8060
|
+
ModalInvoicePjForFixationComponent.prototype.updateLinkedValueInGrid = function (result) {
|
|
8011
8061
|
return __awaiter(this, void 0, void 0, function () {
|
|
8012
|
-
var
|
|
8013
|
-
var _this = this;
|
|
8062
|
+
var externalInvoiceId, filter, listParams;
|
|
8014
8063
|
return __generator(this, function (_a) {
|
|
8015
8064
|
switch (_a.label) {
|
|
8016
8065
|
case 0:
|
|
8017
|
-
|
|
8066
|
+
externalInvoiceId = result.map(function (invoice) { return invoice.externalInvoiceId; });
|
|
8018
8067
|
filter = "fixationItem.fixation.id eq '" + this.options.fixationId + "'";
|
|
8019
|
-
if (
|
|
8020
|
-
filter += "and
|
|
8068
|
+
if (externalInvoiceId && externalInvoiceId.length > 0) {
|
|
8069
|
+
filter += "and externalInvoiceId in ('" + externalInvoiceId.join("','") + "') ";
|
|
8021
8070
|
}
|
|
8022
8071
|
listParams = {
|
|
8023
8072
|
page: 0,
|
|
8024
|
-
size:
|
|
8073
|
+
size: result.length,
|
|
8025
8074
|
filterQuery: filter,
|
|
8026
8075
|
};
|
|
8027
8076
|
return [4 /*yield*/, this.producerInvoiceService
|
|
@@ -8030,10 +8079,11 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
8030
8079
|
.toPromise()
|
|
8031
8080
|
.then(function (producerInvoices) {
|
|
8032
8081
|
producerInvoices === null || producerInvoices === void 0 ? void 0 : producerInvoices.contents.forEach(function (invoice) {
|
|
8033
|
-
var
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8082
|
+
var _a;
|
|
8083
|
+
(_a = result
|
|
8084
|
+
.filter(function (item) { return item.externalInvoiceId === invoice.externalInvoiceId; })) === null || _a === void 0 ? void 0 : _a.forEach(function (linkedInvoice) {
|
|
8085
|
+
linkedInvoice.linkedValue = invoice.linkedValue;
|
|
8086
|
+
});
|
|
8037
8087
|
});
|
|
8038
8088
|
})];
|
|
8039
8089
|
case 1:
|
|
@@ -8043,13 +8093,21 @@ var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
|
8043
8093
|
});
|
|
8044
8094
|
});
|
|
8045
8095
|
};
|
|
8096
|
+
ModalInvoicePjForFixationComponent.prototype.getTotalValue = function (row) {
|
|
8097
|
+
var netTotalValue = row === null || row === void 0 ? void 0 : row.netTotalValue;
|
|
8098
|
+
if (netTotalValue) {
|
|
8099
|
+
return netTotalValue;
|
|
8100
|
+
}
|
|
8101
|
+
var items = (row === null || row === void 0 ? void 0 : row.items) || [];
|
|
8102
|
+
return items.reduce(function (total, item) { return total + (item.unitPrice || 0) * (item.quantity || 0); }, 0);
|
|
8103
|
+
};
|
|
8046
8104
|
ModalInvoicePjForFixationComponent.ctorParameters = function () { return [
|
|
8047
8105
|
{ type: LibTranslationService },
|
|
8048
8106
|
{ type: AgroInvoiceService },
|
|
8049
8107
|
{ type: LocaleService },
|
|
8050
8108
|
{ type: KilogramPipe },
|
|
8051
8109
|
{ type: CurrencyPipe },
|
|
8052
|
-
{ type: ProducerInvoiceService },
|
|
8110
|
+
{ type: ProducerInvoiceService$1 },
|
|
8053
8111
|
{ type: MessageService$1 },
|
|
8054
8112
|
{ type: DatePipe }
|
|
8055
8113
|
]; };
|