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)" on-change = "$ctrl.onChangeWareHouse(item)"
label="Store"> label="Store">
</vn-autocomplete> </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-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal vn-one margin-large-bottom> <vn-horizontal vn-one margin-large-bottom>

View File

@ -1,6 +1,7 @@
{ {
"Finder" : "Localizador", "Finder" : "Localizador",
"Error: No tickets selected!" : "Error: ¡No hay tickets seleccionados!", "Error: No tickets selected!" : "Error: ¡No hay tickets seleccionados!",
"Error: Action not implemented!" : "Error: ¡Acción no implementada!",
"State" : "Estado", "State" : "Estado",
"Alarm" : "Alarma", "Alarm" : "Alarma",
"Agencies": "Agencias", "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) { doAction(actionName) {
let ids = []; let ids = [];
@ -93,8 +105,11 @@ export default class ProductionActions {
case 'changeTime': case 'changeTime':
this._changeTime(ids, this.actionHours.name, index); this._changeTime(ids, this.actionHours.name, index);
break; break;
case 'changeWorker':
this._changeWorker(ids, this.actionWorker.id, index);
break;
default: default:
this.vnApp.showMessage(this.$translate.instant('Error: No jet implemented!')); this.vnApp.showMessage(this.$translate.instant('Error: Action not implemented!'));
} }
} else { } else {
this.vnApp.showMessage(this.$translate.instant('Error: No tickets selected!')); 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> <!DOCTYPE html>
<html lang="es"> <html lang="es">
<head> <head>
<title>{{_.subject}}</title> <title>{{_.subject}}</title>
<meta charset="utf8"/> <meta charset="utf8"/>
</head> </head>
<body> <body>
<div style="width: 600px;margin: 0 auto;font-family: arial, sans-serif;font-size: 16px;color: #555"> <div style="width: 600px;margin: 0 auto;font-family: arial, sans-serif;font-size: 16px;color: #555">
<!-- Banner block --> <!-- Banner block -->
<div> <div>
<a href="https://www.verdnatura.es"/><img src="cid:header.png" alt="VerdNatura" style="margin:0"/></a> <a href="https://www.verdnatura.es"/><img src="cid:header.png" alt="VerdNatura" style="margin:0"/></a>
</div> </div>
<!-- Banner block end --> <!-- Banner block end -->
<!-- Title block --> <!-- Title block -->
<div style="padding: 35px 0;background-color:#95d831;text-align: center"> <div style="padding: 35px 0;background-color:#95d831;text-align: center">
<h1 style="margin: 0;font-size: 32px;color: #333;">{{_.title}}</h1> <h1 style="margin: 0;font-size: 32px;color: #333;">{{_.title}}</h1>
</div> </div>
<!-- Title block end --> <!-- Title block end -->
<!-- Mail body block --> <!-- Mail body block -->
<div style="padding: 20px 0"> <div style="padding: 20px 0">
<p style="text-align: justify">Hola, {{username}}</p> <p style="text-align: justify">Hola, {{username}}</p>
<p style="text-align: justify">{{_.bodyDescription}}</p> <p style="text-align: justify">{{_.bodyDescription}}</p>
</div> </div>
<!-- Mail body block end --> <!-- Mail body block end -->
<!-- Action button block --> <!-- Action button block -->
<div style="background-color: #333;overflow:hidden"> <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"> <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="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> <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>
<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"> <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="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> <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> </a>
</div> </div>
<!-- Action button block end--> <!-- Action button block end-->
<!-- Networks block --> <!-- Networks block -->
<div style="padding:20px 0;background-color:#555;text-align:center"> <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"> <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"/> <img src="cid:facebook.png" alt="Visita nuestro Facebook" style="margin:0"/>
</a> </a>
<a href="https://www.twitter.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px"> <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"/> <img src="cid:twitter.png" alt="Visita nuestro Twitter" style="margin:0"/>
</a> </a>
<a href="https://www.youtube.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px"> <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"/> <img src="cid:youtube.png" alt="Visita nuestro canal de Youtube" style="margin:0"/>
</a> </a>
<a href="https://www.pinterest.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px"> <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"/> <img src="cid:pinterest.png" alt="Visita nuestro Pinterest" style="margin:0"/>
</a> </a>
<a href="https://www.instagram.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px"> <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"/> <img src="cid:instagram.png" alt="Visita nuestro Instagram" style="margin:0"/>
</a> </a>
<a href="https://www.linkedin.com/company/verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px"> <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"/> <img src="cid:linkedin.png" alt="Visita nuestro Linkedin" style="width:50px;margin:0"/>
</a> </a>
</div> </div>
<!-- Networks block end --> <!-- Networks block end -->
<!-- Privacy block --> <!-- Privacy block -->
<div style="padding:20px 0;font-size:10px;font-weight:100"> <div style="padding:20px 0;font-size:10px;font-weight:100">
<p style="text-align: justify">{{_.fiscalAddress}}</p> <p style="text-align: justify">{{_.fiscalAddress}}</p>
<p style="text-align: justify">{{_.privacy}}</p> <p style="text-align: justify">{{_.privacy}}</p>
<p style="text-align: justify">{{_.privacyLaw}}</p> <p style="text-align: justify">{{_.privacyLaw}}</p>
</div> </div>
<!-- Privacy block end --> <!-- Privacy block end -->
</div> </div>
</body> </body>
</html> </html>

View File

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