This commit is contained in:
Vicente Falco 2017-07-06 11:31:26 +02:00
commit a7af81383b
9 changed files with 270 additions and 154 deletions

View File

@ -26,7 +26,7 @@
on-change = "$ctrl.onChangeWareHouse(item)"
label="Store">
</vn-autocomplete>
<vn-icon-button vn-none pad-ten-top icon="refresh" ng-click="$ctrl.refreshTickets()"></vn-icon-button>
<vn-icon-button vn-none pad-ten-top margin-small-left icon="refresh" ng-click="$ctrl.refreshTickets()"></vn-icon-button>
</vn-one>
</vn-horizontal>
<vn-horizontal vn-one margin-large-bottom>

View File

@ -1,6 +1,7 @@
{
"Finder" : "Localizador",
"Error: No tickets selected!" : "Error: ¡No hay tickets seleccionados!",
"Error: Action not implemented!" : "Error: ¡Acción no implementada!",
"State" : "Estado",
"Alarm" : "Alarma",
"Agencies": "Agencias",

View File

@ -65,6 +65,18 @@ export default class ProductionActions {
}
);
}
_changeWorker(ids, workerFk, index) {
this.$http.put(`/production/api/Tickets/${workerFk}/changeWorker`, {tickets: ids}).then(
() => {
index.forEach(
i => {
this.tickets[i].workerFk = this.actionWorker.id;
this.tickets[i].worker = this.actionWorker.name;
}
);
}
);
}
doAction(actionName) {
let ids = [];
@ -93,8 +105,11 @@ export default class ProductionActions {
case 'changeTime':
this._changeTime(ids, this.actionHours.name, index);
break;
case 'changeWorker':
this._changeWorker(ids, this.actionWorker.id, index);
break;
default:
this.vnApp.showMessage(this.$translate.instant('Error: No jet implemented!'));
this.vnApp.showMessage(this.$translate.instant('Error: Action not implemented!'));
}
} else {
this.vnApp.showMessage(this.$translate.instant('Error: No tickets selected!'));

View File

@ -0,0 +1,27 @@
var express = require('express');
var router = new express.Router();
var mail = require('../mail.js');
var database = require('../database.js');
var template = require('../template.js');
// Escrito de cambios en méto de pago del cliente
router.post('/:userId/payment-update', function(request, response, next) {
database.pool.query('SELECT `e-mail` AS email, LOWER(p.Codigo) AS countryCode FROM Clientes AS c JOIN Paises AS p ON p.id = c.Id_Pais WHERE Id_Cliente = ?', [request.params.userId], function(error, qryRs) {
if (qryRs.length == 0)
return response.json({data: {message: 'Client not found'}});
template.getTemplate('payment-update', qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) {
if (error)
return response.json({data: {message: error}});
mail.send(qryRs[0].email, tplRs.subject, tplRs.body, tplRs.attachments, (mailrs, error) => {
if (error)
return response.json({data: {message: error}});
return response.json({data: {message: 'Mail sent'}});
});
});
});
});
module.exports = router;

View File

@ -0,0 +1,28 @@
var express = require('express');
var router = new express.Router();
var mail = require('../mail.js');
var database = require('../database.js');
var template = require('../template.js');
router.get('/:userId/notice', function(request, response) {
database.pool.query('SELECT `e-mail` AS email, LOWER(p.Codigo) AS countryCode FROM Clientes AS c JOIN Paises AS p ON p.id = c.Id_Pais WHERE Id_Cliente = ?', [request.params.userId], function(error, qryRs) {
if (qryRs.length == 0)
return response.json({data: {message: 'Client not found'}});
template.getTemplate('notice', qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) {
if (error)
return response.json({data: {message: error}});
mail.send(qryRs[0].email, tplRs.subject, tplRs.body, tplRs.attachments, (mailrs, error) => {
if (error)
return response.json({data: {message: error}});
return response.json({data: {message: 'Mail sent'}});
});
});
});
response.send(request.params.userid);
});
module.exports = router;

View File

@ -0,0 +1,35 @@
let database = require('../database.js');
module.exports = {
/**
* Devuelve el iban
* @param {String} addressNumber - Dirección de cuenta bancaria
* @param {Object} cb - Callback
*/
accountAddressIban: function(addressNumber, cb) {
database.pool.query('SELECT vn2008.cc_to_iban(?) AS iban', [addressNumber], function(error, result) {
cb(result[0].iban);
});
},
/**
* Obtiene el numero de cuenta completo incluyendo iban
* @param {String} addressNumber - Dirección de cuenta bancaria
* @return {String} Cuenta bancaria formateada
*/
accountAddress: function(addressNumber) {
var formattedAccountAddress = addressNumber.replace(/(.{4})/g, '$1-');
return formattedAccountAddress.substring(0, formattedAccountAddress.length - 1);
},
/**
* Devuelve el numero de cuenta mostrando únicamente los últimos 4 dígitos.
* @param {String} addressNumber - Dirección de cuenta bancaria
* @return {String} Cuenta bancaria formateada
*/
partialAccountAddress: function(addressNumber) {
let address = this.accountAddress(addressNumber);
return address.substring(0, 19).replace(/[0-9]/g, 'X') + address.substring(19, 24);
}
};

View File

@ -0,0 +1,10 @@
module.exports = {
/**
* Obtiene las variables de entorno
* @param {String} env - Nombre de la variable de entorno
* @return {String} Valor de la variable de entorno
*/
getEnv: function(env) {
return process.env[env];
}
};

View File

