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:
Juan Ferrer 2019-04-10 15:47:39 +02:00
commit c3b4c18ba7
84 changed files with 252 additions and 124 deletions

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
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 params = {
recipientFk: 1,

View File

@ -0,0 +1,13 @@
DROP TABLE IF EXISTS `vn`.`ticketServiceType`;
CREATE TABLE vn.`ticketServiceType` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de los posibles servicios a elegir';
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Porte Agencia');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Portes Retorno');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Porte Carry');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Cargo FITOSANITARIO');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Documentos');

View File

@ -355,15 +355,15 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
(2, 2 , 6000, DATE_ADD(CURDATE(), INTERVAL -2 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
(1, 56, CURDATE(), 1, 1, 'first route', null, 10, CURDATE(), CURDATE()),
(2, 56, CURDATE(), 1, 1, 'second route', 4.2, 20, CURDATE(), CURDATE()),
(3, 56, CURDATE(), 2, 7, 'third route', 5.3, 30, CURDATE(), CURDATE()),
(4, 56, CURDATE(), 3, 7, 'fourth route', 6.4, 40, CURDATE(), CURDATE()),
(5, 56, CURDATE(), 4, 8, 'fifth route', 7.5, 50, CURDATE(), CURDATE()),
(6, 57, CURDATE(), 5, 8, 'sixth route', 8.6, 60, CURDATE(), CURDATE()),
(7, 57, CURDATE(), 6, null, 'seventh route', 9.7, 70, CURDATE(), CURDATE());
(1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', null, 10, CURDATE(), CURDATE()),
(2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 1, 'second route', 4.2, 20, CURDATE(), CURDATE()),
(3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', 5.3, 30, CURDATE(), CURDATE()),
(4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 7, 'fourth route', 6.4, 40, CURDATE(), CURDATE()),
(5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 8, 'fifth route', 7.5, 50, CURDATE(), CURDATE()),
(6, null, 57, CURDATE(), 5, 8, 'sixth route', 8.6, 60, CURDATE(), CURDATE()),
(7, null, 57, CURDATE(), 6, null, 'seventh route', 9.7, 70, CURDATE(), CURDATE());
INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
VALUES
@ -771,10 +771,10 @@ INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuant
INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`)
VALUES
(1, 1 ,1 ),
(2, 1 ,2 ),
(3, 1 ,3 ),
(4, 2 ,4 );
(1, 1, 1111111111),
(2, 1, 2222222222),
(3, 1, 3333333333),
(4, 2, 4444444444);
INSERT INTO `vn`.`itemPlacement`(`id`, `itemFk`, `warehouseFk`, `code`)
VALUES

View File

@ -455,7 +455,7 @@ export default {
},
ticketService: {
addServiceButton: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(3) > vn-icon-button > button > vn-icon',
firstDescriptionInput: 'vn-ticket-service vn-textfield[label="Description"] input',
firstDescriptionInput: 'vn-ticket-service vn-autocomplete[label="Documentos"]',
firstQuantityInput: 'vn-ticket-service vn-input-number[label="Quantity"] input',
firstPriceInput: 'vn-ticket-service vn-input-number[label="Price"] input',
firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
@ -582,7 +582,6 @@ export default {
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[model="ticket.priority"] input',
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[model="ticket.priority"] input',
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[model="ticket.priority"] input',
fifthTicketPriority: 'vn-route-tickets vn-tr:nth-child(5) vn-textfield[model="ticket.priority"] input',
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check md-checkbox',
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',

View File

@ -118,7 +118,7 @@ describe('Client risk path', () => {
let result = await nightmare
.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() => {

View File

@ -55,7 +55,7 @@ describe('Ticket services path', () => {
expect(result).toEqual('General VAT');
});
it('should delete the service', async() => {
fit('should delete the service', async() => {
const result = await nightmare
.waitToClick(selectors.ticketService.fistDeleteServiceButton)
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)

View File

@ -7,19 +7,10 @@ describe('Route basic Data path', () => {
beforeAll(() => {
nightmare
.loginAndModule('delivery', 'route')
.accessToSearchResult(1)
.accessToSearchResult(2)
.accessToSection('route.card.tickets');
});
it('should modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 5)
.write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should now modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 4)
@ -85,13 +76,6 @@ describe('Route basic Data path', () => {
expect(result).toEqual('4');
});
it('should confirm the fifth ticket priority', async() => {
const result = await nightmare
.waitToGetProperty(selectors.routeTickets.fifthTicketPriority, 'value');
expect(result).toEqual('5');
});
it('should confirm the buscamanButton is disabled', async() => {
const result = await nightmare
.evaluate(selector => {
@ -115,7 +99,7 @@ describe('Route basic Data path', () => {
const result = await nightmare
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
expect(result).toEqual(5);
expect(result).toEqual(4);
});
it('should delete the first ticket in route', async() => {
@ -131,6 +115,6 @@ describe('Route basic Data path', () => {
const result = await nightmare
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
expect(result).toEqual(4);
expect(result).toEqual(3);
});
});

View File

@ -21,6 +21,8 @@ export default class InputNumber extends Input {
if (!isNaN(this.value))
this.input.value = this.value;
this.validateValue();
this.emit('change', {event});
});
@ -42,8 +44,11 @@ export default class InputNumber extends Input {
* @param {Number} value - Value
*/
set value(value) {
if (!this.hasOwnProperty('_value') && value)
this.input.value = value;
this._value = value;
this.hasValue = this._value !== null;
this.hasValue = !(value === null || value === undefined || value === '');
if (this.hasValue)
this.element.classList.add('not-empty');
@ -102,6 +107,10 @@ export default class InputNumber extends Input {
this.input.step = value;
}
get validationError() {
return this.input.validationMessage;
}
/**
* Increases the input value
*/
@ -131,12 +140,42 @@ export default class InputNumber extends Input {
*/
validateValue() {
if (!this.hasValidValue()) {
this.element.querySelector('.infix')
.classList.add('invalid', 'validated');
} else {
this.element.querySelector('.infix')
.classList.remove('invalid', 'validated');
}
this.hideError();
this.showError();
} else
this.hideError();
}
/**
* Shows the input validation error
*/
showError() {
const infixElement = this.element.querySelector('.infix');
const infixClassList = infixElement.classList;
const errorSpan = document.createElement('span');
errorSpan.className = 'mdl-textfield__error';
const errorText = document.createTextNode(this.validationError);
errorSpan.append(errorText);
infixElement.append(errorSpan);
infixClassList.add('validated', 'invalid');
}
/**
* Hides the input validation error
*/
hideError() {
const infixElement = this.element.querySelector('.infix');
const infixClassList = infixElement.classList;
const errorElement = this.element.querySelector('.infix span.mdl-textfield__error');
if (errorElement)
errorElement.remove();
infixClassList.remove('validated', 'invalid');
}
}

View File

@ -50,7 +50,7 @@ describe('Component vnInputNumber', () => {
controller.validateValue();
let classes = controller.element.querySelector('.infix').classList.toString();
expect(classes).not.toContain('invalid validated');
expect(classes).not.toContain('validated invalid');
});
it(`should call hasValidValue() and add the class invalid and validated`, () => {
@ -60,7 +60,7 @@ describe('Component vnInputNumber', () => {
controller.validateValue();
let classes = controller.element.querySelector('.infix').classList.toString();
expect(classes).toContain('invalid validated');
expect(classes).toContain('validated invalid');
});
});
});

View File

@ -24,7 +24,13 @@
}
.icon-agency:before {
content: "\e952";
content: "\e910";
}
.icon-delivery:before {
content: "\e94a";
}
.icon-wand:before {
content: "\e954";
}
.icon-unavailable:before {
content: "\e953";
@ -107,9 +113,6 @@
.icon-credit:before {
content: "\e90e";
}
.icon-delivery:before {
content: "\e910";
}
.icon-details:before {
content: "\e911";
}
@ -155,9 +158,6 @@
.icon-info:before {
content: "\e949";
}
.icon-invoices1:before {
content: "\e94a";
}
.icon-item:before {
content: "\e941";
}
@ -274,4 +274,4 @@
}
.icon-worker:before {
content: "\e943";
}
}

6
front/core/styles/salixfont.svg Normal file → Executable file
View File

@ -23,7 +23,7 @@
<glyph unicode="&#xe90d;" glyph-name="consignatarios" d="M409.6-64v349.867h204.8v-349.867h256v563.2h153.6l-512 460.8-512-460.8h153.6v-563.2h256z" />
<glyph unicode="&#xe90e;" glyph-name="credit" d="M921.6 849.067h-819.2c-55.467 0-102.4-42.667-102.4-98.133v-601.6c0-55.467 46.933-102.4 102.4-102.4h819.2c55.467 0 102.4 42.667 102.4 102.4v601.6c0 55.467-46.933 98.133-102.4 98.133zM921.6 145.067h-819.2v302.933h819.2v-302.933zM921.6 648.533h-819.2v102.4h819.2v-102.4z" />
<glyph unicode="&#xe90f;" glyph-name="columndelete" d="M0 960h256v-256h-256v256zM0 192h256v-256h-256v256zM0 576h256v-256h-256v256zM785.067 686.933l93.867-98.133-140.8-140.8 140.8-145.067-93.867-98.133-145.067 145.067-145.067-145.067-93.867 98.133 140.8 145.067-140.8 140.8 93.867 98.133 145.067-145.067z" />
<glyph unicode="&#xe910;" glyph-name="delivery" d="M1006.933 494.933l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-332.8h1024v38.4c0 17.067-8.533 34.133-17.067 46.933zM328.533 516.267c0-34.133-21.333-64-42.667-68.267 0 0-4.267 0-4.267 0l-72.533-8.533v38.4c0 34.133 21.333 64 42.667 68.267 0 0 4.267 0 4.267 0l72.533 8.533v-38.4zM332.8 580.267l-85.333-12.8c-34.133 0-59.733 29.867-55.467 72.533v51.2l85.333 12.8c34.133 4.267 55.467-25.6 55.467-72.533v-51.2zM435.2 499.2l-51.2-4.267c-17.067-4.267-29.867 12.8-29.867 38.4v25.6l46.933 8.533c17.067 4.267 29.867-17.067 29.867-38.4l4.267-29.867zM520.533 695.467c0-46.933-29.867-85.333-59.733-93.867-4.267 0-4.267 0-8.533 0l-98.133-17.067v55.467c0 46.933 29.867 85.333 59.733 93.867 4.267 0 4.267 0 8.533 0l98.133 12.8v-51.2zM921.6 486.4h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8zM789.333 307.2c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM789.333 153.6c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2zM1024 384v-110.933c0-25.6-21.333-51.2-51.2-51.2h-51.2c-8.533 64-68.267 115.2-136.533 115.2s-123.733-51.2-132.267-115.2h-268.8c-8.533 64-68.267 115.2-132.267 115.2-68.267 0-123.733-51.2-132.267-115.2h-68.267c-25.6 0-51.2 21.333-51.2 51.2v110.933h1024zM251.733 307.2c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM251.733 153.6c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2z" />
<glyph unicode="&#xe910;" glyph-name="agency" d="M789.333 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM789.333 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM251.733 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM251.733 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2zM1006.933 537.6l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933zM725.333 682.667c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067z" />
<glyph unicode="&#xe911;" glyph-name="details" d="M908.823 844.777v-797.867h-793.6v797.867h793.6zM972.823 959.977h-921.6c-29.867 0-51.2-21.333-51.2-51.2v-921.6c0-21.333 21.333-51.2 51.2-51.2h921.6c21.333 0 51.2 29.867 51.2 51.2v921.6c0 29.867-29.867 51.2-51.2 51.2zM456.556 733.844h341.333v-115.2h-341.333v115.2zM456.556 503.444h341.333v-115.2h-341.333v115.2zM456.556 277.31h341.333v-115.2h-341.333v115.2zM226.156 733.844h115.2v-115.2h-115.2v115.2zM226.156 503.444h115.2v-115.2h-115.2v115.2zM226.156 277.31h115.2v-115.2h-115.2v115.2z" />
<glyph unicode="&#xe912;" glyph-name="fiscal" d="M140.8 520.533v-341.333h149.333v341.333h-149.333zM439.467 520.533v-341.333h149.333v341.333h-149.333zM38.4-64h942.933v145.067h-942.933v-145.067zM733.867 520.533v-341.333h149.333v341.333h-149.333zM512 960l-473.6-243.2v-98.133h942.933v98.133l-469.333 243.2z" />
<glyph unicode="&#xe913;" glyph-name="doc" d="M614.4 960h-409.6c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h614.4c55.467 0 102.4 46.933 102.4 102.4v614.4l-307.2 307.2zM716.8 140.8h-409.6v102.4h409.6v-102.4zM716.8 345.6h-409.6v102.4h409.6v-102.4zM563.2 601.6v281.6l281.6-281.6h-281.6z" />
@ -81,7 +81,7 @@
<glyph unicode="&#xe947;" glyph-name="exit" d="M405.333 243.2l81.067-81.067 281.6 285.867-285.867 285.867-76.8-81.067 145.067-149.333h-550.4v-115.2h550.4l-145.067-145.067zM908.8 960h-793.6c-64 0-115.2-51.2-115.2-115.2v-226.133h115.2v226.133h797.867v-797.867h-797.867v230.4h-115.2v-226.133c0-64 51.2-115.2 115.2-115.2h797.867c64 0 115.2 51.2 115.2 115.2v793.6c-4.267 64-55.467 115.2-119.467 115.2z" />
<glyph unicode="&#xe948;" glyph-name="apps" d="M0 704h256v256h-256v-256zM384-64h256v256h-256v-256zM0-64h256v256h-256v-256zM0 320h256v256h-256v-256zM384 320h256v256h-256v-256zM768 960v-256h256v256h-256zM384 704h256v256h-256v-256zM768 320h256v256h-256v-256zM768-64h256v256h-256v-256z" />
<glyph unicode="&#xe949;" glyph-name="info" d="M512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM563.2 192h-102.4v307.2h102.4v-307.2zM563.2 601.6h-102.4v102.4h102.4v-102.4z" />
<glyph unicode="&#xe94a;" glyph-name="invoices1" d="M345.6 174.933h-89.6v102.4h81.067c4.267 34.133 8.533 68.267 21.333 102.4h-102.4v102.4h162.133c34.133 42.667 72.533 76.8 119.467 102.4h-281.6v102.4h520.533v-55.467c4.267 0 12.8 0 17.067 0 42.667 0 85.333-4.267 128-17.067v243.2c0 55.467-46.933 102.4-102.4 102.4h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h302.933c-81.067 55.467-136.533 140.8-153.6 238.933zM942.933 119.467l85.333-81.067c-25.6-34.133-59.733-59.733-102.4-76.8s-85.333-25.6-136.533-25.6c-46.933 0-93.867 8.533-132.267 25.6s-76.8 42.667-106.667 72.533c-29.867 29.867-51.2 68.267-64 110.933h-93.867v68.267h81.067c0 4.267 0 12.8 0 21.333s0 17.067 0 21.333h-81.067v68.267h93.867c12.8 42.667 34.133 76.8 64 110.933 29.867 29.867 64 55.467 106.667 72.533s85.333 25.6 132.267 25.6c51.2 0 93.867-8.533 136.533-25.6s76.8-42.667 102.4-76.8l-85.333-81.067c-38.4 46.933-89.6 68.267-145.067 68.267-38.4 0-68.267-8.533-98.133-25.6s-51.2-38.4-68.267-68.267h209.067v-68.267h-230.4c0-4.267 0-12.8 0-21.333s0-17.067 0-21.333h230.4v-68.267h-209.067c17.067-29.867 38.4-51.2 68.267-68.267s59.733-25.6 98.133-25.6c55.467 0 102.4 21.333 145.067 68.267z" />
<glyph unicode="&#xe94a;" glyph-name="delivery" d="M789.333 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM789.333 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM251.733 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM251.733 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2zM1006.933 537.6l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933zM725.333 682.667c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067zM311.467 597.333c0 46.933 29.867 85.333 59.733 93.867 4.267 0 4.267 0 8.533 0l98.133 12.8v-51.2c0-46.933-29.867-85.333-59.733-93.867-4.267 0-4.267 0-8.533 0l-98.133-17.067v55.467zM311.467 516.267l46.933 8.533c17.067 4.267 29.867-17.067 29.867-38.4l4.267-29.867-51.2-4.267c-17.067-4.267-29.867 12.8-29.867 38.4v25.6zM149.333 597.333v51.2l85.333 12.8c34.133 4.267 55.467-25.6 55.467-72.533v-51.2l-85.333-12.8c-34.133 0-59.733 29.867-55.467 72.533zM285.867 512v-38.4c0-34.133-21.333-64-42.667-68.267h-4.267l-72.533-8.533v38.4c0 34.133 21.333 64 42.667 68.267h4.267l72.533 8.533z" />
<glyph unicode="&#xe94b;" glyph-name="linesprepaired" d="M870.4 857.6h-213.333c-21.333 59.733-76.8 102.4-145.067 102.4s-123.733-42.667-145.067-102.4h-213.333c-55.467 0-102.4-46.933-102.4-102.4v-716.8c0-55.467 46.933-102.4 102.4-102.4h716.8c55.467 0 102.4 46.933 102.4 102.4v716.8c0 55.467-46.933 102.4-102.4 102.4zM512 857.6c29.867 0 51.2-21.333 51.2-51.2s-21.333-51.2-51.2-51.2-51.2 21.333-51.2 51.2 21.333 51.2 51.2 51.2zM614.4 140.8h-358.4v102.4h358.4v-102.4zM768 345.6h-512v102.4h512v-102.4zM768 550.4h-512v102.4h512v-102.4z" />
<glyph unicode="&#xe94c;" glyph-name="revision" d="M358.4 140.8h-102.4v102.4h81.067c0 0 0 4.267 0 4.267 0 34.133 8.533 68.267 21.333 98.133h-102.4v102.4h170.667c51.2 51.2 123.733 85.333 200.533 102.4h-371.2v102.4h512v-93.867c76.8-8.533 149.333-34.133 204.8-72.533v268.8c0 55.467-46.933 102.4-102.4 102.4h-213.333c-21.333 59.733-76.8 102.4-145.067 102.4s-123.733-42.667-145.067-102.4h-213.333c-55.467 0-102.4-46.933-102.4-102.4v-716.8c0-55.467 46.933-102.4 102.4-102.4h546.133c-157.867 8.533-290.133 89.6-341.333 204.8zM512 857.6c29.867 0 51.2-21.333 51.2-51.2s-21.333-51.2-51.2-51.2-51.2 21.333-51.2 51.2c0 29.867 21.333 51.2 51.2 51.2zM721.067 452.267c-136.533 0-251.733-85.333-302.933-204.8 46.933-119.467 162.133-204.8 302.933-204.8s251.733 85.333 302.933 204.8c-46.933 119.467-162.133 204.8-302.933 204.8zM721.067 110.933c-76.8 0-136.533 59.733-136.533 136.533s64 136.533 136.533 136.533 136.533-64 136.533-136.533-59.733-136.533-136.533-136.533zM721.067 328.533c-46.933 0-81.067-38.4-81.067-81.067s38.4-81.067 81.067-81.067c46.933 0 81.067 38.4 81.067 81.067s-34.133 81.067-81.067 81.067z" />
<glyph unicode="&#xe94d;" glyph-name="services" d="M951.467 217.6c0 8.533 0 21.333 0 29.867s0 21.333-4.267 29.867l64 51.2c4.267 4.267 8.533 12.8 4.267 21.333l-64 106.667c-4.267 8.533-12.8 8.533-17.067 8.533l-76.8-29.867c-17.067 12.8-34.133 21.333-51.2 29.867l-12.8 81.067c0 8.533-8.533 12.8-17.067 12.8h-123.733c-8.533 0-12.8-4.267-17.067-12.8l-12.8-81.067c-17.067-8.533-38.4-17.067-51.2-29.867l-76.8 29.867c-8.533 4.267-17.067 0-17.067-8.533l-64-106.667c-4.267-8.533-4.267-17.067 4.267-21.333l64-51.2c0-8.533-4.267-21.333-4.267-29.867s0-21.333 4.267-29.867l-55.467-51.2c-4.267-4.267-8.533-12.8-4.267-21.333l64-106.667c4.267-8.533 12.8-8.533 17.067-8.533l76.8 29.867c17.067-12.8 34.133-21.333 51.2-29.867l12.8-81.067c0-8.533 8.533-12.8 17.067-12.8h123.733c8.533 0 12.8 4.267 17.067 12.8l12.8 81.067c17.067 8.533 38.4 17.067 51.2 29.867l76.8-29.867c8.533-4.267 17.067 0 17.067 8.533l64 106.667c4.267 8.533 4.267 17.067-4.267 21.333 0 0-68.267 51.2-68.267 51.2zM721.067 132.267c-64 0-115.2 51.2-115.2 115.2s51.2 115.2 115.2 115.2 115.2-51.2 115.2-115.2c0-64-51.2-115.2-115.2-115.2zM345.6 174.933h-89.6v102.4h81.067c4.267 34.133 8.533 68.267 21.333 102.4h-102.4v102.4h162.133c34.133 42.667 72.533 76.8 119.467 102.4h-281.6v102.4h520.533v-59.733c51.2-8.533 102.4-25.6 145.067-51.2v281.6c0 55.467-46.933 102.4-102.4 102.4h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h302.933c-81.067 55.467-136.533 140.8-153.6 238.933z" />
@ -89,6 +89,6 @@
<glyph unicode="&#xe94f;" glyph-name="calendar" d="M883.2 866.133h-46.933v93.867h-93.867v-93.867h-465.067v93.867h-89.6v-93.867h-46.933c-51.2 0-93.867-42.667-93.867-93.867v-746.667c0-51.2 42.667-93.867 93.867-93.867h746.667c51.2 0 93.867 42.667 93.867 93.867v746.667c-4.267 51.2-46.933 93.867-98.133 93.867zM883.2 29.867h-742.4v605.867h746.667v-605.867z" />
<glyph unicode="&#xe950;" glyph-name="pbx" d="M512 960c-230.4 0-418.133-187.733-418.133-418.133v-324.267c0-76.8 64-140.8 140.8-140.8h140.8v371.2h-187.733v93.867c0 179.2 145.067 324.267 324.267 324.267s324.267-145.067 324.267-324.267v-93.867h-187.733v-371.2h187.733v-46.933h-324.267v-93.867h277.333c76.8 0 140.8 64 140.8 140.8v465.067c0 230.4-187.733 418.133-418.133 418.133z" />
<glyph unicode="&#xe951;" glyph-name="buscaman" d="M774.4 67.2c0-19.2-16-38.4-38.4-38.4s-38.4 16-38.4 38.4 16 38.4 38.4 38.4 38.4-19.2 38.4-38.4zM262.4 102.4c-19.2 0-38.4-16-38.4-38.4s16-38.4 38.4-38.4c19.2 0 38.4 16 38.4 38.4s-16 38.4-38.4 38.4zM809.6 176c0 0 0 0 0 0 35.2-22.4 57.6-64 57.6-108.8 0-70.4-57.6-131.2-131.2-131.2-70.4 0-131.2 57.6-131.2 131.2 0 0 0-3.2 0-3.2-64-3.2-137.6-9.6-214.4-12.8 0 0 0 0 0 0-6.4-64-64-115.2-128-115.2-70.4 0-131.2 57.6-131.2 131.2 0 54.4 32 99.2 80 121.6 0 0 0 0 0 0-3.2 89.6 0 198.4 16 275.2 0 0 73.6 73.6 243.2 86.4 6.4-16 19.2-28.8 38.4-28.8s32 12.8 38.4 28.8c12.8 0 25.6-3.2 38.4-3.2v-249.6c0 0 48-60.8 220.8-67.2zM345.6 67.2c0 44.8-35.2 80-80 80s-80-35.2-80-80c0-44.8 35.2-80 80-80 44.8-3.2 80 35.2 80 80zM416 454.4c0 9.6-6.4 16-16 16s-16-6.4-16-16c3.2-48-6.4-80-28.8-99.2-28.8-25.6-73.6-12.8-73.6-12.8-9.6 3.2-16-3.2-19.2-12.8s3.2-16 12.8-19.2c0 0 12.8-3.2 32-3.2s48 3.2 70.4 22.4c25.6 25.6 38.4 67.2 38.4 124.8zM819.2 67.2c0 44.8-35.2 80-80 80s-80-35.2-80-80c0-44.8 35.2-80 80-80 41.6-3.2 80 35.2 80 80zM886.4 806.4c-118.4 102.4-243.2 156.8-377.6 153.6-214.4-3.2-368-150.4-374.4-156.8-12.8-12.8-12.8-28.8 0-41.6s28.8-12.8 41.6 0c0 0 140.8 137.6 332.8 137.6 115.2 0 230.4-44.8 336-140.8 6.4-6.4 12.8-6.4 19.2-6.4 9.6 0 16 3.2 22.4 9.6 12.8 12.8 12.8 32 0 44.8zM806.4 720c-92.8 83.2-192 121.6-297.6 121.6-169.6-3.2-291.2-118.4-294.4-121.6-12.8-12.8-12.8-28.8 0-41.6s28.8-12.8 41.6 0c0 0 108.8 102.4 252.8 105.6 0 0 3.2 0 3.2 0 86.4 0 172.8-35.2 252.8-105.6 6.4-6.4 12.8-6.4 19.2-6.4 9.6 0 16 3.2 22.4 9.6 12.8 9.6 12.8 28.8 0 38.4zM732.8 636.8c-70.4 60.8-144 92.8-220.8 89.6-128 0-217.6-89.6-220.8-92.8-12.8-12.8-12.8-28.8 0-41.6s28.8-12.8 41.6 0c0 0 76.8 73.6 179.2 73.6 64 0 124.8-25.6 182.4-76.8 6.4-6.4 12.8-6.4 19.2-6.4 9.6 0 16 3.2 22.4 9.6 9.6 12.8 9.6 32-3.2 44.8zM512 585.6c-16 0-28.8-12.8-28.8-28.8s12.8-28.8 28.8-28.8c16 0 28.8 12.8 28.8 28.8-3.2 16-16 28.8-28.8 28.8z" />
<glyph unicode="&#xe952;" glyph-name="agency" d="M1006.933 494.933l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-332.8h1024v38.4c0 17.067-8.533 34.133-17.067 46.933zM921.6 486.4h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8zM789.333 307.2c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM789.333 153.6c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1024 384v-110.933c0-25.6-21.333-51.2-51.2-51.2h-51.2c-8.533 64-68.267 115.2-136.533 115.2s-123.733-51.2-132.267-115.2h-268.8c-8.533 64-68.267 115.2-132.267 115.2-68.267 0-123.733-51.2-132.267-115.2h-68.267c-25.6 0-51.2 21.333-51.2 51.2v110.933h1024zM251.733 307.2c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 153.6c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2z" />
<glyph unicode="&#xe953;" glyph-name="unavailable" d="M469.333 524.8v366.933h-136.533v-499.2zM290.133 345.6v546.133h-42.667v-588.8zM776.533 832v59.733h-42.667v-102.4zM644.267 699.733v192h-89.6c0 0 0-145.067 0-277.333l89.6 85.333zM866.133 682.667v-42.667c34.133-17.067 64-42.667 89.6-68.267v200.533l-89.6-89.6zM776.533 593.067l-64-64c8.533 0 17.067 4.267 25.6 4.267 85.333 0 149.333-68.267 149.333-149.333 0-85.333-68.267-149.333-149.333-149.333s-149.333 68.267-149.333 149.333c0 8.533 0 17.067 0 25.6l-68.267-68.267c8.533-38.4 21.333-72.533 46.933-102.4l-12.8-12.8h-25.6l-166.4-170.667 51.2-51.2 166.4 170.667v25.6l8.533 12.8c38.4-34.133 89.6-51.2 145.067-51.2 123.733 0 217.6 98.133 217.6 217.6 0 106.667-76.8 192-174.933 213.333zM157.867 213.333v678.4h-89.6v-733.867h29.867zM460.8 273.067l-119.467-115.2h21.333l102.4 102.4c-4.267 4.267-4.267 8.533-4.267 12.8zM964.267 960l59.733-59.733-964.267-964.267-59.733 59.733 964.267 964.267z" />
<glyph unicode="&#xe954;" glyph-name="wand" d="M829.649 565.029l-18.808-50.155-50.155-18.808 50.155-18.808 18.808-50.155 18.808 50.155 50.155 18.808-50.155 18.808-18.808 50.155zM624.849 870.139l-35.527 89.861-33.437-89.861-89.861-35.527 89.861-33.437 33.437-89.861 33.437 89.861 91.951 33.437-89.861 35.527zM969.665 819.984l-20.898 54.335-20.898-54.335-52.245-20.898 52.245-20.898 20.898-52.245 20.898 52.245 54.335 20.898-54.335 20.898zM783.673 648.62l-71.053 71.053c-4.18 4.18-8.359 4.18-12.539 4.18s-8.359-2.090-12.539-4.18l-681.273-681.273c0 0 0 0 0 0v0c-6.269-6.269-6.269-18.808 0-25.078l71.053-71.053c6.269-6.269 16.718-6.269 22.988 0v0c0 0 0 0 0 0l683.363 683.363c6.269 6.269 6.269 16.718 0 22.988zM626.939 506.514l-56.424 56.424 129.567 129.567 56.424-56.424-129.567-129.567z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

BIN
front/core/styles/salixfont.ttf Normal file → Executable file

Binary file not shown.

BIN
front/core/styles/salixfont.woff Normal file → Executable file

Binary file not shown.

View File

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

View File

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

View File

@ -32,31 +32,27 @@
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-input-number
vn-two
min="0"
step="1"
<vn-input-number vn-two
label="Traveling days"
field="$ctrl.zone.travelingDays">
model="$ctrl.zone.travelingDays"
min="0" step="1">
</vn-input-number>
<vn-input-time
vn-two
label="Estimated hour (ETD)"
field="$ctrl.zone.hour">
model="$ctrl.zone.hour">
</vn-input-time>
</vn-horizontal>
<vn-horizontal>
<vn-input-number vn-one
label="Price"
field="$ctrl.zone.price"
min="0.00"
step="0.10">
model="$ctrl.zone.price"
min="0" step="0.01">
</vn-input-number>
<vn-input-number vn-one
label="Bonus"
field="$ctrl.zone.bonus"
min="0.00"
step="0.10">
model="$ctrl.zone.bonus"
min="0" step="0.01">
</vn-input-number>
</vn-horizontal>
<vn-horizontal>

View File

@ -6,7 +6,7 @@ const app = require('vn-loopback/server/server');
* por destinatario inválido, pero puede llegar a fallar.
*/
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 result = await app.models.Sms.send(ctx, null, 'Invalid', 'My SMS Body');

View File

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

View File

@ -72,7 +72,7 @@ module.exports = Self => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {'i.id': {inq: value}}
? {or: [{'i.id': value}, {'ib.code': value}]}
: {'i.name': {like: `%${value}%`}};
case 'id':
return {'i.id': value};
@ -89,9 +89,6 @@ module.exports = Self => {
}
});
/* case 'hasVisible':
return value ? {'v.visible': {gt: 0}} : {'v.visible': {or: [{lte: 0}, {neq: null}]}}; */
filter = mergeFilters(ctx.args.filter, {where});
let stmts = [];
let stmt;
@ -117,22 +114,10 @@ module.exports = Self => {
LEFT JOIN origin ori ON ori.id = i.originFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk`
LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk
LEFT JOIN itemBarcode ib ON ib.itemFk = i.id`
);
/* if (ctx.args.hasVisible !== undefined) {
stmts.push('CALL cache.visible_refresh(@visibleCalc, false, 1)');
stmts.push('CALL cache.visible_refresh(@visibleCalc, false, 44)');
let joinAvailable = new ParameterizedSQL(
`LEFT JOIN cache.visible v
ON v.item_id = i.id`
);
stmt.merge(joinAvailable);
} */
/* where v.visible > 0
where v.visible <= 0 OR v.visible IS NULL
*/
if (ctx.args.tags) {
let i = 1;
for (const tag of ctx.args.tags) {
@ -156,13 +141,10 @@ where v.visible <= 0 OR v.visible IS NULL
}
stmt.merge(conn.makeWhere(filter.where));
/* if (ctx.args.hasVisible !== undefined)
stmt.merge(`GROUP BY i.id`);
*/
stmt.merge(`GROUP BY i.id`);
stmt.merge(conn.makePagination(filter));
let itemsIndex = stmts.push(stmt) - 1;
let itemsIndex = stmts.push(stmt) - 1;
let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql);
return itemsIndex === 0 ? result : result[itemsIndex];

View File

@ -1,6 +1,22 @@
const app = require('vn-loopback/server/server');
describe('item filter()', () => {
it('should return 1 result filtering by id', async() => {
let filter = {};
let result = await app.models.Item.filter({args: {filter: filter, search: 1}});
expect(result.length).toEqual(1);
expect(result[0].id).toEqual(1);
});
it('should return 1 result filtering by barcode', async() => {
let filter = {};
let result = await app.models.Item.filter({args: {filter: filter, search: 4444444444}});
expect(result.length).toEqual(1);
expect(result[0].id).toEqual(2);
});
it('should return 1 result using filter and tags', async() => {
let filter = {
order: 'isActive ASC, name',

View File

@ -9,9 +9,9 @@
<vn-card pad-large>
<vn-tool-bar margin-small-bottom >
<vn-button
label="Varita"
icon="icon-wand"
ng-click="$ctrl.guessPriority()"
vn-tooltip="Change ticket state to 'Ok'">
vn-tooltip="Sort routes">
</vn-button>
<vn-button
disabled="!$ctrl.isChecked"

View File

@ -3,3 +3,4 @@ Open buscaman: Abrir buscaman
Ticket deleted from route: Ticket borrado de la ruta
Order changed: Orden cambiado
Delete ticket from route?: ¿Borrar ticket de la ruta?
Sort routes: Ordenar rutas

View File

@ -56,6 +56,9 @@
"TicketService":{
"dataSource": "vn"
},
"TicketServiceType":{
"dataSource": "vn"
},
"TicketTracking": {
"dataSource": "vn"
},

View File

@ -0,0 +1,19 @@
{
"name": "TicketServiceType",
"options": {
"mysql": {
"table": "ticketServiceType"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "String",
"required": true
}
}
}

View File

@ -14,7 +14,8 @@ class Controller {
{callback: this.showDeliveryNote, name: 'Show Delivery Note', show: true},
{callback: this.showDeleteTicketDialog, name: 'Delete ticket', 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() {
this.$scope.addStowaway.show();
}

View File

@ -8,6 +8,7 @@ Add stowaway: Añadir 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?
Show Delivery Note: Ver albarán
Show pallet report: Mostrar hoja de pallet
Change shipped hour: Cambiar hora de envío
Shipped hour: Hora de envío
SMSPayment: >-

View File

@ -14,13 +14,14 @@
<vn-card pad-large>
<vn-one>
<vn-horizontal ng-repeat="service in services track by $index">
<vn-textfield
vn-one
<vn-autocomplete vn-one
vn-focus
url="/api/TicketServiceTypes"
label="Description"
model="service.description"
rule="TicketService.description">
</vn-textfield>
show-field="name"
value-field="name"
field="service.description">
</vn-autocomplete>
<vn-input-number vn-one min="0" step="1"
label="Quantity"
model="service.quantity"

View File

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