@senior-agronegocio/angular-components 0.0.9884 → 0.0.9886
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 +182 -130
- 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/event-control-board/common/event-control-constants.d.ts +2 -8
- package/components/event-control-board/event-control-board.component.d.ts +3 -0
- package/components/event-control-board/service/rural-estate/rural-estate.d.ts +0 -2
- package/components/modal-invoice-pj/for-fixation/modal-invoice-pj-for-fixation.component.d.ts +6 -5
- 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/common/event-control-constants.js +1 -7
- package/esm2015/components/event-control-board/event-control-board.component.js +49 -46
- package/esm2015/components/event-control-board/service/rural-estate/rural-estate.js +1 -10
- package/esm2015/components/modal-invoice-pj/for-fixation/modal-invoice-pj-for-fixation.component.js +44 -26
- package/esm2015/components/modal-invoice-pj/for-origination/modal-invoice-pj-for-origination.component.js +2 -2
- package/esm2015/components/modal-invoice-pj/for-transfer/modal-invoice-pj-for-transfer.component.js +2 -2
- package/esm2015/components/modal-invoice-pj/modal-invoice-pj-base.class.js +10 -5
- 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/en-US.js +2 -1
- package/esm2015/services/i18n/es-CO.js +2 -1
- package/esm2015/services/i18n/pt-BR.js +6 -4
- package/esm2015/services/producer-invoice/producer-invoice.service.js +4 -37
- package/esm5/components/event-control-board/common/event-control-constants.js +1 -7
- package/esm5/components/event-control-board/event-control-board.component.js +50 -47
- package/esm5/components/event-control-board/service/rural-estate/rural-estate.js +1 -10
- package/esm5/components/modal-invoice-pj/for-fixation/modal-invoice-pj-for-fixation.component.js +53 -29
- package/esm5/components/modal-invoice-pj/for-origination/modal-invoice-pj-for-origination.component.js +2 -2
- package/esm5/components/modal-invoice-pj/for-transfer/modal-invoice-pj-for-transfer.component.js +2 -2
- package/esm5/components/modal-invoice-pj/modal-invoice-pj-base.class.js +16 -5
- 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/en-US.js +2 -1
- package/esm5/services/i18n/es-CO.js +2 -1
- package/esm5/services/i18n/pt-BR.js +6 -4
- package/esm5/services/producer-invoice/producer-invoice.service.js +4 -42
- package/fesm2015/senior-agronegocio-angular-components.js +158 -121
- package/fesm2015/senior-agronegocio-angular-components.js.map +1 -1
- package/fesm5/senior-agronegocio-angular-components.js +182 -130
- package/fesm5/senior-agronegocio-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/services/i18n/en-US.d.ts +1 -0
- package/services/i18n/es-CO.d.ts +1 -0
- package/services/i18n/pt-BR.d.ts +1 -0
- package/services/producer-invoice/producer-invoice.service.d.ts +1 -4
- package/components/event-control-board/common/input-fields.d.ts +0 -5
- package/esm2015/components/event-control-board/common/input-fields.js +0 -7
- package/esm5/components/event-control-board/common/input-fields.js +0 -7
|
@@ -750,6 +750,7 @@
|
|
|
750
750
|
return WebsocketModule;
|
|
751
751
|
}());
|
|
752
752
|
|
|
753
|
+
var INVOICE_CLOSING = "Fechamento de NF";
|
|
753
754
|
var ptBR = {
|
|
754
755
|
"agro.angular_components.table_empty_description": "Altere os filtros acima para gerar outros resultados de busca",
|
|
755
756
|
"agro.angular_components.nothing_found": "Nenhum registro encontrado",
|
|
@@ -773,6 +774,7 @@
|
|
|
773
774
|
"agro.angular_components.change_request_event_summary": "Alteração de \nPesagem",
|
|
774
775
|
"agro.angular_components.ticket_maintenance_header": "Manutenção de ticket",
|
|
775
776
|
"agro.angular_components.invoice_creating_event": "Emissão de NF",
|
|
777
|
+
"agro.angular_components.invoice_close_event": INVOICE_CLOSING,
|
|
776
778
|
"agro.angular_components.balance_entry_control_event": "Entrada/saída balança",
|
|
777
779
|
"agro.angular_components.event_origin_label": "Origem do evento",
|
|
778
780
|
"agro.angular_components.event_details_header": "Detalhes do Evento",
|
|
@@ -990,11 +992,11 @@
|
|
|
990
992
|
"agro.angular_components.ORIGINATION_CREATE_INVOICE": "Emissão de NF",
|
|
991
993
|
"agro.angular_components.ORIGINATION_CREATE_EFFECTIVE_BALANCE": "Emissão de saldo efetivo",
|
|
992
994
|
"agro.angular_components.PRODUCER_NET_VALUE_EFFECTIVE_BALANCE_CONFIRMATION": "Confirmação de saldo efetivo",
|
|
993
|
-
"agro.angular_components.CLOSE_INVOICE_FIXATION":
|
|
994
|
-
"agro.angular_components.INVOICE_CLOSE_INVOICE":
|
|
995
|
+
"agro.angular_components.CLOSE_INVOICE_FIXATION": INVOICE_CLOSING,
|
|
996
|
+
"agro.angular_components.INVOICE_CLOSE_INVOICE": INVOICE_CLOSING,
|
|
995
997
|
"agro.angular_components.ORIGINATION_CREATE_EFFECTIVE_CONFIRMATION": "Confirmação efetiva",
|
|
996
998
|
"agro.angular_components.ORIGINATION_CREATE_PROVISIONAL_BALANCE": "Saldo provisório",
|
|
997
|
-
"agro.angular_components.CLOSE_INVOICE_TRANSFER":
|
|
999
|
+
"agro.angular_components.CLOSE_INVOICE_TRANSFER": INVOICE_CLOSING,
|
|
998
1000
|
"agro.angular_components.REOPEN_INVOICE_TRANSFER": "Reabertura da NF",
|
|
999
1001
|
"agro.angular_components.TRANSFER_CREATE_FINANCIAL_TITLE": "Criação de título financeiro",
|
|
1000
1002
|
"agro.angular_components.TRANSFER_CANCEL_FINANCIAL_TITLE": "Cancelamento de título financeiro",
|
|
@@ -1094,6 +1096,7 @@
|
|
|
1094
1096
|
"agro.angular_components.change_request_event_summary": "Weight Change",
|
|
1095
1097
|
"agro.angular_components.ticket_maintenance_header": "Ticket Maintenance",
|
|
1096
1098
|
"agro.angular_components.invoice_creating_event": "Invoice Issuance",
|
|
1099
|
+
"agro.angular_components.invoice_close_event": "Invoice Closing",
|
|
1097
1100
|
"agro.angular_components.balance_entry_control_event": "Balance Entry/Exit",
|
|
1098
1101
|
"agro.angular_components.event_origin_label": "Event origin",
|
|
1099
1102
|
"agro.angular_components.event_details_header": "Event Details",
|
|
@@ -1415,6 +1418,7 @@
|
|
|
1415
1418
|
"agro.angular_components.change_request_event_summary": "Cambio de \nPesaje",
|
|
1416
1419
|
"agro.angular_components.ticket_maintenance_header": "Mantenimiento de ticket",
|
|
1417
1420
|
"agro.angular_components.invoice_creating_event": "Emisión de Factura",
|
|
1421
|
+
"agro.angular_components.invoice_close_event": "Cierre de Factura",
|
|
1418
1422
|
"agro.angular_components.balance_entry_control_event": "Entrada/salida balanza",
|
|
1419
1423
|
"agro.angular_components.event_origin_label": "Origen del evento",
|
|
1420
1424
|
"agro.angular_components.event_details_header": "Detalles del Evento",
|
|
@@ -5778,43 +5782,6 @@
|
|
|
5778
5782
|
_this.translate = translate;
|
|
5779
5783
|
return _this;
|
|
5780
5784
|
}
|
|
5781
|
-
ProducerInvoiceService.prototype.getTotalLinkedInInvoices = function (invoiceId, fixationId) {
|
|
5782
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5783
|
-
var filter;
|
|
5784
|
-
var _this = this;
|
|
5785
|
-
return __generator(this, function (_a) {
|
|
5786
|
-
filter = "fixationItem.fixation.id eq '" + fixationId + "' " + ("and invoiceId in ('" + invoiceId.join("','") + "') ");
|
|
5787
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
5788
|
-
_this.list({
|
|
5789
|
-
filterQuery: filter,
|
|
5790
|
-
size: exports.AGRO_NUMBERS.ONE_HUNDRED,
|
|
5791
|
-
}).subscribe({
|
|
5792
|
-
next: function (data) {
|
|
5793
|
-
var invoiceList = data.contents;
|
|
5794
|
-
var producerInvoice = new Map();
|
|
5795
|
-
if (invoiceList.length) {
|
|
5796
|
-
invoiceList.forEach(function (invoice) {
|
|
5797
|
-
var _a;
|
|
5798
|
-
producerInvoice.set(invoice.invoiceId, ((_a = producerInvoice.get(invoice.invoiceId)) !== null && _a !== void 0 ? _a : 0) + invoice.linkedValue);
|
|
5799
|
-
});
|
|
5800
|
-
}
|
|
5801
|
-
resolve(Array.from(producerInvoice.entries()).map(function (_a) {
|
|
5802
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
5803
|
-
return {
|
|
5804
|
-
invoiceId: key,
|
|
5805
|
-
totalLinked: value,
|
|
5806
|
-
};
|
|
5807
|
-
}));
|
|
5808
|
-
},
|
|
5809
|
-
error: function (err) { return reject(new Error(typeof err === 'string' ? err : JSON.stringify(err))); },
|
|
5810
|
-
});
|
|
5811
|
-
})];
|
|
5812
|
-
});
|
|
5813
|
-
});
|
|
5814
|
-
};
|
|
5815
|
-
ProducerInvoiceService.prototype.deleteAllProducerInvoice = function (fixationId) {
|
|
5816
|
-
return this.http.post(this.actionsUrl + "/deleteAllProducerInvoice", { fixationId: fixationId }).pipe(this.defaultCatch());
|
|
5817
|
-
};
|
|
5818
5785
|
ProducerInvoiceService.ctorParameters = function () { return [
|
|
5819
5786
|
{ type: http.HttpClient },
|
|
5820
5787
|
{ type: api.MessageService },
|
|
@@ -6002,13 +5969,6 @@
|
|
|
6002
5969
|
EventOperation["ORIGINATION_CREATE_STOCK_MOVEMENT"] = "ORIGINATION_CREATE_STOCK_MOVEMENT";
|
|
6003
5970
|
})(EventOperation || (EventOperation = {}));
|
|
6004
5971
|
|
|
6005
|
-
var InputFields;
|
|
6006
|
-
(function (InputFields) {
|
|
6007
|
-
InputFields["AGRO_INVOICE_TYPE"] = "agroInvoiceType";
|
|
6008
|
-
InputFields["INVOICE_TYPE"] = "invoiceType";
|
|
6009
|
-
InputFields["INVOICE_NUMBER"] = "number";
|
|
6010
|
-
})(InputFields || (InputFields = {}));
|
|
6011
|
-
|
|
6012
5972
|
var eventItem = [
|
|
6013
5973
|
{ label: "agro.angular_components.ticket_event", value: EventOperation.TICKET },
|
|
6014
5974
|
{ label: "agro.angular_components.provisional_event", value: EventOperation.PROVISIONAL },
|
|
@@ -6030,11 +5990,6 @@
|
|
|
6030
5990
|
label: "agro.angular_components." + EventOperation.INVOICE_CLOSE_INVOICE,
|
|
6031
5991
|
value: EventOperation.INVOICE_CLOSE_INVOICE,
|
|
6032
5992
|
},
|
|
6033
|
-
{
|
|
6034
|
-
label: "agro.angular_components." + EventOperation.INVOICE_CLOSE_INVOICE,
|
|
6035
|
-
value: EventOperation.INVOICE_CLOSE_INVOICE,
|
|
6036
|
-
subLabelField: InputFields.AGRO_INVOICE_TYPE,
|
|
6037
|
-
},
|
|
6038
5993
|
{ label: "agro.angular_components." + EventOperation.REPROCESS_INVOICE, value: EventOperation.REPROCESS_INVOICE },
|
|
6039
5994
|
{ label: "agro.angular_components." + EventOperation.EFFECTIVE_CONFIRMATION, value: EventOperation.EFFECTIVE_CONFIRMATION },
|
|
6040
5995
|
{ label: "agro.angular_components." + EventOperation.CHANGE_REQUEST, value: EventOperation.CHANGE_REQUEST },
|
|
@@ -6647,7 +6602,7 @@
|
|
|
6647
6602
|
if (prescriptionOperations.includes(eventOperation)) {
|
|
6648
6603
|
formattedSubtitle = this.translate.instant('agro.angular_components.new_prescription_page', { count: subTitle });
|
|
6649
6604
|
}
|
|
6650
|
-
return formattedSubtitle;
|
|
6605
|
+
return formattedSubtitle !== null && formattedSubtitle !== void 0 ? formattedSubtitle : null;
|
|
6651
6606
|
};
|
|
6652
6607
|
EventControlBoardComponent.prototype.onGridChange = function (event) {
|
|
6653
6608
|
var size = event === null || event === void 0 ? void 0 : event.rows;
|
|
@@ -6710,57 +6665,60 @@
|
|
|
6710
6665
|
return producerBalanceEntryControlId ? producerBalanceEntryControlId : null;
|
|
6711
6666
|
};
|
|
6712
6667
|
EventControlBoardComponent.prototype.stepSelected = function (event) {
|
|
6713
|
-
var _this = this;
|
|
6714
6668
|
this.selectedStep = event.step;
|
|
6715
6669
|
this.applySidebarTitle("");
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
case EventOrigin.TICKET:
|
|
6719
|
-
case EventOrigin.INVOICE:
|
|
6720
|
-
case EventOrigin.CREATE_INVOICE:
|
|
6721
|
-
this.sidebarLoading = true;
|
|
6722
|
-
{
|
|
6723
|
-
var param = JSON.parse(this.selectedStep.item.input);
|
|
6724
|
-
var producerInvoiceId = this.getProducerInvoiceIdFromParams(param);
|
|
6725
|
-
var filterQuery = "";
|
|
6726
|
-
if (!producerInvoiceId) {
|
|
6727
|
-
var producerBalanceEntryControlId = this.getProducerBalanceEntryControlIdFromParams(param);
|
|
6728
|
-
if (!producerBalanceEntryControlId) {
|
|
6729
|
-
this.sidebarLoading = false;
|
|
6730
|
-
return;
|
|
6731
|
-
}
|
|
6732
|
-
filterQuery = "producerBalanceEntryControl.id eq '" + producerBalanceEntryControlId + "'";
|
|
6733
|
-
}
|
|
6734
|
-
else {
|
|
6735
|
-
filterQuery = "id eq '" + producerInvoiceId + "'";
|
|
6736
|
-
}
|
|
6737
|
-
this.producerInvoiceService
|
|
6738
|
-
.list({
|
|
6739
|
-
displayFields: ["*", "producerBalanceEntryControl.*", "producerBalanceEntryControl.producer.*"],
|
|
6740
|
-
filterQuery: filterQuery,
|
|
6741
|
-
page: 0,
|
|
6742
|
-
size: 1,
|
|
6743
|
-
})
|
|
6744
|
-
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
6745
|
-
.subscribe(function (result) {
|
|
6746
|
-
_this.producerInvoice = result === null || result === void 0 ? void 0 : result.contents[0];
|
|
6747
|
-
_this.producerInvoice;
|
|
6748
|
-
_this.sidebarLoading = false;
|
|
6749
|
-
_this.applySidebarTitle(_this.getProducerInvoiceNumberAndSerie());
|
|
6750
|
-
}, function () {
|
|
6751
|
-
_this.sidebarLoading = false;
|
|
6752
|
-
});
|
|
6753
|
-
}
|
|
6754
|
-
break;
|
|
6755
|
-
case EventOrigin.FIXATION:
|
|
6756
|
-
case EventOrigin.CANCEL_FIXATION:
|
|
6757
|
-
case EventOrigin.CHANGE_REQUEST:
|
|
6758
|
-
case EventOrigin.TRANSFER:
|
|
6759
|
-
break;
|
|
6670
|
+
if (this.shouldLoadProducerInvoice(this.selectedStep.eventType)) {
|
|
6671
|
+
this.loadSelectedStepProducerInvoice();
|
|
6760
6672
|
}
|
|
6761
6673
|
this.showReprocessButton = event.step.state === angularComponents.StepState.Warning;
|
|
6762
6674
|
this.showSidebar = true;
|
|
6763
6675
|
};
|
|
6676
|
+
EventControlBoardComponent.prototype.shouldLoadProducerInvoice = function (eventType) {
|
|
6677
|
+
return [
|
|
6678
|
+
EventOrigin.BALANCE_ENTRY_CONTROL,
|
|
6679
|
+
EventOrigin.TICKET,
|
|
6680
|
+
EventOrigin.INVOICE,
|
|
6681
|
+
EventOrigin.CREATE_INVOICE,
|
|
6682
|
+
EventOrigin.CLOSE_INVOICE,
|
|
6683
|
+
].includes(eventType);
|
|
6684
|
+
};
|
|
6685
|
+
EventControlBoardComponent.prototype.loadSelectedStepProducerInvoice = function () {
|
|
6686
|
+
var _this = this;
|
|
6687
|
+
this.sidebarLoading = true;
|
|
6688
|
+
var param = JSON.parse(this.selectedStep.item.input);
|
|
6689
|
+
var filterQuery = this.getProducerInvoiceFilterQuery(param);
|
|
6690
|
+
if (!filterQuery) {
|
|
6691
|
+
this.sidebarLoading = false;
|
|
6692
|
+
return;
|
|
6693
|
+
}
|
|
6694
|
+
this.producerInvoiceService
|
|
6695
|
+
.list({
|
|
6696
|
+
displayFields: ["*", "producerBalanceEntryControl.*", "producerBalanceEntryControl.producer.*"],
|
|
6697
|
+
filterQuery: filterQuery,
|
|
6698
|
+
page: 0,
|
|
6699
|
+
size: 1,
|
|
6700
|
+
})
|
|
6701
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
6702
|
+
.subscribe(function (result) {
|
|
6703
|
+
_this.producerInvoice = result === null || result === void 0 ? void 0 : result.contents[0];
|
|
6704
|
+
_this.producerInvoice;
|
|
6705
|
+
_this.sidebarLoading = false;
|
|
6706
|
+
_this.applySidebarTitle(_this.getProducerInvoiceNumberAndSerie());
|
|
6707
|
+
}, function () {
|
|
6708
|
+
_this.sidebarLoading = false;
|
|
6709
|
+
});
|
|
6710
|
+
};
|
|
6711
|
+
EventControlBoardComponent.prototype.getProducerInvoiceFilterQuery = function (param) {
|
|
6712
|
+
var producerInvoiceId = this.getProducerInvoiceIdFromParams(param);
|
|
6713
|
+
if (producerInvoiceId) {
|
|
6714
|
+
return "id eq '" + producerInvoiceId + "'";
|
|
6715
|
+
}
|
|
6716
|
+
var producerBalanceEntryControlId = this.getProducerBalanceEntryControlIdFromParams(param);
|
|
6717
|
+
if (!producerBalanceEntryControlId) {
|
|
6718
|
+
return null;
|
|
6719
|
+
}
|
|
6720
|
+
return "producerBalanceEntryControl.id eq '" + producerBalanceEntryControlId + "'";
|
|
6721
|
+
};
|
|
6764
6722
|
EventControlBoardComponent.prototype.applySidebarTitle = function (title) {
|
|
6765
6723
|
this.sidebarTitle = this.translate.instant("agro.angular_components.event_sidebar_title", { eventNumber: title });
|
|
6766
6724
|
};
|
|
@@ -7780,6 +7738,7 @@
|
|
|
7780
7738
|
this.gridLoading = true;
|
|
7781
7739
|
this.dontHaveAnyInvoice = false;
|
|
7782
7740
|
this.updateCurrentParams(event);
|
|
7741
|
+
var numberSearchValue = searchValue ? AgroNumberUtils.getNearInteger(searchValue) : null;
|
|
7783
7742
|
var filterBody = {
|
|
7784
7743
|
filter: {
|
|
7785
7744
|
companyId: companyId,
|
|
@@ -7788,6 +7747,7 @@
|
|
|
7788
7747
|
ruralEstateIds: [ruralEstateId],
|
|
7789
7748
|
multiProducts: false,
|
|
7790
7749
|
productId: this.options.productId,
|
|
7750
|
+
number: numberSearchValue,
|
|
7791
7751
|
},
|
|
7792
7752
|
pageRequest: {
|
|
7793
7753
|
offset: this.currentParams.page,
|
|
@@ -7799,16 +7759,25 @@
|
|
|
7799
7759
|
},
|
|
7800
7760
|
};
|
|
7801
7761
|
if (searchValue) {
|
|
7802
|
-
searchValue =
|
|
7762
|
+
searchValue = numberSearchValue.toString();
|
|
7803
7763
|
}
|
|
7804
7764
|
this.invoiceService
|
|
7805
7765
|
.invoiceLookupFilter(filterBody)
|
|
7806
|
-
.pipe(operators.takeUntil(this.ngUnsubscribe), operators.
|
|
7766
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe), operators.switchMap(function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
7767
|
+
return __generator(this, function (_a) {
|
|
7768
|
+
switch (_a.label) {
|
|
7769
|
+
case 0: return [4 /*yield*/, this.adaptResult(result)];
|
|
7770
|
+
case 1:
|
|
7771
|
+
_a.sent();
|
|
7772
|
+
return [2 /*return*/, result];
|
|
7773
|
+
}
|
|
7774
|
+
});
|
|
7775
|
+
}); }), operators.finalize(function () {
|
|
7807
7776
|
_this.gridLoading = false;
|
|
7808
7777
|
}))
|
|
7809
7778
|
.subscribe(function (result) {
|
|
7810
7779
|
var _a;
|
|
7811
|
-
_this.gridData = ((_a = result === null || result === void 0 ? void 0 : result.result) === null || _a === void 0 ? void 0 : _a.invoices) || [];
|
|
7780
|
+
_this.gridData = (((_a = result === null || result === void 0 ? void 0 : result.result) === null || _a === void 0 ? void 0 : _a.invoices) || []).map(function (invoice) { return (__assign(__assign({}, invoice), { _uniqueId: invoice.externalInvoiceId || invoice.invoiceId })); });
|
|
7812
7781
|
if (_this.gridData.length === 0 && !searchValue) {
|
|
7813
7782
|
_this.dontHaveAnyInvoice = true;
|
|
7814
7783
|
}
|
|
@@ -7948,7 +7917,7 @@
|
|
|
7948
7917
|
ModalInvoicePjForOriginationComponent = __decorate([
|
|
7949
7918
|
core.Component({
|
|
7950
7919
|
selector: 's-modal-invoice-pj-for-origination',
|
|
7951
|
-
template: "<p-dialog\r\n header=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [(visible)]=\"visible\"\r\n [modal]=\"true\"\r\n class=\"add-invoice-modal\"\r\n [closeOnEscape]=\"false\"\r\n (onHide)=\"cancelPooling()\"\r\n [dismissableMask]=\"false\"\r\n>\r\n <ng-container *ngIf=\"!dontHaveAnyInvoice\">\r\n <div class=\"ui-g\">\r\n <label for=\"invoiceSearchInput\">{{ 'agro.angular_components.number' | libTranslate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"invoiceSearchInput\"\r\n pInputText\r\n [formControl]=\"searchValue\"\r\n [placeholder]=\"'' | libTranslate\"\r\n [required]=\"false\"\r\n />\r\n <div class=\"ui-g-12\">\r\n <p-table\r\n [(selection)]=\"selected\"\r\n [value]=\"gridData\"\r\n [columns]=\"gridColumns\"\r\n [scrollable]=\"true\"\r\n dataKey=\"
|
|
7920
|
+
template: "<p-dialog\r\n header=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [(visible)]=\"visible\"\r\n [modal]=\"true\"\r\n class=\"add-invoice-modal\"\r\n [closeOnEscape]=\"false\"\r\n (onHide)=\"cancelPooling()\"\r\n [dismissableMask]=\"false\"\r\n>\r\n <ng-container *ngIf=\"!dontHaveAnyInvoice\">\r\n <div class=\"ui-g\">\r\n <label for=\"invoiceSearchInput\">{{ 'agro.angular_components.number' | libTranslate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"invoiceSearchInput\"\r\n pInputText\r\n [formControl]=\"searchValue\"\r\n [placeholder]=\"'' | libTranslate\"\r\n [required]=\"false\"\r\n />\r\n <div class=\"ui-g-12\">\r\n <p-table\r\n [(selection)]=\"selected\"\r\n [value]=\"gridData\"\r\n [columns]=\"gridColumns\"\r\n [scrollable]=\"true\"\r\n dataKey=\"_uniqueId\"\r\n [rows]=\"10\"\r\n [paginator]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n [totalRecords]=\"gridTotalRecords\"\r\n [lazy]=\"true\"\r\n (onLazyLoad)=\"updateGridData($event)\"\r\n [resizableColumns]=\"true\"\r\n *sLoadingState=\"gridLoading\"\r\n sortMode=\"multiple\"\r\n [selectionMode]=\"'multiple'\"\r\n >\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th class=\"checkbox\" scope=\"col\">\r\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\r\n </th>\r\n <ng-container *ngFor=\"let col of columns\">\r\n <th\r\n *ngIf=\"col.sortable === undefined || col.sortable\"\r\n [pSortableColumn]=\"col.field\"\r\n scope=\"col\"\r\n >\r\n {{ col.header }}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </th>\r\n <th *ngIf=\"col.sortable === false || col.sortable === null\" scope=\"col\">\r\n {{ col.header }}\r\n </th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <td class=\"checkbox\" tabindex=\"0\">\r\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\r\n </td>\r\n <td\r\n [pSelectableRow]=\"rowData\"\r\n [pSelectableRowIndex]=\"rowIndex\"\r\n *ngFor=\"let col of columns\"\r\n class=\"column\"\r\n tabindex=\"0\"\r\n >\r\n <ng-container>\r\n {{ gridFieldValuesMap[col.field] ? gridFieldValuesMap[col.field](rowData) :\r\n rowData[col.field] }}\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"paginatorright\">\r\n <span>{{ gridTotalRecords }} registros encontrados</span>\r\n </ng-template>\r\n </p-table>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dontHaveAnyInvoice\">\r\n <s-empty-state\r\n iconClass=\"fa fa-exclamation-triangle\"\r\n title=\"{{ 'agro.angular_components.add_pj_invoice_modal_no_invoices_found' | libTranslate }}\"\r\n primaryActionLabel=\"{{ 'agro.angular_components.error_server_try_again' | libTranslate }}\"\r\n (primaryAction)=\"tryToSearchAgain()\"\r\n description=\"{{ 'agro.angular_components.no_register_found_for_external_invoices_summary' | libTranslate }}\"\r\n >\r\n </s-empty-state>\r\n </ng-container>\r\n\r\n <p-footer class=\"footer\" *ngIf=\"!dontHaveAnyInvoice\">\r\n <s-button\r\n [priority]=\"buttonPriority.Primary\"\r\n label=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [disabled]=\"!selected?.length\"\r\n (click)=\"add()\"\r\n (keydown.enter)=\"add()\"\r\n ></s-button>\r\n <s-button\r\n [priority]=\"buttonPriority.Link\"\r\n label=\"{{ 'agro.angular_components.cancel' | libTranslate }}\"\r\n (click)=\"cancel()\"\r\n (keydown.enter)=\"cancel()\"\r\n ></s-button>\r\n </p-footer>\r\n</p-dialog>\r\n",
|
|
7952
7921
|
styles: [".footer{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}.add-invoice-modal{width:480px;max-width:480px}.add-invoice-modal input[type=text]{width:100%}.add-invoice-modal .ui-dialog{width:480px!important}.add-invoice-modal .ui-dialog .ui-dialog-content{min-height:175px}td.checkbox,th.checkbox{width:50px}td.column,th.column{min-width:150px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}"]
|
|
7953
7922
|
})
|
|
7954
7923
|
], ModalInvoicePjForOriginationComponent);
|
|
@@ -8015,7 +7984,7 @@
|
|
|
8015
7984
|
ModalInvoicePjForTransferComponent = __decorate([
|
|
8016
7985
|
core.Component({
|
|
8017
7986
|
selector: 's-modal-invoice-pj-for-transfer',
|
|
8018
|
-
template: "<p-dialog\r\n header=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [(visible)]=\"visible\"\r\n [modal]=\"true\"\r\n class=\"add-invoice-modal\"\r\n [closeOnEscape]=\"false\"\r\n (onHide)=\"cancelPooling()\"\r\n [dismissableMask]=\"false\"\r\n>\r\n <ng-container *ngIf=\"!dontHaveAnyInvoice\">\r\n <div class=\"ui-g\">\r\n <label for=\"invoiceSearchInput\">{{ 'agro.angular_components.number' | libTranslate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"invoiceSearchInput\"\r\n pInputText\r\n [formControl]=\"searchValue\"\r\n [placeholder]=\"'' | libTranslate\"\r\n [required]=\"false\"\r\n />\r\n <div class=\"ui-g-12\">\r\n <p-table\r\n [(selection)]=\"selected\"\r\n [value]=\"gridData\"\r\n [columns]=\"gridColumns\"\r\n [scrollable]=\"true\"\r\n dataKey=\"
|
|
7987
|
+
template: "<p-dialog\r\n header=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [(visible)]=\"visible\"\r\n [modal]=\"true\"\r\n class=\"add-invoice-modal\"\r\n [closeOnEscape]=\"false\"\r\n (onHide)=\"cancelPooling()\"\r\n [dismissableMask]=\"false\"\r\n>\r\n <ng-container *ngIf=\"!dontHaveAnyInvoice\">\r\n <div class=\"ui-g\">\r\n <label for=\"invoiceSearchInput\">{{ 'agro.angular_components.number' | libTranslate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"invoiceSearchInput\"\r\n pInputText\r\n [formControl]=\"searchValue\"\r\n [placeholder]=\"'' | libTranslate\"\r\n [required]=\"false\"\r\n />\r\n <div class=\"ui-g-12\">\r\n <p-table\r\n [(selection)]=\"selected\"\r\n [value]=\"gridData\"\r\n [columns]=\"gridColumns\"\r\n [scrollable]=\"true\"\r\n dataKey=\"_uniqueId\"\r\n [rows]=\"10\"\r\n [paginator]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n [totalRecords]=\"gridTotalRecords\"\r\n [lazy]=\"true\"\r\n (onLazyLoad)=\"updateGridData($event)\"\r\n [resizableColumns]=\"true\"\r\n *sLoadingState=\"gridLoading\"\r\n sortMode=\"multiple\"\r\n [selectionMode]=\"'multiple'\"\r\n >\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th class=\"checkbox\" scope=\"col\">\r\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\r\n </th>\r\n <ng-container *ngFor=\"let col of columns\">\r\n <th\r\n *ngIf=\"col.sortable === undefined || col.sortable\"\r\n [pSortableColumn]=\"col.field\"\r\n scope=\"col\"\r\n >\r\n {{ col.header }}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </th>\r\n <th *ngIf=\"col.sortable === false || col.sortable === null\" scope=\"col\">\r\n {{ col.header }}\r\n </th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <td class=\"checkbox\" tabindex=\"0\">\r\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\r\n </td>\r\n <td\r\n [pSelectableRow]=\"rowData\"\r\n [pSelectableRowIndex]=\"rowIndex\"\r\n *ngFor=\"let col of columns\"\r\n class=\"column\"\r\n tabindex=\"0\"\r\n >\r\n <ng-container>\r\n {{ gridFieldValuesMap[col.field] ? gridFieldValuesMap[col.field](rowData) :\r\n rowData[col.field] }}\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"paginatorright\">\r\n <span>{{ gridTotalRecords }} registros encontrados</span>\r\n </ng-template>\r\n </p-table>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dontHaveAnyInvoice\">\r\n <s-empty-state\r\n iconClass=\"fa fa-exclamation-triangle\"\r\n title=\"{{ 'agro.angular_components.add_pj_invoice_modal_no_invoices_found' | libTranslate }}\"\r\n primaryActionLabel=\"{{ 'agro.angular_components.error_server_try_again' | libTranslate }}\"\r\n (primaryAction)=\"tryToSearchAgain()\"\r\n description=\"{{ 'agro.angular_components.no_register_found_for_external_invoices_summary' | libTranslate }}\"\r\n >\r\n </s-empty-state>\r\n </ng-container>\r\n\r\n <p-footer class=\"footer\" *ngIf=\"!dontHaveAnyInvoice\">\r\n <s-button\r\n [priority]=\"buttonPriority.Primary\"\r\n label=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [disabled]=\"!selected?.length\"\r\n (click)=\"add()\"\r\n (keydown.enter)=\"add()\"\r\n ></s-button>\r\n <s-button\r\n [priority]=\"buttonPriority.Link\"\r\n label=\"{{ 'agro.angular_components.cancel' | libTranslate }}\"\r\n (click)=\"cancel()\"\r\n (keydown.enter)=\"cancel()\"\r\n ></s-button>\r\n </p-footer>\r\n</p-dialog>\r\n",
|
|
8019
7988
|
styles: [".footer{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}.add-invoice-modal{width:480px;max-width:480px}.add-invoice-modal input[type=text]{width:100%}.add-invoice-modal .ui-dialog{width:480px!important}.add-invoice-modal .ui-dialog .ui-dialog-content{min-height:175px}td.checkbox,th.checkbox{width:50px}td.column,th.column{min-width:150px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}"]
|
|
8020
7989
|
})
|
|
8021
7990
|
], ModalInvoicePjForTransferComponent);
|
|
@@ -8036,6 +8005,66 @@
|
|
|
8036
8005
|
return ModalInvoicePjForTransferModule;
|
|
8037
8006
|
}());
|
|
8038
8007
|
|
|
8008
|
+
var ProducerInvoiceService$1 = /** @class */ (function (_super) {
|
|
8009
|
+
__extends(ProducerInvoiceService, _super);
|
|
8010
|
+
function ProducerInvoiceService(http, messageService, translate) {
|
|
8011
|
+
var _this = _super.call(this, http, messageService, "agro/fixation/entities/producerInvoice", "agro/fixation/actions", "agro/fixation/queries", translate) || this;
|
|
8012
|
+
_this.http = http;
|
|
8013
|
+
_this.messageService = messageService;
|
|
8014
|
+
_this.translate = translate;
|
|
8015
|
+
return _this;
|
|
8016
|
+
}
|
|
8017
|
+
ProducerInvoiceService.prototype.getTotalLinkedInInvoices = function (invoiceId, fixationId) {
|
|
8018
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8019
|
+
var filter;
|
|
8020
|
+
var _this = this;
|
|
8021
|
+
return __generator(this, function (_a) {
|
|
8022
|
+
filter = "fixationItem.fixation.id eq '" + fixationId + "' " + ("and externalInvoiceId in ('" + invoiceId.join("','") + "') ");
|
|
8023
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
8024
|
+
_this.list({
|
|
8025
|
+
filterQuery: filter,
|
|
8026
|
+
size: 100
|
|
8027
|
+
}).subscribe({
|
|
8028
|
+
next: function (data) {
|
|
8029
|
+
var invoiceList = data.contents;
|
|
8030
|
+
var producerInvoice = new Map();
|
|
8031
|
+
if (invoiceList.length) {
|
|
8032
|
+
invoiceList.forEach(function (invoice) {
|
|
8033
|
+
var _a;
|
|
8034
|
+
producerInvoice.set(invoice.invoiceId, ((_a = producerInvoice.get(invoice.invoiceId)) !== null && _a !== void 0 ? _a : 0) + invoice.linkedValue);
|
|
8035
|
+
});
|
|
8036
|
+
}
|
|
8037
|
+
resolve(Array.from(producerInvoice.entries()).map(function (_a) {
|
|
8038
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
8039
|
+
return {
|
|
8040
|
+
invoiceId: key,
|
|
8041
|
+
totalLinked: value
|
|
8042
|
+
};
|
|
8043
|
+
}));
|
|
8044
|
+
},
|
|
8045
|
+
error: function (err) { return reject(err instanceof Error ? err : new Error(String(err))); }
|
|
8046
|
+
});
|
|
8047
|
+
})];
|
|
8048
|
+
});
|
|
8049
|
+
});
|
|
8050
|
+
};
|
|
8051
|
+
ProducerInvoiceService.prototype.deleteAllProducerInvoice = function (fixationId) {
|
|
8052
|
+
return this.http.post(this.actionsUrl + "/deleteAllProducerInvoice", { fixationId: fixationId }).pipe(this.defaultCatch());
|
|
8053
|
+
};
|
|
8054
|
+
ProducerInvoiceService.ctorParameters = function () { return [
|
|
8055
|
+
{ type: http.HttpClient },
|
|
8056
|
+
{ type: api.MessageService },
|
|
8057
|
+
{ type: LibTranslationService }
|
|
8058
|
+
]; };
|
|
8059
|
+
ProducerInvoiceService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function ProducerInvoiceService_Factory() { return new ProducerInvoiceService(core["ɵɵinject"](http.HttpClient), core["ɵɵinject"](api.MessageService), core["ɵɵinject"](LibTranslationService)); }, token: ProducerInvoiceService, providedIn: "root" });
|
|
8060
|
+
ProducerInvoiceService = __decorate([
|
|
8061
|
+
core.Injectable({
|
|
8062
|
+
providedIn: 'root'
|
|
8063
|
+
})
|
|
8064
|
+
], ProducerInvoiceService);
|
|
8065
|
+
return ProducerInvoiceService;
|
|
8066
|
+
}(AgroEntityService));
|
|
8067
|
+
|
|
8039
8068
|
var ModalInvoicePjForFixationComponent = /** @class */ (function (_super) {
|
|
8040
8069
|
__extends(ModalInvoicePjForFixationComponent, _super);
|
|
8041
8070
|
function ModalInvoicePjForFixationComponent(translationService, invoiceService, localeService, kilogramPipe, currencyPipe, producerInvoiceService, messageService, datePipe) {
|
|
@@ -8049,12 +8078,17 @@
|
|
|
8049
8078
|
_this.messageService = messageService;
|
|
8050
8079
|
_this.datePipe = datePipe;
|
|
8051
8080
|
_this.whenSelectInvoices = new core.EventEmitter();
|
|
8081
|
+
common.registerLocaleData(localePt);
|
|
8052
8082
|
return _this;
|
|
8053
8083
|
}
|
|
8054
8084
|
ModalInvoicePjForFixationComponent.prototype.ngOnInit = function () {
|
|
8055
8085
|
var _this = this;
|
|
8056
8086
|
this.defineGridColumns();
|
|
8057
|
-
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) {
|
|
8087
|
+
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) {
|
|
8088
|
+
return _this.currencyPipe.transform(_this.getTotalValue(row) || 0, 'BRL', 'symbol', undefined, 'pt-BR');
|
|
8089
|
+
}, linkedValue: function (row) {
|
|
8090
|
+
return _this.currencyPipe.transform((row === null || row === void 0 ? void 0 : row.linkedValue) || 0, 'BRL', 'symbol', undefined, 'pt-BR');
|
|
8091
|
+
} });
|
|
8058
8092
|
_super.prototype.ngOnInit.call(this);
|
|
8059
8093
|
};
|
|
8060
8094
|
ModalInvoicePjForFixationComponent.prototype.defineGridColumns = function () {
|
|
@@ -8076,7 +8110,7 @@
|
|
|
8076
8110
|
};
|
|
8077
8111
|
ModalInvoicePjForFixationComponent.prototype.beforeAdd = function (selectedInvoices) {
|
|
8078
8112
|
if (selectedInvoices === null || selectedInvoices === void 0 ? void 0 : selectedInvoices.length) {
|
|
8079
|
-
this.linkSelectedInvoicesInFixationItem();
|
|
8113
|
+
this.linkSelectedInvoicesInFixationItem(selectedInvoices);
|
|
8080
8114
|
}
|
|
8081
8115
|
return rxjs.of(rxjs.EMPTY).toPromise();
|
|
8082
8116
|
};
|
|
@@ -8091,20 +8125,20 @@
|
|
|
8091
8125
|
}
|
|
8092
8126
|
_super.prototype.open.call(this);
|
|
8093
8127
|
};
|
|
8094
|
-
ModalInvoicePjForFixationComponent.prototype.linkSelectedInvoicesInFixationItem = function () {
|
|
8128
|
+
ModalInvoicePjForFixationComponent.prototype.linkSelectedInvoicesInFixationItem = function (selectedInvoices) {
|
|
8095
8129
|
return __awaiter(this, void 0, void 0, function () {
|
|
8096
8130
|
var entities;
|
|
8097
8131
|
var _this = this;
|
|
8098
8132
|
return __generator(this, function (_a) {
|
|
8099
8133
|
switch (_a.label) {
|
|
8100
|
-
case 0: return [4 /*yield*/, this.isValidAndSetLinkedValueInInvoices()];
|
|
8134
|
+
case 0: return [4 /*yield*/, this.isValidAndSetLinkedValueInInvoices(selectedInvoices)];
|
|
8101
8135
|
case 1:
|
|
8102
8136
|
if (!(_a.sent())) {
|
|
8103
8137
|
this.gridLoading = false;
|
|
8104
8138
|
return [2 /*return*/];
|
|
8105
8139
|
}
|
|
8106
8140
|
entities = []
|
|
8107
|
-
.concat.apply([], __spread(
|
|
8141
|
+
.concat.apply([], __spread(selectedInvoices.map(function (invoice) {
|
|
8108
8142
|
return _this.options.fixationItems.map(function (fixationItem) {
|
|
8109
8143
|
var requiredValue = (fixationItem.requiredValue || 0) - (fixationItem.totalValueInvoices || 0);
|
|
8110
8144
|
if (invoice.remainingValue <= 0 || requiredValue <= 0) {
|
|
@@ -8115,11 +8149,11 @@
|
|
|
8115
8149
|
var body = {
|
|
8116
8150
|
series: invoice === null || invoice === void 0 ? void 0 : invoice.series,
|
|
8117
8151
|
number: String(invoice === null || invoice === void 0 ? void 0 : invoice.number),
|
|
8118
|
-
|
|
8152
|
+
externalInvoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.externalInvoiceId,
|
|
8119
8153
|
linkedValue: valueToBeLinked,
|
|
8120
|
-
totalValue: invoice
|
|
8154
|
+
totalValue: _this.getTotalValue(invoice),
|
|
8121
8155
|
issuanceDate: invoice === null || invoice === void 0 ? void 0 : invoice.issuanceDate,
|
|
8122
|
-
fixationItem: fixationItem,
|
|
8156
|
+
fixationItem: { id: fixationItem === null || fixationItem === void 0 ? void 0 : fixationItem.id },
|
|
8123
8157
|
};
|
|
8124
8158
|
fixationItem.totalValueInvoices = (fixationItem.totalValueInvoices || 0) + valueToBeLinked;
|
|
8125
8159
|
return body;
|
|
@@ -8145,19 +8179,25 @@
|
|
|
8145
8179
|
});
|
|
8146
8180
|
});
|
|
8147
8181
|
};
|
|
8148
|
-
ModalInvoicePjForFixationComponent.prototype.isValidAndSetLinkedValueInInvoices = function () {
|
|
8182
|
+
ModalInvoicePjForFixationComponent.prototype.isValidAndSetLinkedValueInInvoices = function (selectedInvoices) {
|
|
8149
8183
|
return __awaiter(this, void 0, void 0, function () {
|
|
8150
8184
|
var valorLinked, isValid;
|
|
8151
8185
|
var _this = this;
|
|
8152
8186
|
return __generator(this, function (_a) {
|
|
8153
8187
|
switch (_a.label) {
|
|
8154
|
-
case 0: return [4 /*yield*/, this.producerInvoiceService.getTotalLinkedInInvoices(
|
|
8188
|
+
case 0: return [4 /*yield*/, this.producerInvoiceService.getTotalLinkedInInvoices(selectedInvoices.map(function (invoice) { return invoice.externalInvoiceId; }), this.options.fixationId)];
|
|
8155
8189
|
case 1:
|
|
8156
8190
|
valorLinked = _a.sent();
|
|
8191
|
+
selectedInvoices.forEach(function (invoice) {
|
|
8192
|
+
if (!invoice.totalValue) {
|
|
8193
|
+
invoice.totalValue = _this.getTotalValue(invoice);
|
|
8194
|
+
}
|
|
8195
|
+
});
|
|
8157
8196
|
isValid = true;
|
|
8158
|
-
|
|
8197
|
+
selectedInvoices.forEach(function (invoice) {
|
|
8159
8198
|
var _a;
|
|
8160
|
-
invoice.linkedValue =
|
|
8199
|
+
invoice.linkedValue =
|
|
8200
|
+
((_a = valorLinked.find(function (linked) { return linked.externalInvoiceId === invoice.externalInvoiceId; })) === null || _a === void 0 ? void 0 : _a.totalLinked) || 0;
|
|
8161
8201
|
if (invoice.linkedValue >= invoice.totalValue) {
|
|
8162
8202
|
_this.messageService.add({
|
|
8163
8203
|
severity: 'warn',
|
|
@@ -8174,9 +8214,13 @@
|
|
|
8174
8214
|
});
|
|
8175
8215
|
};
|
|
8176
8216
|
ModalInvoicePjForFixationComponent.prototype.adaptResult = function (result) {
|
|
8217
|
+
var _a;
|
|
8177
8218
|
return __awaiter(this, void 0, void 0, function () {
|
|
8178
|
-
return __generator(this, function (
|
|
8179
|
-
|
|
8219
|
+
return __generator(this, function (_b) {
|
|
8220
|
+
switch (_b.label) {
|
|
8221
|
+
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) || [])];
|
|
8222
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
8223
|
+
}
|
|
8180
8224
|
});
|
|
8181
8225
|
});
|
|
8182
8226
|
};
|
|
@@ -8184,21 +8228,20 @@
|
|
|
8184
8228
|
this.options.fixationItems = [];
|
|
8185
8229
|
return _super.prototype.cancel.call(this);
|
|
8186
8230
|
};
|
|
8187
|
-
ModalInvoicePjForFixationComponent.prototype.updateLinkedValueInGrid = function (
|
|
8231
|
+
ModalInvoicePjForFixationComponent.prototype.updateLinkedValueInGrid = function (result) {
|
|
8188
8232
|
return __awaiter(this, void 0, void 0, function () {
|
|
8189
|
-
var
|
|
8190
|
-
var _this = this;
|
|
8233
|
+
var externalInvoiceId, filter, listParams;
|
|
8191
8234
|
return __generator(this, function (_a) {
|
|
8192
8235
|
switch (_a.label) {
|
|
8193
8236
|
case 0:
|
|
8194
|
-
|
|
8237
|
+
externalInvoiceId = result.map(function (invoice) { return invoice.externalInvoiceId; });
|
|
8195
8238
|
filter = "fixationItem.fixation.id eq '" + this.options.fixationId + "'";
|
|
8196
|
-
if (
|
|
8197
|
-
filter += "and
|
|
8239
|
+
if (externalInvoiceId && externalInvoiceId.length > 0) {
|
|
8240
|
+
filter += "and externalInvoiceId in ('" + externalInvoiceId.join("','") + "') ";
|
|
8198
8241
|
}
|
|
8199
8242
|
listParams = {
|
|
8200
8243
|
page: 0,
|
|
8201
|
-
size:
|
|
8244
|
+
size: result.length,
|
|
8202
8245
|
filterQuery: filter,
|
|
8203
8246
|
};
|
|
8204
8247
|
return [4 /*yield*/, this.producerInvoiceService
|
|
@@ -8207,10 +8250,11 @@
|
|
|
8207
8250
|
.toPromise()
|
|
8208
8251
|
.then(function (producerInvoices) {
|
|
8209
8252
|
producerInvoices === null || producerInvoices === void 0 ? void 0 : producerInvoices.contents.forEach(function (invoice) {
|
|
8210
|
-
var
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8253
|
+
var _a;
|
|
8254
|
+
(_a = result
|
|
8255
|
+
.filter(function (item) { return item.externalInvoiceId === invoice.externalInvoiceId; })) === null || _a === void 0 ? void 0 : _a.forEach(function (linkedInvoice) {
|
|
8256
|
+
linkedInvoice.linkedValue = invoice.linkedValue;
|
|
8257
|
+
});
|
|
8214
8258
|
});
|
|
8215
8259
|
})];
|
|
8216
8260
|
case 1:
|
|
@@ -8220,13 +8264,21 @@
|
|
|
8220
8264
|
});
|
|
8221
8265
|
});
|
|
8222
8266
|
};
|
|
8267
|
+
ModalInvoicePjForFixationComponent.prototype.getTotalValue = function (row) {
|
|
8268
|
+
var netTotalValue = row === null || row === void 0 ? void 0 : row.netTotalValue;
|
|
8269
|
+
if (netTotalValue) {
|
|
8270
|
+
return netTotalValue;
|
|
8271
|
+
}
|
|
8272
|
+
var items = (row === null || row === void 0 ? void 0 : row.items) || [];
|
|
8273
|
+
return items.reduce(function (total, item) { return total + (item.unitPrice || 0) * (item.quantity || 0); }, 0);
|
|
8274
|
+
};
|
|
8223
8275
|
ModalInvoicePjForFixationComponent.ctorParameters = function () { return [
|
|
8224
8276
|
{ type: LibTranslationService },
|
|
8225
8277
|
{ type: AgroInvoiceService },
|
|
8226
8278
|
{ type: angularComponents.LocaleService },
|
|
8227
8279
|
{ type: KilogramPipe },
|
|
8228
8280
|
{ type: common.CurrencyPipe },
|
|
8229
|
-
{ type: ProducerInvoiceService },
|
|
8281
|
+
{ type: ProducerInvoiceService$1 },
|
|
8230
8282
|
{ type: primeng.MessageService },
|
|
8231
8283
|
{ type: common.DatePipe }
|
|
8232
8284
|
]; };
|
|
@@ -8239,7 +8291,7 @@
|
|
|
8239
8291
|
ModalInvoicePjForFixationComponent = __decorate([
|
|
8240
8292
|
core.Component({
|
|
8241
8293
|
selector: 's-modal-invoice-pj-for-fixation',
|
|
8242
|
-
template: "<p-dialog\r\n header=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [(visible)]=\"visible\"\r\n [modal]=\"true\"\r\n class=\"add-invoice-modal\"\r\n [closeOnEscape]=\"false\"\r\n (onHide)=\"cancelPooling()\"\r\n [dismissableMask]=\"false\"\r\n>\r\n <ng-container *ngIf=\"!dontHaveAnyInvoice\">\r\n <div class=\"ui-g\">\r\n <label for=\"invoiceSearchInput\">{{ 'agro.angular_components.number' | libTranslate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"invoiceSearchInput\"\r\n pInputText\r\n [formControl]=\"searchValue\"\r\n [placeholder]=\"'' | libTranslate\"\r\n [required]=\"false\"\r\n />\r\n <div class=\"ui-g-12\">\r\n <p-table\r\n [(selection)]=\"selected\"\r\n [value]=\"gridData\"\r\n [columns]=\"gridColumns\"\r\n [scrollable]=\"true\"\r\n dataKey=\"
|
|
8294
|
+
template: "<p-dialog\r\n header=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [(visible)]=\"visible\"\r\n [modal]=\"true\"\r\n class=\"add-invoice-modal\"\r\n [closeOnEscape]=\"false\"\r\n (onHide)=\"cancelPooling()\"\r\n [dismissableMask]=\"false\"\r\n>\r\n <ng-container *ngIf=\"!dontHaveAnyInvoice\">\r\n <div class=\"ui-g\">\r\n <label for=\"invoiceSearchInput\">{{ 'agro.angular_components.number' | libTranslate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"invoiceSearchInput\"\r\n pInputText\r\n [formControl]=\"searchValue\"\r\n [placeholder]=\"'' | libTranslate\"\r\n [required]=\"false\"\r\n />\r\n <div class=\"ui-g-12\">\r\n <p-table\r\n [(selection)]=\"selected\"\r\n [value]=\"gridData\"\r\n [columns]=\"gridColumns\"\r\n [scrollable]=\"true\"\r\n dataKey=\"_uniqueId\"\r\n [rows]=\"10\"\r\n [paginator]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n [totalRecords]=\"gridTotalRecords\"\r\n [lazy]=\"true\"\r\n (onLazyLoad)=\"updateGridData($event)\"\r\n [resizableColumns]=\"true\"\r\n *sLoadingState=\"gridLoading\"\r\n sortMode=\"multiple\"\r\n [selectionMode]=\"'multiple'\"\r\n >\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th class=\"checkbox\" scope=\"col\">\r\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\r\n </th>\r\n <ng-container *ngFor=\"let col of columns\">\r\n <th\r\n *ngIf=\"col.sortable === undefined || col.sortable\"\r\n [pSortableColumn]=\"col.field\"\r\n scope=\"col\"\r\n >\r\n {{ col.header }}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </th>\r\n <th *ngIf=\"col.sortable === false || col.sortable === null\" scope=\"col\">\r\n {{ col.header }}\r\n </th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <td class=\"checkbox\" tabindex=\"0\">\r\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\r\n </td>\r\n <td\r\n [pSelectableRow]=\"rowData\"\r\n [pSelectableRowIndex]=\"rowIndex\"\r\n *ngFor=\"let col of columns\"\r\n class=\"column\"\r\n tabindex=\"0\"\r\n >\r\n <ng-container>\r\n {{ gridFieldValuesMap[col.field] ? gridFieldValuesMap[col.field](rowData) :\r\n rowData[col.field] }}\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"paginatorright\">\r\n <span>{{ gridTotalRecords }} registros encontrados</span>\r\n </ng-template>\r\n </p-table>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dontHaveAnyInvoice\">\r\n <s-empty-state\r\n iconClass=\"fa fa-exclamation-triangle\"\r\n title=\"{{ 'agro.angular_components.add_pj_invoice_modal_no_invoices_found' | libTranslate }}\"\r\n primaryActionLabel=\"{{ 'agro.angular_components.error_server_try_again' | libTranslate }}\"\r\n (primaryAction)=\"tryToSearchAgain()\"\r\n description=\"{{ 'agro.angular_components.no_register_found_for_external_invoices_summary' | libTranslate }}\"\r\n >\r\n </s-empty-state>\r\n </ng-container>\r\n\r\n <p-footer class=\"footer\" *ngIf=\"!dontHaveAnyInvoice\">\r\n <s-button\r\n [priority]=\"buttonPriority.Primary\"\r\n label=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [disabled]=\"!selected?.length\"\r\n (click)=\"add()\"\r\n (keydown.enter)=\"add()\"\r\n ></s-button>\r\n <s-button\r\n [priority]=\"buttonPriority.Link\"\r\n label=\"{{ 'agro.angular_components.cancel' | libTranslate }}\"\r\n (click)=\"cancel()\"\r\n (keydown.enter)=\"cancel()\"\r\n ></s-button>\r\n </p-footer>\r\n</p-dialog>\r\n",
|
|
8243
8295
|
styles: [".footer{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}.add-invoice-modal{width:480px;max-width:480px}.add-invoice-modal input[type=text]{width:100%}.add-invoice-modal .ui-dialog{width:480px!important}.add-invoice-modal .ui-dialog .ui-dialog-content{min-height:175px}td.checkbox,th.checkbox{width:50px}td.column,th.column{min-width:150px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}"]
|
|
8244
8296
|
})
|
|
8245
8297
|
], ModalInvoicePjForFixationComponent);
|