Merge pull request '3597-feat(print_deliveryNote): add proforma type' (#906) from 3597-ticket_descriptor_proforma into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #906
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2022-03-23 11:22:57 +00:00
commit 6e9db8b1cd
10 changed files with 33 additions and 19 deletions

View File

@ -21,7 +21,7 @@
<vn-list> <vn-list>
<vn-item <vn-item
ng-if="!$ctrl.hasDocuwareFile" ng-if="!$ctrl.hasDocuwareFile"
ng-click="$ctrl.showPdfDeliveryNote()" ng-click="$ctrl.showPdfDeliveryNote('deliveryNote')"
translate> translate>
as PDF as PDF
</vn-item> </vn-item>
@ -44,7 +44,6 @@
vn-click-stop="sendDeliveryNoteMenu.show($event, 'left')" vn-click-stop="sendDeliveryNoteMenu.show($event, 'left')"
translate> translate>
Send Delivery Note... Send Delivery Note...
<vn-menu vn-id="sendDeliveryNoteMenu"> <vn-menu vn-id="sendDeliveryNoteMenu">
<vn-list> <vn-list>
<vn-item <vn-item
@ -60,6 +59,11 @@
</vn-list> </vn-list>
</vn-menu> </vn-menu>
</vn-item> </vn-item>
<vn-item
ng-click="$ctrl.showPdfDeliveryNote('proforma')"
translate>
Show Proforma
</vn-item>
<vn-item <vn-item
ng-click="deleteConfirmation.show()" ng-click="deleteConfirmation.show()"
ng-show="$ctrl.isEditable" ng-show="$ctrl.isEditable"

View File

@ -116,10 +116,11 @@ class Controller extends Section {
}); });
} }
showPdfDeliveryNote() { showPdfDeliveryNote(type) {
this.vnReport.show('delivery-note', { this.vnReport.show('delivery-note', {
recipientId: this.ticket.client.id, recipientId: this.ticket.client.id,
ticketId: this.id, ticketId: this.id,
type: type
}); });
} }

View File

@ -122,14 +122,15 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
describe('showPdfDeliveryNote()', () => { describe('showPdfDeliveryNote()', () => {
it('should open a new window showing a delivery note PDF document', () => { it('should open a new window showing a delivery note PDF document', () => {
jest.spyOn(window, 'open').mockReturnThis(); jest.spyOn(window, 'open').mockReturnThis();
const type = 'deliveryNote';
const expectedParams = { const expectedParams = {
ticketId: ticket.id, ticketId: ticket.id,
recipientId: ticket.client.id recipientId: ticket.client.id,
type: type
}; };
const serializedParams = $httpParamSerializer(expectedParams); const serializedParams = $httpParamSerializer(expectedParams);
const expectedPath = `api/report/delivery-note?${serializedParams}`; const expectedPath = `api/report/delivery-note?${serializedParams}`;
controller.showPdfDeliveryNote(); controller.showPdfDeliveryNote(type);
expect(window.open).toHaveBeenCalledWith(expectedPath); expect(window.open).toHaveBeenCalledWith(expectedPath);
}); });

View File

@ -6,3 +6,4 @@ Send PDF: Enviar PDF
Send CSV: Enviar CSV Send CSV: Enviar CSV
Send CSV Delivery Note: Enviar albarán en CSV Send CSV Delivery Note: Enviar albarán en CSV
Send PDF Delivery Note: Enviar albarán en PDF Send PDF Delivery Note: Enviar albarán en PDF
Show Proforma: Ver proforma

View File

@ -15,7 +15,7 @@
<div class="columns"> <div class="columns">
<div class="size50"> <div class="size50">
<div class="size75 vn-mt-ml"> <div class="size75 vn-mt-ml">
<h1 class="title uppercase">{{$t('title')}}</h1> <h1 class="title uppercase">{{$t(type)}}</h1>
<table class="row-oriented ticket-info"> <table class="row-oriented ticket-info">
<tbody> <tbody>
<tr> <tr>
@ -23,7 +23,7 @@
<th>{{client.id}}</th> <th>{{client.id}}</th>
</tr> </tr>
<tr> <tr>
<td class="font gray uppercase">{{$t('ticketId')}}</td> <td class="font gray uppercase">{{$t(type)}}</td>
<th>{{ticket.id}}</th> <th>{{ticket.id}}</th>
</tr> </tr>
<tr> <tr>
@ -281,7 +281,7 @@
<!-- Footer block --> <!-- Footer block -->
<report-footer id="pageFooter" <report-footer id="pageFooter"
v-bind:company-code="ticket.companyCode" v-bind:company-code="ticket.companyCode"
v-bind:left-text="$t('ticket', [ticket.id])" v-bind:left-text="footerType"
v-bind:center-text="client.socialName" v-bind:center-text="client.socialName"
v-bind="$props"> v-bind="$props">
</report-footer> </report-footer>

View File

@ -44,6 +44,10 @@ module.exports = {
}); });
return total; return total;
},
footerType() {
const translatedType = this.$t(this.type);
return `${translatedType} ${this.ticketId}`;
} }
}, },
methods: { methods: {
@ -119,6 +123,10 @@ module.exports = {
ticketId: { ticketId: {
type: [Number, String], type: [Number, String],
required: true required: true
},
type: {
type: String,
required: true
} }
} }
}; };

View File

@ -1,6 +1,6 @@
reportName: delivery-note reportName: delivery-note
title: Delivery note deliveryNote: Delivery note
ticketId: Delivery note proforma: Proforma
clientId: Client clientId: Client
deliveryAddress: Delivery address deliveryAddress: Delivery address
fiscalData: Fiscal data fiscalData: Fiscal data
@ -17,7 +17,6 @@ total: Total
subtotal: Subtotal subtotal: Subtotal
vatType: VAT Type vatType: VAT Type
digitalSignature: Digital signature digitalSignature: Digital signature
ticket: Delivery note {0}
plantPassport: Plant passport plantPassport: Plant passport
packages: Packages packages: Packages
services: services:

View File

@ -1,6 +1,6 @@
reportName: albaran reportName: albaran
title: Albarán deliveryNote: Albarán
ticketId: Albarán proforma: Proforma
clientId: Cliente clientId: Cliente
deliveryAddress: Dirección de entrega deliveryAddress: Dirección de entrega
fiscalData: Datos fiscales fiscalData: Datos fiscales

View File

@ -1,6 +1,6 @@
reportName: bon-de-livraison reportName: bon-de-livraison
title: Bon de livraison deliveryNote: Bon de livraison
ticketId: BL proforma: Proforma
clientId: Client clientId: Client
deliveryAddress: Adresse de livraison deliveryAddress: Adresse de livraison
fiscalData: Coordonnées fiscalData: Coordonnées

View File

@ -1,6 +1,6 @@
reportName: nota-de-entrega reportName: nota-de-entrega
title: Nota de Entrega deliveryNote: Nota de Entrega
ticketId: Nota de Entrega proforma: Proforma
clientId: Cliente clientId: Cliente
deliveryAddress: Morada de Entrega deliveryAddress: Morada de Entrega
fiscalData: Dados Fiscais fiscalData: Dados Fiscais