diff --git a/print/common/css/layout.css b/print/common/css/layout.css index a3a43a9c4..8a3e79219 100644 --- a/print/common/css/layout.css +++ b/print/common/css/layout.css @@ -15,6 +15,7 @@ .grid-block { box-sizing: border-box; + background-color: #FFF; min-height: 40px } @@ -22,10 +23,6 @@ height: 40px } -.grid-block.white { - background-color: #FFF -} - .columns { overflow: hidden; box-sizing: border-box; diff --git a/print/core/mixins/prop-validator.js b/print/core/mixins/prop-validator.js index d380f723d..a73197ebf 100644 --- a/print/core/mixins/prop-validator.js +++ b/print/core/mixins/prop-validator.js @@ -16,7 +16,7 @@ const validator = { if (invalidProps.length > 0) { const required = invalidProps.join(', '); - throw new Error(`Required params not found [${required}]`); + throw new Error(`Required properties not found [${required}]`); } }, props: ['isPreview'] diff --git a/print/methods/email.js b/print/methods/email.js index 1a180935e..a56798820 100644 --- a/print/methods/email.js +++ b/print/methods/email.js @@ -1,33 +1,32 @@ const Email = require('../core/email'); module.exports = app => { - app.get(`/api/email/:name`, async(req, res) => { + app.get(`/api/email/:name`, async(req, res, next) => { const args = req.query; - const requiredArgs = ['recipient', 'clientId']; - + const requiredArgs = ['clientId', 'recipient']; + const argList = requiredArgs.join(','); const hasRequiredArgs = requiredArgs.every(arg => { return args[arg]; }); - if (!hasRequiredArgs) { - return res.status(400).json({ - message: 'Required params recipient, clientId' - }); - } - try { + if (!hasRequiredArgs) + throw new Error(`Required properties not found [${argList}]`); + const email = new Email(req.params.name, args); if (args.isPreview === 'true') { const rendered = await email.render(); res.send(rendered); - } else await email.send(); + } else { + await email.send(); + + res.status(200).json({ + message: 'Sent' + }); + } } catch (e) { - console.error(e); - - return res.status(500).json({message: 'Email not sent'}); + next(e); } - - res.status(200).json({message: 'Sent'}); }); }; diff --git a/print/methods/report.js b/print/methods/report.js index bf7c47dcb..626830c39 100644 --- a/print/methods/report.js +++ b/print/methods/report.js @@ -4,21 +4,21 @@ module.exports = app => { app.get(`/api/report/:name`, async(req, res, next) => { const args = req.query; const requiredArgs = ['clientId']; - + const argList = requiredArgs.join(','); const hasRequiredArgs = requiredArgs.every(arg => { return args[arg]; }); - if (!hasRequiredArgs) - res.json({message: 'Required params recipient, clientId'}); - try { + if (!hasRequiredArgs) + throw new Error(`Required properties not found [${argList}]`); + const report = new Report(req.params.name, args); const stream = await report.toPdfStream(); res.setHeader('Content-type', 'application/pdf'); stream.pipe(res); - } catch (e) { - next(e); + } catch (error) { + next(error); } }); }; diff --git a/print/templates/email/claim-pickup-order/attachments.json b/print/templates/email/claim-pickup-order/attachments.json index 8fb5569e4..5d7c15fb9 100644 --- a/print/templates/email/claim-pickup-order/attachments.json +++ b/print/templates/email/claim-pickup-order/attachments.json @@ -1,4 +1,6 @@ -[{ - "filename": "claim-pickup-order.pdf", - "component": "claim-pickup" -}] \ No newline at end of file +[ + { + "filename": "claim-pickup-order.pdf", + "component": "claim-pickup" + } +] \ No newline at end of file diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.html b/print/templates/email/claim-pickup-order/claim-pickup-order.html index 139c11a40..039f5761a 100644 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.html +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.html @@ -25,7 +25,7 @@
-
+

{{ $t('title') }}

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

{{$t('description.instructions')}}

diff --git a/print/templates/email/client-welcome/client-welcome.html b/print/templates/email/client-welcome/client-welcome.html index e410405c7..dc5c5e572 100644 --- a/print/templates/email/client-welcome/client-welcome.html +++ b/print/templates/email/client-welcome/client-welcome.html @@ -25,7 +25,7 @@
-
+

{{ $t('title') }}

{{$t('dearClient')}},

diff --git a/print/templates/email/delivery-note-link/delivery-note-link.html b/print/templates/email/delivery-note-link/delivery-note-link.html index 6a23ed4b5..2be79a118 100644 --- a/print/templates/email/delivery-note-link/delivery-note-link.html +++ b/print/templates/email/delivery-note-link/delivery-note-link.html @@ -30,7 +30,7 @@
-
+

{{ $t('title') }}

{{$t('dear')}}

@@ -38,7 +38,7 @@
-
+

{{$t('copyLink')}}

-
+

diff --git a/print/templates/email/delivery-note/attachments.json b/print/templates/email/delivery-note/attachments.json index d963db0c5..19519a387 100644 --- a/print/templates/email/delivery-note/attachments.json +++ b/print/templates/email/delivery-note/attachments.json @@ -1,4 +1,6 @@ -[{ - "filename": "delivery-note.pdf", - "component": "delivery-note" -}] \ No newline at end of file +[ + { + "filename": "delivery-note.pdf", + "component": "delivery-note" + } +] \ No newline at end of file diff --git a/print/templates/email/delivery-note/delivery-note.html b/print/templates/email/delivery-note/delivery-note.html index b91f66e69..dcc7f0d56 100644 --- a/print/templates/email/delivery-note/delivery-note.html +++ b/print/templates/email/delivery-note/delivery-note.html @@ -25,7 +25,7 @@
-
+

{{ $t('title') }}

{{$t('dear')}},

diff --git a/print/templates/email/driver-route/attachments.json b/print/templates/email/driver-route/attachments.json index e80a74ce0..01111c464 100644 --- a/print/templates/email/driver-route/attachments.json +++ b/print/templates/email/driver-route/attachments.json @@ -1,4 +1,6 @@ -[{ - "filename": "driver-route.pdf", - "component": "driver-route" -}] \ No newline at end of file +[ + { + "filename": "driver-route.pdf", + "component": "driver-route" + } +] \ No newline at end of file diff --git a/print/templates/email/driver-route/driver-route.html b/print/templates/email/driver-route/driver-route.html index f70be019e..40635bab1 100644 --- a/print/templates/email/driver-route/driver-route.html +++ b/print/templates/email/driver-route/driver-route.html @@ -25,7 +25,7 @@
-
+

{{ $t('title') }}

{{$t('description.instructions')}}

diff --git a/print/templates/email/letter-debtor-nd/attachments.json b/print/templates/email/letter-debtor-nd/attachments.json index ae8a3f4cc..1e21ea343 100644 --- a/print/templates/email/letter-debtor-nd/attachments.json +++ b/print/templates/email/letter-debtor-nd/attachments.json @@ -1,4 +1,6 @@ -[{ - "filename": "letter-debtor.pdf", - "component": "letter-debtor" -}] \ No newline at end of file +[ + { + "filename": "letter-debtor.pdf", + "component": "letter-debtor" + } +] \ No newline at end of file diff --git a/print/templates/email/letter-debtor-nd/letter-debtor-nd.html b/print/templates/email/letter-debtor-nd/letter-debtor-nd.html index b2b0967f3..5299ab5be 100644 --- a/print/templates/email/letter-debtor-nd/letter-debtor-nd.html +++ b/print/templates/email/letter-debtor-nd/letter-debtor-nd.html @@ -25,7 +25,7 @@
-
+

{{ $t('title') }}

{{ $t('sections.introduction.title') }},

{{ $t('sections.introduction.description') }}

@@ -65,7 +65,7 @@
-
+
-
+

{{ $t('title') }}

{{ $t('sections.introduction.title') }},

{{ $t('sections.introduction.description') }}

@@ -48,7 +48,7 @@
-
+
-
+

{{ $t('title') }}

{{ $t('sections.introduction.title') }},

diff --git a/print/templates/email/printer-setup/attachments.json b/print/templates/email/printer-setup/attachments.json index 2f828a6a0..1e1f710c3 100644 --- a/print/templates/email/printer-setup/attachments.json +++ b/print/templates/email/printer-setup/attachments.json @@ -1,12 +1,14 @@ -[{ - "filename": "model.ezp", - "component": "printer-setup", - "path": "/assets/files/model.ezp", - "cid": "model.ezp" -}, -{ - "filename": "port.png", - "component": "printer-setup", - "path": "/assets/files/port.png", - "cid": "port.png" -}] \ No newline at end of file +[ + { + "filename": "model.ezp", + "component": "printer-setup", + "path": "/assets/files/model.ezp", + "cid": "model.ezp" + }, + { + "filename": "port.png", + "component": "printer-setup", + "path": "/assets/files/port.png", + "cid": "port.png" + } +] \ No newline at end of file diff --git a/print/templates/email/printer-setup/printer-setup.html b/print/templates/email/printer-setup/printer-setup.html index abc28db33..e6b66cd98 100644 --- a/print/templates/email/printer-setup/printer-setup.html +++ b/print/templates/email/printer-setup/printer-setup.html @@ -25,7 +25,7 @@
-
+

{{ $t('title') }}

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

{{$t('description.instructions')}}

@@ -43,7 +43,7 @@
-
+

{{$t('sections.help.title')}}

{{$t('sections.help.description')}}

@@ -51,7 +51,7 @@
-
+
{{$t('salesPersonName')}}: {{client.salesPersonName}}
@@ -66,7 +66,7 @@
-
+
-
+

{{ $t('title') }}

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

@@ -34,7 +34,7 @@
-
+
{{$t('date')}} - {{currentDate}} + {{dated}} diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.js b/print/templates/reports/claim-pickup-order/claim-pickup-order.js index 04da444be..a18e6d0e0 100755 --- a/print/templates/reports/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.js @@ -13,7 +13,7 @@ module.exports = { throw new Error('Something went wrong'); }, computed: { - currentDate: function() { + dated: function() { const filters = this.$options.filters; return filters.date(new Date(), '%d-%m-%Y'); diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index 7c603865d..908f49370 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -12,13 +12,6 @@ module.exports = { if (!this.route) throw new Error('Something went wrong'); }, - computed: { - dated: function() { - const filters = this.$options.filters; - - return filters.date(new Date(), '%d-%m-%Y'); - } - }, methods: { fetchRoute(id) { return db.findOne(