@ -1,74 +1,74 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div style="width: 600px;margin: 0 auto;font-family: arial, sans-serif;font-size: 16px;color: #555">
<!-- Banner block -->
<div>
<a href="https://www.verdnatura.es"/><img src="cid:header.png" alt="VerdNatura" style="margin:0"/></a>
</div>
<!-- Banner block end -->
<!-- Title block -->
<div style="padding: 35px 0;background-color:#95d831;text-align: center">
<h1 style="margin: 0;font-size: 32px;color: #333;">{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div style="padding: 20px 0">
<p style="text-align: justify">Hola, {{username}}</p>
<p style="text-align: justify">{{_.bodyDescription}}</p>
</div>
<!-- Mail body block end -->
<!-- Action button block -->
<div style="background-color: #333;overflow:hidden">
<a href="https://www.verdnatura.es" target="_blank" style="display:block;float:left;width:300px;height:72px;color:#fff;font-size:22px;text-decoration:none">
<div style="float:left;width:230px;padding:22px 0;height:72px;text-align:center">{{_.actionButton}}</div>
<div style="background-color:#95d831;text-align:center;float:right;padding-top:22px;height:50px;width:70px"><img style="margin:0" src="cid:action.png"/></div>
</a>
<a href="https://goo.gl/forms/j8WSL151ZW6QtlT72" target="_blank" style="display:block;float:left;width:300px;height:72px;color:#fff;font-size:22px;text-decoration:none">
<div style="float:left;width:230px;padding:22px 0;height:72px;text-align:center">{{_.infoButton}}</div>
<div style="background-color:#95d831;text-align:center;float:right;padding-top:22px;height:50px;width:70px"><img style="margin:0" src="cid:info.png"/></div>
</a>
</div>
<!-- Action button block end-->
<!-- Networks block -->
<div style="padding:20px 0;background-color:#555;text-align:center">
<a href="https://www.facebook.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:facebook.png" alt="Visita nuestro Facebook" style="margin:0"/>
</a>
<a href="https://www.twitter.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:twitter.png" alt="Visita nuestro Twitter" style="margin:0"/>
</a>
<a href="https://www.youtube.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:youtube.png" alt="Visita nuestro canal de Youtube" style="margin:0"/>
</a>
<a href="https://www.pinterest.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:pinterest.png" alt="Visita nuestro Pinterest" style="margin:0"/>
</a>
<a href="https://www.instagram.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:instagram.png" alt="Visita nuestro Instagram" style="margin:0"/>
</a>
<a href="https://www.linkedin.com/company/verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:linkedin.png" alt="Visita nuestro Linkedin" style="width:50px;margin:0"/>
</a>
</div>
<!-- Networks block end -->
<!-- Privacy block -->
<div style="padding:20px 0;font-size:10px;font-weight:100">
<p style="text-align: justify">{{_.fiscalAddress}}</p>
<p style="text-align: justify">{{_.privacy}}</p>
<p style="text-align: justify">{{_.privacyLaw}}</p>
</div>
<!-- Privacy block end -->
</div>
</body>
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div style="width: 600px;margin: 0 auto;font-family: arial, sans-serif;font-size: 16px;color: #555">
<!-- Banner block -->
<div>
<a href="https://www.verdnatura.es"/><img src="cid:header.png" alt="VerdNatura" style="margin:0"/></a>
</div>
<!-- Banner block end -->
<!-- Title block -->
<div style="padding: 35px 0;background-color:#95d831;text-align: center">
<h1 style="margin: 0;font-size: 32px;color: #333;">{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div style="padding: 20px 0">
<p style="text-align: justify">Hola, {{username}}</p>
<p style="text-align: justify">{{_.bodyDescription}}</p>
</div>
<!-- Mail body block end -->
<!-- Action button block -->
<div style="background-color: #333;overflow:hidden">
<a href="https://www.verdnatura.es" target="_blank" style="display:block;float:left;width:300px;height:72px;color:#fff;font-size:22px;text-decoration:none">
<div style="float:left;width:230px;padding:22px 0;height:72px;text-align:center">{{_.actionButton}}</div>
<div style="background-color:#95d831;text-align:center;float:right;padding-top:22px;height:50px;width:70px"><img style="margin:0" src="cid:action.png"/></div>
</a>
<a href="https://goo.gl/forms/j8WSL151ZW6QtlT72" target="_blank" style="display:block;float:left;width:300px;height:72px;color:#fff;font-size:22px;text-decoration:none">
<div style="float:left;width:230px;padding:22px 0;height:72px;text-align:center">{{_.infoButton}}</div>
<div style="background-color:#95d831;text-align:center;float:right;padding-top:22px;height:50px;width:70px"><img style="margin:0" src="cid:info.png"/></div>
</a>
</div>
<!-- Action button block end-->
<!-- Networks block -->
<div style="padding:20px 0;background-color:#555;text-align:center">
<a href="https://www.facebook.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:facebook.png" alt="Visita nuestro Facebook" style="margin:0"/>
</a>
<a href="https://www.twitter.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:twitter.png" alt="Visita nuestro Twitter" style="margin:0"/>
</a>
<a href="https://www.youtube.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:youtube.png" alt="Visita nuestro canal de Youtube" style="margin:0"/>
</a>
<a href="https://www.pinterest.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:pinterest.png" alt="Visita nuestro Pinterest" style="margin:0"/>
</a>
<a href="https://www.instagram.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:instagram.png" alt="Visita nuestro Instagram" style="margin:0"/>
</a>
<a href="https://www.linkedin.com/company/verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:linkedin.png" alt="Visita nuestro Linkedin" style="width:50px;margin:0"/>
</a>
</div>
<!-- Networks block end -->
<!-- Privacy block -->
<div style="padding:20px 0;font-size:10px;font-weight:100">
<p style="text-align: justify">{{_.fiscalAddress}}</p>
<p style="text-align: justify">{{_.privacy}}</p>
<p style="text-align: justify">{{_.privacyLaw}}</p>
</div>
<!-- Privacy block end -->
</div>
</body>
</html>

View File

@ -1,80 +1,80 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Banner block -->
<div class="banner">
<a href="https://www.verdnatura.es"/><img src="cid:header.png" alt="VerdNatura"/></a>
</div>
<!-- Banner block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p style="text-align: justify">{{_.dear}},</p>
<p style="text-align: justify">{{_.bodyDescription}}</p>
<p style="text-align: justify">
<div>{{_.paymentMethod}}: <strong style="font-size: 16px">{{payMethod}}</strong></div>
{{{paymentDay}}}
</p>
<p style="text-align: justify">{{paymentAdvice}}</p>
<p style="text-align: justify">{{_.notifyError}}</p>
</div>
<!-- Mail body block end -->
<!-- Action button block -->
<div class="buttons">
<a href="https://www.verdnatura.es" target="_blank"><div class="btn">
<span class="text">{{_.actionButton}}</span>
<span class="icon"><img src="cid:action.png"/></span>
</div></a><a href="https://goo.gl/forms/j8WSL151ZW6QtlT72" target="_blank"><div class="btn">
<span class="text">{{_.infoButton}}</span>
<span class="icon"><img src="cid:info.png"/></span>
</div></a>
</div>
<!-- Action button block -->
<!-- Networks block -->
<div class="footer">
<a href="https://www.facebook.com/Verdnatura" target="_blank">
<img src="cid:facebook.png" alt="Facebook"/>
</a>
<a href="https://www.twitter.com/Verdnatura" target="_blank">
<img src="cid:twitter.png" alt="Twitter"/>
</a>
<a href="https://www.youtube.com/Verdnatura" target="_blank">
<img src="cid:youtube.png" alt="Youtube"/>
</a>
<a href="https://www.pinterest.com/Verdnatura" target="_blank">
<img src="cid:pinterest.png" alt="Pinterest"/>
</a>
<a href="https://www.instagram.com/Verdnatura" target="_blank">
<img src="cid:instagram.png" alt="Instagram"/>
</a>
<a href="https://www.linkedin.com/company/verdnatura" target="_blank">
<img src="cid:linkedin.png" alt="Linkedin"/>
</a>
</div>
<!-- Networks block end -->
<!-- Privacy block -->
<div class="privacy">
<p style="text-align: justify">{{_.fiscalAddress}}</p>
<p style="text-align: justify">{{_.privacy}}</p>
<p style="text-align: justify">{{_.privacyLaw}}</p>
</div>
<!-- Privacy block end -->
</div>
</div>
</body>
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Banner block -->
<div class="banner">
<a href="https://www.verdnatura.es"/><img src="cid:header.png" alt="VerdNatura"/></a>
</div>
<!-- Banner block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p style="text-align: justify">{{_.dear}},</p>
<p style="text-align: justify">{{_.bodyDescription}}</p>
<p style="text-align: justify">
<div>{{_.paymentMethod}}: <strong style="font-size: 16px">{{payMethod}}</strong></div>
{{{paymentDay}}}
</p>
<p style="text-align: justify">{{paymentAdvice}}</p>
<p style="text-align: justify">{{_.notifyError}}</p>
</div>
<!-- Mail body block end -->
<!-- Action button block -->
<div class="buttons">
<a href="https://www.verdnatura.es" target="_blank"><div class="btn">
<span class="text">{{_.actionButton}}</span>
<span class="icon"><img src="cid:action.png"/></span>
</div></a><a href="https://goo.gl/forms/j8WSL151ZW6QtlT72" target="_blank"><div class="btn">
<span class="text">{{_.infoButton}}</span>
<span class="icon"><img src="cid:info.png"/></span>
</div></a>
</div>
<!-- Action button block -->
<!-- Networks block -->
<div class="footer">
<a href="https://www.facebook.com/Verdnatura" target="_blank">
<img src="cid:facebook.png" alt="Facebook"/>
</a>
<a href="https://www.twitter.com/Verdnatura" target="_blank">
<img src="cid:twitter.png" alt="Twitter"/>
</a>
<a href="https://www.youtube.com/Verdnatura" target="_blank">
<img src="cid:youtube.png" alt="Youtube"/>
</a>
<a href="https://www.pinterest.com/Verdnatura" target="_blank">
<img src="cid:pinterest.png" alt="Pinterest"/>
</a>
<a href="https://www.instagram.com/Verdnatura" target="_blank">
<img src="cid:instagram.png" alt="Instagram"/>
</a>
<a href="https://www.linkedin.com/company/verdnatura" target="_blank">
<img src="cid:linkedin.png" alt="Linkedin"/>
</a>
</div>
<!-- Networks block end -->
<!-- Privacy block -->
<div class="privacy">
<p style="text-align: justify">{{_.fiscalAddress}}</p>
<p style="text-align: justify">{{_.privacy}}</p>
<p style="text-align: justify">{{_.privacyLaw}}</p>
</div>
<!-- Privacy block end -->
</div>
</div>
</body>
</html>