diff --git a/print/templates/email/greuge-wrong/assets/css/import.js b/print/templates/email/greuge-wrong/assets/css/import.js
new file mode 100644
index 000000000..89b2afaa5
--- /dev/null
+++ b/print/templates/email/greuge-wrong/assets/css/import.js
@@ -0,0 +1,11 @@
+const Stylesheet = require(`vn-print/core/stylesheet`);
+
+const path = require('path');
+const vnPrintPath = path.resolve('print');
+
+module.exports = new Stylesheet([
+ `${vnPrintPath}/common/css/spacing.css`,
+ `${vnPrintPath}/common/css/misc.css`,
+ `${vnPrintPath}/common/css/layout.css`,
+ `${vnPrintPath}/common/css/email.css`])
+ .mergeStyles();
\ No newline at end of file
diff --git a/print/templates/email/greuge-wrong/greuge-wrong.html b/print/templates/email/greuge-wrong/greuge-wrong.html
index 4f0874268..336007122 100644
--- a/print/templates/email/greuge-wrong/greuge-wrong.html
+++ b/print/templates/email/greuge-wrong/greuge-wrong.html
@@ -1,14 +1,15 @@
-
-
-
-
-
- {{ $t('subject') }}
-
-
- {{ $t('title') }} {{name}}
- {{ $t('ticketId') }} {{ticketId}}
- {{ $t('amount') }} {{amount}}
- {{ $t('description') }} {{description}}
-
-
\ No newline at end of file
+
+
+
+
{{ $t('total') }}: {{tickets.length}}
+
+
+
+
{{ $t('ticketId') }}: {{ticket.ticketId}}
+
{{ $t('clientId') }}: {{ticket.clientId}}
+
{{ $t('description') }}: {{ticket.description}}
+
{{ $t('amount') }}: {{ticket.amount}} €
+
+
+
+
\ No newline at end of file
diff --git a/print/templates/email/greuge-wrong/greuge-wrong.js b/print/templates/email/greuge-wrong/greuge-wrong.js
index ac18c4e9b..2aa3d50a7 100644
--- a/print/templates/email/greuge-wrong/greuge-wrong.js
+++ b/print/templates/email/greuge-wrong/greuge-wrong.js
@@ -1,21 +1,36 @@
+const Component = require(`vn-print/core/component`);
+const emailBody = new Component('email-body');
+const models = require('vn-loopback/server/server').models;
+
module.exports = {
name: 'greuge-wrong',
- props: {
- ticketId: {
- type: [Number],
- required: false
- },
- clientId: {
- type: [Number],
- required: true
- },
- description: {
- type: [String],
- required: true
- },
- amount: {
- type: [Number],
- required: true
- }
+ async serverPrefetch() {
+ this.url = await this.salixUrl();
+
+ if (!this.url)
+ throw new Error('Something went wrong');
},
-};
+ components: {
+ 'email-body': emailBody.build(),
+ },
+ methods: {
+ async salixUrl() {
+ const salix = await models.Url.findOne({
+ where: {
+ appName: 'salix',
+ environment: process.env.NODE_ENV || 'dev'
+ }
+ });
+ return salix.url;
+ },
+ clientGreugeUrl(clientId) {
+ return `${this.url}client/${clientId}/greuge/index`
+ },
+ },
+ props: {
+ tickets: {
+ type: Array,
+ required: true
+ },
+ },
+};
\ No newline at end of file
diff --git a/print/templates/email/greuge-wrong/locale/en.yml b/print/templates/email/greuge-wrong/locale/en.yml
index 67fb74ccb..0ace99c36 100644
--- a/print/templates/email/greuge-wrong/locale/en.yml
+++ b/print/templates/email/greuge-wrong/locale/en.yml
@@ -1,5 +1,6 @@
-subject: A wrong greuge has been created
-title: A wrong greuge has been created for the client
-ticketId: The ticket is
-amount: The amount is
-description: The description is
\ No newline at end of file
+subject: Abnormal greuges have been created
+total: Total number of abnormal greuges
+ticketId: Ticket
+clientId: Client
+description: Description
+amount: Amount
\ No newline at end of file
diff --git a/print/templates/email/greuge-wrong/locale/es.yml b/print/templates/email/greuge-wrong/locale/es.yml
index 4282fd3af..fd2397182 100644
--- a/print/templates/email/greuge-wrong/locale/es.yml
+++ b/print/templates/email/greuge-wrong/locale/es.yml
@@ -1,5 +1,6 @@
-subject: Se ha creado una gruge anormal
-title: Se ha creado una gruge anormal para el cliente
-ticketId: El ticket es
-amount: El importe es
-description: La descripción es
\ No newline at end of file
+subject: Se han creado greuges anormales
+total: Número total de greuges anormales
+ticketId: Ticket
+clientId: Cliente
+description: Descipción
+amount: Importe
\ No newline at end of file