@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
|
@@ -470,6 +470,7 @@ WebsocketModule = __decorate([
|
|
|
470
470
|
})
|
|
471
471
|
], WebsocketModule);
|
|
472
472
|
|
|
473
|
+
const INVOICE_CLOSING = "Fechamento de NF";
|
|
473
474
|
const ptBR = {
|
|
474
475
|
"agro.angular_components.table_empty_description": "Altere os filtros acima para gerar outros resultados de busca",
|
|
475
476
|
"agro.angular_components.nothing_found": "Nenhum registro encontrado",
|
|
@@ -493,6 +494,7 @@ const ptBR = {
|
|
|
493
494
|
"agro.angular_components.change_request_event_summary": "Alteração de \nPesagem",
|
|
494
495
|
"agro.angular_components.ticket_maintenance_header": "Manutenção de ticket",
|
|
495
496
|
"agro.angular_components.invoice_creating_event": "Emissão de NF",
|
|
497
|
+
"agro.angular_components.invoice_close_event": INVOICE_CLOSING,
|
|
496
498
|
"agro.angular_components.balance_entry_control_event": "Entrada/saída balança",
|
|
497
499
|
"agro.angular_components.event_origin_label": "Origem do evento",
|
|
498
500
|
"agro.angular_components.event_details_header": "Detalhes do Evento",
|
|
@@ -710,11 +712,11 @@ const ptBR = {
|
|
|
710
712
|
"agro.angular_components.ORIGINATION_CREATE_INVOICE": "Emissão de NF",
|
|
711
713
|
"agro.angular_components.ORIGINATION_CREATE_EFFECTIVE_BALANCE": "Emissão de saldo efetivo",
|
|
712
714
|
"agro.angular_components.PRODUCER_NET_VALUE_EFFECTIVE_BALANCE_CONFIRMATION": "Confirmação de saldo efetivo",
|
|
713
|
-
"agro.angular_components.CLOSE_INVOICE_FIXATION":
|
|
714
|
-
"agro.angular_components.INVOICE_CLOSE_INVOICE":
|
|
715
|
+
"agro.angular_components.CLOSE_INVOICE_FIXATION": INVOICE_CLOSING,
|
|
716
|
+
"agro.angular_components.INVOICE_CLOSE_INVOICE": INVOICE_CLOSING,
|
|
715
717
|
"agro.angular_components.ORIGINATION_CREATE_EFFECTIVE_CONFIRMATION": "Confirmação efetiva",
|
|
716
718
|
"agro.angular_components.ORIGINATION_CREATE_PROVISIONAL_BALANCE": "Saldo provisório",
|
|
717
|
-
"agro.angular_components.CLOSE_INVOICE_TRANSFER":
|
|
719
|
+
"agro.angular_components.CLOSE_INVOICE_TRANSFER": INVOICE_CLOSING,
|
|
718
720
|
"agro.angular_components.REOPEN_INVOICE_TRANSFER": "Reabertura da NF",
|
|
719
721
|
"agro.angular_components.TRANSFER_CREATE_FINANCIAL_TITLE": "Criação de título financeiro",
|
|
720
722
|
"agro.angular_components.TRANSFER_CANCEL_FINANCIAL_TITLE": "Cancelamento de título financeiro",
|
|
@@ -814,6 +816,7 @@ const enUS = {
|
|
|
814
816
|
"agro.angular_components.change_request_event_summary": "Weight Change",
|
|
815
817
|
"agro.angular_components.ticket_maintenance_header": "Ticket Maintenance",
|
|
816
818
|
"agro.angular_components.invoice_creating_event": "Invoice Issuance",
|
|
819
|
+
"agro.angular_components.invoice_close_event": "Invoice Closing",
|
|
817
820
|
"agro.angular_components.balance_entry_control_event": "Balance Entry/Exit",
|
|
818
821
|
"agro.angular_components.event_origin_label": "Event origin",
|
|
819
822
|
"agro.angular_components.event_details_header": "Event Details",
|
|
@@ -1135,6 +1138,7 @@ const esCO = {
|
|
|
1135
1138
|
"agro.angular_components.change_request_event_summary": "Cambio de \nPesaje",
|
|
1136
1139
|
"agro.angular_components.ticket_maintenance_header": "Mantenimiento de ticket",
|
|
1137
1140
|
"agro.angular_components.invoice_creating_event": "Emisión de Factura",
|
|
1141
|
+
"agro.angular_components.invoice_close_event": "Cierre de Factura",
|
|
1138
1142
|
"agro.angular_components.balance_entry_control_event": "Entrada/salida balanza",
|
|
1139
1143
|
"agro.angular_components.event_origin_label": "Origen del evento",
|
|
1140
1144
|
"agro.angular_components.event_details_header": "Detalles del Evento",
|
|
@@ -5304,38 +5308,6 @@ let ProducerInvoiceService = class ProducerInvoiceService extends AgroEntityServ
|
|
|
5304
5308
|
this.messageService = messageService;
|
|
5305
5309
|
this.translate = translate;
|
|
5306
5310
|
}
|
|
5307
|
-
getTotalLinkedInInvoices(invoiceId, fixationId) {
|
|
5308
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5309
|
-
const filter = `fixationItem.fixation.id eq '${fixationId}' ` + `and invoiceId in ('${invoiceId.join("','")}') `;
|
|
5310
|
-
return new Promise((resolve, reject) => {
|
|
5311
|
-
this.list({
|
|
5312
|
-
filterQuery: filter,
|
|
5313
|
-
size: AGRO_NUMBERS.ONE_HUNDRED,
|
|
5314
|
-
}).subscribe({
|
|
5315
|
-
next: (data) => {
|
|
5316
|
-
const invoiceList = data.contents;
|
|
5317
|
-
const producerInvoice = new Map();
|
|
5318
|
-
if (invoiceList.length) {
|
|
5319
|
-
invoiceList.forEach((invoice) => {
|
|
5320
|
-
var _a;
|
|
5321
|
-
producerInvoice.set(invoice.invoiceId, ((_a = producerInvoice.get(invoice.invoiceId)) !== null && _a !== void 0 ? _a : 0) + invoice.linkedValue);
|
|
5322
|
-
});
|
|
5323
|
-
}
|
|
5324
|
-
resolve(Array.from(producerInvoice.entries()).map(([key, value]) => {
|
|
5325
|
-
return {
|
|
5326
|
-
invoiceId: key,
|
|
5327
|
-
totalLinked: value,
|
|
5328
|
-
};
|
|
5329
|
-
}));
|
|
5330
|
-
},
|
|
5331
|
-
error: (err) => reject(new Error(typeof err === 'string' ? err : JSON.stringify(err))),
|
|
5332
|
-
});
|
|
5333
|
-
});
|
|
5334
|
-
});
|
|
5335
|
-
}
|
|
5336
|
-
deleteAllProducerInvoice(fixationId) {
|
|
5337
|
-
return this.http.post(`${this.actionsUrl}/deleteAllProducerInvoice`, { fixationId }).pipe(this.defaultCatch());
|
|
5338
|
-
}
|
|
5339
5311
|
};
|
|
5340
5312
|
ProducerInvoiceService.ctorParameters = () => [
|
|
5341
5313
|
{ type: HttpClient },
|
|
@@ -5511,13 +5483,6 @@ var EventOperation;
|
|
|
5511
5483
|
EventOperation["ORIGINATION_CREATE_STOCK_MOVEMENT"] = "ORIGINATION_CREATE_STOCK_MOVEMENT";
|
|
5512
5484
|
})(EventOperation || (EventOperation = {}));
|
|
5513
5485
|
|
|
5514
|
-
var InputFields;
|
|
5515
|
-
(function (InputFields) {
|
|
5516
|
-
InputFields["AGRO_INVOICE_TYPE"] = "agroInvoiceType";
|
|
5517
|
-
InputFields["INVOICE_TYPE"] = "invoiceType";
|
|
5518
|
-
InputFields["INVOICE_NUMBER"] = "number";
|
|
5519
|
-
})(InputFields || (InputFields = {}));
|
|
5520
|
-
|
|
5521
5486
|
const eventItem = [
|
|
5522
5487
|
{ label: "agro.angular_components.ticket_event", value: EventOperation.TICKET },
|
|
5523
5488
|
{ label: "agro.angular_components.provisional_event", value: EventOperation.PROVISIONAL },
|
|
@@ -5539,11 +5504,6 @@ const eventItem = [
|
|
|
5539
5504
|
label: `agro.angular_components.${EventOperation.INVOICE_CLOSE_INVOICE}`,
|
|
5540
5505
|
value: EventOperation.INVOICE_CLOSE_INVOICE,
|
|
5541
5506
|
},
|
|
5542
|
-
{
|
|
5543
|
-
label: `agro.angular_components.${EventOperation.INVOICE_CLOSE_INVOICE}`,
|
|
5544
|
-
value: EventOperation.INVOICE_CLOSE_INVOICE,
|
|
5545
|
-
subLabelField: InputFields.AGRO_INVOICE_TYPE,
|
|
5546
|
-
},
|
|
5547
5507
|
{ label: `agro.angular_components.${EventOperation.REPROCESS_INVOICE}`, value: EventOperation.REPROCESS_INVOICE },
|
|
5548
5508
|
{ label: `agro.angular_components.${EventOperation.EFFECTIVE_CONFIRMATION}`, value: EventOperation.EFFECTIVE_CONFIRMATION },
|
|
5549
5509
|
{ label: `agro.angular_components.${EventOperation.CHANGE_REQUEST}`, value: EventOperation.CHANGE_REQUEST },
|
|
@@ -6105,7 +6065,7 @@ let EventControlBoardComponent = class EventControlBoardComponent {
|
|
|
6105
6065
|
if (prescriptionOperations.includes(eventOperation)) {
|
|
6106
6066
|
formattedSubtitle = this.translate.instant('agro.angular_components.new_prescription_page', { count: subTitle });
|
|
6107
6067
|
}
|
|
6108
|
-
return formattedSubtitle;
|
|
6068
|
+
return formattedSubtitle !== null && formattedSubtitle !== void 0 ? formattedSubtitle : null;
|
|
6109
6069
|
}
|
|
6110
6070
|
onGridChange(event) {
|
|
6111
6071
|
const size = event === null || event === void 0 ? void 0 : event.rows;
|
|
@@ -6166,54 +6126,57 @@ let EventControlBoardComponent = class EventControlBoardComponent {
|
|
|
6166
6126
|
stepSelected(event) {
|
|
6167
6127
|
this.selectedStep = event.step;
|
|
6168
6128
|
this.applySidebarTitle("");
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
case EventOrigin.TICKET:
|
|
6172
|
-
case EventOrigin.INVOICE:
|
|
6173
|
-
case EventOrigin.CREATE_INVOICE:
|
|
6174
|
-
this.sidebarLoading = true;
|
|
6175
|
-
{
|
|
6176
|
-
const param = JSON.parse(this.selectedStep.item.input);
|
|
6177
|
-
const producerInvoiceId = this.getProducerInvoiceIdFromParams(param);
|
|
6178
|
-
let filterQuery = "";
|
|
6179
|
-
if (!producerInvoiceId) {
|
|
6180
|
-
const producerBalanceEntryControlId = this.getProducerBalanceEntryControlIdFromParams(param);
|
|
6181
|
-
if (!producerBalanceEntryControlId) {
|
|
6182
|
-
this.sidebarLoading = false;
|
|
6183
|
-
return;
|
|
6184
|
-
}
|
|
6185
|
-
filterQuery = `producerBalanceEntryControl.id eq '${producerBalanceEntryControlId}'`;
|
|
6186
|
-
}
|
|
6187
|
-
else {
|
|
6188
|
-
filterQuery = `id eq '${producerInvoiceId}'`;
|
|
6189
|
-
}
|
|
6190
|
-
this.producerInvoiceService
|
|
6191
|
-
.list({
|
|
6192
|
-
displayFields: ["*", "producerBalanceEntryControl.*", "producerBalanceEntryControl.producer.*"],
|
|
6193
|
-
filterQuery,
|
|
6194
|
-
page: 0,
|
|
6195
|
-
size: 1,
|
|
6196
|
-
})
|
|
6197
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
6198
|
-
.subscribe((result) => {
|
|
6199
|
-
this.producerInvoice = result === null || result === void 0 ? void 0 : result.contents[0];
|
|
6200
|
-
this.producerInvoice;
|
|
6201
|
-
this.sidebarLoading = false;
|
|
6202
|
-
this.applySidebarTitle(this.getProducerInvoiceNumberAndSerie());
|
|
6203
|
-
}, () => {
|
|
6204
|
-
this.sidebarLoading = false;
|
|
6205
|
-
});
|
|
6206
|
-
}
|
|
6207
|
-
break;
|
|
6208
|
-
case EventOrigin.FIXATION:
|
|
6209
|
-
case EventOrigin.CANCEL_FIXATION:
|
|
6210
|
-
case EventOrigin.CHANGE_REQUEST:
|
|
6211
|
-
case EventOrigin.TRANSFER:
|
|
6212
|
-
break;
|
|
6129
|
+
if (this.shouldLoadProducerInvoice(this.selectedStep.eventType)) {
|
|
6130
|
+
this.loadSelectedStepProducerInvoice();
|
|
6213
6131
|
}
|
|
6214
6132
|
this.showReprocessButton = event.step.state === StepState$1.Warning;
|
|
6215
6133
|
this.showSidebar = true;
|
|
6216
6134
|
}
|
|
6135
|
+
shouldLoadProducerInvoice(eventType) {
|
|
6136
|
+
return [
|
|
6137
|
+
EventOrigin.BALANCE_ENTRY_CONTROL,
|
|
6138
|
+
EventOrigin.TICKET,
|
|
6139
|
+
EventOrigin.INVOICE,
|
|
6140
|
+
EventOrigin.CREATE_INVOICE,
|
|
6141
|
+
EventOrigin.CLOSE_INVOICE,
|
|
6142
|
+
].includes(eventType);
|
|
6143
|
+
}
|
|
6144
|
+
loadSelectedStepProducerInvoice() {
|
|
6145
|
+
this.sidebarLoading = true;
|
|
6146
|
+
const param = JSON.parse(this.selectedStep.item.input);
|
|
6147
|
+
const filterQuery = this.getProducerInvoiceFilterQuery(param);
|
|
6148
|
+
if (!filterQuery) {
|
|
6149
|
+
this.sidebarLoading = false;
|
|
6150
|
+
return;
|
|
6151
|
+
}
|
|
6152
|
+
this.producerInvoiceService
|
|
6153
|
+
.list({
|
|
6154
|
+
displayFields: ["*", "producerBalanceEntryControl.*", "producerBalanceEntryControl.producer.*"],
|
|
6155
|
+
filterQuery,
|
|
6156
|
+
page: 0,
|
|
6157
|
+
size: 1,
|
|
6158
|
+
})
|
|
6159
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
6160
|
+
.subscribe((result) => {
|
|
6161
|
+
this.producerInvoice = result === null || result === void 0 ? void 0 : result.contents[0];
|
|
6162
|
+
this.producerInvoice;
|
|
6163
|
+
this.sidebarLoading = false;
|
|
6164
|
+
this.applySidebarTitle(this.getProducerInvoiceNumberAndSerie());
|
|
6165
|
+
}, () => {
|
|
6166
|
+
this.sidebarLoading = false;
|
|
6167
|
+
});
|
|
6168
|
+
}
|
|
6169
|
+
getProducerInvoiceFilterQuery(param) {
|
|
6170
|
+
const producerInvoiceId = this.getProducerInvoiceIdFromParams(param);
|
|
6171
|
+
if (producerInvoiceId) {
|
|
6172
|
+
return `id eq '${producerInvoiceId}'`;
|
|
6173
|
+
}
|
|
6174
|
+
const producerBalanceEntryControlId = this.getProducerBalanceEntryControlIdFromParams(param);
|
|
6175
|
+
if (!producerBalanceEntryControlId) {
|
|
6176
|
+
return null;
|
|
6177
|
+
}
|
|
6178
|
+
return `producerBalanceEntryControl.id eq '${producerBalanceEntryControlId}'`;
|
|
6179
|
+
}
|
|
6217
6180
|
applySidebarTitle(title) {
|
|
6218
6181
|
this.sidebarTitle = this.translate.instant("agro.angular_components.event_sidebar_title", { eventNumber: title });
|
|
6219
6182
|
}
|
|
@@ -7123,6 +7086,7 @@ let ModalInvoicePjBase = class ModalInvoicePjBase {
|
|
|
7123
7086
|
this.gridLoading = true;
|
|
7124
7087
|
this.dontHaveAnyInvoice = false;
|
|
7125
7088
|
this.updateCurrentParams(event);
|
|
7089
|
+
const numberSearchValue = searchValue ? AgroNumberUtils.getNearInteger(searchValue) : null;
|
|
7126
7090
|
const filterBody = {
|
|
7127
7091
|
filter: {
|
|
7128
7092
|
companyId,
|
|
@@ -7131,6 +7095,7 @@ let ModalInvoicePjBase = class ModalInvoicePjBase {
|
|
|
7131
7095
|
ruralEstateIds: [ruralEstateId],
|
|
7132
7096
|
multiProducts: false,
|
|
7133
7097
|
productId: this.options.productId,
|
|
7098
|
+
number: numberSearchValue,
|
|
7134
7099
|
},
|
|
7135
7100
|
pageRequest: {
|
|
7136
7101
|
offset: this.currentParams.page,
|
|
@@ -7142,16 +7107,19 @@ let ModalInvoicePjBase = class ModalInvoicePjBase {
|
|
|
7142
7107
|
},
|
|
7143
7108
|
};
|
|
7144
7109
|
if (searchValue) {
|
|
7145
|
-
searchValue =
|
|
7110
|
+
searchValue = numberSearchValue.toString();
|
|
7146
7111
|
}
|
|
7147
7112
|
this.invoiceService
|
|
7148
7113
|
.invoiceLookupFilter(filterBody)
|
|
7149
|
-
.pipe(takeUntil(this.ngUnsubscribe),
|
|
7114
|
+
.pipe(takeUntil(this.ngUnsubscribe), switchMap((result) => __awaiter(this, void 0, void 0, function* () {
|
|
7115
|
+
yield this.adaptResult(result);
|
|
7116
|
+
return result;
|
|
7117
|
+
})), finalize(() => {
|
|
7150
7118
|
this.gridLoading = false;
|
|
7151
7119
|
}))
|
|
7152
7120
|
.subscribe((result) => {
|
|
7153
7121
|
var _a;
|
|
7154
|
-
this.gridData = ((_a = result === null || result === void 0 ? void 0 : result.result) === null || _a === void 0 ? void 0 : _a.invoices) || [];
|
|
7122
|
+
this.gridData = (((_a = result === null || result === void 0 ? void 0 : result.result) === null || _a === void 0 ? void 0 : _a.invoices) || []).map((invoice) => (Object.assign(Object.assign({}, invoice), { _uniqueId: invoice.externalInvoiceId || invoice.invoiceId })));
|
|
7155
7123
|
if (this.gridData.length === 0 && !searchValue) {
|
|
7156
7124
|
this.dontHaveAnyInvoice = true;
|
|
7157
7125
|
}
|
|
@@ -7273,7 +7241,7 @@ __decorate([
|
|
|
7273
7241
|
ModalInvoicePjForOriginationComponent = __decorate([
|
|
7274
7242
|
Component({
|
|
7275
7243
|
selector: 's-modal-invoice-pj-for-origination',
|
|
7276
|
-
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=\"
|
|
7244
|
+
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",
|
|
7277
7245
|
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}"]
|
|
7278
7246
|
})
|
|
7279
7247
|
], ModalInvoicePjForOriginationComponent);
|
|
@@ -7334,7 +7302,7 @@ ModalInvoicePjForTransferComponent.ctorParameters = () => [
|
|
|
7334
7302
|
ModalInvoicePjForTransferComponent = __decorate([
|
|
7335
7303
|
Component({
|
|
7336
7304
|
selector: 's-modal-invoice-pj-for-transfer',
|
|
7337
|
-
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=\"
|
|
7305
|
+
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",
|
|
7338
7306
|
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}"]
|
|
7339
7307
|
})
|
|
7340
7308
|
], ModalInvoicePjForTransferComponent);
|
|
@@ -7350,6 +7318,58 @@ ModalInvoicePjForTransferModule = __decorate([
|
|
|
7350
7318
|
})
|
|
7351
7319
|
], ModalInvoicePjForTransferModule);
|
|
7352
7320
|
|
|
7321
|
+
let ProducerInvoiceService$1 = class ProducerInvoiceService extends AgroEntityService {
|
|
7322
|
+
constructor(http, messageService, translate) {
|
|
7323
|
+
super(http, messageService, `agro/fixation/entities/producerInvoice`, `agro/fixation/actions`, `agro/fixation/queries`, translate);
|
|
7324
|
+
this.http = http;
|
|
7325
|
+
this.messageService = messageService;
|
|
7326
|
+
this.translate = translate;
|
|
7327
|
+
}
|
|
7328
|
+
getTotalLinkedInInvoices(invoiceId, fixationId) {
|
|
7329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7330
|
+
const filter = `fixationItem.fixation.id eq '${fixationId}' ` + `and externalInvoiceId in ('${invoiceId.join("','")}') `;
|
|
7331
|
+
return new Promise((resolve, reject) => {
|
|
7332
|
+
this.list({
|
|
7333
|
+
filterQuery: filter,
|
|
7334
|
+
size: 100
|
|
7335
|
+
}).subscribe({
|
|
7336
|
+
next: (data) => {
|
|
7337
|
+
const invoiceList = data.contents;
|
|
7338
|
+
const producerInvoice = new Map();
|
|
7339
|
+
if (invoiceList.length) {
|
|
7340
|
+
invoiceList.forEach((invoice) => {
|
|
7341
|
+
var _a;
|
|
7342
|
+
producerInvoice.set(invoice.invoiceId, ((_a = producerInvoice.get(invoice.invoiceId)) !== null && _a !== void 0 ? _a : 0) + invoice.linkedValue);
|
|
7343
|
+
});
|
|
7344
|
+
}
|
|
7345
|
+
resolve(Array.from(producerInvoice.entries()).map(([key, value]) => {
|
|
7346
|
+
return {
|
|
7347
|
+
invoiceId: key,
|
|
7348
|
+
totalLinked: value
|
|
7349
|
+
};
|
|
7350
|
+
}));
|
|
7351
|
+
},
|
|
7352
|
+
error: (err) => reject(err instanceof Error ? err : new Error(String(err)))
|
|
7353
|
+
});
|
|
7354
|
+
});
|
|
7355
|
+
});
|
|
7356
|
+
}
|
|
7357
|
+
deleteAllProducerInvoice(fixationId) {
|
|
7358
|
+
return this.http.post(`${this.actionsUrl}/deleteAllProducerInvoice`, { fixationId }).pipe(this.defaultCatch());
|
|
7359
|
+
}
|
|
7360
|
+
};
|
|
7361
|
+
ProducerInvoiceService$1.ctorParameters = () => [
|
|
7362
|
+
{ type: HttpClient },
|
|
7363
|
+
{ type: MessageService },
|
|
7364
|
+
{ type: LibTranslationService }
|
|
7365
|
+
];
|
|
7366
|
+
ProducerInvoiceService$1.ɵprov = ɵɵdefineInjectable({ factory: function ProducerInvoiceService_Factory() { return new ProducerInvoiceService$1(ɵɵinject(HttpClient), ɵɵinject(MessageService), ɵɵinject(LibTranslationService)); }, token: ProducerInvoiceService$1, providedIn: "root" });
|
|
7367
|
+
ProducerInvoiceService$1 = __decorate([
|
|
7368
|
+
Injectable({
|
|
7369
|
+
providedIn: 'root'
|
|
7370
|
+
})
|
|
7371
|
+
], ProducerInvoiceService$1);
|
|
7372
|
+
|
|
7353
7373
|
let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponent extends ModalInvoicePjBase {
|
|
7354
7374
|
constructor(translationService, invoiceService, localeService, kilogramPipe, currencyPipe, producerInvoiceService, messageService, datePipe) {
|
|
7355
7375
|
super(translationService, invoiceService, localeService, kilogramPipe, messageService, datePipe);
|
|
@@ -7362,10 +7382,11 @@ let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponen
|
|
|
7362
7382
|
this.messageService = messageService;
|
|
7363
7383
|
this.datePipe = datePipe;
|
|
7364
7384
|
this.whenSelectInvoices = new EventEmitter();
|
|
7385
|
+
registerLocaleData(localePt);
|
|
7365
7386
|
}
|
|
7366
7387
|
ngOnInit() {
|
|
7367
7388
|
this.defineGridColumns();
|
|
7368
|
-
this.gridFieldValuesMap = Object.assign(Object.assign({}, this.gridFieldValuesMap), { series: (row) => (row === null || row === void 0 ? void 0 : row.seriesLegal) || (row === null || row === void 0 ? void 0 : row.series) || row.series, totalValue: (row) => this.currencyPipe.transform((row === null || row === void 0 ? void 0 : row.
|
|
7389
|
+
this.gridFieldValuesMap = Object.assign(Object.assign({}, this.gridFieldValuesMap), { series: (row) => (row === null || row === void 0 ? void 0 : row.seriesLegal) || (row === null || row === void 0 ? void 0 : row.series) || row.series, totalValue: (row) => this.currencyPipe.transform(this.getTotalValue(row) || 0, 'BRL', 'symbol', undefined, 'pt-BR'), linkedValue: (row) => this.currencyPipe.transform((row === null || row === void 0 ? void 0 : row.linkedValue) || 0, 'BRL', 'symbol', undefined, 'pt-BR') });
|
|
7369
7390
|
super.ngOnInit();
|
|
7370
7391
|
}
|
|
7371
7392
|
defineGridColumns() {
|
|
@@ -7387,7 +7408,7 @@ let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponen
|
|
|
7387
7408
|
}
|
|
7388
7409
|
beforeAdd(selectedInvoices) {
|
|
7389
7410
|
if (selectedInvoices === null || selectedInvoices === void 0 ? void 0 : selectedInvoices.length) {
|
|
7390
|
-
this.linkSelectedInvoicesInFixationItem();
|
|
7411
|
+
this.linkSelectedInvoicesInFixationItem(selectedInvoices);
|
|
7391
7412
|
}
|
|
7392
7413
|
return of(EMPTY).toPromise();
|
|
7393
7414
|
}
|
|
@@ -7402,14 +7423,14 @@ let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponen
|
|
|
7402
7423
|
}
|
|
7403
7424
|
super.open();
|
|
7404
7425
|
}
|
|
7405
|
-
linkSelectedInvoicesInFixationItem() {
|
|
7426
|
+
linkSelectedInvoicesInFixationItem(selectedInvoices) {
|
|
7406
7427
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7407
|
-
if (!(yield this.isValidAndSetLinkedValueInInvoices())) {
|
|
7428
|
+
if (!(yield this.isValidAndSetLinkedValueInInvoices(selectedInvoices))) {
|
|
7408
7429
|
this.gridLoading = false;
|
|
7409
7430
|
return;
|
|
7410
7431
|
}
|
|
7411
7432
|
const entities = []
|
|
7412
|
-
.concat(...
|
|
7433
|
+
.concat(...selectedInvoices.map((invoice) => {
|
|
7413
7434
|
return this.options.fixationItems.map((fixationItem) => {
|
|
7414
7435
|
const requiredValue = (fixationItem.requiredValue || 0) - (fixationItem.totalValueInvoices || 0);
|
|
7415
7436
|
if (invoice.remainingValue <= 0 || requiredValue <= 0) {
|
|
@@ -7420,11 +7441,11 @@ let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponen
|
|
|
7420
7441
|
const body = {
|
|
7421
7442
|
series: invoice === null || invoice === void 0 ? void 0 : invoice.series,
|
|
7422
7443
|
number: String(invoice === null || invoice === void 0 ? void 0 : invoice.number),
|
|
7423
|
-
|
|
7444
|
+
externalInvoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.externalInvoiceId,
|
|
7424
7445
|
linkedValue: valueToBeLinked,
|
|
7425
|
-
totalValue: invoice
|
|
7446
|
+
totalValue: this.getTotalValue(invoice),
|
|
7426
7447
|
issuanceDate: invoice === null || invoice === void 0 ? void 0 : invoice.issuanceDate,
|
|
7427
|
-
fixationItem,
|
|
7448
|
+
fixationItem: { id: fixationItem === null || fixationItem === void 0 ? void 0 : fixationItem.id },
|
|
7428
7449
|
};
|
|
7429
7450
|
fixationItem.totalValueInvoices = (fixationItem.totalValueInvoices || 0) + valueToBeLinked;
|
|
7430
7451
|
return body;
|
|
@@ -7448,13 +7469,19 @@ let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponen
|
|
|
7448
7469
|
});
|
|
7449
7470
|
});
|
|
7450
7471
|
}
|
|
7451
|
-
isValidAndSetLinkedValueInInvoices() {
|
|
7472
|
+
isValidAndSetLinkedValueInInvoices(selectedInvoices) {
|
|
7452
7473
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7453
|
-
const valorLinked = yield this.producerInvoiceService.getTotalLinkedInInvoices(
|
|
7474
|
+
const valorLinked = yield this.producerInvoiceService.getTotalLinkedInInvoices(selectedInvoices.map((invoice) => invoice.externalInvoiceId), this.options.fixationId);
|
|
7475
|
+
selectedInvoices.forEach((invoice) => {
|
|
7476
|
+
if (!invoice.totalValue) {
|
|
7477
|
+
invoice.totalValue = this.getTotalValue(invoice);
|
|
7478
|
+
}
|
|
7479
|
+
});
|
|
7454
7480
|
let isValid = true;
|
|
7455
|
-
|
|
7481
|
+
selectedInvoices.forEach((invoice) => {
|
|
7456
7482
|
var _a;
|
|
7457
|
-
invoice.linkedValue =
|
|
7483
|
+
invoice.linkedValue =
|
|
7484
|
+
((_a = valorLinked.find((linked) => linked.externalInvoiceId === invoice.externalInvoiceId)) === null || _a === void 0 ? void 0 : _a.totalLinked) || 0;
|
|
7458
7485
|
if (invoice.linkedValue >= invoice.totalValue) {
|
|
7459
7486
|
this.messageService.add({
|
|
7460
7487
|
severity: 'warn',
|
|
@@ -7469,24 +7496,25 @@ let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponen
|
|
|
7469
7496
|
});
|
|
7470
7497
|
}
|
|
7471
7498
|
adaptResult(result) {
|
|
7499
|
+
var _a;
|
|
7472
7500
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7473
|
-
return
|
|
7501
|
+
return yield this.updateLinkedValueInGrid(((_a = result === null || result === void 0 ? void 0 : result.result) === null || _a === void 0 ? void 0 : _a.invoices) || []);
|
|
7474
7502
|
});
|
|
7475
7503
|
}
|
|
7476
7504
|
cancel() {
|
|
7477
7505
|
this.options.fixationItems = [];
|
|
7478
7506
|
return super.cancel();
|
|
7479
7507
|
}
|
|
7480
|
-
updateLinkedValueInGrid(
|
|
7508
|
+
updateLinkedValueInGrid(result) {
|
|
7481
7509
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7482
|
-
const
|
|
7510
|
+
const externalInvoiceId = result.map((invoice) => invoice.externalInvoiceId);
|
|
7483
7511
|
let filter = `fixationItem.fixation.id eq '${this.options.fixationId}'`;
|
|
7484
|
-
if (
|
|
7485
|
-
filter += `and
|
|
7512
|
+
if (externalInvoiceId && externalInvoiceId.length > 0) {
|
|
7513
|
+
filter += `and externalInvoiceId in ('${externalInvoiceId.join("','")}') `;
|
|
7486
7514
|
}
|
|
7487
7515
|
const listParams = {
|
|
7488
7516
|
page: 0,
|
|
7489
|
-
size:
|
|
7517
|
+
size: result.length,
|
|
7490
7518
|
filterQuery: filter,
|
|
7491
7519
|
};
|
|
7492
7520
|
yield this.producerInvoiceService
|
|
@@ -7495,14 +7523,23 @@ let ModalInvoicePjForFixationComponent = class ModalInvoicePjForFixationComponen
|
|
|
7495
7523
|
.toPromise()
|
|
7496
7524
|
.then((producerInvoices) => {
|
|
7497
7525
|
producerInvoices === null || producerInvoices === void 0 ? void 0 : producerInvoices.contents.forEach((invoice) => {
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7526
|
+
var _a;
|
|
7527
|
+
(_a = result
|
|
7528
|
+
.filter((item) => item.externalInvoiceId === invoice.externalInvoiceId)) === null || _a === void 0 ? void 0 : _a.forEach((linkedInvoice) => {
|
|
7529
|
+
linkedInvoice.linkedValue = invoice.linkedValue;
|
|
7530
|
+
});
|
|
7502
7531
|
});
|
|
7503
7532
|
});
|
|
7504
7533
|
});
|
|
7505
7534
|
}
|
|
7535
|
+
getTotalValue(row) {
|
|
7536
|
+
const netTotalValue = row === null || row === void 0 ? void 0 : row.netTotalValue;
|
|
7537
|
+
if (netTotalValue) {
|
|
7538
|
+
return netTotalValue;
|
|
7539
|
+
}
|
|
7540
|
+
const items = (row === null || row === void 0 ? void 0 : row.items) || [];
|
|
7541
|
+
return items.reduce((total, item) => total + (item.unitPrice || 0) * (item.quantity || 0), 0);
|
|
7542
|
+
}
|
|
7506
7543
|
};
|
|
7507
7544
|
ModalInvoicePjForFixationComponent.ctorParameters = () => [
|
|
7508
7545
|
{ type: LibTranslationService },
|
|
@@ -7510,7 +7547,7 @@ ModalInvoicePjForFixationComponent.ctorParameters = () => [
|
|
|
7510
7547
|
{ type: LocaleService },
|
|
7511
7548
|
{ type: KilogramPipe },
|
|
7512
7549
|
{ type: CurrencyPipe },
|
|
7513
|
-
{ type: ProducerInvoiceService },
|
|
7550
|
+
{ type: ProducerInvoiceService$1 },
|
|
7514
7551
|
{ type: MessageService$1 },
|
|
7515
7552
|
{ type: DatePipe }
|
|
7516
7553
|
];
|
|
@@ -7523,7 +7560,7 @@ __decorate([
|
|
|
7523
7560
|
ModalInvoicePjForFixationComponent = __decorate([
|
|
7524
7561
|
Component({
|
|
7525
7562
|
selector: 's-modal-invoice-pj-for-fixation',
|
|
7526
|
-
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=\"
|
|
7563
|
+
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",
|
|
7527
7564
|
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}"]
|
|
7528
7565
|
})
|
|
7529
7566
|
], ModalInvoicePjForFixationComponent);
|