Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-04-10 12:04:22 +02:00
commit 49ef341eb6
15 changed files with 111 additions and 36 deletions

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
describe('message send()', () => { describe('message send()', () => {
it('should call the send method and return the response', async() => { it('should return a response containing the same message in params', async() => {
let ctx = {req: {accessToken: {userId: 1}}}; let ctx = {req: {accessToken: {userId: 1}}};
let params = { let params = {
recipientFk: 1, recipientFk: 1,

View File

@ -355,15 +355,15 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
(2, 2 , 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL), (2, 2 , 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
(3, 3, 10000 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL); (3, 3, 10000 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL);
INSERT INTO `vn`.`route`(`id`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`) INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`)
VALUES VALUES
(1, 56, CURDATE(), 1, 1, 'first route', null, 10, CURDATE(), CURDATE()), (1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', null, 10, CURDATE(), CURDATE()),
(2, 56, CURDATE(), 1, 1, 'second route', 4.2, 20, CURDATE(), CURDATE()), (2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 1, 'second route', 4.2, 20, CURDATE(), CURDATE()),
(3, 56, CURDATE(), 2, 7, 'third route', 5.3, 30, CURDATE(), CURDATE()), (3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', 5.3, 30, CURDATE(), CURDATE()),
(4, 56, CURDATE(), 3, 7, 'fourth route', 6.4, 40, CURDATE(), CURDATE()), (4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 7, 'fourth route', 6.4, 40, CURDATE(), CURDATE()),
(5, 56, CURDATE(), 4, 8, 'fifth route', 7.5, 50, CURDATE(), CURDATE()), (5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 8, 'fifth route', 7.5, 50, CURDATE(), CURDATE()),
(6, 57, CURDATE(), 5, 8, 'sixth route', 8.6, 60, CURDATE(), CURDATE()), (6, null, 57, CURDATE(), 5, 8, 'sixth route', 8.6, 60, CURDATE(), CURDATE()),
(7, 57, CURDATE(), 6, null, 'seventh route', 9.7, 70, CURDATE(), CURDATE()); (7, null, 57, CURDATE(), 6, null, 'seventh route', 9.7, 70, CURDATE(), CURDATE());
INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`) INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
VALUES VALUES

View File

@ -118,7 +118,7 @@ describe('Client risk path', () => {
let result = await nightmare let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
expect(result).toContain('-€50.00'); expect(result).toContain('€50.00');
}); });
it('should now click on the Clients button of the top bar menu', async() => { it('should now click on the Clients button of the top bar menu', async() => {

View File

@ -1,22 +1,22 @@
<div ng-if="$ctrl.$state.current.name === 'home'"> <div ng-if="$ctrl.$state.current.name === 'home'">
<div class="modules"> <div class="modules">
<a <a
ng-repeat="mod in ::$ctrl.modules" ng-repeat="mod in ::$ctrl.modules"
ui-sref="{{::mod.route.state}}" ui-sref="{{::mod.route.state}}"
translate-attr="::{title: mod.name}" translate-attr="::{title: mod.name}"
class="mdl-shadow--4dp"> class="mdl-shadow--4dp">
<div> <div>
<vn-icon icon="{{::mod.icon || 'photo'}}"></vn-icon> <vn-icon icon="{{::mod.icon || 'photo'}}"></vn-icon>
</div> </div>
<h4 ng-bind-html="$ctrl.getModuleName(mod)"></h4> <h4 ng-bind-html="$ctrl.getModuleName(mod)"></h4>
<span <span
ng-show='mod.keyBind' ng-show='mod.keyBind'
vn-tooltip="Ctrl + Alt + {{mod.keyBind}}"> vn-tooltip="Ctrl + Alt + {{mod.keyBind}}">
({{::mod.keyBind}}) ({{::mod.keyBind}})
</span> </span>
<span ng-show='!mod.keyBind'>&nbsp;</span> <span ng-show='!mod.keyBind'>&nbsp;</span>
</a> </a>
</div> </div>
</div> </div>

View File

@ -16,7 +16,7 @@ vn-home {
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
max-width: 40em; max-width: 44em;
margin: 0 auto; margin: 0 auto;
& > a { & > a {
@ -28,7 +28,7 @@ vn-home {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 8em; height: 8em;
width: 7em; width: 8em;
margin: .5em; margin: .5em;
padding: 1em; padding: 1em;
justify-content: center; justify-content: center;
@ -49,13 +49,13 @@ vn-home {
text-align: center; text-align: center;
} }
& > h4 { & > h4 {
max-width: 7em;
text-align: center; text-align: center;
font-size: 16pt; font-size: 13pt;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden; overflow: hidden;
color: inherit; color: inherit;
margin: 0; margin: 0;
line-height: 1.5em;
/* & > .bind-letter { /* & > .bind-letter {
color: #FD0; color: #FD0;

View File

@ -6,7 +6,7 @@ const app = require('vn-loopback/server/server');
* por destinatario inválido, pero puede llegar a fallar. * por destinatario inválido, pero puede llegar a fallar.
*/ */
describe('sms send()', () => { describe('sms send()', () => {
it('should call the send method', async() => { it('should should return the expected message and status code', async() => {
let ctx = {req: {accessToken: {userId: 1}}}; let ctx = {req: {accessToken: {userId: 1}}};
let result = await app.models.Sms.send(ctx, null, 'Invalid', 'My SMS Body'); let result = await app.models.Sms.send(ctx, null, 'Invalid', 'My SMS Body');

View File

@ -1,7 +1,7 @@
{ {
"module": "invoiceOut", "module": "invoiceOut",
"name": "Invoices out", "name": "Invoices out",
"icon": "icon-invoices1", "icon": "icon-invoices",
"validations" : true, "validations" : true,
"dependencies": ["worker", "client", "ticket"], "dependencies": ["worker", "client", "ticket"],
"routes": [ "routes": [

View File

@ -14,7 +14,8 @@ class Controller {
{callback: this.showDeliveryNote, name: 'Show Delivery Note', show: true}, {callback: this.showDeliveryNote, name: 'Show Delivery Note', show: true},
{callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}, {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true},
{callback: this.showChangeShipped, name: 'Change shipped hour', show: true}, {callback: this.showChangeShipped, name: 'Change shipped hour', show: true},
{callback: this.showSMSDialog, name: 'Send SMS', show: true} {callback: this.showSMSDialog, name: 'Send SMS', show: true},
{callback: this.openRptRoute, name: 'Show pallet report', show: true}
]; ];
} }
@ -109,6 +110,11 @@ class Controller {
} }
} }
openRptRoute() {
let url = `/api/report/rpt-route?routeFk=${this.ticket.routeFk}`;
window.open(url);
}
showAddStowaway() { showAddStowaway() {
this.$scope.addStowaway.show(); this.$scope.addStowaway.show();
} }

View File

@ -8,6 +8,7 @@ Add stowaway: Añadir polizón
Remove stowaway: Borrar polizón Remove stowaway: Borrar polizón
Are you sure you want to delete this stowaway?: ¿Estas seguro de que quieres borrar este polizón? Are you sure you want to delete this stowaway?: ¿Estas seguro de que quieres borrar este polizón?
Show Delivery Note: Ver albarán Show Delivery Note: Ver albarán
Show pallet report: Mostrar hoja de pallet
Change shipped hour: Cambiar hora de envío Change shipped hour: Cambiar hora de envío
Shipped hour: Hora de envío Shipped hour: Hora de envío
SMSPayment: >- SMSPayment: >-

View File

@ -12,6 +12,7 @@
{"type": "report", "name": "rpt-letter-debtor"}, {"type": "report", "name": "rpt-letter-debtor"},
{"type": "report", "name": "rpt-sepa-core"}, {"type": "report", "name": "rpt-sepa-core"},
{"type": "report", "name": "rpt-receipt"}, {"type": "report", "name": "rpt-receipt"},
{"type": "report", "name": "rpt-route"},
{"type": "static", "name": "email-header"}, {"type": "static", "name": "email-header"},
{"type": "static", "name": "email-footer"}, {"type": "static", "name": "email-footer"},
{"type": "static", "name": "report-header"}, {"type": "static", "name": "report-header"},

View File

@ -0,0 +1,7 @@
const CssReader = require(`${appPath}/lib/cssReader`);
module.exports = new CssReader([
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -0,0 +1,9 @@
section .text {
font-family: Tahoma;
font-weight: bold;
color: white;
font-size: 7.5em;
text-align: center;
background-color: black;
margin-bottom: 0.2em
}

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="es">
<body>
<section class="container" id="report">
<section class="main">
<!-- Report start -->
<section class="text">{{route.agencyName}}</section>
<section class="text">{{route.id}}</section>
<section class="text">{{route.plateNumber}} {{routeTime(route.time)}}</section>
<section></section>
<!-- Report end -->
</section>
</section>
</body>
</html>

36
print/report/rpt-route/index.js Executable file
View File

@ -0,0 +1,36 @@
const strftime = require('strftime');
const database = require(`${appPath}/lib/database`);
const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = {
name: 'rpt-route',
async asyncData(ctx, params) {
if (!params.routeFk)
throw new UserException('No route id specified');
let [[route]] = await this.methods.fetchRoute(params.routeFk);
if (!route)
throw new UserException('Route not ready');
return {route};
},
methods: {
fetchRoute(routeFk) {
return database.pool.query(
`SELECT
r.id,
r.time,
am.name agencyName,
v.numberPlate plateNumber
FROM route r
JOIN agencyMode am ON am.id = r.agencyModeFk
JOIN vehicle v ON v.id = r.vehicleFk
WHERE r.id = ?`, [routeFk]);
},
routeTime: routeTime => {
if (routeTime)
return strftime('%H:%M', routeTime);
},
},
};

View File