fixes #4457 hasInvoiceElectronic-para-cliente #1116

Merged
pau merged 18 commits from 4457-hasInvoiceElectronic-para-cliente into dev 2022-11-24 09:45:45 +00:00
68 changed files with 919 additions and 212 deletions
Showing only changes of commit cb6ae41c13 - Show all commits

12
.vscode/settings.json vendored
View File

@ -2,13 +2,7 @@
{
// Carácter predeterminado de final de línea.
"files.eol": "\n",
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
"eslint.validate": [
"javascript",
"json"
]
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}

View File

@ -0,0 +1,4 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('Sale', 'editTracked', 'WRITE', 'ALLOW', 'ROLE', 'production'),
('Sale', 'editFloramondo', 'WRITE', 'ALLOW', 'ROLE', 'salesAssistant');

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`greuge` CHANGE `userFK` `userFk` int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1,88 @@
DROP PROCEDURE IF EXISTS `vn`.`timeBusiness_calculate`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
* Horas que debe trabajar un empleado según contrato y día.
* @param vDatedFrom workerTimeControl
* @param vDatedTo workerTimeControl
* @table tmp.user(userFk)
* @return tmp.timeBusinessCalculate
*/
DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate;
CREATE TEMPORARY TABLE tmp.timeBusinessCalculate
(INDEX (departmentFk))
SELECT dated,
businessFk,
userFk,
departmentFk,
hourStart,
hourEnd,
timeTable,
timeWorkSeconds,
SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal,
timeWorkSeconds / 3600 timeWorkDecimal,
timeWorkSeconds timeBusinessSeconds,
SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal,
timeWorkSeconds / 3600 timeBusinessDecimal,
name type,
permissionRate,
hoursWeek,
discountRate,
isAllowedToWork
FROM(SELECT t.dated,
b.id businessFk,
w.userFk,
b.departmentFk,
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart ,
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd,
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5), " - ", LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) timeTable,
IF(j.start = NULL, 0, IFNULL(SUM(TIME_TO_SEC(j.end)) - SUM(TIME_TO_SEC(j.start)), 0)) timeWorkSeconds,
at2.name,
at2.permissionRate,
at2.discountRate,
cl.hours_week hoursWeek,
at2.isAllowedToWork
FROM time t
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
LEFT JOIN worker w ON w.id = b.workerFk
JOIN tmp.`user` u ON u.userFK = w.userFK
LEFT JOIN workCenter wc ON wc.id = b.workcenterFK
LEFT JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = b.calendarTypeFk
LEFT JOIN postgresql.journey j ON j.business_id = b.id AND j.day_id = WEEKDAY(t.dated) + 1
LEFT JOIN postgresql.calendar_employee ce ON ce.businessFk = b.id AND ce.date = t.dated
LEFT JOIN absenceType at2 ON at2.id = ce.calendar_state_id
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
GROUP BY w.userFk, t.dated
)sub;
UPDATE tmp.timeBusinessCalculate t
LEFT JOIN postgresql.journey j ON j.business_id = t.businessFk
SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600,
t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600),
t.timeWorkDecimal = t.hoursWeek / 5,
t.timeBusinessSeconds = t.hoursWeek / 5 * 3600,
t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600),
t.timeBusinessDecimal = t.hoursWeek / 5
WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND j.journey_id IS NULL ;
UPDATE tmp.timeBusinessCalculate t
SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) ,
t.timeWorkSexagesimal = SEC_TO_TIME ((t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)) * 3600),
t.timeWorkDecimal = t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)
WHERE permissionRate <> 0;
UPDATE tmp.timeBusinessCalculate t
JOIN calendarHolidays ch ON ch.dated = t.dated
JOIN business b ON b.id = t.businessFk
AND b.workcenterFk = ch.workcenterFk
SET t.timeWorkSeconds = 0,
t.timeWorkSexagesimal = 0,
t.timeWorkDecimal = 0,
t.permissionrate = 1,
t.type = 'Festivo'
WHERE t.type IS NULL;
END$$
DELIMITER ;

View File

