feat(print_deliveryNote): add proforma type
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-03-22 07:38:14 +01:00
parent 19df1fe382
commit ca35c88be4
10 changed files with 28 additions and 16 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>
@ -40,6 +40,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 class="dropdown" <vn-item class="dropdown"
vn-click-stop="sendDeliveryNoteMenu.show($event, 'left')" vn-click-stop="sendDeliveryNoteMenu.show($event, 'left')"
translate> translate>

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>

View File

@ -119,6 +119,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

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