Merge branch 'dev' into 4457-hasInvoiceElectronic
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
0739608de3
|
@ -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') {
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('privileges', {
|
||||||
|
description: 'Change role and hasGrant if user has privileges',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The user id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'roleFk',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The new role for user',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'hasGrant',
|
||||||
|
type: 'boolean',
|
||||||
|
description: 'Whether to has grant'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/:id/privileges`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.privileges = async function(ctx, id, roleFk, hasGrant, options) {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const user = await models.Account.findById(userId, null, myOptions);
|
||||||
|
|
||||||
|
if (!user.hasGrant)
|
||||||
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
|
const userToUpdate = await models.Account.findById(id);
|
||||||
|
if (hasGrant != null)
|
||||||
|
return await userToUpdate.updateAttribute('hasGrant', hasGrant, myOptions);
|
||||||
|
if (!roleFk) return;
|
||||||
|
|
||||||
|
const role = await models.Role.findById(roleFk, null, myOptions);
|
||||||
|
const hasRole = await models.Account.hasRole(userId, role.name, myOptions);
|
||||||
|
|
||||||
|
if (!hasRole)
|
||||||
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
|
await userToUpdate.updateAttribute('roleFk', roleFk, myOptions);
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,99 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('account privileges()', () => {
|
||||||
|
const employeeId = 1;
|
||||||
|
const developerId = 9;
|
||||||
|
const sysadminId = 66;
|
||||||
|
const bruceWayneId = 1101;
|
||||||
|
|
||||||
|
it('should throw an error when user not has privileges', async() => {
|
||||||
|
const ctx = {req: {accessToken: {userId: developerId}}};
|
||||||
|
const tx = await models.Account.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
await models.Account.privileges(ctx, employeeId, null, true, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toContain(`You don't have enough privileges`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error when user has privileges but not has the role', async() => {
|
||||||
|
const ctx = {req: {accessToken: {userId: sysadminId}}};
|
||||||
|
const tx = await models.Account.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const root = await models.Role.findOne({
|
||||||
|
where: {
|
||||||
|
name: 'root'
|
||||||
|
}
|
||||||
|
}, options);
|
||||||
|
await models.Account.privileges(ctx, employeeId, root.id, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toContain(`You don't have enough privileges`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change role', async() => {
|
||||||
|
const ctx = {req: {accessToken: {userId: sysadminId}}};
|
||||||
|
const tx = await models.Account.beginTransaction({});
|
||||||
|
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const agency = await models.Role.findOne({
|
||||||
|
where: {
|
||||||
|
name: 'agency'
|
||||||
|
}
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
let error;
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
await models.Account.privileges(ctx, bruceWayneId, agency.id, null, options);
|
||||||
|
result = await models.Account.findById(bruceWayneId, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).not.toBeDefined();
|
||||||
|
expect(result.roleFk).toEqual(agency.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change hasGrant', async() => {
|
||||||
|
const ctx = {req: {accessToken: {userId: sysadminId}}};
|
||||||
|
const tx = await models.Account.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
await models.Account.privileges(ctx, bruceWayneId, null, true, options);
|
||||||
|
result = await models.Account.findById(bruceWayneId, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).not.toBeDefined();
|
||||||
|
expect(result.hasGrant).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -17,16 +17,11 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.deleteTrashFiles = async options => {
|
Self.deleteTrashFiles = async options => {
|
||||||
const tx = await Self.beginTransaction({});
|
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
if (!myOptions.transaction)
|
|
||||||
myOptions.transaction = tx;
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (process.env.NODE_ENV == 'test')
|
if (process.env.NODE_ENV == 'test')
|
||||||
throw new UserError(`Action not allowed on the test environment`);
|
throw new UserError(`Action not allowed on the test environment`);
|
||||||
|
|
||||||
|
@ -61,16 +56,11 @@ module.exports = Self => {
|
||||||
const dstFolder = path.join(dmsContainer.client.root, pathHash);
|
const dstFolder = path.join(dmsContainer.client.root, pathHash);
|
||||||
try {
|
try {
|
||||||
await fs.rmdir(dstFolder);
|
await fs.rmdir(dstFolder);
|
||||||
await dms.destroy(myOptions);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await dms.destroy(myOptions);
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (tx) await tx.commit();
|
|
||||||
} catch (e) {
|
|
||||||
if (tx) await tx.rollback();
|
|
||||||
|
|
||||||
throw e;
|
await dms.destroy(myOptions);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
|
@ -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"
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,6 +7,7 @@ module.exports = Self => {
|
||||||
require('../methods/account/change-password')(Self);
|
require('../methods/account/change-password')(Self);
|
||||||
require('../methods/account/set-password')(Self);
|
require('../methods/account/set-password')(Self);
|
||||||
require('../methods/account/validate-token')(Self);
|
require('../methods/account/validate-token')(Self);
|
||||||
|
require('../methods/account/privileges')(Self);
|
||||||
|
|
||||||
// Validations
|
// Validations
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
},
|
},
|
||||||
"image": {
|
"image": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"hasGrant": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Receipt', 'receiptPdf', '*', 'ALLOW', 'ROLE', 'salesAssistant');
|
|
@ -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');
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `account`.`user` ADD hasGrant TINYINT(1) NOT NULL;
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Notification', '*', 'WRITE', 'ALLOW', 'ROLE', 'developer');
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `vn`.`payDem` (id,payDem)
|
||||||
|
VALUES (7,'0');
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||||
|
VALUES ('Supplier','newSupplier','WRITE','administrative');
|
|
@ -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 @@
|
||||||
|
ALTER TABLE `vn`.`supplier` MODIFY COLUMN payMethodFk tinyint(3) unsigned NULL;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`supplier` MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
|
|
@ -0,0 +1,35 @@
|
||||||
|
drop procedure `vn`.`ticket_closeByTicket`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
create
|
||||||
|
definer = `root`@`localhost` procedure `vn`.`ticket_closeByTicket`(IN vTicketFk int)
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserta el ticket en la tabla temporal
|
||||||
|
* para ser cerrado.
|
||||||
|
*
|
||||||
|
* @param vTicketFk Id del ticket
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_close;
|
||||||
|
CREATE TEMPORARY TABLE tmp.ticket_close ENGINE = MEMORY (
|
||||||
|
SELECT
|
||||||
|
t.id AS ticketFk
|
||||||
|
FROM ticket t
|
||||||
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
|
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||||
|
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
|
||||||
|
AND t.id = vTicketFk
|
||||||
|
AND t.refFk IS NULL
|
||||||
|
GROUP BY t.id);
|
||||||
|
|
||||||
|
CALL ticket_close();
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.ticket_close;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('ClaimRma', '*', 'READ', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
|
('ClaimRma', '*', 'WRITE', 'ALLOW', 'ROLE', 'claimManager');
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`claim` ADD rma varchar(100) NULL ;
|
|
@ -0,0 +1,7 @@
|
||||||
|
CREATE TABLE `vn`.`claimRma` (
|
||||||
|
id INT UNSIGNED auto_increment NOT NULL PRIMARY KEY,
|
||||||
|
code varchar(100) NOT NULL,
|
||||||
|
created timestamp DEFAULT current_timestamp() NOT NULL,
|
||||||
|
workerFk INTEGER UNSIGNED NOT NULL
|
||||||
|
)
|
||||||
|
ENGINE=InnoDB;
|
|
@ -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`)
|
||||||
|
@ -1380,13 +1380,6 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
|
||||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'),
|
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'),
|
||||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', '');
|
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', '');
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
|
||||||
VALUES
|
|
||||||
(1101, 500, NULL, 0.00, 0.00, 1.00),
|
|
||||||
(1102, 1000, 2.00, 0.01, 0.05, 1.00),
|
|
||||||
(1103, 2000, 0.00, 0.00, 0.02, 1.00),
|
|
||||||
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
|
||||||
|
|
||||||
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
|
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
|
||||||
VALUES
|
VALUES
|
||||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', 1, 1, '1062', '51', '4.8'),
|
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', 1, 1, '1062', '51', '4.8'),
|
||||||
|
@ -1743,12 +1736,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`,
|
||||||
( 6, 'mana', 'Mana', 1, 4, 0),
|
( 6, 'mana', 'Mana', 1, 4, 0),
|
||||||
( 7, 'lack', 'Faltas', 1, 2, 0);
|
( 7, 'lack', 'Faltas', 1, 2, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`)
|
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0),
|
(1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183'),
|
||||||
(2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1),
|
(2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL),
|
||||||
(3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5),
|
(3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL),
|
||||||
(4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10);
|
(4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`)
|
INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1790,6 +1783,23 @@ INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`)
|
||||||
(1, 'Contact description', 50),
|
(1, 'Contact description', 50),
|
||||||
(2, 'Contact description', 30);
|
(2, 'Contact description', 30);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||||
|
VALUES
|
||||||
|
(1101, 500, NULL, 0.00, 0.00, 1.00),
|
||||||
|
(1102, 1000, 2.00, 0.01, 0.05, 1.00),
|
||||||
|
(1103, 2000, 0.00, 0.00, 0.02, 1.00),
|
||||||
|
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||||
|
|
||||||
|
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
||||||
|
VALUES
|
||||||
|
(1, '02676A049183', DEFAULT, 1106),
|
||||||
|
(2, '02676A049183', DEFAULT, 1106),
|
||||||
|
(3, '02676A049183', DEFAULT, 1107),
|
||||||
|
(4, '02676A049183', DEFAULT, 1107),
|
||||||
|
(5, '01837B023653', DEFAULT, 1106);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, `secretKey`)
|
INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, `secretKey`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Arkham Bank', 442, 1, 'h12387193H10238'),
|
(1, 'Arkham Bank', 442, 1, 'h12387193H10238'),
|
||||||
|
@ -2648,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);
|
||||||
|
@ -2663,3 +2706,7 @@ INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPack
|
||||||
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
|
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
|
||||||
VALUES
|
VALUES
|
||||||
(9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL);
|
(9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
UPDATE `account`.`user`
|
||||||
|
SET `hasGrant` = 1
|
||||||
|
WHERE `id` = 66;
|
||||||
|
|
|
@ -51,14 +51,12 @@ export default {
|
||||||
accountDescriptor: {
|
accountDescriptor: {
|
||||||
menuButton: 'vn-user-descriptor vn-icon-button[icon="more_vert"]',
|
menuButton: 'vn-user-descriptor vn-icon-button[icon="more_vert"]',
|
||||||
deleteAccount: '.vn-menu [name="deleteUser"]',
|
deleteAccount: '.vn-menu [name="deleteUser"]',
|
||||||
changeRole: '.vn-menu [name="changeRole"]',
|
|
||||||
setPassword: '.vn-menu [name="setPassword"]',
|
setPassword: '.vn-menu [name="setPassword"]',
|
||||||
activateAccount: '.vn-menu [name="enableAccount"]',
|
activateAccount: '.vn-menu [name="enableAccount"]',
|
||||||
activateUser: '.vn-menu [name="activateUser"]',
|
activateUser: '.vn-menu [name="activateUser"]',
|
||||||
deactivateUser: '.vn-menu [name="deactivateUser"]',
|
deactivateUser: '.vn-menu [name="deactivateUser"]',
|
||||||
newPassword: 'vn-textfield[ng-model="$ctrl.newPassword"]',
|
newPassword: 'vn-textfield[ng-model="$ctrl.newPassword"]',
|
||||||
repeatPassword: 'vn-textfield[ng-model="$ctrl.repeatPassword"]',
|
repeatPassword: 'vn-textfield[ng-model="$ctrl.repeatPassword"]',
|
||||||
newRole: 'vn-autocomplete[ng-model="$ctrl.newRole"]',
|
|
||||||
activeAccountIcon: 'vn-icon[icon="contact_mail"]',
|
activeAccountIcon: 'vn-icon[icon="contact_mail"]',
|
||||||
activeUserIcon: 'vn-icon[icon="icon-disabled"]',
|
activeUserIcon: 'vn-icon[icon="icon-disabled"]',
|
||||||
acceptButton: 'button[response="accept"]',
|
acceptButton: 'button[response="accept"]',
|
||||||
|
@ -143,6 +141,11 @@ export default {
|
||||||
verifyCert: 'vn-account-samba vn-check[ng-model="$ctrl.config.verifyCert"]',
|
verifyCert: 'vn-account-samba vn-check[ng-model="$ctrl.config.verifyCert"]',
|
||||||
save: 'vn-account-samba vn-submit'
|
save: 'vn-account-samba vn-submit'
|
||||||
},
|
},
|
||||||
|
accountPrivileges: {
|
||||||
|
checkHasGrant: 'vn-user-privileges vn-check[ng-model="$ctrl.user.hasGrant"]',
|
||||||
|
role: 'vn-user-privileges vn-autocomplete[ng-model="$ctrl.user.roleFk"]',
|
||||||
|
save: 'vn-user-privileges vn-submit'
|
||||||
|
},
|
||||||
clientsIndex: {
|
clientsIndex: {
|
||||||
createClientButton: `vn-float-button`
|
createClientButton: `vn-float-button`
|
||||||
},
|
},
|
||||||
|
@ -1019,8 +1022,8 @@ export default {
|
||||||
},
|
},
|
||||||
travelExtraCommunity: {
|
travelExtraCommunity: {
|
||||||
anySearchResult: 'vn-travel-extra-community > vn-card div > tbody > tr[ng-attr-id="{{::travel.id}}"]',
|
anySearchResult: 'vn-travel-extra-community > vn-card div > tbody > tr[ng-attr-id="{{::travel.id}}"]',
|
||||||
firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-textfield[ng-model="travel.ref"]',
|
firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="reference"]',
|
||||||
firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-input-number[ng-model="travel.kg"]',
|
firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="lockedKg"]',
|
||||||
removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i'
|
removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i'
|
||||||
},
|
},
|
||||||
travelBasicData: {
|
travelBasicData: {
|
||||||
|
|
|
@ -19,10 +19,10 @@ describe('Travel extra community path', () => {
|
||||||
it('should edit the travel reference and the locked kilograms', async() => {
|
it('should edit the travel reference and the locked kilograms', async() => {
|
||||||
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
||||||
await page.waitForSpinnerLoad();
|
await page.waitForSpinnerLoad();
|
||||||
await page.clearInput(selectors.travelExtraCommunity.firstTravelReference);
|
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
||||||
await page.write(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
await page.waitForSpinnerLoad();
|
||||||
await page.clearInput(selectors.travelExtraCommunity.firstTravelLockedKg);
|
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
|
||||||
await page.write(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
|
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
expect(message.text).toContain('Data saved!');
|
||||||
|
@ -32,9 +32,9 @@ describe('Travel extra community path', () => {
|
||||||
await page.accessToSection('travel.index');
|
await page.accessToSection('travel.index');
|
||||||
await page.accessToSection('travel.extraCommunity');
|
await page.accessToSection('travel.extraCommunity');
|
||||||
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
||||||
|
await page.waitForTextInElement(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
||||||
const reference = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelReference, 'value');
|
const reference = await page.getProperty(selectors.travelExtraCommunity.firstTravelReference, 'innerText');
|
||||||
const lockedKg = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'value');
|
const lockedKg = await page.getProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'innerText');
|
||||||
|
|
||||||
expect(reference).toContain('edited reference');
|
expect(reference).toContain('edited reference');
|
||||||
expect(lockedKg).toContain(1500);
|
expect(lockedKg).toContain(1500);
|
||||||
|
|
|
@ -31,7 +31,7 @@ describe('Supplier fiscal data path', () => {
|
||||||
await page.clearInput(selectors.supplierFiscalData.taxNumber);
|
await page.clearInput(selectors.supplierFiscalData.taxNumber);
|
||||||
await page.write(selectors.supplierFiscalData.taxNumber, 'Wrong tax number');
|
await page.write(selectors.supplierFiscalData.taxNumber, 'Wrong tax number');
|
||||||
await page.clearInput(selectors.supplierFiscalData.account);
|
await page.clearInput(selectors.supplierFiscalData.account);
|
||||||
await page.write(selectors.supplierFiscalData.account, 'edited account number');
|
await page.write(selectors.supplierFiscalData.account, '0123456789');
|
||||||
await page.autocompleteSearch(selectors.supplierFiscalData.sageWihholding, 'retencion estimacion objetiva');
|
await page.autocompleteSearch(selectors.supplierFiscalData.sageWihholding, 'retencion estimacion objetiva');
|
||||||
await page.autocompleteSearch(selectors.supplierFiscalData.sageTaxType, 'operaciones no sujetas');
|
await page.autocompleteSearch(selectors.supplierFiscalData.sageTaxType, 'operaciones no sujetas');
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ describe('Supplier fiscal data path', () => {
|
||||||
it('should check the account was edited', async() => {
|
it('should check the account was edited', async() => {
|
||||||
const result = await page.waitToGetProperty(selectors.supplierFiscalData.account, 'value');
|
const result = await page.waitToGetProperty(selectors.supplierFiscalData.account, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('edited account number');
|
expect(result).toEqual('0123456789');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the sageWihholding was edited', async() => {
|
it('should check the sageWihholding was edited', async() => {
|
||||||
|
|
|
@ -62,27 +62,6 @@ describe('Account create and basic data path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Descriptor option', () => {
|
describe('Descriptor option', () => {
|
||||||
describe('Edit role', () => {
|
|
||||||
it('should edit the role using the descriptor menu', async() => {
|
|
||||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
|
||||||
await page.waitToClick(selectors.accountDescriptor.changeRole);
|
|
||||||
await page.autocompleteSearch(selectors.accountDescriptor.newRole, 'adminBoss');
|
|
||||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Role changed succesfully!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should reload the roles section to see now there are more roles', async() => {
|
|
||||||
// when role updates db takes time to return changes, without this timeout the result would have been 3
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
await page.reloadSection('account.card.roles');
|
|
||||||
const rolesCount = await page.countElement(selectors.accountRoles.anyResult);
|
|
||||||
|
|
||||||
expect(rolesCount).toEqual(61);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('activate account', () => {
|
describe('activate account', () => {
|
||||||
it(`should check the active account icon isn't present in the descriptor`, async() => {
|
it(`should check the active account icon isn't present in the descriptor`, async() => {
|
||||||
await page.waitForNumberOfElements(selectors.accountDescriptor.activeAccountIcon, 0);
|
await page.waitForNumberOfElements(selectors.accountDescriptor.activeAccountIcon, 0);
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Account privileges path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('developer', 'account');
|
||||||
|
await page.accessToSearchResult('1101');
|
||||||
|
await page.accessToSection('account.card.privileges');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('as developer', () => {
|
||||||
|
it('should throw error when give privileges', async() => {
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.checkHasGrant);
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
|
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain(`You don't have enough privileges`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw error when change role', async() => {
|
||||||
|
await page.autocompleteSearch(selectors.accountPrivileges.role, 'employee');
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
|
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain(`You don't have enough privileges`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('as sysadmin', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
await page.loginAndModule('sysadmin', 'account');
|
||||||
|
await page.accessToSearchResult('9');
|
||||||
|
await page.accessToSection('account.card.privileges');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should give privileges', async() => {
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.checkHasGrant);
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
await page.reloadSection('account.card.privileges');
|
||||||
|
const result = await page.checkboxState(selectors.accountPrivileges.checkHasGrant);
|
||||||
|
|
||||||
|
expect(message.text).toContain(`Data saved!`);
|
||||||
|
expect(result).toBe('checked');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change role', async() => {
|
||||||
|
await page.autocompleteSearch(selectors.accountPrivileges.role, 'employee');
|
||||||
|
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('employee');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('as developer again', () => {
|
||||||
|
it('should remove privileges', async() => {
|
||||||
|
await page.accessToSearchResult('9');
|
||||||
|
await page.accessToSection('account.card.privileges');
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.checkHasGrant);
|
||||||
|
await page.waitToClick(selectors.accountPrivileges.save);
|
||||||
|
|
||||||
|
await page.reloadSection('account.card.privileges');
|
||||||
|
const result = await page.checkboxState(selectors.accountPrivileges.checkHasGrant);
|
||||||
|
|
||||||
|
expect(result).toBe('unchecked');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -6,8 +6,98 @@ export default class Textfield extends Field {
|
||||||
super($element, $scope, $compile);
|
super($element, $scope, $compile);
|
||||||
this.buildInput('text');
|
this.buildInput('text');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set maxLength(value) {
|
||||||
|
this.input.maxLength = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get maxLength() {
|
||||||
|
return this.input.maxLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
set insertable(value) {
|
||||||
|
if (this._insertable === value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this._insertable)
|
||||||
|
this.input.removeEventListener('keypress', this.keyPressListener);
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
this.keyPressListener = async e => await this.onKeyPress(e);
|
||||||
|
this.input.addEventListener('keypress', this.keyPressListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._insertable = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get insertable() {
|
||||||
|
return this._insertable;
|
||||||
|
}
|
||||||
|
|
||||||
|
async onKeyPress(e) {
|
||||||
|
if (e.key == 'Enter')
|
||||||
|
return; // If the enter key is pressed dismiss it
|
||||||
|
|
||||||
|
let maxLength = this.maxLength;
|
||||||
|
|
||||||
|
// Call the function that obtains the current cursor position
|
||||||
|
let pointerPosition = getCaretPosition(e.target);
|
||||||
|
|
||||||
|
// If the cursor position is on the last allowed character,
|
||||||
|
// prevent any keystroke from doing anything
|
||||||
|
if (pointerPosition >= maxLength) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case by any ways the input is longer than the max especified size, cut it to it.
|
||||||
|
let currentArrValue = e.target.value.slice(0, maxLength);
|
||||||
|
|
||||||
|
// Transform said input to a array with each character on one position
|
||||||
|
currentArrValue = currentArrValue.split('');
|
||||||
|
|
||||||
|
// Cut the array in 2 parts, one with everything right of the caret,
|
||||||
|
// and one with everything left to it
|
||||||
|
let rightToTheCaret = currentArrValue.slice(pointerPosition);
|
||||||
|
|
||||||
|
let leftToTheCaret = currentArrValue.slice(0, pointerPosition);
|
||||||
|
|
||||||
|
// Remove the first number on the array that was right of the caret
|
||||||
|
rightToTheCaret.shift();
|
||||||
|
|
||||||
|
// The part that was left to the caret is not modified in any way and is put back into the textField
|
||||||
|
e.target.value = leftToTheCaret.join('');
|
||||||
|
|
||||||
|
// Add one millisecond of delay to give the UI time to update,
|
||||||
|
// so that it detects the changes on the textField
|
||||||
|
await new Promise(r => setTimeout(r, 1));
|
||||||
|
|
||||||
|
// Add the values that should be right to the Caret back in the textField
|
||||||
|
e.target.value = e.target.value + rightToTheCaret.join('');
|
||||||
|
|
||||||
|
// Update the current pointer position so that it moves 1 position to the right
|
||||||
|
pointerPosition++;
|
||||||
|
e.target.setSelectionRange(pointerPosition, pointerPosition);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCaretPosition(targetElement) {
|
||||||
|
let caretPosition = 0;
|
||||||
|
|
||||||
|
if (targetElement.selectionStart || targetElement.selectionStart == 0) // Firefox Support
|
||||||
|
caretPosition = targetElement.selectionStart;
|
||||||
|
|
||||||
|
return caretPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnTextfield', {
|
ngModule.vnComponent('vnTextfield', {
|
||||||
controller: Textfield
|
controller: Textfield,
|
||||||
|
bindings: {
|
||||||
|
maxLength: '<?',
|
||||||
|
insertable: '<?'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -132,5 +132,6 @@
|
||||||
"Descanso diario 9h.": "Daily rest 9h.",
|
"Descanso diario 9h.": "Daily rest 9h.",
|
||||||
"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",
|
||||||
"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"
|
||||||
}
|
}
|
|
@ -96,7 +96,7 @@
|
||||||
"This postcode already exists": "Este código postal ya existe",
|
"This postcode already exists": "Este código postal ya existe",
|
||||||
"Concept cannot be blank": "El concepto no puede quedar en blanco",
|
"Concept cannot be blank": "El concepto no puede quedar en blanco",
|
||||||
"File doesn't exists": "El archivo no existe",
|
"File doesn't exists": "El archivo no existe",
|
||||||
"You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
|
"You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
|
||||||
"This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
|
"This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
|
||||||
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
|
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
|
||||||
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
|
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
"image/png",
|
"image/png",
|
||||||
"image/jpeg",
|
"image/jpeg",
|
||||||
"image/jpg",
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
"video/mp4"
|
"video/mp4"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -60,7 +61,8 @@
|
||||||
"multipart/x-zip",
|
"multipart/x-zip",
|
||||||
"image/png",
|
"image/png",
|
||||||
"image/jpeg",
|
"image/jpeg",
|
||||||
"image/jpg"
|
"image/jpg",
|
||||||
|
"image/webp"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"imageStorage": {
|
"imageStorage": {
|
||||||
|
@ -72,7 +74,8 @@
|
||||||
"allowedContentTypes": [
|
"allowedContentTypes": [
|
||||||
"image/png",
|
"image/png",
|
||||||
"image/jpeg",
|
"image/jpeg",
|
||||||
"image/jpg"
|
"image/jpg",
|
||||||
|
"image/webp"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"invoiceStorage": {
|
"invoiceStorage": {
|
||||||
|
@ -96,6 +99,7 @@
|
||||||
"image/png",
|
"image/png",
|
||||||
"image/jpeg",
|
"image/jpeg",
|
||||||
"image/jpg",
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
"video/mp4"
|
"video/mp4"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,14 +11,6 @@
|
||||||
translate>
|
translate>
|
||||||
Delete
|
Delete
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item
|
|
||||||
ng-click="$ctrl.onChangeRole()"
|
|
||||||
name="changeRole"
|
|
||||||
vn-acl="hr"
|
|
||||||
vn-acl-action="remove"
|
|
||||||
translate>
|
|
||||||
Change role
|
|
||||||
</vn-item>
|
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-if="::$root.user.id == $ctrl.id"
|
ng-if="::$root.user.id == $ctrl.id"
|
||||||
ng-click="$ctrl.onChangePassClick(true)"
|
ng-click="$ctrl.onChangePassClick(true)"
|
||||||
|
@ -128,22 +120,6 @@
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
message="User will be deactivated">
|
message="User will be deactivated">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
<vn-dialog
|
|
||||||
vn-id="changeRole"
|
|
||||||
on-accept="$ctrl.onChangeRoleAccept()">
|
|
||||||
<tpl-body>
|
|
||||||
<vn-autocomplete
|
|
||||||
label="Role"
|
|
||||||
ng-model="$ctrl.newRole"
|
|
||||||
url="Roles"
|
|
||||||
vn-focus>
|
|
||||||
</vn-autocomplete>
|
|
||||||
</tpl-body>
|
|
||||||
<tpl-buttons>
|
|
||||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
|
||||||
<button response="accept" translate>Accept</button>
|
|
||||||
</tpl-buttons>
|
|
||||||
</vn-dialog>
|
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="changePass"
|
vn-id="changePass"
|
||||||
on-accept="$ctrl.onPassChange()"
|
on-accept="$ctrl.onPassChange()"
|
||||||
|
|
|
@ -30,20 +30,6 @@ class Controller extends Descriptor {
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('User removed')));
|
.then(() => this.vnApp.showSuccess(this.$t('User removed')));
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeRole() {
|
|
||||||
this.newRole = this.user.role.id;
|
|
||||||
this.$.changeRole.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onChangeRoleAccept() {
|
|
||||||
const params = {roleFk: this.newRole};
|
|
||||||
return this.$http.patch(`Accounts/${this.id}`, params)
|
|
||||||
.then(() => {
|
|
||||||
this.emit('change');
|
|
||||||
this.vnApp.showSuccess(this.$t('Role changed succesfully!'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onChangePassClick(askOldPass) {
|
onChangePassClick(askOldPass) {
|
||||||
this.$http.get('UserPasswords/findOne')
|
this.$http.get('UserPasswords/findOne')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
|
@ -30,17 +30,6 @@ describe('component vnUserDescriptor', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('onChangeRoleAccept()', () => {
|
|
||||||
it('should call backend method to change role', () => {
|
|
||||||
$httpBackend.expectPATCH('Accounts/1').respond();
|
|
||||||
controller.onChangeRoleAccept();
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
|
||||||
expect(controller.emit).toHaveBeenCalledWith('change');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onPassChange()', () => {
|
describe('onPassChange()', () => {
|
||||||
it('should throw an error when password is empty', () => {
|
it('should throw an error when password is empty', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
|
|
|
@ -18,3 +18,4 @@ import './roles';
|
||||||
import './ldap';
|
import './ldap';
|
||||||
import './samba';
|
import './samba';
|
||||||
import './accounts';
|
import './accounts';
|
||||||
|
import './privileges';
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<mg-ajax path="Accounts/{{post.params.id}}/privileges" options="vnPost"></mg-ajax>
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
url="Accounts"
|
||||||
|
data="$ctrl.user"
|
||||||
|
id-value="$ctrl.$params.id"
|
||||||
|
form="form"
|
||||||
|
save="post">
|
||||||
|
</vn-watcher>
|
||||||
|
<form
|
||||||
|
name="form"
|
||||||
|
ng-submit="watcher.submit()"
|
||||||
|
class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg" vn-focus>
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-check
|
||||||
|
label="Has grant"
|
||||||
|
ng-model="$ctrl.user.hasGrant">
|
||||||
|
</vn-check>
|
||||||
|
</vn-vertical>
|
||||||
|
<vn-vertical
|
||||||
|
class="vn-mt-md">
|
||||||
|
<vn-autocomplete
|
||||||
|
label="Role"
|
||||||
|
ng-model="$ctrl.user.roleFk"
|
||||||
|
url="Roles">
|
||||||
|
</vn-autocomplete>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
disabled="!watcher.dataChanged()"
|
||||||
|
label="Save">
|
||||||
|
</vn-submit>
|
||||||
|
<vn-button
|
||||||
|
class="cancel"
|
||||||
|
label="Undo changes"
|
||||||
|
disabled="!watcher.dataChanged()"
|
||||||
|
ng-click="watcher.loadOriginalData()">
|
||||||
|
</vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -0,0 +1,9 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
export default class Controller extends Section {}
|
||||||
|
|
||||||
|
ngModule.component('vnUserPrivileges', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -0,0 +1,2 @@
|
||||||
|
Privileges: Privilegios
|
||||||
|
Has grant: Tiene privilegios
|
|
@ -19,7 +19,8 @@
|
||||||
{"state": "account.card.basicData", "icon": "settings"},
|
{"state": "account.card.basicData", "icon": "settings"},
|
||||||
{"state": "account.card.roles", "icon": "group"},
|
{"state": "account.card.roles", "icon": "group"},
|
||||||
{"state": "account.card.mailForwarding", "icon": "forward"},
|
{"state": "account.card.mailForwarding", "icon": "forward"},
|
||||||
{"state": "account.card.aliases", "icon": "email"}
|
{"state": "account.card.aliases", "icon": "email"},
|
||||||
|
{"state": "account.card.privileges", "icon": "badge"}
|
||||||
],
|
],
|
||||||
"role": [
|
"role": [
|
||||||
{"state": "account.role.card.basicData", "icon": "settings"},
|
{"state": "account.role.card.basicData", "icon": "settings"},
|
||||||
|
@ -99,6 +100,13 @@
|
||||||
"description": "Mail aliases",
|
"description": "Mail aliases",
|
||||||
"acl": ["marketing", "hr"]
|
"acl": ["marketing", "hr"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"url": "/privileges",
|
||||||
|
"state": "account.card.privileges",
|
||||||
|
"component": "vn-user-privileges",
|
||||||
|
"description": "Privileges",
|
||||||
|
"acl": ["hr"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"url": "/role?q",
|
"url": "/role?q",
|
||||||
"state": "account.role",
|
"state": "account.role",
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
const {Report, Email, smtp} = require('vn-print');
|
const {Email} = require('vn-print');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('claimPickupEmail', {
|
Self.remoteMethodCtx('claimPickupEmail', {
|
||||||
description: 'Sends the the claim pickup order email with an attached PDF',
|
description: 'Sends the the claim pickup order email with an attached PDF',
|
||||||
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
|
@ -40,7 +41,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.claimPickupEmail = async(ctx, id) => {
|
Self.claimPickupEmail = async ctx => {
|
||||||
const args = Object.assign({}, ctx.args);
|
const args = Object.assign({}, ctx.args);
|
||||||
const params = {
|
const params = {
|
||||||
recipient: args.recipient,
|
recipient: args.recipient,
|
||||||
|
|
|
@ -47,7 +47,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'claimState',
|
relation: 'claimState',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'description']
|
fields: ['id', 'code', 'description']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
"Claim": {
|
"Claim": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ClaimContainer": {
|
||||||
|
"dataSource": "claimStorage"
|
||||||
|
},
|
||||||
"ClaimBeginning": {
|
"ClaimBeginning": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -41,7 +44,7 @@
|
||||||
"ClaimObservation": {
|
"ClaimObservation": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ClaimContainer": {
|
"ClaimRma": {
|
||||||
"dataSource": "claimStorage"
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.observe('before save', async function(ctx) {
|
||||||
|
const changes = ctx.data || ctx.instance;
|
||||||
|
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||||
|
changes.workerFk = loopBackContext.active.accessToken.userId;
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "ClaimRma",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "claimRma"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"code": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"worker": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,6 +46,9 @@
|
||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"rma": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -54,6 +57,12 @@
|
||||||
"model": "ClaimState",
|
"model": "ClaimState",
|
||||||
"foreignKey": "claimStateFk"
|
"foreignKey": "claimStateFk"
|
||||||
},
|
},
|
||||||
|
"claimRma": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "ClaimRma",
|
||||||
|
"foreignKey": "rma",
|
||||||
|
"primaryKey": "code"
|
||||||
|
},
|
||||||
"client": {
|
"client": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Client",
|
"model": "Client",
|
||||||
|
|
|
@ -25,10 +25,9 @@ module.exports = Self => {
|
||||||
|
|
||||||
const client = await Self.app.models.Client.findById(id, myOptions);
|
const client = await Self.app.models.Client.findById(id, myOptions);
|
||||||
|
|
||||||
const emails = client.email ? client.email.split(',') : null;
|
|
||||||
|
|
||||||
const findParams = [];
|
const findParams = [];
|
||||||
if (emails.length) {
|
if (client.email) {
|
||||||
|
const emails = client.email.split(',');
|
||||||
for (let email of emails)
|
for (let email of emails)
|
||||||
findParams.push({email: email});
|
findParams.push({email: email});
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,43 +18,43 @@ module.exports = Self => {
|
||||||
Self.consumptionSendQueued = async() => {
|
Self.consumptionSendQueued = async() => {
|
||||||
const queues = await Self.rawSql(`
|
const queues = await Self.rawSql(`
|
||||||
SELECT
|
SELECT
|
||||||
ccq.id,
|
id,
|
||||||
|
params
|
||||||
|
FROM clientConsumptionQueue
|
||||||
|
WHERE status = ''`);
|
||||||
|
|
||||||
|
for (const queue of queues) {
|
||||||
|
try {
|
||||||
|
const params = JSON.parse(queue.params);
|
||||||
|
|
||||||
|
const clients = await Self.rawSql(`
|
||||||
|
SELECT
|
||||||
c.id AS clientFk,
|
c.id AS clientFk,
|
||||||
c.email AS clientEmail,
|
c.email AS clientEmail,
|
||||||
eu.email salesPersonEmail,
|
eu.email salesPersonEmail
|
||||||
REPLACE(json_extract(params, '$.from'), '"', '') AS fromDate,
|
FROM client c
|
||||||
REPLACE(json_extract(params, '$.to'), '"', '') AS toDate
|
|
||||||
FROM clientConsumptionQueue ccq
|
|
||||||
JOIN client c ON (
|
|
||||||
JSON_SEARCH(
|
|
||||||
JSON_ARRAY(
|
|
||||||
json_extract(params, '$.clients')
|
|
||||||
)
|
|
||||||
, 'all', c.id) IS NOT NULL)
|
|
||||||
JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
||||||
JOIN ticket t ON t.clientFk = c.id
|
JOIN ticket t ON t.clientFk = c.id
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
WHERE status = ''
|
WHERE c.id IN(?)
|
||||||
AND it.isPackaging = FALSE
|
AND it.isPackaging = FALSE
|
||||||
AND DATE(t.shipped) BETWEEN
|
AND DATE(t.shipped) BETWEEN ? AND ?
|
||||||
REPLACE(json_extract(params, '$.from'), '"', '') AND
|
GROUP BY c.id`, [params.clients, params.from, params.to]);
|
||||||
REPLACE(json_extract(params, '$.to'), '"', '')
|
|
||||||
GROUP BY c.id`);
|
|
||||||
|
|
||||||
for (const queue of queues) {
|
for (const client of clients) {
|
||||||
try {
|
|
||||||
const args = {
|
const args = {
|
||||||
id: queue.clientFk,
|
id: client.clientFk,
|
||||||
recipient: queue.clientEmail,
|
recipient: client.clientEmail,
|
||||||
replyTo: queue.salesPersonEmail,
|
replyTo: client.salesPersonEmail,
|
||||||
from: queue.fromDate,
|
from: params.from,
|
||||||
to: queue.toDate
|
to: params.to
|
||||||
};
|
};
|
||||||
|
|
||||||
const email = new Email('campaign-metrics', args);
|
const email = new Email('campaign-metrics', args);
|
||||||
await email.send();
|
await email.send();
|
||||||
|
}
|
||||||
|
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE clientConsumptionQueue
|
UPDATE clientConsumptionQueue
|
||||||
|
@ -69,7 +69,7 @@ module.exports = Self => {
|
||||||
WHERE id = ?`,
|
WHERE id = ?`,
|
||||||
[error.message, queue.id]);
|
[error.message, queue.id]);
|
||||||
|
|
||||||
throw e;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
const {Report} = require('vn-print');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('receiptPdf', {
|
||||||
|
description: 'Returns the receipt pdf',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The claim id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'recipientId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The recipient id',
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: '/:id/receipt-pdf',
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.receiptPdf = async(ctx, id) => {
|
||||||
|
const args = Object.assign({}, ctx.args);
|
||||||
|
const params = {lang: ctx.req.getLocale()};
|
||||||
|
|
||||||
|
delete args.ctx;
|
||||||
|
for (const param in args)
|
||||||
|
params[param] = args[param];
|
||||||
|
|
||||||
|
const report = new Report('receipt', params);
|
||||||
|
const stream = await report.toPdfStream();
|
||||||
|
|
||||||
|
return [stream, 'application/pdf', `filename="doc-${id}.pdf"`];
|
||||||
|
};
|
||||||
|
};
|
|
@ -2,6 +2,7 @@ const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
require('../methods/receipt/filter')(Self);
|
require('../methods/receipt/filter')(Self);
|
||||||
|
require('../methods/receipt/receiptPdf')(Self);
|
||||||
|
|
||||||
Self.validateBinded('amountPaid', isNotZero, {
|
Self.validateBinded('amountPaid', isNotZero, {
|
||||||
message: 'Amount cannot be zero',
|
message: 'Amount cannot be zero',
|
||||||
|
|
|
@ -144,12 +144,8 @@ class Controller extends Dialog {
|
||||||
})
|
})
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (this.viewReceipt) {
|
if (this.viewReceipt)
|
||||||
this.vnReport.show('receipt', {
|
this.vnReport.show(`Receipts/${receiptId}/receipt-pdf`);
|
||||||
receiptId: receiptId,
|
|
||||||
companyId: this.companyFk
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ describe('Client', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make an http POST query and then call to the report show() method', () => {
|
it('should make an http POST query and then call to the report show() method', () => {
|
||||||
|
const receiptId = 1;
|
||||||
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
jest.spyOn(controller.vnReport, 'show');
|
jest.spyOn(controller.vnReport, 'show');
|
||||||
window.open = jest.fn();
|
window.open = jest.fn();
|
||||||
|
@ -92,14 +94,12 @@ describe('Client', () => {
|
||||||
controller.$params = {id: 1101};
|
controller.$params = {id: 1101};
|
||||||
controller.viewReceipt = true;
|
controller.viewReceipt = true;
|
||||||
|
|
||||||
$httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: 1});
|
$httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: receiptId});
|
||||||
controller.responseHandler('accept');
|
controller.responseHandler('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
const expectedParams = {receiptId: 1, companyId: 442};
|
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
expect(controller.vnReport.show).toHaveBeenCalledWith('receipt', expectedParams);
|
expect(controller.vnReport.show).toHaveBeenCalledWith(`Receipts/${receiptId}/receipt-pdf`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -77,15 +77,16 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
onSendClientConsumption() {
|
onSendClientConsumption() {
|
||||||
const clientIds = this.checked.map(client => client.id);
|
const clientIds = this.checked.map(client => client.id);
|
||||||
const params = {
|
const data = {
|
||||||
clients: clientIds,
|
clients: clientIds,
|
||||||
from: this.campaign.from,
|
from: this.campaign.from,
|
||||||
to: this.campaign.to
|
to: this.campaign.to
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const params = JSON.stringify(data);
|
||||||
this.$http.post('ClientConsumptionQueues', {params})
|
this.$http.post('ClientConsumptionQueues', {params})
|
||||||
.then(() => this.$.filters.hide())
|
.then(() => this.$.filters.hide())
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Notifications sent!')));
|
.then(() => this.vnApp.showSuccess(this.$t('Notification sent!')));
|
||||||
}
|
}
|
||||||
|
|
||||||
exprBuilder(param, value) {
|
exprBuilder(param, value) {
|
||||||
|
|
|
@ -69,15 +69,16 @@ describe('Client notification', () => {
|
||||||
data[0].$checked = true;
|
data[0].$checked = true;
|
||||||
data[1].$checked = true;
|
data[1].$checked = true;
|
||||||
|
|
||||||
const params = Object.assign({
|
const args = Object.assign({
|
||||||
clients: [1101, 1102]
|
clients: [1101, 1102]
|
||||||
}, controller.campaign);
|
}, controller.campaign);
|
||||||
|
const params = JSON.stringify(args);
|
||||||
|
|
||||||
$httpBackend.expect('POST', `ClientConsumptionQueues`, {params}).respond(200, params);
|
$httpBackend.expect('POST', `ClientConsumptionQueues`, {params}).respond(200, params);
|
||||||
controller.onSendClientConsumption();
|
controller.onSendClientConsumption();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Notifications sent!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Notification sent!');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Controller extends Section {
|
||||||
if (this.$params.warehouseFk)
|
if (this.$params.warehouseFk)
|
||||||
this.warehouseFk = this.$params.warehouseFk;
|
this.warehouseFk = this.$params.warehouseFk;
|
||||||
else if (value)
|
else if (value)
|
||||||
this.warehouseFk = value.itemType.warehouseFk;
|
this.warehouseFk = this.vnConfig.warehouseFk;
|
||||||
|
|
||||||
if (this.$params.lineFk)
|
if (this.$params.lineFk)
|
||||||
this.lineFk = this.$params.lineFk;
|
this.lineFk = this.$params.lineFk;
|
||||||
|
|
|
@ -19,7 +19,8 @@ describe('Item', () => {
|
||||||
describe('set item()', () => {
|
describe('set item()', () => {
|
||||||
it('should set warehouseFk property based on itemType warehouseFk', () => {
|
it('should set warehouseFk property based on itemType warehouseFk', () => {
|
||||||
jest.spyOn(controller.$, '$applyAsync');
|
jest.spyOn(controller.$, '$applyAsync');
|
||||||
controller.item = {id: 1, itemType: {warehouseFk: 1}};
|
controller.vnConfig = {warehouseFk: 1};
|
||||||
|
controller.item = {id: 1};
|
||||||
|
|
||||||
expect(controller.$.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function));
|
expect(controller.$.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function));
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
|
@ -211,7 +211,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN province p ON p.id = a.provinceFk
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
LEFT JOIN warehouse w ON w.id = t.warehouseFk
|
LEFT JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
STRAIGHT_JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN state st ON st.id = ts.stateFk
|
LEFT JOIN state st ON st.id = ts.stateFk
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
|
|
|
@ -3,6 +3,7 @@ const {Email} = require('vn-print');
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('driverRouteEmail', {
|
Self.remoteMethodCtx('driverRouteEmail', {
|
||||||
description: 'Sends the driver route email with an attached PDF',
|
description: 'Sends the driver route email with an attached PDF',
|
||||||
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
|
|
|
@ -6,9 +6,9 @@ module.exports = Self => {
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id',
|
description: 'The route id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,10 +39,7 @@ export default class Controller extends Section {
|
||||||
routes.push(route.id);
|
routes.push(route.id);
|
||||||
const routesId = routes.join(',');
|
const routesId = routes.join(',');
|
||||||
|
|
||||||
this.vnReport.show('driver-route', {
|
this.vnReport.show(`Routes/${routesId}/driver-route-pdf`);
|
||||||
authorization: this.vnToken.token,
|
|
||||||
routeId: routesId
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openClonationDialog() {
|
openClonationDialog() {
|
||||||
|
|
|
@ -49,14 +49,12 @@ describe('Component vnRouteIndex', () => {
|
||||||
const data = controller.$.model.data;
|
const data = controller.$.model.data;
|
||||||
data[0].checked = true;
|
data[0].checked = true;
|
||||||
data[2].checked = true;
|
data[2].checked = true;
|
||||||
const expectedParams = {
|
|
||||||
authorization: null,
|
const routeIds = '1,3';
|
||||||
routeId: '1,3'
|
|
||||||
};
|
|
||||||
|
|
||||||
controller.showRouteReport();
|
controller.showRouteReport();
|
||||||
|
|
||||||
expect(controller.vnReport.show).toHaveBeenCalledWith('driver-route', expectedParams);
|
expect(controller.vnReport.show).toHaveBeenCalledWith(`Routes/${routeIds}/driver-route-pdf`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,8 @@ module.exports = Self => {
|
||||||
pm.name AS payMethod,
|
pm.name AS payMethod,
|
||||||
pd.payDem AS payDem
|
pd.payDem AS payDem
|
||||||
FROM vn.supplier s
|
FROM vn.supplier s
|
||||||
JOIN vn.payMethod pm ON pm.id = s.payMethodFk
|
LEFT JOIN vn.payMethod pm ON pm.id = s.payMethodFk
|
||||||
JOIN vn.payDem pd ON pd.id = s.payDemFk`
|
LEFT JOIN vn.payDem pd ON pd.id = s.payDemFk`
|
||||||
);
|
);
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('newSupplier', {
|
||||||
|
description: 'Creates a new supplier and returns it',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'params',
|
||||||
|
type: 'object',
|
||||||
|
http: {source: 'body'}
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
type: 'string',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/newSupplier`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.newSupplier = async params => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof(params) == 'string')
|
||||||
|
params = JSON.parse(params);
|
||||||
|
|
||||||
|
params.nickname = params.name;
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const supplier = await models.Supplier.create(params, myOptions);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
return supplier;
|
||||||
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -10,7 +10,7 @@ describe('Supplier filter()', () => {
|
||||||
|
|
||||||
let result = await app.models.Supplier.filter(ctx);
|
let result = await app.models.Supplier.filter(ctx);
|
||||||
|
|
||||||
expect(result.length).toEqual(1);
|
expect(result.length).toBeGreaterThanOrEqual(1);
|
||||||
expect(result[0].id).toEqual(1);
|
expect(result[0].id).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
const app = require('vn-loopback/server/server');
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
|
describe('Supplier newSupplier()', () => {
|
||||||
|
const newSupp = {
|
||||||
|
name: 'TestSupplier-1'
|
||||||
|
};
|
||||||
|
const administrativeId = 5;
|
||||||
|
|
||||||
|
it('should create a new supplier containing only the name', async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: administrativeId},
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
|
||||||
|
let result = await app.models.Supplier.newSupplier(JSON.stringify(newSupp));
|
||||||
|
|
||||||
|
expect(result.name).toEqual('TestSupplier-1');
|
||||||
|
expect(result.id).toEqual(443);
|
||||||
|
|
||||||
|
const createdSupplier = await app.models.Supplier.findById(result.id);
|
||||||
|
|
||||||
|
expect(createdSupplier.id).toEqual(result.id);
|
||||||
|
expect(createdSupplier.name).toEqual(result.name);
|
||||||
|
expect(createdSupplier.payDemFk).toEqual(7);
|
||||||
|
expect(createdSupplier.nickname).toEqual(result.name);
|
||||||
|
});
|
||||||
|
});
|
|
@ -10,6 +10,7 @@ module.exports = Self => {
|
||||||
require('../methods/supplier/freeAgencies')(Self);
|
require('../methods/supplier/freeAgencies')(Self);
|
||||||
require('../methods/supplier/campaignMetricsPdf')(Self);
|
require('../methods/supplier/campaignMetricsPdf')(Self);
|
||||||
require('../methods/supplier/campaignMetricsEmail')(Self);
|
require('../methods/supplier/campaignMetricsEmail')(Self);
|
||||||
|
require('../methods/supplier/newSupplier')(Self);
|
||||||
|
|
||||||
Self.validatesPresenceOf('name', {
|
Self.validatesPresenceOf('name', {
|
||||||
message: 'The social name cannot be empty'
|
message: 'The social name cannot be empty'
|
||||||
|
@ -19,13 +20,17 @@ module.exports = Self => {
|
||||||
message: 'The supplier name must be unique'
|
message: 'The supplier name must be unique'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.city) {
|
||||||
Self.validatesPresenceOf('city', {
|
Self.validatesPresenceOf('city', {
|
||||||
message: 'City cannot be empty'
|
message: 'City cannot be empty'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.nif) {
|
||||||
Self.validatesPresenceOf('nif', {
|
Self.validatesPresenceOf('nif', {
|
||||||
message: 'The nif cannot be empty'
|
message: 'The nif cannot be empty'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Self.validatesUniquenessOf('nif', {
|
Self.validatesUniquenessOf('nif', {
|
||||||
message: 'TIN must be unique'
|
message: 'TIN must be unique'
|
||||||
|
@ -57,6 +62,9 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function tinIsValid(err, done) {
|
async function tinIsValid(err, done) {
|
||||||
|
if (!this.countryFk)
|
||||||
|
return done();
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['code'],
|
fields: ['code'],
|
||||||
where: {id: this.countryFk}
|
where: {id: this.countryFk}
|
||||||
|
@ -80,6 +88,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function hasSupplierAccount(err, done) {
|
async function hasSupplierAccount(err, done) {
|
||||||
|
if (!this.payMethodFk) return done();
|
||||||
const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk);
|
const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk);
|
||||||
const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}});
|
const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}});
|
||||||
const hasIban = supplierAccount && supplierAccount.iban;
|
const hasIban = supplierAccount && supplierAccount.iban;
|
||||||
|
@ -92,6 +101,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
Self.observe('before save', async function(ctx) {
|
Self.observe('before save', async function(ctx) {
|
||||||
|
if (ctx.isNewInstance) return;
|
||||||
const loopbackContext = LoopBackContext.getCurrentContext();
|
const loopbackContext = LoopBackContext.getCurrentContext();
|
||||||
const changes = ctx.data || ctx.instance;
|
const changes = ctx.data || ctx.instance;
|
||||||
const orgData = ctx.currentInstance;
|
const orgData = ctx.currentInstance;
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
url="suppliers/newSupplier"
|
||||||
|
data="$ctrl.supplier"
|
||||||
|
insert-mode="true"
|
||||||
|
form="form">
|
||||||
|
</vn-watcher>
|
||||||
|
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield
|
||||||
|
label="Supplier name"
|
||||||
|
ng-model="$ctrl.supplier.name"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
disabled="!watcher.dataChanged()"
|
||||||
|
label="Create">
|
||||||
|
</vn-submit>
|
||||||
|
<vn-button
|
||||||
|
class="cancel"
|
||||||
|
label="Cancel"
|
||||||
|
ui-sref="supplier.index">
|
||||||
|
</vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -0,0 +1,23 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
class Controller extends Section {
|
||||||
|
constructor($element, $) {
|
||||||
|
super($element, $);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
this.$.watcher.submit().then(
|
||||||
|
json => {
|
||||||
|
this.$state.go(`supplier.card.fiscalData`, {id: json.data.id});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.$inject = ['$element', '$scope'];
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnSupplierCreate', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -60,6 +60,8 @@
|
||||||
vn-one
|
vn-one
|
||||||
label="Account"
|
label="Account"
|
||||||
ng-model="$ctrl.supplier.account"
|
ng-model="$ctrl.supplier.account"
|
||||||
|
insertable="true"
|
||||||
|
max-length="10"
|
||||||
rule>
|
rule>
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
|
|
|
@ -20,3 +20,4 @@ import './address/create';
|
||||||
import './address/edit';
|
import './address/edit';
|
||||||
import './agency-term/index';
|
import './agency-term/index';
|
||||||
import './agency-term/create';
|
import './agency-term/create';
|
||||||
|
import './create/index';
|
||||||
|
|
|
@ -59,3 +59,6 @@
|
||||||
supplier="$ctrl.supplierSelected">
|
supplier="$ctrl.supplierSelected">
|
||||||
</vn-supplier-summary>
|
</vn-supplier-summary>
|
||||||
</vn-popup>
|
</vn-popup>
|
||||||
|
<a vn-acl-action="remove" vn-acl="administrative" ui-sref="supplier.create" vn-tooltip="New supplier" vn-bind="+" fixed-bottom-right>
|
||||||
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
|
</a>
|
|
@ -3,3 +3,4 @@ Pay day: Dia de pago
|
||||||
Account: Cuenta
|
Account: Cuenta
|
||||||
Pay method: Metodo de pago
|
Pay method: Metodo de pago
|
||||||
Tax number: Nif
|
Tax number: Nif
|
||||||
|
New supplier: Nuevo proveedor
|
|
@ -52,6 +52,13 @@
|
||||||
"supplier": "$ctrl.supplier"
|
"supplier": "$ctrl.supplier"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"url": "/create",
|
||||||
|
"state": "supplier.create",
|
||||||
|
"component": "vn-supplier-create",
|
||||||
|
"acl": ["administrative"],
|
||||||
|
"description": "New supplier"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"url": "/basic-data",
|
"url": "/basic-data",
|
||||||
"state": "supplier.card.basicData",
|
"state": "supplier.card.basicData",
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,57 @@
|
||||||
|
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('getItemTypeWorker', {
|
||||||
|
description: 'Returns the workers that appear in itemType',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'filter',
|
||||||
|
type: 'Object',
|
||||||
|
description: 'Filter defining where and paginated data',
|
||||||
|
required: true
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
type: ['object'],
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/getItemTypeWorker`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.getItemTypeWorker = async(ctx, filter, options) => {
|
||||||
|
const myOptions = {};
|
||||||
|
const conn = Self.dataSource.connector;
|
||||||
|
let tx;
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const query =
|
||||||
|
`SELECT DISTINCT u.id, u.nickname
|
||||||
|
FROM itemType it
|
||||||
|
JOIN worker w ON w.id = it.workerFk
|
||||||
|
JOIN account.user u ON u.id = w.id`;
|
||||||
|
|
||||||
|
let stmt = new ParameterizedSQL(query);
|
||||||
|
|
||||||
|
if (filter.where) {
|
||||||
|
const value = filter.where.firstName;
|
||||||
|
const myFilter = {
|
||||||
|
where: {or: [
|
||||||
|
{'w.firstName': {like: `%${value}%`}},
|
||||||
|
{'w.lastName': {like: `%${value}%`}},
|
||||||
|
{'u.name': {like: `%${value}%`}},
|
||||||
|
{'u.nickname': {like: `%${value}%`}}
|
||||||
|
]}
|
||||||
|
};
|
||||||
|
|
||||||
|
stmt.merge(conn.makeSuffix(myFilter));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
return conn.executeStmt(stmt);
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,21 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('ticket-request getItemTypeWorker()', () => {
|
||||||
|
const ctx = {req: {accessToken: {userId: 18}}};
|
||||||
|
|
||||||
|
it('should return the buyer as result', async() => {
|
||||||
|
const filter = {where: {firstName: 'buyer'}};
|
||||||
|
|
||||||
|
const result = await models.TicketRequest.getItemTypeWorker(ctx, filter);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the workers at itemType as result', async() => {
|
||||||
|
const filter = {};
|
||||||
|
|
||||||
|
const result = await models.TicketRequest.getItemTypeWorker(ctx, filter);
|
||||||
|
|
||||||
|
expect(result.length).toBeGreaterThan(1);
|
||||||
|
});
|
||||||
|
});
|
|
@ -18,6 +18,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.closeAll = async() => {
|
Self.closeAll = async() => {
|
||||||
const toDate = new Date();
|
const toDate = new Date();
|
||||||
|
toDate.setHours(0, 0, 0, 0);
|
||||||
toDate.setDate(toDate.getDate() - 1);
|
toDate.setDate(toDate.getDate() - 1);
|
||||||
|
|
||||||
const todayMinDate = new Date();
|
const todayMinDate = new Date();
|
||||||
|
@ -51,7 +52,7 @@ module.exports = Self => {
|
||||||
JOIN province p ON p.id = c.provinceFk
|
JOIN province p ON p.id = c.provinceFk
|
||||||
JOIN country co ON co.id = p.countryFk
|
JOIN country co ON co.id = p.countryFk
|
||||||
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
||||||
WHERE al.code = 'PACKED'
|
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
|
||||||
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
|
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
|
||||||
AND util.dayEnd(?)
|
AND util.dayEnd(?)
|
||||||
AND t.refFk IS NULL
|
AND t.refFk IS NULL
|
||||||
|
|
|
@ -101,6 +101,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) {
|
||||||
if (firstOrder == 1) {
|
if (firstOrder == 1) {
|
||||||
const args = {
|
const args = {
|
||||||
id: ticket.clientFk,
|
id: ticket.clientFk,
|
||||||
|
companyId: ticket.companyFk,
|
||||||
recipientId: ticket.clientFk,
|
recipientId: ticket.clientFk,
|
||||||
recipient: ticket.recipient,
|
recipient: ticket.recipient,
|
||||||
replyTo: ticket.salesPersonEmail
|
replyTo: ticket.salesPersonEmail
|
||||||
|
@ -109,7 +110,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) {
|
||||||
const email = new Email('incoterms-authorization', args);
|
const email = new Email('incoterms-authorization', args);
|
||||||
await email.send();
|
await email.send();
|
||||||
|
|
||||||
const sample = await Self.rawSql(
|
const [sample] = await Self.rawSql(
|
||||||
`SELECT id
|
`SELECT id
|
||||||
FROM sample
|
FROM sample
|
||||||
WHERE code = 'incoterms-authorization'
|
WHERE code = 'incoterms-authorization'
|
||||||
|
|
|
@ -126,8 +126,7 @@ module.exports = Self => {
|
||||||
myOptions);
|
myOptions);
|
||||||
|
|
||||||
if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) {
|
if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) {
|
||||||
const error = `You don't have privileges to change the zone or
|
const error = `You don't have privileges to change the zone`;
|
||||||
for these parameters there are more than one shipping options, talk to agencies`;
|
|
||||||
|
|
||||||
throw new UserError(error);
|
throw new UserError(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,7 @@ module.exports = Self => {
|
||||||
myOptions);
|
myOptions);
|
||||||
|
|
||||||
if (!zoneShipped || zoneShipped.zoneFk != args.zoneId) {
|
if (!zoneShipped || zoneShipped.zoneFk != args.zoneId) {
|
||||||
const error = `You don't have privileges to change the zone or
|
const error = `You don't have privileges to change the zone`;
|
||||||
for these parameters there are more than one shipping options, talk to agencies`;
|
|
||||||
|
|
||||||
throw new UserError(error);
|
throw new UserError(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue