From 443aa56fed080b0feb197f6dacd25c2147f49c80 Mon Sep 17 00:00:00 2001
From: Joan Sanchez
Date: Tue, 29 Oct 2019 07:46:44 +0100
Subject: [PATCH] refactor
---
modules/ticket/front/index/index.js | 1 +
package-lock.json | 20 +-
print/common/css/email.css | 4 +
print/common/css/layout.css | 4 +
print/common/css/misc.css | 4 +
print/common/css/report.css | 4 +
print/config/routes.json | 25 --
print/core/component.js | 103 ++++++++
.../email-footer/assets/css/style.css | 0
.../email-footer/assets/images/action.png | Bin
.../email-footer/assets/images/facebook.png | Bin
.../email-footer/assets/images/info.png | Bin
.../email-footer/assets/images/instagram.png | Bin
.../email-footer/assets/images/linkedin.png | Bin
.../email-footer/assets/images/pinterest.png | Bin
.../email-footer/assets/images/twitter.png | Bin
.../email-footer/assets/images/youtube.png | Bin
.../components/email-footer/attachments.json | 27 ++
.../email-footer/email-footer.html} | 16 +-
.../components/email-footer/email-footer.js | 4 +
.../components/email-footer/locale/es.yml | 19 ++
.../components/email-footer/locale/fr.yml | 19 ++
.../email-header/assets/css/style.css | 0
.../email-header/assets/images/email-logo.png | Bin
.../components/email-header/attachments.json | 7 +
.../components/email-header/email-header.html | 5 +
.../components/email-header/email-header.js | 4 +
.../report-footer/assets/css/style.css | 0
.../components/report-footer/locale/es.yml | 10 +
.../components/report-footer/locale/fr.yml | 10 +
.../components/report-footer/locale/pt.yml | 10 +
.../report-footer/report-footer.html} | 0
.../report-footer/report-footer.js} | 0
.../report-header/assets/css/style.css | 0
.../assets/images/report-logo.png | Bin
.../assets/images/report-logo.svg | 0
.../components/report-header/locale/es.yml | 5 +
.../components/report-header/locale/pt.yml | 5 +
.../report-header/report-header.html} | 0
.../report-header/report-header.js} | 0
print/{lib => core}/config.js | 0
print/{lib => core}/cssReader.js | 0
print/{lib => core}/database.js | 0
print/core/directives/index.js | 1 +
print/{lib/emailEngine.js => core/email.js} | 101 ++++++--
.../{lib => core}/exceptions/userException.js | 0
print/core/filters/currency.js | 7 +
print/core/filters/index.js | 1 +
.../index.js => core/filters/translate.js} | 0
print/core/mixins/image-src.js | 15 ++
print/core/mixins/index.js | 2 +
print/{lib => core}/report.js | 56 +----
print/{lib => core}/router.js | 49 +++-
print/{lib => core}/smtp.js | 4 +-
print/lib/mixins/text.js | 7 -
print/package-lock.json | 27 ++
print/package.json | 1 +
print/server.js | 11 +-
.../claim-pickup-order/assets/css/email.css | 44 ++++
.../claim-pickup-order/assets/css/index.js | 7 -
.../claim-pickup-order/assets/css/layout.css | 233 ++++++++++++++++++
.../claim-pickup-order/assets/css/misc.css | 47 ++++
.../email/claim-pickup-order/attachments.json | 3 +
.../{index.html => claim-pickup-order.html} | 11 +-
.../claim-pickup-order/claim-pickup-order.js | 39 +++
.../email/claim-pickup-order/index.js | 53 ----
.../email/claim-pickup-order/locale.js | 25 --
.../email/claim-pickup-order/locale/es.yml | 23 ++
.../email/client-welcome/assets/css/email.css | 1 +
.../email/client-welcome/assets/css/index.js | 7 -
.../client-welcome/assets/css/layout.css | 233 ++++++++++++++++++
.../email/client-welcome/assets/css/misc.css | 47 ++++
.../{index.html => client-welcome.html} | 21 +-
.../{index.js => client-welcome.js} | 25 +-
.../templates/email/client-welcome/locale.js | 55 -----
.../email/client-welcome/locale/es.yml | 55 +++++
.../email/delivery-note/assets/css/email.css | 44 ++++
.../email/delivery-note/assets/css/index.js | 7 -
.../email/delivery-note/assets/css/layout.css | 233 ++++++++++++++++++
.../email/delivery-note/assets/css/misc.css | 47 ++++
.../email/delivery-note/attachments.json | 4 +
.../{index.html => delivery-note.html} | 4 +-
.../{index.js => delivery-note.js} | 21 +-
print/templates/email/delivery-note/locale.js | 11 -
.../email/delivery-note/locale/es.yml | 6 +
.../email/email-footer/assets/css/index.js | 4 -
print/templates/email/email-footer/index.js | 34 ---
print/templates/email/email-footer/locale.js | 42 ----
.../email/email-header/assets/css/index.js | 4 -
print/templates/email/email-header/index.html | 5 -
print/templates/email/email-header/index.js | 22 --
print/templates/email/email-header/locale.js | 5 -
.../email/printer-setup/assets/css/email.css | 44 ++++
.../email/printer-setup/assets/css/index.js | 7 -
.../email/printer-setup/assets/css/layout.css | 233 ++++++++++++++++++
.../email/printer-setup/assets/css/misc.css | 47 ++++
.../email/printer-setup/attachments.json | 10 +
print/templates/email/printer-setup/index.js | 55 -----
print/templates/email/printer-setup/locale.js | 59 -----
.../email/printer-setup/locale/es.yml | 50 ++++
.../email/printer-setup/options.json | 0
.../{index.html => printer-setup.html} | 16 +-
.../email/printer-setup/printer-setup.js | 38 +++
.../claim-pickup-order/assets/css/layout.css | 233 ++++++++++++++++++
.../claim-pickup-order/assets/css/misc.css | 47 ++++
.../claim-pickup-order/assets/css/report.css | 14 ++
.../assets/css/style.css | 0
.../claim-pickup-order.html} | 3 +-
.../claim-pickup-order.js} | 48 ++--
.../reports/claim-pickup-order/locale/es.yml | 15 ++
.../assets/css/index.js | 0
.../assets/css/style.css | 0
.../delivery-note.html} | 0
.../delivery-note.js} | 5 +-
.../reports/delivery-note/locale/es.yml | 26 ++
.../reports/receipt/assets/css/layout.css | 1 +
.../reports/receipt/assets/css/misc.css | 1 +
.../reports/receipt/assets/css/report.css | 1 +
print/templates/reports/receipt/locale.js | 24 --
print/templates/reports/receipt/locale/en.yml | 0
print/templates/reports/receipt/locale/es.yml | 17 ++
print/templates/reports/receipt/receipt.html | 7 +-
.../reports/receipt/{index.js => receipt.js} | 15 +-
.../reports/report-footer/assets/css/index.js | 6 -
.../templates/reports/report-footer/locale.js | 32 ---
.../reports/report-header/assets/css/index.js | 4 -
.../templates/reports/report-header/locale.js | 16 --
.../assets/css/index.js | 8 -
.../reports/rpt-claim-pickup-order/locale.js | 23 --
.../rpt-delivery-note/assets/css/index.js | 8 -
.../reports/rpt-delivery-note/locale.js | 32 ---
.../reports/rpt-sepa-core/locale/fr.yml | 38 +++
132 files changed, 2419 insertions(+), 774 deletions(-)
delete mode 100644 print/config/routes.json
create mode 100644 print/core/component.js
rename print/{templates/email => core/components}/email-footer/assets/css/style.css (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/action.png (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/facebook.png (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/info.png (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/instagram.png (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/linkedin.png (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/pinterest.png (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/twitter.png (100%)
rename print/{templates/email => core/components}/email-footer/assets/images/youtube.png (100%)
create mode 100644 print/core/components/email-footer/attachments.json
rename print/{templates/email/email-footer/index.html => core/components/email-footer/email-footer.html} (67%)
create mode 100755 print/core/components/email-footer/email-footer.js
create mode 100644 print/core/components/email-footer/locale/es.yml
create mode 100644 print/core/components/email-footer/locale/fr.yml
rename print/{templates/email => core/components}/email-header/assets/css/style.css (100%)
rename print/{templates/email => core/components}/email-header/assets/images/email-logo.png (100%)
create mode 100644 print/core/components/email-header/attachments.json
create mode 100644 print/core/components/email-header/email-header.html
create mode 100755 print/core/components/email-header/email-header.js
rename print/{templates/reports => core/components}/report-footer/assets/css/style.css (100%)
create mode 100644 print/core/components/report-footer/locale/es.yml
create mode 100644 print/core/components/report-footer/locale/fr.yml
create mode 100644 print/core/components/report-footer/locale/pt.yml
rename print/{templates/reports/report-footer/index.html => core/components/report-footer/report-footer.html} (100%)
rename print/{templates/reports/report-footer/index.js => core/components/report-footer/report-footer.js} (100%)
rename print/{templates/reports => core/components}/report-header/assets/css/style.css (100%)
rename print/{templates/reports => core/components}/report-header/assets/images/report-logo.png (100%)
rename print/{templates/reports => core/components}/report-header/assets/images/report-logo.svg (100%)
create mode 100644 print/core/components/report-header/locale/es.yml
create mode 100644 print/core/components/report-header/locale/pt.yml
rename print/{templates/reports/report-header/index.html => core/components/report-header/report-header.html} (100%)
rename print/{templates/reports/report-header/index.js => core/components/report-header/report-header.js} (100%)
rename print/{lib => core}/config.js (100%)
rename print/{lib => core}/cssReader.js (100%)
rename print/{lib => core}/database.js (100%)
create mode 100644 print/core/directives/index.js
rename print/{lib/emailEngine.js => core/email.js} (62%)
rename print/{lib => core}/exceptions/userException.js (100%)
create mode 100644 print/core/filters/currency.js
create mode 100644 print/core/filters/index.js
rename print/{lib/filters/index.js => core/filters/translate.js} (100%)
create mode 100644 print/core/mixins/image-src.js
create mode 100644 print/core/mixins/index.js
rename print/{lib => core}/report.js (74%)
rename print/{lib => core}/router.js (71%)
rename print/{lib => core}/smtp.js (86%)
delete mode 100755 print/lib/mixins/text.js
create mode 100644 print/templates/email/claim-pickup-order/assets/css/email.css
delete mode 100644 print/templates/email/claim-pickup-order/assets/css/index.js
create mode 100644 print/templates/email/claim-pickup-order/assets/css/layout.css
create mode 100644 print/templates/email/claim-pickup-order/assets/css/misc.css
create mode 100644 print/templates/email/claim-pickup-order/attachments.json
rename print/templates/email/claim-pickup-order/{index.html => claim-pickup-order.html} (71%)
create mode 100755 print/templates/email/claim-pickup-order/claim-pickup-order.js
delete mode 100755 print/templates/email/claim-pickup-order/index.js
delete mode 100644 print/templates/email/claim-pickup-order/locale.js
create mode 100644 print/templates/email/claim-pickup-order/locale/es.yml
create mode 120000 print/templates/email/client-welcome/assets/css/email.css
delete mode 100644 print/templates/email/client-welcome/assets/css/index.js
create mode 100644 print/templates/email/client-welcome/assets/css/layout.css
create mode 100644 print/templates/email/client-welcome/assets/css/misc.css
rename print/templates/email/client-welcome/{index.html => client-welcome.html} (71%)
rename print/templates/email/client-welcome/{index.js => client-welcome.js} (67%)
delete mode 100644 print/templates/email/client-welcome/locale.js
create mode 100644 print/templates/email/client-welcome/locale/es.yml
create mode 100644 print/templates/email/delivery-note/assets/css/email.css
delete mode 100644 print/templates/email/delivery-note/assets/css/index.js
create mode 100644 print/templates/email/delivery-note/assets/css/layout.css
create mode 100644 print/templates/email/delivery-note/assets/css/misc.css
create mode 100644 print/templates/email/delivery-note/attachments.json
rename print/templates/email/delivery-note/{index.html => delivery-note.html} (80%)
rename print/templates/email/delivery-note/{index.js => delivery-note.js} (69%)
delete mode 100644 print/templates/email/delivery-note/locale.js
create mode 100644 print/templates/email/delivery-note/locale/es.yml
delete mode 100644 print/templates/email/email-footer/assets/css/index.js
delete mode 100755 print/templates/email/email-footer/index.js
delete mode 100644 print/templates/email/email-footer/locale.js
delete mode 100644 print/templates/email/email-header/assets/css/index.js
delete mode 100644 print/templates/email/email-header/index.html
delete mode 100755 print/templates/email/email-header/index.js
delete mode 100644 print/templates/email/email-header/locale.js
create mode 100644 print/templates/email/printer-setup/assets/css/email.css
delete mode 100644 print/templates/email/printer-setup/assets/css/index.js
create mode 100644 print/templates/email/printer-setup/assets/css/layout.css
create mode 100644 print/templates/email/printer-setup/assets/css/misc.css
create mode 100644 print/templates/email/printer-setup/attachments.json
delete mode 100755 print/templates/email/printer-setup/index.js
delete mode 100644 print/templates/email/printer-setup/locale.js
create mode 100644 print/templates/email/printer-setup/locale/es.yml
create mode 100644 print/templates/email/printer-setup/options.json
rename print/templates/email/printer-setup/{index.html => printer-setup.html} (70%)
create mode 100755 print/templates/email/printer-setup/printer-setup.js
create mode 100644 print/templates/reports/claim-pickup-order/assets/css/layout.css
create mode 100644 print/templates/reports/claim-pickup-order/assets/css/misc.css
create mode 100644 print/templates/reports/claim-pickup-order/assets/css/report.css
rename print/templates/reports/{rpt-claim-pickup-order => claim-pickup-order}/assets/css/style.css (100%)
rename print/templates/reports/{rpt-claim-pickup-order/index.html => claim-pickup-order/claim-pickup-order.html} (96%)
rename print/templates/reports/{rpt-claim-pickup-order/index.js => claim-pickup-order/claim-pickup-order.js} (58%)
create mode 100644 print/templates/reports/claim-pickup-order/locale/es.yml
rename print/templates/reports/{receipt => delivery-note}/assets/css/index.js (100%)
rename print/templates/reports/{rpt-delivery-note => delivery-note}/assets/css/style.css (100%)
rename print/templates/reports/{rpt-delivery-note/index.html => delivery-note/delivery-note.html} (100%)
rename print/templates/reports/{rpt-delivery-note/index.js => delivery-note/delivery-note.js} (98%)
create mode 100644 print/templates/reports/delivery-note/locale/es.yml
create mode 120000 print/templates/reports/receipt/assets/css/layout.css
create mode 120000 print/templates/reports/receipt/assets/css/misc.css
create mode 120000 print/templates/reports/receipt/assets/css/report.css
delete mode 100644 print/templates/reports/receipt/locale.js
create mode 100644 print/templates/reports/receipt/locale/en.yml
create mode 100644 print/templates/reports/receipt/locale/es.yml
rename print/templates/reports/receipt/{index.js => receipt.js} (82%)
delete mode 100644 print/templates/reports/report-footer/assets/css/index.js
delete mode 100644 print/templates/reports/report-footer/locale.js
delete mode 100644 print/templates/reports/report-header/assets/css/index.js
delete mode 100644 print/templates/reports/report-header/locale.js
delete mode 100644 print/templates/reports/rpt-claim-pickup-order/assets/css/index.js
delete mode 100644 print/templates/reports/rpt-claim-pickup-order/locale.js
delete mode 100644 print/templates/reports/rpt-delivery-note/assets/css/index.js
delete mode 100644 print/templates/reports/rpt-delivery-note/locale.js
create mode 100644 print/templates/reports/rpt-sepa-core/locale/fr.yml
diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js
index 2a2f3a238..b566bbfc0 100644
--- a/modules/ticket/front/index/index.js
+++ b/modules/ticket/front/index/index.js
@@ -18,6 +18,7 @@ export default class Controller {
this.$.balanceCreateDialog.show();
}, name: 'Payment on account...', always: true}
];
+ console.log(this.$stateParams);
}
setBalanceCreateDialog() {
diff --git a/package-lock.json b/package-lock.json
index 7b4445337..cd41d3950 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4769,7 +4769,7 @@
"dot-prop": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz",
- "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==",
+ "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=",
"requires": {
"is-obj": "^1.0.0"
}
@@ -4937,7 +4937,7 @@
},
"jsonfile": {
"version": "2.4.0",
- "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"dev": true,
"requires": {
@@ -7485,7 +7485,7 @@
},
"kind-of": {
"version": "1.1.0",
- "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz",
"integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=",
"dev": true
},
@@ -9120,7 +9120,7 @@
},
"jasmine-core": {
"version": "2.99.1",
- "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz",
+ "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz",
"integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=",
"dev": true
},
@@ -11194,7 +11194,7 @@
"dependencies": {
"commander": {
"version": "1.0.4",
- "resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz",
"integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=",
"dev": true,
"requires": {
@@ -13041,7 +13041,7 @@
},
"readable-stream": {
"version": "1.1.14",
- "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"dev": true,
"requires": {
@@ -13053,7 +13053,7 @@
},
"string_decoder": {
"version": "0.10.31",
- "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
},
@@ -13500,7 +13500,7 @@
"dependencies": {
"jsesc": {
"version": "0.5.0",
- "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true
}
@@ -14321,7 +14321,7 @@
},
"string-width": {
"version": "1.0.2",
- "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true,
"requires": {
@@ -15885,7 +15885,7 @@
"touch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
- "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
+ "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=",
"dev": true,
"requires": {
"nopt": "~1.0.10"
diff --git a/print/common/css/email.css b/print/common/css/email.css
index 6b15fbcba..a2b129057 100644
--- a/print/common/css/email.css
+++ b/print/common/css/email.css
@@ -1,3 +1,7 @@
+/**
+ * Email only stylesheet
+ *
+*/
body {
background-color: #EEE
}
diff --git a/print/common/css/layout.css b/print/common/css/layout.css
index 5914c3587..26b9bf8e0 100644
--- a/print/common/css/layout.css
+++ b/print/common/css/layout.css
@@ -1,3 +1,7 @@
+/**
+ * CSS layout elements
+ *
+*/
.container {
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
font-size: 16px
diff --git a/print/common/css/misc.css b/print/common/css/misc.css
index 16a37b6c3..093d5a974 100644
--- a/print/common/css/misc.css
+++ b/print/common/css/misc.css
@@ -1,3 +1,7 @@
+/**
+ * CSS misc classes
+ *
+*/
.uppercase {
text-transform: uppercase
}
diff --git a/print/common/css/report.css b/print/common/css/report.css
index 24b20c330..e1105957b 100644
--- a/print/common/css/report.css
+++ b/print/common/css/report.css
@@ -1,3 +1,7 @@
+/**
+ * Report only stylesheet
+ *
+*/
body {
zoom: 0.55
}
diff --git a/print/config/routes.json b/print/config/routes.json
deleted file mode 100644
index 58d46193c..000000000
--- a/print/config/routes.json
+++ /dev/null
@@ -1,25 +0,0 @@
-[
- {"type": "email", "name": "client-welcome"},
- {"type": "email", "name": "printer-setup"},
- {"type": "email", "name": "payment-update"},
- {"type": "email", "name": "letter-debtor-st"},
- {"type": "email", "name": "letter-debtor-nd"},
- {"type": "email", "name": "claim-pickup-order"},
- {"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"},
- {"type": "report", "name": "rpt-sepa-core"},
- {"type": "report", "name": "rpt-receipt"},
- {"type": "report", "name": "rpt-zone"},
- {"type": "report", "name": "rpt-route"},
- {"type": "report", "name": "rpt-lcr"},
- {"type": "report", "name": "rpt-item-label"},
- {"type": "static", "name": "email-header"},
- {"type": "static", "name": "email-footer"},
- {"type": "static", "name": "report-header"},
- {"type": "static", "name": "report-footer"}
-]
\ No newline at end of file
diff --git a/print/core/component.js b/print/core/component.js
new file mode 100644
index 000000000..26490c9e3
--- /dev/null
+++ b/print/core/component.js
@@ -0,0 +1,103 @@
+const Vue = require('vue');
+const VueI18n = require('vue-i18n');
+const renderer = require('vue-server-renderer').createRenderer();
+Vue.use(VueI18n);
+
+const fs = require('fs');
+const yaml = require('js-yaml');
+const juice = require('juice');
+const path = require('path');
+
+const config = require('./config');
+
+class Component {
+ constructor(name) {
+ this.name = name;
+ }
+
+ get path() {
+ return `./components/${this.name}`;
+ }
+
+ get template() {
+ const templatePath = `${this.path}/${this.name}.html`;
+ const fullPath = path.resolve(__dirname, templatePath);
+
+ return fs.readFileSync(fullPath, 'utf8');
+ }
+
+ get locale() {
+ const mergedLocale = {messages: {}};
+ const localePath = path.resolve(__dirname, `${this.path}/locale`);
+
+ if (!fs.existsSync(localePath))
+ return mergedLocale;
+
+ const localeDir = fs.readdirSync(localePath);
+ localeDir.forEach(locale => {
+ const fullPath = path.join(localePath, '/', locale);
+ const yamlLocale = fs.readFileSync(fullPath, 'utf8');
+ const jsonLocale = yaml.safeLoad(yamlLocale);
+ const localeName = locale.replace('.yml', '');
+
+ mergedLocale.messages[localeName] = jsonLocale;
+ });
+
+ return mergedLocale;
+ }
+
+ get stylesheet() {
+ let mergedStyles = '';
+ const stylePath = path.resolve(__dirname, `${this.path}/assets/css`);
+
+ if (!fs.existsSync(stylePath))
+ return mergedStyles;
+
+ const styleDir = fs.readdirSync(stylePath);
+ styleDir.forEach(fileName => {
+ const fullPath = path.join(stylePath, '/', fileName);
+ const contents = fs.readFileSync(fullPath, 'utf8');
+
+ mergedStyles += contents;
+ });
+
+ return mergedStyles;
+ }
+
+ get attachments() {
+ const attachmentsPath = `${this.path}/attachments.json`;
+ const fullPath = path.resolve(__dirname, attachmentsPath);
+
+ if (!fs.existsSync(fullPath))
+ return [];
+
+ return require(fullPath);
+ }
+
+ build() {
+ const component = require(`${this.path}/${this.name}`);
+
+ component.i18n = this.locale;
+ component.attachments = this.attachments;
+ component.template = juice.inlineContent(this.template, this.stylesheet, {
+ inlinePseudoElements: true
+ });
+
+ return component;
+ }
+
+ async render() {
+ const component = this.build();
+ const i18n = new VueI18n(config.i18n);
+ const app = new Vue({
+ i18n: i18n,
+ render: h => h(component, {
+ props: this.args
+ })
+ });
+
+ return renderer.renderToString(app);
+ }
+}
+
+module.exports = Component;
diff --git a/print/templates/email/email-footer/assets/css/style.css b/print/core/components/email-footer/assets/css/style.css
similarity index 100%
rename from print/templates/email/email-footer/assets/css/style.css
rename to print/core/components/email-footer/assets/css/style.css
diff --git a/print/templates/email/email-footer/assets/images/action.png b/print/core/components/email-footer/assets/images/action.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/action.png
rename to print/core/components/email-footer/assets/images/action.png
diff --git a/print/templates/email/email-footer/assets/images/facebook.png b/print/core/components/email-footer/assets/images/facebook.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/facebook.png
rename to print/core/components/email-footer/assets/images/facebook.png
diff --git a/print/templates/email/email-footer/assets/images/info.png b/print/core/components/email-footer/assets/images/info.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/info.png
rename to print/core/components/email-footer/assets/images/info.png
diff --git a/print/templates/email/email-footer/assets/images/instagram.png b/print/core/components/email-footer/assets/images/instagram.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/instagram.png
rename to print/core/components/email-footer/assets/images/instagram.png
diff --git a/print/templates/email/email-footer/assets/images/linkedin.png b/print/core/components/email-footer/assets/images/linkedin.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/linkedin.png
rename to print/core/components/email-footer/assets/images/linkedin.png
diff --git a/print/templates/email/email-footer/assets/images/pinterest.png b/print/core/components/email-footer/assets/images/pinterest.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/pinterest.png
rename to print/core/components/email-footer/assets/images/pinterest.png
diff --git a/print/templates/email/email-footer/assets/images/twitter.png b/print/core/components/email-footer/assets/images/twitter.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/twitter.png
rename to print/core/components/email-footer/assets/images/twitter.png
diff --git a/print/templates/email/email-footer/assets/images/youtube.png b/print/core/components/email-footer/assets/images/youtube.png
similarity index 100%
rename from print/templates/email/email-footer/assets/images/youtube.png
rename to print/core/components/email-footer/assets/images/youtube.png
diff --git a/print/core/components/email-footer/attachments.json b/print/core/components/email-footer/attachments.json
new file mode 100644
index 000000000..ca9329065
--- /dev/null
+++ b/print/core/components/email-footer/attachments.json
@@ -0,0 +1,27 @@
+[
+ {
+ "filename": "facebook.png",
+ "path": "/assets/images/facebook.png",
+ "cid": "facebook.png"
+ }, {
+ "filename": "twitter.png",
+ "path": "/assets/images/twitter.png",
+ "cid": "twitter.png"
+ }, {
+ "filename": "youtube.png",
+ "path": "/assets/images/youtube.png",
+ "cid": "youtube.png"
+ }, {
+ "filename": "pinterest.png",
+ "path": "/assets/images/pinterest.png",
+ "cid": "pinterest.png"
+ }, {
+ "filename": "instagram.png",
+ "path": "/assets/images/instagram.png",
+ "cid": "instagram.png"
+ }, {
+ "filename": "linkedin.png",
+ "path": "/assets/images/linkedin.png",
+ "cid": "linkedin.png"
+ }
+]
\ No newline at end of file
diff --git a/print/templates/email/email-footer/index.html b/print/core/components/email-footer/email-footer.html
similarity index 67%
rename from print/templates/email/email-footer/index.html
rename to print/core/components/email-footer/email-footer.html
index dd7853591..ae013691f 100644
--- a/print/templates/email/email-footer/index.html
+++ b/print/core/components/email-footer/email-footer.html
@@ -4,13 +4,13 @@
{{ $t('buttons.webAcccess')}}
-
+
{{ $t('buttons.info')}}
-
+
-->
@@ -19,22 +19,22 @@
diff --git a/print/core/components/email-footer/email-footer.js b/print/core/components/email-footer/email-footer.js
new file mode 100755
index 000000000..527c8121a
--- /dev/null
+++ b/print/core/components/email-footer/email-footer.js
@@ -0,0 +1,4 @@
+module.exports = {
+ name: 'email-footer',
+ props: ['isPreview', 'locale']
+};
diff --git a/print/core/components/email-footer/locale/es.yml b/print/core/components/email-footer/locale/es.yml
new file mode 100644
index 000000000..592a46737
--- /dev/null
+++ b/print/core/components/email-footer/locale/es.yml
@@ -0,0 +1,19 @@
+buttons:
+ webAcccess: Visita nuestra Web
+ info: Ayúdanos a mejorar
+privacy:
+ fiscalAddress: VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla
+ · www.verdnatura.es · clientes@verdnatura.es
+ disclaimer: '- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado
+ exclusivamente por la persona destinataria del mismo. Si has recibido este mensaje
+ por error, te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier
+ documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la
+ confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal
+ funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones,
+ errores u omisiones que pudieran hacerse al mensaje una vez enviado.'
+ law: En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de
+ Datos de Carácter Personal, te comunicamos que los datos personales que facilites
+ se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en
+ todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición,
+ comunicándolo por escrito al domicilio social de la entidad. La finalidad del
+ fichero es la gestión administrativa, contabilidad, y facturación.
diff --git a/print/core/components/email-footer/locale/fr.yml b/print/core/components/email-footer/locale/fr.yml
new file mode 100644
index 000000000..38262a160
--- /dev/null
+++ b/print/core/components/email-footer/locale/fr.yml
@@ -0,0 +1,19 @@
+buttons:
+ webAcccess: Visitez notre site web
+ info: Ayúdanos a mejorar
+privacy:
+ fiscalAddress: VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla
+ · www.verdnatura.es · clientes@verdnatura.es
+ disclaimer: '- AVISO - Ce message est privé et confidentiel et doit être utilisé.exclusivamente
+ por la persona destinataria del mismo. Si has recibido este mensajepor error,
+ te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier documentoadjunto
+ que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad
+ ni aningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente
+ no se haceresponsable de los cambios, alteraciones, errores u omisiones que pudieran
+ hacerse al mensaje una vez enviado.'
+ law: En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de
+ Datos de Carácter Personal,te comunicamos que los datos personales que facilites
+ se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L.,pudiendo en
+ todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición,
+ comunicándolo porescrito al domicilio social de la entidad. La finalidad del fichero
+ es la gestión administrativa, contabilidad, y facturación.
diff --git a/print/templates/email/email-header/assets/css/style.css b/print/core/components/email-header/assets/css/style.css
similarity index 100%
rename from print/templates/email/email-header/assets/css/style.css
rename to print/core/components/email-header/assets/css/style.css
diff --git a/print/templates/email/email-header/assets/images/email-logo.png b/print/core/components/email-header/assets/images/email-logo.png
similarity index 100%
rename from print/templates/email/email-header/assets/images/email-logo.png
rename to print/core/components/email-header/assets/images/email-logo.png
diff --git a/print/core/components/email-header/attachments.json b/print/core/components/email-header/attachments.json
new file mode 100644
index 000000000..5e57ae009
--- /dev/null
+++ b/print/core/components/email-header/attachments.json
@@ -0,0 +1,7 @@
+[
+ {
+ "filename": "email-logo.png",
+ "path": "/assets/images/email-logo.png",
+ "cid": "email-logo.png"
+ }
+]
\ No newline at end of file
diff --git a/print/core/components/email-header/email-header.html b/print/core/components/email-header/email-header.html
new file mode 100644
index 000000000..f2b5a90cf
--- /dev/null
+++ b/print/core/components/email-header/email-header.html
@@ -0,0 +1,5 @@
+
diff --git a/print/core/components/email-header/email-header.js b/print/core/components/email-header/email-header.js
new file mode 100755
index 000000000..a1c73ee60
--- /dev/null
+++ b/print/core/components/email-header/email-header.js
@@ -0,0 +1,4 @@
+module.exports = {
+ name: 'email-header',
+ props: ['isPreview']
+};
diff --git a/print/templates/reports/report-footer/assets/css/style.css b/print/core/components/report-footer/assets/css/style.css
similarity index 100%
rename from print/templates/reports/report-footer/assets/css/style.css
rename to print/core/components/report-footer/assets/css/style.css
diff --git a/print/core/components/report-footer/locale/es.yml b/print/core/components/report-footer/locale/es.yml
new file mode 100644
index 000000000..8c54b796f
--- /dev/null
+++ b/print/core/components/report-footer/locale/es.yml
@@ -0,0 +1,10 @@
+numPages: Página {{page}} de {{pages}}
+law:
+ phytosanitary: 'VERDNATURA LEVANTE SL - Pasaporte Fitosanitario R.P. Generalitat
+ Valenciana - Nº Comerciante: ES17462130'
+ privacy: En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección
+ de Datos de Carácter Personal, le comunicamos que los datos personales que facilite
+ se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en
+ todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición,
+ comunicándolo por escrito al domicilio social de la entidad. La finalidad del
+ fichero es la gestión administrativa, contabilidad, y facturación.
diff --git a/print/core/components/report-footer/locale/fr.yml b/print/core/components/report-footer/locale/fr.yml
new file mode 100644
index 000000000..e35f9fb7f
--- /dev/null
+++ b/print/core/components/report-footer/locale/fr.yml
@@ -0,0 +1,10 @@
+numPages: Page {{page}} de {{pages}}
+law:
+ phytosanitary: 'VERDNATURA LEVANTE SL - Passeport Phytosanitaire R.P. Generalitat
+ Valenciana - Numéro d''opérateur: ES17462130'
+ privacy: Conformément aux dispositions de la loi organique 15/1999 sur la protection
+ des données personnelles, nous vous informons que les données personnelles que
+ vous fournissez seront incluses dans des dossiers. VERDNATURA LEVANTE S.L., vous
+ pouvez à tout moment, exercer les droits d'accès, de rectification, d'annulation
+ et d'opposition, en communiquant par écrit au siège social de la société. Le dossier
+ a pour objet la gestion administrative, la comptabilité et la facturation.
diff --git a/print/core/components/report-footer/locale/pt.yml b/print/core/components/report-footer/locale/pt.yml
new file mode 100644
index 000000000..8494c1ed5
--- /dev/null
+++ b/print/core/components/report-footer/locale/pt.yml
@@ -0,0 +1,10 @@
+numPages: Página {{page}} de {{pages}}
+law:
+ phytosanitary: 'VERDNATURA LEVANTE S.L - Passaporte Fitossanitário R.P. Generalitat
+ Valenciana - Nº Comerciante: ES17462130'
+ privacy: Em cumprimento do disposto na lei Orgânica 15/1999, de Protecção de Dados
+ de Carácter Pessoal, comunicamos que os dados pessoais que facilite se incluirão
+ nos ficheiros automatizados de VERDNATURA LEVANTE S.L., podendo em todo momento
+ exercer os direitos de acesso, rectificação, cancelação e oposição, comunicando
+ por escrito ao domicílio social da entidade. A finalidade do ficheiro é a gestão
+ administrativa, contabilidade e facturação.
diff --git a/print/templates/reports/report-footer/index.html b/print/core/components/report-footer/report-footer.html
similarity index 100%
rename from print/templates/reports/report-footer/index.html
rename to print/core/components/report-footer/report-footer.html
diff --git a/print/templates/reports/report-footer/index.js b/print/core/components/report-footer/report-footer.js
similarity index 100%
rename from print/templates/reports/report-footer/index.js
rename to print/core/components/report-footer/report-footer.js
diff --git a/print/templates/reports/report-header/assets/css/style.css b/print/core/components/report-header/assets/css/style.css
similarity index 100%
rename from print/templates/reports/report-header/assets/css/style.css
rename to print/core/components/report-header/assets/css/style.css
diff --git a/print/templates/reports/report-header/assets/images/report-logo.png b/print/core/components/report-header/assets/images/report-logo.png
similarity index 100%
rename from print/templates/reports/report-header/assets/images/report-logo.png
rename to print/core/components/report-header/assets/images/report-logo.png
diff --git a/print/templates/reports/report-header/assets/images/report-logo.svg b/print/core/components/report-header/assets/images/report-logo.svg
similarity index 100%
rename from print/templates/reports/report-header/assets/images/report-logo.svg
rename to print/core/components/report-header/assets/images/report-logo.svg
diff --git a/print/core/components/report-header/locale/es.yml b/print/core/components/report-header/locale/es.yml
new file mode 100644
index 000000000..51552c24c
--- /dev/null
+++ b/print/core/components/report-header/locale/es.yml
@@ -0,0 +1,5 @@
+company:
+ fiscalAddress: VERDNATURA LEVANTE S.L., B97367486 Avda. Espioca, 100, 46460 Silla
+ - www.verdnatura.es - clientes@verdnatura.es
+ registry: 'CIF: B97367486 Registro Mercantil de Valencia, Tomo 8041, Libro 5334,
+ Folio 160, Sección 8, Hoja V 102076'
diff --git a/print/core/components/report-header/locale/pt.yml b/print/core/components/report-header/locale/pt.yml
new file mode 100644
index 000000000..51552c24c
--- /dev/null
+++ b/print/core/components/report-header/locale/pt.yml
@@ -0,0 +1,5 @@
+company:
+ fiscalAddress: VERDNATURA LEVANTE S.L., B97367486 Avda. Espioca, 100, 46460 Silla
+ - www.verdnatura.es - clientes@verdnatura.es
+ registry: 'CIF: B97367486 Registro Mercantil de Valencia, Tomo 8041, Libro 5334,
+ Folio 160, Sección 8, Hoja V 102076'
diff --git a/print/templates/reports/report-header/index.html b/print/core/components/report-header/report-header.html
similarity index 100%
rename from print/templates/reports/report-header/index.html
rename to print/core/components/report-header/report-header.html
diff --git a/print/templates/reports/report-header/index.js b/print/core/components/report-header/report-header.js
similarity index 100%
rename from print/templates/reports/report-header/index.js
rename to print/core/components/report-header/report-header.js
diff --git a/print/lib/config.js b/print/core/config.js
similarity index 100%
rename from print/lib/config.js
rename to print/core/config.js
diff --git a/print/lib/cssReader.js b/print/core/cssReader.js
similarity index 100%
rename from print/lib/cssReader.js
rename to print/core/cssReader.js
diff --git a/print/lib/database.js b/print/core/database.js
similarity index 100%
rename from print/lib/database.js
rename to print/core/database.js
diff --git a/print/core/directives/index.js b/print/core/directives/index.js
new file mode 100644
index 000000000..b93a6ca1e
--- /dev/null
+++ b/print/core/directives/index.js
@@ -0,0 +1 @@
+// Import global directives
diff --git a/print/lib/emailEngine.js b/print/core/email.js
similarity index 62%
rename from print/lib/emailEngine.js
rename to print/core/email.js
index 2ccff4f87..f85e42035 100644
--- a/print/lib/emailEngine.js
+++ b/print/core/email.js
@@ -1,26 +1,92 @@
-const Vue = require('vue');
-const VueI18n = require('vue-i18n');
-const renderer = require('vue-server-renderer').createRenderer();
-const fs = require('fs-extra');
-const juice = require('juice');
+const path = require('path');
const smtp = require('./smtp');
-const fallbackLocale = 'es';
+const Component = require('./component');
+const Report = require('./report');
if (!process.env.OPENSSL_CONF)
process.env.OPENSSL_CONF = '/etc/ssl/';
-Vue.use(VueI18n);
+class Email extends Component {
+ constructor(name, args) {
+ super(name);
-module.exports = {
+ this.args = args;
+ }
+
+ get path() {
+ return `../templates/email/${this.name}`;
+ }
+
+
+ get subject() {
+ return null;
+ }
+
+ async send() {
+ const instance = this.build();
+ const rendered = await this.render();
+ const attachments = [];
+ const getAttachments = async(componentPath, files) => {
+ for (file of files) {
+ const fileCopy = Object.assign({}, file);
+ if (fileCopy.cid) {
+ const templatePath = `${componentPath}/${file.path}`;
+ const fullFilePath = path.resolve(__dirname, templatePath);
+
+ fileCopy.path = path.resolve(__dirname, fullFilePath);
+ } else {
+ const reportName = fileCopy.filename.replace('.pdf', '');
+ const report = new Report(reportName, this.args);
+ fileCopy.content = await report.toPdfStream();
+ }
+
+ attachments.push(fileCopy);
+ }
+ };
+
+ if (instance.components) {
+ const components = instance.components;
+ for (let componentName in components) {
+ const component = components[componentName];
+ const componentPath = `../components/${componentName}`;
+ await getAttachments(componentPath, component.attachments);
+ }
+ }
+
+
+ if (this.attachments)
+ await getAttachments(this.path, this.attachments);
+ /*
+ this.attachments.forEach(file => {
+ const fileCopy = Object.assign({}, file);
+ if (fileCopy.path) {
+ const templatePath = `${this.path}/${file.path}`;
+ const fullFilePath = path.resolve(__dirname, templatePath);
+
+ fileCopy.path = path.resolve(__dirname, fullFilePath);
+ }
+
+ attachments.push(fileCopy);
+ }); */
+
+ const options = {
+ to: this.args.recipient,
+ subject: 'Test',
+ html: rendered,
+ attachments: attachments
+ };
+
+ return smtp.send(options);
+ }
+}
+
+module.exports = Email;
+
+
+/* module.exports = {
path: `${appPath}/report`,
- /**
- * Renders a report component
- *
- * @param {String} name - Report name
- * @param {Object} ctx - Request context
- */
async render(name, ctx) {
const component = require(`${this.path}/${name}`);
const result = await this.preFetch(component, ctx);
@@ -39,12 +105,6 @@ module.exports = {
});
},
- /**
- * Prefetch all component data from asyncData method
- *
- * @param {Object} orgComponent - Component object
- * @param {Object} ctx - Request context
- */
async preFetch(orgComponent, ctx) {
let component = Object.create(orgComponent);
let mergedData = {attachments: []};
@@ -150,3 +210,4 @@ module.exports = {
return smtp.send(options);
},
};
+ */
diff --git a/print/lib/exceptions/userException.js b/print/core/exceptions/userException.js
similarity index 100%
rename from print/lib/exceptions/userException.js
rename to print/core/exceptions/userException.js
diff --git a/print/core/filters/currency.js b/print/core/filters/currency.js
new file mode 100644
index 000000000..b455673ac
--- /dev/null
+++ b/print/core/filters/currency.js
@@ -0,0 +1,7 @@
+const Vue = require('vue');
+const currency = {
+ methods: {
+ },
+};
+
+Vue.mixin(currency);
diff --git a/print/core/filters/index.js b/print/core/filters/index.js
new file mode 100644
index 000000000..caf95d54a
--- /dev/null
+++ b/print/core/filters/index.js
@@ -0,0 +1 @@
+// Import global filters
diff --git a/print/lib/filters/index.js b/print/core/filters/translate.js
similarity index 100%
rename from print/lib/filters/index.js
rename to print/core/filters/translate.js
diff --git a/print/core/mixins/image-src.js b/print/core/mixins/image-src.js
new file mode 100644
index 000000000..730604455
--- /dev/null
+++ b/print/core/mixins/image-src.js
@@ -0,0 +1,15 @@
+const Vue = require('vue');
+const imageSrc = {
+ methods: {
+ getSrc(image) {
+ let src = `cid:${image}`;
+
+ if (this.isPreview === 'true')
+ src = `/api/assets/${this.$options.name}/images/${image}`;
+
+ return src;
+ }
+ },
+};
+
+Vue.mixin(imageSrc);
diff --git a/print/core/mixins/index.js b/print/core/mixins/index.js
new file mode 100644
index 000000000..3baffcec4
--- /dev/null
+++ b/print/core/mixins/index.js
@@ -0,0 +1,2 @@
+// Import global mixins
+require('./image-src');
diff --git a/print/lib/report.js b/print/core/report.js
similarity index 74%
rename from print/lib/report.js
rename to print/core/report.js
index 6cfaee4b4..4b00b25b7 100644
--- a/print/lib/report.js
+++ b/print/core/report.js
@@ -1,66 +1,20 @@
-const Vue = require('vue');
-const VueI18n = require('vue-i18n');
-const renderer = require('vue-server-renderer').createRenderer();
-
const fs = require('fs');
const pdf = require('html-pdf');
-const juice = require('juice');
-const path = require('path');
-
const config = require('./config');
-const reportsPath = '../templates/reports';
+const Component = require('./component');
if (!process.env.OPENSSL_CONF)
process.env.OPENSSL_CONF = '/etc/ssl/';
-Vue.use(VueI18n);
-
-class Report {
+class Report extends Component {
constructor(name, args) {
- this.name = name;
+ super(name);
+
this.args = args;
}
get path() {
- return `${reportsPath}/${this.name}`;
- }
-
- get template() {
- const templatePath = `${this.path}/${this.name}.html`;
- const fullPath = path.resolve(__dirname, templatePath);
-
- return fs.readFileSync(fullPath, 'utf8');
- }
-
- get locale() {
-
- }
-
- get style() {
-
- }
-
- async render() {
- const localePath = `${this.path}/locale`;
- const stylePath = `${this.path}/assets/css/index`;
-
- const stylesheet = require(stylePath);
- const component = require(this.path);
-
- component.i18n = require(localePath);
- component.template = juice.inlineContent(this.template, stylesheet, {
- inlinePseudoElements: true
- });
-
- const i18n = new VueI18n(config.i18n);
- const app = new Vue({
- i18n: i18n,
- render: h => h(component, {
- props: this.args
- })
- });
-
- return renderer.renderToString(app);
+ return `../templates/reports/${this.name}`;
}
async toPdfStream() {
diff --git a/print/lib/router.js b/print/core/router.js
similarity index 71%
rename from print/lib/router.js
rename to print/core/router.js
index eff4b5c9e..f800ace0c 100644
--- a/print/lib/router.js
+++ b/print/core/router.js
@@ -1,13 +1,25 @@
-const Report = require('./report');
-const emailEngine = require('./emailEngine');
const express = require('express');
const path = require('path');
-const vue = require('vue');
-
const fs = require('fs');
+
+const Report = require('./report');
+const Email = require('./email');
+
const templatesPath = path.resolve(__dirname, '../templates');
+const componentsPath = path.resolve(__dirname, './components');
module.exports = app => {
+ /**
+ * Serve component static files
+ */
+ const componentsDir = fs.readdirSync(componentsPath);
+ componentsDir.forEach(componentName => {
+ const componentDir = path.join(componentsPath, '/', componentName);
+ const assetsDir = `${componentDir}/assets`;
+
+ app.use(`/api/assets/${componentName}`, express.static(assetsDir));
+ });
+
/**
* Serve static files
*/
@@ -20,7 +32,7 @@ module.exports = app => {
const templateDir = path.join(templatesPath, '/', directory, '/', templateName);
const assetsDir = `${templateDir}/assets`;
- app.use(`/api/assets`, express.static(assetsDir));
+ app.use(`/api/assets/${templateName}`, express.static(assetsDir));
});
});
@@ -28,19 +40,34 @@ module.exports = app => {
const args = Object.assign({}, req.body, req.query);
const report = new Report(req.params.name, args);
const stream = await report.toPdfStream();
-
res.setHeader('Content-type', 'application/pdf');
stream.pipe(res);
});
- /* app.get(`/api/email/${name}`, (request, response) => {
- emailEngine.render(name, request).then(rendered => {
- response.send(rendered.html);
- }).catch(e => {
- next(e);
+ app.get(`/api/email/:name`, async(req, res) => {
+ const args = req.query;
+ const requiredArgs = ['userId'];
+
+ const hasRequiredArgs = requiredArgs.every(arg => {
+ return args[arg];
});
+
+ if (!hasRequiredArgs)
+ res.json({message: 'userId'});
+
+ const email = new Email(req.params.name, args);
+ if (args.isPreview === 'true') {
+ const rendered = await email.render();
+
+ res.send(rendered);
+ } else {
+ await email.send();
+ res.status(200).json({message: 'Sent'});
+ }
});
+ /*
+
app.post(`/api/email/${name}`, (request, response, next) => {
emailEngine.toEmail(name, request).then(() => {
response.status(200).json({status: 200});
diff --git a/print/lib/smtp.js b/print/core/smtp.js
similarity index 86%
rename from print/lib/smtp.js
rename to print/core/smtp.js
index 65fb58289..6f8bb20f9 100644
--- a/print/lib/smtp.js
+++ b/print/core/smtp.js
@@ -1,5 +1,5 @@
const nodemailer = require('nodemailer');
-const config = require('./config.js');
+const config = require('./config');
module.exports = {
init() {
@@ -11,7 +11,7 @@ module.exports = {
options.from = `${config.app.senderName} <${config.app.senderMail}>`;
if (process.env.NODE_ENV !== 'production') {
- if (!config.smtp.user)
+ if (!config.smtp.auth.user)
return Promise.resolve(true);
options.to = config.app.senderMail;
diff --git a/print/lib/mixins/text.js b/print/lib/mixins/text.js
deleted file mode 100755
index be67a8746..000000000
--- a/print/lib/mixins/text.js
+++ /dev/null
@@ -1,7 +0,0 @@
-module.exports = {
- methods: {
- uFirst: (text) => {
- return text;
- },
- },
-};
diff --git a/print/package-lock.json b/print/package-lock.json
index 2be86cc84..5e8073291 100644
--- a/print/package-lock.json
+++ b/print/package-lock.json
@@ -25,6 +25,14 @@
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
},
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
"asn1": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
@@ -309,6 +317,11 @@
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
+ },
"extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
@@ -519,6 +532,15 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
+ "js-yaml": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
@@ -997,6 +1019,11 @@
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz",
"integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI="
},
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
+ },
"sqlstring": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
diff --git a/print/package.json b/print/package.json
index 0332817c2..898e75da0 100755
--- a/print/package.json
+++ b/print/package.json
@@ -15,6 +15,7 @@
"dependencies": {
"fs-extra": "^7.0.1",
"html-pdf": "^2.2.0",
+ "js-yaml": "^3.13.1",
"juice": "^5.0.1",
"mysql2": "^1.6.5",
"nodemailer": "^4.7.0",
diff --git a/print/server.js b/print/server.js
index 31830009d..112873b9b 100644
--- a/print/server.js
+++ b/print/server.js
@@ -4,11 +4,16 @@ module.exports = app => {
process.env.OPENSSL_CONF = '/etc/ssl/';
// Init database instance
- require('./lib/database').init();
+ require('./core/database').init();
// Init SMTP Instance
- require('./lib/smtp').init();
+ require('./core/smtp').init();
- require('./lib/router')(app);
+ require('./core/router')(app);
+
+ require('./core/mixins');
+ require('./core/filters');
+ require('./core/directives');
+ // require('./core/components/email-header/email-header');
};
diff --git a/print/templates/email/claim-pickup-order/assets/css/email.css b/print/templates/email/claim-pickup-order/assets/css/email.css
new file mode 100644
index 000000000..a2b129057
--- /dev/null
+++ b/print/templates/email/claim-pickup-order/assets/css/email.css
@@ -0,0 +1,44 @@
+/**
+ * Email only stylesheet
+ *
+*/
+body {
+ background-color: #EEE
+}
+
+.container {
+ max-width: 600px;
+ min-width: 320px;
+ margin: 0 auto;
+ color: #555
+}
+
+.main {
+ background-color: #FFF;
+ padding: 20px
+}
+
+.main a {
+ color: #8dba25
+}
+
+.main h1 {
+ color: #999
+}
+
+.main h3 {
+ font-size: 16px
+}
+
+.title {
+ background-color: #95d831;
+ text-transform: uppercase;
+ text-align: center;
+ padding: 35px 0
+}
+
+.title h1 {
+ font-size: 32px;
+ color: #333;
+ margin: 0
+}
diff --git a/print/templates/email/claim-pickup-order/assets/css/index.js b/print/templates/email/claim-pickup-order/assets/css/index.js
deleted file mode 100644
index 321c632dc..000000000
--- a/print/templates/email/claim-pickup-order/assets/css/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-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/templates/email/claim-pickup-order/assets/css/layout.css b/print/templates/email/claim-pickup-order/assets/css/layout.css
new file mode 100644
index 000000000..26b9bf8e0
--- /dev/null
+++ b/print/templates/email/claim-pickup-order/assets/css/layout.css
@@ -0,0 +1,233 @@
+/**
+ * CSS layout elements
+ *
+*/
+.container {
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ font-size: 16px
+}
+
+.columns {
+ overflow: hidden
+}
+
+.columns .size100 {
+ width: 100%;
+ float: left
+}
+
+.columns .size75 {
+ width: 75%;
+ float: left
+}
+
+.columns .size50 {
+ width: 50%;
+ float: left
+}
+
+.columns .size33 {
+ width: 33.33%;
+ float: left
+}
+
+.columns .size25 {
+ width: 25%;
+ float: left
+}
+
+.clearfix {
+ overflow: hidden;
+ display: block;
+ clear: both
+}
+
+.panel {
+ position: relative;
+ margin-bottom: 15px;
+ padding-top: 10px;
+ break-inside: avoid;
+ break-before: always;
+ break-after: always;
+}
+
+.panel .header {
+ background-color: #FFF;
+ padding: 2.5px 10px;
+ position: absolute;
+ font-weight: bold;
+ top: 0px;
+ left: 17.5px;
+}
+
+.panel .body {
+ border: 1px solid #CCC;
+ overflow: hidden;
+ padding: 20px
+}
+
+.panel .body h3 {
+ margin-top: 0
+}
+
+.panel.dark .header {
+ border: 1px solid #808080;
+ background-color: #FFF;
+}
+
+.panel.dark .body {
+ border: 1px solid #808080;
+ background-color: #c0c0c0
+}
+
+.field {
+ border-bottom: 1px solid #CCC;
+ border-left: 1px solid #CCC;
+ border-top: 1px solid #CCC;
+ float: left
+}
+
+.field span {
+ border-right: 1px solid #CCC;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ font-weight: bold
+}
+
+.field.square span {
+ height: 35.4px;
+ width: 35.4px
+}
+
+.emptyField {
+ border-bottom: 1px dotted grey;
+ min-height: 1em;
+ display: block
+}
+
+.field.rectangle span {
+ height: 2em;
+ width: 8em
+}
+
+.pull-left {
+ float: left !important
+}
+
+.pull-right {
+ float: right !important
+}
+
+.vertical-text {
+ -moz-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ position: absolute;
+ text-align: center;
+ font-size: .65em;
+ right: -108px;
+ width: 200px;
+ top: 50%
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+.row-oriented, .column-oriented {
+ text-align: left;
+ width: 100%
+}
+
+.column-oriented {
+ margin-bottom: 15px
+}
+
+.column-oriented td,
+.column-oriented th {
+ padding: 5px 10px
+}
+
+.column-oriented thead {
+ background-color: #e5e5e5
+}
+
+.column-oriented thead tr {
+ border-bottom: 1px solid #808080;
+ border-top: 1px solid #808080;
+ background-color: #e5e5e5
+}
+
+.column-oriented tfoot {
+ border-top: 2px solid #808080;
+}
+
+.column-oriented tfoot tr:first-child td {
+ padding-top: 20px !important;
+}
+
+.column-oriented .description {
+ border-bottom: 1px solid #DDD;
+ font-size: 0.8em
+}
+
+.panel .row-oriented td, .panel .row-oriented th {
+ padding: 10px 0
+}
+
+.row-oriented > tbody > tr > td {
+ width: 30%
+}
+
+.row-oriented > tbody > tr > th {
+ padding-left: 30px;
+ width: 70%
+}
+
+.row-oriented .description {
+ padding: 0 !important;
+ font-size: 0.6em;
+ color: #888
+}
+
+.line {
+ border-bottom: 1px solid #DDD;
+ border-right: 1px solid #DDD;
+ border-left: 1px solid #DDD;
+ position: relative;
+ margin-left: -1px;
+ margin-right: 1px;
+ margin-top: 10px;
+ color: #999;
+ padding: 5px 0
+}
+
+.line .vertical-aligned {
+ position: absolute;
+ text-align: center;
+ width: 100%;
+
+}
+
+.line span {
+ background-color: #FFF;
+ padding: 5px
+}
+
+.signature {
+ width: 100%
+}
+
+.signature section {
+ height: 150px
+}
+
+.signature p {
+ margin-right: 50%;
+ margin-top: 140px
+}
diff --git a/print/templates/email/claim-pickup-order/assets/css/misc.css b/print/templates/email/claim-pickup-order/assets/css/misc.css
new file mode 100644
index 000000000..093d5a974
--- /dev/null
+++ b/print/templates/email/claim-pickup-order/assets/css/misc.css
@@ -0,0 +1,47 @@
+/**
+ * CSS misc classes
+ *
+*/
+.uppercase {
+ text-transform: uppercase
+}
+
+.justified {
+ text-align: justify
+}
+
+.centered {
+ text-align: center
+}
+
+.align-right {
+ text-align: right
+}
+
+.align-left {
+ text-align: left
+}
+
+.number {
+ text-align: right
+}
+
+.font.gray {
+ color: #555
+}
+
+.font.light-gray {
+ color: #888
+}
+
+.font.small {
+ font-size: 0.65em
+}
+
+.font.bold {
+ font-weight: bold
+}
+
+.non-page-break {
+ page-break-inside: avoid;
+}
\ No newline at end of file
diff --git a/print/templates/email/claim-pickup-order/attachments.json b/print/templates/email/claim-pickup-order/attachments.json
new file mode 100644
index 000000000..1c77a5539
--- /dev/null
+++ b/print/templates/email/claim-pickup-order/attachments.json
@@ -0,0 +1,3 @@
+[{
+ "filename": "claim-pickup-order.pdf"
+}]
\ No newline at end of file
diff --git a/print/templates/email/claim-pickup-order/index.html b/print/templates/email/claim-pickup-order/claim-pickup-order.html
similarity index 71%
rename from print/templates/email/claim-pickup-order/index.html
rename to print/templates/email/claim-pickup-order/claim-pickup-order.html
index fa2b0c530..3cd63bd56 100644
--- a/print/templates/email/claim-pickup-order/index.html
+++ b/print/templates/email/claim-pickup-order/claim-pickup-order.html
@@ -6,7 +6,7 @@
-
+
@@ -15,6 +15,8 @@
+ {{$t('testing')}}
+
{{$t('description.dear')}},
{{$t('description.instructions')}}
@@ -27,9 +29,14 @@
{{$t('sections.howToBuy.stock')}}
{{$t('sections.howToBuy.delivery')}}
-->
+
-
+
diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.js b/print/templates/email/claim-pickup-order/claim-pickup-order.js
new file mode 100755
index 000000000..452331b34
--- /dev/null
+++ b/print/templates/email/claim-pickup-order/claim-pickup-order.js
@@ -0,0 +1,39 @@
+const db = require(`${appPath}/core/database`);
+const Component = require(`${appPath}/core/component`);
+const emailHeader = new Component('email-header');
+const emailFooter = new Component('email-footer');
+const attachments = require('./attachments.json');
+
+module.exports = {
+ name: 'claim-pickup-order',
+ /* async serverPrefetch() {
+ this.client = await this.fetchClient(this.clientId);
+ },*/
+ created() {
+ if (this.locale)
+ this.$i18n.locale = this.locale;
+ },
+ data() {
+ return {
+ attachments
+ };
+ },
+ methods: {
+ fetchClient(claimId) {
+ return db.findOne(`
+ SELECT
+ c.id,
+ u.lang locale,
+ c.email recipient
+ FROM claim cl
+ JOIN client c ON c.id = cl.clientFk
+ JOIN account.user u ON u.id = c.id
+ WHERE cl.id = ?`, [claimId]);
+ },
+ },
+ components: {
+ 'email-header': emailHeader.build(),
+ 'email-footer': emailFooter.build()
+ },
+ props: ['claimId', 'isPreview']
+};
diff --git a/print/templates/email/claim-pickup-order/index.js b/print/templates/email/claim-pickup-order/index.js
deleted file mode 100755
index 38cb65e78..000000000
--- a/print/templates/email/claim-pickup-order/index.js
+++ /dev/null
@@ -1,53 +0,0 @@
-const UserException = require(`${appPath}/lib/exceptions/userException`);
-const reportEngine = require(`${appPath}/lib/reportEngine`);
-const database = require(`${appPath}/lib/database`);
-const emailHeader = require('../email-header');
-const emailFooter = require('../email-footer');
-
-
-module.exports = {
- name: 'claim-pickup-order',
- async asyncData(ctx, params) {
- const promises = [];
- const data = {
- isPreview: ctx.method === 'GET',
- };
-
- if (!params.claimFk)
- throw new UserException('No claim id specified');
-
- promises.push(reportEngine.toPdf('rpt-claim-pickup-order', ctx));
- promises.push(this.methods.fetchClient(params.claimFk));
-
- return Promise.all(promises).then(result => {
- const stream = result[0];
- const [[client]] = result[1];
-
- Object.assign(data, client);
- Object.assign(data, {attachments: [{filename: 'claim-pickup-order.pdf', content: stream}]});
-
- return data;
- });
- },
- created() {
- if (this.locale)
- this.$i18n.locale = this.locale;
- },
- methods: {
- fetchClient(claimFk) {
- return database.pool.query(`
- SELECT
- c.id,
- u.lang locale,
- c.email recipient
- FROM claim cl
- JOIN client c ON c.id = cl.clientFk
- JOIN account.user u ON u.id = c.id
- WHERE cl.id = ?`, [claimFk]);
- },
- },
- components: {
- emailHeader,
- emailFooter,
- },
-};
diff --git a/print/templates/email/claim-pickup-order/locale.js b/print/templates/email/claim-pickup-order/locale.js
deleted file mode 100644
index 343a9f9ab..000000000
--- a/print/templates/email/claim-pickup-order/locale.js
+++ /dev/null
@@ -1,25 +0,0 @@
-module.exports = {
- messages: {
- es: {
- subject: 'Orden de recogida',
- title: 'Orden de recogida',
- description: {
- dear: 'Estimado cliente',
- instructions: 'Aqui tienes tu orden de recogida.'
- },
- sections: {
- howToBuy: {
- title: 'Cómo hacer un pedido',
- description: `Para realizar un pedido en nuestra web,
- debes configurarlo indicando:`,
- requeriments: [
- 'Si quieres recibir el pedido (por agencia o por nuestro propio reparto) o si lo prefieres recoger en alguno de nuestros almacenes.',
- 'La fecha en la que quieres recibir el pedido (se preparará el día anterior).',
- 'La dirección de entrega o el almacén donde quieres recoger el pedido.'],
- stock: 'En nuestra web y aplicaciones puedes visualizar el stock disponible de flor cortada, verdes, plantas, complementos y artificial. Ten en cuenta que dicho stock puede variar en función de la fecha seleccionada al configurar el pedido. Es importante CONFIRMAR los pedidos para que la mercancía quede reservada.',
- delivery: 'El reparto se realiza de lunes a sábado según la zona en la que te encuentres. Por regla general, los pedidos que se entregan por agencia, deben estar confirmados y pagados antes de las 17h del día en que se preparan (el día anterior a recibirlos), aunque esto puede variar si el pedido se envía a través de nuestro reparto y según la zona.',
- }
- }
- },
- },
-};
diff --git a/print/templates/email/claim-pickup-order/locale/es.yml b/print/templates/email/claim-pickup-order/locale/es.yml
new file mode 100644
index 000000000..1d49b2b2b
--- /dev/null
+++ b/print/templates/email/claim-pickup-order/locale/es.yml
@@ -0,0 +1,23 @@
+subject: Orden de recogida
+title: Orden de recogida
+description:
+ dear: Estimado cliente
+ instructions: Aqui tienes tu orden de recogida.
+sections:
+ howToBuy:
+ title: Cómo hacer un pedido
+ description: 'Para realizar un pedido en nuestra web, debes configurarlo indicando:'
+ requeriments:
+ - Si quieres recibir el pedido (por agencia o por nuestro propio reparto) o si
+ lo prefieres recoger en alguno de nuestros almacenes.
+ - La fecha en la que quieres recibir el pedido (se preparará el día anterior).
+ - La dirección de entrega o el almacén donde quieres recoger el pedido.
+ stock: En nuestra web y aplicaciones puedes visualizar el stock disponible de
+ flor cortada, verdes, plantas, complementos y artificial. Ten en cuenta que
+ dicho stock puede variar en función de la fecha seleccionada al configurar el
+ pedido. Es importante CONFIRMAR los pedidos para que la mercancía quede reservada.
+ delivery: El reparto se realiza de lunes a sábado según la zona en la que te encuentres.
+ Por regla general, los pedidos que se entregan por agencia, deben estar confirmados
+ y pagados antes de las 17h del día en que se preparan (el día anterior a recibirlos),
+ aunque esto puede variar si el pedido se envía a través de nuestro reparto y
+ según la zona.
diff --git a/print/templates/email/client-welcome/assets/css/email.css b/print/templates/email/client-welcome/assets/css/email.css
new file mode 120000
index 000000000..78b0e007a
--- /dev/null
+++ b/print/templates/email/client-welcome/assets/css/email.css
@@ -0,0 +1 @@
+../../../../../common/css/email.css
\ No newline at end of file
diff --git a/print/templates/email/client-welcome/assets/css/index.js b/print/templates/email/client-welcome/assets/css/index.js
deleted file mode 100644
index 321c632dc..000000000
--- a/print/templates/email/client-welcome/assets/css/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-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/templates/email/client-welcome/assets/css/layout.css b/print/templates/email/client-welcome/assets/css/layout.css
new file mode 100644
index 000000000..26b9bf8e0
--- /dev/null
+++ b/print/templates/email/client-welcome/assets/css/layout.css
@@ -0,0 +1,233 @@
+/**
+ * CSS layout elements
+ *
+*/
+.container {
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ font-size: 16px
+}
+
+.columns {
+ overflow: hidden
+}
+
+.columns .size100 {
+ width: 100%;
+ float: left
+}
+
+.columns .size75 {
+ width: 75%;
+ float: left
+}
+
+.columns .size50 {
+ width: 50%;
+ float: left
+}
+
+.columns .size33 {
+ width: 33.33%;
+ float: left
+}
+
+.columns .size25 {
+ width: 25%;
+ float: left
+}
+
+.clearfix {
+ overflow: hidden;
+ display: block;
+ clear: both
+}
+
+.panel {
+ position: relative;
+ margin-bottom: 15px;
+ padding-top: 10px;
+ break-inside: avoid;
+ break-before: always;
+ break-after: always;
+}
+
+.panel .header {
+ background-color: #FFF;
+ padding: 2.5px 10px;
+ position: absolute;
+ font-weight: bold;
+ top: 0px;
+ left: 17.5px;
+}
+
+.panel .body {
+ border: 1px solid #CCC;
+ overflow: hidden;
+ padding: 20px
+}
+
+.panel .body h3 {
+ margin-top: 0
+}
+
+.panel.dark .header {
+ border: 1px solid #808080;
+ background-color: #FFF;
+}
+
+.panel.dark .body {
+ border: 1px solid #808080;
+ background-color: #c0c0c0
+}
+
+.field {
+ border-bottom: 1px solid #CCC;
+ border-left: 1px solid #CCC;
+ border-top: 1px solid #CCC;
+ float: left
+}
+
+.field span {
+ border-right: 1px solid #CCC;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ font-weight: bold
+}
+
+.field.square span {
+ height: 35.4px;
+ width: 35.4px
+}
+
+.emptyField {
+ border-bottom: 1px dotted grey;
+ min-height: 1em;
+ display: block
+}
+
+.field.rectangle span {
+ height: 2em;
+ width: 8em
+}
+
+.pull-left {
+ float: left !important
+}
+
+.pull-right {
+ float: right !important
+}
+
+.vertical-text {
+ -moz-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ position: absolute;
+ text-align: center;
+ font-size: .65em;
+ right: -108px;
+ width: 200px;
+ top: 50%
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+.row-oriented, .column-oriented {
+ text-align: left;
+ width: 100%
+}
+
+.column-oriented {
+ margin-bottom: 15px
+}
+
+.column-oriented td,
+.column-oriented th {
+ padding: 5px 10px
+}
+
+.column-oriented thead {
+ background-color: #e5e5e5
+}
+
+.column-oriented thead tr {
+ border-bottom: 1px solid #808080;
+ border-top: 1px solid #808080;
+ background-color: #e5e5e5
+}
+
+.column-oriented tfoot {
+ border-top: 2px solid #808080;
+}
+
+.column-oriented tfoot tr:first-child td {
+ padding-top: 20px !important;
+}
+
+.column-oriented .description {
+ border-bottom: 1px solid #DDD;
+ font-size: 0.8em
+}
+
+.panel .row-oriented td, .panel .row-oriented th {
+ padding: 10px 0
+}
+
+.row-oriented > tbody > tr > td {
+ width: 30%
+}
+
+.row-oriented > tbody > tr > th {
+ padding-left: 30px;
+ width: 70%
+}
+
+.row-oriented .description {
+ padding: 0 !important;
+ font-size: 0.6em;
+ color: #888
+}
+
+.line {
+ border-bottom: 1px solid #DDD;
+ border-right: 1px solid #DDD;
+ border-left: 1px solid #DDD;
+ position: relative;
+ margin-left: -1px;
+ margin-right: 1px;
+ margin-top: 10px;
+ color: #999;
+ padding: 5px 0
+}
+
+.line .vertical-aligned {
+ position: absolute;
+ text-align: center;
+ width: 100%;
+
+}
+
+.line span {
+ background-color: #FFF;
+ padding: 5px
+}
+
+.signature {
+ width: 100%
+}
+
+.signature section {
+ height: 150px
+}
+
+.signature p {
+ margin-right: 50%;
+ margin-top: 140px
+}
diff --git a/print/templates/email/client-welcome/assets/css/misc.css b/print/templates/email/client-welcome/assets/css/misc.css
new file mode 100644
index 000000000..093d5a974
--- /dev/null
+++ b/print/templates/email/client-welcome/assets/css/misc.css
@@ -0,0 +1,47 @@
+/**
+ * CSS misc classes
+ *
+*/
+.uppercase {
+ text-transform: uppercase
+}
+
+.justified {
+ text-align: justify
+}
+
+.centered {
+ text-align: center
+}
+
+.align-right {
+ text-align: right
+}
+
+.align-left {
+ text-align: left
+}
+
+.number {
+ text-align: right
+}
+
+.font.gray {
+ color: #555
+}
+
+.font.light-gray {
+ color: #888
+}
+
+.font.small {
+ font-size: 0.65em
+}
+
+.font.bold {
+ font-weight: bold
+}
+
+.non-page-break {
+ page-break-inside: avoid;
+}
\ No newline at end of file
diff --git a/print/templates/email/client-welcome/index.html b/print/templates/email/client-welcome/client-welcome.html
similarity index 71%
rename from print/templates/email/client-welcome/index.html
rename to print/templates/email/client-welcome/client-welcome.html
index d6643e978..1608ee13e 100644
--- a/print/templates/email/client-welcome/index.html
+++ b/print/templates/email/client-welcome/client-welcome.html
@@ -6,7 +6,7 @@
-
+
@@ -19,8 +19,8 @@
-
{{$t('clientId')}}: {{ id }}
- {{$t('user')}}: {{userName}}
+ {{$t('clientId')}}: {{client.id}}
+ {{$t('user')}}: {{client.userName}}
@@ -52,20 +52,21 @@
-
- {{$t('salesPersonName')}}: {{salesPersonName}}
+
+ {{$t('salesPersonName')}}: {{client.salesPersonName}}
-
- {{$t('salesPersonPhone')}}: {{salesPersonPhone}}
+
+ {{$t('salesPersonPhone')}}: {{client.salesPersonPhone}}
-
+ {{isPreview}}
-
+
diff --git a/print/templates/email/client-welcome/index.js b/print/templates/email/client-welcome/client-welcome.js
similarity index 67%
rename from print/templates/email/client-welcome/index.js
rename to print/templates/email/client-welcome/client-welcome.js
index b2278b4ee..022b90865 100755
--- a/print/templates/email/client-welcome/index.js
+++ b/print/templates/email/client-welcome/client-welcome.js
@@ -1,9 +1,15 @@
-const database = require(`${appPath}/lib/database`);
-const UserException = require(`${appPath}/lib/exceptions/userException`);
+const db = require(`${appPath}/lib/database`);
+const Component = require(`${appPath}/lib/component`);
+const emailHeader = new Component('email-header');
+const emailFooter = new Component('email-footer');
+
module.exports = {
name: 'client-welcome',
- async asyncData(ctx, params) {
+ async serverPrefetch() {
+ this.client = await this.fetchClient(this.clientId);
+ },
+ /* async asyncData(ctx, params) {
const data = {
isPreview: ctx.method === 'GET',
};
@@ -17,14 +23,14 @@ module.exports = {
throw new UserException('No client data found');
return Object.assign(data, result[0]);
});
- },
+ }, */
created() {
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
- fetchClient(clientFk) {
- return database.pool.query(`
+ fetchClient(clientId) {
+ return db.findOne(`
SELECT
c.id,
u.lang locale,
@@ -37,11 +43,12 @@ module.exports = {
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 = ?`, [clientFk]);
+ WHERE c.id = ?`, [clientId]);
},
},
components: {
- 'email-header': require('../email-header'),
- 'email-footer': require('../email-footer'),
+ 'email-header': emailHeader.build(),
+ 'email-footer': emailFooter.build()
},
+ props: ['clientId', 'isPreview']
};
diff --git a/print/templates/email/client-welcome/locale.js b/print/templates/email/client-welcome/locale.js
deleted file mode 100644
index bf18a9d91..000000000
--- a/print/templates/email/client-welcome/locale.js
+++ /dev/null
@@ -1,55 +0,0 @@
-module.exports = {
- messages: {
- es: {
- subject: 'Bienvenido a Verdnatura',
- title: '¡Te damos la bienvenida!',
- dearClient: 'Estimado cliente',
- clientData: `Tus datos para poder comprar en la web de Verdnatura
- (https://www.verdnatura.es)
- o en nuestras aplicaciones para iOS y
- Android
- (Ver tutorial de uso), son`,
- clientId: 'Identificador de cliente',
- user: 'Usuario',
- password: 'Contraseña',
- passwordResetText: 'Haz clic en "¿Has olvidado tu contraseña?"',
- sections: {
- howToBuy: {
- title: 'Cómo hacer un pedido',
- description: `Para realizar un pedido en nuestra web,
- debes configurarlo indicando:`,
- requeriments: [
- 'Si quieres recibir el pedido (por agencia o por nuestro propio reparto) o si lo prefieres recoger en alguno de nuestros almacenes.',
- 'La fecha en la que quieres recibir el pedido (se preparará el día anterior).',
- 'La dirección de entrega o el almacén donde quieres recoger el pedido.'],
- stock: 'En nuestra web y aplicaciones puedes visualizar el stock disponible de flor cortada, verdes, plantas, complementos y artificial. Ten en cuenta que dicho stock puede variar en función de la fecha seleccionada al configurar el pedido. Es importante CONFIRMAR los pedidos para que la mercancía quede reservada.',
- delivery: 'El reparto se realiza de lunes a sábado según la zona en la que te encuentres. Por regla general, los pedidos que se entregan por agencia, deben estar confirmados y pagados antes de las 17h del día en que se preparan (el día anterior a recibirlos), aunque esto puede variar si el pedido se envía a través de nuestro reparto y según la zona.',
- },
- howToPay: {
- title: 'Cómo pagar',
- description: 'Las formas de pago admitidas en Verdnatura son:',
- options: [
- 'Con tarjeta a través de nuestra plataforma web (al confirmar el pedido).',
- 'Mediante giro bancario mensual, modalidad que hay que solicitar y tramitar.',
- ],
- },
- toConsider: {
- title: 'Cosas a tener en cuenta',
- description: `Verdnatura vende EXCLUSIVAMENTE a profesionales, por lo que debes
- remitirnos el Modelo 036 ó 037, para comprobar que está
- dado/a de alta en el epígrafe correspondiente al comercio de flores.`,
- },
- claimsPolicy: {
- title: 'POLÍTICA DE RECLAMACIONES',
- description: `Verdnatura aceptará las reclamaciones que se realicen dentro
- de los dos días naturales siguientes a la recepción del pedido (incluyendo el mismo día de la recepción).
- Pasado este plazo no se aceptará ninguna reclamación.`,
- },
- },
- help: 'Cualquier duda que te surja, no dudes en consultarla, ¡estamos para atenderte!',
- salesPersonName: 'Soy tu comercial y mi nombre es',
- salesPersonPhone: 'Teléfono y whatsapp',
- salesPersonEmail: 'Dirección de e-mail',
- },
- },
-};
diff --git a/print/templates/email/client-welcome/locale/es.yml b/print/templates/email/client-welcome/locale/es.yml
new file mode 100644
index 000000000..ac43a7cc6
--- /dev/null
+++ b/print/templates/email/client-welcome/locale/es.yml
@@ -0,0 +1,55 @@
+subject: Bienvenido a Verdnatura
+title: "¡Te damos la bienvenida!"
+dearClient: Estimado cliente
+clientData: 'Tus datos para poder comprar en la web de Verdnatura (https://www.verdnatura.es)
+ o en nuestras aplicaciones para iOS y Android (Ver tutorial de uso), son'
+clientId: Identificador de cliente
+user: Usuario
+password: Contraseña
+passwordResetText: Haz clic en '¿Has olvidado tu contraseña?'
+sections:
+ howToBuy:
+ title: Cómo hacer un pedido
+ description: 'Para realizar un pedido en nuestra web, debes configurarlo indicando:'
+ requeriments:
+ - Si quieres recibir el pedido (por agencia o por nuestro propio reparto) o si
+ lo prefieres recoger en alguno de nuestros almacenes.
+ - La fecha en la que quieres recibir el pedido (se preparará el día anterior).
+ - La dirección de entrega o el almacén donde quieres recoger el pedido.
+ stock: En nuestra web y aplicaciones puedes visualizar el stock disponible de
+ flor cortada, verdes, plantas, complementos y artificial. Ten en cuenta que
+ dicho stock puede variar en función de la fecha seleccionada al configurar el
+ pedido. Es importante CONFIRMAR los pedidos para que la mercancía quede reservada.
+ delivery: El reparto se realiza de lunes a sábado según la zona en la que te encuentres.
+ Por regla general, los pedidos que se entregan por agencia, deben estar confirmados
+ y pagados antes de las 17h del día en que se preparan (el día anterior a recibirlos),
+ aunque esto puede variar si el pedido se envía a través de nuestro reparto y
+ según la zona.
+ howToPay:
+ title: Cómo pagar
+ description: 'Las formas de pago admitidas en Verdnatura son:'
+ options:
+ - Con tarjeta a través de nuestra plataforma web (al confirmar
+ el pedido).
+ - Mediante giro bancario mensual, modalidad que hay que solicitar
+ y tramitar.
+ toConsider:
+ title: Cosas a tener en cuenta
+ description: Verdnatura vende EXCLUSIVAMENTE a profesionales, por lo que debes
+ remitirnos el Modelo 036 ó 037, para comprobar que está dado/a de alta en el
+ epígrafe correspondiente al comercio de flores.
+ claimsPolicy:
+ title: POLÍTICA DE RECLAMACIONES
+ description: Verdnatura aceptará las reclamaciones que se realicen dentro de los
+ dos días naturales siguientes a la recepción del pedido (incluyendo el mismo
+ día de la recepción). Pasado este plazo no se aceptará ninguna reclamación.
+help: Cualquier duda que te surja, no dudes en consultarla, ¡estamos para
+ atenderte!
+salesPersonName: Soy tu comercial y mi nombre es
+salesPersonPhone: Teléfono y whatsapp
+salesPersonEmail: Dirección de e-mail
diff --git a/print/templates/email/delivery-note/assets/css/email.css b/print/templates/email/delivery-note/assets/css/email.css
new file mode 100644
index 000000000..a2b129057
--- /dev/null
+++ b/print/templates/email/delivery-note/assets/css/email.css
@@ -0,0 +1,44 @@
+/**
+ * Email only stylesheet
+ *
+*/
+body {
+ background-color: #EEE
+}
+
+.container {
+ max-width: 600px;
+ min-width: 320px;
+ margin: 0 auto;
+ color: #555
+}
+
+.main {
+ background-color: #FFF;
+ padding: 20px
+}
+
+.main a {
+ color: #8dba25
+}
+
+.main h1 {
+ color: #999
+}
+
+.main h3 {
+ font-size: 16px
+}
+
+.title {
+ background-color: #95d831;
+ text-transform: uppercase;
+ text-align: center;
+ padding: 35px 0
+}
+
+.title h1 {
+ font-size: 32px;
+ color: #333;
+ margin: 0
+}
diff --git a/print/templates/email/delivery-note/assets/css/index.js b/print/templates/email/delivery-note/assets/css/index.js
deleted file mode 100644
index 321c632dc..000000000
--- a/print/templates/email/delivery-note/assets/css/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-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/templates/email/delivery-note/assets/css/layout.css b/print/templates/email/delivery-note/assets/css/layout.css
new file mode 100644
index 000000000..26b9bf8e0
--- /dev/null
+++ b/print/templates/email/delivery-note/assets/css/layout.css
@@ -0,0 +1,233 @@
+/**
+ * CSS layout elements
+ *
+*/
+.container {
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ font-size: 16px
+}
+
+.columns {
+ overflow: hidden
+}
+
+.columns .size100 {
+ width: 100%;
+ float: left
+}
+
+.columns .size75 {
+ width: 75%;
+ float: left
+}
+
+.columns .size50 {
+ width: 50%;
+ float: left
+}
+
+.columns .size33 {
+ width: 33.33%;
+ float: left
+}
+
+.columns .size25 {
+ width: 25%;
+ float: left
+}
+
+.clearfix {
+ overflow: hidden;
+ display: block;
+ clear: both
+}
+
+.panel {
+ position: relative;
+ margin-bottom: 15px;
+ padding-top: 10px;
+ break-inside: avoid;
+ break-before: always;
+ break-after: always;
+}
+
+.panel .header {
+ background-color: #FFF;
+ padding: 2.5px 10px;
+ position: absolute;
+ font-weight: bold;
+ top: 0px;
+ left: 17.5px;
+}
+
+.panel .body {
+ border: 1px solid #CCC;
+ overflow: hidden;
+ padding: 20px
+}
+
+.panel .body h3 {
+ margin-top: 0
+}
+
+.panel.dark .header {
+ border: 1px solid #808080;
+ background-color: #FFF;
+}
+
+.panel.dark .body {
+ border: 1px solid #808080;
+ background-color: #c0c0c0
+}
+
+.field {
+ border-bottom: 1px solid #CCC;
+ border-left: 1px solid #CCC;
+ border-top: 1px solid #CCC;
+ float: left
+}
+
+.field span {
+ border-right: 1px solid #CCC;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ font-weight: bold
+}
+
+.field.square span {
+ height: 35.4px;
+ width: 35.4px
+}
+
+.emptyField {
+ border-bottom: 1px dotted grey;
+ min-height: 1em;
+ display: block
+}
+
+.field.rectangle span {
+ height: 2em;
+ width: 8em
+}
+
+.pull-left {
+ float: left !important
+}
+
+.pull-right {
+ float: right !important
+}
+
+.vertical-text {
+ -moz-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ position: absolute;
+ text-align: center;
+ font-size: .65em;
+ right: -108px;
+ width: 200px;
+ top: 50%
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+.row-oriented, .column-oriented {
+ text-align: left;
+ width: 100%
+}
+
+.column-oriented {
+ margin-bottom: 15px
+}
+
+.column-oriented td,
+.column-oriented th {
+ padding: 5px 10px
+}
+
+.column-oriented thead {
+ background-color: #e5e5e5
+}
+
+.column-oriented thead tr {
+ border-bottom: 1px solid #808080;
+ border-top: 1px solid #808080;
+ background-color: #e5e5e5
+}
+
+.column-oriented tfoot {
+ border-top: 2px solid #808080;
+}
+
+.column-oriented tfoot tr:first-child td {
+ padding-top: 20px !important;
+}
+
+.column-oriented .description {
+ border-bottom: 1px solid #DDD;
+ font-size: 0.8em
+}
+
+.panel .row-oriented td, .panel .row-oriented th {
+ padding: 10px 0
+}
+
+.row-oriented > tbody > tr > td {
+ width: 30%
+}
+
+.row-oriented > tbody > tr > th {
+ padding-left: 30px;
+ width: 70%
+}
+
+.row-oriented .description {
+ padding: 0 !important;
+ font-size: 0.6em;
+ color: #888
+}
+
+.line {
+ border-bottom: 1px solid #DDD;
+ border-right: 1px solid #DDD;
+ border-left: 1px solid #DDD;
+ position: relative;
+ margin-left: -1px;
+ margin-right: 1px;
+ margin-top: 10px;
+ color: #999;
+ padding: 5px 0
+}
+
+.line .vertical-aligned {
+ position: absolute;
+ text-align: center;
+ width: 100%;
+
+}
+
+.line span {
+ background-color: #FFF;
+ padding: 5px
+}
+
+.signature {
+ width: 100%
+}
+
+.signature section {
+ height: 150px
+}
+
+.signature p {
+ margin-right: 50%;
+ margin-top: 140px
+}
diff --git a/print/templates/email/delivery-note/assets/css/misc.css b/print/templates/email/delivery-note/assets/css/misc.css
new file mode 100644
index 000000000..093d5a974
--- /dev/null
+++ b/print/templates/email/delivery-note/assets/css/misc.css
@@ -0,0 +1,47 @@
+/**
+ * CSS misc classes
+ *
+*/
+.uppercase {
+ text-transform: uppercase
+}
+
+.justified {
+ text-align: justify
+}
+
+.centered {
+ text-align: center
+}
+
+.align-right {
+ text-align: right
+}
+
+.align-left {
+ text-align: left
+}
+
+.number {
+ text-align: right
+}
+
+.font.gray {
+ color: #555
+}
+
+.font.light-gray {
+ color: #888
+}
+
+.font.small {
+ font-size: 0.65em
+}
+
+.font.bold {
+ font-weight: bold
+}
+
+.non-page-break {
+ page-break-inside: avoid;
+}
\ No newline at end of file
diff --git a/print/templates/email/delivery-note/attachments.json b/print/templates/email/delivery-note/attachments.json
new file mode 100644
index 000000000..d1d96d94a
--- /dev/null
+++ b/print/templates/email/delivery-note/attachments.json
@@ -0,0 +1,4 @@
+[{
+ "filename": "delivery-note.pdf",
+ "href": "http://localhost:5000/pi"
+}]
\ No newline at end of file
diff --git a/print/templates/email/delivery-note/index.html b/print/templates/email/delivery-note/delivery-note.html
similarity index 80%
rename from print/templates/email/delivery-note/index.html
rename to print/templates/email/delivery-note/delivery-note.html
index b85f8fab0..683a02271 100644
--- a/print/templates/email/delivery-note/index.html
+++ b/print/templates/email/delivery-note/delivery-note.html
@@ -6,7 +6,7 @@
diff --git a/print/templates/email/delivery-note/index.js b/print/templates/email/delivery-note/delivery-note.js
similarity index 69%
rename from print/templates/email/delivery-note/index.js
rename to print/templates/email/delivery-note/delivery-note.js
index 550e58bbb..aa1430657 100755
--- a/print/templates/email/delivery-note/index.js
+++ b/print/templates/email/delivery-note/delivery-note.js
@@ -1,6 +1,7 @@
-const database = require(`${appPath}/lib/database`);
-const reportEngine = require(`${appPath}/lib/reportEngine.js`);
-const UserException = require(`${appPath}/lib/exceptions/userException`);
+const db = require(`${appPath}/lib/database`);
+const Component = require(`${appPath}/lib/component`);
+const emailHeader = new Component('email-header');
+const emailFooter = new Component('email-footer');
module.exports = {
name: 'delivery-note',
@@ -27,12 +28,11 @@ module.exports = {
});
},
created() {
- if (this.locale)
- this.$i18n.locale = this.locale;
+ this.locale = 'es';
},
methods: {
- fetchTicket(ticketFk) {
- return database.pool.query(`
+ fetchTicket(ticketId) {
+ return db.findOne(`
SELECT
t.id,
u.lang locale,
@@ -40,11 +40,12 @@ module.exports = {
FROM ticket t
JOIN client c ON c.id = t.clientFk
JOIN account.user u ON u.id = c.id
- WHERE t.id = ?`, [ticketFk]);
+ WHERE t.id = ?`, [ticketId]);
},
},
components: {
- 'email-header': require('../email-header'),
- 'email-footer': require('../email-footer'),
+ 'email-header': emailHeader.build(),
+ 'email-footer': emailFooter.build()
},
+ props: ['ticketId', 'isPreview']
};
diff --git a/print/templates/email/delivery-note/locale.js b/print/templates/email/delivery-note/locale.js
deleted file mode 100644
index 0ddde5fc7..000000000
--- a/print/templates/email/delivery-note/locale.js
+++ /dev/null
@@ -1,11 +0,0 @@
-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/templates/email/delivery-note/locale/es.yml b/print/templates/email/delivery-note/locale/es.yml
new file mode 100644
index 000000000..cdc63e8eb
--- /dev/null
+++ b/print/templates/email/delivery-note/locale/es.yml
@@ -0,0 +1,6 @@
+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!
\ No newline at end of file
diff --git a/print/templates/email/email-footer/assets/css/index.js b/print/templates/email/email-footer/assets/css/index.js
deleted file mode 100644
index c321a3fe7..000000000
--- a/print/templates/email/email-footer/assets/css/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const CssReader = require(`${appPath}/lib/cssReader`);
-
-module.exports = new CssReader([`${__dirname}/style.css`])
- .mergeStyles();
diff --git a/print/templates/email/email-footer/index.js b/print/templates/email/email-footer/index.js
deleted file mode 100755
index 22321dd7d..000000000
--- a/print/templates/email/email-footer/index.js
+++ /dev/null
@@ -1,34 +0,0 @@
-module.exports = {
- name: 'email-footer',
- asyncData(ctx) {
- return {
- isPreview: ctx.method === 'GET',
- };
- },
- created() {
- if (this.locale)
- this.$i18n.locale = this.locale;
-
- const embeded = [];
- this.files.map(file => {
- const src = this.isPreview ? `/api/${file}` : `cid:${file}`;
- embeded[file] = src;
- });
- this.embeded = embeded;
- },
- data() {
- return {
- files: [
- /* '/assets/images/action.png',
- '/assets/images/info.png', */
- '/assets/images/facebook.png',
- '/assets/images/twitter.png',
- '/assets/images/youtube.png',
- '/assets/images/pinterest.png',
- '/assets/images/instagram.png',
- '/assets/images/linkedin.png',
- ],
- };
- },
- props: ['locale']
-};
diff --git a/print/templates/email/email-footer/locale.js b/print/templates/email/email-footer/locale.js
deleted file mode 100644
index 7e8aa401d..000000000
--- a/print/templates/email/email-footer/locale.js
+++ /dev/null
@@ -1,42 +0,0 @@
-module.exports = {
- messages: {
- es: {
- buttons: {
- webAcccess: 'Visita nuestra Web',
- info: 'Ayúdanos a mejorar',
- },
- privacy: {
- fiscalAddress: 'VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es',
- disclaimer: `- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado
- exclusivamente por la persona destinataria del mismo. Si has recibido este mensaje
- por error, te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier documento
- adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a
- ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace
- responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.`,
- law: `En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal,
- te comunicamos que los datos personales que facilites se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L.,
- pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por
- escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`,
- },
- },
- /* fr: {
- buttons: {
- webAcccess: 'Visitez notre site web',
- info: 'Ayúdanos a mejorar',
- },
- privacy: {
- fiscalAddress: 'VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es',
- disclaimer: `- AVISO - Ce message est privé et confidentiel et doit être utilisé.
- exclusivamente por la persona destinataria del mismo. Si has recibido este mensaje
- por error, te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier documento
- adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a
- ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace
- responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.`,
- law: `En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal,
- te comunicamos que los datos personales que facilites se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L.,
- pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por
- escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`,
- },
- }, */
- },
-};
diff --git a/print/templates/email/email-header/assets/css/index.js b/print/templates/email/email-header/assets/css/index.js
deleted file mode 100644
index c321a3fe7..000000000
--- a/print/templates/email/email-header/assets/css/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const CssReader = require(`${appPath}/lib/cssReader`);
-
-module.exports = new CssReader([`${__dirname}/style.css`])
- .mergeStyles();
diff --git a/print/templates/email/email-header/index.html b/print/templates/email/email-header/index.html
deleted file mode 100644
index a8f5f2d74..000000000
--- a/print/templates/email/email-header/index.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/print/templates/email/email-header/index.js b/print/templates/email/email-header/index.js
deleted file mode 100755
index e92d2fa64..000000000
--- a/print/templates/email/email-header/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-module.exports = {
- name: 'email-header',
- asyncData(ctx) {
- return {
- isPreview: ctx.method === 'GET',
- };
- },
- created() {
- const embeded = [];
- this.files.map(file => {
- const src = this.isPreview ? `/api/${file}` : `cid:${file}`;
- embeded[file] = src;
- });
- this.embeded = embeded;
- },
-
- data() {
- return {
- files: ['/assets/images/email-logo.png'],
- };
- },
-};
diff --git a/print/templates/email/email-header/locale.js b/print/templates/email/email-header/locale.js
deleted file mode 100644
index 7200e6048..000000000
--- a/print/templates/email/email-header/locale.js
+++ /dev/null
@@ -1,5 +0,0 @@
-module.exports = {
- messages: {
- es: {},
- },
-};
diff --git a/print/templates/email/printer-setup/assets/css/email.css b/print/templates/email/printer-setup/assets/css/email.css
new file mode 100644
index 000000000..a2b129057
--- /dev/null
+++ b/print/templates/email/printer-setup/assets/css/email.css
@@ -0,0 +1,44 @@
+/**
+ * Email only stylesheet
+ *
+*/
+body {
+ background-color: #EEE
+}
+
+.container {
+ max-width: 600px;
+ min-width: 320px;
+ margin: 0 auto;
+ color: #555
+}
+
+.main {
+ background-color: #FFF;
+ padding: 20px
+}
+
+.main a {
+ color: #8dba25
+}
+
+.main h1 {
+ color: #999
+}
+
+.main h3 {
+ font-size: 16px
+}
+
+.title {
+ background-color: #95d831;
+ text-transform: uppercase;
+ text-align: center;
+ padding: 35px 0
+}
+
+.title h1 {
+ font-size: 32px;
+ color: #333;
+ margin: 0
+}
diff --git a/print/templates/email/printer-setup/assets/css/index.js b/print/templates/email/printer-setup/assets/css/index.js
deleted file mode 100644
index 321c632dc..000000000
--- a/print/templates/email/printer-setup/assets/css/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-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/templates/email/printer-setup/assets/css/layout.css b/print/templates/email/printer-setup/assets/css/layout.css
new file mode 100644
index 000000000..26b9bf8e0
--- /dev/null
+++ b/print/templates/email/printer-setup/assets/css/layout.css
@@ -0,0 +1,233 @@
+/**
+ * CSS layout elements
+ *
+*/
+.container {
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ font-size: 16px
+}
+
+.columns {
+ overflow: hidden
+}
+
+.columns .size100 {
+ width: 100%;
+ float: left
+}
+
+.columns .size75 {
+ width: 75%;
+ float: left
+}
+
+.columns .size50 {
+ width: 50%;
+ float: left
+}
+
+.columns .size33 {
+ width: 33.33%;
+ float: left
+}
+
+.columns .size25 {
+ width: 25%;
+ float: left
+}
+
+.clearfix {
+ overflow: hidden;
+ display: block;
+ clear: both
+}
+
+.panel {
+ position: relative;
+ margin-bottom: 15px;
+ padding-top: 10px;
+ break-inside: avoid;
+ break-before: always;
+ break-after: always;
+}
+
+.panel .header {
+ background-color: #FFF;
+ padding: 2.5px 10px;
+ position: absolute;
+ font-weight: bold;
+ top: 0px;
+ left: 17.5px;
+}
+
+.panel .body {
+ border: 1px solid #CCC;
+ overflow: hidden;
+ padding: 20px
+}
+
+.panel .body h3 {
+ margin-top: 0
+}
+
+.panel.dark .header {
+ border: 1px solid #808080;
+ background-color: #FFF;
+}
+
+.panel.dark .body {
+ border: 1px solid #808080;
+ background-color: #c0c0c0
+}
+
+.field {
+ border-bottom: 1px solid #CCC;
+ border-left: 1px solid #CCC;
+ border-top: 1px solid #CCC;
+ float: left
+}
+
+.field span {
+ border-right: 1px solid #CCC;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ font-weight: bold
+}
+
+.field.square span {
+ height: 35.4px;
+ width: 35.4px
+}
+
+.emptyField {
+ border-bottom: 1px dotted grey;
+ min-height: 1em;
+ display: block
+}
+
+.field.rectangle span {
+ height: 2em;
+ width: 8em
+}
+
+.pull-left {
+ float: left !important
+}
+
+.pull-right {
+ float: right !important
+}
+
+.vertical-text {
+ -moz-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ position: absolute;
+ text-align: center;
+ font-size: .65em;
+ right: -108px;
+ width: 200px;
+ top: 50%
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+.row-oriented, .column-oriented {
+ text-align: left;
+ width: 100%
+}
+
+.column-oriented {
+ margin-bottom: 15px
+}
+
+.column-oriented td,
+.column-oriented th {
+ padding: 5px 10px
+}
+
+.column-oriented thead {
+ background-color: #e5e5e5
+}
+
+.column-oriented thead tr {
+ border-bottom: 1px solid #808080;
+ border-top: 1px solid #808080;
+ background-color: #e5e5e5
+}
+
+.column-oriented tfoot {
+ border-top: 2px solid #808080;
+}
+
+.column-oriented tfoot tr:first-child td {
+ padding-top: 20px !important;
+}
+
+.column-oriented .description {
+ border-bottom: 1px solid #DDD;
+ font-size: 0.8em
+}
+
+.panel .row-oriented td, .panel .row-oriented th {
+ padding: 10px 0
+}
+
+.row-oriented > tbody > tr > td {
+ width: 30%
+}
+
+.row-oriented > tbody > tr > th {
+ padding-left: 30px;
+ width: 70%
+}
+
+.row-oriented .description {
+ padding: 0 !important;
+ font-size: 0.6em;
+ color: #888
+}
+
+.line {
+ border-bottom: 1px solid #DDD;
+ border-right: 1px solid #DDD;
+ border-left: 1px solid #DDD;
+ position: relative;
+ margin-left: -1px;
+ margin-right: 1px;
+ margin-top: 10px;
+ color: #999;
+ padding: 5px 0
+}
+
+.line .vertical-aligned {
+ position: absolute;
+ text-align: center;
+ width: 100%;
+
+}
+
+.line span {
+ background-color: #FFF;
+ padding: 5px
+}
+
+.signature {
+ width: 100%
+}
+
+.signature section {
+ height: 150px
+}
+
+.signature p {
+ margin-right: 50%;
+ margin-top: 140px
+}
diff --git a/print/templates/email/printer-setup/assets/css/misc.css b/print/templates/email/printer-setup/assets/css/misc.css
new file mode 100644
index 000000000..093d5a974
--- /dev/null
+++ b/print/templates/email/printer-setup/assets/css/misc.css
@@ -0,0 +1,47 @@
+/**
+ * CSS misc classes
+ *
+*/
+.uppercase {
+ text-transform: uppercase
+}
+
+.justified {
+ text-align: justify
+}
+
+.centered {
+ text-align: center
+}
+
+.align-right {
+ text-align: right
+}
+
+.align-left {
+ text-align: left
+}
+
+.number {
+ text-align: right
+}
+
+.font.gray {
+ color: #555
+}
+
+.font.light-gray {
+ color: #888
+}
+
+.font.small {
+ font-size: 0.65em
+}
+
+.font.bold {
+ font-weight: bold
+}
+
+.non-page-break {
+ page-break-inside: avoid;
+}
\ No newline at end of file
diff --git a/print/templates/email/printer-setup/attachments.json b/print/templates/email/printer-setup/attachments.json
new file mode 100644
index 000000000..cdc147f79
--- /dev/null
+++ b/print/templates/email/printer-setup/attachments.json
@@ -0,0 +1,10 @@
+[{
+ "filename": "model.ezp",
+ "path": "/assets/files/model.ezp",
+ "cid": "model.ezp"
+},
+{
+ "filename": "port.png",
+ "path": "/assets/files/port.png",
+ "cid": "port.png"
+}]
\ No newline at end of file
diff --git a/print/templates/email/printer-setup/index.js b/print/templates/email/printer-setup/index.js
deleted file mode 100755
index 1353d996c..000000000
--- a/print/templates/email/printer-setup/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-const database = require(`${appPath}/lib/database`);
-const UserException = require(`${appPath}/lib/exceptions/userException`);
-
-module.exports = {
- name: 'printer-setup',
- async asyncData(ctx, params) {
- const data = {
- isPreview: ctx.method === 'GET',
- };
-
- if (!params.clientFk)
- throw new UserException('No client id specified');
-
- return this.methods.fetchClient(params.clientFk)
- .then(([result]) => {
- if (!result)
- throw new UserException('No client data found');
- return Object.assign(data, result[0]);
- });
- },
- created() {
- if (this.locale)
- this.$i18n.locale = this.locale;
- },
- data() {
- return {
- files: [
- '/assets/files/model.ezp',
- '/assets/files/port.png'
- ],
- };
- },
- methods: {
- fetchClient(clientFk) {
- return database.pool.query(`
- SELECT
- c.id,
- u.lang locale,
- u.name AS userName,
- c.email recipient,
- 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 = ?`, [clientFk]);
- },
- },
- components: {
- 'email-header': require('../email-header'),
- 'email-footer': require('../email-footer'),
- },
-};
diff --git a/print/templates/email/printer-setup/locale.js b/print/templates/email/printer-setup/locale.js
deleted file mode 100644
index dc95c931a..000000000
--- a/print/templates/email/printer-setup/locale.js
+++ /dev/null
@@ -1,59 +0,0 @@
-module.exports = {
- messages: {
- es: {
- subject: 'Instalación y configuración de impresora',
- title: '¡Gracias por tu confianza!',
- description: {
- dear: 'Estimado cliente',
- instructions: 'Sigue las instrucciones especificadas en este correo para llevar a cabo la instalación de la impresora.',
- followGuide: `Puedes utilizar como guía, el vídeo del montaje del ribon y la cinta
- https://www.youtube.com/watch?v=qhb0kgQF3o8.
- También necesitarás el QLabel, el programa para imprimir las cintas.`,
- downloadFrom: `Puedes descargarlo desde este enlace
- https://godex.s3-accelerate.amazonaws.com/gGnOPoojkP6vC1lgmrbEqQ.file?v01`,
- },
- sections: {
- QLabel: {
- title: 'Utilización de QLabel',
- description: 'Para utilizar el programa de impresión de cintas sigue estos pasos',
- steps: [
- 'Abre el programa QLabel',
- 'Haz clic en el icono de la barra superior con forma de "carpeta"',
- 'Selecciona el archivo llamado "model.ezp" adjunto en este correo, y haz clic en abrir',
- 'Ve a "File" -> "Save as" y guárdalo en el escritorio con otro nombre',
- 'Cierra el Qlabel y abre el archivo que acabamos de guardar',
- 'Haz clic encima del texto con el botón secundario del ratón',
- 'Elige la primera opción "setup"',
- 'Cambia el texto para imprimir',
- 'Haz clic en el botón "Ok"',
- 'Desplázate con el ratón para ver la medida máxima que ocupa el texto',
- 'Haz clic encima del texto con el botón secundario del ratón',
- 'Elige la segunda opción "Setup printer"',
- 'Haz clic en la primera pestaña "Label Setup"',
- 'Modifica la propiedad "Paper Height" con la medida máxima consultada anteriormente',
- `Comprueba el puerto de la impresora, botón de de la derecha
- "SETUP PRINTER" y en la parte derecha, igual como la imagen
- que adjuntamos, seleccionar la que ponga "USB00x: GODEX"`,
- 'Haz clic en el botón "Ok"',
- 'Haz clic sobre el icono de la impresora',
- 'Haz clic en "Print"',
- ],
- },
- help: {
- title: '¿Necesitas ayuda?',
- description: `Si necesitas ayuda, descárgate nuestro programa de soporte para poder conectarnos
- remotamente a tu equipo y hacerte la instalación. Proporciónanos un horario de contacto para atenderte, y contactaremos contigo.`,
- remoteSupport: `Puedes descargarte el programa desde este enlace
- http://soporte.verdnatura.es.`,
- },
- },
- help: 'Cualquier duda que te surja, no dudes en consultarla, ¡estamos para atenderte!',
- salesPersonName: 'Soy tu comercial y mi nombre es',
- salesPersonPhone: 'Teléfono y whatsapp',
- salesPersonEmail: 'Dirección de e-mail',
- },
- },
-};
-
-
diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml
new file mode 100644
index 000000000..39568bd1b
--- /dev/null
+++ b/print/templates/email/printer-setup/locale/es.yml
@@ -0,0 +1,50 @@
+subject: Instalación y configuración de impresora
+title: "¡Gracias por tu confianza!"
+description:
+ dear: Estimado cliente
+ instructions: Sigue las instrucciones especificadas en este correo para llevar a
+ cabo la instalación de la impresora.
+ followGuide: Puedes utilizar como guía, el vídeo del montaje del ribon y la cinta
+ https://www.youtube.com/watch?v=qhb0kgQF3o8. También
+ necesitarás el QLabel, el programa para imprimir las cintas.
+ downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/gGnOPoojkP6vC1lgmrbEqQ.file?v01
+sections:
+ QLabel:
+ title: Utilización de QLabel
+ description: Para utilizar el programa de impresión de cintas sigue estos pasos
+ steps:
+ - Abre el programa QLabel
+ - Haz clic en el icono de la barra superior con forma de 'carpeta'
+ - Selecciona el archivo llamado 'model.ezp' adjunto en este correo, y haz clic
+ en abrir
+ - Ve a 'File' -> 'Save as' y guárdalo en el escritorio con otro nombre
+ - Cierra el Qlabel y abre el archivo que acabamos de guardar
+ - Haz clic encima del texto con el botón secundario del ratón
+ - Elige la primera opción 'setup'
+ - Cambia el texto para imprimir
+ - Haz clic en el botón 'Ok'
+ - Desplázate con el ratón para ver la medida máxima que ocupa el texto
+ - Haz clic encima del texto con el botón secundario del ratón
+ - Elige la segunda opción 'Setup printer'
+ - Haz clic en la primera pestaña 'Label Setup'
+ - Modifica la propiedad 'Paper Height' con la medida máxima consultada anteriormente
+ - 'Comprueba el puerto de la impresora, botón de de la derecha ''SETUP PRINTER''
+ y en la parte derecha, igual como la imagen que adjuntamos, seleccionar la que
+ ponga ''USB00x: GODEX'''
+ - Haz clic en el botón 'Ok'
+ - Haz clic sobre el icono de la impresora
+ - Haz clic en 'Print'
+ help:
+ title: "¿Necesitas ayuda?"
+ description: Si necesitas ayuda, descárgate nuestro programa de soporte para poder
+ conectarnos remotamente a tu equipo y hacerte la instalación. Proporciónanos
+ un horario de contacto para atenderte, y contactaremos contigo.
+ remoteSupport: Puedes descargarte el programa desde este enlace http://soporte.verdnatura.es.
+help: Cualquier duda que te surja, no dudes en consultarla, ¡estamos para
+ atenderte!
+salesPersonName: Soy tu comercial y mi nombre es
+salesPersonPhone: Teléfono y whatsapp
+salesPersonEmail: Dirección de e-mail
\ No newline at end of file
diff --git a/print/templates/email/printer-setup/options.json b/print/templates/email/printer-setup/options.json
new file mode 100644
index 000000000..e69de29bb
diff --git a/print/templates/email/printer-setup/index.html b/print/templates/email/printer-setup/printer-setup.html
similarity index 70%
rename from print/templates/email/printer-setup/index.html
rename to print/templates/email/printer-setup/printer-setup.html
index 0b62f5919..44f5e344a 100644
--- a/print/templates/email/printer-setup/index.html
+++ b/print/templates/email/printer-setup/printer-setup.html
@@ -6,7 +6,7 @@
-
+
@@ -35,20 +35,20 @@
-
- {{$t('salesPersonName')}}: {{salesPersonName}}
+
+ {{$t('salesPersonName')}}: {{client.salesPersonName}}
-
- {{$t('salesPersonPhone')}}: {{salesPersonPhone}}
+
+ {{$t('salesPersonPhone')}}: {{client.salesPersonPhone}}
-
-
+
diff --git a/print/templates/email/printer-setup/printer-setup.js b/print/templates/email/printer-setup/printer-setup.js
new file mode 100755
index 000000000..6fa412301
--- /dev/null
+++ b/print/templates/email/printer-setup/printer-setup.js
@@ -0,0 +1,38 @@
+const db = require(`${appPath}/lib/database`);
+const Component = require(`${appPath}/lib/component`);
+const emailHeader = new Component('email-header');
+const emailFooter = new Component('email-footer');
+
+module.exports = {
+ name: 'printer-setup',
+ async serverPrefetch() {
+ this.client = await this.fetchClient(this.clientId);
+ },
+ created() {
+ /* if (this.locale)
+ this.$i18n.locale = this.locale; */
+ },
+ methods: {
+ fetchClient(clientId) {
+ return db.findOne(`
+ SELECT
+ c.id,
+ u.lang locale,
+ u.name AS userName,
+ c.email recipient,
+ 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 = ?`, [clientId]);
+ },
+ },
+ components: {
+ 'email-header': emailHeader.build(),
+ 'email-footer': emailFooter.build()
+ },
+ props: ['clientId', 'isPreview']
+};
diff --git a/print/templates/reports/claim-pickup-order/assets/css/layout.css b/print/templates/reports/claim-pickup-order/assets/css/layout.css
new file mode 100644
index 000000000..26b9bf8e0
--- /dev/null
+++ b/print/templates/reports/claim-pickup-order/assets/css/layout.css
@@ -0,0 +1,233 @@
+/**
+ * CSS layout elements
+ *
+*/
+.container {
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ font-size: 16px
+}
+
+.columns {
+ overflow: hidden
+}
+
+.columns .size100 {
+ width: 100%;
+ float: left
+}
+
+.columns .size75 {
+ width: 75%;
+ float: left
+}
+
+.columns .size50 {
+ width: 50%;
+ float: left
+}
+
+.columns .size33 {
+ width: 33.33%;
+ float: left
+}
+
+.columns .size25 {
+ width: 25%;
+ float: left
+}
+
+.clearfix {
+ overflow: hidden;
+ display: block;
+ clear: both
+}
+
+.panel {
+ position: relative;
+ margin-bottom: 15px;
+ padding-top: 10px;
+ break-inside: avoid;
+ break-before: always;
+ break-after: always;
+}
+
+.panel .header {
+ background-color: #FFF;
+ padding: 2.5px 10px;
+ position: absolute;
+ font-weight: bold;
+ top: 0px;
+ left: 17.5px;
+}
+
+.panel .body {
+ border: 1px solid #CCC;
+ overflow: hidden;
+ padding: 20px
+}
+
+.panel .body h3 {
+ margin-top: 0
+}
+
+.panel.dark .header {
+ border: 1px solid #808080;
+ background-color: #FFF;
+}
+
+.panel.dark .body {
+ border: 1px solid #808080;
+ background-color: #c0c0c0
+}
+
+.field {
+ border-bottom: 1px solid #CCC;
+ border-left: 1px solid #CCC;
+ border-top: 1px solid #CCC;
+ float: left
+}
+
+.field span {
+ border-right: 1px solid #CCC;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ font-weight: bold
+}
+
+.field.square span {
+ height: 35.4px;
+ width: 35.4px
+}
+
+.emptyField {
+ border-bottom: 1px dotted grey;
+ min-height: 1em;
+ display: block
+}
+
+.field.rectangle span {
+ height: 2em;
+ width: 8em
+}
+
+.pull-left {
+ float: left !important
+}
+
+.pull-right {
+ float: right !important
+}
+
+.vertical-text {
+ -moz-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ position: absolute;
+ text-align: center;
+ font-size: .65em;
+ right: -108px;
+ width: 200px;
+ top: 50%
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+.row-oriented, .column-oriented {
+ text-align: left;
+ width: 100%
+}
+
+.column-oriented {
+ margin-bottom: 15px
+}
+
+.column-oriented td,
+.column-oriented th {
+ padding: 5px 10px
+}
+
+.column-oriented thead {
+ background-color: #e5e5e5
+}
+
+.column-oriented thead tr {
+ border-bottom: 1px solid #808080;
+ border-top: 1px solid #808080;
+ background-color: #e5e5e5
+}
+
+.column-oriented tfoot {
+ border-top: 2px solid #808080;
+}
+
+.column-oriented tfoot tr:first-child td {
+ padding-top: 20px !important;
+}
+
+.column-oriented .description {
+ border-bottom: 1px solid #DDD;
+ font-size: 0.8em
+}
+
+.panel .row-oriented td, .panel .row-oriented th {
+ padding: 10px 0
+}
+
+.row-oriented > tbody > tr > td {
+ width: 30%
+}
+
+.row-oriented > tbody > tr > th {
+ padding-left: 30px;
+ width: 70%
+}
+
+.row-oriented .description {
+ padding: 0 !important;
+ font-size: 0.6em;
+ color: #888
+}
+
+.line {
+ border-bottom: 1px solid #DDD;
+ border-right: 1px solid #DDD;
+ border-left: 1px solid #DDD;
+ position: relative;
+ margin-left: -1px;
+ margin-right: 1px;
+ margin-top: 10px;
+ color: #999;
+ padding: 5px 0
+}
+
+.line .vertical-aligned {
+ position: absolute;
+ text-align: center;
+ width: 100%;
+
+}
+
+.line span {
+ background-color: #FFF;
+ padding: 5px
+}
+
+.signature {
+ width: 100%
+}
+
+.signature section {
+ height: 150px
+}
+
+.signature p {
+ margin-right: 50%;
+ margin-top: 140px
+}
diff --git a/print/templates/reports/claim-pickup-order/assets/css/misc.css b/print/templates/reports/claim-pickup-order/assets/css/misc.css
new file mode 100644
index 000000000..093d5a974
--- /dev/null
+++ b/print/templates/reports/claim-pickup-order/assets/css/misc.css
@@ -0,0 +1,47 @@
+/**
+ * CSS misc classes
+ *
+*/
+.uppercase {
+ text-transform: uppercase
+}
+
+.justified {
+ text-align: justify
+}
+
+.centered {
+ text-align: center
+}
+
+.align-right {
+ text-align: right
+}
+
+.align-left {
+ text-align: left
+}
+
+.number {
+ text-align: right
+}
+
+.font.gray {
+ color: #555
+}
+
+.font.light-gray {
+ color: #888
+}
+
+.font.small {
+ font-size: 0.65em
+}
+
+.font.bold {
+ font-weight: bold
+}
+
+.non-page-break {
+ page-break-inside: avoid;
+}
\ No newline at end of file
diff --git a/print/templates/reports/claim-pickup-order/assets/css/report.css b/print/templates/reports/claim-pickup-order/assets/css/report.css
new file mode 100644
index 000000000..e1105957b
--- /dev/null
+++ b/print/templates/reports/claim-pickup-order/assets/css/report.css
@@ -0,0 +1,14 @@
+/**
+ * Report only stylesheet
+ *
+*/
+body {
+ zoom: 0.55
+}
+
+.title {
+ margin-bottom: 20px;
+ font-weight: 100;
+ margin-top: 0;
+ font-size: 2em
+}
\ No newline at end of file
diff --git a/print/templates/reports/rpt-claim-pickup-order/assets/css/style.css b/print/templates/reports/claim-pickup-order/assets/css/style.css
similarity index 100%
rename from print/templates/reports/rpt-claim-pickup-order/assets/css/style.css
rename to print/templates/reports/claim-pickup-order/assets/css/style.css
diff --git a/print/templates/reports/rpt-claim-pickup-order/index.html b/print/templates/reports/claim-pickup-order/claim-pickup-order.html
similarity index 96%
rename from print/templates/reports/rpt-claim-pickup-order/index.html
rename to print/templates/reports/claim-pickup-order/claim-pickup-order.html
index b5c571a5c..6f96718b2 100644
--- a/print/templates/reports/rpt-claim-pickup-order/index.html
+++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.html
@@ -3,7 +3,7 @@
-
+
{{$t('payed', [
+ 'Silla',
+ receipt.payed.getDate(),
+ $t('months')[receipt.payed.getMonth()],
+ receipt.payed.getFullYear()])
+ }}
diff --git a/print/templates/reports/receipt/index.js b/print/templates/reports/receipt/receipt.js
similarity index 82%
rename from print/templates/reports/receipt/index.js
rename to print/templates/reports/receipt/receipt.js
index 93fdad6d5..09f5d5b5d 100755
--- a/print/templates/reports/receipt/index.js
+++ b/print/templates/reports/receipt/receipt.js
@@ -1,6 +1,8 @@
const strftime = require('strftime');
const db = require(`${appPath}/lib/database`);
-const UserException = require(`${appPath}/lib/exceptions/userException`);
+const Component = require(`${appPath}/lib/component`);
+const reportHeader = new Component('report-header');
+const reportFooter = new Component('report-footer');
module.exports = {
name: 'receipt',
@@ -46,11 +48,14 @@ module.exports = {
FROM receipt r
JOIN client c ON c.id = r.clientFk
WHERE r.id = ?`, [receiptId]);
- }
- /* dated: () => {
+ },
+ dated: () => {
return strftime('%d-%m-%Y', new Date());
- }, */
+ },
+ },
+ components: {
+ 'report-header': reportHeader.build(),
+ 'report-footer': reportFooter.build()
},
- template: '{{client}}
',
props: ['userId', 'receiptId']
};
diff --git a/print/templates/reports/report-footer/assets/css/index.js b/print/templates/reports/report-footer/assets/css/index.js
deleted file mode 100644
index c44219258..000000000
--- a/print/templates/reports/report-footer/assets/css/index.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const CssReader = require(`${appPath}/lib/cssReader`);
-
-module.exports = new CssReader([
- `${__dirname}/style.css`,
- `${appPath}/common/css/misc.css`])
- .mergeStyles();
diff --git a/print/templates/reports/report-footer/locale.js b/print/templates/reports/report-footer/locale.js
deleted file mode 100644
index bf564c731..000000000
--- a/print/templates/reports/report-footer/locale.js
+++ /dev/null
@@ -1,32 +0,0 @@
-module.exports = {
- messages: {
- es: {
- numPages: 'Página {{page}} de {{pages}}',
- law: {
- phytosanitary: 'VERDNATURA LEVANTE SL - Pasaporte Fitosanitario R.P. Generalitat Valenciana - Nº Comerciante: ES17462130',
- privacy: `En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal,
- le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L.,
- pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo
- por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`,
- }
- },
- fr: {
- numPages: 'Page {{page}} de {{pages}}',
- law: {
- phytosanitary: `VERDNATURA LEVANTE SL - Passeport Phytosanitaire R.P. Generalitat Valenciana - Numéro d'opérateur: ES17462130`,
- privacy: `Conformément aux dispositions de la loi organique 15/1999 sur la protection des données personnelles, nous vous informons que les données personnelles que vous fournissez seront incluses dans des dossiers.
- VERDNATURA LEVANTE S.L., vous pouvez à tout moment, exercer les droits d'accès, de rectification, d'annulation et d'opposition, en communiquant par écrit au siège social de la société. Le dossier a pour objet la gestion administrative, la comptabilité et la facturation.`,
- }
- },
- pt: {
- numPages: 'Página {{page}} de {{pages}}',
- law: {
- phytosanitary: 'VERDNATURA LEVANTE S.L - Passaporte Fitossanitário R.P. Generalitat Valenciana - Nº Comerciante: ES17462130',
- privacy: `Em cumprimento do disposto na lei Orgânica 15/1999, de Protecção de Dados de Carácter Pessoal, comunicamos que os
- dados pessoais que facilite se incluirão nos ficheiros automatizados de VERDNATURA LEVANTE S.L., podendo em todo momento
- exercer os direitos de acesso, rectificação, cancelação e oposição, comunicando por escrito ao domicílio social da entidade.
- A finalidade do ficheiro é a gestão administrativa, contabilidade e facturação.`,
- }
- },
- },
-};
diff --git a/print/templates/reports/report-header/assets/css/index.js b/print/templates/reports/report-header/assets/css/index.js
deleted file mode 100644
index c321a3fe7..000000000
--- a/print/templates/reports/report-header/assets/css/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const CssReader = require(`${appPath}/lib/cssReader`);
-
-module.exports = new CssReader([`${__dirname}/style.css`])
- .mergeStyles();
diff --git a/print/templates/reports/report-header/locale.js b/print/templates/reports/report-header/locale.js
deleted file mode 100644
index 7b3b9f38e..000000000
--- a/print/templates/reports/report-header/locale.js
+++ /dev/null
@@ -1,16 +0,0 @@
-module.exports = {
- messages: {
- es: {
- company: {
- fiscalAddress: 'VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es',
- registry: `CIF: B97367486 Registro Mercantil de Valencia, Tomo 8041, Libro 5334, Folio 160, sección 8, Hoja V 102076`,
- }
- },
- pt: {
- company: {
- fiscalAddress: 'VERDNATURA LEVANTE S.L., B97367486 Avda. Espioca, 100, 46460 Silla - www.verdnatura.es - clientes@verdnatura.es',
- registry: `CIF: B97367486 Registro Mercantil de Valencia, Tomo 8041, Libro 5334, Folio 160, Sección 8, Hoja V 102076`,
- }
- },
- },
-};
diff --git a/print/templates/reports/rpt-claim-pickup-order/assets/css/index.js b/print/templates/reports/rpt-claim-pickup-order/assets/css/index.js
deleted file mode 100644
index 515dea750..000000000
--- a/print/templates/reports/rpt-claim-pickup-order/assets/css/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const CssReader = require(`${appPath}/lib/cssReader`);
-
-module.exports = new CssReader([
- `${appPath}/common/css/layout.css`,
- `${appPath}/common/css/report.css`,
- `${appPath}/common/css/misc.css`,
- `${__dirname}/style.css`])
- .mergeStyles();
diff --git a/print/templates/reports/rpt-claim-pickup-order/locale.js b/print/templates/reports/rpt-claim-pickup-order/locale.js
deleted file mode 100644
index e15bd28c1..000000000
--- a/print/templates/reports/rpt-claim-pickup-order/locale.js
+++ /dev/null
@@ -1,23 +0,0 @@
-module.exports = {
- messages: {
- es: {
- title: 'Ord. recogida',
- claimId: 'Reclamación',
- clientId: 'Cliente',
- date: 'Fecha',
- clientData: 'Dirección de recogida',
- quantity: 'Cantidad',
- claims: 'Reclama',
- reference: 'Referencia',
- concept: 'Concepto',
- clientSignature: 'Firma del cliente',
- claim: 'Reclamación {0}',
- sections: {
- agency: {
- description: `Para agilizar tu recogida, por favor, pónte en contacto con la oficina de integrados.
- Tlf: 96 166 77 88 - Ana Gómez (Ext. 2133) (agomezf@integra2.es) `
- }
- }
- },
- },
-};
diff --git a/print/templates/reports/rpt-delivery-note/assets/css/index.js b/print/templates/reports/rpt-delivery-note/assets/css/index.js
deleted file mode 100644
index 515dea750..000000000
--- a/print/templates/reports/rpt-delivery-note/assets/css/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const CssReader = require(`${appPath}/lib/cssReader`);
-
-module.exports = new CssReader([
- `${appPath}/common/css/layout.css`,
- `${appPath}/common/css/report.css`,
- `${appPath}/common/css/misc.css`,
- `${__dirname}/style.css`])
- .mergeStyles();
diff --git a/print/templates/reports/rpt-delivery-note/locale.js b/print/templates/reports/rpt-delivery-note/locale.js
deleted file mode 100644
index c637d9977..000000000
--- a/print/templates/reports/rpt-delivery-note/locale.js
+++ /dev/null
@@ -1,32 +0,0 @@
-module.exports = {
- messages: {
- es: {
- title: 'Albarán',
- ticketId: 'Albarán',
- clientId: 'Cliente',
- deliveryAddress: 'Dirección de entrega',
- fiscalData: 'Datos fiscales',
- saleLines: 'Líneas de pedido',
- date: 'Fecha',
- reference: 'Ref.',
- quantity: 'Cant.',
- concept: 'Concepto',
- price: 'PVP/u',
- discount: 'Dto.',
- vat: 'IVA',
- amount: 'Importe',
- type: 'Tipo',
- taxBase: 'Base imp.',
- tax: 'Tasa',
- fee: 'Cuota',
- total: 'Total',
- subtotal: 'Subtotal',
- taxBreakdown: 'Desglose impositivo',
- packagings: 'Cubos y embalajes',
- services: 'Servicios',
- vatType: 'Tipo de IVA',
- digitalSignature: 'Firma digital',
- ticket: 'Albarán {0}'
- },
- },
-};
diff --git a/print/templates/reports/rpt-sepa-core/locale/fr.yml b/print/templates/reports/rpt-sepa-core/locale/fr.yml
new file mode 100644
index 000000000..333472def
--- /dev/null
+++ b/print/templates/reports/rpt-sepa-core/locale/fr.yml
@@ -0,0 +1,38 @@
+{
+ title: 'Autorisation pour débit',
+ description: `Mediante la firma de esta orden de domiciliación, el deudor autoriza (A) al acreedor a enviar instrucciones
+ a la entidad del deudor para adeudar su cuenta y (B) a la entidad para efectuar los adeudos en su cuenta siguiendo las
+ instrucciones del acreedor.Como parte de sus derechos, el deudor está legitimado al reembolso por su entidad en los
+ términos y condiciones del contrato suscrito con la misma. La solicitud de reembolso deberá efectuarse dentro de las
+ ocho semanas que adeudo en cuenta. Puede obtener información adicional sobre sus derechos en su entidad financiera.`,
+ documentCopy: `Debe llevar a su entidad Bancaria una copia
+ del documento firmado para que lo registre y evitar la devolución.`,
+ mandatoryFields: `TODOS LOS CAMPOS HAN DE SER CUMPLIMENTADOS OBLIGATORIAMENTE.`,
+ sendOrder: `UNA VEZ FIRMADA ESTA ORDEN DE DOMICILIACIÓN DEBE SER ENVIADA AL ACREEDOR PARA SU CUSTODIA Y ES RECOMENDABLE FACILITAR UNA COPIA A SU ENTIDAD BANCARIA.`,
+ supplier: {
+ toCompleteBySupplier: 'A cumplimentar por el acreedor',
+ orderReference: 'Referencia de la orden de domiciliación',
+ identifier: 'Identificador del acreedor',
+ name: 'Nombre del acreedor',
+ street: 'Dirección',
+ location: 'CP - Población - Provincia',
+ country: 'País'
+ },
+ client: {
+ toCompleteByClient: 'A cumplimentar por el deudor',
+ name: 'Nombre del deudor/es',
+ street: 'Dirección del deudor',
+ location: 'CP - Población - Provincia',
+ country: 'País del deudor',
+ swift: 'Swift BIC',
+ accountNumber: 'Número de cuenta - IBAN',
+ accountHolder: '(Titular/es de la cuenta de cargo)',
+ accountNumberFormat: 'En Francia el IBAN consta de 27 posiciones comenzando siempre por FR',
+ paymentType: 'Tipo de pago',
+ recurrent: 'Recurrente',
+ unique: 'Único',
+ signLocation: 'Fecha - Localidad',
+ sign: 'Firma del deudor y sello',
+ },
+ order: 'Orden de domiciliación',
+}
\ No newline at end of file