3888-ticket.expedition_moveExpedition #1097
|
@ -13,7 +13,7 @@ RUN apt-get update \
|
||||||
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
|
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
|
||||||
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
|
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
|
||||||
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
|
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
|
||||||
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
nodejs \
|
nodejs \
|
||||||
&& apt-get purge -y --auto-remove \
|
&& apt-get purge -y --auto-remove \
|
||||||
|
|
|
@ -62,13 +62,13 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Backend') {
|
// stage('Backend') {
|
||||||
steps {
|
// steps {
|
||||||
nodejs('node-v14') {
|
// nodejs('node-v14') {
|
||||||
sh 'npm run test:back:ci'
|
// sh 'npm run test:back:ci'
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
|
|
@ -29,6 +29,8 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.privileges = async function(ctx, id, roleFk, hasGrant, options) {
|
Self.privileges = async function(ctx, id, roleFk, hasGrant, options) {
|
||||||
|
if (!(hasGrant != null || roleFk)) return;
|
||||||
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
|
||||||
|
@ -37,22 +39,40 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const user = await models.Account.findById(userId, null, myOptions);
|
const user = await models.Account.findById(userId, {fields: ['hasGrant']}, myOptions);
|
||||||
|
|
||||||
|
const userToUpdate = await models.Account.findById(id, {
|
||||||
|
fields: ['id', 'name', 'hasGrant', 'roleFk', 'password'],
|
||||||
|
include: {
|
||||||
|
relation: 'role',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
if (!user.hasGrant)
|
if (!user.hasGrant)
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have grant privilege`);
|
||||||
|
|
||||||
|
const hasRoleFromUser = await models.Account.hasRole(userId, userToUpdate.role().name, myOptions);
|
||||||
|
|
||||||
|
if (!hasRoleFromUser)
|
||||||
|
throw new UserError(`You don't own the role and you can't assign it to another user`);
|
||||||
|
|
||||||
const userToUpdate = await models.Account.findById(id);
|
|
||||||
if (hasGrant != null)
|
if (hasGrant != null)
|
||||||
return await userToUpdate.updateAttribute('hasGrant', hasGrant, myOptions);
|
userToUpdate.hasGrant = hasGrant;
|
||||||
if (!roleFk) return;
|
|
||||||
|
|
||||||
const role = await models.Role.findById(roleFk, null, myOptions);
|
if (roleFk) {
|
||||||
const hasRole = await models.Account.hasRole(userId, role.name, myOptions);
|
const role = await models.Role.findById(roleFk, {fields: ['name']}, myOptions);
|
||||||
|
const hasRole = await models.Account.hasRole(userId, role.name, myOptions);
|
||||||
|
|
||||||
if (!hasRole)
|
if (!hasRole)
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't own the role and you can't assign it to another user`);
|
||||||
|
|
||||||
await userToUpdate.updateAttribute('roleFk', roleFk, myOptions);
|
userToUpdate.roleFk = roleFk;
|
||||||
|
}
|
||||||
|
|
||||||
|
await userToUpdate.save(userToUpdate);
|
||||||
|
await models.UserAccount.sync(userToUpdate.name);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,9 @@ describe('account privileges()', () => {
|
||||||
const employeeId = 1;
|
const employeeId = 1;
|
||||||
const developerId = 9;
|
const developerId = 9;
|
||||||
const sysadminId = 66;
|
const sysadminId = 66;
|
||||||
const bruceWayneId = 1101;
|
const itBossId = 104;
|
||||||
|
const rootId = 100;
|
||||||
|
const clarkKent = 1103;
|
||||||
|
|
||||||
it('should throw an error when user not has privileges', async() => {
|
it('should throw an error when user not has privileges', async() => {
|
||||||
const ctx = {req: {accessToken: {userId: developerId}}};
|
const ctx = {req: {accessToken: {userId: developerId}}};
|
||||||
|
@ -22,7 +24,7 @@ describe('account privileges()', () => {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error.message).toContain(`You don't have enough privileges`);
|
expect(error.message).toContain(`You don't have grant privilege`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when user has privileges but not has the role', async() => {
|
it('should throw an error when user has privileges but not has the role', async() => {
|
||||||
|
@ -33,12 +35,7 @@ describe('account privileges()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const root = await models.Role.findOne({
|
await models.Account.privileges(ctx, employeeId, rootId, null, options);
|
||||||
where: {
|
|
||||||
name: 'root'
|
|
||||||
}
|
|
||||||
}, options);
|
|
||||||
await models.Account.privileges(ctx, employeeId, root.id, null, options);
|
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -46,7 +43,26 @@ describe('account privileges()', () => {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error.message).toContain(`You don't have enough privileges`);
|
expect(error.message).toContain(`You don't own the role and you can't assign it to another user`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error when user has privileges but not has the role from user', async() => {
|
||||||
|
const ctx = {req: {accessToken: {userId: sysadminId}}};
|
||||||
|
const tx = await models.Account.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
await models.Account.privileges(ctx, itBossId, developerId, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toContain(`You don't own the role and you can't assign it to another user`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should change role', async() => {
|
it('should change role', async() => {
|
||||||
|
@ -63,8 +79,8 @@ describe('account privileges()', () => {
|
||||||
let error;
|
let error;
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
await models.Account.privileges(ctx, bruceWayneId, agency.id, null, options);
|
await models.Account.privileges(ctx, clarkKent, agency.id, null, options);
|
||||||
result = await models.Account.findById(bruceWayneId, null, options);
|
result = await models.Account.findById(clarkKent, null, options);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -84,8 +100,8 @@ describe('account privileges()', () => {
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
await models.Account.privileges(ctx, bruceWayneId, null, true, options);
|
await models.Account.privileges(ctx, clarkKent, null, true, options);
|
||||||
result = await models.Account.findById(bruceWayneId, null, options);
|
result = await models.Account.findById(clarkKent, null, options);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('clean', {
|
||||||
|
description: 'clean notifications from queue',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/clean`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.clean = async options => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const status = ['sent', 'error'];
|
||||||
|
|
||||||
|
const myOptions = {};
|
||||||
|
let tx;
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const config = await models.NotificationConfig.findOne({}, myOptions);
|
||||||
|
const cleanDate = new Date();
|
||||||
|
cleanDate.setDate(cleanDate.getDate() - config.cleanDays);
|
||||||
|
|
||||||
|
await models.NotificationQueue.destroyAll({
|
||||||
|
where: {status: {inq: status}},
|
||||||
|
created: {lt: cleanDate}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,81 @@
|
||||||
|
const {Email} = require('vn-print');
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('send', {
|
||||||
|
description: 'Send notifications from queue',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/send`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.send = async options => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const findStatus = 'pending';
|
||||||
|
|
||||||
|
const myOptions = {};
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const notificationQueue = await models.NotificationQueue.find({
|
||||||
|
where: {status: findStatus},
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'notification',
|
||||||
|
scope: {
|
||||||
|
include: {
|
||||||
|
relation: 'subscription',
|
||||||
|
scope: {
|
||||||
|
include: {
|
||||||
|
relation: 'user',
|
||||||
|
scope: {
|
||||||
|
fields: ['name', 'email', 'lang']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const statusSent = 'sent';
|
||||||
|
const statusError = 'error';
|
||||||
|
|
||||||
|
for (const queue of notificationQueue) {
|
||||||
|
const queueName = queue.notification().name;
|
||||||
|
const queueParams = JSON.parse(queue.params);
|
||||||
|
|
||||||
|
for (const notificationUser of queue.notification().subscription()) {
|
||||||
|
try {
|
||||||
|
const sendParams = {
|
||||||
|
recipient: notificationUser.user().email,
|
||||||
|
lang: notificationUser.user().lang
|
||||||
|
};
|
||||||
|
|
||||||
|
if (notificationUser.userFk == queue.authorFk) {
|
||||||
|
await queue.updateAttribute('status', statusSent);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newParams = Object.assign({}, queueParams, sendParams);
|
||||||
|
const email = new Email(queueName, newParams);
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV != 'test')
|
||||||
|
await email.send();
|
||||||
|
|
||||||
|
await queue.updateAttribute('status', statusSent);
|
||||||
|
} catch (error) {
|
||||||
|
await queue.updateAttribute('status', statusError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,42 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('Notification Clean()', () => {
|
||||||
|
it('should delete old rows with error', async() => {
|
||||||
|
const userId = 9;
|
||||||
|
const status = 'error';
|
||||||
|
const tx = await models.NotificationQueue.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const notification = await models.Notification.findOne({}, options);
|
||||||
|
const notificationConfig = await models.NotificationConfig.findOne({});
|
||||||
|
|
||||||
|
const cleanDate = new Date();
|
||||||
|
cleanDate.setDate(cleanDate.getDate() - (notificationConfig.cleanDays + 1));
|
||||||
|
|
||||||
|
let before;
|
||||||
|
let after;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const notificationDelete = await models.NotificationQueue.create({
|
||||||
|
notificationFk: notification.name,
|
||||||
|
authorFk: userId,
|
||||||
|
status: status,
|
||||||
|
created: cleanDate
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
before = await models.NotificationQueue.findById(notificationDelete.id, null, options);
|
||||||
|
|
||||||
|
await models.Notification.clean(options);
|
||||||
|
|
||||||
|
after = await models.NotificationQueue.findById(notificationDelete.id, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(before.notificationFk).toEqual(notification.name);
|
||||||
|
expect(after).toBe(null);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,33 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('Notification Send()', () => {
|
||||||
|
it('should send notification', async() => {
|
||||||
|
const statusPending = 'pending';
|
||||||
|
const tx = await models.NotificationQueue.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const filter = {
|
||||||
|
where: {
|
||||||
|
status: statusPending
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let before;
|
||||||
|
let after;
|
||||||
|
|
||||||
|
try {
|
||||||
|
before = await models.NotificationQueue.find(filter, options);
|
||||||
|
|
||||||
|
await models.Notification.send(options);
|
||||||
|
|
||||||
|
after = await models.NotificationQueue.find(filter, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(before.length).toEqual(3);
|
||||||
|
expect(after.length).toEqual(0);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,12 +1,13 @@
|
||||||
const jsdom = require('jsdom');
|
const jsdom = require('jsdom');
|
||||||
const mysql = require('mysql');
|
const mysql = require('mysql');
|
||||||
|
const FormData = require('form-data');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('closeTicket', {
|
Self.remoteMethodCtx('closeTicket', {
|
||||||
description: 'Close tickets without response from the user',
|
description: 'Close tickets without response from the user',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
returns: {
|
returns: {
|
||||||
type: 'Object',
|
type: 'object',
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
@ -54,9 +55,9 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await requestToken();
|
await getRequestToken();
|
||||||
|
|
||||||
async function requestToken() {
|
async function getRequestToken() {
|
||||||
const response = await fetch(ostUri);
|
const response = await fetch(ostUri);
|
||||||
|
|
||||||
const result = response.headers.get('set-cookie');
|
const result = response.headers.get('set-cookie');
|
||||||
|
@ -93,24 +94,45 @@ module.exports = Self => {
|
||||||
await close(token, secondCookie);
|
await close(token, secondCookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getLockCode(token, secondCookie, ticketId) {
|
||||||
|
const ostUri = `${config.host}/ajax.php/lock/ticket/${ticketId}`;
|
||||||
|
const params = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': token,
|
||||||
|
'Cookie': secondCookie
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const response = await fetch(ostUri, params);
|
||||||
|
const body = await response.text();
|
||||||
|
const json = JSON.parse(body);
|
||||||
|
|
||||||
|
return json.code;
|
||||||
|
}
|
||||||
|
|
||||||
async function close(token, secondCookie) {
|
async function close(token, secondCookie) {
|
||||||
for (const ticketId of ticketsId) {
|
for (const ticketId of ticketsId) {
|
||||||
const ostUri = `${config.host}/ajax.php/tickets/${ticketId}/status`;
|
const lockCode = await getLockCode(token, secondCookie, ticketId);
|
||||||
const data = {
|
let form = new FormData();
|
||||||
status_id: config.newStatusId,
|
form.append('__CSRFToken__', token);
|
||||||
comments: config.comment,
|
form.append('id', ticketId);
|
||||||
undefined: config.action
|
form.append('a', config.responseType);
|
||||||
};
|
form.append('lockCode', lockCode);
|
||||||
|
form.append('from_email_id', config.fromEmailId);
|
||||||
|
form.append('reply-to', config.replyTo);
|
||||||
|
form.append('cannedResp', 0);
|
||||||
|
form.append('response', config.comment);
|
||||||
|
form.append('signature', 'none');
|
||||||
|
form.append('reply_status_id', config.newStatusId);
|
||||||
|
|
||||||
|
const ostUri = `${config.host}/tickets.php?id=${ticketId}`;
|
||||||
const params = {
|
const params = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: new URLSearchParams(data),
|
body: form,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
||||||
'X-CSRFToken': token,
|
|
||||||
'Cookie': secondCookie
|
'Cookie': secondCookie
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return fetch(ostUri, params);
|
return fetch(ostUri, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,21 @@
|
||||||
"Module": {
|
"Module": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"Notification": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"NotificationAcl": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"NotificationConfig": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"NotificationQueue": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"NotificationSubscription": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Province": {
|
"Province": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -101,6 +116,9 @@
|
||||||
"Town": {
|
"Town": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"Url": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"UserConfig": {
|
"UserConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -102,6 +102,13 @@
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$authenticated",
|
"principalId": "$authenticated",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "privileges",
|
||||||
|
"accessType": "*",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$authenticated",
|
||||||
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/notification/send')(Self);
|
||||||
|
require('../methods/notification/clean')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "Notification",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "util.notification"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"subscription": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "NotificationSubscription",
|
||||||
|
"foreignKey": "notificationFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "NotificationAcl",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "util.notificationAcl"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"notification": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Notification",
|
||||||
|
"foreignKey": "notificationFk"
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Role",
|
||||||
|
"foreignKey": "roleFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "NotificationConfig",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "util.notificationConfig"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"cleanDays": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"name": "NotificationQueue",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "util.notificationQueue"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"notification": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Notification",
|
||||||
|
"foreignKey": "notificationFk",
|
||||||
|
"primaryKey": "name"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Account",
|
||||||
|
"foreignKey": "authorFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"name": "NotificationSubscription",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "util.notificationSubscription"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"notificationFk": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"userFk": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"notification": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Notification",
|
||||||
|
"foreignKey": "notificationFk"
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Account",
|
||||||
|
"foreignKey": "userFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,9 +27,6 @@
|
||||||
"newStatusId": {
|
"newStatusId": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"action": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"day": {
|
"day": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
@ -47,6 +44,15 @@
|
||||||
},
|
},
|
||||||
"portDb": {
|
"portDb": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"responseType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"fromEmailId": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"replyTo": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "Url",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "salix.url"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"appName": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true,
|
||||||
|
"id": 1
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true,
|
||||||
|
"id": 2
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,8 +13,4 @@ CREATE TABLE `vn`.`osTicketConfig` (
|
||||||
`passwordDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
`passwordDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
`portDb` int(11) DEFAULT NULL,
|
`portDb` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`)
|
|
||||||
VALUES
|
|
||||||
(0, 'https://cau.verdnatura.es/scp', NULL, NULL, 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente', NULL, NULL, NULL, NULL);
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalId)
|
||||||
|
VALUES ('WorkerDisableExcluded','*','*','ALLOW','hr');
|
|
@ -0,0 +1,28 @@
|
||||||
|
DROP FUNCTION IF EXISTS `util`.`notification_send`;
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`notification_send`(vNotificationName VARCHAR(255), vParams TEXT, vAuthorFk INT)
|
||||||
|
RETURNS INT
|
||||||
|
MODIFIES SQL DATA
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Sends a notification.
|
||||||
|
*
|
||||||
|
* @param vNotificationName The notification name
|
||||||
|
* @param vParams The notification parameters formatted as JSON
|
||||||
|
* @param vAuthorFk The notification author or %NULL if there is no author
|
||||||
|
* @return The notification id
|
||||||
|
*/
|
||||||
|
DECLARE vNotificationFk INT;
|
||||||
|
|
||||||
|
SELECT id INTO vNotificationFk
|
||||||
|
FROM `notification`
|
||||||
|
WHERE `name` = vNotificationName;
|
||||||
|
|
||||||
|
INSERT INTO notificationQueue
|
||||||
|
SET notificationFk = vNotificationFk,
|
||||||
|
params = vParams,
|
||||||
|
authorFk = vAuthorFk;
|
||||||
|
|
||||||
|
RETURN LAST_INSERT_ID();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,63 @@
|
||||||
|
USE util;
|
||||||
|
|
||||||
|
CREATE TABLE notification(
|
||||||
|
id INT PRIMARY KEY,
|
||||||
|
`name` VARCHAR(255) UNIQUE,
|
||||||
|
`description` VARCHAR(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE notificationAcl(
|
||||||
|
notificationFk INT,
|
||||||
|
roleFk INT(10) unsigned,
|
||||||
|
PRIMARY KEY(notificationFk, roleFk)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_2` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
CREATE TABLE notificationSubscription(
|
||||||
|
notificationFk INT,
|
||||||
|
userFk INT(10) unsigned,
|
||||||
|
PRIMARY KEY(notificationFk, userFk)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user`(`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
CREATE TABLE notificationQueue(
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
notificationFk VARCHAR(255),
|
||||||
|
params JSON,
|
||||||
|
authorFk INT(10) unsigned NULL,
|
||||||
|
`status` ENUM('pending', 'sent', 'error') NOT NULL DEFAULT 'pending',
|
||||||
|
created DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
INDEX(notificationFk),
|
||||||
|
INDEX(authorFk),
|
||||||
|
INDEX(status)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `nnotificationQueue_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`name`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `notificationQueue_ibfk_2` FOREIGN KEY (`authorFk`) REFERENCES `account`.`user`(`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
CREATE TABLE notificationConfig(
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
cleanDays MEDIUMINT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO notificationConfig
|
||||||
|
SET cleanDays = 90;
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE `vn`.`osTicketConfig` DROP COLUMN `action`;
|
||||||
|
ALTER TABLE `vn`.`osTicketConfig` ADD responseType varchar(100) NULL;
|
||||||
|
ALTER TABLE `vn`.`osTicketConfig` ADD fromEmailId INT NULL;
|
||||||
|
ALTER TABLE `vn`.`osTicketConfig` ADD replyTo varchar(100) NULL;
|
||||||
|
|
||||||
|
UPDATE `vn`.`osTicketConfig`
|
||||||
|
SET responseType='reply', fromEmailId=5, replyTo='all'
|
||||||
|
WHERE id=0;
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Notification', '*', 'WRITE', 'ALLOW', 'ROLE', 'developer');
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`;
|
|
@ -0,0 +1,12 @@
|
||||||
|
CREATE TABLE `vn`.`packingSiteConfig` (
|
||||||
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`shinobiUrl` varchar(255) NOT NULL,
|
||||||
|
`shinobiToken` varchar(255) NOT NULL,
|
||||||
|
`shinobiGroupKey` varchar(255) NOT NULL,
|
||||||
|
`avgBoxingTime` INT(3) NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Boxing', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,56 @@
|
||||||
|
ALTER TABLE `vn`.`packingSite` ADD monitorId varchar(255) NULL;
|
||||||
|
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'VbiUcajdaT'
|
||||||
|
WHERE code = 'h1';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'qKMPn9aaVe'
|
||||||
|
WHERE code = 'h2';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '3CtdIAGPAv'
|
||||||
|
WHERE code = 'h3';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'Xme2hiqz1f'
|
||||||
|
WHERE code = 'h4';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'aulxefgfJU'
|
||||||
|
WHERE code = 'h5';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '6Ou0D1bhBw'
|
||||||
|
WHERE code = 'h6';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'eVUvnE6pNw'
|
||||||
|
WHERE code = 'h7';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '0wsmSvqmrs'
|
||||||
|
WHERE code = 'h8';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'r2l2RyyF4I'
|
||||||
|
WHERE code = 'h9';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'EdjHLIiDVD'
|
||||||
|
WHERE code = 'h10';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'czC45kmwqI'
|
||||||
|
WHERE code = 'h11';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'PNsmxPaCwQ'
|
||||||
|
WHERE code = 'h12';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'agVssO0FDC'
|
||||||
|
WHERE code = 'h13';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'f2SPNENHPo'
|
||||||
|
WHERE code = 'h14';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '6UR7gUZxks'
|
||||||
|
WHERE code = 'h15';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'bOB0f8WZ2V'
|
||||||
|
WHERE code = 'h16';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'MIR1nXaL0n'
|
||||||
|
WHERE code = 'h17';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '0Oj9SgGTXR'
|
||||||
|
WHERE code = 'h18';
|
|
@ -0,0 +1,33 @@
|
||||||
|
CREATE TABLE `salix`.`url` (
|
||||||
|
`appName` varchar(100) NOT NULL,
|
||||||
|
`environment` varchar(100) NOT NULL,
|
||||||
|
`url` varchar(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`appName`,`environment`)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||||
|
VALUES
|
||||||
|
('salix', 'production', 'https://salix.verdnatura.es/#!/');
|
||||||
|
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||||
|
VALUES
|
||||||
|
('salix', 'test', 'https://test-salix.verdnatura.es/#!/');
|
||||||
|
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||||
|
VALUES
|
||||||
|
('salix', 'dev', 'http://localhost:5000/#!/');
|
||||||
|
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||||
|
VALUES
|
||||||
|
('lilium', 'production', 'https://lilium.verdnatura.es/#/');
|
||||||
|
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||||
|
VALUES
|
||||||
|
('lilium', 'test', 'https://test-lilium.verdnatura.es/#/');
|
||||||
|
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||||
|
VALUES
|
||||||
|
('lilium', 'dev', 'http://localhost:8080/#/');
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Url', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Url', '*', 'WRITE', 'ALLOW', 'ROLE', 'it');
|
|
@ -14,10 +14,10 @@ INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
|
||||||
('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66);
|
('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66);
|
||||||
|
|
||||||
INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`)
|
INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'it@gotamcity.com', 'incidences@gotamcity.com');
|
(1, 'it@gotamcity.com', 'incidences@gotamcity.com');
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', '6');
|
('1', '6');
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ INSERT INTO `account`.`roleConfig`(`id`, `mysqlPassword`, `rolePrefix`, `userPre
|
||||||
|
|
||||||
CALL `account`.`role_sync`;
|
CALL `account`.`role_sync`;
|
||||||
|
|
||||||
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`, `image`)
|
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`, `image`, `bcryptPassword`)
|
||||||
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'en', '4fa3ada0-3ac4-11eb-9ab8-27f6fc3b85fd'
|
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'en', '4fa3ada0-3ac4-11eb-9ab8-27f6fc3b85fd', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2'
|
||||||
FROM `account`.`role` WHERE id <> 20
|
FROM `account`.`role` WHERE id <> 20
|
||||||
ORDER BY id;
|
ORDER BY id;
|
||||||
|
|
||||||
|
@ -918,21 +918,21 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
||||||
(3, 'Perdida', 'LOST');
|
(3, 'Perdida', 'LOST');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
|
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1),
|
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1, 'pc1'),
|
||||||
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1),
|
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1, NULL),
|
||||||
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2),
|
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2, NULL),
|
||||||
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2),
|
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2, NULL),
|
||||||
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3),
|
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||||
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3),
|
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||||
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL),
|
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL,NULL),
|
||||||
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1),
|
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1, NULL),
|
||||||
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2),
|
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2, NULL),
|
||||||
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3),
|
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||||
(11, 7, 8, 71, NOW(), NULL, 1, 18, NULL, 94, 3),
|
(11, 7, 8, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||||
(12, 7, 9, 71, NOW(), NULL, 1, 18, NULL, 94, 3),
|
(12, 7, 9, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||||
(13, 1, 10, 71, NOW(), NULL, 1, 18, NULL, 94, 3);
|
(13, 1, 10,71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
||||||
|
@ -1778,10 +1778,10 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
|
||||||
(1, 31, 4, 21, 2),
|
(1, 31, 4, 21, 2),
|
||||||
(2, 32, 3, 21, 3);
|
(2, 32, 3, 21, 3);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`)
|
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Contact description', 50),
|
(1, 50),
|
||||||
(2, 'Contact description', 30);
|
(2, 30);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1791,7 +1791,7 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa
|
||||||
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||||
|
|
||||||
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, '02676A049183', DEFAULT, 1106),
|
(1, '02676A049183', DEFAULT, 1106),
|
||||||
(2, '02676A049183', DEFAULT, 1106),
|
(2, '02676A049183', DEFAULT, 1106),
|
||||||
(3, '02676A049183', DEFAULT, 1107),
|
(3, '02676A049183', DEFAULT, 1107),
|
||||||
|
@ -2658,6 +2658,39 @@ INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`,
|
||||||
VALUES
|
VALUES
|
||||||
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`host` (`id`, `code`, `description`, `warehouseFk`, `bankFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 'pc1', 'pc host', 1, 1);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`packingSite` (`id`, `code`, `hostFk`, `monitorId`)
|
||||||
|
VALUES
|
||||||
|
(1, 'h1', 1, '');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`packingSiteConfig` (`shinobiUrl`, `shinobiToken`, `shinobiGroupKey`, `avgBoxingTime`)
|
||||||
|
VALUES
|
||||||
|
('', 'SHINNOBI_TOKEN', 'GROUP_TOKEN', 6000);
|
||||||
|
INSERT INTO `util`.`notificationConfig`
|
||||||
|
SET `cleanDays` = 90;
|
||||||
|
|
||||||
|
INSERT INTO `util`.`notification` (`id`, `name`, `description`)
|
||||||
|
VALUES
|
||||||
|
(1, 'print-email', 'notification fixture one');
|
||||||
|
|
||||||
|
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 9);
|
||||||
|
|
||||||
|
INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`)
|
||||||
|
VALUES
|
||||||
|
(1, 'print-email', '{"id": "1"}', 9, 'pending', util.VN_CURDATE()),
|
||||||
|
(2, 'print-email', '{"id": "2"}', null, 'pending', util.VN_CURDATE()),
|
||||||
|
(3, 'print-email', null, null, 'pending', util.VN_CURDATE());
|
||||||
|
|
||||||
|
INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 1109),
|
||||||
|
(1, 1110);
|
||||||
|
|
||||||
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 9);
|
(1, 9);
|
||||||
|
@ -2677,3 +2710,7 @@ INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `lev
|
||||||
UPDATE `account`.`user`
|
UPDATE `account`.`user`
|
||||||
SET `hasGrant` = 1
|
SET `hasGrant` = 1
|
||||||
WHERE `id` = 66;
|
WHERE `id` = 66;
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
||||||
|
VALUES
|
||||||
|
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', 'open', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');
|
|
@ -29,4 +29,13 @@ describe('Account LDAP path', () => {
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
expect(message.text).toContain('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should reset data', async() => {
|
||||||
|
await page.waitToClick(selectors.accountLdap.checkEnable);
|
||||||
|
await page.waitToClick(selectors.accountLdap.save);
|
||||||
|
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Data saved!');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,4 +29,13 @@ describe('Account Samba path', () => {
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
expect(message.text).toContain('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should reset data', async() => {
|
||||||
|
await page.waitToClick(selectors.accountSamba.checkEnable);
|
||||||
|
await page.waitToClick(selectors.accountSamba.save);
|
||||||
|
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Data saved!');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('Account privileges path', () => {
|
||||||
|
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toContain(`You don't have enough privileges`);
|
expect(message.text).toContain(`You don't have grant privilege`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error when change role', async() => {
|
it('should throw error when change role', async() => {
|
||||||
|
@ -33,7 +33,7 @@ describe('Account privileges path', () => {
|
||||||
|
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toContain(`You don't have enough privileges`);
|
expect(message.text).toContain(`You don't have grant privilege`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,7 +56,16 @@ describe('Account privileges path', () => {
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should change role', async() => {
|
it('should throw error when change role and not own role', async() => {
|
||||||
|
await page.autocompleteSearch(selectors.accountPrivileges.role, 'itBoss');
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
|
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain(`You don't own the role and you can't assign it to another user`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change role to employee', async() => {
|
||||||
await page.autocompleteSearch(selectors.accountPrivileges.role, 'employee');
|
await page.autocompleteSearch(selectors.accountPrivileges.role, 'employee');
|
||||||
await page.waitToClick(selectors.accountPrivileges.save);
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
@ -67,6 +76,18 @@ describe('Account privileges path', () => {
|
||||||
expect(message.text).toContain(`Data saved!`);
|
expect(message.text).toContain(`Data saved!`);
|
||||||
expect(result).toContain('employee');
|
expect(result).toContain('employee');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return role to developer', async() => {
|
||||||
|
await page.autocompleteSearch(selectors.accountPrivileges.role, 'developer');
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
await page.reloadSection('account.card.privileges');
|
||||||
|
const result = await page.waitToGetProperty(selectors.accountPrivileges.role, 'value');
|
||||||
|
|
||||||
|
expect(message.text).toContain(`Data saved!`);
|
||||||
|
expect(result).toContain('developer');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as developer again', () => {
|
describe('as developer again', () => {
|
||||||
|
@ -76,7 +97,12 @@ describe('Account privileges path', () => {
|
||||||
|
|
||||||
await page.waitToClick(selectors.accountPrivileges.checkHasGrant);
|
await page.waitToClick(selectors.accountPrivileges.checkHasGrant);
|
||||||
await page.waitToClick(selectors.accountPrivileges.save);
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain(`Data saved!`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should logIn in developer', async() => {
|
||||||
await page.reloadSection('account.card.privileges');
|
await page.reloadSection('account.card.privileges');
|
||||||
const result = await page.checkboxState(selectors.accountPrivileges.checkHasGrant);
|
const result = await page.checkboxState(selectors.accountPrivileges.checkHasGrant);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,21 @@ export default class App {
|
||||||
localStorage.setItem('salix-version', newVersion);
|
localStorage.setItem('salix-version', newVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUrl(route, appName = 'lilium') {
|
||||||
|
const env = process.env.NODE_ENV;
|
||||||
|
const filter = {
|
||||||
|
where: {and: [
|
||||||
|
{appName: appName},
|
||||||
|
{environment: env}
|
||||||
|
]}
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.logger.$http.get('Urls/findOne', {filter})
|
||||||
|
.then(res => {
|
||||||
|
return res.data.url + route;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.service('vnApp', App);
|
ngModule.service('vnApp', App);
|
||||||
|
|
|
@ -133,5 +133,8 @@
|
||||||
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.",
|
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.",
|
||||||
"Password does not meet requirements": "Password does not meet requirements",
|
"Password does not meet requirements": "Password does not meet requirements",
|
||||||
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
|
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
|
||||||
"Not enough privileges to edit a client": "Not enough privileges to edit a client"
|
"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"
|
||||||
|
}
|
||||||
|
|
|
@ -236,5 +236,8 @@
|
||||||
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
||||||
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
||||||
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
||||||
"This route does not exists": "Esta ruta no existe"
|
"This route does not exists": "Esta ruta no existe",
|
||||||
}
|
"Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*",
|
||||||
|
"You don't have grant privilege": "No tienes privilegios para dar privilegios",
|
||||||
|
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario"
|
||||||
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
Privileges: Privilegios
|
Privileges: Privilegios
|
||||||
Has grant: Tiene privilegios
|
Has grant: Puede delegar privilegios
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id',
|
description: 'The claim id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,11 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.claimPickupEmail = async ctx => {
|
Self.claimPickupEmail = async ctx => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
const $t = ctx.req.__; // $translate
|
||||||
|
const origin = ctx.req.headers.origin;
|
||||||
|
|
||||||
const args = Object.assign({}, ctx.args);
|
const args = Object.assign({}, ctx.args);
|
||||||
const params = {
|
const params = {
|
||||||
recipient: args.recipient,
|
recipient: args.recipient,
|
||||||
|
@ -52,6 +57,34 @@ module.exports = Self => {
|
||||||
for (const param in args)
|
for (const param in args)
|
||||||
params[param] = args[param];
|
params[param] = args[param];
|
||||||
|
|
||||||
|
const claim = await models.Claim.findById(args.id, {
|
||||||
|
fields: ['id', 'clientFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'client',
|
||||||
|
scope: {
|
||||||
|
fields: ['name', 'salesPersonFk']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const message = $t('Claim pickup order sent', {
|
||||||
|
claimId: args.id,
|
||||||
|
clientName: claim.client().name,
|
||||||
|
claimUrl: `${origin}/#!/claim/${args.id}/summary`,
|
||||||
|
});
|
||||||
|
|
||||||
|
const salesPersonId = claim.client().salesPersonFk;
|
||||||
|
if (salesPersonId)
|
||||||
|
await models.Chat.sendCheckingPresence(ctx, salesPersonId, message);
|
||||||
|
|
||||||
|
await models.ClaimLog.create({
|
||||||
|
originFk: args.id,
|
||||||
|
userFk: userId,
|
||||||
|
action: 'insert',
|
||||||
|
description: 'Claim-pickup-order sent',
|
||||||
|
changedModel: 'Mail'
|
||||||
|
});
|
||||||
|
|
||||||
const email = new Email('claim-pickup-order', params);
|
const email = new Email('claim-pickup-order', params);
|
||||||
|
|
||||||
return email.send();
|
return email.send();
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "number",
|
|
||||||
"id": true,
|
"id": true,
|
||||||
|
"type": "number",
|
||||||
"description": "Identifier"
|
"description": "Identifier"
|
||||||
},
|
},
|
||||||
"code": {
|
"code": {
|
||||||
|
|
|
@ -57,11 +57,11 @@
|
||||||
"model": "ClaimState",
|
"model": "ClaimState",
|
||||||
"foreignKey": "claimStateFk"
|
"foreignKey": "claimStateFk"
|
||||||
},
|
},
|
||||||
"claimRma": {
|
"rmas": {
|
||||||
"type": "belongsTo",
|
"type": "hasMany",
|
||||||
"model": "ClaimRma",
|
"model": "ClaimRma",
|
||||||
"foreignKey": "rma",
|
"foreignKey": "code",
|
||||||
"primaryKey": "code"
|
"primaryKey": "rma"
|
||||||
},
|
},
|
||||||
"client": {
|
"client": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
readonly="true">
|
readonly="true">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="Created"
|
label="Created"
|
||||||
field="::$ctrl.claim.created | date:'yyyy-MM-dd HH:mm'"
|
field="::$ctrl.claim.created | date:'yyyy-MM-dd HH:mm'"
|
||||||
readonly="true">
|
readonly="true">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
label="Pick up"
|
label="Pick up"
|
||||||
ng-model="$ctrl.claim.hasToPickUp"
|
ng-model="$ctrl.claim.hasToPickUp"
|
||||||
vn-acl="claimManager"
|
vn-acl="claimManager"
|
||||||
info="When checked will notify to the salesPerson">
|
title="{{'When checked will notify to the salesPerson' | translate}}">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -5,5 +5,5 @@ Responsability: Responsabilidad
|
||||||
Company: Empresa
|
Company: Empresa
|
||||||
Sales/Client: Comercial/Cliente
|
Sales/Client: Comercial/Cliente
|
||||||
Pick up: Recoger
|
Pick up: Recoger
|
||||||
When checked will notify a pickup to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial
|
When checked will notify to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial
|
||||||
Packages received: Bultos recibidos
|
Packages received: Bultos recibidos
|
||||||
|
|
|
@ -25,16 +25,23 @@
|
||||||
</vn-button-menu>
|
</vn-button-menu>
|
||||||
</h5>
|
</h5>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-one>
|
<vn-auto>
|
||||||
<vn-label-value
|
<h4>
|
||||||
label="Created"
|
<a
|
||||||
value="{{$ctrl.summary.claim.created | date: 'dd/MM/yyyy'}}">
|
ui-sref="claim.card.basicData({id:$ctrl.claim.id})"
|
||||||
</vn-label-value>
|
target="_self">
|
||||||
<vn-label-value
|
<span translate vn-tooltip="Go to">Basic data</span>
|
||||||
label="State"
|
</a>
|
||||||
value="{{$ctrl.summary.claim.claimState.description}}">
|
</h4>
|
||||||
</vn-label-value>
|
<vn-label-value
|
||||||
<vn-label-value
|
label="Created"
|
||||||
|
value="{{$ctrl.summary.claim.created | date: 'dd/MM/yyyy'}}">
|
||||||
|
</vn-label-value>
|
||||||
|
<vn-label-value
|
||||||
|
label="State"
|
||||||
|
value="{{$ctrl.summary.claim.claimState.description}}">
|
||||||
|
</vn-label-value>
|
||||||
|
<vn-label-value
|
||||||
label="Salesperson"
|
label="Salesperson"
|
||||||
value="{{$ctrl.summary.claim.client.salesPersonUser.name}}">
|
value="{{$ctrl.summary.claim.client.salesPersonUser.name}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
|
@ -42,16 +49,23 @@
|
||||||
label="Attended by"
|
label="Attended by"
|
||||||
value="{{$ctrl.summary.claim.worker.user.nickname}}">
|
value="{{$ctrl.summary.claim.worker.user.nickname}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</vn-one>
|
<vn-check
|
||||||
|
class="vn-mr-md"
|
||||||
|
label="Pick up"
|
||||||
|
ng-model="$ctrl.summary.claim.hasToPickUp"
|
||||||
|
title="{{'When checked will notify to the salesPerson' | translate}}"
|
||||||
|
disabled="true">
|
||||||
|
</vn-check>
|
||||||
|
</vn-auto>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 ng-show="$ctrl.isSalesPerson && $ctrl.summary.observations.length">
|
<h4 ng-show="$ctrl.isSalesPerson && $ctrl.summary.observations.length">
|
||||||
<a
|
<a
|
||||||
ui-sref="claim.card.note.index({id:$ctrl.claim.id})"
|
ui-sref="claim.card.note.index({id:$ctrl.claim.id})"
|
||||||
target="_self">
|
target="_self">
|
||||||
<span translate vn-tooltip="Go to">Observations</span>
|
<span translate vn-tooltip="Go to">Observations</span>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
<h4
|
<h4
|
||||||
ng-show="!$ctrl.isSalesPerson && $ctrl.summary.observations.length"
|
ng-show="!$ctrl.isSalesPerson && $ctrl.summary.observations.length"
|
||||||
translate>
|
translate>
|
||||||
Observations
|
Observations
|
||||||
|
@ -70,13 +84,13 @@
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 ng-show="$ctrl.isSalesPerson">
|
<h4 ng-show="$ctrl.isSalesPerson">
|
||||||
<a
|
<a
|
||||||
ui-sref="claim.card.detail({id:$ctrl.claim.id})"
|
ui-sref="claim.card.detail({id:$ctrl.claim.id})"
|
||||||
target="_self">
|
target="_self">
|
||||||
<span translate vn-tooltip="Go to">Detail</span>
|
<span translate vn-tooltip="Go to">Detail</span>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
<h4
|
<h4
|
||||||
ng-show="!$ctrl.isSalesPerson"
|
ng-show="!$ctrl.isSalesPerson"
|
||||||
translate>
|
translate>
|
||||||
Detail
|
Detail
|
||||||
|
@ -98,7 +112,7 @@
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
|
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk, saleClaimed.sale.id)"
|
ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk, saleClaimed.sale.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::saleClaimed.sale.itemFk | zeroFill:6}}
|
{{::saleClaimed.sale.itemFk | zeroFill:6}}
|
||||||
|
@ -111,7 +125,7 @@
|
||||||
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
|
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
|
||||||
<vn-td number>{{::saleClaimed.sale.discount}} %</vn-td>
|
<vn-td number>{{::saleClaimed.sale.discount}} %</vn-td>
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
{{saleClaimed.sale.quantity * saleClaimed.sale.price *
|
{{saleClaimed.sale.quantity * saleClaimed.sale.price *
|
||||||
((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}}
|
((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}}
|
||||||
</vn-td>
|
</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
@ -123,7 +137,7 @@
|
||||||
<h4 translate>Photos</h4>
|
<h4 translate>Photos</h4>
|
||||||
<vn-horizontal class="photo-list">
|
<vn-horizontal class="photo-list">
|
||||||
<section class="photo" ng-repeat="photo in photos">
|
<section class="photo" ng-repeat="photo in photos">
|
||||||
<section class="image" on-error-src
|
<section class="image" on-error-src
|
||||||
ng-style="{'background': 'url(' + $ctrl.getImagePath(photo.dmsFk) + ')'}"
|
ng-style="{'background': 'url(' + $ctrl.getImagePath(photo.dmsFk) + ')'}"
|
||||||
zoom-image="{{$ctrl.getImagePath(photo.dmsFk)}}"
|
zoom-image="{{$ctrl.getImagePath(photo.dmsFk)}}"
|
||||||
ng-if="photo.dms.contentType != 'video/mp4'">
|
ng-if="photo.dms.contentType != 'video/mp4'">
|
||||||
|
@ -137,13 +151,13 @@
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 ng-show="$ctrl.isClaimManager">
|
<h4 ng-show="$ctrl.isClaimManager">
|
||||||
<a
|
<a
|
||||||
ui-sref="claim.card.development({id:$ctrl.claim.id})"
|
ui-sref="claim.card.development({id:$ctrl.claim.id})"
|
||||||
target="_self">
|
target="_self">
|
||||||
<span translate vn-tooltip="Go to">Development</span>
|
<span translate vn-tooltip="Go to">Development</span>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
<h4
|
<h4
|
||||||
translate
|
translate
|
||||||
ng-show="!$ctrl.isClaimManager">
|
ng-show="!$ctrl.isClaimManager">
|
||||||
Development
|
Development
|
||||||
|
@ -165,8 +179,8 @@
|
||||||
<vn-td>{{::development.claimResult.description}}</vn-td>
|
<vn-td>{{::development.claimResult.description}}</vn-td>
|
||||||
<vn-td>{{::development.claimResponsible.description}}</vn-td>
|
<vn-td>{{::development.claimResponsible.description}}</vn-td>
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="workerDescriptor.show($event, development.workerFk)">
|
ng-click="workerDescriptor.show($event, development.workerFk)">
|
||||||
{{::development.worker.user.nickname}}
|
{{::development.worker.user.nickname}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -179,21 +193,21 @@
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 ng-show="$ctrl.isClaimManager">
|
<h4 ng-show="$ctrl.isClaimManager">
|
||||||
<a
|
<a
|
||||||
ui-sref="claim.card.action({id:$ctrl.claim.id})"
|
ui-sref="claim.card.action({id:$ctrl.claim.id})"
|
||||||
target="_self">
|
target="_self">
|
||||||
<span translate vn-tooltip="Go to">Action</span>
|
<span translate vn-tooltip="Go to">Action</span>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
<h4
|
<h4
|
||||||
translate
|
translate
|
||||||
ng-show="!$ctrl.isClaimManager">
|
ng-show="!$ctrl.isClaimManager">
|
||||||
Action
|
Action
|
||||||
</h4>
|
</h4>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-range
|
<vn-range
|
||||||
vn-one
|
vn-one
|
||||||
disabled="true"
|
disabled="true"
|
||||||
label="Responsability"
|
label="Responsability"
|
||||||
min-label="Company"
|
min-label="Company"
|
||||||
|
@ -224,14 +238,14 @@
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="action in $ctrl.summary.actions">
|
<vn-tr ng-repeat="action in $ctrl.summary.actions">
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="itemDescriptor.show($event, action.sale.itemFk, action.sale.id)"
|
ng-click="itemDescriptor.show($event, action.sale.itemFk, action.sale.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::action.sale.itemFk | zeroFill:6}}
|
{{::action.sale.itemFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="ticketDescriptor.show($event, action.sale.ticket.id)"
|
ng-click="ticketDescriptor.show($event, action.sale.ticket.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::action.sale.ticket.id}}
|
{{::action.sale.ticket.id}}
|
||||||
|
@ -258,9 +272,9 @@
|
||||||
vn-id="item-descriptor"
|
vn-id="item-descriptor"
|
||||||
warehouse-fk="$ctrl.vnConfig.warehouseFk">
|
warehouse-fk="$ctrl.vnConfig.warehouseFk">
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
<vn-worker-descriptor-popover
|
<vn-worker-descriptor-popover
|
||||||
vn-id="worker-descriptor">
|
vn-id="worker-descriptor">
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
<vn-ticket-descriptor-popover
|
<vn-ticket-descriptor-popover
|
||||||
vn-id="ticket-descriptor">
|
vn-id="ticket-descriptor">
|
||||||
</vn-ticket-descriptor-popover>
|
</vn-ticket-descriptor-popover>
|
||||||
|
|
|
@ -425,14 +425,19 @@ module.exports = Self => {
|
||||||
|
|
||||||
account.observe('before save', async ctx => {
|
account.observe('before save', async ctx => {
|
||||||
if (ctx.isNewInstance) return;
|
if (ctx.isNewInstance) return;
|
||||||
ctx.hookState.oldInstance = JSON.parse(JSON.stringify(ctx.currentInstance));
|
if (ctx.currentInstance)
|
||||||
|
ctx.hookState.oldInstance = JSON.parse(JSON.stringify(ctx.currentInstance));
|
||||||
});
|
});
|
||||||
|
|
||||||
account.observe('after save', async ctx => {
|
account.observe('after save', async ctx => {
|
||||||
const changes = ctx.data || ctx.instance;
|
const changes = ctx.data || ctx.instance;
|
||||||
if (!ctx.isNewInstance && changes) {
|
if (!ctx.isNewInstance && changes) {
|
||||||
const oldData = ctx.hookState.oldInstance;
|
const oldData = ctx.hookState.oldInstance;
|
||||||
const hasChanges = oldData.name != changes.name || oldData.active != changes.active;
|
let hasChanges;
|
||||||
|
|
||||||
|
if (oldData)
|
||||||
|
hasChanges = oldData.name != changes.name || oldData.active != changes.active;
|
||||||
|
|
||||||
if (!hasChanges) return;
|
if (!hasChanges) return;
|
||||||
|
|
||||||
const isClient = await Self.app.models.Client.count({id: oldData.id});
|
const isClient = await Self.app.models.Client.count({id: oldData.id});
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
const https = require('https');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('getVideo', {
|
||||||
|
description: 'Get packing video',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'Ticket id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'filename',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description: 'Time to add'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'req',
|
||||||
|
type: 'object',
|
||||||
|
http: {source: 'req'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'res',
|
||||||
|
type: 'object',
|
||||||
|
http: {source: 'res'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/getVideo`,
|
||||||
|
verb: 'GET',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.getVideo = async(id, filename, req, res, options) => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
|
||||||
|
|
||||||
|
const query = `
|
||||||
|
SELECT
|
||||||
|
e.id,
|
||||||
|
ps.monitorId,
|
||||||
|
e.created
|
||||||
|
FROM expedition e
|
||||||
|
JOIN host h ON Convert(h.code USING utf8mb3) COLLATE utf8mb3_unicode_ci = e.hostFk
|
||||||
|
JOIN packingSite ps ON ps.hostFk = h.id
|
||||||
|
WHERE e.id = ?;`;
|
||||||
|
const [expedition] = await models.Expedition.rawSql(query, [id]);
|
||||||
|
const monitorId = expedition.monitorId;
|
||||||
|
|
||||||
|
const videoUrl =
|
||||||
|
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}/${filename}`;
|
||||||
|
|
||||||
|
const headers = Object.assign({}, req.headers, {
|
||||||
|
host: 'shinobi.verdnatura.es'
|
||||||
|
});
|
||||||
|
const httpOptions = {
|
||||||
|
host: 'shinobi.verdnatura.es',
|
||||||
|
path: videoUrl,
|
||||||
|
port: 443,
|
||||||
|
headers
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const req = https.request(httpOptions, shinobiRes => {
|
||||||
|
shinobiRes.pause();
|
||||||
|
res.writeHeader(shinobiRes.statusCode, shinobiRes.headers);
|
||||||
|
shinobiRes.pipe(res);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', () => {
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('end', () => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,78 @@
|
||||||
|
const axios = require('axios');
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('getVideoList', {
|
||||||
|
description: 'Get video list of expedition id',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'Expedition id'
|
||||||
|
}, {
|
||||||
|
arg: 'from',
|
||||||
|
type: 'number',
|
||||||
|
required: false,
|
||||||
|
}, {
|
||||||
|
arg: 'to',
|
||||||
|
type: 'number',
|
||||||
|
required: false,
|
||||||
|
}
|
||||||
|
], returns: {
|
||||||
|
type: ['object'],
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/getVideoList`,
|
||||||
|
verb: 'GET',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.getVideoList = async(id, from, to, options) => {
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
|
||||||
|
|
||||||
|
const query = `
|
||||||
|
SELECT
|
||||||
|
e.id,
|
||||||
|
ps.monitorId,
|
||||||
|
e.created
|
||||||
|
FROM expedition e
|
||||||
|
JOIN host h ON Convert(h.code USING utf8mb3) COLLATE utf8mb3_unicode_ci = e.hostFk
|
||||||
|
JOIN packingSite ps ON ps.hostFk = h.id
|
||||||
|
WHERE e.id = ?;`;
|
||||||
|
const [expedition] = await models.PackingSiteConfig.rawSql(query, [id]);
|
||||||
|
|
||||||
|
if (!from && !expedition) return [];
|
||||||
|
let start = new Date(expedition.created);
|
||||||
|
let end = new Date(start.getTime() + (packingSiteConfig.avgBoxingTime * 1000));
|
||||||
|
|
||||||
|
if (from && to) {
|
||||||
|
start.setHours(from, 0, 0);
|
||||||
|
end.setHours(to, 0, 0);
|
||||||
|
}
|
||||||
|
const offset = start.getTimezoneOffset();
|
||||||
|
start = new Date(start.getTime() - (offset * 60 * 1000));
|
||||||
|
end = new Date(end.getTime() - (offset * 60 * 1000));
|
||||||
|
|
||||||
|
const videoUrl =
|
||||||
|
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${expedition.monitorId}`;
|
||||||
|
const timeUrl = `?start=${start.toISOString().split('.')[0]}&end=${end.toISOString().split('.')[0]}`;
|
||||||
|
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}${timeUrl}`;
|
||||||
|
|
||||||
|
let response;
|
||||||
|
|
||||||
|
try {
|
||||||
|
response = await axios.get(url);
|
||||||
|
} catch (e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return response.data.videos.map(video => video.filename);
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,40 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const https = require('https');
|
||||||
|
|
||||||
|
xdescribe('boxing getVideo()', () => {
|
||||||
|
it('should return data', async() => {
|
||||||
|
const tx = await models.PackingSiteConfig.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const id = 1;
|
||||||
|
const video = 'video.mp4';
|
||||||
|
|
||||||
|
const response = {
|
||||||
|
pipe: () => {},
|
||||||
|
on: () => {},
|
||||||
|
end: () => {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = {
|
||||||
|
headers: 'apiHeader',
|
||||||
|
data: {
|
||||||
|
pipe: () => {},
|
||||||
|
on: () => {},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(https, 'request').and.returnValue(response);
|
||||||
|
|
||||||
|
const result = await models.Boxing.getVideo(id, video, req, null, options);
|
||||||
|
|
||||||
|
expect(result[0]).toEqual(response.data.videos[0].filename);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,36 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
|
describe('boxing getVideoList()', () => {
|
||||||
|
it('should return video list', async() => {
|
||||||
|
const tx = await models.PackingSiteConfig.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const id = 1;
|
||||||
|
const from = 1;
|
||||||
|
const to = 2;
|
||||||
|
|
||||||
|
const response = {
|
||||||
|
data: {
|
||||||
|
videos: [{
|
||||||
|
id: 1,
|
||||||
|
filename: 'video1.mp4'
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(response)));
|
||||||
|
|
||||||
|
const result = await models.Boxing.getVideoList(id, from, to, options);
|
||||||
|
|
||||||
|
expect(result[0]).toEqual(response.data.videos[0].filename);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -18,9 +18,12 @@ describe('ticket componentUpdate()', () => {
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
const deliveryComponenet = await models.Component.findOne({where: {code: 'delivery'}});
|
const deliveryComponenet = await models.Component.findOne({where: {code: 'delivery'}});
|
||||||
deliveryComponentId = deliveryComponenet.id;
|
deliveryComponentId = deliveryComponenet.id;
|
||||||
componentOfSaleSeven = `SELECT value FROM vn.saleComponent WHERE saleFk = 7 AND componentFk = ${deliveryComponentId}`;
|
componentOfSaleSeven = `SELECT value
|
||||||
componentOfSaleEight = `SELECT value FROM vn.saleComponent WHERE saleFk = 8 AND componentFk = ${deliveryComponentId}`;
|
FROM vn.saleComponent
|
||||||
|
WHERE saleFk = 7 AND componentFk = ${deliveryComponentId}`;
|
||||||
|
componentOfSaleEight = `SELECT value
|
||||||
|
FROM vn.saleComponent
|
||||||
|
WHERE saleFk = 8 AND componentFk = ${deliveryComponentId}`;
|
||||||
[componentValue] = await models.SaleComponent.rawSql(componentOfSaleSeven);
|
[componentValue] = await models.SaleComponent.rawSql(componentOfSaleSeven);
|
||||||
firstvalueBeforeChange = componentValue.value;
|
firstvalueBeforeChange = componentValue.value;
|
||||||
|
|
||||||
|
|
|
@ -115,14 +115,38 @@ module.exports = Self => {
|
||||||
for (let sale of sales) {
|
for (let sale of sales) {
|
||||||
const oldDiscount = sale.discount;
|
const oldDiscount = sale.discount;
|
||||||
const value = ((-sale.price * newDiscount) / 100);
|
const value = ((-sale.price * newDiscount) / 100);
|
||||||
const newComponent = models.SaleComponent.upsert({
|
|
||||||
saleFk: sale.id,
|
const manaComponent = await models.Component.findOne({
|
||||||
value: value,
|
where: {code: 'mana'}
|
||||||
componentFk: componentId}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
const manaClaimComponent = await models.Component.findOne({
|
||||||
|
where: {code: 'manaClaim'}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const [oldComponent] = await models.SaleComponent.find({
|
||||||
|
where: {
|
||||||
|
and: [
|
||||||
|
{saleFk: sale.id},
|
||||||
|
{componentFk: {inq: [manaComponent.id, manaClaimComponent.id]}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
let deletedComponent;
|
||||||
|
if (oldComponent) {
|
||||||
|
const filter = {
|
||||||
|
saleFk: sale.id,
|
||||||
|
componentFk: oldComponent.componentFk
|
||||||
|
};
|
||||||
|
deletedComponent = await models.SaleComponent.destroyAll(filter, myOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
const newComponent = await createSaleComponent(sale.id, value, componentId, myOptions);
|
||||||
|
|
||||||
const updatedSale = sale.updateAttribute('discount', newDiscount, myOptions);
|
const updatedSale = sale.updateAttribute('discount', newDiscount, myOptions);
|
||||||
|
|
||||||
promises.push(newComponent, updatedSale);
|
promises.push(newComponent, updatedSale, deletedComponent);
|
||||||
|
|
||||||
const change = `${oldDiscount}% ➔ *${newDiscount}%*`;
|
const change = `${oldDiscount}% ➔ *${newDiscount}%*`;
|
||||||
changesMade += `\r\n-${sale.itemFk}: ${sale.concept} (${sale.quantity}) ${change}`;
|
changesMade += `\r\n-${sale.itemFk}: ${sale.concept} (${sale.quantity}) ${change}`;
|
||||||
|
@ -165,4 +189,14 @@ module.exports = Self => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function createSaleComponent(saleId, value, componentId, myOptions) {
|
||||||
|
const models = Self.app.models;
|
||||||
|
|
||||||
|
return models.SaleComponent.create({
|
||||||
|
saleFk: saleId,
|
||||||
|
value: value,
|
||||||
|
componentFk: componentId
|
||||||
|
}, myOptions);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
"AnnualAverageInvoiced": {
|
"AnnualAverageInvoiced": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"Boxing": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Component": {
|
"Component": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -20,6 +23,9 @@
|
||||||
"Packaging": {
|
"Packaging": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"PackingSiteConfig": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"PrintServerQueue": {
|
"PrintServerQueue": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/boxing/getVideo')(Self);
|
||||||
|
require('../methods/boxing/getVideoList')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "Boxing",
|
||||||
|
"base": "PersistedModel",
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"name": "PackingSiteConfig",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "packingSiteConfig"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number",
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"shinobiUrl": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"shinobiGroupKey":{
|
||||||
|
"type":"string"
|
||||||
|
},
|
||||||
|
"shinobiToken":{
|
||||||
|
"type":"string"
|
||||||
|
},
|
||||||
|
"avgBoxingTime":{
|
||||||
|
"type":"number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
<vn-card>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,21 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
class Controller extends Section {
|
||||||
|
constructor($element, $) {
|
||||||
|
super($element, $);
|
||||||
|
}
|
||||||
|
|
||||||
|
async $onInit() {
|
||||||
|
const url = await this.vnApp.getUrl(`ticket/${this.$params.id}/boxing`);
|
||||||
|
window.open(url).focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnTicketBoxing', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
ticket: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -33,3 +33,4 @@ import './dms/index';
|
||||||
import './dms/create';
|
import './dms/create';
|
||||||
import './dms/edit';
|
import './dms/edit';
|
||||||
import './sms';
|
import './sms';
|
||||||
|
import './boxing';
|
||||||
|
|
|
@ -4,6 +4,7 @@ Agency: Agencia
|
||||||
Amount: Importe
|
Amount: Importe
|
||||||
Base to commission: Base comisionable
|
Base to commission: Base comisionable
|
||||||
Boxes: Cajas
|
Boxes: Cajas
|
||||||
|
Boxing: Encajado
|
||||||
by: por
|
by: por
|
||||||
Checked: Comprobado
|
Checked: Comprobado
|
||||||
Client: Cliente
|
Client: Cliente
|
||||||
|
@ -45,7 +46,7 @@ Price gap: Diferencia de precio
|
||||||
Quantity: Cantidad
|
Quantity: Cantidad
|
||||||
Remove lines: Eliminar lineas
|
Remove lines: Eliminar lineas
|
||||||
Route: Ruta
|
Route: Ruta
|
||||||
SET OK: PONER OK
|
SET OK: PONER OK
|
||||||
Shipment: Salida
|
Shipment: Salida
|
||||||
Shipped: F. envío
|
Shipped: F. envío
|
||||||
Some fields are invalid: Algunos campos no son válidos
|
Some fields are invalid: Algunos campos no son válidos
|
||||||
|
@ -81,4 +82,4 @@ Sale tracking: Líneas preparadas
|
||||||
Pictures: Fotos
|
Pictures: Fotos
|
||||||
Log: Historial
|
Log: Historial
|
||||||
Packager: Encajador
|
Packager: Encajador
|
||||||
Palletizer: Palletizador
|
Palletizer: Palletizador
|
||||||
|
|
|
@ -24,7 +24,8 @@
|
||||||
{"state": "ticket.card.saleChecked", "icon": "assignment"},
|
{"state": "ticket.card.saleChecked", "icon": "assignment"},
|
||||||
{"state": "ticket.card.components", "icon": "icon-components"},
|
{"state": "ticket.card.components", "icon": "icon-components"},
|
||||||
{"state": "ticket.card.saleTracking", "icon": "assignment"},
|
{"state": "ticket.card.saleTracking", "icon": "assignment"},
|
||||||
{"state": "ticket.card.dms.index", "icon": "cloud_download"}
|
{"state": "ticket.card.dms.index", "icon": "cloud_download"},
|
||||||
|
{"state": "ticket.card.boxing", "icon": "science"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"keybindings": [
|
"keybindings": [
|
||||||
|
@ -66,7 +67,7 @@
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"params": {
|
"params": {
|
||||||
"ticket": "$ctrl.ticket"
|
"ticket": "$ctrl.ticket"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url" : "/step-one",
|
"url" : "/step-one",
|
||||||
|
@ -273,6 +274,15 @@
|
||||||
"params": {
|
"params": {
|
||||||
"ticket": "$ctrl.ticket"
|
"ticket": "$ctrl.ticket"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "/boxing",
|
||||||
|
"state": "ticket.card.boxing",
|
||||||
|
"component": "vn-ticket-boxing",
|
||||||
|
"description": "Boxing",
|
||||||
|
"params": {
|
||||||
|
"ticket": "$ctrl.ticket"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@
|
||||||
ng-model="$ctrl.manaCode">
|
ng-model="$ctrl.manaCode">
|
||||||
</vn-radio>
|
</vn-radio>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
<div class="simulator">
|
<div class="simulator" ng-show="$ctrl.edit.sale">
|
||||||
<p class="simulatorTitle" translate>New price</p>
|
<p class="simulatorTitle" translate>New price</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>{{$ctrl.getNewPrice() | currency: 'EUR': 2}}</strong>
|
<strong>{{$ctrl.getNewPrice() | currency: 'EUR': 2}}</strong>
|
||||||
|
@ -321,32 +321,6 @@
|
||||||
</div>
|
</div>
|
||||||
</vn-popover>
|
</vn-popover>
|
||||||
|
|
||||||
<!-- Multiple discount dialog -->
|
|
||||||
<vn-dialog vn-id="editDiscountDialog"
|
|
||||||
on-open="$ctrl.getMana()"
|
|
||||||
message="Edit discount">
|
|
||||||
<tpl-body>
|
|
||||||
<vn-spinner class="vn-pa-xs"
|
|
||||||
ng-if="$ctrl.edit.mana == null"
|
|
||||||
enable="true">
|
|
||||||
</vn-spinner>
|
|
||||||
<div ng-if="$ctrl.edit.mana != null">
|
|
||||||
<div class="vn-pa-md">
|
|
||||||
<vn-input-number vn-focus
|
|
||||||
label="Discount"
|
|
||||||
ng-model="$ctrl.edit.discount"
|
|
||||||
on-change="$ctrl.changeMultipleDiscount()"
|
|
||||||
clear-disabled="true"
|
|
||||||
suffix="%">
|
|
||||||
</vn-input-number>
|
|
||||||
</div>
|
|
||||||
<section class="header vn-pa-md">
|
|
||||||
<span>Mana: <strong>{{::$ctrl.edit.mana | currency: 'EUR': 0}}</strong></span>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</tpl-body>
|
|
||||||
</vn-dialog>
|
|
||||||
|
|
||||||
<!-- Transfer Popover -->
|
<!-- Transfer Popover -->
|
||||||
<vn-popover vn-id="transfer">
|
<vn-popover vn-id="transfer">
|
||||||
<div class="vn-pa-lg transfer">
|
<div class="vn-pa-lg transfer">
|
||||||
|
@ -490,7 +464,7 @@
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
name="discount"
|
name="discount"
|
||||||
ng-click="$ctrl.showEditDiscountDialog($event)">
|
ng-click="$ctrl.showEditDiscountPopover($event, sale)">
|
||||||
Update discount
|
Update discount
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
|
|
|
@ -243,26 +243,21 @@ class Controller extends Section {
|
||||||
|
|
||||||
showEditDiscountPopover(event, sale) {
|
showEditDiscountPopover(event, sale) {
|
||||||
if (this.isLocked) return;
|
if (this.isLocked) return;
|
||||||
|
if (sale) {
|
||||||
this.edit = {
|
this.edit = {
|
||||||
discount: sale.discount,
|
discount: sale.discount,
|
||||||
sale: sale
|
sale: sale
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
this.edit = {
|
||||||
|
discount: null,
|
||||||
|
sales: this.selectedValidSales()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
this.$.editDiscount.show(event);
|
this.$.editDiscount.show(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
showEditDiscountDialog(event) {
|
|
||||||
if (this.isLocked) return;
|
|
||||||
|
|
||||||
this.edit = {
|
|
||||||
discount: null,
|
|
||||||
sales: this.selectedValidSales()
|
|
||||||
};
|
|
||||||
|
|
||||||
this.$.editDiscountDialog.show(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
changeDiscount() {
|
changeDiscount() {
|
||||||
const sale = this.edit.sale;
|
const sale = this.edit.sale;
|
||||||
const newDiscount = this.edit.discount;
|
const newDiscount = this.edit.discount;
|
||||||
|
@ -278,11 +273,10 @@ class Controller extends Section {
|
||||||
const hasChanges = sales.some(sale => {
|
const hasChanges = sales.some(sale => {
|
||||||
return sale.discount != newDiscount;
|
return sale.discount != newDiscount;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newDiscount != null && hasChanges)
|
if (newDiscount != null && hasChanges)
|
||||||
this.updateDiscount(sales);
|
this.updateDiscount(sales);
|
||||||
|
|
||||||
this.$.editDiscountDialog.hide();
|
this.$.editDiscount.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDiscount(sales) {
|
updateDiscount(sales) {
|
||||||
|
@ -303,7 +297,7 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
getNewPrice() {
|
getNewPrice() {
|
||||||
if (this.edit) {
|
if (this.edit.sale) {
|
||||||
const sale = this.edit.sale;
|
const sale = this.edit.sale;
|
||||||
let newDiscount = sale.discount;
|
let newDiscount = sale.discount;
|
||||||
let newPrice = this.edit.price || sale.price;
|
let newPrice = this.edit.price || sale.price;
|
||||||
|
@ -505,7 +499,8 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.changeDiscount();
|
if (this.edit.sale) this.changeDiscount();
|
||||||
|
if (this.edit.sales) this.changeMultipleDiscount();
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
|
|
@ -393,7 +393,7 @@ describe('Ticket', () => {
|
||||||
secondSelectedSale.checked = true;
|
secondSelectedSale.checked = true;
|
||||||
|
|
||||||
const expectedSales = [firstSelectedSale, secondSelectedSale];
|
const expectedSales = [firstSelectedSale, secondSelectedSale];
|
||||||
controller.$.editDiscountDialog = {hide: jest.fn()};
|
controller.$.editDiscount = {hide: jest.fn()};
|
||||||
controller.edit = {
|
controller.edit = {
|
||||||
discount: 10,
|
discount: 10,
|
||||||
sales: expectedSales
|
sales: expectedSales
|
||||||
|
@ -402,7 +402,7 @@ describe('Ticket', () => {
|
||||||
controller.changeMultipleDiscount();
|
controller.changeMultipleDiscount();
|
||||||
|
|
||||||
expect(controller.updateDiscount).toHaveBeenCalledWith(expectedSales);
|
expect(controller.updateDiscount).toHaveBeenCalledWith(expectedSales);
|
||||||
expect(controller.$.editDiscountDialog.hide).toHaveBeenCalledWith();
|
expect(controller.$.editDiscount.hide).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call to the updateDiscount() method and then to the editDiscountDialog hide() method', () => {
|
it('should not call to the updateDiscount() method and then to the editDiscountDialog hide() method', () => {
|
||||||
|
@ -417,7 +417,7 @@ describe('Ticket', () => {
|
||||||
secondSelectedSale.discount = 10;
|
secondSelectedSale.discount = 10;
|
||||||
|
|
||||||
const expectedSales = [firstSelectedSale, secondSelectedSale];
|
const expectedSales = [firstSelectedSale, secondSelectedSale];
|
||||||
controller.$.editDiscountDialog = {hide: jest.fn()};
|
controller.$.editDiscount = {hide: jest.fn()};
|
||||||
controller.edit = {
|
controller.edit = {
|
||||||
discount: 10,
|
discount: 10,
|
||||||
sales: expectedSales
|
sales: expectedSales
|
||||||
|
@ -426,7 +426,7 @@ describe('Ticket', () => {
|
||||||
controller.changeMultipleDiscount();
|
controller.changeMultipleDiscount();
|
||||||
|
|
||||||
expect(controller.updateDiscount).not.toHaveBeenCalledWith(expectedSales);
|
expect(controller.updateDiscount).not.toHaveBeenCalledWith(expectedSales);
|
||||||
expect(controller.$.editDiscountDialog.hide).toHaveBeenCalledWith();
|
expect(controller.$.editDiscount.hide).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,9 @@
|
||||||
},
|
},
|
||||||
"WorkerTimeControlMail": {
|
"WorkerTimeControlMail": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"WorkerDisableExcluded": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerDisableExcluded",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerDisableExcluded"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"workerFk": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"dated": {
|
||||||
|
"type": "date"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -14,6 +14,20 @@
|
||||||
</vn-float-button>
|
</vn-float-button>
|
||||||
</div>
|
</div>
|
||||||
</slot-before>
|
</slot-before>
|
||||||
|
<slot-menu>
|
||||||
|
<vn-item
|
||||||
|
ng-click="$ctrl.handleExcluded()"
|
||||||
|
translate
|
||||||
|
ng-if="!$ctrl.excluded">
|
||||||
|
Click to exclude the user from getting disabled
|
||||||
|
</vn-item>
|
||||||
|
<vn-item
|
||||||
|
ng-click="$ctrl.handleExcluded()"
|
||||||
|
translate
|
||||||
|
ng-if="$ctrl.excluded">
|
||||||
|
Click to allow the user to be disabled
|
||||||
|
</vn-item>
|
||||||
|
</slot-menu>
|
||||||
<slot-body>
|
<slot-body>
|
||||||
<div class="attributes">
|
<div class="attributes">
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
|
@ -37,6 +51,13 @@
|
||||||
value="{{$ctrl.worker.sip.extension}}">
|
value="{{$ctrl.worker.sip.extension}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="icons">
|
||||||
|
<vn-icon
|
||||||
|
vn-tooltip="This user can't be disabled"
|
||||||
|
icon="person"
|
||||||
|
ng-if="$ctrl.worker.excluded">
|
||||||
|
</vn-icon>
|
||||||
|
</div>
|
||||||
<div class="quicklinks">
|
<div class="quicklinks">
|
||||||
<div ng-transclude="btnOne">
|
<div ng-transclude="btnOne">
|
||||||
<vn-quick-link
|
<vn-quick-link
|
||||||
|
|
|
@ -13,6 +13,33 @@ class Controller extends Descriptor {
|
||||||
|
|
||||||
set worker(value) {
|
set worker(value) {
|
||||||
this.entity = value;
|
this.entity = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
this.getIsExcluded();
|
||||||
|
}
|
||||||
|
|
||||||
|
get excluded() {
|
||||||
|
return this.entity.excluded;
|
||||||
|
}
|
||||||
|
|
||||||
|
set excluded(value) {
|
||||||
|
this.entity.excluded = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIsExcluded() {
|
||||||
|
this.$http.get(`workerDisableExcludeds/${this.entity.id}/exists`).then(data => {
|
||||||
|
this.excluded = data.data.exists;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleExcluded() {
|
||||||
|
if (this.excluded) {
|
||||||
|
this.$http.delete(`workerDisableExcludeds/${this.entity.id}`);
|
||||||
|
this.excluded = false;
|
||||||
|
} else {
|
||||||
|
this.$http.post(`workerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date});
|
||||||
|
this.excluded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadData() {
|
loadData() {
|
||||||
|
|
|
@ -20,4 +20,7 @@ View worker: Ver trabajador
|
||||||
Worker id: Id trabajador
|
Worker id: Id trabajador
|
||||||
Workers: Trabajadores
|
Workers: Trabajadores
|
||||||
worker: trabajador
|
worker: trabajador
|
||||||
Go to the worker: Ir al trabajador
|
Go to the worker: Ir al trabajador
|
||||||
|
Click to exclude the user from getting disabled: Marcar para no deshabilitar
|
||||||
|
Click to allow the user to be disabled: Marcar para deshabilitar
|
||||||
|
This user can't be disabled: Fijado para no deshabilitar
|
|
@ -16,6 +16,7 @@
|
||||||
"bcrypt": "^5.0.1",
|
"bcrypt": "^5.0.1",
|
||||||
"bmp-js": "^0.1.0",
|
"bmp-js": "^0.1.0",
|
||||||
"compression": "^1.7.3",
|
"compression": "^1.7.3",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
"fs-extra": "^5.0.0",
|
"fs-extra": "^5.0.0",
|
||||||
"ftps": "^1.2.0",
|
"ftps": "^1.2.0",
|
||||||
"got": "^10.7.0",
|
"got": "^10.7.0",
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
"node-ssh": "^11.0.0",
|
"node-ssh": "^11.0.0",
|
||||||
"object-diff": "0.0.4",
|
"object-diff": "0.0.4",
|
||||||
"object.pick": "^1.3.0",
|
"object.pick": "^1.3.0",
|
||||||
"puppeteer": "^18.0.5",
|
"puppeteer": "^19.0.0",
|
||||||
"read-chunk": "^3.2.0",
|
"read-chunk": "^3.2.0",
|
||||||
"require-yaml": "0.0.1",
|
"require-yaml": "0.0.1",
|
||||||
"sharp": "^0.31.0",
|
"sharp": "^0.31.0",
|
||||||
|
|
|
@ -21,7 +21,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
from: {
|
from: {
|
||||||
|
|
|
@ -23,9 +23,10 @@
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-ml">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title', [id]) }}</h1>
|
||||||
<p>{{$t('description.dear')}},</p>
|
<p>{{ $t('description.dear') }},</p>
|
||||||
<p>{{$t('description.instructions')}}</p>
|
<p v-html="instructions"></p>
|
||||||
|
<p>{{ $t('description.conclusion') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Footer block -->
|
<!-- Footer block -->
|
||||||
|
@ -43,4 +44,4 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -8,9 +8,22 @@ module.exports = {
|
||||||
'email-header': emailHeader.build(),
|
'email-header': emailHeader.build(),
|
||||||
'email-footer': emailFooter.build()
|
'email-footer': emailFooter.build()
|
||||||
},
|
},
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.ticket = await this.fetchTicket(this.id);
|
||||||
|
|
||||||
|
if (!this.ticket)
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
|
||||||
|
this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchTicket(id) {
|
||||||
|
return this.findOneFromDef('ticket', [id]);
|
||||||
|
}
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
subject: Orden de recogida
|
subject: Reclamación Verdnatura
|
||||||
title: Orden de recogida
|
title: Reclamación Verdnatura {0}
|
||||||
description:
|
description:
|
||||||
dear: Estimado cliente
|
dear: Estimado cliente
|
||||||
instructions: Aqui tienes tu orden de recogida.
|
instructions: 'Le informamos que se ha aceptado su solicitud de reclamación <strong>nº {0}</strong> correspondiente al pedido <strong>{1}</strong>.
|
||||||
|
Para tramitar la recogida, rellene el <a href="https://form.jotform.com/verdnatura/recogida-verdnatura"
|
||||||
|
title="Formulario Recogida" target="_blank" style="color: #8dba25">SIGUIENTE FORMULARIO</a> en un <strong>plazo máximo de 24h.</strong>
|
||||||
|
<br/><br/>Cuando recibamos el género en nuestras instalaciones emitiremos el abono correspondiente.
|
||||||
|
Debe imprimir el archivo adjunto e incluirlo en la caja. En el caso de no poder imprimirlo, <strong>identifique la caja con el número de reclamación CLARAMENTE LEGIBLE.</strong>'
|
||||||
|
conclusion: Un saludo
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
SELECT
|
||||||
|
c.ticketFk as id
|
||||||
|
FROM claim c
|
||||||
|
WHERE c.id = ?
|
|
@ -23,7 +23,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
from: {
|
from: {
|
||||||
|
|
|
@ -18,7 +18,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id'
|
description: 'The client id'
|
||||||
},
|
},
|
||||||
companyId: {
|
companyId: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
reference: {
|
reference: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
companyId: {
|
companyId: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
companyId: {
|
companyId: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id'
|
description: 'The client id'
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,11 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
companyId: {
|
companyId: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
from: {
|
from: {
|
||||||
|
|
|
@ -25,7 +25,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id'
|
description: 'The client id'
|
||||||
},
|
},
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="column-oriented vn-mt-ml">
|
<table class="column-oriented vn-mt-ml">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -71,16 +71,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="panel sign">
|
<div class="panel sign">
|
||||||
<div class="header">{{$t('clientSignature')}}</div>
|
<div class="header">{{$t('clientSignature')}}</div>
|
||||||
<div class="body centered">
|
<div class="body centered">
|
||||||
<h3>{{client.name}}</h3>
|
<h3>{{client.name}}</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p v-html="$t('sections.agency.description')"></p>
|
|
||||||
<p>{{claimConfig.pickupContact}}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Footer block -->
|
<!-- Footer block -->
|
||||||
|
@ -94,4 +91,4 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -7,7 +7,6 @@ module.exports = {
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.client = await this.fetchClient(this.id);
|
||||||
this.sales = await this.fetchSales(this.id);
|
this.sales = await this.fetchSales(this.id);
|
||||||
this.claimConfig = await this.fetchClaimConfig();
|
|
||||||
|
|
||||||
if (!this.client)
|
if (!this.client)
|
||||||
throw new Error('Something went wrong');
|
throw new Error('Something went wrong');
|
||||||
|
@ -25,10 +24,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
fetchSales(id) {
|
fetchSales(id) {
|
||||||
return this.rawSqlFromDef('sales', [id]);
|
return this.rawSqlFromDef('sales', [id]);
|
||||||
},
|
}
|
||||||
fetchClaimConfig() {
|
|
||||||
return this.findOneFromDef('claimConfig');
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
'report-header': reportHeader.build(),
|
'report-header': reportHeader.build(),
|
||||||
|
@ -36,7 +32,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The claim id'
|
description: 'The claim id'
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,3 @@ concept: Concepto
|
||||||
clientSignature: Firma del cliente
|
clientSignature: Firma del cliente
|
||||||
claim: Reclamación {0}
|
claim: Reclamación {0}
|
||||||
phone: Teléfono
|
phone: Teléfono
|
||||||
sections:
|
|
||||||
agency:
|
|
||||||
description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina
|
|
||||||
de Logista Parcel.'
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
SELECT pickupContact
|
|
||||||
FROM claimConfig;
|
|
|
@ -69,7 +69,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id'
|
description: 'The client id'
|
||||||
},
|
},
|
||||||
|
|
|
@ -127,7 +127,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The ticket id'
|
description: 'The ticket id'
|
||||||
},
|
},
|
||||||
|
|
|
@ -44,7 +44,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The route id'
|
description: 'The route id'
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The entry id'
|
description: 'The entry id'
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
reference: {
|
reference: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The invoice ref'
|
description: 'The invoice ref'
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id'
|
description: 'The client id'
|
||||||
},
|
},
|
||||||
companyId: {
|
companyId: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
reference: {
|
reference: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The invoice ref'
|
description: 'The invoice ref'
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,12 +63,12 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id'
|
description: 'The client id'
|
||||||
},
|
},
|
||||||
companyId: {
|
companyId: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'Receipt id'
|
description: 'Receipt id'
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue