diff --git a/modules/claim/front/descriptor/index.js b/modules/claim/front/descriptor/index.js
index 24eed7a9f0..8d6977ea66 100644
--- a/modules/claim/front/descriptor/index.js
+++ b/modules/claim/front/descriptor/index.js
@@ -68,9 +68,6 @@ class Controller {
this.$scope.confirmPickupOrder.show();
}
- confirmDeleteClaim() {
- this.$scope.confirmDeleteClaim.show();
- }
sendPickupOrder(response) {
if (response === 'ACCEPT') {
this.$http.post(`/api/email/claim-pickup-order`, {claimFk: this.claim.id}).then(
@@ -78,6 +75,11 @@ class Controller {
);
}
}
+
+ confirmDeleteClaim() {
+ this.$scope.confirmDeleteClaim.show();
+ }
+
deleteClaim(response) {
if (response === 'ACCEPT') {
this.$http.delete(`/claim/api/Claims/${this.claim.id}`).then(() => {
diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html
index f3b80a6c18..6d22699a69 100644
--- a/modules/ticket/front/descriptor/index.html
+++ b/modules/ticket/front/descriptor/index.html
@@ -203,4 +203,11 @@
-
\ No newline at end of file
+
+
+
+
\ No newline at end of file
diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js
index 67e539877a..6d11e41e53 100644
--- a/modules/ticket/front/descriptor/index.js
+++ b/modules/ticket/front/descriptor/index.js
@@ -11,6 +11,7 @@ class Controller {
this.moreOptions = [
{name: 'Add turn', callback: this.showAddTurnDialog},
{name: 'Show Delivery Note', callback: this.showDeliveryNote},
+ {name: 'Send Delivery Note', callback: this.confirmDeliveryNote},
{name: 'Delete ticket', callback: this.showDeleteTicketDialog},
{name: 'Change shipped hour', callback: this.showChangeShipped},
{name: 'Send SMS', callback: this.showSMSDialog},
@@ -262,6 +263,18 @@ class Controller {
hasInvoice() {
return this.ticket.refFk !== null;
}
+
+ confirmDeliveryNote() {
+ this.$scope.confirmDeliveryNote.show();
+ }
+
+ sendDeliveryNote(response) {
+ if (response === 'ACCEPT') {
+ this.$http.post(`/api/email/delivery-note`, {ticketFk: this.ticket.id}).then(
+ () => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
+ );
+ }
+ }
}
Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate', 'aclService'];
diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml
index 9c83c5243b..1703c5ffbe 100644
--- a/modules/ticket/front/descriptor/locale/es.yml
+++ b/modules/ticket/front/descriptor/locale/es.yml
@@ -7,7 +7,9 @@ Stowaways of the ticket: Polizones del ticket
Add stowaway: Añadir polizón
Remove stowaway: Borrar polizón
Are you sure you want to delete this stowaway?: ¿Seguro que quieres borrar este polizón?
+Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
Show Delivery Note: Ver albarán
+Send Delivery Note: Enviar albarán
Show pallet report: Ver hoja de pallet
Change shipped hour: Cambiar hora de envío
Shipped hour: Hora de envío
diff --git a/print/config/routes.json b/print/config/routes.json
index f4a620ffe3..e658f4cc4b 100644
--- a/print/config/routes.json
+++ b/print/config/routes.json
@@ -8,6 +8,7 @@
{"type": "email", "name": "sepa-core"},
{"type": "email", "name": "client-lcr"},
{"type": "email", "name": "driver-route"},
+ {"type": "email", "name": "delivery-note"},
{"type": "report", "name": "rpt-delivery-note"},
{"type": "report", "name": "rpt-claim-pickup-order"},
{"type": "report", "name": "rpt-letter-debtor"},
diff --git a/print/report/delivery-note/assets/css/index.js b/print/report/delivery-note/assets/css/index.js
new file mode 100644
index 0000000000..321c632dc7
--- /dev/null
+++ b/print/report/delivery-note/assets/css/index.js
@@ -0,0 +1,7 @@
+const CssReader = require(`${appPath}/lib/cssReader`);
+
+module.exports = new CssReader([
+ `${appPath}/common/css/layout.css`,
+ `${appPath}/common/css/email.css`,
+ `${appPath}/common/css/misc.css`])
+ .mergeStyles();
diff --git a/print/report/delivery-note/index.html b/print/report/delivery-note/index.html
new file mode 100644
index 0000000000..b85f8fab0f
--- /dev/null
+++ b/print/report/delivery-note/index.html
@@ -0,0 +1,27 @@
+
+
+
+ {{ $t('subject') }}
+
+
+
+
+
+
+
+
+
+
{{ $t('title') }}
+
+
+
+ {{$t('dearClient')}},
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/print/report/delivery-note/index.js b/print/report/delivery-note/index.js
new file mode 100755
index 0000000000..550e58bbbe
--- /dev/null
+++ b/print/report/delivery-note/index.js
@@ -0,0 +1,50 @@
+const database = require(`${appPath}/lib/database`);
+const reportEngine = require(`${appPath}/lib/reportEngine.js`);
+const UserException = require(`${appPath}/lib/exceptions/userException`);
+
+module.exports = {
+ name: 'delivery-note',
+ async asyncData(ctx, params) {
+ const promises = [];
+ const data = {
+ isPreview: ctx.method === 'GET',
+ };
+
+ if (!params.ticketFk)
+ throw new UserException('No ticket id specified');
+
+ promises.push(reportEngine.toPdf('rpt-delivery-note', ctx));
+ promises.push(this.methods.fetchTicket(params.ticketFk));
+
+ return Promise.all(promises).then(result => {
+ const stream = result[0];
+ const [[ticket]] = result[1];
+
+ Object.assign(data, ticket);
+ Object.assign(data, {attachments: [{filename: 'rpt-delivery-note.pdf', content: stream}]});
+
+ return data;
+ });
+ },
+ created() {
+ if (this.locale)
+ this.$i18n.locale = this.locale;
+ },
+ methods: {
+ fetchTicket(ticketFk) {
+ return database.pool.query(`
+ SELECT
+ t.id,
+ u.lang locale,
+ c.email recipient
+ FROM ticket t
+ JOIN client c ON c.id = t.clientFk
+ JOIN account.user u ON u.id = c.id
+ WHERE t.id = ?`, [ticketFk]);
+ },
+ },
+ components: {
+ 'email-header': require('../email-header'),
+ 'email-footer': require('../email-footer'),
+ },
+};
diff --git a/print/report/delivery-note/locale.js b/print/report/delivery-note/locale.js
new file mode 100644
index 0000000000..0ddde5fc74
--- /dev/null
+++ b/print/report/delivery-note/locale.js
@@ -0,0 +1,11 @@
+module.exports = {
+ messages: {
+ es: {
+ subject: 'Aquí tienes tu albarán',
+ title: '¡Este es tu albarán!',
+ dearClient: 'Estimado cliente',
+ clientData: `A continuación adjuntamos tu albarán.`,
+ help: 'Cualquier duda que te surja, no dudes en consultarla, ¡estamos para atenderte!'
+ },
+ },
+};
diff --git a/print/report/payment-update/locale.js b/print/report/payment-update/locale.js
index 1e7d1dbbc0..891af2062f 100644
--- a/print/report/payment-update/locale.js
+++ b/print/report/payment-update/locale.js
@@ -6,16 +6,16 @@ module.exports = {
sections: {
introduction: {
title: 'Estimado cliente',
- description: `Le informamos que han cambiado las condiciones de pago de su cuenta.
-
A continuación le indicamos las nuevas condiciones`,
+ description: `Te informamos que han cambiado las condiciones de pago de tu cuenta.
+
A continuación te indicamos las nuevas condiciones`,
},
pay: {
method: 'Método de pago',
day: 'Día de pago',
dueDay: '{0} de cada mes',
- cardImplicates: `Su modo de pago actual implica que deberá abonar el
+ cardImplicates: `Tu modo de pago actual implica que deberás abonar el
importe de los pedidos realizados en el mismo día para que se puedan enviar.`,
- accountImplicates: `Su modo de pago actual implica que se le pasará un cargo a la
+ accountImplicates: `Tu modo de pago actual implica que se te pasará un cargo a la
cuenta terminada en "{0}" por el importe pendiente, al vencimiento establecido en las condiciones.`,
},
},