From 7c75eaadce02044fe970a7565fbc7ced641abdbd Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 21 Nov 2022 15:15:25 +0100 Subject: [PATCH] feat: worker-welcome --- print/templates/email/worker-welcome/sql/client.sql | 11 ----------- print/templates/email/worker-welcome/sql/worker.sql | 7 +++++++ .../email/worker-welcome/worker-welcome.html | 2 +- .../templates/email/worker-welcome/worker-welcome.js | 8 ++++---- 4 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 print/templates/email/worker-welcome/sql/client.sql create mode 100644 print/templates/email/worker-welcome/sql/worker.sql diff --git a/print/templates/email/worker-welcome/sql/client.sql b/print/templates/email/worker-welcome/sql/client.sql deleted file mode 100644 index 49e1d4bf6..000000000 --- a/print/templates/email/worker-welcome/sql/client.sql +++ /dev/null @@ -1,11 +0,0 @@ -SELECT - c.id, - u.name AS userName, - CONCAT(w.lastName, ' ', w.firstName) salesPersonName, - w.phone AS salesPersonPhone, - CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail -FROM client c - JOIN account.user u ON u.id = c.id - LEFT JOIN worker w ON w.id = c.salesPersonFk - LEFT JOIN account.user wu ON wu.id = w.userFk -WHERE c.id = ? \ No newline at end of file diff --git a/print/templates/email/worker-welcome/sql/worker.sql b/print/templates/email/worker-welcome/sql/worker.sql new file mode 100644 index 000000000..99377fec9 --- /dev/null +++ b/print/templates/email/worker-welcome/sql/worker.sql @@ -0,0 +1,7 @@ +SELECT + u.id, + u.name AS userName, + e.email +FROM account.user u + LEFT JOIN account.emailUser e ON e.userFk = u.id +WHERE u.id = ?; diff --git a/print/templates/email/worker-welcome/worker-welcome.html b/print/templates/email/worker-welcome/worker-welcome.html index f91c9941d..28e5689f1 100644 --- a/print/templates/email/worker-welcome/worker-welcome.html +++ b/print/templates/email/worker-welcome/worker-welcome.html @@ -3,7 +3,7 @@

{{ $t('title', [id]) }}

{{ $t('description.dearWorker') }},

-

{{ $t('workerData', this.user.name, this.url) }}

+

{{ $t('workerData', this.worker.name, this.url) }}

diff --git a/print/templates/email/worker-welcome/worker-welcome.js b/print/templates/email/worker-welcome/worker-welcome.js index 9fbcf86a6..b9bf2ca28 100755 --- a/print/templates/email/worker-welcome/worker-welcome.js +++ b/print/templates/email/worker-welcome/worker-welcome.js @@ -2,13 +2,13 @@ const Component = require(`vn-print/core/component`); const emailBody = new Component('email-body'); module.exports = { - name: 'client-welcome', + name: 'worker-welcome', async serverPrefetch() { - this.client = await this.fetchClient(this.id); + this.worker = await this.fetchWorker(this.id); }, methods: { - fetchClient(id) { - return this.findOneFromDef('client', [id]); + fetchWorker(id) { + return this.findOneFromDef('worker', [id]); }, }, components: {