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('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('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('dear')}}
@@ -38,7 +38,7 @@{{$t('copyLink')}}
{{$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('description.instructions')}}
{{ $t('sections.introduction.title') }},
{{ $t('sections.introduction.description') }}
@@ -65,7 +65,7 @@{{ $t('sections.introduction.title') }},
{{ $t('sections.introduction.description') }}
@@ -48,7 +48,7 @@{{ $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('description.dear')}},
{{$t('description.instructions')}}
@@ -43,7 +43,7 @@{{$t('sections.help.description')}}
@@ -51,7 +51,7 @@{{$t('description.dear')}},
@@ -34,7 +34,7 @@