diff --git a/client/core/src/lib/app.js b/client/core/src/lib/app.js index 3b58309b4..5851357d8 100644 --- a/client/core/src/lib/app.js +++ b/client/core/src/lib/app.js @@ -12,7 +12,7 @@ export default class App { this.$rootScope = $rootScope; } show(message) { - if (this.snackbar) this.snackbar.show({message: message}); + if (this.snackbar) this.snackbar.show({message: message, timeout: 400}); } showMessage(message) { this.show(message); diff --git a/services/mailer/application/route/notification.js b/services/mailer/application/route/notification.js index bd7a81f11..810fbdf88 100644 --- a/services/mailer/application/route/notification.js +++ b/services/mailer/application/route/notification.js @@ -4,10 +4,15 @@ var config = require('../config.js'); var mail = require('../mail.js'); var template = require('../template.js'); var httpRequest = require('request'); +var auth = require('../auth.js'); +// Auth middleware +var requestToken = function(request, response, next) { + auth.init(request, response, next); +}; // Printer setup -router.post('/printer-setup/:clientId', function(request, response) { +router.get('/printer-setup/:clientId', requestToken, function(request, response) { mail.sendWithTemplate('printer-setup', {clientId: request.params.clientId}, error => { if (error) return response.status(400).json({message: error.message}); @@ -17,7 +22,7 @@ router.post('/printer-setup/:clientId', function(request, response) { }); // Printer setup preview -router.get('/printer-setup/:clientId', function(request, response) { +router.get('/printer-setup/:clientId/preview', requestToken, function(request, response) { template.get('printer-setup', {clientId: request.params.clientId, isPreview: true}, (error, result) => { if (error) return response.status(400).json({message: error.message}); @@ -27,7 +32,7 @@ router.get('/printer-setup/:clientId', function(request, response) { }); // Client welcome -router.post('/client-welcome/:clientId', function(request, response) { +router.get('/client-welcome/:clientId', requestToken, function(request, response) { mail.sendWithTemplate('client-welcome', {clientId: request.params.clientId}, error => { if (error) return response.status(400).json({message: error.message}); @@ -37,7 +42,7 @@ router.post('/client-welcome/:clientId', function(request, response) { }); // Client welcome preview -router.get('/client-welcome/:clientId', function(request, response) { +router.get('/client-welcome/:clientId/preview', requestToken, function(request, response) { template.get('client-welcome', {clientId: request.params.clientId, isPreview: true}, (error, result) => { if (error) return response.status(400).json({message: error.message}); @@ -47,8 +52,13 @@ router.get('/client-welcome/:clientId', function(request, response) { }); // Client SEPA CORE -router.post('/sepa-core/:clientId', function(request, response) { - let path = `${request.proxyHost}/print/manuscript/sepa-core/${request.params.clientId}`; +router.get('/sepa-core/:companyId/:clientId', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId + }; + + let path = `${request.proxyHost}/print/manuscript/sepa-core/${params.companyId}/${params.clientId}`; let options = { url: path, method: 'GET', @@ -59,25 +69,75 @@ router.post('/sepa-core/:clientId', function(request, response) { let httpStream = httpRequest(options, function(error, httpResponse, body) { if (error || httpResponse.statusCode != 200) - return response.status(400).json({message: error.message}); + return response.status(400).json({message: error}); }); if (httpStream) - mail.sendWithTemplate('sepa-core', { - clientId: request.params.clientId, - attachments: [{filename: 'sepa-core.pdf', content: httpStream}] - }, error => { - if (error) - return response.status(400).json({message: error.message}); - - return response.json(); + params.attachments = [{filename: 'sepa-core.pdf', content: httpStream}]; + + mail.sendWithTemplate('sepa-core', params, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); }); }); // Client SEPA CORE preview -router.get('/sepa-core/:clientId', function(request, response) { - template.get('sepa-core', { +router.get('/sepa-core/:companyId/:clientId/preview', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token, + isPreview: true + }; + + template.get('sepa-core', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); +}); + +// First debtor letter +router.get('/letter-debtor-st/:companyId/:clientId', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token + }; + + let path = `${request.proxyHost}/print/manuscript/letter-debtor/${params.companyId}/${params.clientId}`; + let options = { + url: path, + method: 'GET', + headers: { + 'Authorization': request.headers.authorization + } + } + + let httpStream = httpRequest(options, function(error, httpResponse, body) { + if (error || httpResponse.statusCode != 200) + return response.status(400).json({message: error}); + }); + + if (httpStream) + params.attachments = [{filename: 'extracto.pdf', content: httpStream}]; + + mail.sendWithTemplate('letter-debtor-st', params, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// First debtor letter preview +router.get('/letter-debtor-st/:companyId/:clientId/preview', requestToken, function(request, response) { + template.get('letter-debtor-st', { clientId: request.params.clientId, + companyId: request.params.companyId, token: request.user.token, isPreview: true }, (error, result) => { @@ -88,6 +148,85 @@ router.get('/sepa-core/:clientId', function(request, response) { }); }); +// Second debtor letter +router.get('/letter-debtor-nd/:companyId/:clientId', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token + }; + + let path = `${request.proxyHost}/print/manuscript/letter-debtor/${params.companyId}/${params.clientId}`; + let options = { + url: path, + method: 'GET', + headers: { + 'Authorization': request.headers.authorization + } + } + + let httpStream = httpRequest(options, function(error, httpResponse, body) { + if (error || httpResponse.statusCode != 200) + return response.status(400).json({message: error}); + }); + + if (httpStream) + params.attachments = [{filename: 'extracto.pdf', content: httpStream}]; + + mail.sendWithTemplate('letter-debtor-nd', params, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// Second debtor letter preview +router.get('/letter-debtor-nd/:companyId/:clientId/preview', requestToken, function(request, response) { + template.get('letter-debtor-nd', { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token, + isPreview: true + }, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); +}); + +// Payment method changes +router.get('/payment-update/:clientId', requestToken, function(request, response) { + mail.sendWithTemplate('payment-update', {clientId: request.params.clientId}, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// Send notification to alias creditInsurance on client deactivate +router.get('/client-deactivate/:clientId', requestToken, function(request, response) { + var params = { + alias: 'creditInsurance', + code: 'clientDeactivate', + bodyParams: { + clientId: request.params.clientId + } + }; + + mail.sendWithTemplate('notification-alias', params, error => { + if (error) + response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +module.exports = router; + + // Single user notification /* router.post('/:recipient/noticeUserSend', function(request, response) { var params = { @@ -146,34 +285,4 @@ router.get('/sepa-core/:clientId', function(request, response) { mail.sendWithTemplate('notification-notice', params, result => { return response.json(result); }); -}); */ - -// Payment method changes -router.post('/payment-update/:clientId', function(request, response) { - mail.sendWithTemplate('payment-update', {clientId: request.params.clientId}, error => { - if (error) - return response.status(400).json({message: error.message}); - - return response.json(); - }); -}); - -// Send notification to alias creditInsurance on client deactivate -router.post('/client-deactivate/:clientId', function(request, response) { - var params = { - alias: 'creditInsurance', - code: 'clientDeactivate', - bodyParams: { - clientId: request.params.clientId - } - }; - - mail.sendWithTemplate('notification-alias', params, error => { - if (error) - response.status(400).json({message: error.message}); - - return response.json(); - }); -}); - -module.exports = router; +}); */ \ No newline at end of file diff --git a/services/mailer/application/router.js b/services/mailer/application/router.js index ed5794bbe..161271820 100644 --- a/services/mailer/application/router.js +++ b/services/mailer/application/router.js @@ -1,5 +1,7 @@ var express = require('express'); var router = new express.Router(); +var fs = require('fs'); +var path = require('path'); // Mailer default page router.get('/', function(request, response) { @@ -9,4 +11,20 @@ router.get('/', function(request, response) { // Notifications router.use('/notification', require('./route/notification.js')); +// Serve static images +router.use('/static/:template/:image', function(request, response) { + let imagePath = path.join(__dirname, '/template/', request.params.template, '/image/', request.params.image); + + fs.stat(imagePath, function(error) { + if (error) + return response.json({message: 'Image not found'}); + + let readStream = fs.createReadStream(imagePath); + + readStream.on('open', function() { + readStream.pipe(response); + }); + }); +}); + module.exports = router; diff --git a/services/mailer/application/template.js b/services/mailer/application/template.js index d2c13f222..1e9c92fde 100644 --- a/services/mailer/application/template.js +++ b/services/mailer/application/template.js @@ -15,7 +15,7 @@ module.exports = { get: function(template, params, cb) { var templatePath = path.join(__dirname, 'template', `${template}`, `index.html`); var classPath = path.join(__dirname, 'template', `${template}`, `${template}.js`); - var stylePath = path.join(__dirname, 'template', `${template}`, 'static', 'css', 'style.css'); + var stylePath = path.join(__dirname, 'template', `${template}`, 'style.css'); fs.stat(templatePath, (error, stat) => { if (error) @@ -65,6 +65,8 @@ module.exports = { return cb(error); instance._ = result.locale; + instance.isPreview = params.isPreview; + getDataCb(null, result); }); }); @@ -173,14 +175,17 @@ module.exports = { // Template default attachments for (var i = 0; i < tplAttachments.length; i++) { - let name = tplAttachments[i].replace('src="cid:', '').replace('"', ''); + let src = tplAttachments[i].replace('src="cid:', '').replace('"', '').split('/'); + let attachmentTpl = src[0]; + let attachment = src[1]; if (isPreview) { - let attachmentPath = `/mailer/static/images/${name}`; + let attachmentPath = `/mailer/static/${attachmentTpl}/${attachment}`; body = body.replace(tplAttachments[i], `src="${attachmentPath}"`); } else { - let attachmentPath = path.join(__dirname, '../static', 'images', name); - attachments.push({filename: name, path: attachmentPath, cid: name}); + let attachmentPath = path.join(__dirname, 'template', `${attachmentTpl}`, 'image', attachment); + let attachmentName = attachmentTpl + '/' + attachment; + attachments.push({filename: attachmentName, path: attachmentPath, cid: attachmentName}); } } diff --git a/services/mailer/application/template/client-welcome/client-welcome.js b/services/mailer/application/template/client-welcome/client-welcome.js index 469e74386..7cf435d0e 100644 --- a/services/mailer/application/template/client-welcome/client-welcome.js +++ b/services/mailer/application/template/client-welcome/client-welcome.js @@ -14,10 +14,11 @@ module.exports = class ClientWelcome { c.email recipient FROM client c JOIN account.user u ON u.id = c.id - LEFT JOIN worker w ON w.id = c.workerFk + LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN account.user wu ON wu.id = w.userFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); diff --git a/services/mailer/application/template/client-welcome/index.html b/services/mailer/application/template/client-welcome/index.html index a8a711c8e..2c778bee8 100644 --- a/services/mailer/application/template/client-welcome/index.html +++ b/services/mailer/application/template/client-welcome/index.html @@ -22,6 +22,7 @@

{{_.dear}}

{{{_.bodyDescription}}}

+

{{_.clientNumber}} {{clientId}}
{{_.user}} {{userName}}
{{_.password}} ******** {{_.passwordResetText}}

diff --git a/services/mailer/application/template/client-welcome/locale/es.json b/services/mailer/application/template/client-welcome/locale/es.json index b1149d62b..e7dce623c 100644 --- a/services/mailer/application/template/client-welcome/locale/es.json +++ b/services/mailer/application/template/client-welcome/locale/es.json @@ -3,6 +3,7 @@ "title": "¡LE DAMOS LA BIENVENIDA!", "dear": "Estimado cliente,", "bodyDescription": "Sus 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:", + "clientNumber": "Identificador de cliente:", "user": "Usuario:", "password": "Contraseña:", "passwordResetText": "(Va a recibir un correo para establecer la contraseña)", diff --git a/services/mailer/application/template/client-welcome/static/css/style.css b/services/mailer/application/template/client-welcome/style.css similarity index 100% rename from services/mailer/application/template/client-welcome/static/css/style.css rename to services/mailer/application/template/client-welcome/style.css diff --git a/services/mailer/application/template/default/image/download.svg b/services/mailer/application/template/default/image/download.svg new file mode 100644 index 000000000..b05bc05c8 --- /dev/null +++ b/services/mailer/application/template/default/image/download.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/services/mailer/application/template/default/image/preview.svg b/services/mailer/application/template/default/image/preview.svg new file mode 100644 index 000000000..09a2a6bca --- /dev/null +++ b/services/mailer/application/template/default/image/preview.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/services/mailer/application/template/footer/footer.js b/services/mailer/application/template/footer/footer.js index 3b4020bf4..555e70b10 100644 --- a/services/mailer/application/template/footer/footer.js +++ b/services/mailer/application/template/footer/footer.js @@ -5,7 +5,8 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class Footer { getData(params, cb) { let query = `SELECT - socialName + socialName, + LOWER(ct.code) countryCode FROM client c JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; diff --git a/services/mailer/application/template/footer/static/image/action.png b/services/mailer/application/template/footer/image/action.png similarity index 100% rename from services/mailer/application/template/footer/static/image/action.png rename to services/mailer/application/template/footer/image/action.png diff --git a/services/mailer/application/template/footer/static/image/facebook.png b/services/mailer/application/template/footer/image/facebook.png similarity index 100% rename from services/mailer/application/template/footer/static/image/facebook.png rename to services/mailer/application/template/footer/image/facebook.png diff --git a/services/mailer/application/template/footer/static/image/header.png b/services/mailer/application/template/footer/image/header.png similarity index 100% rename from services/mailer/application/template/footer/static/image/header.png rename to services/mailer/application/template/footer/image/header.png diff --git a/services/mailer/application/template/footer/static/image/info.png b/services/mailer/application/template/footer/image/info.png similarity index 100% rename from services/mailer/application/template/footer/static/image/info.png rename to services/mailer/application/template/footer/image/info.png diff --git a/services/mailer/application/template/footer/static/image/instagram.png b/services/mailer/application/template/footer/image/instagram.png similarity index 100% rename from services/mailer/application/template/footer/static/image/instagram.png rename to services/mailer/application/template/footer/image/instagram.png diff --git a/services/mailer/application/template/footer/static/image/linkedin.png b/services/mailer/application/template/footer/image/linkedin.png similarity index 100% rename from services/mailer/application/template/footer/static/image/linkedin.png rename to services/mailer/application/template/footer/image/linkedin.png diff --git a/services/mailer/application/template/footer/static/image/pinterest.png b/services/mailer/application/template/footer/image/pinterest.png similarity index 100% rename from services/mailer/application/template/footer/static/image/pinterest.png rename to services/mailer/application/template/footer/image/pinterest.png diff --git a/services/mailer/application/template/footer/static/image/twitter.png b/services/mailer/application/template/footer/image/twitter.png similarity index 100% rename from services/mailer/application/template/footer/static/image/twitter.png rename to services/mailer/application/template/footer/image/twitter.png diff --git a/services/mailer/application/template/footer/static/image/youtube.png b/services/mailer/application/template/footer/image/youtube.png similarity index 100% rename from services/mailer/application/template/footer/static/image/youtube.png rename to services/mailer/application/template/footer/image/youtube.png diff --git a/services/mailer/application/template/footer/index.html b/services/mailer/application/template/footer/index.html index e52f7a695..484f5c2b8 100644 --- a/services/mailer/application/template/footer/index.html +++ b/services/mailer/application/template/footer/index.html @@ -2,10 +2,10 @@
{{_.actionButton}} - +
{{_.infoButton}} - +
@@ -13,22 +13,22 @@ diff --git a/services/mailer/application/template/footer/static/css/style.css b/services/mailer/application/template/footer/style.css similarity index 100% rename from services/mailer/application/template/footer/static/css/style.css rename to services/mailer/application/template/footer/style.css diff --git a/services/mailer/application/template/header/header.js b/services/mailer/application/template/header/header.js index 82c78e003..a6d1d6194 100644 --- a/services/mailer/application/template/header/header.js +++ b/services/mailer/application/template/header/header.js @@ -5,7 +5,8 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class Header { getData(params, cb) { let query = `SELECT - c.name AS clientName + c.name AS clientName, + LOWER(ct.code) countryCode FROM client c JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; diff --git a/services/mailer/application/template/header/static/image/header.png b/services/mailer/application/template/header/image/logo.png similarity index 100% rename from services/mailer/application/template/header/static/image/header.png rename to services/mailer/application/template/header/image/logo.png diff --git a/services/mailer/application/template/header/index.html b/services/mailer/application/template/header/index.html index c5234bbc8..6e4fcf8a4 100644 --- a/services/mailer/application/template/header/index.html +++ b/services/mailer/application/template/header/index.html @@ -1,3 +1,3 @@
- VerdNatura + VerdNatura
diff --git a/services/mailer/application/template/header/static/image/logo.png b/services/mailer/application/template/header/static/image/logo.png deleted file mode 100644 index 55e26fec6..000000000 Binary files a/services/mailer/application/template/header/static/image/logo.png and /dev/null differ diff --git a/services/mailer/application/template/header/static/css/style.css b/services/mailer/application/template/header/style.css similarity index 100% rename from services/mailer/application/template/header/static/css/style.css rename to services/mailer/application/template/header/style.css diff --git a/services/mailer/application/template/letter-debtor-nd/attachment.json b/services/mailer/application/template/letter-debtor-nd/attachment.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/attachment.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-nd/index.html b/services/mailer/application/template/letter-debtor-nd/index.html new file mode 100644 index 000000000..aa4379519 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/index.html @@ -0,0 +1,87 @@ + + + + {{_.subject}} + + + +
+
+ + {{$.header}} + + + +
+

{{_.title}}

+
+ + + +
+

{{_.dear}}

+ +

{{_.bodyDescription}}

+

{{_.termLimits}}

+

+ {{_.payMethod}} + +

    +
  1. {{_.payMethodOption1}}
  2. +
  3. {{_.payMethodOption2}}
  4. +
+

+

+ {{_.legalActions}} +

    +
  1. {{_.legalActionsOption1}}
  2. +
  3. {{_.legalActionsOption2}}
  4. +
  5. {{_.legalActionsOption3}}
  6. +
+

+ +

{{_.contact}}

+ +

{{_.waitingForNews}}

+

{{_.conclusion}}

+ +

+

+
{{bankName}}
+
{{iban}}
+
+
{{_.accountTransferData}}
+
+
+

+ + {{#isPreview}} + +
+
+ Ver adjunto +
+ Ver adjunto +
+
+ + +
+
+ Descargar adjunto +
+ Descargar PDF +
+
+ {{/isPreview}} +
+ + + + + {{$.footer}} + +
+
+ + \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js b/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js new file mode 100644 index 000000000..be0f996e1 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js @@ -0,0 +1,39 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class LetterDebtorNd { + getData(params, cb) { + let query = `SELECT + sa.iban, + be.name AS bankName, + LOWER(ct.code) countryCode, + c.email recipient + FROM client c + JOIN company AS cny + JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk + JOIN bankEntity be ON be.id = sa.bankEntityFk + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ? AND cny.id = ?`; + + this.clientId = params.clientId; + this.companyId = params.companyId; + this.token = params.token; + + database.pool.query(query, [params.clientId, params.companyId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + + cb(); + }); + } + + get previewAttachments() { + if (this.isPreview) + return `` + + '
Descargar adjunto
' + + 'extracto.pdf
'; + } +}; diff --git a/services/mailer/application/template/letter-debtor-nd/locale/es.json b/services/mailer/application/template/letter-debtor-nd/locale/es.json new file mode 100644 index 000000000..1f8790eba --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/locale/es.json @@ -0,0 +1,18 @@ +{ + "subject": "Reiteración de aviso por saldo deudor", + "title": "AVISO REITERADO", + "dear": "Estimado cliente,", + "bodyDescription": "Nos dirigimos a Vd. nuevamente para informarle que sigue pendiente su deuda con nuestra empresa, tal y como puede comprobar en el extracto adjunto.", + "termLimits": "Dado que los plazos de pago acordados están ampliamente superados, no procede mayor dilación en la liquidación del importe adeudado.", + "payMethod": "Para ello dispone de las siguientes formas de pago:", + "payMethodOption1": "Pago online desde nuestra web", + "payMethodOption2": "Ingreso o transferencia al número de cuenta que detallamos al pie de esta carta, indicando el número de cliente.", + "legalActions": "En caso de no ser atendido este apremio de pago, nos veremos obligados a iniciar las acciones legales que procedan, entre las que están:", + "legalActionsOption1": "Inclusión en ficheros negativos sobre solvencia patrimonial y crédito.", + "legalActionsOption2": "Reclamación judicial", + "legalActionsOption3": "Cesión de deuda a una empresa de gestión de cobro", + "contact": "Para consultas, puede ponerse en contacto con nosotros en el 96 324 21 00.", + "waitingForNews": "En espera de sus noticias", + "conclusion": "Gracias por su atención.", + "accountTransferData": "Datos para transferencia bancaria" +} \ No newline at end of file diff --git a/services/mailer/application/template/notification-alias/static/css/style.css b/services/mailer/application/template/letter-debtor-nd/style.css similarity index 100% rename from services/mailer/application/template/notification-alias/static/css/style.css rename to services/mailer/application/template/letter-debtor-nd/style.css diff --git a/services/mailer/application/template/letter-debtor-st/attachment.json b/services/mailer/application/template/letter-debtor-st/attachment.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/attachment.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-st/index.html b/services/mailer/application/template/letter-debtor-st/index.html new file mode 100644 index 000000000..a3b07e677 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/index.html @@ -0,0 +1,69 @@ + + + + {{_.subject}} + + + +
+
+ + {{$.header}} + + + +
+

{{_.title}}

+
+ + + +
+

{{_.dear}}

+ +

{{_.bodyDescription}}

+

{{_.viewExtract}}

+

{{_.validData}}

+

{{_.payMethod}}

+

{{_.conclusion}}

+ +

+

+
{{bankName}}
+
{{iban}}
+
+
{{_.accountTransferData}}
+
+
+

+ + {{#isPreview}} + +
+
+ Ver adjunto +
+ Ver adjunto +
+
+ + +
+
+ Descargar adjunto +
+ Descargar PDF +
+
+ {{/isPreview}} +
+ + + + + {{$.footer}} + +
+
+ + \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js b/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js new file mode 100644 index 000000000..43ccb7a25 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js @@ -0,0 +1,39 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class LetterDebtorSt { + getData(params, cb) { + let query = `SELECT + sa.iban, + be.name AS bankName, + LOWER(ct.code) countryCode, + c.email recipient + FROM client c + JOIN company AS cny + JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk + JOIN bankEntity be ON be.id = sa.bankEntityFk + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ? AND cny.id = ?`; + + this.clientId = params.clientId; + this.companyId = params.companyId; + this.token = params.token; + + database.pool.query(query, [params.clientId, params.companyId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + + cb(); + }); + } + + get previewAttachments() { + if (this.isPreview) + return `` + + '
Descargar adjunto
' + + 'extracto.pdf
'; + } +}; diff --git a/services/mailer/application/template/letter-debtor-st/locale/es.json b/services/mailer/application/template/letter-debtor-st/locale/es.json new file mode 100644 index 000000000..558b18753 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/locale/es.json @@ -0,0 +1,11 @@ +{ + "subject": "Aviso inicial por saldo deudor", + "title": "AVISO INICIAL", + "dear": "Estimado cliente,", + "bodyDescription": "Por el presente escrito le comunicamos que, según nuestros datos contables, su cuenta tiene un saldo pendiente de liquidar.", + "viewExtract": "Le solicitamos compruebe que el extracto adjunto corresponde con los datos de que Vd. dispone. Nuestro departamento de administración le aclarará gustosamente cualquier duda que pueda tener, e igualmente le facilitará cualquier documento que solicite.", + "validData": "Si al comprobar los datos aportados resultaran correctos, le rogamos proceda a regularizar su situación.", + "payMethod": "Si no desea desplazarse personalmente hasta nuestras oficinas, puede realizar el pago mediante transferencia bancaria a la cuenta que figura al pie del comunicado, indicando su número de cliente, o bien puede realizar el pago online desde nuestra página web.", + "conclusion": "De antemano le agradecemos su amable colaboración.", + "accountTransferData": "Datos para transferencia bancaria" +} \ No newline at end of file diff --git a/services/mailer/application/template/payment-update/static/css/style.css b/services/mailer/application/template/letter-debtor-st/style.css similarity index 100% rename from services/mailer/application/template/payment-update/static/css/style.css rename to services/mailer/application/template/letter-debtor-st/style.css diff --git a/services/mailer/application/template/printer-setup/static/css/style.css b/services/mailer/application/template/notification-alias/style.css similarity index 100% rename from services/mailer/application/template/printer-setup/static/css/style.css rename to services/mailer/application/template/notification-alias/style.css diff --git a/services/mailer/application/template/payment-update/payment-update.js b/services/mailer/application/template/payment-update/payment-update.js index 187d21b73..8a5a3b45b 100644 --- a/services/mailer/application/template/payment-update/payment-update.js +++ b/services/mailer/application/template/payment-update/payment-update.js @@ -4,8 +4,7 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class PaymentUpdate { getData(params, cb) { - let query = `SELECT - c.id clientId, + let query = `SELECT pm.id payMethodFk, pm.name payMethodName, c.dueDay, @@ -16,6 +15,9 @@ module.exports = class PaymentUpdate { JOIN payMethod pm ON pm.id = c.paymentMethodFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; + + this.clientId = params.clientId; + database.pool.query(query, [params.clientId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); diff --git a/services/mailer/application/template/sepa-core/static/css/style.css b/services/mailer/application/template/payment-update/style.css similarity index 100% rename from services/mailer/application/template/sepa-core/static/css/style.css rename to services/mailer/application/template/payment-update/style.css diff --git a/services/mailer/application/template/printer-setup/printer-setup.js b/services/mailer/application/template/printer-setup/printer-setup.js index 6dece0d23..d17add406 100644 --- a/services/mailer/application/template/printer-setup/printer-setup.js +++ b/services/mailer/application/template/printer-setup/printer-setup.js @@ -4,19 +4,21 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class PrinterSetup { getData(params, cb) { - let query = `SELECT - c.id clientId, + let query = `SELECT CONCAT(w.name, ' ', w.firstName) name, w.phone AS phone, CONCAT(u.name, '@verdnatura.es') AS email, LOWER(ct.code) countryCode, c.email recipient FROM client c - LEFT JOIN worker w ON w.id = c.workerFk + LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = w.userFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; - + + this.clientId = params.clientId; + this.isPreview = params.isPreview; + database.pool.query(query, [params.clientId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); diff --git a/services/mailer/application/template/printer-setup/style.css b/services/mailer/application/template/printer-setup/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/application/template/sepa-core/index.html b/services/mailer/application/template/sepa-core/index.html index 0e9c34d04..1acdae3fc 100644 --- a/services/mailer/application/template/sepa-core/index.html +++ b/services/mailer/application/template/sepa-core/index.html @@ -22,7 +22,26 @@

{{_.dear}}

{{_.bodyDescription}}

{{_.conclusion}}

- {{{previewAttachments}}} + + {{#isPreview}} + +
+
+ Ver adjunto +
+ Ver adjunto +
+
+ + +
+
+ Descargar adjunto +
+ Descargar PDF +
+
+ {{/isPreview}} diff --git a/services/mailer/application/template/sepa-core/sepa-core.js b/services/mailer/application/template/sepa-core/sepa-core.js index 04fd71df7..ec19dd29b 100644 --- a/services/mailer/application/template/sepa-core/sepa-core.js +++ b/services/mailer/application/template/sepa-core/sepa-core.js @@ -5,19 +5,19 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class SepaCore { getData(params, cb) { let query = `SELECT - c.id clientId, CONCAT(w.name, ' ', w.firstName) name, w.phone AS phone, CONCAT(u.name, '@verdnatura.es') AS email, LOWER(ct.code) countryCode, c.email recipient FROM client c - LEFT JOIN worker w ON w.id = c.workerFk + LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = w.userFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; - this.isPreview = params.isPreview; + this.clientId = params.clientId; + this.companyId = params.companyId; this.token = params.token; database.pool.query(query, [params.clientId], (error, result) => { @@ -29,11 +29,4 @@ module.exports = class SepaCore { cb(); }); } - - get previewAttachments() { - if (this.isPreview) - return `` + - '
Descargar adjunto
' + - 'sepa-core.pdf
'; - } }; diff --git a/services/mailer/application/template/sepa-core/style.css b/services/mailer/application/template/sepa-core/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/server/server.js b/services/mailer/server/server.js index 50320a391..457a61ddf 100644 --- a/services/mailer/server/server.js +++ b/services/mailer/server/server.js @@ -13,13 +13,8 @@ app.use(bodyParser.urlencoded({extended: true})); app.use('/static', express.static(path.join(__dirname, '../static'))); -// Auth middleware -var requestToken = function(request, response, next) { - auth.init(request, response, next); -}; - // Load routes -app.use('/', requestToken, require('../application/router.js')); +app.use('/', require('../application/router.js')); app.start = function() { var listener = app.listen(config.app.port, function() { diff --git a/services/mailer/static/css/component.css b/services/mailer/static/css/component.css index 10805e562..b4c018d79 100644 --- a/services/mailer/static/css/component.css +++ b/services/mailer/static/css/component.css @@ -1,137 +1,221 @@ -img { - margin: 0 -} - -p { - text-align: justify -} - -.wrapper { - background-color: #EEE -} - -.container { - font-family: arial, sans-serif; - max-width: 600px; - min-width: 320px; - font-size: 16px; - margin: 0 auto; - color: #555 -} - -.title { - background-color: #95d831; - text-align: center; - padding: 35px 0 -} - -.title h1 { - font-size: 32px; - color: #333; - margin: 0 -} - -.body { - background-color:#FFF; - padding: 20px -} - -.body a { - color: #8dba25 -} - -.body h1 { - color: #999 -} - -.body h3 { - font-size: 16px -} - -.panel { - border: 1px solid #DDD; - margin-bottom: 10px; - padding:10px -} - -.row { - margin-bottom: 15px; - overflow: hidden; - content: ''; - clear: both -} - -.row .text { - margin-bottom: 5px -} - -.row .control { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box -} - -.row .description { - font-size: 8px; - color: #999 -} - -.row .v-align { - padding-top: 5px; - line-height: 21px -} - -.row:last-child { - margin-bottom: 0 -} - -.row.inline .text { - margin-bottom: 0; - width: 40%; - float: left -} - -.row.inline .control { - font-weight: bold; - padding-left: 20px; - color: #000; - width: 60%; - float: left -} - -.box { - border-top: 1px solid #CCC; - border-right: 1px solid #CCC; - border-bottom: 1px solid #CCC; - font-weight: bold; - text-align: center; - padding-top: 4px; - width: 25px; - height: 21px; - color: #000; - float: left -} - -.row .control .box:first-child { - border-left: 1px solid #CCC; -} - -.attachment { - overflow: hidden; - margin-top: 10px -} - -.attachment:after { - content: ' '; - display: block; - clear: both -} - -.attachment-icon { - float: left -} - -.attachment span { - padding: 16px 0 0 10px; - float: left +body { + padding: 0; + margin: 0 +} + +img { + margin: 0 +} + +p { + text-align: justify +} + +.wrapper { + background-color: #EEE +} + +.container { + font-family: arial, sans-serif; + max-width: 600px; + min-width: 320px; + font-size: 16px; + margin: 0 auto; + color: #555 +} + +.title { + background-color: #95d831; + text-align: center; + padding: 35px 0 +} + +.title h1 { + font-size: 32px; + color: #333; + margin: 0 +} + +.body { + background-color:#FFF; + padding: 20px +} + +.body a { + color: #8dba25 +} + +.body h1 { + color: #999 +} + +.body h3 { + font-size: 16px +} + +.panel { + border: 1px solid #DDD; + margin-bottom: 10px; + position: relative; + padding:10px +} + +.row { + margin-bottom: 15px; + overflow: hidden +} + +.row .text { + margin-bottom: 5px +} + +.row .control { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box +} + +.row .text, .row .control { + overflow: hidden +} + +.row .description { + position: relative; + padding-top: 2px; + overflow: hidden; + font-size: 11px; + display: block; + color: #999 +} + +.row .line { + border-bottom: 1px solid #DDD; + border-right: 1px solid #DDD; + border-left: 1px solid #DDD; + margin-top: 10px; + color: #999; + padding: 5px +} + +.row .description span { + background-color: #FFF; + margin: -5px 0 0 50px; + display: block; + padding: 5px; + float: left +} + +.row:last-child { + margin-bottom: 0 +} + +.row.inline .text { + margin-bottom: 0; + width: 40%; + float: left +} + +.row.inline .control { + font-weight: bold; + padding-left: 20px; + color: #000; + width: 60%; + float: left +} + +.row.inline .description { + position: static; + overflow: visible +} + +.box { + border-top: 1px solid #CCC; + border-right: 1px solid #CCC; + border-bottom: 1px solid #CCC; + font-weight: bold; + text-align: center; + padding-top: 4px; + width: 25px; + height: 21px; + color: #000; + float: left +} + +.box.crossed { + font-weight: 100; + font-size: 16px +} + +.row .control .box:first-child { + border-left: 1px solid #CCC; +} + +.font.small { + font-size: 10px +} + +.font.verticalAlign { + height: 27px; + line-height: 27px +} + +.font.centered { + height: 27px; + line-height: 27px; + text-align: center +} + +.verticalText { + -moz-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + position: absolute; + text-align: center; + font-size: .65em; + width: 200px; + right: -115px; + top: 50% +} + +.attachment { + overflow: hidden; + margin-top: 10px +} + +.attachment-icon { + float: left +} + +.attachment span { + padding: 16px 0 0 10px; + float: left +} + +.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 } \ No newline at end of file diff --git a/services/mailer/static/images/attachment.png b/services/mailer/static/images/attachment.png deleted file mode 100644 index 78efe4f95..000000000 Binary files a/services/mailer/static/images/attachment.png and /dev/null differ diff --git a/services/print/application/route/manuscript.js b/services/print/application/route/manuscript.js index 90662b646..091ffa4c3 100644 --- a/services/print/application/route/manuscript.js +++ b/services/print/application/route/manuscript.js @@ -4,22 +4,93 @@ var template = require('../template.js'); var config = require('../config.js'); var pdf = require('html-pdf'); var path = require('path'); +var auth = require('../auth.js'); + +// Auth middleware +var requestToken = function(request, response, next) { + auth.init(request, response, next); +}; // Sepa core -router.post('/sepa-core/:clientId', function(request, response, next) { - template.get('sepa-core', {clientId: request.params.clientId}, (error, result) => { +router.get('/sepa-core/:companyId/:clientId', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId + }; + + template.get('sepa-core', params, (error, result) => { if (error) return response.status(400).json({message: error.message}); - pdf.create(result.body).toStream(function(error, stream) { + pdf.create(result.body, config.pdf).toStream(function(error, stream) { if (error) throw Error(error); + response.setHeader('Content-Disposition', 'attachment; filename="sepa-core.pdf"'); + response.setHeader('Content-type', 'application/pdf'); stream.pipe(response); }); }); }); +// Sepa core html preview +router.get('/sepa-core/:companyId/:clientId/preview', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + isPreview: true + }; + + template.get('sepa-core', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); + }); + + // Debtor letter +router.get('/letter-debtor/:companyId/:clientId', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId + }; + + template.get('letter-debtor', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + pdf.create(result.body, config.pdf).toStream(function(error, stream) { + if (error) + throw Error(error); + + response.setHeader('Content-Disposition', 'attachment; filename="extracto.pdf"'); + response.setHeader('Content-type', 'application/pdf'); + stream.pipe(response); + }); + }); + }); + + // Debtor letter html preview +router.get('/letter-debtor/:companyId/:clientId/preview', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + isPreview: true + }; + + template.get('letter-debtor', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); + }); + + +module.exports = router; + + // store pdf /* router.post('/sepa-core/:clientId', function(request, response, next) { template.get('sepa-core', {recipient: request.params.clientId}, (error, result) => { @@ -35,32 +106,4 @@ router.post('/sepa-core/:clientId', function(request, response, next) { }); }); }); - */ -// Sepa core preview -router.get('/sepa-core/:clientId', function(request, response, next) { - template.get('sepa-core', {clientId: request.params.clientId}, (error, result) => { - if (error) - return response.status(400).json({message: error.message}); - - let options = config.pdf; - pdf.create(result.body, options).toStream(function(error, stream) { - if (error) - throw Error(error); - - response.setHeader('Content-Disposition', 'inline; filename="sepa-core.pdf"'); - response.setHeader('Content-type', 'application/pdf'); - stream.pipe(response); - }); - }); -}); - -router.get('/sepa-core-view/:clientId', function(request, response, next) { - template.get('sepa-core', {clientId: request.params.clientId}, (error, result) => { - if (error) - return response.status(400).json({message: error.message}); - - response.send(result.body); - }); - }); - -module.exports = router; + */ \ No newline at end of file diff --git a/services/print/application/router.js b/services/print/application/router.js index 58e9a3694..a9ebe1acf 100644 --- a/services/print/application/router.js +++ b/services/print/application/router.js @@ -1,5 +1,7 @@ var express = require('express'); var router = new express.Router(); +var fs = require('fs'); +var path = require('path'); // Default page router.get('/', function(request, response) { @@ -9,4 +11,21 @@ router.get('/', function(request, response) { // Manuscripts router.use('/manuscript', require('./route/manuscript.js')); +// Serve static images +router.use('/static/:template/:image', function(request, response) { + let imagePath = path.join(__dirname, '/template/', request.params.template, '/image/', request.params.image); + + fs.stat(imagePath, function(error) { + if (error) + return response.json({message: 'Image not found'}); + + let readStream = fs.createReadStream(imagePath); + + readStream.on('open', function() { + readStream.pipe(response); + }); + }); +}); + + module.exports = router; diff --git a/services/print/application/template.js b/services/print/application/template.js index 9bc968c74..9974ebcf5 100644 --- a/services/print/application/template.js +++ b/services/print/application/template.js @@ -4,6 +4,7 @@ var locale = require('./locale.js'); var inlineCss = require('inline-css'); var path = require('path'); + module.exports = { /** * Get template. @@ -15,7 +16,7 @@ module.exports = { get: function(template, params, cb) { var templatePath = path.join(__dirname, 'template', `${template}`, `index.html`); var classPath = path.join(__dirname, 'template', `${template}`, `${template}.js`); - var stylePath = path.join(__dirname, 'template', `${template}`, 'static', 'css', 'style.css'); + var stylePath = path.join(__dirname, 'template', `${template}`, 'style.css'); fs.stat(templatePath, (error, stat) => { if (error) @@ -43,7 +44,7 @@ module.exports = { params.subject = title[1]; } - this.renderImages(template, body, (error, body) => { + this.renderImages(template, body, params.isPreview, (error, body) => { if (error) return cb(error); @@ -53,7 +54,7 @@ module.exports = { }; let getDataCb = () => { - this.render(templatePath, instance, (error, result) => getRenderedStyles(error, result)); + this.render(templatePath, params, instance, (error, result) => getRenderedStyles(error, result)); }; instance.getData(params, (error, result) => { @@ -65,6 +66,7 @@ module.exports = { return cb(error); instance._ = result.locale; + instance.isPreview = params.isPreview; getDataCb(null, result); }); }); @@ -77,7 +79,7 @@ module.exports = { * @param {Object} data - Params * @param {Object} cb - Callback */ - render: function(path, data, cb) { + render: function(path, params, data, cb) { fs.readFile(path, 'utf8', (error, body) => { // Find matching sub-templates let regexp = new RegExp(/\{\{\$\.(.*?)\}\}/, 'ig'); @@ -89,7 +91,7 @@ module.exports = { } let parentBody = body; - this.renderSub(parentBody, subTpl, data, regexp, (error, body) => { + this.renderSub(parentBody, subTpl, params, regexp, (error, body) => { if (error) return cb(error); @@ -99,13 +101,13 @@ module.exports = { }); }, - renderSub: function(body, subTpl, data, regexp, cb) { + renderSub: function(body, subTpl, params, regexp, cb) { let index = 1; subTpl.forEach(keyName => { subTplName = keyName.replace(regexp, '$1'); - this.get(subTplName, data, (error, result) => { + this.get(subTplName, params, (error, result) => { if (error) return cb(error); @@ -140,7 +142,7 @@ module.exports = { let style = ''; let body = style + html; let options = {url: ' '}; - + inlineCss(body, options) .then(function(body) { cb(null, body); @@ -156,7 +158,7 @@ module.exports = { * @param {String} body - template body * @param {Object} cb - Callback */ - renderImages: function(template, body, cb) { + renderImages: function(template, body, isPreview, cb) { let tplImages = body.match(new RegExp('src="cid:(.*?)"', 'ig')); if (!tplImages) @@ -164,10 +166,17 @@ module.exports = { // Template default attachments for (var i = 0; i < tplImages.length; i++) { - let name = tplImages[i].replace('src="cid:', '').replace('"', ''); + let src = tplImages[i].replace('src="cid:', '').replace('"', '').split('/'); + let attachmentTpl = src[0]; + let attachment = src[1]; - let imagePath = path.join(__dirname, 'template', `${template}`, 'static', 'image', name); - body = body.replace(tplImages[i], `src="file:///${imagePath}"`); + if (isPreview) { + let imagePath = `/print/static/${attachmentTpl}/${attachment}`; + body = body.replace(tplImages[i], `src="${imagePath}"`); + } else { + let imagePath = path.join(__dirname, 'template', attachmentTpl, 'image', attachment); + body = body.replace(tplImages[i], `src="file:///${imagePath}"`); + } } cb(null, body); diff --git a/services/mailer/application/template/header/static/image/action.png b/services/print/application/template/footer/image/action.png similarity index 100% rename from services/mailer/application/template/header/static/image/action.png rename to services/print/application/template/footer/image/action.png diff --git a/services/mailer/application/template/header/static/image/facebook.png b/services/print/application/template/footer/image/facebook.png similarity index 100% rename from services/mailer/application/template/header/static/image/facebook.png rename to services/print/application/template/footer/image/facebook.png diff --git a/services/mailer/application/template/header/static/image/info.png b/services/print/application/template/footer/image/info.png similarity index 100% rename from services/mailer/application/template/header/static/image/info.png rename to services/print/application/template/footer/image/info.png diff --git a/services/mailer/application/template/header/static/image/instagram.png b/services/print/application/template/footer/image/instagram.png similarity index 100% rename from services/mailer/application/template/header/static/image/instagram.png rename to services/print/application/template/footer/image/instagram.png diff --git a/services/mailer/application/template/header/static/image/linkedin.png b/services/print/application/template/footer/image/linkedin.png similarity index 100% rename from services/mailer/application/template/header/static/image/linkedin.png rename to services/print/application/template/footer/image/linkedin.png diff --git a/services/mailer/application/template/header/static/image/pinterest.png b/services/print/application/template/footer/image/pinterest.png similarity index 100% rename from services/mailer/application/template/header/static/image/pinterest.png rename to services/print/application/template/footer/image/pinterest.png diff --git a/services/mailer/application/template/header/static/image/twitter.png b/services/print/application/template/footer/image/twitter.png similarity index 100% rename from services/mailer/application/template/header/static/image/twitter.png rename to services/print/application/template/footer/image/twitter.png diff --git a/services/mailer/application/template/header/static/image/youtube.png b/services/print/application/template/footer/image/youtube.png similarity index 100% rename from services/mailer/application/template/header/static/image/youtube.png rename to services/print/application/template/footer/image/youtube.png diff --git a/services/print/application/template/footer/static/image/action.png b/services/print/application/template/footer/static/image/action.png deleted file mode 100644 index 2cd16c453..000000000 Binary files a/services/print/application/template/footer/static/image/action.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/facebook.png b/services/print/application/template/footer/static/image/facebook.png deleted file mode 100644 index 7ab54c538..000000000 Binary files a/services/print/application/template/footer/static/image/facebook.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/header.png b/services/print/application/template/footer/static/image/header.png deleted file mode 100644 index 3c063ae44..000000000 Binary files a/services/print/application/template/footer/static/image/header.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/info.png b/services/print/application/template/footer/static/image/info.png deleted file mode 100644 index fb75cbc4e..000000000 Binary files a/services/print/application/template/footer/static/image/info.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/instagram.png b/services/print/application/template/footer/static/image/instagram.png deleted file mode 100644 index 66550c4a5..000000000 Binary files a/services/print/application/template/footer/static/image/instagram.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/linkedin.png b/services/print/application/template/footer/static/image/linkedin.png deleted file mode 100644 index 0d191e5ae..000000000 Binary files a/services/print/application/template/footer/static/image/linkedin.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/logo.png b/services/print/application/template/footer/static/image/logo.png deleted file mode 100644 index 55e26fec6..000000000 Binary files a/services/print/application/template/footer/static/image/logo.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/logo.svg b/services/print/application/template/footer/static/image/logo.svg deleted file mode 100644 index 51baf46d3..000000000 --- a/services/print/application/template/footer/static/image/logo.svg +++ /dev/null @@ -1,48 +0,0 @@ - - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/print/application/template/footer/static/image/pinterest.png b/services/print/application/template/footer/static/image/pinterest.png deleted file mode 100644 index 4d7b28ef8..000000000 Binary files a/services/print/application/template/footer/static/image/pinterest.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/twitter.png b/services/print/application/template/footer/static/image/twitter.png deleted file mode 100644 index c4a8ab0c1..000000000 Binary files a/services/print/application/template/footer/static/image/twitter.png and /dev/null differ diff --git a/services/print/application/template/footer/static/image/youtube.png b/services/print/application/template/footer/static/image/youtube.png deleted file mode 100644 index 11871deb5..000000000 Binary files a/services/print/application/template/footer/static/image/youtube.png and /dev/null differ diff --git a/services/print/application/template/footer/static/css/style.css b/services/print/application/template/footer/style.css similarity index 89% rename from services/print/application/template/footer/static/css/style.css rename to services/print/application/template/footer/style.css index 8bd10148d..aeddc6f0a 100644 --- a/services/print/application/template/footer/static/css/style.css +++ b/services/print/application/template/footer/style.css @@ -8,6 +8,7 @@ img { max-width: 90%; margin: 0 auto; font-size: 9px; + margin: 30px; color: #555 } diff --git a/services/mailer/application/template/footer/static/image/logo.svg b/services/print/application/template/header/image/logo.svg similarity index 100% rename from services/mailer/application/template/footer/static/image/logo.svg rename to services/print/application/template/header/image/logo.svg diff --git a/services/print/application/template/header/index.html b/services/print/application/template/header/index.html index 30c2a21f1..44e8e52d7 100644 --- a/services/print/application/template/header/index.html +++ b/services/print/application/template/header/index.html @@ -1,5 +1,5 @@
- VerdNatura + VerdNatura

{{_.mercantileRegistry}}
{{_.fiscalAddress}}
diff --git a/services/print/application/template/header/static/image/action.png b/services/print/application/template/header/static/image/action.png deleted file mode 100644 index 2cd16c453..000000000 Binary files a/services/print/application/template/header/static/image/action.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/facebook.png b/services/print/application/template/header/static/image/facebook.png deleted file mode 100644 index 7ab54c538..000000000 Binary files a/services/print/application/template/header/static/image/facebook.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/header.png b/services/print/application/template/header/static/image/header.png deleted file mode 100644 index 3c063ae44..000000000 Binary files a/services/print/application/template/header/static/image/header.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/info.png b/services/print/application/template/header/static/image/info.png deleted file mode 100644 index fb75cbc4e..000000000 Binary files a/services/print/application/template/header/static/image/info.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/instagram.png b/services/print/application/template/header/static/image/instagram.png deleted file mode 100644 index 66550c4a5..000000000 Binary files a/services/print/application/template/header/static/image/instagram.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/linkedin.png b/services/print/application/template/header/static/image/linkedin.png deleted file mode 100644 index 0d191e5ae..000000000 Binary files a/services/print/application/template/header/static/image/linkedin.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/logo.png b/services/print/application/template/header/static/image/logo.png deleted file mode 100644 index 55e26fec6..000000000 Binary files a/services/print/application/template/header/static/image/logo.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/logo.svg b/services/print/application/template/header/static/image/logo.svg deleted file mode 100644 index 51baf46d3..000000000 --- a/services/print/application/template/header/static/image/logo.svg +++ /dev/null @@ -1,48 +0,0 @@ - - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/print/application/template/header/static/image/pinterest.png b/services/print/application/template/header/static/image/pinterest.png deleted file mode 100644 index 4d7b28ef8..000000000 Binary files a/services/print/application/template/header/static/image/pinterest.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/twitter.png b/services/print/application/template/header/static/image/twitter.png deleted file mode 100644 index c4a8ab0c1..000000000 Binary files a/services/print/application/template/header/static/image/twitter.png and /dev/null differ diff --git a/services/print/application/template/header/static/image/youtube.png b/services/print/application/template/header/static/image/youtube.png deleted file mode 100644 index 11871deb5..000000000 Binary files a/services/print/application/template/header/static/image/youtube.png and /dev/null differ diff --git a/services/print/application/template/header/static/css/style.css b/services/print/application/template/header/style.css similarity index 100% rename from services/print/application/template/header/static/css/style.css rename to services/print/application/template/header/style.css diff --git a/services/mailer/static/images/action.png b/services/print/application/template/letter-debtor/image/action.png similarity index 100% rename from services/mailer/static/images/action.png rename to services/print/application/template/letter-debtor/image/action.png diff --git a/services/mailer/static/images/facebook.png b/services/print/application/template/letter-debtor/image/facebook.png similarity index 100% rename from services/mailer/static/images/facebook.png rename to services/print/application/template/letter-debtor/image/facebook.png diff --git a/services/mailer/static/images/header.png b/services/print/application/template/letter-debtor/image/header.png similarity index 100% rename from services/mailer/static/images/header.png rename to services/print/application/template/letter-debtor/image/header.png diff --git a/services/mailer/static/images/info.png b/services/print/application/template/letter-debtor/image/info.png similarity index 100% rename from services/mailer/static/images/info.png rename to services/print/application/template/letter-debtor/image/info.png diff --git a/services/mailer/static/images/instagram.png b/services/print/application/template/letter-debtor/image/instagram.png similarity index 100% rename from services/mailer/static/images/instagram.png rename to services/print/application/template/letter-debtor/image/instagram.png diff --git a/services/mailer/static/images/linkedin.png b/services/print/application/template/letter-debtor/image/linkedin.png similarity index 100% rename from services/mailer/static/images/linkedin.png rename to services/print/application/template/letter-debtor/image/linkedin.png diff --git a/services/mailer/application/template/footer/static/image/logo.png b/services/print/application/template/letter-debtor/image/logo.png similarity index 100% rename from services/mailer/application/template/footer/static/image/logo.png rename to services/print/application/template/letter-debtor/image/logo.png diff --git a/services/mailer/application/template/header/static/image/logo.svg b/services/print/application/template/letter-debtor/image/logo.svg similarity index 100% rename from services/mailer/application/template/header/static/image/logo.svg rename to services/print/application/template/letter-debtor/image/logo.svg diff --git a/services/mailer/static/images/pinterest.png b/services/print/application/template/letter-debtor/image/pinterest.png similarity index 100% rename from services/mailer/static/images/pinterest.png rename to services/print/application/template/letter-debtor/image/pinterest.png diff --git a/services/mailer/static/images/twitter.png b/services/print/application/template/letter-debtor/image/twitter.png similarity index 100% rename from services/mailer/static/images/twitter.png rename to services/print/application/template/letter-debtor/image/twitter.png diff --git a/services/mailer/static/images/youtube.png b/services/print/application/template/letter-debtor/image/youtube.png similarity index 100% rename from services/mailer/static/images/youtube.png rename to services/print/application/template/letter-debtor/image/youtube.png diff --git a/services/print/application/template/letter-debtor/index.html b/services/print/application/template/letter-debtor/index.html new file mode 100644 index 000000000..a2d92979b --- /dev/null +++ b/services/print/application/template/letter-debtor/index.html @@ -0,0 +1,84 @@ + + + + {{_.subject}} + + + + + {{$.header}} + + + +
+ +
+
+
+

EXTRACTO

+
+
CLIENTE:
+
{{clientId}}
+
+
+
FACTURA:
+
x
+
+
+
FECHA:
+
{{currentDate}}
+
+
+
+
+
+

+ {{supplierName}} +

+
+ {{supplierStreet}} +
+
+ {{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}}) +
+
+ {{supplierCountry}} +
+
+
+
+ +
+
+
Fecha
+
Concepto
+
Debe
+
Haber
+
Saldo
+
+
+
Fecha
+
Concepto
+
Debe
+
Haber
+
Saldo
+
+
+ +
+ +
+
+ Subtotal +
+
+
+ +
+ + + + {{$.footer}} + + + \ No newline at end of file diff --git a/services/print/application/template/letter-debtor/letter-debtor.js b/services/print/application/template/letter-debtor/letter-debtor.js new file mode 100644 index 000000000..77715f3b7 --- /dev/null +++ b/services/print/application/template/letter-debtor/letter-debtor.js @@ -0,0 +1,54 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class LetterDebtor { + getData(params, cb) { + let query = `SELECT + c.id clientId, + m.code mandateCode, + LOWER(ct.code) AS countryCode, + c.email AS recipient, + c.socialName AS clientName, + c.street AS clientStreet, + c.postcode AS clientPostCode, + c.city AS clientCity, + p.name AS clientProvince, + ct.country AS clientCountry, + s.name AS supplierName, + s.street AS supplierStreet, + sc.country AS supplierCountry, + s.postCode AS supplierPostCode, + s.city AS supplierCity, + sp.name AS supplierProvince + FROM client c + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN province p ON p.id = c.provinceFk + LEFT JOIN mandate m ON m.clientFk = c.id AND m.finished IS NULL + LEFT JOIN supplier s ON s.id = m.companyFk + LEFT JOIN country sc ON sc.id = s.countryFk + LEFT JOIN province sp ON sp.id = s.provinceFk + WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + cb(); + }); + } + + // Swift BIC fields + get swiftFields() { + return new Array(11); + } + + // Account number fields + get accountNumberFields() { + return new Array(23); + } + + get currentDate() { + return format.date(new Date(), '/'); + } +}; diff --git a/services/print/application/template/letter-debtor/locale/es.json b/services/print/application/template/letter-debtor/locale/es.json new file mode 100644 index 000000000..e5453e858 --- /dev/null +++ b/services/print/application/template/letter-debtor/locale/es.json @@ -0,0 +1,31 @@ +{ + "title": "Orden de domiciliación de adeudo directo SEPA CORE", + "toCompleteBySupplier": "A cumplimentar por el acreedor", + "toCompleteByClient": "A cumplimentar por el deudor", + "bodyDescription": "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.", + "orderReference": "Referencia de la orden de domiciliación", + "supplierIdentifier": "Identificador del acreedor", + "supplierName": "Nombre del acreedor", + "supplierStreet": "Dirección", + "supplierLocation": "CP - Población - Provincia", + "supplierCountry": "País", + "clientAdvice": "Debe llevar a su Entidad Bancaria una copia del documento firmado para que lo registre y evitar la devolución.", + "clientName": "Nombre del deudor/es", + "clientStreet": "Dirección del deudor", + "clientLocation": "CP - Población - Provincia", + "clientCountry": "País del deudor", + "swift": "Swift BIC", + "accountNumber": "Número de cuenta - IBAN", + "accountHolder": "(Titular/es de la cuenta de cargo)", + "accountNumberFormat": "En España el IBAN consta de 24 posiciones comenzando siempre por ES", + "paymentType": "Tipo de pago", + "recurrent": "Recurrente", + "unique": "Único", + "signLocation": "Fecha - Localidad", + "sign": "Firma del deudor y sello", + "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.", + "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es", + "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre 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.", + "privacyLaw": "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." +} \ No newline at end of file diff --git a/services/print/application/template/sepa-core/static/css/style.css b/services/print/application/template/letter-debtor/style.css similarity index 100% rename from services/print/application/template/sepa-core/static/css/style.css rename to services/print/application/template/letter-debtor/style.css diff --git a/services/print/application/template/sepa-core/index.html b/services/print/application/template/sepa-core/index.html index 867da43d9..92cc6fb80 100644 --- a/services/print/application/template/sepa-core/index.html +++ b/services/print/application/template/sepa-core/index.html @@ -14,8 +14,8 @@
-

{{_.title}}

-
+

{{_.title}}

+
{{_.toCompleteBySupplier}}
diff --git a/services/print/application/template/sepa-core/sepa-core.js b/services/print/application/template/sepa-core/sepa-core.js index 74e08fd31..304e327da 100644 --- a/services/print/application/template/sepa-core/sepa-core.js +++ b/services/print/application/template/sepa-core/sepa-core.js @@ -10,7 +10,7 @@ module.exports = class SepaCore { LOWER(ct.code) AS countryCode, c.email AS recipient, c.socialName AS clientName, - c.postalAddress AS clientStreet, + c.street AS clientStreet, c.postcode AS clientPostCode, c.city AS clientCity, p.name AS clientProvince, diff --git a/services/print/application/template/sepa-core/static/image/action.png b/services/print/application/template/sepa-core/static/image/action.png deleted file mode 100644 index 2cd16c453..000000000 Binary files a/services/print/application/template/sepa-core/static/image/action.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/facebook.png b/services/print/application/template/sepa-core/static/image/facebook.png deleted file mode 100644 index 7ab54c538..000000000 Binary files a/services/print/application/template/sepa-core/static/image/facebook.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/header.png b/services/print/application/template/sepa-core/static/image/header.png deleted file mode 100644 index 3c063ae44..000000000 Binary files a/services/print/application/template/sepa-core/static/image/header.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/info.png b/services/print/application/template/sepa-core/static/image/info.png deleted file mode 100644 index fb75cbc4e..000000000 Binary files a/services/print/application/template/sepa-core/static/image/info.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/instagram.png b/services/print/application/template/sepa-core/static/image/instagram.png deleted file mode 100644 index 66550c4a5..000000000 Binary files a/services/print/application/template/sepa-core/static/image/instagram.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/linkedin.png b/services/print/application/template/sepa-core/static/image/linkedin.png deleted file mode 100644 index 0d191e5ae..000000000 Binary files a/services/print/application/template/sepa-core/static/image/linkedin.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/logo.png b/services/print/application/template/sepa-core/static/image/logo.png deleted file mode 100644 index 55e26fec6..000000000 Binary files a/services/print/application/template/sepa-core/static/image/logo.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/logo.svg b/services/print/application/template/sepa-core/static/image/logo.svg deleted file mode 100644 index 51baf46d3..000000000 --- a/services/print/application/template/sepa-core/static/image/logo.svg +++ /dev/null @@ -1,48 +0,0 @@ - - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/print/application/template/sepa-core/static/image/pinterest.png b/services/print/application/template/sepa-core/static/image/pinterest.png deleted file mode 100644 index 4d7b28ef8..000000000 Binary files a/services/print/application/template/sepa-core/static/image/pinterest.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/twitter.png b/services/print/application/template/sepa-core/static/image/twitter.png deleted file mode 100644 index c4a8ab0c1..000000000 Binary files a/services/print/application/template/sepa-core/static/image/twitter.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/static/image/youtube.png b/services/print/application/template/sepa-core/static/image/youtube.png deleted file mode 100644 index 11871deb5..000000000 Binary files a/services/print/application/template/sepa-core/static/image/youtube.png and /dev/null differ diff --git a/services/print/application/template/sepa-core/style.css b/services/print/application/template/sepa-core/style.css new file mode 100644 index 000000000..5b1e628d6 --- /dev/null +++ b/services/print/application/template/sepa-core/style.css @@ -0,0 +1,22 @@ +img { + margin: 0 +} + +.body { + font-family: arial, sans-serif; + max-width: 90%; + margin: 0 auto; + font-size: 14px; + color: #000 +} + +body .title { + text-align: center; + padding-bottom: 20px +} + +body .title h1 { + font-size: 16px; + color: #333; + margin: 0 +} \ No newline at end of file diff --git a/services/print/server/server.js b/services/print/server/server.js index 9ef4074ea..c94a4f834 100644 --- a/services/print/server/server.js +++ b/services/print/server/server.js @@ -10,13 +10,8 @@ var path = require('path'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); -// Auth middleware -var requestToken = function(request, response, next) { - auth.init(request, response, next); -}; - // Load routes -app.use('/', requestToken, require('../application/router.js')); +app.use('/', require('../application/router.js')); app.start = function() { var listener = app.listen(config.app.port, function() { diff --git a/services/print/static/css/component.css b/services/print/static/css/component.css index e7fc24b0a..2b2b8e157 100644 --- a/services/print/static/css/component.css +++ b/services/print/static/css/component.css @@ -1,170 +1,203 @@ -body { - margin: 0 auto; - width: 210mm -} - -.panel { - border: 1px solid #DDD; - margin-bottom: 10px; - position: relative; - padding:10px -} - -.row { - margin-bottom: 15px; - overflow: hidden -} - -.row .text { - margin-bottom: 5px -} - -.row .control { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box -} - -.row .text, .row .control { - overflow: hidden -} - -.row .description { - position: relative; - padding-top: 2px; - overflow: hidden; - font-size: 8px; - display: block; - color: #999 -} - -.row .line { - border-bottom: 1px solid #DDD; - border-right: 1px solid #DDD; - border-left: 1px solid #DDD; - margin-top: 10px; - color: #999; - padding: 5px -} - -.row .description span { - background-color: #FFF; - margin: -5px 0 0 50px; - display: block; - padding: 5px; - float: left -} - -.row:last-child { - margin-bottom: 0 -} - -.row.inline .text { - margin-bottom: 0; - width: 40%; - float: left -} - -.row.inline .control { - font-weight: bold; - padding-left: 20px; - color: #000; - width: 60%; - float: left -} - -.row.inline .description { - position: static; - overflow: visible -} - -.box { - border-top: 1px solid #CCC; - border-right: 1px solid #CCC; - border-bottom: 1px solid #CCC; - font-weight: bold; - text-align: center; - padding-top: 4px; - width: 25px; - height: 21px; - color: #000; - float: left -} - -.box.crossed { - font-weight: 100; - font-size: 16px -} - -.row .control .box:first-child { - border-left: 1px solid #CCC; -} - -p { - text-align: justify -} - -.font.small { - font-size: 10px -} - -.font.verticalAlign { - height: 27px; - line-height: 27px -} - -.font.centered { - height: 27px; - line-height: 27px; - text-align: center -} - -.verticalText { - -moz-transform: rotate(90deg); - -webkit-transform: rotate(90deg); - transform: rotate(90deg); - position: absolute; - text-align: center; - font-size: .65em; - width: 200px; - right: -115px; - top: 50% -} - -.columns:after { - display: block; - content: ' '; - clear: both -} - -.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 -} - - - - - - - +body { + margin: 0 auto; + width: 210mm +} + +img { + margin: 0 +} + +p { + text-align: justify +} + +.panel { + border: 1px solid #DDD; + margin-bottom: 10px; + position: relative; + padding:10px +} + +.row { + margin-bottom: 15px; + overflow: hidden +} + +.row.small { + margin-bottom: 5px +} + +.row .text { + margin-bottom: 5px +} + +.row .control { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box +} + +.row .text, .row .control { + overflow: hidden +} + +.row .description { + position: relative; + padding-top: 2px; + overflow: hidden; + font-size: 9px; + display: block; + color: #999 +} + +.row .line { + border-bottom: 1px solid #DDD; + border-right: 1px solid #DDD; + border-left: 1px solid #DDD; + margin-top: 10px; + color: #999; + padding: 5px +} + +.row .description span { + background-color: #FFF; + margin: -5px 0 0 50px; + display: block; + padding: 5px; + float: left +} + +.row:last-child { + margin-bottom: 0 +} + +.row.inline .text { + margin-bottom: 0; + width: 40%; + float: left +} + +.row.inline .control { + font-weight: bold; + padding-left: 20px; + color: #000; + width: 60%; + float: left +} + +.row.inline .description { + position: static; + overflow: visible +} + +.box { + border-top: 1px solid #CCC; + border-right: 1px solid #CCC; + border-bottom: 1px solid #CCC; + font-weight: bold; + text-align: center; + padding-top: 4px; + width: 25px; + height: 21px; + color: #000; + float: left +} + +.box.crossed { + font-weight: 100; + font-size: 16px +} + +.row .control .box:first-child { + border-left: 1px solid #CCC; +} + +.font.small { + font-size: 10px +} + +.font.gray { + color: #555 +} + +.font.verticalAlign { + height: 27px; + line-height: 27px +} + +.font.centered { + height: 27px; + line-height: 27px; + text-align: center +} + +.verticalText { + -moz-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + position: absolute; + text-align: center; + font-size: .65em; + width: 200px; + right: -115px; + top: 50% +} + +.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 +} + +.pull-left { + float: left +} + +.pull-right { + float: right +} + + +.grid { + border-bottom: 3px solid #888888 +} + +.grid .row { + padding: 5px; + margin-bottom: 0 +} + +.grid .header { + border-bottom: 1px solid #808080; + border-top: 1px solid #808080; + background-color: #c0c0c0; +} + + +.grid .row.inline > div { + float: left; +} +