@ -984,7 +984,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
(30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE()),
(32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE());
(33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES
@ -1146,10 +1146,11 @@ INSERT INTO `vncontrol`.`accion`(`accion_id`, `accion`)
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
VALUES
(1, 0, util.VN_CURDATE(), 5, 55, 3, 1, 14),
(1, 1, util.VN_CURDATE(), 5, 54, 3, 2, 8),
(2, 1, util.VN_CURDATE(), 10, 40, 4, 3, 8),
(3, 1, util.VN_CURDATE(), 2, 40, 4, 4, 8);
(1, 0, util.VN_CURDATE(), 5, 55, 3, 1, 14),
(1, 1, util.VN_CURDATE(), 5, 54, 3, 2, 8),
(2, 1, util.VN_CURDATE(), 10, 40, 4, 3, 8),
(3, 1, util.VN_CURDATE(), 2, 40, 4, 4, 8),
(31, 1, util.VN_CURDATE(), -5, 40, 4, 5, 8);
INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`)
VALUES
@ -1356,7 +1357,8 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
(2, 1),
(3, 2),
(4, 4),
(5, 6);
(5, 6),
(15, 6);
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`)
VALUES
@ -2712,6 +2714,10 @@ INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `lev
VALUES
(9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL);
INSERT INTO `vn`.`saleCloned` (`saleClonedFk`, `saleOriginalFk`)
VALUES
(29, 25);
UPDATE `account`.`user`
SET `hasGrant` = 1
WHERE `id` = 66;

View File

@ -104,7 +104,6 @@ describe('Ticket Edit basic data path', () => {
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
await page.waitToClick(selectors.ticketBasicData.withoutNegatives);
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
await page.waitForState('ticket.card.summary');

View File

@ -19,7 +19,7 @@ describe('Ticket descriptor path', () => {
it('should count the amount of tickets in the turns section', async() => {
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
expect(result).toEqual(5);
expect(result).toEqual(6);
});
it('should go back to the ticket index then search and access a ticket summary', async() => {
@ -104,7 +104,7 @@ describe('Ticket descriptor path', () => {
await page.doSearch();
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
expect(nResults).toEqual(5);
expect(nResults).toEqual(6);
});
it('should update the agency then remove it afterwards', async() => {

View File

@ -136,5 +136,6 @@
"Not enough privileges to edit a client": "Not enough privileges to edit a client",
"Claim pickup order sent": "Claim pickup order sent [({{claimId}})]({{{claimUrl}}}) to client *{{clientName}}*",
"You don't have grant privilege": "You don't have grant privilege",
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user"
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
"Sale(s) blocked, please contact production": "Sale(s) blocked, please contact production"
}

View File

@ -0,0 +1,22 @@
module.exports = function(app) {
app.models.ACL.checkAccessAcl = async(ctx, modelId, property, accessType = '*') => {
const models = app.models;
const context = {
accessToken: ctx.req.accessToken,
model: models[modelId],
property: property,
modelId: modelId,
accessType: accessType,
sharedMethod: {
name: property,
aliases: [],
sharedClass: true
}
};
const acl = await models.ACL.checkAccessForContext(context);
return acl.permission == 'ALLOW';
};
};

View File

@ -23,12 +23,6 @@ module.exports = Self => {
Self.setPassword = async function(ctx, id, newPassword) {
const models = Self.app.models;
const userId = ctx.req.accessToken.userId;
const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson');
if (!isSalesPerson)
throw new UserError(`Not enough privileges to edit a client`);
const isClient = await models.Client.findById(id, null);
const isUserAccount = await models.UserAccount.findById(id, null);

View File

@ -6,21 +6,6 @@ describe('Client setPassword', () => {
req: {accessToken: {userId: salesPersonId}}
};
it(`should throw an error if you don't have enough permissions`, async() => {
let error;
const employeeId = 1;
const ctx = {
req: {accessToken: {userId: employeeId}}
};
try {
await models.Client.setPassword(ctx, 1, 't0pl3v3l.p455w0rd!');
} catch (e) {
error = e;
}
expect(error.message).toEqual(`Not enough privileges to edit a client`);
});
it('should throw an error the setPassword target is not just a client but a worker', async() => {
let error;

View File

@ -1,6 +1,21 @@
const LoopBackContext = require('loopback-context');
module.exports = function(Self) {
require('../methods/greuge/sumAmount')(Self);
Self.observe('before save', function(ctx, next) {
const loopBackContext = LoopBackContext.getCurrentContext();
let userFk = loopBackContext.active.accessToken.userId;
if (ctx.instance)
ctx.instance.userFk = userFk;
else
ctx.data.userFk = userFk;
next();
});
Self.validatesLengthOf('description', {
max: 45,
message: 'Description should have maximum of 45 characters'

View File

@ -2,9 +2,9 @@
"name": "Greuge",
"base": "Loggable",
"log": {
"model": "ClientLog",
"relation": "client",
"showField": "description"
"model": "ClientLog",
"relation": "client",
"showField": "description"
},
"options": {
"mysql": {
@ -35,7 +35,6 @@
"type": "number",
"required": true
}
},
"relations": {
"client": {
@ -52,6 +51,11 @@
"type": "belongsTo",
"model": "GreugeType",
"foreignKey": "greugeTypeFk"
},
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
}
}
}

View File

@ -29,6 +29,7 @@
<vn-thead>
<vn-tr>
<vn-th field="shipped" default-order="DESC" expand>Date</vn-th>
<vn-th field="userFk">Created by</vn-thfield></vn-th>
<vn-th field="description">Comment</vn-th>
<vn-th field="greugeTypeFk">Type</vn-th>
<vn-th field="amount" number>Amount</vn-th>
@ -37,6 +38,8 @@
<vn-tbody>
<vn-tr ng-repeat="greuge in greuges">
<vn-td shrink-datetime>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-td>
<vn-td><span ng-click="workerDescriptor.show($event, greuge.user.id)"
class="link">{{::greuge.user.name}}</span></vn-td>
<vn-td>
<span title="{{::greuge.description}}">{{::greuge.description}}</span>
</vn-td>
@ -57,3 +60,4 @@
vn-bind="+"
fixed-bottom-right>
</vn-float-button>
<vn-worker-descriptor-popover vn-id="workerDescriptor"></vn-worker-descriptor-popover>

View File

@ -8,6 +8,12 @@ class Controller extends Section {
include: [
{
relation: 'greugeType',
scope: {
fields: ['id', 'name']
},
},
{
relation: 'user',
scope: {
fields: ['id', 'name']
}

View File

@ -2,3 +2,4 @@ Date: Fecha
Comment: Comentario
Amount: Importe
Type: Tipo
Created by: Creado por

View File

@ -49,6 +49,10 @@ module.exports = Self => {
const provisionalName = params.provisionalName;
delete params.provisionalName;
const itemType = await models.ItemType.findById(params.typeFk, myOptions);
params.isLaid = itemType.isLaid;
const item = await models.Item.create(params, myOptions);
const typeTags = await models.ItemTypeTag.find({

View File

@ -15,6 +15,11 @@ describe('item new()', () => {
};
let item = await models.Item.new(itemParams, options);
let itemType = await models.ItemType.findById(item.typeFk, options);
item.isLaid = itemType.isLaid;
const temporalNameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}}, options);
const temporalName = await models.ItemTag.findOne({
@ -26,9 +31,14 @@ describe('item new()', () => {
item = await models.Item.findById(item.id, null, options);
itemType = await models.ItemType.findById(item.typeFk, options);
item.isLaid = itemType.isLaid;
expect(item.intrastatFk).toEqual(5080000);
expect(item.originFk).toEqual(1);
expect(item.typeFk).toEqual(2);
expect(item.isLaid).toBeFalse();
expect(item.name).toEqual('planta');
expect(temporalName.value).toEqual('planta');

View File

@ -26,6 +26,9 @@
},
"isUnconventionalSize": {
"type": "number"
},
"isLaid": {
"type": "boolean"
}
},
"relations": {

View File

@ -143,6 +143,9 @@
},
"packingShelve": {
"type": "number"
},
"isLaid": {
"type": "boolean"
}
},
"relations": {

View File

@ -53,7 +53,7 @@ module.exports = Self => {
JOIN client c ON c.id = o.customer_id
JOIN address a ON a.id = o.address_id
JOIN agencyMode am ON am.id = o.agency_id
JOIN user u ON u.id = c.salesPersonFk
JOIN account.user u ON u.id = c.salesPersonFk
JOIN workerTeamCollegues wtc ON c.salesPersonFk = wtc.collegueFk`);
if (!filter.where) filter.where = {};

View File

@ -0,0 +1,39 @@
module.exports = Self => {
Self.remoteMethodCtx('sendSms', {
description: 'Sends a SMS to each client of the routes, each client only recieves the SMS once',
accessType: 'WRITE',
accepts: [
{
arg: 'destination',
type: 'string',
description: 'A comma separated string of destinations',
required: true,
},
{
arg: 'message',
type: 'string',
required: true,
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/sendSms`,
verb: 'POST'
}
});
Self.sendSms = async(ctx, destination, message) => {
const targetClients = destination.split(',');
const allSms = [];
for (let client of targetClients) {
let sms = await Self.app.models.Sms.send(ctx, client, message);
allSms.push(sms);
}
return allSms;
};
};

View File

@ -12,6 +12,7 @@ module.exports = Self => {
require('../methods/route/updateWorkCenter')(Self);
require('../methods/route/driverRoutePdf')(Self);
require('../methods/route/driverRouteEmail')(Self);
require('../methods/route/sendSms')(Self);
Self.validate('kmStart', validateDistance, {
message: 'Distance must be lesser than 1000'

View File

@ -20,6 +20,13 @@
translate>
Update volume
</vn-item>
<vn-item
ng-click="$ctrl.deleteCurrentRoute()"
vn-acl="deliveryBoss"
vn-acl-action="remove"
translate>
Delete route
</vn-item>
</slot-menu>
<slot-body>
<div class="attributes">

View File

@ -34,6 +34,14 @@ class Controller extends Descriptor {
});
}
deleteCurrentRoute() {
this.$http.delete(`Routes/${this.id}`)
.then(() => {
this.vnApp.showSuccess(this.$t('Route deleted'));
this.$state.go('route.index');
});
}
loadData() {
const filter = {
fields: [

View File

@ -23,4 +23,20 @@ describe('vnRouteDescriptorPopover', () => {
expect(controller.route).toEqual(response);
});
});
describe('deleteCurrentRoute()', () => {
it(`should perform a delete query to delete the current route`, () => {
const id = 1;
jest.spyOn(controller.vnApp, 'showSuccess');
controller._id = id;
$httpBackend.expectDELETE(`Routes/${id}`).respond(200);
controller.deleteCurrentRoute();
$httpBackend.flush();
expect(controller.route).toBeUndefined();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Route deleted');
});
});
});

View File

@ -4,4 +4,6 @@ Send route report: Enviar informe de ruta
Show route report: Ver informe de ruta
Update volume: Actualizar volumen
Volume updated: Volumen actualizado
Delete route: Borrar ruta
Route deleted: Ruta borrada
Are you sure you want to update the volume?: Estas seguro que quieres actualizar el volumen?

View File

@ -15,3 +15,4 @@ import './agency-term/index';
import './agency-term/createInvoiceIn';
import './agency-term-search-panel';
import './ticket-popup';
import './sms';

View File

@ -9,3 +9,5 @@ Go to route: Ir a la ruta
You must select a valid time: Debe seleccionar una hora válida
You must select a valid date: Debe seleccionar una fecha válida
Mark as served: Marcar como servidas
Retrieving data from the routes: Recuperando datos de las rutas
Send SMS to all clients: Mandar sms a todos los clientes de las rutas

View File

@ -0,0 +1,36 @@
<vn-dialog
vn-id="SMSDialog"
on-accept="$ctrl.onResponse()"
message="Send SMS to the selected tickets">
<tpl-body>
<section class="SMSDialog">
<vn-horizontal>
<vn-textarea vn-one
vn-id="message"
label="Message"
ng-model="$ctrl.sms.message"
info="Special characters like accents counts as a multiple"
rows="5"
required="true"
rule>
</vn-textarea>
</vn-horizontal>
<vn-horizontal>
<span>
{{'Characters remaining' | translate}}:
<vn-chip translate-attr="{title: 'Packing'}" ng-class="{
'colored': $ctrl.charactersRemaining() > 25,
'warning': $ctrl.charactersRemaining() <= 25,
'alert': $ctrl.charactersRemaining() < 0,
}">
{{$ctrl.charactersRemaining()}}
</vn-chip>
</span>
</vn-horizontal>
</section>
</tpl-body>
<tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Send</button>
</tpl-buttons>
</vn-dialog>

View File

@ -0,0 +1,47 @@
import ngModule from '../module';
import Component from 'core/lib/component';
import './style.scss';
class Controller extends Component {
open() {
this.$.SMSDialog.show();
}
charactersRemaining() {
const element = this.$.message;
const value = element.input.value;
const maxLength = 160;
const textAreaLength = new Blob([value]).size;
return maxLength - textAreaLength;
}
onResponse() {
try {
if (!this.sms.destination)
throw new Error(`The destination can't be empty`);
if (!this.sms.message)
throw new Error(`The message can't be empty`);
if (this.charactersRemaining() < 0)
throw new Error(`The message it's too long`);
this.$http.post(`Routes/sendSms`, this.sms).then(res => {
this.vnApp.showMessage(this.$t('SMS sent!'));
if (res.data) this.emit('send', {response: res.data});
});
} catch (e) {
this.vnApp.showError(this.$t(e.message));
return false;
}
return true;
}
}
ngModule.vnComponent('vnRouteSms', {
template: require('./index.html'),
controller: Controller,
bindings: {
sms: '<',
}
});

View File

@ -0,0 +1,71 @@
import './index';
describe('Route', () => {
describe('Component vnRouteSms', () => {
let controller;
let $httpBackend;
beforeEach(ngModule('route'));
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
let $scope = $rootScope.$new();
const $element = angular.element('<vn-dialog></vn-dialog>');
controller = $componentController('vnRouteSms', {$element, $scope});
controller.$.message = {
input: {
value: 'My SMS'
}
};
}));
describe('onResponse()', () => {
it('should perform a POST query and show a success snackbar', () => {
let params = {destinationFk: 1101, destination: 111111111, message: 'My SMS'};
controller.sms = {destinationFk: 1101, destination: 111111111, message: 'My SMS'};
jest.spyOn(controller.vnApp, 'showMessage');
$httpBackend.expect('POST', `Routes/sendSms`, params).respond(200, params);
controller.onResponse();
$httpBackend.flush();
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!');
});
it('should call onResponse without the destination and show an error snackbar', () => {
controller.sms = {destinationFk: 1101, message: 'My SMS'};
jest.spyOn(controller.vnApp, 'showError');
controller.onResponse();
expect(controller.vnApp.showError).toHaveBeenCalledWith(`The destination can't be empty`);
});
it('should call onResponse without the message and show an error snackbar', () => {
controller.sms = {destinationFk: 1101, destination: 222222222};
jest.spyOn(controller.vnApp, 'showError');
controller.onResponse();
expect(controller.vnApp.showError).toHaveBeenCalledWith(`The message can't be empty`);
});
});
describe('charactersRemaining()', () => {
it('should return the characters remaining in a element', () => {
controller.$.message = {
input: {
value: 'My message 0€'
}
};
let result = controller.charactersRemaining();
expect(result).toEqual(145);
});
});
});
});

View File

@ -0,0 +1,9 @@
Send SMS to the selected tickets: Enviar SMS a los tickets seleccionados
Routes to notify: Rutas a notificar
Message: Mensaje
SMS sent!: ¡SMS enviado!
Characters remaining: Carácteres restantes
The destination can't be empty: El destinatario no puede estar vacio
The message can't be empty: El mensaje no puede estar vacio
The message it's too long: El mensaje es demasiado largo
Special characters like accents counts as a multiple: Carácteres especiales como los acentos cuentan como varios

View File

@ -0,0 +1,5 @@
@import "variables";
.SMSDialog {
min-width: 400px
}

View File

@ -29,13 +29,21 @@
disabled="!$ctrl.isChecked"
ng-click="$ctrl.deletePriority()"
vn-tooltip="Delete priority"
icon="filter_alt_off">
icon="filter_alt">
</vn-button>
<vn-button
ng-click="$ctrl.setOrderedPriority($ctrl.tickets)"
vn-tooltip="Renumber all tickets in the order you see on the screen"
icon="format_list_numbered">
</vn-button>
<vn-button
vn-acl="deliveryBoss"
vn-acl-action="remove"
disabled="!$ctrl.isChecked"
icon="sms"
vn-tooltip="Send SMS to all clients"
ng-click="$ctrl.sendSms()">
</vn-button>
</vn-tool-bar>
<vn-table class="vn-pt-md" model="model" auto-load="false" vn-droppable="$ctrl.onDrop($event)">
<vn-thead>
@ -149,19 +157,29 @@
route="$ctrl.$params"
parent-reload="$ctrl.$.model.refresh()">
</vn-route-ticket-popup>
<vn-float-button
icon="add"
ng-click="$ctrl.$.ticketPopup.show()"
vn-tooltip="Add ticket"
vn-acl="delivery"
vn-acl-action="remove"
vn-bind="+"
fixed-bottom-right>
</vn-float-button>
<div fixed-bottom-right>
<vn-vertical style="align-items: center;">
<a vn-bind="+">
<vn-button
class="round md vn-mb-sm"
ng-click="$ctrl.$.ticketPopup.show()"
icon="add"
vn-tooltip="Add ticket"
vn-acl="delivery"
vn-acl-action="remove"
tooltip-position="left">
</vn-button>
</a>
</vn-vertical>
</div>
<vn-ticket-descriptor-popover
vn-id="ticket-descriptor">
</vn-ticket-descriptor-popover>
<vn-client-descriptor-popover
vn-id="client-descriptor">
</vn-client-descriptor-popover>
<!-- SMS Dialog -->
<vn-route-sms
vn-id="sms"
sms="$ctrl.newSMS">
</vn-route-sms>

View File

@ -161,6 +161,37 @@ class Controller extends Section {
throw error;
});
}
async sendSms() {
try {
const clientsFk = [];
const clientsName = [];
const clients = [];
const selectedTickets = this.getSelectedItems(this.$.$ctrl.tickets);
for (let ticket of selectedTickets) {
clientsFk.push(ticket.clientFk);
let userContact = await this.$http.get(`Clients/${ticket.clientFk}`);
clientsName.push(userContact.data.name);
clients.push(userContact.data.phone);
}
const destinationFk = String(clientsFk);
const destination = String(clients);
this.newSMS = Object.assign({
destinationFk: destinationFk,
destination: destination
});
this.$.sms.open();
return true;
} catch (e) {
this.vnApp.showError(this.$t(e.message));
return false;
}
}
}
ngModule.vnComponent('vnRouteTickets', {

View File

@ -1,10 +1,12 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('canEdit', {
description: 'Check if all the received sales are aditable',
accessType: 'READ',
accepts: [{
arg: 'sales',
type: ['object'],
type: ['number'],
required: true
}],
returns: {
@ -12,29 +14,48 @@ module.exports = Self => {
root: true
},
http: {
path: `/isEditable`,
verb: 'get'
path: `/canEdit`,
verb: 'GET'
}
});
Self.canEdit = async(ctx, sales, options) => {
const models = Self.app.models;
const userId = ctx.req.accessToken.userId;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const idsCollection = sales.map(sale => sale.id);
const salesData = await models.Sale.find({
fields: ['id', 'itemFk', 'ticketFk'],
where: {id: {inq: sales}},
include:
{
relation: 'item',
scope: {
fields: ['id', 'isFloramondo'],
}
}
}, myOptions);
const saleTracking = await models.SaleTracking.find({where: {saleFk: {inq: idsCollection}}}, myOptions);
const ticketId = salesData[0].ticketFk;
const hasSaleTracking = saleTracking.length;
const isTicketEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions);
if (!isTicketEditable)
throw new UserError(`The sales of this ticket can't be modified`);
const isProductionRole = await models.Account.hasRole(userId, 'production', myOptions);
const hasSaleTracking = await models.SaleTracking.findOne({where: {saleFk: {inq: sales}}}, myOptions);
const hasSaleCloned = await models.SaleCloned.findOne({where: {saleClonedFk: {inq: sales}}}, myOptions);
const hasSaleFloramondo = salesData.find(sale => sale.item().isFloramondo);
const canEdit = (isProductionRole || !hasSaleTracking);
const canEditTracked = await models.ACL.checkAccessAcl(ctx, 'Sale', 'editTracked');
const canEditCloned = await models.ACL.checkAccessAcl(ctx, 'Sale', 'editCloned');
const canEditFloramondo = await models.ACL.checkAccessAcl(ctx, 'Sale', 'editFloramondo');
return canEdit;
const shouldEditTracked = canEditTracked || !hasSaleTracking;
const shouldEditCloned = canEditCloned || !hasSaleCloned;
const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo;
return shouldEditTracked && shouldEditCloned && shouldEditFloramondo;
};
};

View File

@ -41,7 +41,11 @@ module.exports = Self => {
}
try {
const canEditSales = await models.Sale.canEdit(ctx, sales, myOptions);
const saleIds = sales.map(sale => sale.id);
const canEditSales = await models.Sale.canEdit(ctx, saleIds, myOptions);
if (!canEditSales)
throw new UserError(`Sale(s) blocked, please contact production`);
const ticket = await models.Ticket.findById(ticketId, {
include: {
@ -57,13 +61,6 @@ module.exports = Self => {
}
}, myOptions);
const isTicketEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions);
if (!isTicketEditable)
throw new UserError(`The sales of this ticket can't be modified`);
if (!canEditSales)
throw new UserError(`Sale(s) blocked, please contact production`);
const promises = [];
let deletions = '';
for (let sale of sales) {

View File

@ -1,4 +1,5 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('recalculatePrice', {
description: 'Calculates the price of sales and its components',
@ -34,15 +35,9 @@ module.exports = Self => {
}
try {
const salesIds = [];
for (let sale of sales)
salesIds.push(sale.id);
const salesIds = sales.map(sale => sale.id);
const isEditable = await models.Ticket.isEditable(ctx, sales[0].ticketFk, myOptions);
if (!isEditable)
throw new UserError(`The sales of this ticket can't be modified`);
const canEditSale = await models.Sale.canEdit(ctx, sales, myOptions);
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);

View File

@ -49,12 +49,9 @@ module.exports = Self => {
}
try {
const isTicketEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions);
if (!isTicketEditable)
throw new UserError(`The sales of this ticket can't be modified`);
const canEditSale = await models.Sale.canEdit(ctx, sales, myOptions);
const salesIds = sales.map(sale => sale.id);
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);

View File

@ -1,69 +1,193 @@
const models = require('vn-loopback/server/server').models;
describe('sale canEdit()', () => {
it('should return true if the role is production regardless of the saleTrackings', async() => {
const tx = await models.Sale.beginTransaction({});
const employeeId = 1;
try {
const options = {transaction: tx};
describe('sale editTracked', () => {
it('should return true if the role is production regardless of the saleTrackings', async() => {
const tx = await models.Sale.beginTransaction({});
const productionUserID = 49;
const ctx = {req: {accessToken: {userId: productionUserID}}};
try {
const options = {transaction: tx};
const sales = [{id: 3}];
const productionUserID = 49;
const ctx = {req: {accessToken: {userId: productionUserID}}};
const result = await models.Sale.canEdit(ctx, sales, options);
const sales = [25];
expect(result).toEqual(true);
const result = await models.Sale.canEdit(ctx, sales, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
expect(result).toEqual(true);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return true if the role is not production and none of the sales has saleTracking', async() => {
const tx = await models.Sale.beginTransaction({});
try {
const options = {transaction: tx};
const salesPersonUserID = 18;
const ctx = {req: {accessToken: {userId: salesPersonUserID}}};
const sales = [10];
const result = await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(true);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return false if any of the sales has a saleTracking record', async() => {
const tx = await models.Sale.beginTransaction({});
try {
const options = {transaction: tx};
const buyerId = 35;
const ctx = {req: {accessToken: {userId: buyerId}}};
const sales = [31];
const result = await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(false);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});
it('should return true if the role is not production and none of the sales has saleTracking', async() => {
const tx = await models.Sale.beginTransaction({});
describe('sale editCloned', () => {
const saleCloned = [29];
it('should return false if any of the sales is cloned', async() => {
const tx = await models.Sale.beginTransaction({});
try {
const options = {transaction: tx};
try {
const options = {transaction: tx};
const salesPersonUserID = 18;
const ctx = {req: {accessToken: {userId: salesPersonUserID}}};
const buyerId = 35;
const ctx = {req: {accessToken: {userId: buyerId}}};
const sales = [{id: 10}];
const result = await models.Sale.canEdit(ctx, saleCloned, options);
const result = await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(false);
expect(result).toEqual(true);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
it('should return true if any of the sales is cloned and has the correct role', async() => {
const tx = await models.Sale.beginTransaction({});
const roleEnabled = await models.ACL.findOne({
where: {
model: 'Sale',
property: 'editCloned',
permission: 'ALLOW'
}
});
if (!roleEnabled || !roleEnabled.principalId) return await tx.rollback();
try {
const options = {transaction: tx};
const role = await models.Role.findOne({
where: {
name: roleEnabled.principalId
}
});
const ctx = {req: {accessToken: {userId: role.id}}};
const result = await models.Sale.canEdit(ctx, saleCloned, options);
expect(result).toEqual(true);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});
it('should return false if any of the sales has a saleTracking record', async() => {
const tx = await models.Sale.beginTransaction({});
describe('sale editFloramondo', () => {
it('should return false if any of the sales isFloramondo', async() => {
const tx = await models.Sale.beginTransaction({});
const sales = [26];
try {
const options = {transaction: tx};
try {
const options = {transaction: tx};
const salesPersonUserID = 18;
const ctx = {req: {accessToken: {userId: salesPersonUserID}}};
const ctx = {req: {accessToken: {userId: employeeId}}};
const sales = [{id: 3}];
// For test
const saleToEdit = await models.Sale.findById(sales[0], null, options);
await saleToEdit.updateAttribute('itemFk', 9, options);
const result = await models.Sale.canEdit(ctx, sales, options);
const result = await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(false);
expect(result).toEqual(false);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return true if any of the sales is of isFloramondo and has the correct role', async() => {
const tx = await models.Sale.beginTransaction({});
const sales = [26];
const roleEnabled = await models.ACL.findOne({
where: {
model: 'Sale',
property: 'editFloramondo',
permission: 'ALLOW'
}
});
if (!roleEnabled || !roleEnabled.principalId) return await tx.rollback();
try {
const options = {transaction: tx};
const role = await models.Role.findOne({
where: {
name: roleEnabled.principalId
}
});
const ctx = {req: {accessToken: {userId: role.id}}};
// For test
const saleToEdit = await models.Sale.findById(sales[0], null, options);
await saleToEdit.updateAttribute('itemFk', 9, options);
const result = await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(true);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});
});

View File

@ -3,7 +3,7 @@ const models = require('vn-loopback/server/server').models;
describe('sale reserve()', () => {
const ctx = {
req: {
accessToken: {userId: 9},
accessToken: {userId: 1},
headers: {origin: 'localhost:5000'},
__: () => {}
}

View File

@ -2,7 +2,7 @@ const models = require('vn-loopback/server/server').models;
describe('sale updateConcept()', () => {
const ctx = {req: {accessToken: {userId: 9}}};
const saleId = 1;
const saleId = 25;
it('should throw if ID was undefined', async() => {
const tx = await models.Sale.beginTransaction({});

View File

@ -9,32 +9,21 @@ describe('sale updateQuantity()', () => {
}
};
it('should throw an error if the quantity is not a number', async() => {
const tx = await models.Sale.beginTransaction({});
let error;
try {
const options = {transaction: tx};
await models.Sale.updateQuantity(ctx, 1, 'wrong quantity!', options);
await tx.rollback();
} catch (e) {
await tx.rollback();
error = e;
}
expect(error).toEqual(new Error('The value should be a number'));
});
it('should throw an error if the quantity is greater than it should be', async() => {
const ctx = {
req: {
accessToken: {userId: 1},
headers: {origin: 'localhost:5000'},
__: () => {}
}
};
const tx = await models.Sale.beginTransaction({});
let error;
try {
const options = {transaction: tx};
await models.Sale.updateQuantity(ctx, 1, 99, options);
await models.Sale.updateQuantity(ctx, 17, 99, options);
await tx.rollback();
} catch (e) {
@ -45,21 +34,60 @@ describe('sale updateQuantity()', () => {
expect(error).toEqual(new Error('The new quantity should be smaller than the old one'));
});
it('should update the quantity of a given sale current line', async() => {
it('should add quantity if the quantity is greater than it should be and is role advanced', async() => {
const tx = await models.Sale.beginTransaction({});
const saleId = 17;
const buyerId = 35;
const ctx = {
req: {
accessToken: {userId: buyerId},
headers: {origin: 'localhost:5000'},
__: () => {}
}
};
try {
const options = {transaction: tx};
const originalLine = await models.Sale.findOne({where: {id: 1}, fields: ['quantity']}, options);
const isRoleAdvanced = await models.Ticket.isRoleAdvanced(ctx, options);
expect(originalLine.quantity).toEqual(5);
expect(isRoleAdvanced).toEqual(true);
await models.Sale.updateQuantity(ctx, 1, 4, options);
const originalLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options);
const modifiedLine = await models.Sale.findOne({where: {id: 1}, fields: ['quantity']}, options);
expect(originalLine.quantity).toEqual(30);
expect(modifiedLine.quantity).toEqual(4);
const newQuantity = originalLine.quantity + 1;
await models.Sale.updateQuantity(ctx, saleId, newQuantity, options);
const modifiedLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options);
expect(modifiedLine.quantity).toEqual(newQuantity);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should update the quantity of a given sale current line', async() => {
const tx = await models.Sale.beginTransaction({});
const saleId = 25;
const newQuantity = 4;
try {
const options = {transaction: tx};
const originalLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options);
expect(originalLine.quantity).toEqual(20);
await models.Sale.updateQuantity(ctx, saleId, newQuantity, options);
const modifiedLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options);
expect(modifiedLine.quantity).toEqual(newQuantity);
await tx.rollback();
} catch (e) {

View File

@ -66,12 +66,7 @@ module.exports = Self => {
const sale = await models.Sale.findById(id, filter, myOptions);
const isEditable = await models.Ticket.isEditable(ctx, sale.ticketFk, myOptions);
if (!isEditable)
throw new UserError(`The sales of this ticket can't be modified`);
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);

View File

@ -42,13 +42,9 @@ module.exports = Self => {
try {
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
if (isNaN(newQuantity))
throw new UserError(`The value should be a number`);
const filter = {
include: {
relation: 'ticket',
@ -70,7 +66,8 @@ module.exports = Self => {
const sale = await models.Sale.findById(id, filter, myOptions);
if (newQuantity > sale.quantity)
const isRoleAdvanced = await models.Ticket.isRoleAdvanced(ctx, myOptions);
if (newQuantity > sale.quantity && !isRoleAdvanced)
throw new UserError('The new quantity should be smaller than the old one');
const oldQuantity = sale.quantity;

View File

@ -17,7 +17,7 @@ describe('ticket-weekly filter()', () => {
const firstRow = result[0];
expect(firstRow.ticketFk).toEqual(1);
expect(result.length).toEqual(5);
expect(result.length).toEqual(6);
await tx.rollback();
} catch (e) {

View File

@ -20,24 +20,20 @@ module.exports = Self => {
});
Self.isEditable = async(ctx, id, options) => {
const userId = ctx.req.accessToken.userId;
const models = Self.app.models;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
let state = await Self.app.models.TicketState.findOne({
const state = await models.TicketState.findOne({
where: {ticketFk: id}
}, myOptions);
const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant', myOptions);
const isDeliveryBoss = await Self.app.models.Account.hasRole(userId, 'deliveryBoss', myOptions);
const isBuyer = await Self.app.models.Account.hasRole(userId, 'buyer', myOptions);
const isRoleAdvanced = await models.Ticket.isRoleAdvanced(ctx, myOptions);
const isValidRole = isSalesAssistant || isDeliveryBoss || isBuyer;
let alertLevel = state ? state.alertLevel : null;
let ticket = await Self.app.models.Ticket.findById(id, {
const alertLevel = state ? state.alertLevel : null;
const ticket = await models.Ticket.findById(id, {
fields: ['clientFk'],
include: [{
relation: 'client',
@ -48,15 +44,17 @@ module.exports = Self => {
}
}]
}, myOptions);
const isLocked = await Self.app.models.Ticket.isLocked(id, myOptions);
const isLocked = await models.Ticket.isLocked(id, myOptions);
const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions);
const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0);
const isNormalClient = ticket && ticket.client().type().code == 'normal';
const validAlertAndRoleNormalClient = (alertLevelGreaterThanZero && isNormalClient && !isValidRole);
const isEditable = !(alertLevelGreaterThanZero && isNormalClient);
if (!ticket || validAlertAndRoleNormalClient || isLocked)
return false;
if (ticket && (isEditable || isRoleAdvanced) && !isLocked && !isWeekly)
return true;
return true;
return false;
};
};

View File

@ -0,0 +1,32 @@
module.exports = Self => {
Self.remoteMethodCtx('isRoleAdvanced', {
description: 'Check if a ticket is editable',
accessType: 'READ',
returns: {
type: 'boolean',
root: true
},
http: {
path: `/isRoleAdvanced`,
verb: 'GET'
}
});
Self.isRoleAdvanced = async(ctx, options) => {
const models = Self.app.models;
const userId = ctx.req.accessToken.userId;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions);
const isDeliveryBoss = await models.Account.hasRole(userId, 'deliveryBoss', myOptions);
const isBuyer = await models.Account.hasRole(userId, 'buyer', myOptions);
const isClaimManager = await models.Account.hasRole(userId, 'claimManager', myOptions);
const isRoleAdvanced = isSalesAssistant || isDeliveryBoss || isBuyer || isClaimManager;
return isRoleAdvanced;
};
};

View File

@ -1,4 +1,5 @@
const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
describe('ticket componentUpdate()', () => {
const userID = 1101;
@ -178,10 +179,15 @@ describe('ticket componentUpdate()', () => {
}
}
};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: ctx.req
});
const oldTicket = await models.Ticket.findById(ticketID, null, options);
await models.Ticket.componentUpdate(ctx, options);
const [newTicketID] = await models.Ticket.rawSql('SELECT MAX(id) as id FROM ticket', null, options);
const oldTicket = await models.Ticket.findById(ticketID, null, options);
const newTicket = await models.Ticket.findById(newTicketID.id, null, options);
const newTicketSale = await models.Sale.findOne({where: {ticketFk: args.id}}, options);

View File

@ -134,4 +134,23 @@ describe('ticket isEditable()', () => {
expect(result).toEqual(false);
});
it('should not be able to edit if is a ticket weekly', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 1}}};
const result = await models.Ticket.isEditable(ctx, 15, options);
expect(result).toEqual(false);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -35,6 +35,9 @@
"SaleChecked": {
"dataSource": "vn"
},
"SaleCloned": {
"dataSource": "vn"
},
"SaleComponent": {
"dataSource": "vn"
},

View File

@ -0,0 +1,26 @@
{
"name": "SaleCloned",
"base": "VnModel",
"options": {
"mysql": {
"table": "saleCloned"
}
},
"properties": {
"saleClonedFk": {
"id": true
}
},
"relations": {
"saleOriginal": {
"type": "belongsTo",
"model": "Sale",
"foreignKey": "saleOriginalFk"
},
"saleCloned": {
"type": "belongsTo",
"model": "Sale",
"foreignKey": "saleClonedFk"
}
}
}

View File

@ -33,5 +33,6 @@ module.exports = function(Self) {
require('../methods/ticket/closeByTicket')(Self);
require('../methods/ticket/closeByAgency')(Self);
require('../methods/ticket/closeByRoute')(Self);
require('../methods/ticket/isRoleAdvanced')(Self);
require('../methods/ticket/collectionLabel')(Self);
};

View File

@ -89,7 +89,7 @@ class Controller extends Section {
getUsesMana() {
this.$http.get(`Sales/usesMana`)
.then(res => {
this.useMana = res.data;
this.usesMana = res.data;
});
}

View File

@ -12,11 +12,6 @@ describe('workerTimeControl sendMail()', () => {
};
beforeAll(function() {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});
it('should fill time control of a worker without records in Journey and with rest', async() => {
const tx = await models.WorkerTimeControl.beginTransaction({});
@ -124,9 +119,5 @@ describe('workerTimeControl sendMail()', () => {
throw e;
}
});
afterAll(function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});
});

View File

@ -27,7 +27,7 @@
"jsdom": "^16.7.0",
"jszip": "^3.10.0",
"ldapjs": "^2.2.0",
"loopback": "^3.26.0",
"loopback": "^3.28.0",
"loopback-boot": "3.3.1",
"loopback-component-explorer": "^6.5.0",
"loopback-component-storage": "3.6.1",

View File

@ -9,7 +9,7 @@
<div>{{$t('clientId')}}: <strong>{{client.id}}</strong></div>
<div>{{$t('user')}}: <strong>{{client.userName}}</strong></div>
<div>{{$t('password')}}: <strong>********</strong>
(<a href="https://verdnatura.es">{{$t('passwordResetText')}}</a>)
(<a href="https://shop.verdnatura.es">{{$t('passwordResetText')}}</a>)
</div>
</p>

View File

@ -1,8 +1,8 @@
subject: Bienvenido a Verdnatura
title: "¡Te damos la bienvenida!"
dearClient: Estimado cliente
clientData: 'Tus datos para poder comprar en la web de Verdnatura (<a href="https://verdnatura.es"
title="Visitar Verdnatura" target="_blank" style="color: #8dba25">https://verdnatura.es</a>)
clientData: 'Tus datos para poder comprar en la web de Verdnatura (<a href="https://shop.verdnatura.es"
title="Visitar Verdnatura" target="_blank" style="color: #8dba25">https://shop.verdnatura.es</a>)
o en nuestras aplicaciones para <a href="https://goo.gl/3hC2mG" title="App Store"
target="_blank" style="color: #8dba25">iOS</a> y <a href="https://goo.gl/8obvLc"
title="Google Play" target="_blank" style="color: #8dba25">Android</a>, son'

View File

@ -0,0 +1,11 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,6 @@
[
{
"filename": "vehicle-event-expired.pdf",
"component": "vehicle-event-expired"
}
]

View File

@ -0,0 +1,3 @@
subject: Expiración Tarjetas Vehículos
title: Expiración Tarjetas Vehículos
description: A continuación se adjunta el informe de expiración de tarjetas vehículos

View File

@ -0,0 +1,8 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p v-html="$t('description')"></p>
</div>
</div>
</email-body>

View File

@ -0,0 +1,9 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'vehicle-event-expired',
components: {
'email-body': emailBody.build()
}
};

View File

@ -1,9 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`);
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`,
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -1,4 +1,4 @@
const Component = require(`${appPath}/core/component`);
const Component = require(`vn-print/core/component`);
const reportBody = new Component('report-body');
module.exports = {

View File

@ -1,4 +1,4 @@
const Component = require(`${appPath}/core/component`);
const Component = require(`vn-print/core/component`);
const reportBody = new Component('report-body');
module.exports = {