diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index ea84743bc..0c04b42fb 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -5,6 +5,13 @@ + + Transfer client + + + + + + + + #{{id}} - {{::name}} + + + + + + + + { + const ticket = this.ticket; + + const params = + { + clientFk: client.data.id, + addressFk: client.data.defaultAddressFk, + }; + + this.$http.patch(`Tickets/${ticket.id}`, params).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + this.reload(); + }); + }); + } + isTicketEditable() { if (!this.ticket) return; diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js index 091b9a2cf..1716e36f6 100644 --- a/modules/ticket/front/descriptor-menu/index.spec.js +++ b/modules/ticket/front/descriptor-menu/index.spec.js @@ -281,4 +281,17 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { $httpBackend.flush(); }); }); + + describe('transferClient()', () => { + it(`should perform two queries, a get to obtain the clientData and a patch to update the ticket`, () => { + const client = + { + clientFk: 1101, + addressFk: 1, + }; + $httpBackend.expect('GET', `Clients/${ticket.client.id}`).respond(client); + $httpBackend.expect('PATCH', `Tickets/${ticket.id}`).respond(); + controller.transferClient(); + }); + }); }); diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml index b65159a3c..968c61f84 100644 --- a/modules/ticket/front/descriptor-menu/locale/es.yml +++ b/modules/ticket/front/descriptor-menu/locale/es.yml @@ -9,4 +9,5 @@ Send CSV Delivery Note: Enviar albarán en CSV Send PDF Delivery Note: Enviar albarán en PDF Show Proforma: Ver proforma Refund all: Abonar todo -The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}" \ No newline at end of file +The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}" +Transfer client: Transferir cliente \ No newline at end of file diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index 8ab88ce09..bce9e62d7 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -22,4 +22,4 @@ SMS Pending payment: 'SMS Pago pendiente' Restore ticket: Restaurar ticket You are going to restore this ticket: Vas a restaurar este ticket Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket? -Are you sure you want to refund all?: ¿Seguro que quieres abonar todo? \ No newline at end of file +Are you sure you want to refund all?: ¿Seguro que quieres abonar todo?