From ca35c88be462ac41bd15371ad5f4f07c1644f0b2 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 22 Mar 2022 07:38:14 +0100 Subject: [PATCH 1/5] feat(print_deliveryNote): add proforma type --- modules/ticket/front/descriptor-menu/index.html | 7 ++++++- modules/ticket/front/descriptor-menu/index.js | 3 ++- modules/ticket/front/descriptor-menu/index.spec.js | 7 ++++--- modules/ticket/front/descriptor-menu/locale/es.yml | 3 ++- print/templates/reports/delivery-note/delivery-note.html | 4 ++-- print/templates/reports/delivery-note/delivery-note.js | 4 ++++ print/templates/reports/delivery-note/locale/en.yml | 4 ++-- print/templates/reports/delivery-note/locale/es.yml | 4 ++-- print/templates/reports/delivery-note/locale/fr.yml | 4 ++-- print/templates/reports/delivery-note/locale/pt.yml | 4 ++-- 10 files changed, 28 insertions(+), 16 deletions(-) diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index d613fb5de..00962d89c 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -21,7 +21,7 @@ as PDF @@ -40,6 +40,11 @@ + + Show Proforma + diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 841dfa409..6465c43ac 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -116,10 +116,11 @@ class Controller extends Section { }); } - showPdfDeliveryNote() { + showPdfDeliveryNote(type) { this.vnReport.show('delivery-note', { recipientId: this.ticket.client.id, ticketId: this.id, + type: type }); } diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js index 0a80d0884..faf45504e 100644 --- a/modules/ticket/front/descriptor-menu/index.spec.js +++ b/modules/ticket/front/descriptor-menu/index.spec.js @@ -122,14 +122,15 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { describe('showPdfDeliveryNote()', () => { it('should open a new window showing a delivery note PDF document', () => { jest.spyOn(window, 'open').mockReturnThis(); - + const type = 'deliveryNote'; const expectedParams = { ticketId: ticket.id, - recipientId: ticket.client.id + recipientId: ticket.client.id, + type: type }; const serializedParams = $httpParamSerializer(expectedParams); const expectedPath = `api/report/delivery-note?${serializedParams}`; - controller.showPdfDeliveryNote(); + controller.showPdfDeliveryNote(type); expect(window.open).toHaveBeenCalledWith(expectedPath); }); diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml index 4a61556db..56fa1a973 100644 --- a/modules/ticket/front/descriptor-menu/locale/es.yml +++ b/modules/ticket/front/descriptor-menu/locale/es.yml @@ -5,4 +5,5 @@ as CSV: como CSV Send PDF: Enviar PDF Send CSV: Enviar CSV Send CSV Delivery Note: Enviar albarán en CSV -Send PDF Delivery Note: Enviar albarán en PDF \ No newline at end of file +Send PDF Delivery Note: Enviar albarán en PDF +Show Proforma: Ver proforma \ No newline at end of file diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 36d9abde1..c9d2498a5 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -15,7 +15,7 @@
-

{{$t('title')}}

+

{{$t(type)}}

@@ -23,7 +23,7 @@ - + diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index 0ee7c8c91..7f9ca7d0f 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -119,6 +119,10 @@ module.exports = { ticketId: { type: [Number, String], required: true + }, + type: { + type: String, + required: true } } }; diff --git a/print/templates/reports/delivery-note/locale/en.yml b/print/templates/reports/delivery-note/locale/en.yml index 16d0954e2..1fe254a47 100644 --- a/print/templates/reports/delivery-note/locale/en.yml +++ b/print/templates/reports/delivery-note/locale/en.yml @@ -1,6 +1,6 @@ reportName: delivery-note -title: Delivery note -ticketId: Delivery note +deliveryNote: Delivery note +proforma: Proforma clientId: Client deliveryAddress: Delivery address fiscalData: Fiscal data diff --git a/print/templates/reports/delivery-note/locale/es.yml b/print/templates/reports/delivery-note/locale/es.yml index ca670ad59..b33b376fd 100644 --- a/print/templates/reports/delivery-note/locale/es.yml +++ b/print/templates/reports/delivery-note/locale/es.yml @@ -1,6 +1,6 @@ reportName: albaran -title: Albarán -ticketId: Albarán +deliveryNote: Albarán +proforma: Proforma clientId: Cliente deliveryAddress: Dirección de entrega fiscalData: Datos fiscales diff --git a/print/templates/reports/delivery-note/locale/fr.yml b/print/templates/reports/delivery-note/locale/fr.yml index 6b3779a5b..74d52471d 100644 --- a/print/templates/reports/delivery-note/locale/fr.yml +++ b/print/templates/reports/delivery-note/locale/fr.yml @@ -1,6 +1,6 @@ reportName: bon-de-livraison -title: Bon de livraison -ticketId: BL +deliveryNote: Bon de livraison +proforma: Proforma clientId: Client deliveryAddress: Adresse de livraison fiscalData: Coordonnées diff --git a/print/templates/reports/delivery-note/locale/pt.yml b/print/templates/reports/delivery-note/locale/pt.yml index 1a9c1fbd1..93554f74b 100644 --- a/print/templates/reports/delivery-note/locale/pt.yml +++ b/print/templates/reports/delivery-note/locale/pt.yml @@ -1,6 +1,6 @@ reportName: nota-de-entrega -title: Nota de Entrega -ticketId: Nota de Entrega +deliveryNote: Nota de Entrega +proforma: Proforma clientId: Cliente deliveryAddress: Morada de Entrega fiscalData: Dados Fiscais From 7fc82cbfeb994c2a84cec74e67b1f00c7aadf761 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 22 Mar 2022 10:32:26 +0100 Subject: [PATCH 2/5] feat(ticket_descriptor-menu): add show proforma --- modules/ticket/front/descriptor-menu/index.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index 00962d89c..faa8eedfe 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -40,16 +40,10 @@ - - Show Proforma - Send Delivery Note... - + + Show Proforma + Date: Tue, 22 Mar 2022 14:59:57 +0100 Subject: [PATCH 3/5] change footer --- print/templates/reports/delivery-note/delivery-note.html | 2 +- print/templates/reports/delivery-note/locale/en.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index c9d2498a5..6ee9a221b 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -281,7 +281,7 @@ diff --git a/print/templates/reports/delivery-note/locale/en.yml b/print/templates/reports/delivery-note/locale/en.yml index 1fe254a47..93c09d98c 100644 --- a/print/templates/reports/delivery-note/locale/en.yml +++ b/print/templates/reports/delivery-note/locale/en.yml @@ -17,7 +17,6 @@ total: Total subtotal: Subtotal vatType: VAT Type digitalSignature: Digital signature -ticket: Delivery note {0} plantPassport: Plant passport packages: Packages services: From 4a323d2cfbedc98af04dd24b38728d1d11ebf4aa Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 23 Mar 2022 09:27:10 +0100 Subject: [PATCH 4/5] report-footer use function --- print/templates/reports/delivery-note/delivery-note.html | 2 +- print/templates/reports/delivery-note/delivery-note.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 6ee9a221b..a81426df8 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -281,7 +281,7 @@ diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index 7f9ca7d0f..e272208ee 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -109,6 +109,10 @@ module.exports = { return phytosanitary.filter((item, index) => phytosanitary.indexOf(item) == index ).join(', '); + }, + footerType() { + const translatedType = this.$t(this.type); + return `${translatedType} ${this.ticketId}`; } }, components: { From 2d9163ea1b9e3289360313167da1e8bdc4f6a9d8 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 23 Mar 2022 09:48:09 +0100 Subject: [PATCH 5/5] use computed function --- print/templates/reports/delivery-note/delivery-note.html | 2 +- print/templates/reports/delivery-note/delivery-note.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index a81426df8..644e0cf04 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -281,7 +281,7 @@ diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index e272208ee..dbfedae8f 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -44,6 +44,10 @@ module.exports = { }); return total; + }, + footerType() { + const translatedType = this.$t(this.type); + return `${translatedType} ${this.ticketId}`; } }, methods: { @@ -109,10 +113,6 @@ module.exports = { return phytosanitary.filter((item, index) => phytosanitary.indexOf(item) == index ).join(', '); - }, - footerType() { - const translatedType = this.$t(this.type); - return `${translatedType} ${this.ticketId}`; } }, components: {
{{client.id}}
{{$t('ticketId')}}{{$t(type)}} {{ticket.id}}