diff --git a/.vscode/settings.json b/.vscode/settings.json index 2298e4846..54dc05c7f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,8 +2,6 @@ { // Carácter predeterminado de final de línea. "files.eol": "\n", - "vsicons.presets.angular": false, - "eslint.autoFixOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true } diff --git a/Dockerfile b/Dockerfile index f2cbeeff9..5a65b9b18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,5 +34,5 @@ COPY \ CMD ["pm2-runtime", "./back/process.yml"] -HEALTHCHECK --interval=1m --timeout=10s \ +HEALTHCHECK --interval=15s --timeout=10s \ CMD curl -f http://localhost:3000/api/Applications/status || exit 1 diff --git a/Jenkinsfile b/Jenkinsfile index 0d56f7476..1fa6a49ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,20 +6,13 @@ pipeline { disableConcurrentBuilds() } environment { - PROJECT_NAME = 'salix' - REGISTRY = 'registry.verdnatura.es' - PORT_MASTER_FRONT = '5002' - PORT_MASTER_BACK = '3001' - PORT_TEST_FRONT = '5001' - PORT_TEST_BACK = '4001' - TAG = "${env.BRANCH_NAME}" + PROJECT_NAME = 'salix' + STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { stage('Checkout') { steps { script { - env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" - if (!env.GIT_COMMITTER_EMAIL) { env.COMMITTER_EMAIL = sh( script: 'git --no-pager show -s --format="%ae"', @@ -29,16 +22,6 @@ pipeline { env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; } - switch (env.BRANCH_NAME) { - case 'master': - env.PORT_FRONT = PORT_MASTER_FRONT - env.PORT_BACK = PORT_MASTER_BACK - break - case 'test': - env.PORT_FRONT = PORT_TEST_FRONT - env.PORT_BACK = PORT_TEST_BACK - break - } switch (env.BRANCH_NAME) { case 'master': env.NODE_ENV = 'production' @@ -48,6 +31,14 @@ pipeline { break } } + + configFileProvider([ + configFile(fileId: "salix.groovy", + variable: 'GROOVY_FILE') + ]) { + load env.GROOVY_FILE + } + sh 'printenv' } } @@ -57,8 +48,8 @@ pipeline { } steps { nodejs('node-lts') { - sh 'npm install --no-audit' - sh 'gulp install' + sh 'npm install --no-audit --prefer-offline' + sh 'gulp install --ci' } } } diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js new file mode 100644 index 000000000..c36178b0f --- /dev/null +++ b/back/methods/chat/send.js @@ -0,0 +1,138 @@ +const request = require('request-promise-native'); +module.exports = Self => { + Self.remoteMethodCtx('send', { + description: 'Send a RocketChat message', + accessType: 'WRITE', + accepts: [{ + arg: 'to', + type: 'String', + required: true, + description: 'User (@) or channel (#) to send the message' + }, { + arg: 'message', + type: 'String', + required: true, + description: 'The message' + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/send`, + verb: 'POST' + } + }); + + Self.send = async(ctx, to, message) => { + const models = Self.app.models; + const accessToken = ctx.req.accessToken; + const sender = await models.Account.findById(accessToken.userId); + const recipient = to.replace('@', ''); + + if (sender.name != recipient) + return sendMessage(sender, to, `@${sender.name}: ${message} `); + }; + + async function sendMessage(sender, channel, message) { + const config = await getConfig(); + const avatar = `${config.host}/avatar/${sender.name}`; + const uri = `${config.api}/chat.postMessage`; + + return sendAuth(uri, { + 'channel': channel, + 'avatar': avatar, + 'text': message + }).catch(async error => { + if (error.statusCode === 401 && !this.resendAttempted) { + this.resendAttempted = true; + + return sendMessage(sender, channel, message); + } + + throw new Error(error.message); + }); + } + + /** + * Returns a rocketchat token + * @return {Object} userId and authToken + */ + async function getAuthToken() { + if (!this.auth || this.auth && !this.auth.authToken) { + const config = await getConfig(); + const uri = `${config.api}/login`; + const res = await send(uri, { + user: config.user, + password: config.password + }); + + this.auth = res.data; + } + + return this.auth; + } + + /** + * Returns a rocketchat config + * @return {Object} Auth config + */ + async function getConfig() { + if (!this.chatConfig) { + const models = Self.app.models; + + this.chatConfig = await models.ChatConfig.findOne(); + } + + return this.chatConfig; + } + + /** + * Send unauthenticated request + * @param {*} uri - Request uri + * @param {*} body - Request params + * @param {*} options - Request options + * + * @return {Object} Request response + */ + async function send(uri, body, options) { + if (process.env.NODE_ENV !== 'production') { + return new Promise(resolve => { + return resolve({statusCode: 200, message: 'Fake notification sent'}); + }); + } + + const defaultOptions = { + method: 'POST', + uri: uri, + body: body, + headers: {'content-type': 'application/json'}, + json: true + }; + + if (options) Object.assign(defaultOptions, options); + + return request(defaultOptions); + } + + /** + * Send authenticated request + * @param {*} uri - Request uri + * @param {*} body - Request params + * + * @return {Object} Request response + */ + async function sendAuth(uri, body) { + const login = await getAuthToken(); + const options = { + headers: {'content-type': 'application/json'} + }; + + if (login) { + options.headers['X-Auth-Token'] = login.authToken; + options.headers['X-User-Id'] = login.userId; + } + + return send(uri, body, options); + } +}; diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js new file mode 100644 index 000000000..ac5836af3 --- /dev/null +++ b/back/methods/chat/sendCheckingPresence.js @@ -0,0 +1,53 @@ +module.exports = Self => { + Self.remoteMethodCtx('sendCheckingPresence', { + description: 'Sends a RocketChat message to a working worker or department channel', + accessType: 'WRITE', + accepts: [{ + arg: 'workerId', + type: 'Number', + required: true, + description: 'The worker id of the destinatary' + }, { + arg: 'message', + type: 'String', + required: true, + description: 'The message' + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/sendCheckingPresence`, + verb: 'POST' + } + }); + + Self.sendCheckingPresence = async(ctx, workerId, message) => { + const models = Self.app.models; + const account = await models.Account.findById(workerId); + + const query = `SELECT worker_isWorking(?) isWorking`; + const [result] = await Self.rawSql(query, [workerId]); + + let room; + if (result.isWorking) + room = `@${account.name}`; + else { + const workerDepartment = await models.WorkerDepartment.findById(workerId, { + include: { + relation: 'department' + } + }); + const department = workerDepartment.department(); + const channelName = department.chatName; + room = `#${channelName}`; + + if (channelName) + room = `#${channelName}`; + else room = `@${account.name}`; + } + + return Self.send(ctx, room, message); + }; +}; diff --git a/back/methods/chat/sendMessage.js b/back/methods/chat/sendMessage.js index a861ba07e..b6eaf79a8 100644 --- a/back/methods/chat/sendMessage.js +++ b/back/methods/chat/sendMessage.js @@ -1,4 +1,3 @@ -const request = require('request-promise-native'); module.exports = Self => { Self.remoteMethodCtx('sendMessage', { description: 'Send a RocketChat message', @@ -24,115 +23,8 @@ module.exports = Self => { } }); + // FIXME: Deprecate this method #2019 Self.sendMessage = async(ctx, to, message) => { - const models = Self.app.models; - const accessToken = ctx.req.accessToken; - const sender = await models.Account.findById(accessToken.userId); - const recipient = to.replace('@', ''); - - if (sender.name != recipient) - return sendMessage(sender, to, `@${sender.name}: ${message} `); + return Self.send(ctx, to, message); }; - - async function sendMessage(sender, channel, message) { - const config = await getConfig(); - - const avatar = `${config.host}/avatar/${sender.name}`; - const uri = `${config.api}/chat.postMessage`; - return sendAuth(uri, { - 'channel': channel, - 'avatar': avatar, - 'text': message - }).catch(async error => { - if (error.statusCode === 401 && !this.resendAttempted) { - this.resendAttempted = true; - - return sendMessage(sender, channel, message); - } - - throw new Error(error.message); - }); - } - - /** - * Returns a rocketchat token - * @return {Object} userId and authToken - */ - async function getAuthToken() { - if (!this.auth || this.auth && !this.auth.authToken) { - const config = await getConfig(); - const uri = `${config.api}/login`; - const res = await send(uri, { - user: config.user, - password: config.password - }); - - this.auth = res.data; - } - - return this.auth; - } - - /** - * Returns a rocketchat config - * @return {Object} Auth config - */ - async function getConfig() { - if (!this.chatConfig) { - const models = Self.app.models; - - this.chatConfig = await models.ChatConfig.findOne(); - } - - return this.chatConfig; - } - - /** - * Send unauthenticated request - * @param {*} uri - Request uri - * @param {*} body - Request params - * @param {*} options - Request options - * - * @return {Object} Request response - */ - async function send(uri, body, options) { - if (process.env.NODE_ENV !== 'production') { - return new Promise(resolve => { - return resolve({statusCode: 200, message: 'Fake notification sent'}); - }); - } - - const defaultOptions = { - method: 'POST', - uri: uri, - body: body, - headers: {'content-type': 'application/json'}, - json: true - }; - - if (options) Object.assign(defaultOptions, options); - - return request(defaultOptions); - } - - /** - * Send authenticated request - * @param {*} uri - Request uri - * @param {*} body - Request params - * - * @return {Object} Request response - */ - async function sendAuth(uri, body) { - const login = await getAuthToken(); - const options = { - headers: {'content-type': 'application/json'} - }; - - if (login) { - options.headers['X-Auth-Token'] = login.authToken; - options.headers['X-User-Id'] = login.userId; - } - - return send(uri, body, options); - } }; diff --git a/back/methods/chat/spec/send.spec.js b/back/methods/chat/spec/send.spec.js index ebb62a0c8..b2585a9a1 100644 --- a/back/methods/chat/spec/send.spec.js +++ b/back/methods/chat/spec/send.spec.js @@ -1,9 +1,9 @@ const app = require('vn-loopback/server/server'); -describe('chat sendMessage()', () => { +describe('chat send()', () => { it('should return a "Fake notification sent" as response', async() => { let ctx = {req: {accessToken: {userId: 1}}}; - let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something'); + let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something'); expect(response.statusCode).toEqual(200); expect(response.message).toEqual('Fake notification sent'); @@ -11,7 +11,7 @@ describe('chat sendMessage()', () => { it('should not return a response', async() => { let ctx = {req: {accessToken: {userId: 18}}}; - let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something'); + let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something'); expect(response).toBeUndefined(); }); diff --git a/back/methods/chat/spec/sendCheckingPresence.spec.js b/back/methods/chat/spec/sendCheckingPresence.spec.js new file mode 100644 index 000000000..12a163962 --- /dev/null +++ b/back/methods/chat/spec/sendCheckingPresence.spec.js @@ -0,0 +1,65 @@ +const app = require('vn-loopback/server/server'); + +describe('chat sendCheckingPresence()', () => { + const departmentId = 23; + const workerId = 107; + let timeEntry; + + afterAll(async done => { + const department = await app.models.Department.findById(departmentId); + await department.updateAttribute('chatName', null); + await app.models.WorkerTimeControl.destroyById(timeEntry.id); + done(); + }); + + it(`should call to send() method with the worker username when no department channel is specified + and then return a "Fake notification sent" as response`, async() => { + const ctx = {req: {accessToken: {userId: 1}}}; + const chatModel = app.models.Chat; + spyOn(chatModel, 'send').and.callThrough(); + + const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something'); + + expect(response.statusCode).toEqual(200); + expect(response.message).toEqual('Fake notification sent'); + expect(chatModel.send).toHaveBeenCalledWith(ctx, '@HankPym', 'I changed something'); + }); + + it(`should call to send() method with the worker department channel if is specified + and then return a "Fake notification sent" as response`, async() => { + const ctx = {req: {accessToken: {userId: 1}}}; + const chatModel = app.models.Chat; + spyOn(chatModel, 'send').and.callThrough(); + + const department = await app.models.Department.findById(departmentId); + await department.updateAttribute('chatName', 'cooler'); + + const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something'); + + expect(response.statusCode).toEqual(200); + expect(response.message).toEqual('Fake notification sent'); + expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', 'I changed something'); + }); + + it(`should call to send() method with the worker username when the worker is working`, async() => { + const ctx = {req: {accessToken: {userId: 1}}}; + const chatModel = app.models.Chat; + spyOn(chatModel, 'send').and.callThrough(); + + const today = new Date(); + today.setHours(6, 0); + + timeEntry = await app.models.WorkerTimeControl.create({ + userFk: workerId, + timed: today, + manual: false, + direction: 'in' + }); + + const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something'); + + expect(response.statusCode).toEqual(200); + expect(response.message).toEqual('Fake notification sent'); + expect(chatModel.send).toHaveBeenCalledWith(ctx, '@HankPym', 'I changed something'); + }); +}); diff --git a/back/methods/dms/removeFile.js b/back/methods/dms/removeFile.js index 350bea6bc..93fae9728 100644 --- a/back/methods/dms/removeFile.js +++ b/back/methods/dms/removeFile.js @@ -22,8 +22,10 @@ module.exports = Self => { Self.removeFile = async(ctx, id) => { const models = Self.app.models; - const trashDmsType = await models.DmsType.findOne({where: {code: 'trash'}}); const dms = await models.Dms.findById(id); + const trashDmsType = await models.DmsType.findOne({ + where: {code: 'trash'} + }); const hasWriteRole = await models.DmsType.hasWriteRole(ctx, dms.dmsTypeFk); if (!hasWriteRole) diff --git a/back/methods/dms/specs/downloadFile.spec.js b/back/methods/dms/specs/downloadFile.spec.js index ae8a4fe53..99820ed38 100644 --- a/back/methods/dms/specs/downloadFile.spec.js +++ b/back/methods/dms/specs/downloadFile.spec.js @@ -2,6 +2,7 @@ const app = require('vn-loopback/server/server'); describe('dms downloadFile()', () => { let dmsId = 1; + it('should return a response for an employee with text content-type', async() => { let workerId = 107; let ctx = {req: {accessToken: {userId: workerId}}}; diff --git a/back/methods/message/send.js b/back/methods/message/send.js deleted file mode 100644 index c8849774b..000000000 --- a/back/methods/message/send.js +++ /dev/null @@ -1,48 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('send', { - description: 'Send message to user', - accessType: 'WRITE', - accepts: [{ - arg: 'data', - type: 'object', - required: true, - description: 'recipientFk, message', - http: {source: 'body'} - }, { - arg: 'context', - type: 'object', - http: function(ctx) { - return ctx; - } - }], - returns: { - type: 'boolean', - root: true - }, - http: { - path: `/:recipient/send`, - verb: 'post' - } - }); - - Self.send = async(ctx, data, options) => { - const accessToken = ctx.options && ctx.options.accessToken || ctx.req && ctx.req.accessToken; - const userId = accessToken.userId; - const models = Self.app.models; - const sender = await models.Account.findById(userId, null, options); - const recipient = await models.Account.findById(data.recipientFk, null, options); - - await Self.create({ - sender: sender.name, - recipient: recipient.name, - message: data.message - }, options); - - return await models.MessageInbox.create({ - sender: sender.name, - recipient: recipient.name, - finalRecipient: recipient.name, - message: data.message - }, options); - }; -}; diff --git a/back/methods/message/specs/send.spec.js b/back/methods/message/specs/send.spec.js deleted file mode 100644 index 6749bd7cd..000000000 --- a/back/methods/message/specs/send.spec.js +++ /dev/null @@ -1,14 +0,0 @@ -const app = require('vn-loopback/server/server'); - -describe('message send()', () => { - it('should return a response containing the same message in params', async() => { - let ctx = {req: {accessToken: {userId: 1}}}; - let params = { - recipientFk: 1, - message: 'I changed something' - }; - let response = await app.models.Message.send(ctx, params, {transaction: 'You'}); - - expect(response.message).toEqual(params.message); - }); -}); diff --git a/back/model-config.json b/back/model-config.json index a770a200a..50603be3f 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -23,12 +23,6 @@ "Delivery": { "dataSource": "vn" }, - "Message": { - "dataSource": "vn" - }, - "MessageInbox": { - "dataSource": "vn" - }, "Province": { "dataSource": "vn" }, @@ -59,12 +53,6 @@ "Postcode": { "dataSource": "vn" }, - "UserPhoneType": { - "dataSource": "vn" - }, - "UserPhone": { - "dataSource": "vn" - }, "UserLog": { "dataSource": "vn" } diff --git a/back/models/chat.js b/back/models/chat.js index 8086c6d3d..ecd47029c 100644 --- a/back/models/chat.js +++ b/back/models/chat.js @@ -1,3 +1,5 @@ module.exports = Self => { + require('../methods/chat/send')(Self); require('../methods/chat/sendMessage')(Self); + require('../methods/chat/sendCheckingPresence')(Self); }; diff --git a/back/models/country.json b/back/models/country.json index bf8486b4a..8364636fc 100644 --- a/back/models/country.json +++ b/back/models/country.json @@ -4,36 +4,39 @@ "base": "VnModel", "options": { "mysql": { - "table": "country" + "table": "country" } }, "properties": { "id": { - "type": "Number", - "id": true, - "description": "Identifier" + "type": "Number", + "id": true, + "description": "Identifier" }, "country": { - "type": "string", - "required": true + "type": "string", + "required": true }, "code": { - "type": "string" + "type": "string" + }, + "isUeeMember": { + "type": "Boolean" } }, "relations": { "currency": { - "type": "belongsTo", - "model": "Currency", - "foreignKey": "currencyFk" + "type": "belongsTo", + "model": "Currency", + "foreignKey": "currencyFk" } }, "acls": [ { - "accessType": "READ", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" } ] } \ No newline at end of file diff --git a/back/models/dms.json b/back/models/dms.json index bf6e44311..1d9e3ec21 100644 --- a/back/models/dms.json +++ b/back/models/dms.json @@ -3,6 +3,9 @@ "name": "Dms", "description": "Documental Managment system", "base": "VnModel", + "log": { + "showField": "reference" + }, "options": { "mysql": { "table": "dms" diff --git a/back/models/message-inbox.json b/back/models/message-inbox.json deleted file mode 100644 index 238f3e590..000000000 --- a/back/models/message-inbox.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "MessageInbox", - "base": "VnModel", - "options": { - "mysql": { - "table": "messageInbox" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "sender": { - "type": "String", - "required": true - }, - "recipient": { - "type": "String", - "required": true - }, - "finalRecipient": { - "type": "String", - "required": true - }, - "message": { - "type": "String" - } - }, - "relations": { - "remitter": { - "type": "belongsTo", - "model": "User", - "foreignKey": "sender" - }, - "receptor": { - "type": "belongsTo", - "model": "User", - "foreignKey": "recipient" - } - } -} \ No newline at end of file diff --git a/back/models/message.js b/back/models/message.js deleted file mode 100644 index 6a53476f9..000000000 --- a/back/models/message.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = Self => { - require('../methods/message/send')(Self); -}; diff --git a/back/models/message.json b/back/models/message.json deleted file mode 100644 index 2a855c907..000000000 --- a/back/models/message.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "Message", - "base": "VnModel", - "options": { - "mysql": { - "table": "message" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "sender": { - "type": "String", - "required": true - }, - "recipient": { - "type": "String", - "required": true - }, - "message": { - "type": "String" - } - }, - "relations": { - "remitter": { - "type": "belongsTo", - "model": "User", - "foreignKey": "sender" - }, - "receptor": { - "type": "belongsTo", - "model": "User", - "foreignKey": "recipient" - } - } -} \ No newline at end of file diff --git a/back/models/user-phone-type.json b/back/models/user-phone-type.json deleted file mode 100644 index 9410bd8db..000000000 --- a/back/models/user-phone-type.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "UserPhoneType", - "base": "VnModel", - "options": { - "mysql": { - "table": "userPhoneType" - } - }, - "properties": { - "code": { - "id": true, - "type": "String" - }, - "description": { - "type": "String" - } - }, - "acls": [ - { - "accessType": "READ", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - } - ] -} diff --git a/back/models/user-phone.js b/back/models/user-phone.js deleted file mode 100644 index 6f6c20049..000000000 --- a/back/models/user-phone.js +++ /dev/null @@ -1,9 +0,0 @@ -let UserError = require('vn-loopback/util/user-error'); - -module.exports = Self => { - Self.rewriteDbError(function(err) { - if (err.code === 'ER_DUP_ENTRY') - return new UserError(`This phone already exists`); - return err; - }); -}; diff --git a/back/models/user-phone.json b/back/models/user-phone.json deleted file mode 100644 index f264ff28f..000000000 --- a/back/models/user-phone.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "UserPhone", - "base": "Loggable", - "log": { - "model":"UserLog", - "relation": "user" - }, - "options": { - "mysql": { - "table": "userPhone" - } - }, - "properties": { - "id": { - "id": true, - "type": "Number" - }, - "phone": { - "type": "Number", - "required": true - }, - "typeFk": { - "type": "String", - "required": true - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "Account", - "foreignKey": "userFk" - }, - "type": { - "type": "belongsTo", - "model": "UserPhoneType", - "foreignKey": "typeFk" - } - } -} diff --git a/back/process.yml b/back/process.yml index 3062091b4..41a2fafff 100644 --- a/back/process.yml +++ b/back/process.yml @@ -2,4 +2,5 @@ apps: - script: ./loopback/server/server.js name: salix-back instances: 1 - max_restarts: 5 + max_restarts: 3 + restart_delay: 15000 diff --git a/db/changes/10121-zoneClosure/00-zoneClosure.sql b/db/changes/10121-zoneClosure/00-zoneClosure.sql new file mode 100644 index 000000000..07db5b167 --- /dev/null +++ b/db/changes/10121-zoneClosure/00-zoneClosure.sql @@ -0,0 +1,5 @@ +CREATE TABLE `vn`.`zoneClosure` ( + `zoneFk` INT NOT NULL, + `dated` DATE NOT NULL, + `hour` TIME NOT NULL, + PRIMARY KEY (`zoneFk`, `dated`)); diff --git a/db/changes/10121-zoneClosure/00-zoneClosure_recalc.sql b/db/changes/10121-zoneClosure/00-zoneClosure_recalc.sql new file mode 100644 index 000000000..cb313cdec --- /dev/null +++ b/db/changes/10121-zoneClosure/00-zoneClosure_recalc.sql @@ -0,0 +1,50 @@ + +DROP procedure IF EXISTS vn.`zoneClosure_recalc`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE vn.`zoneClosure_recalc`() +proc: BEGIN +/** + * Recalculates the delivery time (hour) for every zone in days + scope in future + */ + DECLARE vScope INT; + DECLARE vCounter INT DEFAULT 0; + DECLARE vShipped DATE DEFAULT CURDATE(); + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.zoneClosure_recalc'); + RESIGNAL; + END; + + IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN + LEAVE proc; + END IF; + + SELECT scope INTO vScope + FROM zoneConfig; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT id FROM zone; + + TRUNCATE TABLE zoneClosure; + + REPEAT + CALL zone_getOptionsForShipment(vShipped); + INSERT INTO zoneClosure(zoneFk, dated, `hour`) + SELECT zoneFk, vShipped, `hour` FROM tmp.zoneOption; + + SET vCounter = vCounter + 1; + SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); + UNTIL vCounter > vScope + END REPEAT; + + DROP TEMPORARY TABLE tmp.zone; + DO RELEASE_LOCK('vn.zoneClosure_recalc'); +END$$ + +DELIMITER ; + diff --git a/db/changes/10121-zoneClosure/00-zoneConfig.sql b/db/changes/10121-zoneClosure/00-zoneConfig.sql new file mode 100644 index 000000000..915fb8894 --- /dev/null +++ b/db/changes/10121-zoneClosure/00-zoneConfig.sql @@ -0,0 +1,11 @@ +CREATE TABLE `vn`.`zoneConfig` ( + `id` INT UNSIGNED NOT NULL, + `scope` INT UNSIGNED NOT NULL, + PRIMARY KEY (`id`)); + +ALTER TABLE `vn`.`zoneConfig` +CHANGE COLUMN `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ; + +INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1'); + +INSERT INTO `bs`.`nightTask` (`order`, `schema`, `procedure`) VALUES ('100', 'vn', 'zoneClosure_recalc'); diff --git a/db/changes/10130-christmas/00-catalog_componentCalculate.sql b/db/changes/10130-christmas/00-catalog_componentCalculate.sql index 6eb30bbfd..c778c7b3a 100644 --- a/db/changes/10130-christmas/00-catalog_componentCalculate.sql +++ b/db/changes/10130-christmas/00-catalog_componentCalculate.sql @@ -109,10 +109,10 @@ proc: BEGIN GROUP BY tc.itemFk, warehouseFk; INSERT INTO tmp.ticketComponent - SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.recobro, 0.25), 3) + SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3) FROM tmp.ticketComponentBase tcb - JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk - WHERE cr.recobro > 0.009; + JOIN claimRatio cr ON cr.clientFk = vClientFk + WHERE cr.priceIncreasing > 0.009; INSERT INTO tmp.ticketComponent SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto @@ -125,13 +125,13 @@ proc: BEGIN INSERT INTO tmp.ticketComponent SELECT tcb.warehouseFk, tcb.itemFk, - cr.id, - GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3) + c.id, + GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3) FROM tmp.ticketComponentBase tcb - JOIN componentRate cr + JOIN component c JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; + WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; INSERT INTO tmp.ticketComponent SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3 @@ -147,7 +147,7 @@ proc: BEGIN vGeneralInflationCoefficient * ROUND(( i.compression - * r.cm3 + * ic.cm3 * IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1) * IFNULL((z.price - z.bonus) * 1/*amz.inflation*/ , 50)) / vBoxVolume, 4 @@ -156,8 +156,8 @@ proc: BEGIN JOIN item i ON i.id = tcc.itemFk JOIN zone z ON z.id = vZoneFk JOIN agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk - AND r.Id_Article = tcc.itemFk + LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk + AND ic.itemFk = tcc.itemFk HAVING cost <> 0; IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN @@ -178,9 +178,9 @@ proc: BEGIN vSpecialPriceComponent, sp.value - SUM(tcc.cost) sumCost FROM tmp.ticketComponentCopy tcc - JOIN componentRate cr ON cr.id = tcc.componentFk + JOIN component c ON c.id = tcc.componentFk JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - WHERE cr.classRate IS NULL + WHERE c.classRate IS NULL GROUP BY tcc.itemFk, tcc.warehouseFk HAVING ABS(sumCost) > 0.001; @@ -188,10 +188,10 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.ticketComponentSum (INDEX (itemFk, warehouseFk)) ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate + SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate FROM tmp.ticketComponent tc - JOIN componentRate cr ON cr.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate; + JOIN component c ON c.id = tc.componentFk + GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY diff --git a/db/changes/10130-christmas/00-timeControl_calculate.sql b/db/changes/10130-christmas/00-timeControl_calculate.sql new file mode 100644 index 000000000..0a6470216 --- /dev/null +++ b/db/changes/10130-christmas/00-timeControl_calculate.sql @@ -0,0 +1,44 @@ +USE `vn`; +DROP procedure IF EXISTS `timeControl_calculate`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + SET @vIsOdd := TRUE; + SET @vUser := NULL; + SET @vDated := NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + + CREATE TEMPORARY TABLE tmp.timeControlCalculate + SELECT userFk, + dated, + IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds, + SEC_TO_TIME(@timeWork ) timeWorkSexagesimal, + @timeWork / 3600 timeWorkDecimal + FROM (SELECT SUM(timeWork) timeWork, + userFk, + dated + FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk ), + IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE ), + IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd ), + IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed), + IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork, + IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated, + wtc.userFk, + wtc.timed timed, + direction + FROM (SELECT * FROM workerTimeControl ORDER BY userFk, timed ASC) wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo + ORDER BY userFk, timed ASC + ) sub + GROUP BY userFk, dated + ORDER BY userFk, dated + )sub2; + +END$$ + +DELIMITER ; + diff --git a/db/changes/10140-kings/00-ACL.sql b/db/changes/10140-kings/00-ACL.sql new file mode 100644 index 000000000..fe1cbeb24 --- /dev/null +++ b/db/changes/10140-kings/00-ACL.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Thermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer'); +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('TravelThermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer'); +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Entry', '*', '*', 'ALLOW', 'ROLE', 'buyer'); \ No newline at end of file diff --git a/db/changes/10140-kings/00-buy_afterUpsert.sql b/db/changes/10140-kings/00-buy_afterUpsert.sql new file mode 100644 index 000000000..ab038628c --- /dev/null +++ b/db/changes/10140-kings/00-buy_afterUpsert.sql @@ -0,0 +1,81 @@ + +DROP procedure IF EXISTS `vn`.`buy_afterUpsert`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`buy_afterUpsert`(vSelf INT) +BEGIN +/** + * Triggered actions when a buy is updated or inserted. + * + * @param vSelf The buy reference + */ + DECLARE vEntryFk INT; + DECLARE vItemFk INT; + DECLARE vStickers INT; + DECLARE vPacking INT; + DECLARE vWarehouse INT; + DECLARE vWarehouseOut INT; + DECLARE vIsMerchandise BOOL; + DECLARE vIsFeedStock BOOL; + DECLARE vLanded DATE; + DECLARE vBuyerFk INT; + DECLARE vItemName VARCHAR(50); + + SELECT entryFk, itemFk, stickers, packing + INTO vEntryFk, vItemFk, vStickers, vPacking + FROM buy + WHERE id = vSelf; + + SELECT t.warehouseInFk, t.warehouseOutFk, t.landed + INTO vWarehouse, vWarehouseOut, vLanded + FROM entry e + JOIN travel t ON t.id = e.travelFk + WHERE e.id = vEntryFk; + + SELECT k.merchandise, it.workerFk, i.longName + INTO vIsMerchandise, vBuyerFk, vItemName + FROM itemCategory k + JOIN itemType it ON it.categoryFk = k.id + JOIN item i ON i.typeFk = it.id + WHERE i.id = vItemFk; + + IF vIsMerchandise THEN + REPLACE itemCost SET + itemFk = vItemFk, + warehouseFk = vWarehouse, + cm3 = buy_getUnitVolume(vSelf); + END IF; + + SELECT isFeedStock INTO vIsFeedStock + FROM warehouse WHERE id = vWarehouseOut AND id <> 13; + + IF vIsFeedStock THEN + INSERT IGNORE INTO producer(`name`) + SELECT es.company_name + FROM buy b + JOIN edi.ekt be ON be.id = b.ektFk + JOIN edi.supplier es ON es.supplier_id = be.pro + WHERE b.id = vSelf; + + IF buy_hasNotifyPassport(vSelf, vItemFk) THEN + CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking); + END IF; + END IF; + + -- Aviso al comprador de modificacion de entrada en Barajas + IF (SELECT isBuyerToBeEmailed FROM warehouse WHERE id = vWarehouse) + AND vLanded = CURDATE() + AND vBuyerFk != account.myUserGetId() + THEN + + CALL vn.mail_insert(CONCAT(account.userGetNameFromId(vBuyerFk),'@verdnatura.es'), + CONCAT(account.myUserGetName(),'@verdnatura.es'), + CONCAT('E ',vEntryFk,' Se ha modificado item ', vItemFk, ' ',vItemName), + 'Este email se ha generado automáticamente'); + + END IF; + +END$$ + +DELIMITER ; + diff --git a/db/changes/10140-kings/00-clientRisk_update.sql b/db/changes/10140-kings/00-clientRisk_update.sql new file mode 100644 index 000000000..389236e1d --- /dev/null +++ b/db/changes/10140-kings/00-clientRisk_update.sql @@ -0,0 +1,18 @@ + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2)) +BEGIN + IF vAmount IS NOT NULL + THEN + INSERT INTO clientRisk + SET + clientFk = vClientId, + companyFk = vCompanyId, + amount = vAmount + ON DUPLICATE KEY UPDATE + amount = amount + VALUES(amount); + END IF; +END$$ + +DELIMITER ; + diff --git a/db/changes/10140-kings/00-componentType.sql b/db/changes/10140-kings/00-componentType.sql new file mode 100644 index 000000000..e17d35400 --- /dev/null +++ b/db/changes/10140-kings/00-componentType.sql @@ -0,0 +1,3 @@ +ALTER TABLE `vn`.`componentType` +CHANGE COLUMN `base` `isBase` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos' ; + diff --git a/db/changes/10140-kings/00-customer_risk_update.sql b/db/changes/10140-kings/00-customer_risk_update.sql new file mode 100644 index 000000000..c7ecead4f --- /dev/null +++ b/db/changes/10140-kings/00-customer_risk_update.sql @@ -0,0 +1,12 @@ + +DROP procedure IF EXISTS `bi`.`customer_risk_update`; + +DELIMITER $$ +USE `bi`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `bi`.`customer_risk_update`(v_customer INT, v_company INT, v_amount DECIMAL(10,2)) +BEGIN + CALL vn.clientRisk_update(v_customer, v_company, v_amount); +END$$ + +DELIMITER ; + diff --git a/db/changes/10140-kings/00-department.sql b/db/changes/10140-kings/00-department.sql new file mode 100644 index 000000000..29008d753 --- /dev/null +++ b/db/changes/10140-kings/00-department.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`department` +ADD COLUMN `chatName` VARCHAR(45) NULL AFTER `path`; diff --git a/db/changes/10140-kings/00-ticketComponentUpdateSale.sql b/db/changes/10140-kings/00-ticketComponentUpdateSale.sql new file mode 100644 index 000000000..b40debce6 --- /dev/null +++ b/db/changes/10140-kings/00-ticketComponentUpdateSale.sql @@ -0,0 +1,155 @@ + + +DROP procedure IF EXISTS `vn`.`ticketComponentUpdateSale`; + +DELIMITER $$ + +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketComponentUpdateSale`(vOption INT) +BEGIN +/** + * A partir de la tabla tmp.sale, crea los Movimientos_componentes + * y modifica el campo Preu de la tabla Movimientos + * + * @param i_option integer tipo de actualizacion + * @param table tmp.sale tabla memory con el campo saleFk, warehouseFk + **/ + DECLARE vComponentFk INT; + DECLARE vRenewComponents BOOLEAN; + DECLARE vKeepPrices BOOLEAN; + + CASE vOption + WHEN 1 THEN + SET vRenewComponents = TRUE; + SET vKeepPrices = FALSE; + WHEN 2 THEN + SET vComponentFk = 17; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 3 THEN + SET vComponentFk = 37; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 4 THEN + SET vComponentFk = 34; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 5 THEN + SET vComponentFk = 35; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 6 THEN + SET vComponentFk = 36; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 7 THEN + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3) + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk NOT IN (28, 29) + GROUP BY s.id; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3) + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk NOT IN (28, 29) + GROUP BY s.id; + + SET vRenewComponents = FALSE; + SET vKeepPrices = FALSE; + WHEN 8 THEN + DELETE sc.* + FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3) + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id; + + SET vRenewComponents = FALSE; + SET vKeepPrices = FALSE; + WHEN 9 THEN + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + END CASE; + + IF vRenewComponents THEN + DELETE sc.* + FROM tmp.sale tmps + JOIN saleComponent sc ON sc.saleFk = tmps.saleFk + JOIN `component` c ON c.id = sc.componentFk + WHERE c.isRenewable; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, tc.componentFk, tc.cost + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk = tc.componentFk + LEFT JOIN `component` c ON c.id = tc.componentFk + WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); + END IF; + + IF vKeepPrices THEN + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + WHERE sc.saleFk <> vComponentFk + GROUP BY s.id + HAVING dif <> 0; + ELSE + UPDATE sale s + JOIN item i on i.id = s.itemFk + JOIN itemType it on it.id = i.typeFk + JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk + FROM saleComponent sc + JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk + GROUP BY sc.saleFk) sc ON sc.saleFk = s.id + SET s.price = sumValue + WHERE it.code != 'PRT' ; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + WHERE sc.componentFk != 21 + GROUP BY s.id + HAVING ROUND(saleValue, 4) <> 0; + END IF; + + UPDATE sale s + JOIN ( + SELECT SUM(sc.value) sumValue, sc.saleFk + FROM saleComponent sc + JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk + JOIN `component` c ON c.id = sc.componentFk + JOIN componentType ct on ct.id = c.typeFk AND ct.isBase + GROUP BY sc.saleFk) sc ON sc.saleFk = s.id + SET s.priceFixed = sumValue, s.isPriceFixed = 1; + + DELETE sc.* + FROM saleComponent sc + JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk + JOIN sale s on s.id = sc.saleFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE it.code = 'PRT'; + + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 15, s.price + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + JOIN item i ON i.id = s.itemFK + JOIN itemType it ON it.id = i.typeFk + WHERE it.code = 'PRT' AND s.price > 0; +END$$ + +DELIMITER ; + diff --git a/db/changes/10140-kings/00-travelThermograph.sql b/db/changes/10140-kings/00-travelThermograph.sql new file mode 100644 index 000000000..c19151a45 --- /dev/null +++ b/db/changes/10140-kings/00-travelThermograph.sql @@ -0,0 +1,7 @@ +ALTER TABLE `vn`.`travelThermograph` +ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST, +DROP PRIMARY KEY, +ADD PRIMARY KEY (`id`); + +ALTER TABLE `vn`.`travelThermograph` +ADD UNIQUE INDEX `thermograph_created` (`thermographFk` ASC, `created` ASC) VISIBLE; \ No newline at end of file diff --git a/db/changes/10140-kings/00-triggerInvoiceOut.sql b/db/changes/10140-kings/00-triggerInvoiceOut.sql new file mode 100644 index 000000000..7f6ed30b1 --- /dev/null +++ b/db/changes/10140-kings/00-triggerInvoiceOut.sql @@ -0,0 +1,27 @@ +DROP TRIGGER IF EXISTS `vn`.`invoiceOut_afterInsert`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_afterInsert` AFTER INSERT ON `vn`.`invoiceOut` FOR EACH ROW BEGIN + CALL clientRisk_update(NEW.clientFk, NEW.companyFk, NEW.amount); +END$$ +DELIMITER ; + +DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeUpdate`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeUpdate` BEFORE UPDATE ON `vn`.`invoiceOut` FOR EACH ROW +BEGIN + CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); + CALL clientRisk_update (NEW.clientFk, NEW.companyFk, NEW.amount); +END$$ + +DELIMITER ; + + +DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeDelete`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeDelete` BEFORE DELETE ON `invoiceOut` FOR EACH ROW BEGIN + CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); +END$$ +DELIMITER ; diff --git a/db/changes/10140-kings/00-triggerReceipt.sql b/db/changes/10140-kings/00-triggerReceipt.sql new file mode 100644 index 000000000..c9c368a40 --- /dev/null +++ b/db/changes/10140-kings/00-triggerReceipt.sql @@ -0,0 +1,20 @@ +DROP TRIGGER IF EXISTS `vn`.`receipt_afterInsert`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_afterInsert` AFTER INSERT ON `receipt` FOR EACH ROW + CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid)$$ +DELIMITER ; +DROP TRIGGER IF EXISTS `vn`.`receipt_beforeUpdate`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeUpdate` BEFORE UPDATE ON `receipt` FOR EACH ROW BEGIN + CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid); + CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid); +END$$ +DELIMITER ; +DROP TRIGGER IF EXISTS `vn`.`receipt_beforeDelete`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeDelete` BEFORE DELETE ON `receipt` FOR EACH ROW + CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid)$$ +DELIMITER ; diff --git a/db/changes/10140-kings/00-weekWaste_getDetail.sql b/db/changes/10140-kings/00-weekWaste_getDetail.sql new file mode 100644 index 000000000..a7e099f58 --- /dev/null +++ b/db/changes/10140-kings/00-weekWaste_getDetail.sql @@ -0,0 +1,29 @@ +USE `bs`; +DROP procedure IF EXISTS `weekWaste_getDetail`; + +DELIMITER $$ +USE `bs`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `weekWaste_getDetail`() +BEGIN + DECLARE vLastWeek DATE; + DECLARE vWeek INT; + DECLARE vYear INT; + + SET vLastWeek = TIMESTAMPADD(WEEK,-1,CURDATE()); + SET vYear = YEAR(vLastWeek); + SET vWeek = WEEK(vLastWeek, 1); + + SELECT *, 100 * dwindle / total AS percentage + FROM ( + SELECT buyer, + ws.family, + sum(ws.saleTotal) AS total, + sum(ws.saleWaste) AS dwindle + FROM bs.waste ws + WHERE year = vYear AND week = vWeek + GROUP BY buyer, family + ) sub + ORDER BY percentage DESC; +END$$ + +DELIMITER ; diff --git a/db/changes/10140-kings/00-worker_isWorking.sql b/db/changes/10140-kings/00-worker_isWorking.sql new file mode 100644 index 000000000..b80d287e0 --- /dev/null +++ b/db/changes/10140-kings/00-worker_isWorking.sql @@ -0,0 +1,32 @@ +USE `vn`; +DROP function IF EXISTS `worker_isWorking`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN +/** + * Comprueba si el trabajador está trabajando en el momento de la consulta + * @return Devuelve TRUE en caso de que este trabajando. Si se encuentra en un descanso devolverá FALSE + */ + DECLARE vLastIn DATETIME ; + + SELECT MAX(timed) INTO vLastIn + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND + direction = 'in'; + + IF (SELECT MOD(COUNT(*),2) + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND + timed >= vLastIn + ) THEN + RETURN TRUE; + ELSE + RETURN FALSE; + END IF; +END$$ + +DELIMITER ; + diff --git a/db/changes/10140-kings/01-order_confirmWithUser.sql b/db/changes/10140-kings/01-order_confirmWithUser.sql new file mode 100644 index 000000000..c398edc4c --- /dev/null +++ b/db/changes/10140-kings/01-order_confirmWithUser.sql @@ -0,0 +1,240 @@ + +DROP procedure IF EXISTS `hedera`.`order_confirmWithUser`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT) +BEGIN +/** + * Confirms an order, creating each of its tickets on the corresponding + * date, store and user. + * + * @param vOrder The order identifier + * @param vUser The user identifier + */ + DECLARE vOk BOOL; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vWarehouse INT; + DECLARE vShipment DATETIME; + DECLARE vTicket INT; + DECLARE vNotes VARCHAR(255); + DECLARE vItem INT; + DECLARE vConcept VARCHAR(30); + DECLARE vAmount INT; + DECLARE vPrice DECIMAL(10,2); + DECLARE vSale INT; + DECLARE vRate INT; + DECLARE vRowId INT; + DECLARE vDelivery DATE; + DECLARE vAddress INT; + DECLARE vIsConfirmed BOOL; + DECLARE vClientId INT; + DECLARE vCompanyId INT; + DECLARE vAgencyModeId INT; + + DECLARE TICKET_FREE INT DEFAULT 2; + + DECLARE cDates CURSOR FOR + SELECT zgs.shipped, r.warehouse_id + FROM `order` o + JOIN order_row r ON r.order_id = o.id + LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id + WHERE o.id = vOrder AND r.amount != 0 + GROUP BY r.warehouse_id; + + DECLARE cRows CURSOR FOR + SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate + FROM order_row r + JOIN vn.item i ON i.id = r.item_id + WHERE r.amount != 0 + AND r.warehouse_id = vWarehouse + AND r.order_id = vOrder + ORDER BY r.rate DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + -- Carga los datos del pedido + + SELECT o.date_send, o.address_id, o.note, + o.confirmed, a.clientFk, o.company_id, o.agency_id + INTO vDelivery, vAddress, vNotes, + vIsConfirmed, vClientId, vCompanyId, vAgencyModeId + FROM hedera.`order` o + JOIN vn.address a ON a.id = o.address_id + WHERE o.id = vOrder; + + -- Comprueba que el pedido no está confirmado + + IF vIsConfirmed THEN + CALL util.throw ('ORDER_ALREADY_CONFIRMED'); + END IF; + + -- Comprueba que el pedido no está vacío + + SELECT COUNT(*) > 0 INTO vOk + FROM order_row WHERE order_id = vOrder AND amount > 0; + + IF !vOk THEN + CALL util.throw ('ORDER_EMPTY'); + END IF; + + -- Carga las fechas de salida de cada almacén + + CALL vn.zone_getShippedWarehouse (vDelivery, vAddress, vAgencyModeId); + + -- Trabajador que realiza la acción + + IF vUserId IS NULL THEN + SELECT employeeFk INTO vUserId FROM orderConfig; + END IF; + + -- Crea los tickets del pedido + + START TRANSACTION; + + OPEN cDates; + + lDates: + LOOP + SET vTicket = NULL; + SET vDone = FALSE; + FETCH cDates INTO vShipment, vWarehouse; + + IF vDone THEN + LEAVE lDates; + END IF; + + -- Busca un ticket existente que coincida con los parametros + + SELECT t.id INTO vTicket + FROM vn.ticket t + LEFT JOIN vn.ticketState tls on tls.ticket = t.id + JOIN `order` o + ON o.address_id = t.addressFk + AND vWarehouse = t.warehouseFk + AND o.agency_id = t.agencyModeFk + AND o.date_send = t.landed + AND vShipment = DATE(t.shipped) + WHERE o.id = vOrder + AND t.invoiceOutFk IS NULL + AND IFNULL(tls.alertLevel,0) = 0 + AND t.clientFk <> 1118 + LIMIT 1; + + -- Crea el ticket en el caso de no existir uno adecuado + + IF vTicket IS NULL + THEN + CALL vn.ticketCreateWithUser( + vClientId, + IFNULL(vShipment, CURDATE()), + vWarehouse, + vCompanyId, + vAddress, + vAgencyModeId, + NULL, + vDelivery, + vUserId, + vTicket + ); + ELSE + INSERT INTO vncontrol.inter + SET Id_Ticket = vTicket, + Id_Trabajador = vUserId, + state_id = TICKET_FREE; + END IF; + + INSERT IGNORE INTO vn.orderTicket + SET orderFk = vOrder, + ticketFk = vTicket; + + -- Añade las notas + + IF vNotes IS NOT NULL AND vNotes != '' + THEN + INSERT INTO vn.ticketObservation SET + ticketFk = vTicket, + observationTypeFk = 4 /* salesperson */ , + `description` = vNotes + ON DUPLICATE KEY UPDATE + `description` = CONCAT(VALUES(`description`),'. ', `description`); + END IF; + + -- Añade los movimientos y sus componentes + + OPEN cRows; + + lRows: + LOOP + SET vDone = FALSE; + FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate; + + IF vDone THEN + LEAVE lRows; + END IF; + + INSERT INTO vn.sale + SET + itemFk = vItem, + ticketFk = vTicket, + concept = vConcept, + quantity = vAmount, + price = vPrice, + priceFixed = 0, + isPriceFixed = TRUE; + + SET vSale = LAST_INSERT_ID(); + + INSERT INTO vn.saleComponent + (saleFk, componentFk, `value`) + SELECT vSale, cm.component_id, cm.price + FROM order_component cm + JOIN vn.component c ON c.id = cm.component_id + WHERE cm.order_row_id = vRowId + GROUP BY vSale, cm.component_id; + + UPDATE order_row SET Id_Movimiento = vSale + WHERE id = vRowId; + + END LOOP; + + CLOSE cRows; + + -- Fija el coste + + DROP TEMPORARY TABLE IF EXISTS tComponents; + CREATE TEMPORARY TABLE tComponents + (INDEX (saleFk)) + ENGINE = MEMORY + SELECT SUM(sc.`value`) valueSum, sc.saleFk + FROM vn.saleComponent sc + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase + JOIN vn.sale s ON s.id = sc.saleFk + WHERE s.ticketFk = vTicket + GROUP BY sc.saleFk; + + UPDATE vn.sale s + JOIN tComponents mc ON mc.saleFk = s.id + SET s.priceFixed = valueSum; + + DROP TEMPORARY TABLE tComponents; + END LOOP; + + CLOSE cDates; + + DELETE FROM basketOrder WHERE orderFk = vOrder; + UPDATE `order` SET confirmed = TRUE, confirm_date = NOW() + WHERE id = vOrder; + + COMMIT; +END$$ + +DELIMITER ; + diff --git a/db/changes/10140-kings/01-tarifaComponentSerie.sql b/db/changes/10140-kings/01-tarifaComponentSerie.sql new file mode 100644 index 000000000..acdae0b13 --- /dev/null +++ b/db/changes/10140-kings/01-tarifaComponentSerie.sql @@ -0,0 +1,12 @@ +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `bi`.`tarifa_componentes_series` AS + SELECT + `ct`.`id` AS `tarifa_componentes_series_id`, + `ct`.`type` AS `Serie`, + `ct`.`isBase` AS `base`, + `ct`.`isMargin` AS `margen` + FROM + `vn`.`componentType` `ct`; diff --git a/db/changes/10141-kings/00-ACL.sql b/db/changes/10141-kings/00-ACL.sql new file mode 100644 index 000000000..9a43990d0 --- /dev/null +++ b/db/changes/10141-kings/00-ACL.sql @@ -0,0 +1 @@ +REPLACE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('CustomsAgent', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/10141-kings/01-customsAgent.sql b/db/changes/10141-kings/01-customsAgent.sql new file mode 100644 index 000000000..34f77f20f --- /dev/null +++ b/db/changes/10141-kings/01-customsAgent.sql @@ -0,0 +1,11 @@ +CREATE TABLE `vn`.`customsAgent` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `fiscalName` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, + `street` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `nif` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, + `phone` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +ALTER TABLE `vn`.`customsAgent` + ADD UNIQUE KEY `nif_UNIQUE` (`nif`); \ No newline at end of file diff --git a/db/changes/10141-kings/02-incoterms.sql b/db/changes/10141-kings/02-incoterms.sql new file mode 100644 index 000000000..3e31b0c89 --- /dev/null +++ b/db/changes/10141-kings/02-incoterms.sql @@ -0,0 +1,10 @@ +CREATE TABLE `vn`.`incoterms` ( + `code` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Internacional Commercial Terms'; + +ALTER TABLE `vn`.`incoterms` + ADD PRIMARY KEY (`code`); + +REPLACE INTO `vn`.`incoterms` (`code`, `name`) VALUES +('FAS', 'Free Alongside Ship'); diff --git a/db/changes/10141-kings/03-address.sql b/db/changes/10141-kings/03-address.sql new file mode 100644 index 000000000..042c2e17e --- /dev/null +++ b/db/changes/10141-kings/03-address.sql @@ -0,0 +1,26 @@ +ALTER TABLE `vn`.`address` +ADD COLUMN `customsAgentFk` INT NULL DEFAULT NULL AFTER `isEqualizated`; + +ALTER TABLE `vn`.`address` +ADD COLUMN `incotermsFk` VARCHAR(3) NULL DEFAULT NULL AFTER `customsAgentFk`; + + +ALTER TABLE `vn`.`address` +ADD INDEX `address_customsAgentFk_idx` (`customsAgentFk` ASC); + +ALTER TABLE `vn`.`address` +ADD INDEX `address_incotermsFk_idx` (`incotermsFk` ASC); + +ALTER TABLE `vn`.`address` +ADD CONSTRAINT `address_customsAgentFk` + FOREIGN KEY (`customsAgentFk`) + REFERENCES `vn`.`customsAgent` (`id`) + ON DELETE RESTRICT + ON UPDATE CASCADE; + +ALTER TABLE `vn`.`address` +ADD CONSTRAINT `address_incotermsFk` + FOREIGN KEY (`incotermsFk`) + REFERENCES `vn`.`incoterms` (`code`) + ON DELETE RESTRICT + ON UPDATE CASCADE; \ No newline at end of file diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 8893590a8..7e766195d 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -23,7 +23,7 @@ USE `util`; LOCK TABLES `config` WRITE; /*!40000 ALTER TABLE `config` DISABLE KEYS */; -INSERT INTO `config` VALUES (1,'10120',0,'production',NULL); +INSERT INTO `config` VALUES (1,'10121',0,'production',NULL); /*!40000 ALTER TABLE `config` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -36,7 +36,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-23 14:05:01 USE `account`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -61,7 +61,7 @@ USE `account`; LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2018-04-23 14:33:59'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',0,'2018-02-26 15:28:23','2019-01-21 12:57:21'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'); +INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2018-04-23 14:33:59'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',0,'2018-02-26 15:28:23','2019-01-21 12:57:21'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -71,7 +71,7 @@ UNLOCK TABLES; LOCK TABLES `roleInherit` WRITE; /*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */; -INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(65,35),(49,36),(61,36),(17,37),(38,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(15,57),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65); +INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(67,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(65,35),(49,36),(61,36),(17,37),(38,37),(60,37),(67,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(15,57),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65); /*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */; UNLOCK TABLES; @@ -81,7 +81,7 @@ UNLOCK TABLES; LOCK TABLES `roleRole` WRITE; /*!40000 ALTER TABLE `roleRole` DISABLE KEYS */; -INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,13),(15,15),(15,35),(15,56),(15,57),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(16,56),(16,57),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,35),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66); +INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(0,67),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(9,67),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,13),(15,15),(15,35),(15,56),(15,57),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(16,56),(16,57),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,37),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,35),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66),(66,67),(67,1),(67,2),(67,3),(67,5),(67,6),(67,11),(67,13),(67,18),(67,21),(67,33),(67,37),(67,53),(67,67); /*!40000 ALTER TABLE `roleRole` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -94,7 +94,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-23 14:05:01 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -119,8 +119,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(193,'Zone','editPrices','WRITE','ALLOW','ROLE','deliveryBoss'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'), -(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -143,7 +142,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-23 14:05:01 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -178,7 +177,7 @@ UNLOCK TABLES; LOCK TABLES `bookingPlanner` WRITE; /*!40000 ALTER TABLE `bookingPlanner` DISABLE KEYS */; -INSERT INTO `bookingPlanner` VALUES (5,'2017-06-30 22:00:00','4770000002','WORLD',1,4,1),(6,'2017-06-30 22:00:00','4770000010','NATIONAL',2,1,1),(8,'2017-06-30 22:00:00','4770000021','NATIONAL',3,2,1),(9,'2017-06-30 22:00:00','4770000101','EQU',3,1,1),(11,'2017-06-30 22:00:00','4770000110','EQU',2,1,1),(12,'2017-06-30 22:00:00','4770000215','EQU',4,2,1),(13,'2017-06-30 22:00:00','4770000521','EQU',5,2,1),(15,'2017-06-30 22:00:00','4771000000','CEE',2,1,1),(16,'2017-06-30 22:00:00','4771000001','CEE',5,3,1),(19,'2017-07-05 11:54:58','4770000020','NATIONAL',1,4,1),(20,'2017-07-05 12:09:24','4771000000','CEE',3,2,1),(21,'2017-07-05 12:09:24','4771000000','CEE',1,4,1),(22,'2017-07-05 12:12:14','4770000002','WORLD',2,1,1),(23,'2017-07-05 12:12:14','4770000002','WORLD',3,2,1),(24,'2017-07-06 08:07:21','4770000002','WORLD',1,4,5),(25,'2017-07-06 08:07:21','HolandaRED','NATIONAL',2,1,5),(27,'2017-07-06 08:07:21','HolandaGEN','NATIONAL',3,2,5),(32,'2017-07-06 08:07:21','4771000000','CEE',2,1,5),(33,'2017-07-06 08:07:21','4771000001','CEE',5,3,5),(34,'2017-07-06 08:07:21','4770000020','NATIONAL',1,4,5),(35,'2017-07-06 08:07:21','4771000000','CEE',3,2,5),(36,'2017-07-06 08:07:21','4771000000','CEE',1,4,5),(37,'2017-07-06 08:07:21','4770000002','WORLD',2,1,5),(38,'2017-07-06 08:07:21','4770000002','WORLD',3,2,5),(70,'2017-07-06 08:08:48','4770000002','WORLD',1,4,30),(71,'2017-07-06 08:08:48','IGIC reduc','NATIONAL',2,1,30),(72,'2017-07-06 08:08:48','4770000020','NATIONAL',1,4,30),(73,'2017-07-06 08:08:48','IGIC gener','NATIONAL',3,2,30),(78,'2017-07-06 08:08:48','4770000020','NATIONAL',1,4,30),(79,'2017-07-06 08:08:48','4770000002','WORLD',2,1,30),(80,'2017-07-06 08:08:48','4770000002','WORLD',3,2,30),(81,'2017-07-05 22:00:00','IGIC cero','NATIONAL',1,5,30),(82,'2019-01-01 11:51:56','4770000504','EQU',10,5,1),(83,'2019-09-11 10:54:03','4770000405','EQU',11,5,1),(84,'2019-09-11 10:58:17','4770000004','NATIONAL',9,5,1),(85,'2019-09-18 22:00:00','4771000000','CEE',6,5,1); +INSERT INTO `bookingPlanner` VALUES (5,'2017-06-30 22:00:00','4770000002','WORLD',7,4,1),(6,'2017-06-30 22:00:00','4770000010','NATIONAL',3,1,1),(8,'2017-06-30 22:00:00','4770000021','NATIONAL',1,2,1),(9,'2017-06-30 22:00:00','4770000101','EQU',3,1,1),(11,'2017-06-30 22:00:00','4770000110','EQU',4,1,1),(12,'2017-06-30 22:00:00','4770000215','EQU',1,2,1),(13,'2017-06-30 22:00:00','4770000521','EQU',2,2,1),(15,'2017-06-30 22:00:00','4771000000','CEE',3,1,1),(16,'2017-06-30 22:00:00','4771000001','CEE',8,3,1),(19,'2017-07-05 11:54:58','4770000020','NATIONAL',7,4,1),(20,'2017-07-05 12:09:24','4771000000','CEE',1,2,1),(21,'2017-07-05 12:09:24','4771000000','CEE',7,4,1),(22,'2017-07-05 12:12:14','4770000002','WORLD',3,1,1),(23,'2017-07-05 12:12:14','4770000002','WORLD',1,2,1),(24,'2017-07-06 08:07:21','4770000002','WORLD',7,4,5),(25,'2017-07-06 08:07:21','HolandaRED','NATIONAL',3,1,5),(27,'2017-07-06 08:07:21','HolandaGEN','NATIONAL',1,2,5),(32,'2017-07-06 08:07:21','4771000000','CEE',3,1,5),(33,'2017-07-06 08:07:21','4771000001','CEE',8,3,5),(34,'2017-07-06 08:07:21','4770000020','NATIONAL',7,4,5),(35,'2017-07-06 08:07:21','4771000000','CEE',1,2,5),(36,'2017-07-06 08:07:21','4771000000','CEE',7,4,5),(37,'2017-07-06 08:07:21','4770000002','WORLD',3,1,5),(38,'2017-07-06 08:07:21','4770000002','WORLD',1,2,5),(70,'2017-07-06 08:08:48','4770000002','WORLD',7,4,30),(71,'2017-07-06 08:08:48','IGIC reduc','NATIONAL',3,1,30),(72,'2017-07-06 08:08:48','4770000020','NATIONAL',7,4,30),(73,'2017-07-06 08:08:48','IGIC gener','NATIONAL',1,2,30),(78,'2017-07-06 08:08:48','4770000020','NATIONAL',7,4,30),(79,'2017-07-06 08:08:48','4770000002','WORLD',3,1,30),(80,'2017-07-06 08:08:48','4770000002','WORLD',1,2,30),(81,'2017-07-05 22:00:00','IGIC cero','NATIONAL',5,5,30),(82,'2019-01-01 11:51:56','4770000504','EQU',5,5,1),(83,'2019-09-11 10:54:03','4770000405','EQU',6,5,1),(84,'2019-09-11 10:58:17','4770000004','NATIONAL',5,5,1),(85,'2019-09-18 22:00:00','4771000000','CEE',5,5,1); /*!40000 ALTER TABLE `bookingPlanner` ENABLE KEYS */; UNLOCK TABLES; @@ -228,7 +227,7 @@ UNLOCK TABLES; LOCK TABLES `tag` WRITE; /*!40000 ALTER TABLE `tag` DISABLE KEYS */; -INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL),(2,'','Forma',1,0,NULL,NULL,NULL),(3,'','Material',1,0,NULL,NULL,NULL),(4,'','Longitud',1,1,NULL,'mm',NULL),(5,'','Diámetro',1,1,NULL,'mm',NULL),(6,'','Perímetro',1,1,NULL,'mm',NULL),(7,'','Ancho de la base',1,1,NULL,'mm',NULL),(8,'','Altura',1,1,NULL,'mm',NULL),(9,'','Volumen',1,1,NULL,'ml',NULL),(10,'','Densidad',1,1,NULL,NULL,NULL),(11,'','Calidad',1,0,NULL,NULL,NULL),(12,'','Textura',1,0,NULL,NULL,NULL),(13,'','Material del mango',1,0,NULL,NULL,NULL),(14,'','Compra mínima',1,0,NULL,NULL,NULL),(15,'','Nº pétalos',1,1,NULL,NULL,NULL),(16,'','Ancho',1,1,NULL,'mm',NULL),(18,'','Profundidad',1,1,NULL,'mm',NULL),(19,'','Largo',1,1,NULL,'mm',NULL),(20,'','Ancho superior',1,1,NULL,'mm',NULL),(21,'','Ancho inferior',1,1,NULL,'mm',NULL),(22,'','Gramaje',1,1,NULL,'g',NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL),(24,'','Estado',1,0,NULL,NULL,NULL),(25,'','Color principal',0,0,'ink',NULL,NULL),(26,'','Color secundario',0,0,'ink',NULL,NULL),(27,'','Longitud(cm)',1,1,NULL,'cm',NULL),(28,'','Diámetro base',1,1,'','mm',NULL),(29,'','Colección',1,0,NULL,NULL,NULL),(30,'','Uds / caja',1,1,NULL,NULL,NULL),(31,'','Contenido',1,0,NULL,NULL,NULL),(32,'','Peso',1,1,NULL,'g',NULL),(33,'','Grosor',1,1,NULL,'mm',NULL),(34,'','Marca',1,0,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL),(36,'','Proveedor',1,0,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL),(38,'','Duración',1,1,NULL,'s',NULL),(39,'','Flor',1,0,NULL,NULL,NULL),(40,'','Soporte',1,0,NULL,NULL,NULL),(41,'','Tamaño flor',1,0,NULL,NULL,NULL),(42,'','Apertura',1,0,NULL,NULL,NULL),(43,'','Tallo',1,0,NULL,NULL,NULL),(44,'','Nº hojas',1,1,NULL,NULL,NULL),(45,'','Dimensiones',1,0,NULL,NULL,NULL),(46,'','Diámetro boca',1,1,NULL,'mm',NULL),(47,'','Nº flores',1,1,NULL,NULL,NULL),(48,'','Uds / paquete',1,1,NULL,NULL,NULL),(49,'','Maceta',1,1,NULL,'cm',NULL),(50,'','Textura flor',1,0,NULL,NULL,NULL),(51,'','Textura hoja',1,0,NULL,NULL,NULL),(52,'','Tipo de IVA',1,0,NULL,NULL,NULL),(53,'','Tronco',1,0,NULL,NULL,NULL),(54,'','Hoja',1,0,NULL,NULL,NULL),(55,'','Formato',1,0,NULL,NULL,NULL),(56,'','Genero',1,0,NULL,NULL,NULL),(57,'','Especie',1,0,NULL,NULL,NULL),(58,'','Variedad',1,0,NULL,NULL,NULL),(59,'','Medida grande',1,0,NULL,NULL,NULL),(60,'','Medida mediano',1,0,NULL,NULL,NULL),(61,'','Medida pequeño',1,0,NULL,NULL,NULL),(62,'','Medida pequeño',1,0,NULL,NULL,NULL),(63,'','Recipiente interior',1,0,NULL,NULL,NULL),(64,'','Material secundario',1,0,NULL,NULL,NULL),(65,'','Colores',1,0,NULL,NULL,NULL),(66,'','Referencia',1,0,NULL,NULL,NULL),(67,'','Categoria',1,0,NULL,NULL,NULL),(68,'','Amb',1,0,NULL,NULL,NULL),(69,'','Anchura',1,1,NULL,'cm',NULL),(70,'','Hueco interior',1,0,NULL,NULL,NULL),(71,'','Tamaño',1,0,NULL,NULL,NULL),(72,'','Color botón',1,0,NULL,NULL,NULL),(73,'','Tamaño minimo del botón',1,0,NULL,NULL,NULL),(74,'','Obtentor',1,0,NULL,NULL,NULL),(75,'','Longitud del brote',1,0,NULL,NULL,NULL),(76,'','Tallos / u.v.',1,0,NULL,NULL,NULL),(77,'','Madera de',1,0,NULL,NULL,NULL),(78,'','Unidad de venta',1,0,NULL,NULL,NULL),(79,'','Temporal',1,0,NULL,NULL,NULL),(80,'','Gramaje/tallo',1,1,NULL,'g',NULL),(81,'','Peso/paquete',1,1,NULL,'g',NULL),(82,'','Flexibilidad del tallo',1,0,NULL,NULL,NULL),(83,'','Nº planchas',1,1,NULL,NULL,NULL),(84,'','Nº páginas',1,1,NULL,NULL,NULL),(85,'','Editorial',1,0,NULL,NULL,NULL),(86,'','Idioma',1,0,NULL,NULL,NULL),(87,'','Fecha publicación',1,0,NULL,NULL,NULL),(88,'','Cubierta',1,0,NULL,NULL,NULL),(89,'','Encuadernación',1,0,NULL,NULL,NULL),(90,'','Autor',1,0,NULL,NULL,NULL),(91,'','Envoltorio',1,0,NULL,NULL,NULL),(92,'','Nombre temporal',1,0,NULL,NULL,NULL),(93,'','Modelo',1,0,NULL,NULL,NULL),(94,'','Producto',1,0,NULL,NULL,NULL),(95,'','Título',1,0,NULL,NULL,NULL),(96,'','Tomo',1,0,NULL,NULL,NULL),(97,'','Articulo',1,0,NULL,NULL,NULL),(98,'','Metodo de cultivo',1,0,NULL,NULL,NULL),(99,'','Edad',1,0,NULL,NULL,NULL),(100,'','Agotado',1,0,NULL,NULL,NULL),(101,'','Altura con asa',1,1,NULL,'cm',NULL),(102,'','Nº tallos',1,1,NULL,NULL,NULL),(103,'','Cultivo',1,0,NULL,NULL,NULL),(104,'','Sabor',1,0,NULL,NULL,NULL),(105,'','Talla',1,0,NULL,NULL,NULL),(106,'','Calibre',1,1,NULL,NULL,NULL),(107,'','Dulzura',1,1,NULL,'bx',NULL),(108,'','Piezas',1,0,NULL,NULL,NULL),(109,'','Altura con patas',1,0,NULL,NULL,NULL),(110,'','Envase',1,0,NULL,NULL,NULL); +INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL),(2,'','Forma',1,0,NULL,NULL,NULL),(3,'','Material',1,0,NULL,NULL,NULL),(4,'','Longitud',1,1,NULL,'mm',NULL),(5,'','Diámetro',1,1,NULL,'mm',NULL),(6,'','Perímetro',1,1,NULL,'mm',NULL),(7,'','Ancho de la base',1,1,NULL,'mm',NULL),(8,'','Altura',1,1,NULL,'mm',NULL),(9,'','Volumen',1,1,NULL,'ml',NULL),(10,'','Densidad',1,1,NULL,NULL,NULL),(11,'','Calidad',1,0,NULL,NULL,NULL),(12,'','Textura',1,0,NULL,NULL,NULL),(13,'','Material del mango',1,0,NULL,NULL,NULL),(14,'','Compra mínima',1,0,NULL,NULL,NULL),(15,'','Nº pétalos',1,1,NULL,NULL,NULL),(16,'','Ancho',1,1,NULL,'mm',NULL),(18,'','Profundidad',1,1,NULL,'mm',NULL),(19,'','Largo',1,1,NULL,'mm',NULL),(20,'','Ancho superior',1,1,NULL,'mm',NULL),(21,'','Ancho inferior',1,1,NULL,'mm',NULL),(22,'','Gramaje',1,1,NULL,'g',NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL),(24,'','Estado',1,0,NULL,NULL,NULL),(25,'','Color principal',0,0,'ink',NULL,NULL),(26,'','Color secundario',0,0,'ink',NULL,NULL),(27,'','Longitud(cm)',1,1,NULL,'cm',NULL),(28,'','Diámetro base',1,1,'','mm',NULL),(29,'','Colección',1,0,NULL,NULL,NULL),(30,'','Uds / caja',1,1,NULL,NULL,NULL),(31,'','Contenido',1,0,NULL,NULL,NULL),(32,'','Peso',1,1,NULL,'g',NULL),(33,'','Grosor',1,1,NULL,'mm',NULL),(34,'','Marca',1,0,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL),(36,'','Proveedor',1,0,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL),(38,'','Duración',1,1,NULL,'s',NULL),(39,'','Flor',1,0,NULL,NULL,NULL),(40,'','Soporte',1,0,NULL,NULL,NULL),(41,'','Tamaño flor',1,0,NULL,NULL,NULL),(42,'','Apertura',1,0,NULL,NULL,NULL),(43,'','Tallo',1,0,NULL,NULL,NULL),(44,'','Nº hojas',1,1,NULL,NULL,NULL),(45,'','Dimensiones',1,0,NULL,NULL,NULL),(46,'','Diámetro boca',1,1,NULL,'mm',NULL),(47,'','Nº flores',1,1,NULL,NULL,NULL),(48,'','Uds / paquete',1,1,NULL,NULL,NULL),(49,'','Maceta',1,1,NULL,'cm',NULL),(50,'','Textura flor',1,0,NULL,NULL,NULL),(51,'','Textura hoja',1,0,NULL,NULL,NULL),(52,'','Tipo de IVA',1,0,NULL,NULL,NULL),(53,'','Tronco',1,0,NULL,NULL,NULL),(54,'','Hoja',1,0,NULL,NULL,NULL),(55,'','Formato',1,0,NULL,NULL,NULL),(56,'','Genero',1,0,NULL,NULL,NULL),(57,'','Especie',1,0,NULL,NULL,NULL),(58,'','Variedad',1,0,NULL,NULL,NULL),(59,'','Medida grande',1,0,NULL,NULL,NULL),(60,'','Medida mediano',1,0,NULL,NULL,NULL),(61,'','Medida pequeño',1,0,NULL,NULL,NULL),(62,'','Medida pequeño',1,0,NULL,NULL,NULL),(63,'','Recipiente interior',1,0,NULL,NULL,NULL),(64,'','Material secundario',1,0,NULL,NULL,NULL),(65,'','Colores',1,0,NULL,NULL,NULL),(66,'','Referencia',1,0,NULL,NULL,NULL),(67,'','Categoria',1,0,NULL,NULL,NULL),(68,'','Amb',1,0,NULL,NULL,NULL),(69,'','Anchura',1,1,NULL,'cm',NULL),(70,'','Hueco interior',1,0,NULL,NULL,NULL),(71,'','Tamaño',1,0,NULL,NULL,NULL),(72,'','Color botón',1,0,NULL,NULL,NULL),(73,'','Tamaño minimo del botón',1,0,NULL,NULL,NULL),(74,'','Obtentor',1,0,NULL,NULL,NULL),(75,'','Longitud del brote',1,0,NULL,NULL,NULL),(76,'','Tallos / u.v.',1,0,NULL,NULL,NULL),(77,'','Madera de',1,0,NULL,NULL,NULL),(78,'','Unidad de venta',1,0,NULL,NULL,NULL),(79,'','Temporal',1,0,NULL,NULL,NULL),(80,'','Gramaje/tallo',1,1,NULL,'g',NULL),(81,'','Peso/paquete',1,1,NULL,'g',NULL),(82,'','Flexibilidad del tallo',1,0,NULL,NULL,NULL),(83,'','Nº planchas',1,1,NULL,NULL,NULL),(84,'','Nº páginas',1,1,NULL,NULL,NULL),(85,'','Editorial',1,0,NULL,NULL,NULL),(86,'','Idioma',1,0,NULL,NULL,NULL),(87,'','Fecha publicación',1,0,NULL,NULL,NULL),(88,'','Cubierta',1,0,NULL,NULL,NULL),(89,'','Encuadernación',1,0,NULL,NULL,NULL),(90,'','Autor',1,0,NULL,NULL,NULL),(91,'','Envoltorio',1,0,NULL,NULL,NULL),(92,'','Nombre temporal',1,0,NULL,NULL,NULL),(93,'','Modelo',1,0,NULL,NULL,NULL),(94,'','Producto',1,0,NULL,NULL,NULL),(95,'','Título',1,0,NULL,NULL,NULL),(96,'','Tomo',1,0,NULL,NULL,NULL),(97,'','Articulo',1,0,NULL,NULL,NULL),(98,'','Metodo de cultivo',1,0,NULL,NULL,NULL),(99,'','Edad',1,0,NULL,NULL,NULL),(100,'','Agotado',1,0,NULL,NULL,NULL),(101,'','Altura con asa',1,1,NULL,'cm',NULL),(102,'','Nº tallos',1,1,NULL,NULL,NULL),(103,'','Cultivo',1,0,NULL,NULL,NULL),(104,'','Sabor',1,0,NULL,NULL,NULL),(105,'','Talla',1,0,NULL,NULL,NULL),(106,'','Calibre',1,1,NULL,NULL,NULL),(107,'','Dulzura',1,1,NULL,'bx',NULL),(108,'','Piezas',1,0,NULL,NULL,NULL),(109,'','Altura con patas',1,0,NULL,NULL,NULL),(110,'','Envase',1,0,NULL,NULL,NULL),(111,'','Nº piezas',1,0,NULL,NULL,NULL),(112,'','Uso',1,0,NULL,'cm',NULL); /*!40000 ALTER TABLE `tag` ENABLE KEYS */; UNLOCK TABLES; @@ -288,7 +287,7 @@ UNLOCK TABLES; LOCK TABLES `state` WRITE; /*!40000 ALTER TABLE `state` DISABLE KEYS */; -INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0),(2,'Libre',1,0,'FREE',NULL,2,0,0,0),(3,'OK',3,0,'OK',3,28,1,0,0),(4,'Impreso',4,1,'PRINTED',2,29,1,0,1),(5,'Preparación',5,1,'ON_PREPARATION',7,5,0,0,0),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0),(7,'Sin Acabar',2,0,'NOT_READY',NULL,7,0,0,0),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0),(9,'Encajando',9,1,'PACKING',NULL,9,0,1,0),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0),(11,'Facturado',0,0,'INVOICED',NULL,11,0,1,0),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0),(17,'Eliminado',14,3,'ERASED',NULL,17,0,0,0),(20,'Asignado',4,1,'PICKER_DESIGNED',NULL,20,1,0,0),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0),(22,'¿Fecha?',2,0,'WRONG_DATE',NULL,22,0,0,0),(23,'URGENTE',2,0,'LAST_CALL',NULL,23,1,0,0),(24,'Encadenado',3,0,'CHAINED',4,24,0,0,0),(25,'Embarcando',3,0,'BOARDING',5,25,0,0,0),(26,'Prep Previa',5,1,'PREVIOUS_PREPARATION',1,26,0,0,0),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0),(28,'Previa OK',3,1,'OK PREVIOUS',3,28,1,0,0),(29,'Previa Impreso',4,1,'PRINTED PREVIOUS',2,29,1,0,1); +INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0),(2,'Libre',1,0,'FREE',NULL,2,0,0,0,0),(3,'OK',3,0,'OK',3,28,1,0,0,0),(4,'Impreso',4,1,'PRINTED',2,29,1,0,1,0),(5,'Preparación',5,1,'ON_PREPARATION',7,5,0,0,0,2),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0,3),(7,'Sin Acabar',2,0,'NOT_READY',NULL,7,0,0,0,0),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0,3),(9,'Encajando',9,2,'PACKING',NULL,9,0,1,0,0),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0,0),(11,'Facturado',0,0,'INVOICED',NULL,11,0,1,0,0),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0,0),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0,2),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0,0),(17,'Eliminado',14,3,'ERASED',NULL,17,0,0,0,0),(20,'Asignado',4,1,'PICKER_DESIGNED',NULL,20,1,0,0,0),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0,0),(22,'¿Fecha?',2,0,'WRONG_DATE',NULL,22,0,0,0,0),(23,'URGENTE',2,0,'LAST_CALL',NULL,23,1,0,0,0),(24,'Encadenado',3,0,'CHAINED',4,24,0,0,0,0),(25,'Embarcando',3,0,'BOARDING',5,25,0,0,0,0),(26,'Prep Previa',5,1,'PREVIOUS_PREPARATION',1,26,0,0,0,1),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0,0),(28,'Previa OK',3,1,'OK PREVIOUS',3,28,1,0,0,1),(29,'Previa Impreso',4,1,'PRINTED PREVIOUS',2,29,1,0,1,1),(30,'Embarcado',4,0,'BOARD',5,30,0,0,0,2); /*!40000 ALTER TABLE `state` ENABLE KEYS */; UNLOCK TABLES; @@ -308,56 +307,28 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,'VERDNATURA',1,2,763,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(22,'COMPRAS',3,4,NULL,72,596,2,5,0,0,0,0,NULL,'/'),(23,'CAMARA',5,6,NULL,72,604,2,6,1,0,0,0,NULL,'/'),(31,'INFORMATICA',7,8,NULL,72,127,3,9,0,0,0,0,NULL,'/'),(34,'CONTABILIDAD',9,10,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(35,'FINANZAS',11,12,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(36,'LABORAL',13,14,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,4,NULL,'/'),(38,'SACADO',16,17,NULL,72,230,4,14,1,0,1,0,37,'/37/'),(39,'ENCAJADO',18,19,NULL,72,230,4,12,1,0,1,0,37,'/37/'),(41,'ADMINISTRACION',25,26,NULL,72,599,3,8,0,0,0,0,NULL,'/'),(43,'VENTAS',27,38,NULL,0,NULL,NULL,NULL,0,0,0,5,NULL,'/'),(44,'GERENCIA',39,40,NULL,72,300,2,7,0,0,0,0,NULL,'/'),(45,'LOGISTICA',41,42,NULL,72,596,3,19,0,0,0,0,NULL,'/'),(46,'REPARTO',20,21,NULL,72,659,3,10,0,0,1,0,37,'/37/'),(48,'ALMACENAJE',43,44,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(49,'PROPIEDAD',45,46,NULL,72,1008,1,1,0,0,0,0,NULL,'/'),(52,'CARGA AEREA',47,48,NULL,72,163,4,28,0,0,0,0,NULL,'/'),(53,'MARKETING Y COMUNICACIÓN',49,50,NULL,72,1238,0,0,0,0,0,0,NULL,'/'),(54,'ORNAMENTALES',51,52,NULL,72,433,3,21,0,0,0,0,NULL,'/'),(55,'TALLER NATURAL',53,54,NULL,72,695,2,23,0,0,0,0,NULL,'/'),(56,'TALLER ARTIFICIAL',55,56,NULL,72,1780,2,24,0,0,0,0,NULL,'/'),(58,'CAMPOS',57,58,NULL,72,225,2,2,0,0,0,0,NULL,'/'),(59,'MANTENIMIENTO',59,60,NULL,72,1907,4,16,0,0,0,0,NULL,'/'),(60,'RECLAMACIONES',61,62,NULL,72,563,3,20,0,0,0,0,NULL,'/'),(61,'VNH',63,64,NULL,73,1297,3,17,0,0,0,0,NULL,'/'),(63,'VENTAS FRANCIA',28,29,NULL,72,277,2,27,0,0,1,0,43,'/43/'),(66,'VERDNAMADRID',65,66,NULL,72,163,3,18,0,0,0,0,NULL,'/'),(68,'COMPLEMENTOS',67,68,NULL,72,617,3,26,1,0,0,0,NULL,'/'),(69,'VERDNABARNA',69,70,NULL,74,432,3,22,0,0,0,0,NULL,'/'),(77,'PALETIZADO',22,23,NULL,72,230,4,15,1,0,1,0,37,'/37/'),(80,'EQUIPO J VALLES',30,31,NULL,72,693,3,4,0,0,1,0,43,'/43/'),(86,'LIMPIEZA',71,72,NULL,72,599,0,0,0,0,0,0,NULL,'/'),(89,'COORDINACION',73,74,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/'),(90,'TRAILER',75,76,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(91,'ARTIFICIAL',77,78,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/'),(92,'EQUIPO SILVERIO',32,33,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(93,'CONFECCION',79,80,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(94,'EQUIPO J BROCAL',34,35,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(95,'EQUIPO C ZAMBRANO',36,37,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'); +INSERT INTO `department` VALUES (1,'VERDNATURA',1,2,763,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(22,'COMPRAS',3,4,NULL,72,596,2,5,0,0,0,0,NULL,'/'),(23,'CAMARA',5,6,NULL,72,604,2,6,1,0,0,0,NULL,'/'),(31,'INFORMATICA',7,8,NULL,72,127,3,9,0,0,0,0,NULL,'/'),(34,'CONTABILIDAD',9,10,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(35,'FINANZAS',11,12,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(36,'LABORAL',13,14,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,4,NULL,'/'),(38,'SACADO',16,17,NULL,72,230,4,14,1,0,1,0,37,'/37/'),(39,'ENCAJADO',18,19,NULL,72,230,4,12,1,0,1,0,37,'/37/'),(41,'ADMINISTRACION',25,26,NULL,72,599,3,8,0,0,0,0,NULL,'/'),(43,'VENTAS',27,48,NULL,0,NULL,NULL,NULL,0,0,0,10,NULL,'/'),(44,'GERENCIA',49,50,NULL,72,300,2,7,0,0,0,0,NULL,'/'),(45,'LOGISTICA',51,52,NULL,72,596,3,19,0,0,0,0,NULL,'/'),(46,'REPARTO',20,21,NULL,72,659,3,10,0,0,1,0,37,'/37/'),(48,'ALMACENAJE',53,54,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(49,'PROPIEDAD',55,56,NULL,72,1008,1,1,0,0,0,0,NULL,'/'),(52,'CARGA AEREA',57,58,NULL,72,163,4,28,0,0,0,0,NULL,'/'),(53,'MARKETING Y COMUNICACIÓN',59,60,NULL,72,1238,0,0,0,0,0,0,NULL,'/'),(54,'ORNAMENTALES',61,62,NULL,72,433,3,21,0,0,0,0,NULL,'/'),(55,'TALLER NATURAL',63,64,NULL,72,695,2,23,0,0,0,0,NULL,'/'),(56,'TALLER ARTIFICIAL',65,66,NULL,72,1780,2,24,0,0,0,0,NULL,'/'),(58,'CAMPOS',67,68,NULL,72,225,2,2,0,0,0,0,NULL,'/'),(59,'MANTENIMIENTO',69,70,NULL,72,1907,4,16,0,0,0,0,NULL,'/'),(60,'RECLAMACIONES',71,72,NULL,72,563,3,20,0,0,0,0,NULL,'/'),(61,'VNH',73,74,NULL,73,1297,3,17,0,0,0,0,NULL,'/'),(63,'VENTAS FRANCIA',28,29,NULL,72,277,2,27,0,0,1,0,43,'/43/'),(66,'VERDNAMADRID',75,76,NULL,72,163,3,18,0,0,0,0,NULL,'/'),(68,'COMPLEMENTOS',77,78,NULL,72,617,3,26,1,0,0,0,NULL,'/'),(69,'VERDNABARNA',79,80,NULL,74,432,3,22,0,0,0,0,NULL,'/'),(77,'PALETIZADO',22,23,NULL,72,230,4,15,1,0,1,0,37,'/37/'),(80,'EQUIPO J VALLES',30,31,NULL,72,693,3,4,0,0,1,0,43,'/43/'),(86,'LIMPIEZA',81,82,NULL,72,599,0,0,0,0,0,0,NULL,'/'),(89,'COORDINACION',83,84,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/'),(90,'TRAILER',85,86,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(91,'ARTIFICIAL',87,88,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/'),(92,'EQUIPO SILVERIO',32,33,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(93,'CONFECCION',89,90,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(94,'EQUIPO J BROCAL',34,35,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(95,'EQUIPO C ZAMBRANO',36,37,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(96,'EQUIPO C LOPEZ',38,39,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(97,'EQUIPO D SARRION',40,41,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(98,'EQUIPO RODRIGO',42,43,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(99,'EQUIPO MANOLI',44,45,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(101,'EQUIPO J IBAÑEZ',46,47,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2019-12-20 11:02:14 -USE `bi`; --- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) --- --- Host: db.verdnatura.es Database: bi --- ------------------------------------------------------ --- Server version 5.6.25-4-log - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- --- Dumping data for table `tarifa_componentes` +-- Dumping data for table `component` -- -LOCK TABLES `tarifa_componentes` WRITE; -/*!40000 ALTER TABLE `tarifa_componentes` DISABLE KEYS */; -INSERT INTO `tarifa_componentes` VALUES (10,'Precios Especiales',4,NULL,NULL,1,'specialPrices'),(14,'porte extra por dia semana',6,NULL,NULL,1,'extraCostPerWeekDay'),(15,'reparto',6,NULL,NULL,1,'delivery'),(17,'recobro',5,NULL,NULL,1,'debtCollection'),(21,'ajuste',12,NULL,NULL,1,'adjustment'),(22,'venta por paquete',9,1,NULL,0,'salePerPackage'),(23,'venta por caja',9,2,NULL,0,'salePerBox'),(28,'valor de compra',1,NULL,NULL,1,'purchaseValue'),(29,'margen',4,NULL,NULL,1,'margin'),(32,'descuento ultimas unidades',9,3,-0.05,0,'lastUnitsDiscount'),(33,'venta por caja',9,1,NULL,0,'salePerBox'),(34,'descuento comprador',4,NULL,NULL,1,'buyerDiscount'),(35,'cartera comprador',10,NULL,NULL,1,NULL),(36,'descuadre',11,NULL,NULL,1,'mismatch'),(37,'maná',7,4,NULL,0,'mana'),(38,'embolsado',9,NULL,NULL,1,'bagged'),(39,'maná auto',7,NULL,NULL,1,'autoMana'),(40,'cambios Santos 2016',4,NULL,NULL,1,NULL),(41,'bonificacion porte',4,NULL,NULL,1,'freightCharge'); -/*!40000 ALTER TABLE `tarifa_componentes` ENABLE KEYS */; +LOCK TABLES `component` WRITE; +/*!40000 ALTER TABLE `component` DISABLE KEYS */; +INSERT INTO `component` VALUES (10,'Precios Especiales',4,NULL,NULL,1,'specialPrices'),(14,'porte extra por dia semana',6,NULL,NULL,1,'extraCostPerWeekDay'),(15,'reparto',6,NULL,NULL,1,'delivery'),(17,'recobro',5,NULL,NULL,1,'debtCollection'),(21,'ajuste',12,NULL,NULL,1,'adjustment'),(22,'venta por paquete',9,1,NULL,0,'salePerPackage'),(23,'venta por caja',9,2,NULL,0,'salePerBox'),(28,'valor de compra',1,NULL,NULL,1,'purchaseValue'),(29,'margen',4,NULL,NULL,1,'margin'),(32,'descuento ultimas unidades',9,3,-0.05,0,'lastUnitsDiscount'),(33,'venta por caja',9,1,NULL,0,'salePerBox'),(34,'descuento comprador',4,NULL,NULL,1,'buyerDiscount'),(35,'cartera comprador',10,NULL,NULL,1,NULL),(36,'descuadre',11,NULL,NULL,1,'mismatch'),(37,'maná',7,4,NULL,0,'mana'),(38,'embolsado',9,NULL,NULL,1,'bagged'),(39,'maná auto',7,NULL,NULL,1,'autoMana'),(40,'cambios Santos 2016',4,NULL,NULL,1,NULL),(41,'bonificacion porte',4,NULL,NULL,1,'freightCharge'); +/*!40000 ALTER TABLE `component` ENABLE KEYS */; UNLOCK TABLES; -- --- Dumping data for table `tarifa_componentes_series` +-- Dumping data for table `componentType` -- -LOCK TABLES `tarifa_componentes_series` WRITE; -/*!40000 ALTER TABLE `tarifa_componentes_series` DISABLE KEYS */; -INSERT INTO `tarifa_componentes_series` VALUES (1,'coste',1,0),(2,'com ventas',1,1),(3,'com compras',1,1),(4,'empresa',1,1),(5,'cliente',0,0),(6,'agencia',0,0),(7,'cartera_comercial',0,1),(8,'cartera_producto',0,1),(9,'maniobra',1,1),(10,'cartera_comprador',0,1),(11,'errores',0,1),(12,'otros',0,1); -/*!40000 ALTER TABLE `tarifa_componentes_series` ENABLE KEYS */; +LOCK TABLES `componentType` WRITE; +/*!40000 ALTER TABLE `componentType` DISABLE KEYS */; +INSERT INTO `componentType` VALUES (1,'coste',1,0),(2,'com ventas',1,1),(3,'com compras',1,1),(4,'empresa',1,1),(5,'cliente',0,0),(6,'agencia',0,0),(7,'cartera_comercial',0,1),(8,'cartera_producto',0,1),(9,'maniobra',1,1),(10,'cartera_comprador',0,1),(11,'errores',0,1),(12,'otros',0,1); +/*!40000 ALTER TABLE `componentType` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -369,7 +340,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-23 14:05:01 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -407,7 +378,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:15 +-- Dump completed on 2020-01-23 14:05:01 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -465,7 +436,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:15 +-- Dump completed on 2020-01-23 14:05:01 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -540,7 +511,7 @@ UNLOCK TABLES; LOCK TABLES `workcenter` WRITE; /*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,1026,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20008,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2851,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,2,NULL); +INSERT INTO `workcenter` VALUES (1,'Silla',20,1027,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20008,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2852,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10); /*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -553,4 +524,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:15 +-- Dump completed on 2020-01-23 14:05:01 diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index a10b2003c..7b7651a9d 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -53,37 +53,38 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType` VALUES (1, 978, 1, 0, 2000, 9, 0); -INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lang`) +INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`) VALUES - (101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'), - (102, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'), - (103, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'), - (104, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'), - (105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'), - (106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'), - (107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'), - (108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'), - (109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'), - (110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'), - (111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'), - (112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'); + (101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'), + (102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'), + (103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'), + (104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'), + (105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'), + (106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'), + (107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'), + (108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'), + (109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'), + (110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'), + (111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'), + (112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'); -INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`) +INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`) VALUES - (106, 'LGN', 'David Charles', 'Haller', 106, 19), - (107, 'ANT', 'Hank' , 'Pym' , 107, 19), - (108, 'DCX', 'Charles' , 'Xavier', 108, 19), - (109, 'HLK', 'Bruce' , 'Banner', 109, 19), - (110, 'JJJ', 'Jessica' , 'Jones' , 110, 19); + (106, 'LGN', 'David Charles', 'Haller', 106, 19, 432978106), + (107, 'ANT', 'Hank' , 'Pym' , 107, 19, 432978107), + (108, 'DCX', 'Charles' , 'Xavier', 108, 19, 432978108), + (109, 'HLK', 'Bruce' , 'Banner', 109, 19, 432978109), + (110, 'JJJ', 'Jessica' , 'Jones' , 110, 19, 432978110); INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`) VALUES - (1, 'España', 0, 'ES', 1, 24), + (1, 'España', 1, 'ES', 1, 24), (2, 'Italia', 1, 'IT', 1, 27), (3, 'Alemania', 1, 'DE', 1, 22), (4, 'Rumania', 1, 'RO', 1, 24), (5, 'Holanda', 1, 'NL', 1, 18), (8, 'Portugal', 1, 'PT', 1, 27), + (13,'Ecuador', 0, 'EC', 1, 24), (19,'Francia', 1, 'FR', 1, 27), (30,'Canarias', 1, 'IC', 1, 24); @@ -124,6 +125,13 @@ INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, (1, 'Pay on receipt', '0000000000', 4, 0, 1, 1), (2, 'Cash', '1111111111', 1, 0, 1, 1); +INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) + VALUES + (1, 'AGENCY', 'Agencia'), + (2, 'DELIVERY', 'Reparto'), + (3, 'PICKUP', 'Recogida'), + (4, 'OTHER', 'Otros'); + INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`) VALUES (1, 'inhouse pickup' , 1, 0, 1, 1), @@ -181,8 +189,8 @@ INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`) (1, 'Province one', 1, NULL), (2, 'Province two', 1, NULL), (3, 'Province three', 1, NULL), - (4, 'Province four', 1, NULL), - (5, 'Province five', 1, NULL); + (4, 'Province four', 2, NULL), + (5, 'Province five', 13, NULL); INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`) VALUES @@ -216,21 +224,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) (3, 'Daily Bugle'), (4, 'GCN Channel'), (5, 'The Newspaper'); - -INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`) +INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`) VALUES - (101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), - (106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1), - (107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), - (108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1), - (109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), - (110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1), - (111, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1), - (112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1); + (101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), + (102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), + (103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), + (104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), + (105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), + (106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1), + (107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), + (108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1), + (109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), + (110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1), + (111, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1), + (112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1 @@ -404,11 +411,11 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`) VALUES - (1, 'T', 1014.24, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 101, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1), + (1, 'T', 1014.24, CURDATE(), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), (2, 'T', 121.36, CURDATE(), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), (3, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), (4, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), - (5, 'A', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1); + (5, 'A', 8.88, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 103, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1); UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1; UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2; @@ -460,21 +467,21 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF ('T', 'Española rapida', 1, 'NATIONAL', 0), ('V', 'Intracomunitaria global', 0, 'CEE', 1); -INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`) +INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `m3Max`) VALUES - (1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0), - (2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0), - (3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0), - (4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0), - (5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0), - (6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0), - (7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 23, 0, 0, 0), - (8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 10, 0, 0, 0), - (9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 0, 0, 0), - (10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 0, 0, 0), - (11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0), - (12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 0, 0, 0), - (13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 0, 0, 0); + (1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, 30.50), + (2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, 30.50), + (3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0, 40.50), + (4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0, 40.50), + (5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0, 50.50), + (6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0, 50.50), + (7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 23, 0, 0, 0, 60.50), + (8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 10, 0, 0, 0, 60.50), + (9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 0, 0, 0, NULL), + (10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 0, 0, 0, NULL), + (11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, NULL), + (12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 0, 0, 0, NULL), + (13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 0, 0, 0, NULL); INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) VALUES @@ -643,7 +650,8 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk (2, 'ITG', 'Anthurium', 1, 31, 5, 0), (3, 'WPN', 'Paniculata', 2, 31, 5, 0), (4, 'PRT', 'Delivery ports', 3, NULL, 5, 1), - (5, 'CON', 'Container', 3, NULL, 5, 1); + (5, 'CON', 'Container', 3, NULL, 5, 1), + (6, 'ALS', 'Alstroemeria', 1, 31, 5, 0); INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`) VALUES @@ -1127,13 +1135,26 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`, (6, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 6, 442, 'Movement 6', 'this is the note six', 'observation six'), (7, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 442, 'Movement 7', 'this is the note seven', 'observation seven'); -INSERT INTO `bi`.`claims_ratio`(`id_Cliente`, `Consumo`, `Reclamaciones`, `Ratio`, `recobro`, `inflacion`) +INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) VALUES (101, 500, NULL, 0.00, 0.00, 1.00), (102, 1000, 2.00, 0.01, 0.05, 1.00), (103, 2000, 0.00, 0.00, 0.02, 1.00), (104, 2500, 150.00, 0.02, 0.10, 1.00); +INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `saleTotal`, `saleWaste`, `rate`) + VALUES + ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', '1062', '51', '4.8'), + ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Colombia', '35074', '687', '2.0'), + ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Mini', '1777', '13', '0.7'), + ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Short', '9182', '59', '0.6'), + ('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Containers', '-74', '0', '0.0'), + ('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Packagings', '-7', '0', '0.0'), + ('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Freight', '1100', '0', '0.0'), + ('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Funeral Accessories', '848', '-187', '-22.1'), + ('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', '186', '0', '0.0'), + ('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', '277', '0', '0.0'); + INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`minPrice`,`producer`,`printedStickers`,`isChecked`,`isIgnored`, `created`) VALUES (1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), @@ -1152,13 +1173,6 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`package (14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, CURDATE()), (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE()); -INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) - VALUES - (1, 'AGENCY', 'Agencia'), - (2, 'DELIVERY', 'Reparto'), - (3, 'PICKUP', 'Recogida'), - (4, 'OTHER', 'Otros'); - INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES (1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), @@ -1549,7 +1563,7 @@ INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`) FROM `postgresql`.`person` `p`; INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`) - SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-31'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-01'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL + SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL FROM `postgresql`.`profile` `p`; INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`) @@ -1586,20 +1600,20 @@ INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, ` INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`) VALUES - (106, 1, DATE_ADD(CURDATE(), INTERVAL 10 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL 11 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL 12 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)), - (106, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)), - (106, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 15 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 16 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 30 DAY)), - (107, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)), - (107, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY)); + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))), + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))), + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))), + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))), + (106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))), + (106, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))), + (106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))), + (107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))), + (107, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))), + (107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY))); INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`) VALUES @@ -1866,12 +1880,12 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`) (8, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)), (8, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY)); -INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `order`, `manual`, `direction`) +INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`) VALUES - (106, CONCAT(CURDATE(), ' 07:00'), 1, TRUE, 'in'), - (106, CONCAT(CURDATE(), ' 10:00'), 2, TRUE, 'middle'), - (106, CONCAT(CURDATE(), ' 10:10'), 3, TRUE, 'middle'), - (106, CONCAT(CURDATE(), ' 15:00'), 4, TRUE, 'out'); + (106, CONCAT(CURDATE(), ' 07:00'), TRUE, 'in'), + (106, CONCAT(CURDATE(), ' 10:00'), TRUE, 'middle'), + (106, CONCAT(CURDATE(), ' 10:10'), TRUE, 'middle'), + (106, CONCAT(CURDATE(), ' 15:00'), TRUE, 'out'); INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`) VALUES @@ -1901,7 +1915,8 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()), (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()), (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()), - (4, 3, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()); + (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()), + (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE()); INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`) VALUES @@ -1926,75 +1941,33 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`) (2, 'Normal'), (3, 'Baja'); -INSERT INTO `vn`.`userPhoneType` (`code`, `description`) - VALUES - ('businessPhone', 'Telefono de empresa del usuario'), - ('personalPhone', 'Telefono personal del usuario'); - -INSERT INTO `vn`.`userPhone`(`id`, `userFk`, `typeFk`, `phone`) - VALUES - (1, 101, 'personalPhone', 1111111111), - (2, 102, 'personalPhone', 1111111111), - (3, 103, 'personalPhone', 1111111111), - (4, 104, 'personalPhone', 1111111111), - (5, 105, 'personalPhone', 1111111111), - (6, 106, 'personalPhone', 1111111111), - (7, 107, 'personalPhone', 1111111111), - (8, 108, 'personalPhone', 1111111111), - (9, 109, 'personalPhone', 1111111111), - (10, 110, 'personalPhone', 1111111111), - (11, 111, 'personalPhone', 1111111111), - (12, 112, 'personalPhone', 1111111111), - (13, 1, 'personalPhone', 623111111), - (14, 2, 'personalPhone', 623111111), - (15, 3, 'personalPhone', 623111111), - (16, 5, 'personalPhone', 623111111), - (17, 6, 'personalPhone', 623111111), - (18, 9, 'personalPhone', 623111111), - (19, 13, 'personalPhone', 623111111), - (20, 15, 'personalPhone', 623111111), - (21, 16, 'personalPhone', 623111111), - (22, 17, 'personalPhone', 623111111), - (23, 18, 'personalPhone', 623111111), - (24, 19, 'personalPhone', 623111111), - (26, 21, 'personalPhone', 623111111), - (27, 22, 'personalPhone', 623111111), - (28, 30, 'personalPhone', 623111111), - (29, 31, 'personalPhone', 623111111), - (30, 32, 'personalPhone', 623111111), - (31, 34, 'personalPhone', 623111111), - (32, 35, 'personalPhone', 623111111), - (33, 36, 'personalPhone', 623111111), - (34, 37, 'personalPhone', 623111111), - (35, 38, 'personalPhone', 623111111), - (36, 39, 'personalPhone', 623111111), - (37, 40, 'personalPhone', 623111111), - (38, 41, 'personalPhone', 623111111), - (39, 42, 'personalPhone', 623111111), - (40, 43, 'personalPhone', 623111111), - (41, 44, 'personalPhone', 623111111), - (42, 45, 'personalPhone', 623111111), - (43, 47, 'personalPhone', 623111111), - (44, 48, 'personalPhone', 623111111), - (45, 50, 'personalPhone', 623111111), - (46, 51, 'personalPhone', 623111111), - (47, 52, 'personalPhone', 623111111), - (48, 54, 'personalPhone', 623111111), - (49, 55, 'personalPhone', 623111111), - (50, 56, 'personalPhone', 623111111), - (51, 57, 'personalPhone', 623111111), - (52, 58, 'personalPhone', 623111111), - (53, 59, 'personalPhone', 623111111), - (54, 60, 'personalPhone', 623111111), - (55, 61, 'personalPhone', 623111111), - (56, 65, 'personalPhone', 623111111), - (57, 66, 'personalPhone', 623111111), - (65, 107, 'businessPhone', 700987987), - (67, 106, 'businessPhone', 1111111112), - (68, 106, 'personalPhone', 1111111113); - INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`) VALUES (1, 43200, 129600, 734400, 43200, 50400); INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); + +INSERT INTO `vn`.`thermograph`(`id`, `model`) + VALUES + ('TMM190901395', 'TEMPMATE'), + ('TL.BBA85422', 'TL30'), + ('TZ1905012010', 'DISPOSABLE'), + ('138350-0', 'DISPOSABLE'); + +INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperature`, `result`, `dmsFk`) + VALUES + ('TMM190901395', CURDATE(), 1, 1, 'WARM', 'Ok', NULL), + ('TL.BBA85422', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL), + ('TL.BBA85422', CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL), + ('TZ1905012010', CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5), + ('138350-0', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5), + ('138350-0', CURDATE(), 1, NULL, 'COOL', NULL, NULL); + +REPLACE INTO `vn`.`incoterms` (`code`, `name`) + VALUES + ('FAS', 'Free Alongside Ship'); + +REPLACE INTO `vn`.`customsAgent` (`id`, `fiscalName`, `street`, `nif`, `phone`, `email`) + VALUES + (1, 'Agent one', '1007 Mountain Drive, Gotham', 'N1111111111', '111111111', 'agentone@gotham.com'), + (2, 'Agent two', '1007 Mountain Drive, Gotham', 'N2222222222', '222222222', 'agenttwo@gotham.com'); \ No newline at end of file diff --git a/db/dump/structure.sql b/db/dump/structure.sql index c56b2a0a1..c78730381 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -1802,769 +1802,463 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Current Database: `bi` +-- Current Database: `bs` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bs` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; -USE `bi`; +USE `bs`; -- --- Table structure for table `Equalizator` +-- Temporary table structure for view `bajasLaborales` -- -DROP TABLE IF EXISTS `Equalizator`; +DROP TABLE IF EXISTS `bajasLaborales`; +/*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `bajasLaborales` AS SELECT + 1 AS `firstname`, + 1 AS `name`, + 1 AS `business_id`, + 1 AS `lastDate`, + 1 AS `endContract`, + 1 AS `type`, + 1 AS `dias`, + 1 AS `userFk`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `bancos_evolution` +-- + +DROP TABLE IF EXISTS `bancos_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Equalizator` ( - `Vista` int(11) NOT NULL, - `Pedido` int(11) DEFAULT NULL, - `Impreso` int(11) DEFAULT NULL, - `Encajado` int(11) DEFAULT NULL, - PRIMARY KEY (`Vista`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Greuge_Evolution` --- - -DROP TABLE IF EXISTS `Greuge_Evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Greuge_Evolution` ( - `Id_Cliente` int(11) NOT NULL, +CREATE TABLE `bancos_evolution` ( `Fecha` date NOT NULL, - `Greuge` decimal(10,2) NOT NULL DEFAULT '0.00', - `Ventas` decimal(10,2) NOT NULL DEFAULT '0.00', - `Fosil` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'greuge fósil, correspondiente a los clientes muertos', - `Recobro` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`Id_Cliente`,`Fecha`), - KEY `greuge_evolution_idx1` (`Fecha`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacenamos la evolucion del greuge de los ultimos dias '; + `Id_Banco` int(11) NOT NULL, + `saldo` double NOT NULL DEFAULT '0', + `quilla` double NOT NULL DEFAULT '0', + `deuda` double NOT NULL DEFAULT '0', + `liquidez` double NOT NULL DEFAULT '0', + `disponibilidad ajena` double NOT NULL DEFAULT '0', + `saldo_aux` double NOT NULL DEFAULT '0' COMMENT 'Saldo auxiliar para el calculo de lo dispuesto en las polizas', + PRIMARY KEY (`Fecha`,`Id_Banco`), + KEY `fk_banco_evolution_idx` (`Id_Banco`), + CONSTRAINT `fk_banco_evolution` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`bank` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los saldos bancarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Greuge_comercial_recobro` +-- Table structure for table `carteras` -- -DROP TABLE IF EXISTS `Greuge_comercial_recobro`; +DROP TABLE IF EXISTS `carteras`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Greuge_comercial_recobro` ( - `Id_Trabajador` int(11) NOT NULL, - `recobro` decimal(10,2) NOT NULL DEFAULT '0.00', - `peso_cartera` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`Id_Trabajador`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Greuges_comercial_detail` --- - -DROP TABLE IF EXISTS `Greuges_comercial_detail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Greuges_comercial_detail` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `Id_Trabajador` int(10) unsigned NOT NULL, - `Comentario` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `Importe` decimal(10,2) NOT NULL, - `Fecha` datetime DEFAULT NULL, - PRIMARY KEY (`Id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Last_buy_id` --- - -DROP TABLE IF EXISTS `Last_buy_id`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Last_buy_id` ( - `Id_Article` int(11) NOT NULL DEFAULT '90', - `Id_Compra` int(11) NOT NULL DEFAULT '0', - `warehouse_id` smallint(6) unsigned NOT NULL, - PRIMARY KEY (`warehouse_id`,`Id_Article`), - UNIQUE KEY `Id_Compra_UNIQUE` (`Id_Compra`), - CONSTRAINT `Id_CompraFK` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Ticket_Portes` --- - -DROP TABLE IF EXISTS `Ticket_Portes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Ticket_Portes` ( - `Id_Ticket` int(11) NOT NULL, - `rate` tinyint(4) NOT NULL COMMENT 'Tarifa', - `real_amount` double NOT NULL COMMENT 'Cantidad pactada con la agencia', - `payed_amount` double NOT NULL COMMENT 'Cantidad reflejada en el Ticket', - PRIMARY KEY (`Id_Ticket`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `XDiario_ALL` --- - -DROP TABLE IF EXISTS `XDiario_ALL`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `XDiario_ALL` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `empresa_id` int(5) NOT NULL, - `SUBCTA` varchar(11) COLLATE utf8_unicode_ci NOT NULL, - `Eurodebe` double DEFAULT NULL, - `Eurohaber` double DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `FECHA_EX` date DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `Cuenta` (`SUBCTA`), - KEY `empresa` (`empresa_id`), - KEY `Fecha` (`Fecha`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_grafico_simple` --- - -DROP TABLE IF EXISTS `analisis_grafico_simple`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_grafico_simple` ( - `Año` smallint(5) unsigned NOT NULL, - `Semana` tinyint(3) unsigned NOT NULL, - `Importe` double DEFAULT NULL, - UNIQUE KEY `Año` (`Año`,`Semana`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `analisis_grafico_ventas` --- - -DROP TABLE IF EXISTS `analisis_grafico_ventas`; -/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `analisis_grafico_ventas` AS SELECT - 1 AS `Año`, - 1 AS `Semana`, - 1 AS `Importe`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `analisis_ventas` --- - -DROP TABLE IF EXISTS `analisis_ventas`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `Familia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `Reino` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `Comercial` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Provincia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `almacen` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `Año` smallint(5) unsigned NOT NULL, - `Mes` tinyint(3) unsigned NOT NULL, - `Semana` tinyint(3) unsigned NOT NULL, - `Vista` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `Importe` double NOT NULL, - PRIMARY KEY (`id`), - KEY `Año` (`Año`,`Semana`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_almacen_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_almacen_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_almacen_evolution` ( - `Semana` int(11) NOT NULL, - `Almacen` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `Ventas` int(11) NOT NULL, +CREATE TABLE `carteras` ( + `CodigoTrabajador` varchar(3) CHARACTER SET latin1 NOT NULL, `Año` int(11) NOT NULL, - `Periodo` int(11) NOT NULL, - UNIQUE KEY `Almacen` (`Almacen`,`Periodo`), - KEY `Periodo` (`Periodo`) + `Mes` int(11) NOT NULL, + `Peso` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`CodigoTrabajador`,`Año`,`Mes`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `analisis_ventas_comprador_evolution` +-- Table structure for table `clientAnnualConsumption` -- -DROP TABLE IF EXISTS `analisis_ventas_comprador_evolution`; +DROP TABLE IF EXISTS `clientAnnualConsumption`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_comprador_evolution` ( - `semana` int(11) NOT NULL, - `comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `comprador` (`comprador`,`periodo`), - KEY `periodo` (`periodo`) +CREATE TABLE `clientAnnualConsumption` ( + `clientFk` int(11) NOT NULL, + `invoiced` double(17,0) DEFAULT NULL, + PRIMARY KEY (`clientFk`), + CONSTRAINT `fmaId_Cliente` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `analisis_ventas_familia_evolution` +-- Table structure for table `clientDied` -- -DROP TABLE IF EXISTS `analisis_ventas_familia_evolution`; +DROP TABLE IF EXISTS `clientDied`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_familia_evolution` ( - `semana` int(11) NOT NULL, - `familia` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `familia` (`familia`,`periodo`), - KEY `periodo` (`periodo`) +CREATE TABLE `clientDied` ( + `id` int(11) NOT NULL DEFAULT '0', + `clientName` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `lastInvoiced` date DEFAULT NULL, + `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `Boss` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `Aviso` varchar(13) CHARACTER SET utf8 DEFAULT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `analisis_ventas_provincia_evolution` +-- Table structure for table `clientNewBorn` -- -DROP TABLE IF EXISTS `analisis_ventas_provincia_evolution`; +DROP TABLE IF EXISTS `clientNewBorn`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_provincia_evolution` ( - `semana` int(11) NOT NULL, - `provincia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `provincia` (`provincia`,`periodo`), - KEY `periodo` (`periodo`) +CREATE TABLE `clientNewBorn` ( + `clientFk` int(11) NOT NULL, + `shipped` date NOT NULL, + PRIMARY KEY (`clientFk`), + CONSTRAINT `clientNewBorn_fk1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Listado de clientes que se consideran nuevos a efectos de cobrar la comision adicional del comercial'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `compradores` +-- + +DROP TABLE IF EXISTS `compradores`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `compradores` ( + `Id_Trabajador` int(11) NOT NULL, + `año` int(4) NOT NULL, + `semana` int(2) NOT NULL, + `importe` decimal(10,2) DEFAULT NULL, + `comision` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`Id_Trabajador`,`año`,`semana`), + CONSTRAINT `comprador_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `analisis_ventas_reino_evolution` +-- Table structure for table `compradores_evolution` -- -DROP TABLE IF EXISTS `analisis_ventas_reino_evolution`; +DROP TABLE IF EXISTS `compradores_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_reino_evolution` ( - `semana` int(11) NOT NULL, - `reino` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `reino` (`reino`,`periodo`), - KEY `periodo` (`periodo`) +CREATE TABLE `compradores_evolution` ( + `Id_Trabajador` int(11) NOT NULL, + `fecha` date NOT NULL, + `importe` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`Id_Trabajador`,`fecha`), + CONSTRAINT `evo_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `analisis_ventas_simple` +-- Table structure for table `defaulter` -- -DROP TABLE IF EXISTS `analisis_ventas_simple`; -/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `analisis_ventas_simple` AS SELECT - 1 AS `Año`, - 1 AS `Semana`, - 1 AS `Importe`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `analisis_ventas_vendedor_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_vendedor_evolution`; +DROP TABLE IF EXISTS `defaulter`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_vendedor_evolution` ( - `semana` int(11) NOT NULL, - `vendedor` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `vendedor` (`vendedor`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_vista_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_vista_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_vista_evolution` ( - `semana` int(11) NOT NULL, - `vista` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `vista` (`vista`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `calidad_detalle` --- - -DROP TABLE IF EXISTS `calidad_detalle`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calidad_detalle` ( - `Id_Cliente` int(11) NOT NULL, - `calidad_parametros_id` int(2) NOT NULL, - `valor` int(3) DEFAULT NULL, - PRIMARY KEY (`Id_Cliente`,`calidad_parametros_id`), - KEY `calidad_parametros_detalle_idx` (`calidad_parametros_id`), - CONSTRAINT `calidad_parametros_detalle` FOREIGN KEY (`calidad_parametros_id`) REFERENCES `calidad_parametros` (`calidad_parametros_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `calidad_parametros` --- - -DROP TABLE IF EXISTS `calidad_parametros`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calidad_parametros` ( - `calidad_parametros_id` int(2) NOT NULL, - `descripcion` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`calidad_parametros_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `claims_ratio` --- - -DROP TABLE IF EXISTS `claims_ratio`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `claims_ratio` ( - `Id_Cliente` int(11) NOT NULL DEFAULT '0', - `Consumo` decimal(10,2) DEFAULT NULL, - `Reclamaciones` decimal(10,2) DEFAULT NULL, - `Ratio` decimal(5,2) DEFAULT NULL, - `recobro` decimal(5,2) DEFAULT NULL, - `inflacion` decimal(5,2) NOT NULL DEFAULT '1.00', - PRIMARY KEY (`Id_Cliente`), - CONSTRAINT `claims_ratio_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `customerDebtInventory` --- - -DROP TABLE IF EXISTS `customerDebtInventory`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `customerDebtInventory` ( - `Id_Cliente` int(11) NOT NULL, - `Debt` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'CREATE TABLE bi.customerDebtInventory\n\nSELECT Id_Cliente, sum(Euros) as Debt\n\nFROM \n(\nSELECT Id_Cliente, Entregado as Euros\n\nFROM Recibos \n\nWHERE Fechacobro < ''2017-01-01\n''\nUNION ALL\n\nSELECT Id_Cliente, - Importe \nFROM Facturas\nWHERE Fecha < ''2017-01-01''\n) sub \nGROUP BY Id_Cliente', - PRIMARY KEY (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `customerRiskOverdue` --- - -DROP TABLE IF EXISTS `customerRiskOverdue`; -/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `customerRiskOverdue` AS SELECT - 1 AS `customer_id`, - 1 AS `amount`, - 1 AS `company_id`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `customer_risk` --- - -DROP TABLE IF EXISTS `customer_risk`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `customer_risk` ( - `customer_id` int(11) NOT NULL DEFAULT '0', - `company_id` smallint(6) unsigned NOT NULL DEFAULT '0', - `amount` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`customer_id`,`company_id`), - KEY `company_id` (`company_id`), - CONSTRAINT `customer_risk_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `customer_risk_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `defaulters` --- - -DROP TABLE IF EXISTS `defaulters`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `defaulters` ( - `client` int(11) NOT NULL, - `date` date NOT NULL, +CREATE TABLE `defaulter` ( + `clientFk` int(11) NOT NULL, + `created` date NOT NULL, `amount` double NOT NULL DEFAULT '0', - `defaulterSince` date DEFAULT NULL, + `defaulterSinced` date DEFAULT NULL, `hasChanged` tinyint(1) DEFAULT NULL, `frozened` date DEFAULT NULL, - PRIMARY KEY (`client`,`date`), - KEY `client` (`client`), - KEY `date` (`date`) + PRIMARY KEY (`clientFk`,`created`), + KEY `client` (`clientFk`), + KEY `date` (`created`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `defaulting` +-- Table structure for table `experienceIberflora2016` -- -DROP TABLE IF EXISTS `defaulting`; +DROP TABLE IF EXISTS `experienceIberflora2016`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `defaulting` ( - `date` date NOT NULL, - `amount` double NOT NULL, - PRIMARY KEY (`date`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `f_tvc` --- - -DROP TABLE IF EXISTS `f_tvc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `f_tvc` ( - `Id_Ticket` int(11) NOT NULL, - PRIMARY KEY (`Id_Ticket`), - CONSTRAINT `id_ticket_to_comisionantes` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacenamos la lista de tickets para agilizar la consulta. Corresponde a los clientes REAL y en los almacenes COMISIONANTES'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `facturacion_media_anual` --- - -DROP TABLE IF EXISTS `facturacion_media_anual`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `facturacion_media_anual` ( +CREATE TABLE `experienceIberflora2016` ( `Id_Cliente` int(11) NOT NULL, - `Consumo` double(17,0) DEFAULT NULL, - PRIMARY KEY (`Id_Cliente`), - CONSTRAINT `fmaId_Cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `lastaction` --- - -DROP TABLE IF EXISTS `lastaction`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `lastaction` ( - `Id_Cliente` int(11) unsigned NOT NULL, - `Cliente` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `Ultima_accion` date DEFAULT NULL, - `Comercial` varchar(3) CHARACTER SET utf8 DEFAULT NULL, + `isVisitor` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`Id_Cliente`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de clientes que participan en el estudio sobre la mejora del consumo tras la visita a las instalaciones de Silla'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fondo_maniobra` +-- + +DROP TABLE IF EXISTS `fondo_maniobra`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fondo_maniobra` ( + `fecha` date NOT NULL, + `fondo` double DEFAULT NULL, + `clientes_facturas` double DEFAULT NULL, + `clientes_cobros` double DEFAULT NULL, + `proveedores_facturas` double DEFAULT NULL, + `proveedores_pagos` double DEFAULT NULL, + `fondo_medio` double DEFAULT NULL, + PRIMARY KEY (`fecha`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `live_counter` +-- Table structure for table `indicators` -- -DROP TABLE IF EXISTS `live_counter`; +DROP TABLE IF EXISTS `indicators`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `live_counter` ( - `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `amount` double NOT NULL, - PRIMARY KEY (`odbc_date`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE `indicators` ( + `updated` date NOT NULL, + `lastYearSales` int(11) DEFAULT NULL, + `totalGreuge` int(11) DEFAULT NULL, + `latePaymentRate` decimal(5,4) DEFAULT NULL, + `countEmployee` decimal(10,2) DEFAULT NULL, + `averageMana` int(11) DEFAULT NULL, + `bankingPool` int(11) DEFAULT NULL, + `lastMonthActiveClients` int(11) DEFAULT NULL, + `lastMonthLostClients` int(11) DEFAULT NULL, + `lastMonthNewClients` int(11) DEFAULT NULL, + `lastMonthWebBuyingRate` decimal(5,4) DEFAULT NULL, + `productionHours` decimal(10,1) DEFAULT NULL, + `dailyWorkersCost` decimal(10,0) DEFAULT NULL, + `volumeM3` decimal(10,0) DEFAULT NULL, + `salesValue` decimal(10,0) DEFAULT NULL, + `valueM3` decimal(10,0) DEFAULT NULL, + `hoursM3` decimal(5,2) DEFAULT NULL, + `workerCostM3` decimal(10,1) DEFAULT NULL, + `salesWorkersCostRate` decimal(10,2) DEFAULT NULL, + `thisWeekSales` decimal(10,2) DEFAULT NULL, + `lastYearWeekSales` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`updated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores actuales para una consulta diaria rápida por los directivos.'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `partitioning_information` +-- Temporary table structure for view `lastIndicators` -- -DROP TABLE IF EXISTS `partitioning_information`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `partitioning_information` ( - `schema_name` varchar(10) CHARACTER SET utf8 NOT NULL, - `table_name` varchar(20) CHARACTER SET utf8 NOT NULL, - `date_field` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `table_depending` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `execution_order` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`schema_name`,`table_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `primer_pedido` --- - -DROP TABLE IF EXISTS `primer_pedido`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `primer_pedido` ( - `Id_Cliente` int(11) NOT NULL, - `Id_Ticket` int(11) NOT NULL, - `month` tinyint(1) NOT NULL, - `year` smallint(2) NOT NULL, - `total` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `rotacion` --- - -DROP TABLE IF EXISTS `rotacion`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rotacion` ( - `Id_Article` int(11) NOT NULL, - `warehouse_id` smallint(6) unsigned NOT NULL, - `total` int(10) NOT NULL DEFAULT '0', - `rotacion` decimal(10,4) NOT NULL DEFAULT '0.0000', - `cm3` int(11) NOT NULL DEFAULT '0', - `almacenaje` decimal(10,4) NOT NULL DEFAULT '0.0000', - `manipulacion` decimal(10,4) NOT NULL DEFAULT '0.0000', - `auxiliar` decimal(10,4) NOT NULL DEFAULT '0.0000', - `mermas` decimal(10,4) NOT NULL DEFAULT '0.0000', - `cm3reparto` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`Id_Article`,`warehouse_id`), - KEY `warehouse_id_rotacion_idx` (`warehouse_id`), - CONSTRAINT `id_article_rotaci` FOREIGN KEY (`Id_Article`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `warehouse_id_rotaci` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de rotacion en los ultimos 365 dias'; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `bi`.`rotacion_beforeInsert` - BEFORE INSERT ON `rotacion` - FOR EACH ROW -BEGIN - IF NEW.Id_Article IN (95, 98) THEN - SET NEW.cm3 = 0; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `bi`.`rotacion_beforeUpdate` - BEFORE UPDATE ON `rotacion` - FOR EACH ROW -BEGIN - IF NEW.Id_Article IN (95, 98) THEN - SET NEW.cm3 = 0; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Table structure for table `rutasBoard` --- - -DROP TABLE IF EXISTS `rutasBoard`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rutasBoard` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `Id_Ruta` int(10) unsigned NOT NULL DEFAULT '0', - `Id_Agencia` int(11) NOT NULL DEFAULT '0', - `km` bigint(10) NOT NULL DEFAULT '0', - `Dia` varchar(9) CHARACTER SET utf8 DEFAULT NULL, - `Fecha` date NOT NULL, - `Terceros` int(11) NOT NULL DEFAULT '0', - `Bultos` int(11) NOT NULL DEFAULT '0', - `Matricula` varchar(10) COLLATE utf8_unicode_ci, - `Tipo` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '', - `year` int(4) NOT NULL, - `month` int(2) NOT NULL, - `warehouse_id` smallint(5) unsigned NOT NULL COMMENT 'A nulo si se puede enrutar desde todos los almacenes', - `coste_bulto` decimal(10,2) unsigned NOT NULL DEFAULT '0.00', - `teorico` decimal(10,2) NOT NULL DEFAULT '0.00', - `practico` decimal(10,2) NOT NULL DEFAULT '0.00', - `greuge` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`id`), - UNIQUE KEY `rutasBoard_Ruta` (`Id_Ruta`), - KEY `rutasBoard_ix1` (`year`), - KEY `rutasBoard_ix2` (`month`), - KEY `rutasBoard_ix3` (`warehouse_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `saleVolume` --- - -DROP TABLE IF EXISTS `saleVolume`; -/*!50001 DROP VIEW IF EXISTS `saleVolume`*/; +DROP TABLE IF EXISTS `lastIndicators`; +/*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `saleVolume` AS SELECT - 1 AS `saleFk`, - 1 AS `m3`*/; +/*!50001 CREATE VIEW `lastIndicators` AS SELECT + 1 AS `updated`, + 1 AS `lastYearSales`, + 1 AS `incLastYearSales`, + 1 AS `totalGreuge`, + 1 AS `incTotalGreuge`, + 1 AS `latePaymentRate`, + 1 AS `incLatePaymentRate`, + 1 AS `countEmployee`, + 1 AS `incCountEmployee`, + 1 AS `averageMana`, + 1 AS `incAverageMana`, + 1 AS `bankingPool`, + 1 AS `incbankingPool`, + 1 AS `lastMonthActiveClients`, + 1 AS `incLastMonthActiveClients`, + 1 AS `lastMonthLostClients`, + 1 AS `incLastMonthLostClients`, + 1 AS `lastMonthNewClients`, + 1 AS `incLastMonthNewClients`, + 1 AS `lastMonthWebBuyingRate`, + 1 AS `incLastMonthWebBuyingRate`, + 1 AS `productionHours`, + 1 AS `dailyWorkersCost`, + 1 AS `volumeM3`, + 1 AS `salesValue`, + 1 AS `valueM3`, + 1 AS `hoursM3`, + 1 AS `workerCostM3`, + 1 AS `salesWorkersCostRate`, + 1 AS `thisWeekSales`, + 1 AS `lastYearWeekSales`*/; SET character_set_client = @saved_cs_client; -- --- Table structure for table `tarifa_componentes` +-- Table structure for table `m3` -- -DROP TABLE IF EXISTS `tarifa_componentes`; +DROP TABLE IF EXISTS `m3`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_componentes` ( - `Id_Componente` int(11) NOT NULL AUTO_INCREMENT, - `Componente` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `tarifa_componentes_series_id` int(11) NOT NULL, - `tarifa_class` smallint(6) DEFAULT NULL, - `tax` double DEFAULT NULL, - `is_renewable` tinyint(2) NOT NULL DEFAULT '1', - `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`Id_Componente`), - KEY `series_componentes_idx` (`tarifa_componentes_series_id`), - KEY `comp` (`tarifa_class`), - CONSTRAINT `serie_componente` FOREIGN KEY (`tarifa_componentes_series_id`) REFERENCES `tarifa_componentes_series` (`tarifa_componentes_series_id`) ON UPDATE CASCADE +CREATE TABLE `m3` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `fecha` date NOT NULL, + `provinceFk` smallint(5) unsigned DEFAULT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '0', + `m3` decimal(10,2) DEFAULT NULL, + `year` int(11) DEFAULT NULL, + `month` int(11) DEFAULT NULL, + `week` int(11) DEFAULT NULL, + `day` int(11) DEFAULT NULL, + `dayName` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, + `euros` decimal(10,2) DEFAULT '0.00', + PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tarifa_componentes_series` +-- Temporary table structure for view `m3Silla` -- -DROP TABLE IF EXISTS `tarifa_componentes_series`; +DROP TABLE IF EXISTS `m3Silla`; +/*!50001 DROP VIEW IF EXISTS `m3Silla`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `m3Silla` AS SELECT + 1 AS `fecha`, + 1 AS `year`, + 1 AS `month`, + 1 AS `week`, + 1 AS `day`, + 1 AS `dayName`, + 1 AS `Volumen`, + 1 AS `Euros`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `m3analisis` +-- + +DROP TABLE IF EXISTS `m3analisis`; +/*!50001 DROP VIEW IF EXISTS `m3analisis`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `m3analisis` AS SELECT + 1 AS `fecha`, + 1 AS `year`, + 1 AS `month`, + 1 AS `week`, + 1 AS `day`, + 1 AS `dayName`, + 1 AS `Volumen`, + 1 AS `Euros`, + 1 AS `Departamento`, + 1 AS `Horas`, + 1 AS `Salarios`, + 1 AS `tiempoM3`, + 1 AS `valorM3`, + 1 AS `costeLaboralM3`, + 1 AS `costeEuros`, + 1 AS `precioHora`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `manaCustomer` +-- + +DROP TABLE IF EXISTS `manaCustomer`; +/*!50001 DROP VIEW IF EXISTS `manaCustomer`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `manaCustomer` AS SELECT + 1 AS `Id_Cliente`, + 1 AS `Mana`, + 1 AS `dated`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `manaSpellersExcluded` +-- + +DROP TABLE IF EXISTS `manaSpellersExcluded`; +/*!50001 DROP VIEW IF EXISTS `manaSpellersExcluded`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `manaSpellersExcluded` AS SELECT + 1 AS `workerFk`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `mana_spellers` +-- + +DROP TABLE IF EXISTS `mana_spellers`; +/*!50001 DROP VIEW IF EXISTS `mana_spellers`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `mana_spellers` AS SELECT + 1 AS `Id_Trabajador`, + 1 AS `size`, + 1 AS `used`, + 1 AS `prices_modifier_rate`, + 1 AS `prices_modifier_activated`, + 1 AS `minRate`, + 1 AS `maxRate`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `mana_spellers_excluded` +-- + +DROP TABLE IF EXISTS `mana_spellers_excluded`; +/*!50001 DROP VIEW IF EXISTS `mana_spellers_excluded`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `mana_spellers_excluded` AS SELECT + 1 AS `Id_Trabajador`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `mermas` +-- + +DROP TABLE IF EXISTS `mermas`; +/*!50001 DROP VIEW IF EXISTS `mermas`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `mermas` AS SELECT + 1 AS `Comprador`, + 1 AS `Familia`, + 1 AS `Referencia`, + 1 AS `Item`, + 1 AS `Cantidad`, + 1 AS `Coste_Unitario`, + 1 AS `Importe`, + 1 AS `Cliente`, + 1 AS `ticketFk`, + 1 AS `Fecha`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `mermasCache__` +-- + +DROP TABLE IF EXISTS `mermasCache__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_componentes_series` ( - `tarifa_componentes_series_id` int(11) NOT NULL AUTO_INCREMENT, - `Serie` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `base` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', - `margen` tinyint(4) NOT NULL DEFAULT '0', - PRIMARY KEY (`tarifa_componentes_series_id`), - UNIQUE KEY `Serie_UNIQUE` (`Serie`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; +CREATE TABLE `mermasCache__` ( + `Comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `año` int(4) NOT NULL, + `Valor_Compra` decimal(10,0) DEFAULT NULL, + `Faltas` decimal(10,0) DEFAULT NULL, + `Basura` decimal(10,0) DEFAULT NULL, + PRIMARY KEY (`Comprador`,`año`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tarifa_premisas` +-- Table structure for table `nightTask` -- -DROP TABLE IF EXISTS `tarifa_premisas`; +DROP TABLE IF EXISTS `nightTask`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_premisas` ( - `Id_Premisa` int(11) NOT NULL AUTO_INCREMENT, - `premisa` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`Id_Premisa`) +CREATE TABLE `nightTask` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `started` datetime DEFAULT NULL, + `finished` datetime DEFAULT NULL, + `lastFinished` datetime DEFAULT NULL, + `order` int(11) DEFAULT NULL, + `schema` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `procedure` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `errorCode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `tarifa_warehouse` --- - -DROP TABLE IF EXISTS `tarifa_warehouse`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_warehouse` ( - `Id_Tarifa_Warehouse` int(11) NOT NULL AUTO_INCREMENT, - `warehouse_id` int(11) NOT NULL, - `Id_Premisa` int(11) NOT NULL, - `Valor` double NOT NULL, - PRIMARY KEY (`Id_Tarifa_Warehouse`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de gasto por almacen'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping events for database 'bi' --- - --- --- Dumping routines for database 'bi' --- -/*!50003 DROP FUNCTION IF EXISTS `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `nz`(dblCANTIDAD DOUBLE) RETURNS double -BEGIN - -DECLARE dblRESULT DOUBLE; - -SET dblRESULT = IFNULL(dblCANTIDAD,0); - -RETURN dblRESULT; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `analisis_ventas_evolution_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -2574,318 +2268,21 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_evolution_add`() +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeInsert` BEFORE INSERT ON `nightTask` FOR EACH ROW BEGIN - DECLARE vPreviousPeriod INT; - DECLARE vCurrentPeriod INT; - DECLARE vLastPeriod INT; - DECLARE vMinPeriod INT DEFAULT 201400; - DECLARE vMaxPeriod INT DEFAULT vn2008.vnperiod(CURDATE()); - DECLARE vYear INT; - DECLARE vWeek INT; + IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN - -- Almacen - - SET vCurrentPeriod = IFNULL(vLastPeriod, vMinPeriod); - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(Periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_almacen_evolution - WHERE Periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_almacen_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_almacen_evolution(Almacen, Ventas, Semana,Año, Periodo) - SELECT Almacen, sum(Ventas) AS Ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT almacen, sum(Importe) AS Ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY almacen - UNION ALL - SELECT almacen, - sum(Importe) AS Ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY almacen - UNION ALL - SELECT Almacen, Ventas - FROM bi.analisis_ventas_almacen_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Almacen; - END WHILE; - - -- Reino - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_reino_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_reino_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_reino_evolution(reino, ventas, semana,año, periodo) - SELECT reino, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Reino, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Reino - UNION ALL - SELECT Reino, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Reino - UNION ALL - SELECT reino, ventas - FROM bi.analisis_ventas_reino_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY reino; - END WHILE; - - -- Familia - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_familia_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_familia_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_familia_evolution(familia, ventas, semana,año, periodo) - SELECT Familia, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Familia, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY familia - UNION ALL - SELECT Familia, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY familia - UNION ALL - SELECT familia, ventas - FROM bi.analisis_ventas_familia_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Familia; - END WHILE; - - -- Comprador - -- FIXME: Bucle infinito porque la tabla está vacía -/* - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT IFNULL(MAX(periodo),vMinPeriod) INTO vPreviousPeriod - FROM bi.analisis_ventas_comprador_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_comprador_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_comprador_evolution(comprador, ventas, semana,año, periodo) - SELECT Comprador, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Comprador, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Comprador - UNION ALL - SELECT Comprador, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Comprador - UNION ALL - SELECT comprador, IFNULL(ventas,0) - FROM bi.analisis_ventas_comprador_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Comprador; - END WHILE; -*/ - -- Provincia - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_provincia_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_provincia_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_provincia_evolution(provincia, ventas, semana,año, periodo) - SELECT Provincia, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Provincia, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Provincia - UNION ALL - SELECT Provincia, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Provincia - UNION ALL - SELECT provincia, ventas - FROM bi.analisis_ventas_provincia_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Provincia; - END WHILE; - - -- Vista - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_vista_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_vista_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_vista_evolution(vista, ventas, semana,año, periodo) - SELECT vista, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Vista, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Vista - UNION ALL - SELECT Vista, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Vista - UNION ALL - SELECT vista, ventas - FROM bi.analisis_ventas_vista_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Vista; - END WHILE; - - -- Vendedor - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_vendedor_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); + CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); - DELETE FROM bi.analisis_ventas_vendedor_evolution - WHERE Periodo = vCurrentPeriod; + END IF; - REPLACE bi.analisis_ventas_vendedor_evolution(vendedor, ventas, semana,año, periodo) - SELECT Comercial AS vendedor, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Comercial, sum(Importe) AS ventas - from bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Comercial - UNION ALL - SELECT Comercial, - sum(Importe) AS ventas - from bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Comercial - UNION ALL - SELECT vendedor, ventas - FROM bi.analisis_ventas_vendedor_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY vendedor; - END WHILE; -END ;; +END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `analisis_ventas_simple` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -2895,130 +2292,387 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_simple`() +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeUpdate` BEFORE UPDATE ON `nightTask` FOR EACH ROW BEGIN -TRUNCATE bi.analisis_grafico_simple; + IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN -INSERT INTO bi.analisis_grafico_simple SELECT * FROM bi.analisis_grafico_ventas; + CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); + + END IF; -END ;; +END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `analisis_ventas_update` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; + +-- +-- Table structure for table `nightTaskConfig` +-- + +DROP TABLE IF EXISTS `nightTaskConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nightTaskConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `logMail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `payMethodClient` +-- + +DROP TABLE IF EXISTS `payMethodClient`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payMethodClient` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `payMethodFk` tinyint(3) unsigned NOT NULL DEFAULT '0', + `clientFk` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `FkPayMethod_idx` (`payMethodFk`), + KEY `FkClientPayMethod_idx` (`clientFk`), + KEY `FkDateClientPayMethod` (`dated`,`clientFk`), + CONSTRAINT `FkClientPayMethod` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FkPayMethodClient` FOREIGN KEY (`payMethodFk`) REFERENCES `vn`.`payMethod` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `payMethodClientEvolution` +-- + +DROP TABLE IF EXISTS `payMethodClientEvolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payMethodClientEvolution` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `payMethodName` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `amountClient` int(11) NOT NULL, + `amount` decimal(10,2) NOT NULL, + `equalizationTax` decimal(10,2) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `productivity` +-- + +DROP TABLE IF EXISTS `productivity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `productivity` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `hh` int(10) unsigned NOT NULL, + `mm` int(10) unsigned NOT NULL, + `m3` double NOT NULL DEFAULT '0', + `workers` int(11) NOT NULL DEFAULT '0', + `wCost` double NOT NULL DEFAULT '0', + `numCoordinadores` int(11) NOT NULL DEFAULT '0', + `costCoordinacion` double NOT NULL DEFAULT '0', + `numSacadores` int(11) NOT NULL DEFAULT '0', + `costSacado` double NOT NULL DEFAULT '0', + `numEncajadores` int(11) NOT NULL DEFAULT '0', + `costEncajado` double NOT NULL DEFAULT '0', + `numPaletizadores` int(11) NOT NULL DEFAULT '0', + `costPaletizado` double NOT NULL DEFAULT '0', + `numCamareros` int(11) NOT NULL DEFAULT '0', + `costCamara` double NOT NULL DEFAULT '0', + `numComplementos` int(11) NOT NULL DEFAULT '0', + `costComplementos` double NOT NULL DEFAULT '0', + `numArtificial` int(11) NOT NULL DEFAULT '0', + `costArtificial` double NOT NULL DEFAULT '0', + `m3FV` double NOT NULL DEFAULT '0', + `m3PCA` double NOT NULL DEFAULT '0', + `m3Artificial` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `productivityDepartment` +-- + +DROP TABLE IF EXISTS `productivityDepartment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `productivityDepartment` ( + `dated` date NOT NULL, + `amountCoordinacion` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountSacado` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountEncajado` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountPaletizado` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountCamara` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountComplementos` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountArtificial` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `productivity_evolution` +-- + +DROP TABLE IF EXISTS `productivity_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `productivity_evolution` ( + `dated` date NOT NULL, + `m3productionCost` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `salaries2018` +-- + +DROP TABLE IF EXISTS `salaries2018`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `salaries2018` ( + `person_id` int(11) NOT NULL DEFAULT '0', + `sex` enum('M','F') CHARACTER SET utf8 NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', + `edad` int(6) DEFAULT NULL, + `antiguedad` int(6) DEFAULT NULL, + `Modalidad` varchar(22) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', + `reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `worker` varchar(82) CHARACTER SET utf8 DEFAULT NULL, + `totalDays` decimal(32,0) DEFAULT NULL, + `totalAnual` decimal(16,0) DEFAULT NULL, + `virtualMonthlySalary` decimal(16,0) DEFAULT NULL, + `departamento` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `category_name` varchar(50) CHARACTER SET utf8 NOT NULL, + `level_name` varchar(5) CHARACTER SET utf8 DEFAULT NULL, + `thisYearDateStart` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL, + PRIMARY KEY (`person_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `salePersonEvolution` +-- + +DROP TABLE IF EXISTS `salePersonEvolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `salePersonEvolution` ( + `dated` date NOT NULL DEFAULT '0000-00-00', + `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `equalizationTax` decimal(10,2) NOT NULL DEFAULT '0.00', + `salesPersonFk` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`dated`,`salesPersonFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `salesByWeek` +-- + +DROP TABLE IF EXISTS `salesByWeek`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `salesByWeek` ( + `week` int(11) NOT NULL, + `year` int(11) NOT NULL, + `sales` double DEFAULT NULL, + UNIQUE KEY `week` (`week`,`year`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vendedores` +-- + +DROP TABLE IF EXISTS `vendedores`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vendedores` ( + `Id_Trabajador` int(11) NOT NULL, + `año` int(4) NOT NULL, + `mes` int(2) NOT NULL, + `importe` decimal(10,2) DEFAULT NULL, + `comision` decimal(10,2) DEFAULT NULL, + `comisionArrendada` decimal(10,2) DEFAULT NULL COMMENT 'comision proveniente de clientes que han sido donados. Ver tabla Clientes_cedidos', + `comisionCedida` decimal(10,2) DEFAULT NULL COMMENT 'comision generada por los clientes que han sido donados. Ver tabla Clientes_cedidos', + `comisionNuevos` decimal(10,2) DEFAULT NULL, + `sustitucionArrendada` decimal(10,2) DEFAULT NULL, + `itemTypeBorrowed` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`Id_Trabajador`,`año`,`mes`), + CONSTRAINT `trabajador_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vendedores_evolution` +-- + +DROP TABLE IF EXISTS `vendedores_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vendedores_evolution` ( + `workerFk` int(11) NOT NULL, + `year` int(11) NOT NULL, + `sales` decimal(10,2) DEFAULT NULL, + `month` int(11) NOT NULL, + PRIMARY KEY (`workerFk`,`year`,`month`), + CONSTRAINT `evo_vendedor_trabajador` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ventas` +-- + +DROP TABLE IF EXISTS `ventas`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ventas` ( + `Id_Movimiento` int(11) NOT NULL, + `importe` decimal(10,3) NOT NULL DEFAULT '0.000', + `recargo` decimal(10,3) NOT NULL DEFAULT '0.000', + `fecha` date NOT NULL, + `tipo_id` smallint(5) unsigned NOT NULL, + `Id_Cliente` int(11) NOT NULL DEFAULT '1', + `empresa_id` smallint(5) unsigned NOT NULL DEFAULT '442', + PRIMARY KEY (`Id_Movimiento`), + KEY `tip_to_tip_idx` (`tipo_id`), + KEY `clientes_bs_ventas_idx` (`Id_Cliente`), + KEY `empresa_bs_ventas_idx` (`empresa_id`), + KEY `fecha_bs` (`fecha`), + CONSTRAINT `clientes_bs_ventas` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `empresa_bs_ventas` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `mov_to_mov` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tip_to_tip` FOREIGN KEY (`tipo_id`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ventas_contables` +-- + +DROP TABLE IF EXISTS `ventas_contables`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ventas_contables` ( + `year` int(4) NOT NULL, + `month` int(2) NOT NULL, + `venta` decimal(10,2) DEFAULT NULL, + `grupo` int(1) NOT NULL, + `reino_id` int(10) unsigned NOT NULL, + `tipo_id` smallint(5) unsigned NOT NULL, + `empresa_id` int(4) NOT NULL, + `gasto` varchar(10) CHARACTER SET latin1 NOT NULL, + PRIMARY KEY (`year`,`month`,`grupo`,`reino_id`,`tipo_id`,`empresa_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `warehouseProduction_kk` +-- + +DROP TABLE IF EXISTS `warehouseProduction_kk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `warehouseProduction_kk` ( + `fecha` date NOT NULL, + `warehouse_id` smallint(6) unsigned NOT NULL, + `m3` decimal(10,0) NOT NULL DEFAULT '0', + `labourCost` decimal(10,0) NOT NULL DEFAULT '0', + `workerHours` decimal(10,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`fecha`,`warehouse_id`), + KEY `warehouseProduction_fk1_idx` (`warehouse_id`), + CONSTRAINT `warehouseProduction_fk1` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `waste` +-- + +DROP TABLE IF EXISTS `waste`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `waste` ( + `buyer` varchar(30) CHARACTER SET utf8 NOT NULL, + `year` int(4) NOT NULL, + `week` int(2) NOT NULL, + `family` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `saleTotal` decimal(16,0) DEFAULT NULL, + `saleWaste` decimal(16,0) DEFAULT NULL, + `rate` decimal(3,1) DEFAULT NULL, + PRIMARY KEY (`buyer`,`year`,`week`,`family`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `workerMana` +-- + +DROP TABLE IF EXISTS `workerMana`; +/*!50001 DROP VIEW IF EXISTS `workerMana`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `workerMana` AS SELECT + 1 AS `workerFk`, + 1 AS `amount`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workerSpeed` +-- + +DROP TABLE IF EXISTS `workerSpeed`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerSpeed` ( + `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', + `LitrosMinuto` decimal(10,1) DEFAULT NULL, + `LitrosMinutoLastHour` decimal(10,1) DEFAULT NULL, + `lastUpdated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`workerCode`,`warehouseFk`,`accion`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'bs' +-- +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +/*!50106 DROP EVENT IF EXISTS `nightTask_launchAll` */; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_update`() -BEGIN - DECLARE vLastMonth DATE; - - SET vLastMonth = util.firstDayOfMonth(TIMESTAMPADD(MONTH, -1, CURDATE())); - - DELETE FROM analisis_ventas - WHERE Año > YEAR(vLastMonth) - OR (Año = YEAR(vLastMonth) AND Mes >= MONTH(vLastMonth)); - - INSERT INTO analisis_ventas ( - Familia, - Reino, - Comercial, - Comprador, - Provincia, - almacen, - Año, - Mes, - Semana, - Vista, - Importe - ) - SELECT - tp.Tipo AS Familia, - r.reino AS Reino, - tr.CodigoTrabajador AS Comercial, - tr2.CodigoTrabajador AS Comprador, - p.name AS Provincia, - w.name AS almacen, - tm.year AS Año, - tm.month AS Mes, - tm.week AS Semana, - v.vista AS Vista, - bt.importe AS Importe - FROM bs.ventas bt - LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - LEFT JOIN vn2008.Clientes c on c.Id_Cliente = bt.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = c.Id_Trabajador - LEFT JOIN vn2008.Trabajadores tr2 ON tr2.Id_Trabajador = tp.Id_Trabajador - JOIN vn2008.time tm ON tm.date = bt.fecha - JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento - LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - LEFT JOIN vn2008.Vistas v ON v.vista_id = a.Vista - LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna - LEFT JOIN vn2008.province p ON p.province_id = cs.province_id - LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id - WHERE bt.fecha >= vLastMonth AND r.mercancia; -END ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2017-08-27 02:00:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `call_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `call_add`() -BEGIN - DECLARE datSTART DATETIME DEFAULT '2012-03-01'/*CURDATE()*/ ; - - -- Seleccionamos la ultima fecha introducida - SELECT MAX(Fecha) INTO datSTART FROM `call`; - - -- Borramos todas las entradas del dia datSTART por si hubiese registros nuevos - DELETE FROM `call` WHERE Fecha = datSTART; - - INSERT INTO bi.`call`(CodTrabajadorCartera,CodTrabajadorTelefono,dur_in,dur_out,Fecha,`year`,`month`,`week`,`hour`,phone) - SELECT vn2008.Averiguar_ComercialCliente(pb.Id_Cliente,Fecha) CodTrabajadorCartera,ll.CodigoTrabajador, dur_in, - dur_out, ll.Fecha,YEAR(ll.Fecha) `year`, MONTH(ll.Fecha) `month`,WEEK(ll.Fecha,7) `week`, Hora,phone - FROM ( - SELECT Id_Trabajador,CodigoTrabajador, IFNULL(billsec,0) dur_in, 0 dur_out, 1 as Recibidas, NULL as Emitidas, calldate as Fecha, - hour(calldate) as Hora,src as phone - FROM vn2008.Trabajadores T - JOIN vn2008.cdr C ON C.dstchannel LIKE CONCAT('%', T.extension, '%') - WHERE calldate >= datSTART AND LENGTH(C.src) >=9 AND disposition = 'ANSWERED' AND duration - UNION ALL - SELECT Id_Trabajador,CodigoTrabajador,0 dur_in, IFNULL(billsec,0) dur_out, NULL as Recibidas, 1 as Emitidas, date(calldate), hour(calldate),dst - FROM vn2008.Trabajadores T - JOIN vn2008.cdr C ON C.src = T.extension - WHERE calldate >= datSTART AND LENGTH(C.dst) >=9 AND disposition = 'ANSWERED' AND duration - ) ll - JOIN vn2008.Permisos USING(Id_Trabajador) - LEFT JOIN vn2008.v_phonebook pb ON pb.Telefono = ll.phone - WHERE Id_Grupo = 6; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `claim_ratio_routine` */; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + +-- +-- Dumping routines for database 'bs' +-- +/*!50003 DROP FUNCTION IF EXISTS `tramo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -3028,247 +2682,319 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `claim_ratio_routine`() -BEGIN - DECLARE vMonthToRefund INT DEFAULT 4; - - /* - * PAK 2015-11-20 - * Se trata de añadir a la tabla Greuges todos los - * cargos que luego vamos a utilizar para calcular el recobro - */ - - -- descuentos comerciales COD 11 - - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, Importe, Id_Ticket) - SELECT Fecha, Id_Cliente, Concat('COD11 : ',Concepte), - round(Cantidad * - Preu * (100 - Descuento) / 100 ,2) AS Importe, t.Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket - WHERE Id_Article = 11 - AND Concepte NOT LIKE '$%' - AND Fecha > '2014-01-01' - HAVING nz(Importe) <> 0; - - DELETE mc.* - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE m.Id_Article = 11 - AND m.Concepte NOT LIKE '$%' - AND t.Fecha > '2017-01-01'; - - INSERT INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) - SELECT m.Id_Movimiento, 34, round(m.Preu * (100 - m.Descuento)/100,4) - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE m.Id_Article = 11 - AND m.Concepte NOT LIKE '$%' - AND t.Fecha > '2017-01-01'; - - UPDATE vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - SET Concepte = CONCAT('$ ',Concepte) - WHERE Id_Article = 11 - AND Concepte NOT LIKE '$%' - AND Fecha > '2014-01-01'; - - -- Reclamaciones demasiado sensibles - - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe, Greuges_type_id,Id_Ticket) - SELECT cm.Fecha - , cm.Id_Cliente - , concat('Claim ',cm.id,' : ', m.Concepte) - ,round( -1 * ((sensib -1)/4) * Cantidad * - Preu * (100 - Descuento) / 100, 2) AS Reclamaciones - , 4 - , m.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca USING(Id_Movimiento) - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3; - - -- Reclamaciones que pasan a Maná - - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe , Greuges_type_id,Id_Ticket) - SELECT cm.Fecha - , cm.Id_Cliente - , concat('Claim_mana ',cm.id,' : ', m.Concepte) - ,round( ((sensib -1)/4) * Cantidad * Preu * (100 - Descuento) / 100, 2) - AS Reclamaciones - ,3 - ,m.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca USING(Id_Movimiento) - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3 - AND cm.mana; - - -- Marcamos para no repetir - UPDATE vn2008.cl_act ca - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - SET greuge = 1 - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3; - - -- Recobros - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) - SELECT DISTINCT t.Id_Ticket - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Tickets_state ts ON ts.Id_Ticket = t.Id_Ticket - JOIN vncontrol.inter i ON i.inter_id = ts.inter_id - JOIN vn2008.state s ON s.id = i.state_id - WHERE mc.Id_Componente = 17 - AND mc.greuge = 0 - AND t.Fecha >= '2016-10-01' - AND t.Fecha < CURDATE() - AND s.alert_level >= 3; - - DELETE g.* - FROM vn2008.Greuges g - JOIN tmp.ticket_list t ON g.Id_Ticket = t.Id_Ticket - WHERE Greuges_type_id = 2; - - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, - Greuges_type_id, Id_Ticket) - SELECT Id_Cliente - ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) - AS dif - ,date(t.Fecha) - , 2 - ,tt.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket - JOIN vn2008.Movimientos_componentes mc - ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17 - GROUP BY t.Id_Ticket - HAVING ABS(dif) > 1; - - UPDATE vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN tmp.ticket_list tt ON tt.Id_Ticket = m.Id_Ticket - SET greuge = 1 - WHERE Id_Componente = 17; - - /* - * Recalculamos la ratio de las reclamaciones, que luego - * se va a utilizar en el recobro - */ - - REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) - SELECT Id_Cliente, 0,0,0,0 - FROM vn2008.Clientes; - - REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) - SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones, - round(Reclamaciones / (12*fm.Consumo),4) AS Ratio, 0 - FROM bi.facturacion_media_anual fm - LEFT JOIN( - SELECT cm.Id_Cliente, round(sum(-1 * ((sensib -1)/4) * - Cantidad * Preu * (100 - Descuento) / 100)) - AS Reclamaciones - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca - ON ca.Id_Movimiento = m.Id_Movimiento - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND cm.cl_est_id = 3 - AND cm.Fecha >= TIMESTAMPADD(YEAR, -1, CURDATE()) - GROUP BY cm.Id_Cliente - ) claims ON claims.Id_Cliente = fm.Id_Cliente; - - - -- Calculamos el porcentaje del recobro para añadirlo al precio de venta - UPDATE bi.claims_ratio cr - JOIN ( - SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge - FROM vn2008.Greuges - WHERE Fecha <= CURDATE() - GROUP BY Id_Cliente - ) g ON g.Id_Cliente = cr.Id_Cliente - SET recobro = GREATEST(0,round(nz(Greuge) / - (nz(Consumo) * vMonthToRefund / 12 ) ,3)); - - -- Protección neonatos - UPDATE bi.claims_ratio cr - JOIN vn.firstTicketShipped fts ON fts.clientFk = cr.Id_Cliente - SET recobro = 0, Ratio = 0 - WHERE fts.shipped > TIMESTAMPADD(MONTH,-1,CURDATE()); - - -- CLIENTE 7983, JULIAN SUAU - UPDATE bi.claims_ratio SET recobro = LEAST(0.05, recobro) WHERE Id_Cliente = 7983; - - -- CLIENTE 4358 - UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 4358; - - -- CLIENTE 5523, VERDECORA - UPDATE bi.claims_ratio SET recobro = GREATEST(0.12, recobro) WHERE Id_Cliente = 5523; +CREATE DEFINER=`root`@`%` FUNCTION `tramo`(vDateTime DATETIME) RETURNS varchar(20) CHARSET utf8 COLLATE utf8_unicode_ci +BEGIN + + DECLARE vTramo VARCHAR(20); + DECLARE vHour INT; - -- CLIENTE 15979, SERVEIS VETERINARIS - UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 15979; - - -- CLIENTE 5189 i 8942, son de CSR i son el mateix client - UPDATE bi.claims_ratio cr - JOIN (SELECT sum(Consumo * recobro)/sum(Consumo) as recobro - FROM bi.claims_ratio - WHERE Id_Cliente IN ( 5189,8942) - ) sub - SET cr.recobro = sub.recobro - WHERE Id_Cliente IN ( 5189,8942); + SET vHour = HOUR(vDateTime) ; + + SET vTramo = + CASE + WHEN vHour BETWEEN 0 AND 14 THEN 'Mañana' + WHEN vHour BETWEEN 15 AND 24 THEN 'Tarde' + END ; + +RETURN vTramo; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `analisisComponentes` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `analisisComponentes`() +BEGIN + +DECLARE vDateStart DATE DEFAULT '2016-01-01'; +DECLARE vDateEnd DATE DEFAULT '2016-11-30'; +DECLARE vDate DATE; + +SET vDate = vDateStart; + +DELETE FROM bs.ventasComponentes; + +WHILE vDate <= vDateEnd DO + + INSERT INTO bs.ventasComponentes + SELECT vDate as Fecha, mc.Id_Componente, cast(sum(m.Cantidad * mc.Valor) AS DECIMAL(10,2)) as Importe + FROM vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + JOIN bs.ventas v ON v.Id_Movimiento = mc.Id_Movimiento + WHERE v.fecha = vDate + AND empresa_id IN (442,567) + GROUP BY mc.Id_Componente; + + SET vDate = TIMESTAMPADD(DAY,1,vDate); + + IF DAY(vDate) MOD 28 = 0 THEN + + SELECT vDate; + + END IF; + +END WHILE; + + SELECT vDate; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `bancos_evolution_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `bancos_evolution_add`() +BEGIN + /* + + Inserta en la tabla bancos_evolution los saldos acumulados + + */ + + + DECLARE vCurrentDate DATE; + DECLARE vStartingDate DATE DEFAULT '2016-01-01'; + DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, CURDATE()); + + DELETE FROM bs.bancos_evolution WHERE Fecha > vStartingDate; + + SET vCurrentDate = vStartingDate; + + WHILE vCurrentDate < vMaxDate DO + + REPLACE bs.bancos_evolution( Fecha + ,Id_Banco + ,saldo) + + SELECT vCurrentDate + , Id_Banco + , sum(saldo) + + FROM + ( + + SELECT Id_Banco + ,saldo_aux as saldo + FROM bs.bancos_evolution + + WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate) -- los saldos acumulados del dia anterior + + UNION ALL + + SELECT c.Id_Banco, IFNULL(sum(Entrada),0) - ifnull(sum(Salida),0) as saldo + FROM vn2008.Cajas c + JOIN vn2008.Bancos b using(Id_Banco) -- saldos de las cajas + WHERE cash IN (0,3) + AND Cajafecha = vCurrentDate + AND (Serie = 'MB' OR cash = 3) + GROUP BY Id_Banco + + UNION ALL + + SELECT id_banco, - importe -- pagos futuros + FROM vn2008.pago + WHERE fecha = vCurrentDate + AND fecha >= CURDATE() + AND NOT conciliado + + UNION ALL + + SELECT Id_Banco, Entregado -- cobros futuros + FROM vn2008.Recibos + WHERE Fechacobro = vCurrentDate + AND Fechacobro > CURDATE() + + UNION ALL + + SELECT sp.Id_Banco, Importe -- saldos de la tabla prevision + FROM vn2008.Saldos_Prevision sp + JOIN vn2008.Bancos b using(Id_Banco) + WHERE cash IN (0,3) + AND Fecha = vCurrentDate + + + + )sub + GROUP BY Id_Banco; + + -- Utilizamos el saldo_auxiliar para calcular lo dispuesto en las polizas + + UPDATE bs.bancos_evolution be + SET saldo_aux = saldo; + + -- Ahora actualizamos la quilla + UPDATE bs.bancos_evolution be + LEFT JOIN + ( + SELECT Id_Banco, - sum(importe) as quilla + FROM vn2008.Bancos_poliza + WHERE vCurrentDate between apertura AND IFNULL(cierre, vCurrentDate) + GROUP BY Id_Banco + ) sub using(Id_Banco) + SET be.quilla = sub.quilla + WHERE be.Fecha = vCurrentDate; + + + SET vCurrentDate = TIMESTAMPADD(DAY,1,vCurrentDate); + + END WHILE; + + + -- Deuda + UPDATE bs.bancos_evolution be + JOIN vn2008.Bancos using(Id_Banco) + SET be.deuda = IF(cash = 3, be.saldo_aux, 0) + , be.saldo = IF(cash = 3, 0, be.saldo_aux) + WHERE Fecha >= vStartingDate; + + + -- Liquidez + update bs.bancos_evolution set liquidez = saldo - quilla + deuda WHERE Fecha >= vStartingDate; + + -- Disponibilidad + update bs.bancos_evolution set `disponibilidad ajena` = - quilla + deuda WHERE Fecha >= vStartingDate; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `campaignComparative` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `campaignComparative`(vDateFrom DATE, vDateTo DATE) +BEGIN + SELECT + workerName, + id, + name, + CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, + CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount + FROM ( + (SELECT + CONCAT(w.firstname, ' ', w.lastName) AS workerName, + c.id, + c.name, + SUM(v.importe) AS previousAmmount, + 0 currentAmmount + FROM bs.ventas v + INNER JOIN vn.`client` c ON v.Id_Cliente = c.id + INNER JOIN vn.worker w ON c.salesPersonFk = w.id + WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) + AND DATE_ADD(vDateTo, INTERVAL - 1 YEAR) + GROUP BY w.id, v.Id_Cliente) + UNION ALL + (SELECT + CONCAT(w.firstname, ' ', w.lastName) AS workerName, + c.id, + c.name, + 0 AS previousAmmount, + SUM(s.quantity * s.price) AS currentAmmount + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.worker w ON c.salesPersonFk = w.id + WHERE t.shipped BETWEEN vDateFrom + AND vDateTo + GROUP BY w.id, c.id) + ) comparative + GROUP BY workerName, id + HAVING (previousAmmount <> 0 OR currentAmmount <> 0) + ORDER BY workerName, id; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `carteras_add` */; +ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `carteras_add`() +BEGIN + +DELETE FROM bs.carteras +WHERE Año >= YEAR(CURDATE()) - 1; + +INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) +SELECT year as Año, month as Mes, CodigoTrabajador, sum(importe) as Peso +FROM vn2008.time t +JOIN bs.ventas v on t.date = v.fecha +JOIN vn2008.Clientes c on c.Id_Cliente = v.Id_Cliente +JOIN vn2008.Trabajadores tr on tr.Id_Trabajador = c.Id_Trabajador +WHERE t.year >= YEAR(CURDATE()) - 1 +GROUP BY CodigoTrabajador, Año, Mes; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clean`() -BEGIN - DECLARE vDateShort DATETIME; - DECLARE vDateLong DATETIME; - DECLARE vOneYearAgo DATETIME; - - SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET vDateLong = TIMESTAMPADD(MONTH, -18,CURDATE()); - SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,CURDATE()); - - -- DELETE FROM bi.comparativa_clientes WHERE Fecha < vDateLong; - - DELETE FROM bi.Greuge_Evolution - WHERE (Fecha < vDateShort AND weekday(Fecha) != 1) - OR Fecha < vOneYearAgo; - - DELETE FROM bi.defaulters WHERE `date` < vDateLong; - DELETE FROM bi.defaulting WHERE `date` < vDateLong; +BEGIN + DECLARE vFourYearsAgo DATETIME; + + SET vFourYearsAgo = TIMESTAMPADD(YEAR, -4,CURDATE()); + + DELETE FROM ventas + WHERE fecha < vFourYearsAgo; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `clean_launcher` */; +/*!50003 DROP PROCEDURE IF EXISTS `clientDied` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -3278,232 +3004,46 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clean_launcher`() +CREATE DEFINER=`root`@`%` PROCEDURE `clientDied`() BEGIN - call vn2008.clean(0); + IF DAY(CURDATE()) = 6 THEN -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `comparativa_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add`() -BEGIN - DECLARE lastCOMP INT; # Se trata de una variable para almacenar el ultimo valor del Periodo + SET @primerAviso := TIMESTAMPADD(MONTH,-1,CURDATE()); + SET @segundoAviso := TIMESTAMPADD(MONTH,-2,CURDATE()); + SET @tercerAviso := TIMESTAMPADD(MONTH,-3,CURDATE()); - SELECT MAX(Periodo) INTO lastCOMP FROM vn2008.Comparativa; - -- Fijaremos las ventas con más de un mes de antiguedad en la tabla Comparativa - - IF lastCOMP < vn2008.vnperiod(CURDATE())- 3 AND vn2008.vnweek(CURDATE()) > 3 THEN - - REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT tm.period as Periodo, m.Id_Article, t.warehouse_id, sum(m.Cantidad), sum(v.importe) - FROM bs.ventas v - JOIN vn2008.time tm ON tm.date = v.fecha - JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento - JOIN vn2008.Tipos tp ON tp.tipo_id = v.tipo_id - JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE tm.period BETWEEN lastCOMP AND vn2008.vnperiod(CURDATE())- 3 - AND t.Id_Cliente NOT IN(400,200) - AND r.display <> 0 - AND t.warehouse_id NOT IN (0,13) - GROUP BY m.Id_Article, Periodo, t.warehouse_id; - - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `comparativa_add_manual` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add_manual`(IN dat_START DATE, IN dat_END DATE) -BEGIN - - DECLARE datINI DATETIME; - DECLARE datFIN DATETIME; - - -- Seleccionamos la fecha minima/maxima del periodo que vamos a consultar - SELECT MIN(`date`) INTO datINI FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_START); - SELECT TIMESTAMP(MAX(`date`),'23:59:59') INTO datFIN FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_END); - - DELETE FROM vn2008.Comparativa WHERE Periodo BETWEEN vn2008.vnperiod(dat_START) and vn2008.vnperiod(dat_END); - - REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT tm.period AS Periodo - , M.Id_Article - , t.warehouse_id - , SUM(Cantidad) AS Total - , sum(v.importe) AS precio - FROM vn2008.Movimientos M - JOIN vn2008.Tickets t on t.Id_Ticket = M.Id_Ticket - JOIN bs.ventas v on v.Id_Movimiento = M.Id_Movimiento - JOIN vn2008.`time` tm on tm.`date` = v.fecha - WHERE v.fecha BETWEEN datINI and datFIN - AND t.warehouse_id NOT IN (0,13) - GROUP BY Id_Article, Periodo, t.warehouse_id; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `comparativa_add_manual__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add_manual__`(IN dat_START DATE, IN dat_END DATE) -BEGIN - - DECLARE datINI DATETIME; - DECLARE datFIN DATETIME; - - -- Seleccionamos la fecha minima/maxima del periodo que vamos a consultar - SELECT MIN(`date`) INTO datINI FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_START); - SELECT TIMESTAMP(MAX(`date`),'23:59:59') INTO datFIN FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_END); + TRUNCATE TABLE bs.clientDied; - DELETE FROM vn2008.Comparativa WHERE Periodo BETWEEN vn2008.vnperiod(dat_START) and vn2008.vnperiod(dat_END); + INSERT INTO bs.clientDied + SELECT c.id, + c.name as clientName, + maxIssued as lastInvoiced, + w.code AS workerCode, + b.code AS Boss, + CASE + WHEN IFNULL(maxIssued,'2000-01-01') < @tercerAviso THEN 'Tercer Aviso' + WHEN maxIssued < @segundoAviso THEN 'Segundo Aviso' + WHEN maxIssued < @primerAviso THEN 'Primer Aviso' + END as Aviso + FROM vn.client c + JOIN vn.worker w ON w.id = c.salesPersonFk + JOIN vn2008.jerarquia j ON j.worker_id = w.id + JOIN vn.worker b ON b.id = j.boss_id + JOIN bs.mana_spellers ms ON ms.Id_Trabajador = c.salesPersonFk + LEFT JOIN (SELECT clientFk, max(issued) as maxIssued FROM vn.invoiceOut GROUP BY clientFk) io ON io.clientFk = c.id + WHERE (maxIssued IS NULL OR maxIssued < @primerAviso) + AND c.created < @tercerAviso; - REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT tm.period AS Periodo - , M.Id_Article - , t.warehouse_id - , SUM(Cantidad) AS Total - , sum(v.importe) AS precio - FROM vn2008.Movimientos M - JOIN vn2008.Tickets t on t.Id_Ticket = M.Id_Ticket - JOIN bs.ventas v on v.Id_Movimiento = M.Id_Movimiento - JOIN vn2008.time tm on tm.date = v.fecha - JOIN vn2008.Tipos tp on v.tipo_id = tp.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - WHERE v.fecha BETWEEN datINI and datFIN - AND r.display <> 0 AND t.warehouse_id NOT IN (0,13) - GROUP BY Id_Article, Periodo, t.warehouse_id; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `comparativa_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add__`() -BEGIN - DECLARE lastCOMP INT; # Se trata de una variable para almacenar el ultimo valor del Periodo - - SELECT MAX(Periodo) INTO lastCOMP FROM vn2008.Comparativa; - -- Fijaremos las ventas con más de un mes de antiguedad en la tabla Comparativa - - IF lastCOMP < vn2008.vnperiod(CURDATE())- 3 AND vn2008.vnweek(CURDATE()) > 3 THEN - - REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT tm.period as Periodo, m.Id_Article, t.warehouse_id, sum(m.Cantidad), sum(v.importe) - FROM bs.ventas v - JOIN vn2008.time tm ON tm.date = v.fecha - JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento - JOIN vn2008.Articles a ON a.Id_Article = m.Id_Article - JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id - JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE tm.period BETWEEN lastCOMP AND vn2008.vnperiod(CURDATE())- 3 - AND t.Id_Cliente NOT IN(400,200) - AND r.display <> 0 - AND t.warehouse_id NOT IN (0,13) - GROUP BY Id_Article, Periodo, warehouse_id; - - -/* - REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT vn2008.vnperiod(T.Fecha) AS Periodo - , Id_Article - , warehouse_id - , SUM(Cantidad) AS Total - , SUM(Cantidad * Preu * (100 - Descuento) / 100) precio - FROM vn2008.Movimientos M - JOIN vn2008.Tickets T USING (Id_Ticket) - JOIN vn2008.Articles A USING (Id_Article) - LEFT JOIN vn2008.Tipos ti ON ti.tipo_id = A.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = ti.reino_id - WHERE T.Fecha BETWEEN TIMESTAMPADD(DAY,-60,CURDATE()) AND TIMESTAMPADD(DAY,-30,CURDATE()) - AND T.Id_Cliente NOT IN(400,200) - AND display <> 0 AND warehouse_id NOT IN (0,13) - GROUP BY Id_Article, Periodo, warehouse_id; -*/ - - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `customer_risk_update` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `customer_risk_update`(v_customer INT, v_company INT, v_amount DECIMAL(10,2)) -BEGIN - IF v_amount IS NOT NULL - THEN - INSERT INTO bi.customer_risk - SET - customer_id = v_customer, - company_id = v_company, - amount = v_amount - ON DUPLICATE KEY UPDATE - amount = amount + VALUES(amount); END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `defaultersFromDate` */; +/*!50003 DROP PROCEDURE IF EXISTS `clientNewBorn_Update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -3513,131 +3053,316 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `defaultersFromDate`(IN vDate DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `clientNewBorn_Update`() BEGIN - SELECT t1.*, c.Cliente, w.code AS workerCode, c.pay_met_id,c.Vencimiento - FROM ( - -- Filtramos aquellos clientes cuyo saldo se ha incrementado de ayer a hoy - select * from( - select today.client, today.amount todayAmount, yesterday.amount yesterdayAmount, round(yesterday.amount - today.amount,2) as difference, defaulterSince - from - (select client, amount, defaulterSince - from defaulters - where date = vDate and hasChanged) today - join - (select client, amount - from defaulters - where date = TIMESTAMPADD(DAY,-1,vDate)) yesterday using(client) - - having today.amount > 0 and difference <> 0 - ) newDefaulters - )t1 left join vn2008.Clientes c ON t1.client = c.Id_Cliente - left join vn.worker w ON w.id = c.Id_Trabajador; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `defaulting` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `defaulting`(IN `vDate` DATE) -BEGIN -/*JGF para usar el campo vencimiento de facturas*/ - DECLARE vDone BOOLEAN; - DECLARE vClient INT; - DECLARE vAmount INT; - DECLARE vDued DATE; - DECLARE vAmountInvoice DECIMAL(10,2); - DECLARE vGraceDays INT; - DECLARE defaulters CURSOR FOR - SELECT client, amount, graceDays FROM bi.defaulters d - JOIN vn2008.Clientes c ON c.Id_Cliente = d.client - JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id - WHERE hasChanged AND date = vDate; - - DECLARE invoices CURSOR FOR - SELECT Vencimiento, importe FROM vn2008.Facturas f - WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DELETE FROM bi.defaulters WHERE date = vDate; - - INSERT INTO bi.defaulters(client, date, amount) - SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount - FROM bi.customerRiskOverdue - GROUP BY customer_id; + DECLARE fromDated DATE DEFAULT '2019-04-01'; - -- marcamos si ha cambiado y heredamos la fecha defaulterSince - UPDATE bi.defaulters d - LEFT JOIN ( - SELECT * FROM( - SELECT client, amount , defaulterSince, frozened FROM bi.defaulters - WHERE date <= TIMESTAMPADD(DAY,-1, vDate) - ORDER BY date DESC) t GROUP BY client - ) yesterday using(client) - SET d.hasChanged = IF(d.amount <> IFNULL(yesterday.amount,0), 1, 0), - d.defaulterSince = yesterday.defaulterSince, - d.frozened = yesterday.frozened - WHERE d.date = vDate ; + -- Eliminamos clientes que ya no son nuevos + DELETE FROM bs.clientNewBorn + WHERE shipped < TIMESTAMPADD(YEAR,-1,CURDATE()); + + -- Clientes nuevos + REPLACE bs.clientNewBorn(clientFk,shipped) + SELECT t.clientFk, MIN(t.shipped) as shipped + FROM vn.ticket t + WHERE shipped > '2001-01-01' + GROUP BY t.clientFk + HAVING shipped >= GREATEST(TIMESTAMPADD(YEAR,-1,CURDATE()), fromDated); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `comercialesCompleto` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto`(IN vWorker INT, vDate DATE) +BEGIN + +CALL vn.worker_GetHierarchy(vWorker); + +SELECT + c.Id_Cliente id_cliente, + c.calidad, + c.Cliente cliente, + cr.recobro * 100 tarifa, + c.Telefono telefono, + c.movil, + c.POBLACION poblacion, + p.`name` provincia, + vn2008.red(f.futur) futur, + c.Credito credito, + pm.`name` forma_pago, + vn2008.red(c365 / 12) consumo_medio365, + vn2008.red(c365) consumo365, + vn2008.red(CmLy.peso) peso_mes_año_pasado, + vn2008.red(CmLy.peso * 1.19) objetivo, + tr.CodigoTrabajador, + vn2008.red(mes_actual.consumo) consumoMes, + vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo, + DATE(LastTicket) ultimo_ticket, + dead.muerto, + g.Greuge, + cr.recobro +FROM + vn2008.Clientes c + LEFT JOIN + (SELECT Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge + FROM vn2008.Greuges + GROUP BY Id_Cliente + ) g ON g.Id_Cliente = c.Id_Cliente + LEFT JOIN + vn2008.province p ON p.province_id = c.province_id + JOIN + vn2008.pay_met pm ON pm.id = c.pay_met_id + LEFT JOIN + vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + LEFT JOIN + bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3 + FROM bs.ventas v + JOIN vn2008.Clientes c USING (Id_Cliente) + + WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate + GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + Id_Cliente, SUM(importe) consumo + FROM + bs.ventas v + INNER JOIN vn2008.Clientes c USING (Id_Cliente) + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) + GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + t.Id_Cliente, + SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur + FROM + vn2008.Tickets t + JOIN vn2008.Clientes c ON c.Id_Cliente = t.Id_Cliente + JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + AND DATE(Fecha) BETWEEN vDate AND LAST_DAY(vDate) + GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente + LEFT JOIN + (SELECT + MAX(t.Fecha) LastTicket, c.Id_Cliente + FROM + vn2008.Tickets t + JOIN vn2008.Clientes c ON c.Id_cliente = t.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY t.Id_Cliente) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + SUM(importe) peso, c.Id_Cliente + FROM + bs.ventas v + JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + MONTH(fecha) = MONTH(vDate) + AND YEAR(fecha) = YEAR(vDate) - 1 + AND (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + c.Id_Cliente, + IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto + FROM + vn2008.Facturas f + JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente + + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente + JOIN tmp.workerHierarchyList s ON s.workerFk = c.Id_Trabajador; + +DROP TEMPORARY TABLE tmp.workerHierarchyList; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `comercialesCompleto__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto__`(IN vWorker INT, vDate DATE) +BEGIN + +CALL vn.subordinateGetList(vWorker); + +SELECT + c.Id_Cliente id_cliente, + c.calidad, + c.Cliente cliente, + cr.recobro * 100 tarifa, + c.Telefono telefono, + c.movil, + c.POBLACION poblacion, + p.`name` provincia, + vn2008.red(f.futur) futur, + c.Credito credito, + pm.`name` forma_pago, + vn2008.red(c365 / 12) consumo_medio365, + vn2008.red(c365) consumo365, + vn2008.red(CmLy.peso) peso_mes_año_pasado, + vn2008.red(CmLy.peso * 1.19) objetivo, + tr.CodigoTrabajador, + vn2008.red(mes_actual.consumo) consumoMes, + vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo, + DATE(LastTicket) ultimo_ticket, + dead.muerto, + g.Greuge, + cr.recobro +FROM + vn2008.Clientes c + LEFT JOIN + (SELECT Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge + FROM vn2008.Greuges + GROUP BY Id_Cliente + ) g ON g.Id_Cliente = c.Id_Cliente + LEFT JOIN + vn2008.province p ON p.province_id = c.province_id + JOIN + vn2008.pay_met pm ON pm.id = c.pay_met_id + LEFT JOIN + vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + LEFT JOIN + bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3 + FROM bs.ventas v + JOIN vn2008.Clientes c USING (Id_Cliente) + + WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate + GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + Id_Cliente, SUM(importe) consumo + FROM + bs.ventas v + INNER JOIN vn2008.Clientes c USING (Id_Cliente) + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) + GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + t.Id_Cliente, + SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur + FROM + vn2008.Tickets t + JOIN vn2008.Clientes c ON c.Id_Cliente = t.Id_Cliente + JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + AND DATE(Fecha) BETWEEN vDate AND LAST_DAY(vDate) + GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente + LEFT JOIN + (SELECT + MAX(t.Fecha) LastTicket, c.Id_Cliente + FROM + vn2008.Tickets t + JOIN vn2008.Clientes c ON c.Id_cliente = t.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY t.Id_Cliente) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + SUM(importe) peso, c.Id_Cliente + FROM + bs.ventas v + JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + MONTH(fecha) = MONTH(vDate) + AND YEAR(fecha) = YEAR(vDate) - 1 + AND (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + c.Id_Cliente, + IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto + FROM + vn2008.Facturas f + JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente + + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente + JOIN tmp.subordinate s ON s.workerFk = c.Id_Trabajador; + +DROP TEMPORARY TABLE tmp.subordinate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `compradores_add` */; +ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `compradores_add`(IN intYEAR INT, IN intWEEK_START INT, IN intWEEK_END INT) +BEGIN + +REPLACE bs.compradores + +SELECT tp.Id_Trabajador + , intYEAR as año + , tm.week as semana + , sum(importe) as importe + , 0 as comision - OPEN defaulters; - defaulters: LOOP - SET vDone = FALSE; - SET vAmount = 0; - FETCH defaulters INTO vClient,vAmount, vGraceDays; - IF vDone THEN - LEAVE defaulters; - END IF; - OPEN invoices; - invoices:LOOP - - FETCH invoices INTO vDued, vAmountInvoice; - IF vDone THEN - LEAVE invoices; - END IF; - - IF TIMESTAMPADD(DAY, vGraceDays, vDued) <= vDate THEN - SET vAmount = vAmount - vAmountInvoice; - IF vAmount <= 0 THEN - - UPDATE defaulters SET defaulterSince = vDued - WHERE client = vClient and date = vDate; - - SET vAmount = 0; - LEAVE invoices; - END IF; - END IF; - END LOOP; - CLOSE invoices; - END LOOP; - CLOSE defaulters; - - UPDATE defaulters d - JOIN vn.config ON TRUE - SET d.frozened = NULL - WHERE d.`date` = vDate - AND d.amount <= config.defaultersMaxAmount; - - CALL vn.clientFreeze(); - - -- actualizamos defaulting - DELETE FROM bi.defaulting WHERE date = vDate; +FROM bs.ventas v +JOIN vn2008.time tm on tm.date = v.fecha +JOIN vn2008.Tipos tp using(tipo_id) +WHERE tm.year = intYEAR and tm.week between intWEEK_START and intWEEK_END +AND reino_id != 6 +GROUP BY tp.Id_Trabajador, tm.week; + + - INSERT INTO bi.defaulting(date, amount) - SELECT vDate, SUM(amount) - FROM bi.defaulters - WHERE date = vDate and amount > 0; END ;; DELIMITER ; @@ -3645,7 +3370,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `defaulting_launcher` */; +ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `compradores_add_launcher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -3655,109 +3381,123 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `defaulting_launcher`() +CREATE DEFINER=`root`@`%` PROCEDURE `compradores_add_launcher`() BEGIN - CALL bi.defaulting(curdate()); + DECLARE vYear INT; + DECLARE vWeek INT; + DECLARE done BOOL DEFAULT FALSE; + + DECLARE rs CURSOR FOR + SELECT year, week + FROM vn.time + WHERE (year = vYear AND week >= vWeek) + OR year > vYear; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + SELECT MAX(año) INTO vYear + FROM compradores; + + SELECT MAX(semana) INTO vWeek + FROM compradores + WHERE año = vYear; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `equaliza` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `equaliza`(IN wh_id INT) -BEGIN + OPEN rs; -DECLARE datEQ DATETIME; -/* JGF 2017-03-20 cuelga el sistema + FETCH rs INTO vYear, vWeek; -SELECT `date` INTO datEQ FROM bi.variables WHERE variable = IF(wh_id = 17,'eq_mcf','equalizator'); + WHILE NOT done DO - -IF TIMEDIFF(now(), datEQ) > '00:05:00' THEN - - UPDATE bi.Equalizator e - JOIN - ( - SELECT - Vista, - sum(1) as pedido, - sum(PedidoImpreso) as impreso, - sum(t.Factura IS NOT NULL - OR t.Etiquetasemitidas - OR nz(ticket_id) <> 0) as encajado - FROM - vn2008.Movimientos - JOIN - vn2008.Tickets t USING (Id_Ticket) - JOIN - vn2008.Agencias a ON t.Id_Agencia = a.Id_Agencia - JOIN - vn2008.Clientes C USING (Id_Cliente) - LEFT JOIN - (SELECT distinct - ticket_id - FROM - vn2008.expeditions e JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id WHERE Fecha >= curDate()) exp ON ticket_id = Id_Ticket - WHERE - invoice And Fecha >= curDate() - AND t.warehouse_id = wh_id - AND fecha < (TIMESTAMPADD(DAY, 1, CURDATE())) - GROUP BY Vista) sub using(Vista) - SET e.Pedido = sub.pedido, e.Impreso = sub.impreso, e.Encajado = sub.encajado; - - UPDATE bi.variables SET `date`= now() WHERE variable = IF(wh_id = 17,'eq_mcf','equalizator'); + CALL compradores_add(vYear, vWeek, vWeek); + FETCH rs INTO vYear, vWeek; + + END WHILE; + + CLOSE rs; + + CALL compradores_evolution_add; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `compradores_evolution_add` */; +ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `compradores_evolution_add`() +BEGIN +/* + +Inserta en la tabla compradores_evolution las ventas acumuladas en los ultimos 365 dias -END IF; */ + +DECLARE datFEC DATE; + + +SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.compradores_evolution; + + WHILE datFEC < CURDATE() DO + + SELECT datFEC; + + REPLACE bs.compradores_evolution( Id_Trabajador + , fecha + , importe) + + SELECT Id_Trabajador + , datFEC as fecha + , sum(importe) as importe + + FROM + ( + + SELECT Id_Trabajador + , importe + FROM bs.compradores_evolution + WHERE fecha = TIMESTAMPADD(DAY,-1,datFEC) -- las ventas acumuladas del dia anterior + + UNION ALL + + SELECT Id_Trabajador + , importe * IF(v.fecha < datFEC,-1,1) -- se restan las ventas del año anterior y se suman las del actual + FROM bs.ventas v + JOIN vn2008.Tipos tp using(tipo_id) + WHERE fecha IN (datFEC, TIMESTAMPADD(DAY,-365,datFEC)) + AND reino_id != 6 + + )sub + GROUP BY Id_Trabajador; + + + + + SET datFEC = TIMESTAMPADD(DAY,1,datFEC); + + END WHILE; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `facturacion_media_anual_update` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `facturacion_media_anual_update`() -BEGIN - TRUNCATE TABLE bi.facturacion_media_anual; - - REPLACE bi.facturacion_media_anual(Id_Cliente, Consumo) - SELECT clientFk, avg(Facturacion) - FROM ( - SELECT clientFk, YEAR(issued) year, MONTH(issued) month, sum(amount) as Facturacion - FROM vn.invoiceOut - WHERE issued BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND TIMESTAMPADD(DAY, - DAY(CURDATE()),CURDATE()) - GROUP BY clientFk, year, month - ) vol - GROUP BY clientFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `greuge_dif_porte_add` */; +ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `fondo_evolution_add` */; +ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -3767,496 +3507,268 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `greuge_dif_porte_add`() +CREATE DEFINER=`root`@`%` PROCEDURE `fondo_evolution_add`() BEGIN - DECLARE datSTART DATETIME DEFAULT TIMESTAMPADD(DAY,-10,CURDATE()); -- '2019-07-01' - DECLARE datEND DATETIME DEFAULT TIMESTAMPADD(DAY,-1,CURDATE()); +/* - DROP TEMPORARY TABLE IF EXISTS tmp.dp; +Inserta en la tabla fondo_maniobra los saldos acumulados en los ultimos 365 dias - -- Agencias que no cobran por volumen - CREATE TEMPORARY TABLE tmp.dp - (PRIMARY KEY (Id_Ticket)) - ENGINE = MEMORY - SELECT t.Id_Ticket, - SUM(z.price * ebv.ratio) AS teorico, - 00000.00 as practico, - 00000.00 as greuge - FROM - vn2008.Tickets t - JOIN vn2008.Clientes cli ON cli.Id_cliente = t.Id_Cliente - LEFT JOIN vn2008.expeditions e ON e.ticket_id = t.Id_Ticket - JOIN vn2008.Consignatarios c ON c.Id_Consigna = t.Id_Consigna - JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.EsBulto - JOIN vn.zone z ON t.zoneFk = z.id - WHERE - t.Fecha between datSTART AND datEND - AND cli.`real` - AND t.empresa_id IN (442 , 567) - AND z.isVolumetric = FALSE - GROUP BY t.Id_Ticket; +*/ + +DECLARE datFEC DATE DEFAULT '2015-01-01'; + + +SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.fondo_maniobra; + + WHILE datFEC < CURDATE() DO + + -- esto solo sirve para no aburrirse mientras esperamos... + + IF day(datFEC) mod 28 = 0 then + SELECT datFEC; + end if; + + + REPLACE bs.fondo_maniobra(Fecha, clientes_facturas, clientes_cobros,proveedores_facturas,proveedores_pagos, fondo) + SELECT datFEC as Fecha, Facturas, Cobros,Recibidas,Pagos, Facturas + Cobros + Recibidas + Pagos + FROM + ( + SELECT Sum(Facturas.Importe) AS Facturas + FROM vn2008.Facturas + INNER JOIN vn2008.Clientes ON Facturas.Id_Cliente = Clientes.Id_cliente + WHERE Clientes.`real` + AND empresa_id <>1381 + AND Fecha between '2011-01-01' and datFEC) fac + JOIN + ( + SELECT - Sum(Entregado) AS Cobros + FROM vn2008.Recibos + INNER JOIN vn2008.Clientes ON Recibos.Id_Cliente = Clientes.Id_cliente + WHERE Clientes.`real` + AND empresa_id <> 1381 + AND Fechacobro Between '2011-01-01' and datFEC) cob + JOIN + ( + SELECT - Sum(cantidad) AS Recibidas + FROM vn2008.recibida + INNER JOIN vn2008.recibida_vencimiento ON recibida.id = recibida_vencimiento.recibida_id + WHERE empresa_id <> 1381 + AND recibida.fecha Between '2015-01-01' and datFEC) rec + JOIN + ( + SELECT Sum(importe) AS Pagos + FROM vn2008.pago + WHERE empresa_id <>1381 AND pago.fecha Between '2015-01-01' and datFEC) pag; + + + + UPDATE bs.fondo_maniobra + JOIN + (SELECT avg(fondo) as media + FROM bs.fondo_maniobra + WHERE fecha <= datFEC) sub + SET fondo_medio = media + WHERE fecha = datFEC; + + + SET datFEC = TIMESTAMPADD(DAY,1,datFEC); + + END WHILE; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `indicatorsUpdate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `indicatorsUpdate`(vDated DATE) +BEGIN + + DECLARE oneYearBefore DATE DEFAULT TIMESTAMPADD(YEAR,-1,vDated); + DECLARE twoMonthsBefore DATE DEFAULT TIMESTAMPADD(DAY,-60,vDated); + DECLARE oneMonthBefore DATE DEFAULT TIMESTAMPADD(DAY,-30,vDated); + DECLARE vWeek INT; - -- Agencias que cobran por volumen - INSERT INTO tmp.dp - SELECT sf.ticketFk, - SUM(freight) AS teorico, - 00000.00 as practico, - 00000.00 as greuge - FROM vn.saleFreight sf - JOIN vn.`client` c ON c.id = sf.clientFk - JOIN vn.zone z ON z.id = sf.zoneFk - WHERE c.isRelevant - AND sf.companyFk IN (442 , 567) - AND sf.shipped BETWEEN datSTART AND datEND - AND z.isVolumetric != FALSE - GROUP BY sf.ticketFk; + REPLACE indicators(updated) + VALUES(vDated); + + -- Ventas totales del ultimo año + UPDATE indicators + SET lastYearSales = + ( + SELECT SUM(importe + recargo) + FROM bs.ventas v + JOIN vn2008.empresa e ON e.id = v.empresa_id + JOIN vn2008.empresa_grupo eg ON eg.empresa_grupo_id = e.empresa_grupo + WHERE fecha BETWEEN oneYearBefore AND vDated + AND eg.grupo = 'Verdnatura' + ) + WHERE updated = vDated; + + -- Greuge total acumulado + UPDATE indicators + SET totalGreuge = + ( + SELECT SUM(amount) + FROM vn.greuge + WHERE shipped <= vDated + ) + WHERE updated = vDated; + + + -- Tasa de morosidad con respecto a las ventas del último mes + UPDATE indicators + SET latePaymentRate = + (SELECT SUM(amount) FROM bi.defaulters WHERE date = vDated and amount > 0) + / + ( SELECT SUM(importe + recargo) FROM bs.ventas WHERE fecha BETWEEN oneMonthBefore AND vDated) + WHERE updated = vDated; + + -- Número de trabajadores activos + UPDATE indicators + SET countEmployee = + ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) + FROM + postgresql.business AS b + JOIN postgresql.profile p ON p.profile_id = b.provider_id + JOIN postgresql.person pe ON pe.person_id = p.person_id + LEFT JOIN + postgresql.business_labour AS bl ON bl.business_id = b.business_id + LEFT JOIN + postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + WHERE + (vDated BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDated)) + AND pe.name = 'VERDNATURA LEVANTE SL' + ) + WHERE updated = vDated; - DROP TEMPORARY TABLE IF EXISTS tmp.dp_aux; - - CREATE TEMPORARY TABLE tmp.dp_aux - (PRIMARY KEY (Id_Ticket)) - ENGINE = MEMORY - SELECT dp.Id_Ticket, sum(Cantidad * Valor) as valor - FROM tmp.dp - JOIN vn2008.Movimientos m using(Id_Ticket) - JOIN vn2008.Movimientos_componentes mc using(Id_Movimiento) - WHERE mc.Id_Componente = 15 - GROUP BY m.Id_Ticket; - - UPDATE tmp.dp - JOIN tmp.dp_aux using(Id_Ticket) - SET practico = valor; - - DROP TEMPORARY TABLE tmp.dp_aux; - - CREATE TEMPORARY TABLE tmp.dp_aux - (PRIMARY KEY (Id_Ticket)) - ENGINE = MEMORY - SELECT dp.Id_Ticket, sum(Importe) Importe - FROM tmp.dp - JOIN vn2008.Greuges g using(Id_Ticket) - WHERE Greuges_type_id = 1 - GROUP BY Id_Ticket; - - UPDATE tmp.dp - JOIN tmp.dp_aux using(Id_Ticket) - SET greuge = Importe; - - - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket) - SELECT t.Id_Cliente - , concat('dif_porte ', dp.Id_Ticket) - , round(IFNULL(teorico,0) - IFNULL(practico,0) - IFNULL(greuge,0),2) as Importe - , date(t.Fecha) - , 1 - ,t.Id_Ticket - FROM tmp.dp - JOIN vn2008.Tickets t on dp.Id_Ticket = t.Id_Ticket - WHERE ABS(IFNULL(teorico,0) - IFNULL(practico,0) - IFNULL(greuge,0)) > 1; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `Greuge_Evolution_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `Greuge_Evolution_Add`() -BEGIN -/* - Inserta en la tabla Greuge_Evolution el saldo acumulado de cada cliente, - así como las ventas acumuladas en los ultimos 365 dias, para poder controlar - su evolucion. -*/ - DECLARE datFEC DATE; - DECLARE datFEC_TOMORROW DATE; - DECLARE datFEC_LASTYEAR DATE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - - GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; - SELECT CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto')); - INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('jgallego@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); - INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('pako@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); - - END; - - SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - - DELETE FROM bi.Greuge_Evolution WHERE Fecha >= TIMESTAMPADD(MONTH,-1,CURDATE()); - - SELECT TIMESTAMPADD(DAY,1,MAX(Fecha)), - TIMESTAMPADD(DAY,2,MAX(Fecha)) - INTO datFEC, - datFEC_TOMORROW - FROM bi.Greuge_Evolution; - - SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); - - DELETE FROM bi.Greuge_Evolution WHERE Fecha >= datFEC; - - DROP TEMPORARY TABLE IF EXISTS maxInvoice; - - CREATE TEMPORARY TABLE maxInvoice - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT DISTINCT Id_Cliente, max(Fecha) as maxFecha - FROM vn2008.Facturas - GROUP BY Id_Cliente - HAVING maxFecha < timestampadd(month,-2,datFEC); - - WHILE datFEC < CURDATE() DO - - REPLACE bi.Greuge_Evolution(Id_Cliente, Fecha, Greuge, Ventas, Fosil) - - SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0 - FROM ( - SELECT Id_Cliente, sum(Importe) as Greuge - FROM vn2008.Greuges - where Fecha <= datFEC - group by Id_Cliente - ) sub - RIGHT JOIN - - ( - - SELECT Id_Cliente, sum(Ventas) as Ventas - FROM - ( - - SELECT Id_Cliente, IF (fecha != datFEC, -1,1) * (importe + recargo) as Ventas - FROM bs.ventas - WHERE fecha = datFEC or fecha = datFEC_LASTYEAR - - UNION ALL - - SELECT Id_Cliente, Ventas - FROM bi.Greuge_Evolution - WHERE Fecha = TIMESTAMPADD(DAY, -1, datFEC) - - ) sub - group by Id_Cliente - - ) v using(Id_Cliente) - ; - - -- Ahora calcularemos el greuge muerto - - UPDATE bi.Greuge_Evolution ge - JOIN maxInvoice m using(Id_Cliente) - SET FOSIL = GREUGE - WHERE m.maxFecha < TIMESTAMPADD(MONTH,-2,ge.Fecha); - - -- Recobro - - UPDATE bi.Greuge_Evolution ge - JOIN ( - SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe - FROM vn2008.Tickets t - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket - JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento - WHERE t.Fecha >= datFEC - AND t.Fecha < datFEC_TOMORROW - AND mc.Id_Componente = 17 -- Recobro - GROUP BY cs.Id_Cliente - ) sub using(Id_Cliente) - SET Recobro = Importe - WHERE ge.Fecha = datFEC; - - SET datFEC = datFEC_TOMORROW; - SET datFEC_TOMORROW = TIMESTAMPADD(DAY,1,datFEC_TOMORROW); - SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); - - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS maxInvoice; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `margenes` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `margenes`() -BEGIN - -TRUNCATE TABLE bi.margenes; - -INSERT INTO bi.margenes -SELECT Id_Article, Cantidad as Unidades, Cantidad * round(nz(Costefijo) + nz(Embalajefijo) + nz(Comisionfija) + nz(Portefijo),3) as Coste , w.name as almacen, month(landing) as Mes, year(landing) as Year, 0 as Venta -FROM vn2008.Compres C -JOIN vn2008.Entradas E using(Id_Entrada) -JOIN vn2008.travel tr on tr.id = travel_id -JOIN vn2008.warehouse w on w.id = tr.warehouse_id -LEFT JOIN vn2008.Articles A using(Id_Article) -JOIN vn2008.Tipos TP using(tipo_id) -WHERE landing between '2013-01-01' and ' 2013-12-31' -AND E.Id_Proveedor <> 4 -AND not redada -AND not inventario -union all -SELECT Id_Article, Cantidad as Unidades, 0 as Coste , w.name, month(Fecha) as Mes, year(Fecha) as Year, Cantidad * round(Preu * (100 - M.Descuento) / 100,2) as Venta -FROM vn2008.Movimientos M -JOIN vn2008.Articles A using(Id_Article) -JOIN vn2008.Tipos TP using(tipo_id) -JOIN vn2008.Tickets T using(Id_Ticket) -JOIN vn2008.Clientes C using(Id_Cliente) -JOIN vn2008.warehouse w on w.id = warehouse_id -WHERE Fecha between '2013-01-01' and ' 2013-12-31' -AND (Id_Cliente = 31 or invoice) -AND Id_Cliente NOT IN (2066,2067,2068); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `nightly_tasks` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nightly_tasks`() -BEGIN - -call bi.analisis_ventas_evolution_add; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `nigthlyAnalisisVentas` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nigthlyAnalisisVentas`() -BEGIN - CALL analisis_ventas_update; - CALL analisis_ventas_simple; - CALL analisis_ventas_evolution_add; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `partitioning` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `partitioning`(IN intyear INT) -BEGIN + -- Maná medio acumulado por comercial + UPDATE indicators + SET averageMana = + (SELECT avg(used) + FROM bs.mana_spellers + ) + WHERE updated = vDated; + + -- Número de clientes que han comprado en los últimos 30 dias + UPDATE indicators + SET lastMonthActiveClients = + (SELECT COUNT(DISTINCT t.clientFk) + FROM vn.ticket t + WHERE t.shipped BETWEEN oneMonthBefore AND vDated + ) + WHERE updated = vDated; + + -- Número de clientes que no han comprado en los últimos 30 dias, pero compraron en los 30 anteriores + UPDATE indicators + SET lastMonthLostClients = + (SELECT COUNT(lm.clientFk) + FROM + ( + SELECT DISTINCT t.clientFk + FROM vn.ticket t + WHERE t.shipped BETWEEN oneMonthBefore AND vDated + ) cm + RIGHT JOIN + ( + SELECT DISTINCT t.clientFk + FROM vn.ticket t + WHERE t.shipped >= twoMonthsBefore + AND t.shipped < oneMonthBefore + ) lm ON lm.clientFk = cm.clientFk + WHERE cm.clientFk IS NULL + ) + WHERE updated = vDated; + + -- Número de clientes que han comprado en los últimos 30 dias, pero no compraron en los 30 anteriores + UPDATE indicators + SET lastMonthNewClients = + (SELECT COUNT(cm.clientFk) + FROM + ( + SELECT DISTINCT t.clientFk + FROM vn.ticket t + WHERE t.shipped BETWEEN oneMonthBefore AND vDated + ) cm + LEFT JOIN + ( + SELECT DISTINCT t.clientFk + FROM vn.ticket t + WHERE t.shipped >= twoMonthsBefore + AND t.shipped < oneMonthBefore + ) lm ON lm.clientFk = cm.clientFk + WHERE lm.clientFk IS NULL + ) + WHERE updated = vDated; + + -- Porcentaje de autopedidos sobre los pedidos totales + UPDATE indicators + SET lastMonthWebBuyingRate = + ( SELECT (SUM(source_app != '') - SUM(source_app = 'TPV')) / SUM(source_app != '') + FROM hedera.`order` + WHERE date_send BETWEEN oneMonthBefore AND vDated + ) + WHERE updated = vDated; + + -- Indicadores de producción + UPDATE indicators i + JOIN productionIndicators pi ON pi.dated = i.updated + SET i.productionHours = pi.productionHours, + i.dailyWorkersCost = pi.dailyWorkersCost, + i.volumeM3 = pi.volumeM3, + i.salesValue = pi.salesValue, + i.valueM3 = pi.valueM3, + i.hoursM3 = pi.hoursM3, + i.workerCostM3 = pi.workerCostM3, + i.salesWorkersCostRate = pi.salesWorkersCostRate + WHERE updated BETWEEN oneMonthBefore AND vDated; + + -- CAP Para el calculo de las ventas agrupado por semanas + + SELECT week + FROM vn.time + WHERE dated=vDated INTO vWeek; - DECLARE v_sql TEXT; - DECLARE strSquemaName VARCHAR(10); - DECLARE strTableName VARCHAR(20); - DECLARE strFieldName VARCHAR(20); - DECLARE strDateField VARCHAR(20); - DECLARE strTableDependingOn VARCHAR(20); - DECLARE strFieldDependingOn VARCHAR(20); - DECLARE done BIT DEFAULT 0; - DECLARE strCacheSchema VARCHAR(5); - DECLARE dat_start,dat_end DATE; - DECLARE cur1 CURSOR FOR - SELECT `schema_name`,`table_name` FROM `cache`.partitioning_information ORDER BY execution_order; - DECLARE cur2 CURSOR FOR - SELECT `schema_name`,`table_name`,`date_field` FROM `cache`.partitioning_information WHERE date_field > '' ORDER BY execution_order; - DECLARE cur3 CURSOR FOR - SELECT `schema_name`,`table_name`,`table_depending` FROM `cache`.partitioning_information WHERE table_depending > '' ORDER BY execution_order; - DECLARE cur4 CURSOR FOR - SELECT `schema_name`,`table_name`,`table_depending` FROM `cache`.partitioning_information WHERE table_depending > '' ORDER BY execution_order DESC; - DECLARE cur5 CURSOR FOR - SELECT `schema_name`,`table_name`,`date_field` FROM `cache`.partitioning_information WHERE date_field > '' ORDER BY execution_order DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; - - SET FOREIGN_KEY_CHECKS=0; - IF LENGTH(intyear) <> 4 THEN - CALL el_año_debe_contener_4_caracteres_yyyy(); - END IF; - SET dat_start = STR_TO_DATE(CONCAT('01,01,',intyear),'%d,%m,%Y'); - SET dat_end = STR_TO_DATE(CONCAT('31,12,',intyear),'%d,%m,%Y'); - SET strCacheSchema = CONCAT('vn_',right(intyear,2)); - SET v_sql = sql_printf ('CREATE SCHEMA IF NOT EXISTS %t',strCacheSchema); - CALL util.exec (v_sql); - - -- Insertamos en las tablas del cur1 - OPEN cur1; - FETCH cur1 INTO strSquemaName,strTableName; - WHILE NOT done DO - SET v_sql = sql_printf ('CREATE TABLE IF NOT EXISTS %t.%t LIKE %t.%t', - strCacheSchema, - strTableName, - strSquemaName, - strTableName); - - CALL util.exec (v_sql); - - FETCH cur1 INTO strSquemaName,strTableName; - - END WHILE; - CLOSE cur1; - - -- Insertamos en las tablas del cur2 - OPEN cur2; - FETCH cur2 INTO strSquemaName,strTableName,strDateField; - WHILE NOT done DO - SET v_sql = sql_printf ('REPLACE INTO %t.%t SELECT * FROM %t.%t WHERE %t BETWEEN %v AND %v', - strCacheSchema, - strTableName, - strSquemaName, - strTableName, - strDateField, - dat_start, - dat_end); - - SELECT v_sql; - CALL util.exec (v_sql); - - FETCH cur2 INTO strSquemaName,strTableName,strDateField; - - END WHILE; - CLOSE cur2; - - -- Insertamos en las tablas del cur3 - OPEN cur3; - SET done = 0; - FETCH cur3 INTO strSquemaName,strTableName,strTableDependingOn; - WHILE NOT done DO - - - -- Torna la columna per la qual vincular amb el seu pare - SELECT kcu.column_name INTO strFieldName - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci - AND REFERENCED_TABLE_NAME = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci - AND table_name = CONVERT(strTableName USING utf8) COLLATE utf8_general_ci; - - -- Torna la columna per la qual vincular amb el seu fill - SELECT kcu.column_name INTO strFieldDependingOn - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci -- FIX mirar l'esquema del pare - AND constraint_name = 'PRIMARY' - AND table_name = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci; - - SET v_sql = sql_printf ('REPLACE INTO %t.%t SELECT a.* FROM %t.%t a JOIN %t.%t b ON a.%t = b.%t', - strCacheSchema, - strTableName, - strSquemaName, - strTableName, - strCacheSchema, - strTableDependingOn, - strFieldName, - strFieldDependingOn); - select v_sql; - CALL util.exec (v_sql); - - FETCH cur3 INTO strSquemaName,strTableName,strTableDependingOn; - END WHILE; - - CLOSE cur3; - - -- Borramos en las tablas del cur4 que es igual que el dos pero en sentido descendente - -- para evitar errores con las foreign key - OPEN cur4; - SET done = 0; - FETCH cur4 INTO strSquemaName,strTableName,strTableDependingOn; - WHILE NOT done DO - + TRUNCATE `bs`.`salesByWeek`; + + INSERT INTO `bs`.`salesByWeek` (week,year,sales) + SELECT `t`.`week` AS `week`,`t`.`year` AS `year`, SUM(`v`.`importe` + `v`.`recargo`) AS `sales` + FROM `bs`.`ventas` `v` + LEFT JOIN `vn`.`time` `t` ON `t`.`dated` = fecha + GROUP BY `t`.`week` , `t`.`year` + ORDER BY `t`.`week` , `t`.`year`; + + -- CAP Indicador Ventas semana actual + UPDATE indicators i + JOIN `bs`.`salesByWeek` s ON s.week= vWeek AND s.year = YEAR(vDated) + SET i.thisWeekSales = s.sales + WHERE updated = vDated; - -- Torna la columna per la qual vincular amb el seu pare - SELECT kcu.column_name INTO strFieldName - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci - AND REFERENCED_TABLE_NAME = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci - AND table_name = CONVERT(strTableName USING utf8) COLLATE utf8_general_ci; + -- CAP indicador ventas semana actual en el año pasado + UPDATE indicators i + JOIN `bs`.`salesByWeek` s ON s.week= vWeek AND s.year = YEAR(vDated)-1 + SET i.lastYearWeekSales = s.sales + WHERE updated = vDated; - -- Torna la columna per la qual vincular amb el seu fill - SELECT kcu.column_name INTO strFieldDependingOn - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci - AND constraint_name = 'PRIMARY' - AND table_name = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci; - - SELECT v_sql; - SET v_sql = sql_printf ('DELETE a.* FROM %t.%t a JOIN %t.%t b ON a.%t = b.%t', - strSquemaName, - strTableName, - strCacheSchema, - strTableDependingOn, - strFieldName, - strFieldDependingOn); - CALL util.exec (v_sql); - - FETCH cur4 INTO strSquemaName,strTableName,strTableDependingOn; - END WHILE; - - CLOSE cur4; - - -- Borramos en las tablas del cur5 - OPEN cur5; - SET done = 0; - FETCH cur5 INTO strSquemaName,strTableName,strDateField; - WHILE NOT done DO - - SET v_sql = sql_printf ('DELETE FROM %t WHERE %t BETWEEN %v AND %v', - strTableName, - strDateField, - dat_start, - dat_end); - CALL util.exec (v_sql); - - FETCH cur5 INTO strSquemaName,strTableName,strDateField; - - END WHILE; - CLOSE cur5; - SET FOREIGN_KEY_CHECKS=1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `primer_pedido_add` */; +/*!50003 DROP PROCEDURE IF EXISTS `indicatorsUpdateLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -4266,64 +3778,24 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `primer_pedido_add`() -BEGIN - INSERT IGNORE INTO bi.primer_pedido(Id_Ticket, Id_Cliente, month, year, total) - SELECT * - FROM - (SELECT - `m`.`Id_Ticket` , - `v`.`Id_Cliente` , - `t`.`month`, - `t`.`year`, - v.importe + v.recargo as total - FROM - bs.ventas v - JOIN - vn2008.Movimientos m on m.Id_Movimiento = v.Id_Movimiento - JOIN - vn2008.time t on t.date = v.fecha - WHERE - fecha > CURDATE() + INTERVAL -(1) YEAR - ORDER BY fecha) `s` - GROUP BY `s`.`Id_Cliente`; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `regularidad` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `regularidad`() +CREATE DEFINER=`root`@`%` PROCEDURE `indicatorsUpdateLauncher`() BEGIN -select Id_Cliente, Meses, IF(Antiguedad = 13,12,Antiguedad) , Meses / IF(Antiguedad = 13,12,Antiguedad) as Regularidad from ( -SELECT Id_Cliente, count(*) as Meses, FLOOR(DATEDIFF('2012-07-31', IF(Created < '2011-08-01','2011-08-01', Created)) / 30) +1 as Antiguedad from -( - -SELECT DISTINCT Id_Cliente, Periodo(Fecha) as periodo from Facturas -where Fecha between '2011-08-01' AND '2012-07-31' - -) sub - -join Clientes using(Id_Cliente) -where Created <= '2012-07-31' - -group by Id_Cliente -having Antiguedad > 0 - -) sub44 -order by Antiguedad ; + DECLARE vDated DATE; + SELECT IFNULL(TIMESTAMPADD(DAY,1,MAX(updated)), '2018-04-01') + INTO vDated + FROM bs.indicators; + + WHILE vDated < CURDATE() DO + + CALL indicatorsUpdate(vDated); + + SELECT TIMESTAMPADD(DAY,1,MAX(updated)) + INTO vDated + FROM bs.indicators; + + END WHILE; END ;; DELIMITER ; @@ -4331,7 +3803,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `rotacion_update` */; +/*!50003 DROP PROCEDURE IF EXISTS `m3Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -4341,17 +3813,42 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update`() +CREATE DEFINER=`root`@`%` PROCEDURE `m3Add`() BEGIN - -- Sólo hace la consulta gorda los sábados de madrugada. Necesita casi dos horas. - CALL rotacion_update_manual(1, 999999, TIMESTAMPADD(WEEK, -1, CURDATE()), CURDATE()); + + DECLARE datSTART DATE; + DECLARE datEND DATE; + + SELECT TIMESTAMPADD(WEEK, -1,MAX(fecha)) INTO datSTART + FROM bs.m3; + + SET datEND = TIMESTAMPADD(DAY,-1,CURDATE()); + + DELETE FROM bs.m3 + WHERE fecha >= datSTART; + + INSERT INTO bs.m3 (fecha, provinceFk, warehouseFk, m3, year, month, week, day, dayName, euros) + SELECT v.fecha, a.provinceFk, t.warehouseFk, sum(i.compression * s.quantity * r.cm3) / 1000000 AS m3, + tm.year, tm.month, tm.week, tm.day, dayname(v.fecha), sum(importe) + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN bs.ventas v ON v.Id_Movimiento = s.id -- Filtra solo por ventas "buenas" + JOIN vn.time tm ON tm.dated = v.fecha + JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk + JOIN vn.address a ON a.id = t.addressFk + WHERE v.fecha BETWEEN datSTART AND datEND + AND s.quantity > 0 -- evita abonos + AND t.companyFk = 442 -- Verdnatura + GROUP BY t.warehouseFk, v.fecha, a.provinceFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `rotacion_update_manual` */; +/*!50003 DROP PROCEDURE IF EXISTS `manaCustomerUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -4361,219 +3858,303 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update_manual`( - vItemFrom INT, - vItemTo INT, - vStartDate DATE, - vEndDate DATE +CREATE DEFINER=`root`@`%` PROCEDURE `manaCustomerUpdate`() +BEGIN +DECLARE vToDated DATE; + DECLARE vFromDated DATE; + DECLARE vForDeleteDated DATE; + DECLARE vManaId INT DEFAULT 37; + DECLARE vManaAutoId INT DEFAULT 39; + DECLARE vManaBankId INT DEFAULT 66; + DECLARE vManaGreugeTypeId INT DEFAULT 3; + + SELECT IFNULL(max(dated), '2016-01-01') + INTO vFromDated + FROM bs.manaCustomer; + + DELETE + FROM bs.manaCustomer + WHERE dated = vFromDated; + + SELECT IFNULL(max(dated), '2016-01-01') + INTO vFromDated + FROM bs.manaCustomer; + + WHILE timestampadd(DAY,30,vFromDated) < CURDATE() DO + + SELECT + timestampadd(DAY,30,vFromDated), + timestampadd(DAY,-90,vFromDated) + INTO + vToDated, + vForDeleteDated; + + DELETE FROM bs.manaCustomer + WHERE dated <= vForDeleteDated; + + + INSERT INTO bs.manaCustomer(Id_Cliente, Mana, dated) + + SELECT + Id_Cliente, + cast(sum(mana) as decimal(10,2)) as mana, + vToDated as dated + FROM + + ( + SELECT cs.Id_Cliente, Cantidad * Valor as mana + FROM vn2008.Tickets t + JOIN vn2008.Consignatarios cs using(Id_Consigna) + JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket + JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento + WHERE Id_Componente IN (vManaAutoId, vManaId) + AND t.Fecha > vFromDated + AND date(t.Fecha) <= vToDated + + + UNION ALL + + SELECT r.Id_Cliente, - Entregado + FROM vn2008.Recibos r + WHERE Id_Banco = vManaBankId + AND Fechacobro > vFromDated + AND Fechacobro <= vToDated + + UNION ALL + + SELECT g.Id_Cliente, g.Importe + FROM vn2008.Greuges g + WHERE Greuges_type_id = vManaGreugeTypeId + AND Fecha > vFromDated + AND Fecha <= vToDated + + UNION ALL + + SELECT Id_Cliente, mana + FROM bs.manaCustomer + WHERE dated = vFromDated + ) sub + + GROUP BY Id_Cliente + HAVING Id_Cliente; + + SET vFromDated = vToDated; + + END WHILE; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `manaSpellers_actualize` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `manaSpellers_actualize`() +BEGIN + + /* PAK 2019/08/09 updated + * + * Recalcula el valor del campo con el modificador de precio para el componente de maná automático. + * La tabla mana_spellers es una caché + * + */ + + UPDATE mana_spellers me + JOIN + (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual + FROM bs.vendedores + WHERE año * 100 + mes >= (YEAR(CURDATE()) -1) * 100 + MONTH(CURDATE()) + GROUP BY Id_Trabajador + ) lastYearSales USING(Id_Trabajador) + SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,3))) ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `mermasCacheUpdate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `mermasCacheUpdate__`() +BEGIN + + DECLARE vTimeRange INT DEFAULT 30; + DECLARE vCurYearStarted DATE DEFAULT TIMESTAMPADD(DAY, - vTimeRange, CURDATE()); + DECLARE vCurYearFinished DATE DEFAULT CURDATE(); + DECLARE vLastYearStarted DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearStarted); + DECLARE vLastYearFinished DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearFinished); + + REPLACE bs.mermasCache + SELECT Comprador, + IF(Fecha < vCurYearStarted, year(CURDATE()) - 1,year(CURDATE())) año, + CAST(sum(Importe) as DECIMAL(10,0)) as Valor_Compra, + CAST(sum(IF(Cliente LIKE 'FALTAS',Importe,0)) as DECIMAL(10,0)) as Faltas, + CAST(sum(IF(Cliente LIKE 'BASURA',Importe,0)) as DECIMAL(10,0)) as Basura + FROM bs.mermas + WHERE Fecha BETWEEN vCurYearStarted AND vCurYearFinished + OR Fecha BETWEEN vLastYearStarted AND vLastYearFinished + GROUP BY año, Comprador; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `nightTask_launchAll` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `nightTask_launchAll`() +BEGIN +/** + * Runs all nightly tasks. + */ + DECLARE vDone BOOL; + DECLARE vError VARCHAR(255); + DECLARE vErrorCode VARCHAR(255); + DECLARE vNErrors INT DEFAULT 0; + DECLARE vSchema VARCHAR(255); + DECLARE vProcedure VARCHAR(255); + DECLARE vLogMail VARCHAR(255); + DECLARE vId INT; + + DECLARE rs CURSOR FOR + SELECT id, `schema`, `procedure` + FROM nightTask + WHERE finished <= CURDATE() + OR finished IS NULL + ORDER BY `order`; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SET max_sp_recursion_depth = 3; + OPEN rs; + + myLoop: LOOP + SET vDone = FALSE; + FETCH rs INTO vId, vSchema, vProcedure; + + IF vDone THEN + LEAVE myLoop; + END IF; + + UPDATE nightTask + SET `started` = NOW(), + `finished` = NULL, + `error` = NULL, + `errorCode` = NULL + WHERE id = vId; + + SET vError = NULL; + CALL nightTask_launchTask( + vSchema, + vProcedure, + vError, + vErrorCode + ); + + IF vError IS NOT NULL THEN + SET vNErrors = vNErrors + 1; + + UPDATE nightTask + SET `error` = vError, + `errorCode` = vErrorCode + WHERE id = vId; + ELSE + UPDATE nightTask + SET finished = NOW(), + lastFinished = NOW() + WHERE id = vId; + END IF; + END LOOP; + + CLOSE rs; + + SELECT logMail INTO vLogMail + FROM nightTaskConfig LIMIT 1; + + IF vNErrors > 0 AND vLogMail IS NOT NULL THEN + INSERT INTO vn.mail SET + `sender` = vLogMail, + `subject` = 'Nightly task failed', + `body` = CONCAT( + vNErrors, ' procedures of nightly tasks have failed. ', + 'Please, see `', SCHEMA() ,'`.`nightTask` table for more info.' + ); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `nightTask_launchTask` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `nightTask_launchTask`( + vSchema VARCHAR(255), + vProcedure VARCHAR(255), + OUT vError VARCHAR(255), + OUT vErrorCode VARCHAR(255) ) BEGIN +/** + * Runs an specific procedure from nightly tasks, if an error + * occurs, instead of throw it, #vError and #vErrorCode variables + * are setted. + * + * @param vSchema The procedure schema + * @param vProcedure The procedure name + * @param vError The error message, if any + * @param vErrorCode The error code, if any + */ + DECLARE EXIT HANDLER FOR SQLEXCEPTION + GET DIAGNOSTICS CONDITION 1 + vError = MESSAGE_TEXT, + vErrorCode = RETURNED_SQLSTATE; - DECLARE vDays INT DEFAULT DATEDIFF(vEndDate, vStartDate); - DECLARE vLastEventFinished DATETIME; - - DROP TEMPORARY TABLE IF EXISTS timing; - CREATE TEMPORARY TABLE timing - SELECT 'Starting Procedure' AS evento, now() as finished, 0 as seconds; - - SELECT now() INTO vLastEventFinished; - - REPLACE bi.rotacion(Id_Article, warehouse_id, total, rotacion) - SELECT Id_Article, warehouse_id, Total, ROUND((SUM(Saldo_Ponderado) / Total), 2) AS rotacion - -- round(AVG(Saldo_Ponderado) / (Total / vDays),1) AS Rotacion - FROM ( - SELECT Id_Article, - warehouse_id, - @intervalo:= IF(warehouse_id = @wh AND Id_Article = @art, - DATEDIFF(Fecha, @fec),1) AS Dias, - IF(warehouse_id = @wh AND Id_Article = @art, - IF(@sd < 0,0,@sd) * @intervalo, - IF(Unidades<0,0,Unidades)) AS Saldo_Ponderado, - IF(warehouse_id = @wh AND Id_Article = @art, - @sd:= @sd + Unidades, @sd:= Unidades) AS Saldo, - @fec:= Fecha, - @art:= Id_Article, - @wh:= warehouse_id - FROM ( - SELECT Id_Article, landing AS Fecha, sum(Cantidad) AS Unidades, - warehouse_id, @fec:= vStartDate, @art := 0, - @d := 0, @sd:= 0, @wh := 0, @intervalo := 0 - FROM ( - SELECT Id_Article, landing, Cantidad, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E USING(Id_Entrada) - JOIN vn2008.Articles A USING(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.travel tr ON tr.id = travel_id - JOIN vn2008.warehouse w ON w.id = tr.warehouse_id - WHERE landing BETWEEN vStartDate AND vEndDate - AND r.mercancia = TRUE - AND Id_Article BETWEEN vItemFrom AND vItemTo - AND Id_Proveedor <> 4 - AND r.display <> 0 - AND NOT E.Inventario - AND NOT fuente - AND NOT redada - UNION ALL - SELECT Id_Article, shipment, -Cantidad, warehouse_id_out - FROM vn2008.Compres C - JOIN vn2008.Entradas E USING(Id_Entrada) - JOIN vn2008.Articles A USING(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.travel tr ON tr.id = travel_id - JOIN vn2008.warehouse w ON w.id = tr.warehouse_id_out - WHERE shipment BETWEEN vStartDate AND vEndDate - AND r.mercancia = TRUE - AND Id_Article BETWEEN vItemFrom AND vItemTo - AND Id_Proveedor <> 4 - AND r.display <> 0 - AND NOT fuente - AND NOT E.Inventario - AND NOT redada - UNION ALL - SELECT Id_Article, DATE(Fecha), -Cantidad, warehouse_id - FROM vn2008.Movimientos M - JOIN vn2008.Articles A USING(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.Tickets t USING(Id_Ticket) - JOIN vn2008.warehouse w ON w.id = t.warehouse_id - WHERE Fecha BETWEEN vStartDate AND vEndDate - AND r.mercancia = TRUE - AND r.display <> 0 - AND NOT fuente - AND Id_Article BETWEEN vItemFrom AND vItemTo - AND Id_Cliente NOT IN (2066,2067,2068) - ) sub - GROUP BY Id_Article, warehouse_id, Fecha - ) sub2 - ) sub4 - JOIN ( - SELECT Id_Article, SUM(Cantidad) AS Total, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E USING(Id_Entrada) - JOIN vn2008.Articles A USING(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.travel tr ON tr.id = travel_id - JOIN vn2008.warehouse w ON w.id = tr.warehouse_id - WHERE landing BETWEEN vStartDate AND vEndDate - AND r.mercancia = TRUE - AND Id_Article BETWEEN vItemFrom AND vItemTo - AND Id_Proveedor <> 4 - AND NOT E.Inventario - AND r.display <> 0 - AND NOT redada - AND NOT fuente - GROUP BY Id_Article, warehouse_id - ) sub3 USING(Id_Article, warehouse_id) - GROUP BY Id_Article, warehouse_id; - - INSERT INTO timing - SELECT 'Replace' AS evento, now() as finished, TIMEDIFF(now(),vLastEventFinished) as seconds; - - SELECT MAX(finished) FROM timing INTO vLastEventFinished; - - -- Añadimos el volumen por unidad de venta - -- FIXME: Optimizar la consulta de actualización - - -- CALL vn2008.item_last_buy_(NULL, vStartDate); - CALL cache.last_buy_refresh(FALSE); - - INSERT INTO timing - SELECT 'last_buy_refresh' AS evento, now() as finished, TIMEDIFF(now(),vLastEventFinished) as seconds; - - SELECT MAX(finished) FROM timing INTO vLastEventFinished; - - UPDATE bi.rotacion r - JOIN cache.last_buy b ON r.Id_Article = b.item_id AND r.warehouse_id = b.warehouse_id - JOIN vn2008.Compres c ON c.Id_Compra = b.buy_id - JOIN vn.packaging p ON p.id = c.Id_Cubo - JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article - JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id - JOIN vn2008.reinos re ON re.id = tp.reino_id - SET cm3 = a.compression * IF(p.volume > 0, p.volume, p.width * p.depth * IF(p.height, p.height, a.medida + 10)) / c.packing - WHERE re.mercancia = TRUE - AND r.Id_Article BETWEEN vItemFrom AND vItemTo; - - INSERT INTO timing - SELECT 'update volume' AS evento, now() as finished, TIMEDIFF(now(),vLastEventFinished) as seconds; - - SELECT MAX(finished) FROM timing INTO vLastEventFinished; - - -- DROP TEMPORARY TABLE vn2008.t_item_last_buy; - - -- Añadimos el coste de almacenamiento y manipulacion - - UPDATE bi.rotacion - JOIN ( - SELECT warehouse_id, SUM(total * rotacion * cm3) AS Operacion - FROM bi.rotacion - WHERE Id_Article BETWEEN vItemFrom AND vItemTo - GROUP BY warehouse_id - ) sub USING(warehouse_id) - JOIN ( - SELECT warehouse_id, SUM(Valor) AS Coste_Auxiliar - FROM bi.tarifa_warehouse - WHERE Id_Premisa = 1 - GROUP BY warehouse_id - ) sub2 USING(warehouse_id) - JOIN ( - SELECT warehouse_id, SUM(Valor) AS Coste_Operativo - FROM bi.tarifa_warehouse - WHERE Id_Premisa IN (2,3) - GROUP BY warehouse_id - ) sub3 USING(warehouse_id) - JOIN ( - SELECT warehouse_id, sum(Valor) AS Coste_Manipulacion - FROM bi.tarifa_warehouse - WHERE Id_Premisa = 4 - GROUP BY warehouse_id - ) sub4 USING(warehouse_id) - SET auxiliar = IF(rotacion < 0, 0, ROUND(rotacion * cm3 * Coste_Auxiliar / Operacion, 4)), - almacenaje = IF(rotacion < 0, 0, ROUND(rotacion * cm3 * Coste_Operativo / Operacion, 4)), - manipulacion = IF(rotacion < 0, 0, ROUND(rotacion * cm3 * Coste_Manipulacion / Operacion, 4)) - WHERE Id_Article BETWEEN vItemFrom AND vItemTo; - - INSERT INTO timing - SELECT 'update almacenamiento' AS evento, now() as finished, TIMEDIFF(now(),vLastEventFinished) as seconds; - - SELECT MAX(finished) FROM timing INTO vLastEventFinished; - - -- Añadimos todos los productos de los que no tenemos histórico - -- con la media de su familia como valor por defecto - - INSERT INTO bi.rotacion(Id_Article, warehouse_id, cm3) - SELECT a.Id_Article, warehouse_id,cm3_m - FROM vn2008.Articles a - JOIN ( - SELECT tp.tipo_id, warehouse_id,AVG(cm3) cm3_m - FROM bi.rotacion rt - JOIN vn2008.Articles a ON a.Id_Article = rt.Id_Article - JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id - JOIN vn2008.reinos r ON r.id = tp.reino_id - WHERE r.mercancia = TRUE - GROUP BY tipo_id, warehouse_id - ) sub ON sub.tipo_id = a.tipo_id - WHERE a.Id_Article BETWEEN vItemFrom AND vItemTo - ON DUPLICATE KEY UPDATE rotacion = rotacion; - - INSERT INTO timing - SELECT 'historico' AS evento, now() as finished, TIMEDIFF(now(),vLastEventFinished) as seconds; - - SELECT MAX(finished) FROM timing INTO vLastEventFinished; - - SELECT * FROM timing; - + CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`')); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `rotacion_update_manual_PCA` */; +/*!50003 DROP PROCEDURE IF EXISTS `payMethodClientAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -4583,119 +4164,298 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update_manual_PCA`(IN datSTART DATE, IN datEND DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `payMethodClientAdd`() +BEGIN + INSERT IGNORE INTO `bs`.`payMethodClient` (dated, payMethodFk, clientFk) + SELECT CURDATE(), c.payMethodFk, c.id + FROM vn.client c + JOIN vn.payMethod p ON c.payMethodFk = p.id; + + TRUNCATE `bs`.`payMethodClientEvolution` ; + + INSERT INTO `bs`.`payMethodClientEvolution` (dated, payMethodName, amountClient, amount, equalizationTax) + SELECT p.dated, pm.name, COUNT(p.clientFk), SUM(sub.importe) , SUM(sub.recargo) + FROM bs.payMethodClient p + JOIN (SELECT SUM(v.importe) AS importe, SUM(v.recargo) as recargo, v.fecha, v.Id_cliente + FROM bs.ventas v + WHERE v.fecha>= (SELECT MIN(dated) FROM bs. payMethodClient) + GROUP BY v.Id_cliente, v.fecha) sub ON sub.fecha = p.dated AND sub.Id_cliente = p.ClientFk + JOIN vn.payMethod pm ON p.payMethodFk = pm.id + GROUP BY dated,payMethodFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `productivityAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `productivityAdd`(vDate DATE) BEGIN - -DECLARE intLAPSO INT DEFAULT DATEDIFF(datEND,datSTART ); -DECLARE intART_DESDE BIGINT DEFAULT 1; -DECLARE intART_HASTA BIGINT DEFAULT 100; - -WHILE intART_HASTA < 999999 DO - - IF intART_HASTA MOD 1000 = 0 THEN + DECLARE vDateStart DATETIME DEFAULT vDate; + DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); + DECLARE myDepLft INT; + DECLARE myDepRgt INT; - SELECT intART_HASTA; - - END IF; - - REPLACE bi.rotacion(Id_Article,warehouse_id,total,rotacion) - SELECT Id_Article, warehouse_id, Total, round((sum(Saldo_Ponderado)/Total),2) as rotacion -- round(avg(Saldo_Ponderado) / (Total / intLAPSO),1) as Rotacion - FROM - ( - SELECT Id_Article, warehouse_id, - @intervalo:= IF(warehouse_id = @wh AND Id_Article = @art , DATEDIFF(Fecha, @fec),1) as Dias, - IF(warehouse_id = @wh AND Id_Article = @art , IF(@sd < 0,0,@sd) * @intervalo, IF(Unidades<0,0,Unidades)) as Saldo_Ponderado, - IF(warehouse_id = @wh AND Id_Article = @art , @sd:= @sd + Unidades, @sd:= Unidades) as Saldo - - , @fec:= Fecha, @art:= Id_Article, @wh:= warehouse_id - FROM - ( - SELECT Id_Article, landing as Fecha, sum(Cantidad) as Unidades, warehouse_id, @fec:= datSTART, @art := 0, @d := 0, @sd:= 0, @wh := 0, @intervalo := 0 - FROM - ( - SELECT Id_Article, landing, Cantidad, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.reinos re ON re.id = Tipos.reino_id - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id - WHERE landing between datSTART and datEND - AND re.mercancia = TRUE - AND warehouse_id = 44 - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND reino_id IN (3,4) - AND NOT E.Inventario - AND NOT fuente - AND NOT redada - UNION ALL - SELECT Id_Article, shipment, -Cantidad, warehouse_id_out - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.reinos re ON re.id = Tipos.reino_id - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id_out - WHERE shipment between datSTART and datEND - AND re.mercancia = TRUE - AND warehouse_id_out = 44 - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND reino_id IN (3,4) - AND NOT fuente - AND NOT E.Inventario - AND NOT redada - UNION ALL - SELECT Id_Article, date(Fecha), -Cantidad, warehouse_id - FROM vn2008.Movimientos M - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.reinos re ON re.id = Tipos.reino_id - JOIN vn2008.Tickets t using(Id_Ticket) - JOIN vn2008.warehouse w on w.id = t.warehouse_id - WHERE Fecha between datSTART and datEND - AND re.mercancia = TRUE - AND t.warehouse_id = 44 - AND reino_id IN (3,4) - AND NOT fuente - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Cliente NOT IN (2066,2067,2068) - ) sub - GROUP BY Id_Article, warehouse_id, Fecha - ) sub2 - ) sub4 + DROP TEMPORARY TABLE IF EXISTS tmp.productivity; + + CREATE TEMPORARY TABLE tmp.productivity + ENGINE = MEMORY + SELECT hh, + mm, + 000.00 as m3, + 000.00 as m3FV, + 000.00 as m3PCA, + 000.00 as m3Artificial, + 0 as workers, + 000.00 as wCost, + 0 as numCoordinadores, + 000.00 as costCoordinacion, + 0 as numSacadores, + 000.00 as costSacado, + 0 as numEncajadores, + 000.00 as costEncajado, + 0 as numPaletizadores, + 000.00 as costPaletizado, + 0 as numCamareros, + 000.00 as costCamara, + 0 as numComplementos, + 000.00 as costComplementos, + 0 as numArtificial, + 000.00 as costArtificial + FROM vn.dayMinute; + +-- Trabajadores + CALL vn.dayMinuteWorker(vDateStart,vDateEnd); -- Genera la tabla tmp.dayMinuteWorker + CALL vn.workerDepartmentByDate(vDate); + + -- General + UPDATE tmp.productivity p JOIN - ( - SELECT Id_Article, sum(Cantidad) as Total, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.reinos re ON re.id = Tipos.reino_id - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id - WHERE landing between datSTART and datEND - AND warehouse_id = 44 - AND Id_Article between intART_DESDE and intART_HASTA - AND re.mercancia = TRUE - AND Id_Proveedor <> 4 - AND NOT E.Inventario - AND reino_id IN (3,4) - AND NOT redada - AND NOT fuente - GROUP BY Id_Article, warehouse_id - ) sub3 using(Id_Article, warehouse_id) - GROUP BY Id_Article, warehouse_id; - -SET intART_DESDE = intART_DESDE + 100; -SET intART_DESDE = intART_HASTA + 100; - -END WHILE; - + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + WHERE Almacen IN (1,44) + AND wdd.production + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.workers = sub.workers, p.wCost = sub.Bruto; + + -- Coordinadores + SELECT lft, rgt INTO myDepLft, myDepRgt + FROM vn.department + WHERE name = 'COORDINACION'; + + UPDATE tmp.productivity p + JOIN + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + JOIN vn.department d ON d.id = wdd.departmentFk + WHERE Almacen IN (1,44) + AND d.lft BETWEEN myDepLft AND myDepRgt + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.numCoordinadores = sub.workers, p.costCoordinacion = sub.Bruto; + + -- Sacado + SELECT lft, rgt INTO myDepLft, myDepRgt + FROM vn.department + WHERE name = 'SACADO'; + + UPDATE tmp.productivity p + JOIN + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + JOIN vn.department d ON d.id = wdd.departmentFk + WHERE Almacen IN (1,44) + AND d.lft BETWEEN myDepLft AND myDepRgt + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.numSacadores = sub.workers, p.costSacado = sub.Bruto; + + -- Encajado + SELECT lft, rgt INTO myDepLft, myDepRgt + FROM vn.department + WHERE name = 'ENCAJADO'; + + UPDATE tmp.productivity p + JOIN + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + JOIN vn.department d ON d.id = wdd.departmentFk + WHERE Almacen IN (1,44) + AND d.lft BETWEEN myDepLft AND myDepRgt + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.numEncajadores = sub.workers, p.costEncajado = sub.Bruto; + + -- Paletizado + SELECT lft, rgt INTO myDepLft, myDepRgt + FROM vn.department + WHERE name = 'PALETIZADO'; + + UPDATE tmp.productivity p + JOIN + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + JOIN vn.department d ON d.id = wdd.departmentFk + WHERE Almacen IN (1,44) + AND d.lft BETWEEN myDepLft AND myDepRgt + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.numPaletizadores = sub.workers, p.costPaletizado = sub.Bruto; + + -- Cámara + SELECT lft, rgt INTO myDepLft, myDepRgt + FROM vn.department + WHERE name = 'CAMARA'; + + UPDATE tmp.productivity p + JOIN + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + JOIN vn.department d ON d.id = wdd.departmentFk + WHERE Almacen IN (1,44) + AND d.lft BETWEEN myDepLft AND myDepRgt + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.numCamareros = sub.workers, p.costCamara = sub.Bruto; + + -- Complementos + SELECT lft, rgt INTO myDepLft, myDepRgt + FROM vn.department + WHERE name = 'COMPLEMENTOS'; + + UPDATE tmp.productivity p + JOIN + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + JOIN vn.department d ON d.id = wdd.departmentFk + WHERE Almacen IN (1,44) + AND d.lft BETWEEN myDepLft AND myDepRgt + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.numComplementos = sub.workers, p.costComplementos = sub.Bruto; + + -- Artificial + SELECT lft, rgt INTO myDepLft, myDepRgt + FROM vn.department + WHERE name = 'ARTIFICIAL'; + + UPDATE tmp.productivity p + JOIN + (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto + FROM tmp.dayMinuteWorker dmw + JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk + JOIN vn.department d ON d.id = wdd.departmentFk + WHERE Almacen IN (1,44) + AND d.lft BETWEEN myDepLft AND myDepRgt + GROUP BY Hora, Minuto + ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto + SET p.numArtificial = sub.workers, p.costArtificial = sub.Bruto; + + -- m3 + CALL vn.ticketBuiltTime(vDate); -- Genera la tabla tmp.ticketBuiltTime(ticketFk,builtTime) + CALL vn.ticketVolumeByDate_ventas(vDate); -- Genera la tabla tmp.ticketVolumeByDate(ticketFk,m3), filtrado por las ventas validas + CALL vn.ticketVolumeByDate_ventas_Artificial(vDate); -- Genera la tabla tmp.ticketVolumeByDate_ventas_Artificial + + UPDATE tmp.productivity p + JOIN + (SELECT HOUR(builtTime) hh, + MINUTE(builtTime) mm, + sum(tvd.m3) as m3, + sum(IF(t.warehouseFk = 1,tvd.m3,0)) as m3FV, + sum(IF(t.warehouseFk = 44,tvd.m3 - IFNULL(tvda.m3,0),0)) as m3PCA, + sum(IFNULL(tvda.m3,0)) as m3Artificial + FROM tmp.ticketBuiltTime tbt + JOIN tmp.ticketVolumeByDate tvd ON tvd.ticketFk = tbt.ticketFk + LEFT JOIN tmp.ticketVolumeByDate_Artificial tvda ON tvda.ticketFk = tbt.ticketFk + JOIN vn.ticket t ON t.id = tbt.ticketFk + WHERE t.warehouseFk IN (1,44) + GROUP BY hh,mm + ) v ON v.hh = p.hh AND v.mm = p.mm + SET p.m3 = v.m3, p.m3FV = v.m3FV, p.m3PCA = v.m3PCA, p.m3Artificial = v.m3Artificial; + + + + DELETE FROM bs.productivity + WHERE dated = vDate; + + INSERT INTO bs.productivity(dated, + hh, + mm, + m3, + m3FV, + m3PCA, + m3Artificial, + workers, + wCost, + numCoordinadores, + costCoordinacion, + numSacadores, + costSacado, + numEncajadores, + costEncajado, + numPaletizadores, + costPaletizado, + numCamareros, + costCamara, + numComplementos, + costComplementos, + numArtificial, + costArtificial) + SELECT vDate, + hh, + mm, + m3, + m3FV, + m3PCA, + m3Artificial, + workers, + wCost, + numCoordinadores, + costCoordinacion, + numSacadores, + costSacado, + numEncajadores, + costEncajado, + numPaletizadores, + costPaletizado, + numCamareros, + costCamara, + numComplementos, + costComplementos, + numArtificial, + costArtificial + FROM tmp.productivity p; + + -- Productivity Evolution + REPLACE bs.productivity_evolution(dated, m3productionCost) + SELECT CURDATE(), sum(wCost) / sum(m3) + FROM bs.productivity + WHERE dated BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND CURDATE(); + + DROP TEMPORARY TABLE tmp.dayMinuteWorker; + DROP TEMPORARY TABLE tmp.productivity; + DROP TEMPORARY TABLE tmp.ticketBuiltTime; + DROP TEMPORARY TABLE tmp.ticketVolumeByDate; + DROP TEMPORARY TABLE tmp.workerDepartmentByDate; + END ;; DELIMITER ; @@ -4703,7 +4463,70 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `rotacion_volumen_update` */; +/*!50003 DROP PROCEDURE IF EXISTS `productivityDepartmentAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `productivityDepartmentAdd`(IN vDateStartPeriod DATETIME, IN vDateEndPeriod DATETIME, IN vDateStart DATETIME) +BEGIN + + DECLARE vEndingDate DATETIME; + + SET vEndingDate = vDateStart; + + WHILE vEndingDate <= vDateEndPeriod DO + REPLACE INTO bs.productivityDepartment + SELECT vEndingDate, + CAST(((productivityCoordinacionLastYear - productivityCoordinacion) / 2) * m3 AS DECIMAL (10,2)) AS amountCoordinacion, + CAST(((productivitySacadoLastYear - productivitySacado) / 2) * m3 AS DECIMAL (10,2)) AS amountSacado, + CAST(((productivityEncajadoLastYear - productivityEncajado) / 2) * m3 AS DECIMAL (10,2)) AS amountEncajado, + CAST(((productivityPaletizadoLastYear - productivityPaletizado) / 2) * m3 AS DECIMAL (10,2)) AS amountPaletizado, + CAST(((productivityCamaraLastYear - productivityCamara) / 2) * m3FV AS DECIMAL (10,2)) AS amountCamara, + CAST(((productivityComplementosLastYear - productivityComplementos) / 2) * m3PCA AS DECIMAL (10,2)) AS amountComplementos, + CAST(((productivityArtificialLastYear - productivityArtificial) / 2) * m3Artificial AS DECIMAL (10,2)) AS amountArtificia + FROM + (SELECT + SUM(p.m3) AS m3, SUM(p.m3FV) as m3FV, SUM(p.m3PCA) as m3PCA, SUM(p.m3Artificial) as m3Artificial, + SUM(p.costCoordinacion) / SUM(p.m3) AS productivityCoordinacion, + SUM(p.costSacado) / SUM(p.m3) AS productivitySacado, + SUM(p.costEncajado) / SUM(p.m3) AS productivityEncajado, + SUM(p.costPaletizado) / SUM(p.m3) AS productivityPaletizado, + SUM(p.costCamara) / SUM(p.m3FV) AS productivityCamara, + SUM(p.costComplementos) / SUM(p.m3PCA) AS productivityComplementos, + SUM(p.costArtificial) / SUM(p.m3Artificial) AS productivityArtificial + FROM + bs.productivity p + WHERE + p.dated BETWEEN vDateStartPeriod AND vEndingDate) sub + JOIN + (SELECT + SUM(p.costCoordinacion) / SUM(p.m3) AS productivityCoordinacionLastYear, + SUM(p.costSacado) / SUM(p.m3) AS productivitySacadoLastYear, + SUM(p.costEncajado) / SUM(p.m3) AS productivityEncajadoLastYear, + SUM(p.costPaletizado) / SUM(p.m3) AS productivityPaletizadoLastYear, + SUM(p.costCamara) / SUM(p.m3FV) AS productivityCamaraLastYear, + SUM(p.costComplementos) / SUM(p.m3PCA) AS productivityComplementosLastYear, + SUM(p.costArtificial) / SUM(p.m3Artificial) AS productivityArtificialLastYear + FROM + bs.productivity p + WHERE + p.dated BETWEEN DATE_ADD(vDateStartPeriod, INTERVAL - 1 YEAR) AND DATE_ADD(vEndingDate, INTERVAL - 1 YEAR)) sub1; + + SET vEndingDate = TIMESTAMPADD(DAY,1, vEndingDate); + END WHILE; + END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `productivityDepartmentLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -4713,84 +4536,53 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_volumen_update`() +CREATE DEFINER=`root`@`%` PROCEDURE `productivityDepartmentLauncher`() BEGIN -/* - CALL vn2008.item_last_buy_(NULL,curdate()); - - -- Añadimos el volumen por unidad de venta - update bi.rotacion r - JOIN vn2008.t_item_last_buy b ON r.Id_Article = b.item_id AND r.warehouse_id = b.warehouse_id - join vn2008.Compres c ON c.Id_Compra = b.buy_id - join vn.item i ON i.id = c.Id_Article - join vn.itemType tp ON tp.id = i.typeFk - join vn.itemCategory ic ON ic.id = tp.categoryFk - set cm3 = vn.item_getVolume(r.Id_Article, Id_Cubo) / Packing - where ic.merchandise = TRUE; -*/ + CALL bs.productivityDepartmentAdd('2019-05-06', CURDATE(),DATE_SUB(CURDATE(), INTERVAL 2 WEEK)); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `Ultima_Accion` */; +/*!50003 DROP PROCEDURE IF EXISTS `productivityLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `Ultima_Accion`() +CREATE DEFINER=`root`@`%` PROCEDURE `productivityLauncher`() BEGIN -REPLACE INTO bi.lastaction(Id_Cliente, Cliente, Ultima_accion, Comercial) + DECLARE vDateFrom DATE; + + SELECT LEAST(TIMESTAMPADD(MONTH, -1, CURDATE()),MAX(dated)) + INTO vDateFrom + FROM bs.productivity; + + WHILE CURDATE() > vDateFrom DO + CALL bs.productivityAdd(vDateFrom); + SET vDateFrom = TIMESTAMPADD(DAY,1,vDateFrom); + END WHILE; + + SET vDateFrom = TIMESTAMPADD(MONTH, -13, CURDATE()); + + WHILE TIMESTAMPADD(MONTH, -12, CURDATE()) > vDateFrom DO + CALL bs.productivityAdd(vDateFrom); + SET vDateFrom = TIMESTAMPADD(DAY,1,vDateFrom); + END WHILE; -SELECT Id_Cliente, Cliente, Ultima_accion, Comercial -FROM vn2008.Clientes -JOIN -( -SELECT Id_Cliente, MAX(calldate) as Ultima_accion, vn2008.Averiguar_ComercialCliente(Id_Cliente, CURDATE()) as Comercial -FROM -( -SELECT Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Contactos CT on CT.Telefono = dst -JOIN vn2008.Relaciones using(Id_Contacto) -WHERE Id_Cliente IS NOT NULL -AND duration > 30 -UNION ALL -SELECT Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Contactos CT on CT.Movil = dst -JOIN vn2008.Relaciones using(Id_Contacto) -WHERE Id_Cliente IS NOT NULL -AND duration > 30 -UNION ALL -SELECT Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Clientes CT on CT.Telefono = dst -WHERE duration > 30 -UNION ALL -SELECT Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Clientes CT on CT.Movil = dst -WHERE duration > 30 -UNION ALL -SELECT C.Id_Cliente, Fecha -FROM vn2008.Tickets JOIN vn2008.Consignatarios C using(Id_Consigna) -) sub -GROUP BY Id_Cliente ) sub2 USING(Id_Cliente); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `Velocity_Add` */; +/*!50003 DROP PROCEDURE IF EXISTS `productivityLauncher_manual` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -4800,43 +4592,1179 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `Velocity_Add`() +CREATE DEFINER=`root`@`%` PROCEDURE `productivityLauncher_manual`(vDateFrom DATE, vToDate DATE) +BEGIN + + TRUNCATE tmp.log; + + WHILE vToDate >= vDateFrom DO + + INSERT INTO tmp.log(text) VALUES (vDateFrom); + CALL bs.productivityAdd(vDateFrom); + + CALL bs.productivityAdd(TIMESTAMPADD(YEAR, -1,vDateFrom)); + INSERT INTO tmp.log(text) VALUES (TIMESTAMPADD(YEAR, -1,vDateFrom)); + + SET vDateFrom = TIMESTAMPADD(DAY,1,vDateFrom); + + END WHILE; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `pruebas` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `pruebas`(IN vDateStart DATE, IN vDateEnd DATE) BEGIN -DECLARE bol_EXISTS BOOL; -DECLARE datMAX DATETIME; -DECLARE v_buffer VARCHAR(11); -DECLARE v_sql VARCHAR(255); - - - -SELECT MAX(Fecha) INTO datMAX FROM bi.Velocity; - -IF Date(datMAX) = CURDATE() AND hour(datMAX) > hour(now()) THEN - - - SET v_buffer = vn2008.buffer_name(CURDATE(),1); +WHILE vDateStart <> vDateEnd +DO + UPDATE indicators + SET countEmployee = + ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) + FROM + postgresql.business AS b + JOIN postgresql.profile p ON p.profile_id = b.provider_id + JOIN postgresql.person pe ON pe.person_id = p.person_id + LEFT JOIN + postgresql.business_labour AS bl ON bl.business_id = b.business_id + LEFT JOIN + postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + WHERE + (vDateStart BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDateStart)) + AND pe.name = 'VERDNATURA LEVANTE SL' + ) + WHERE updated = vDateStart; + SET vDateStart = DATE_ADD(vDateStart, INTERVAL 1 DAY); - SELECT count(*) INTO bol_EXISTS FROM information_schema.`TABLES` - WHERE TABLE_NAME = CONVERT(v_buffer using utf8) collate utf8_general_ci; - - IF bol_EXISTS THEN +END WHILE; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `salePersonEvolutionAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `salePersonEvolutionAdd`(IN vDateStart DATETIME) +BEGIN + DELETE FROM bs.salePersonEvolution + WHERE dated <= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); - SET v_sql = sql_printf ( - 'INSERT INTO bi.Velocity(tipo_id, Fecha, Disponible, Visible) - SELECT A.tipo_id, NOW(), sum(avalaible), sum(visible) - FROM vn2008.%t b - JOIN Articles A ON b.item_id = A.Id_Article GROUP BY tipo_id; - ', - v_buffer - ); - - - CALL util.exec (v_sql); - + + INSERT INTO bs.salePersonEvolution (dated, amount, equalizationTax, salesPersonFk) + SELECT fecha dated, + CAST(SUM(importe) AS DECIMAL(10,2) ) amount, + CAST(SUM(recargo) AS DECIMAL(10,2) ) equalizationTax , + IFNULL(salesPersonFk,0) salesPersonFk + FROM bs.ventas v + JOIN vn.client c ON v.Id_Cliente = c.id + JOIN vn.company co ON co.id = v.empresa_id + WHERE co.code = "VNL" AND fecha >= vDateStart + GROUP BY v.fecha,c.salesPersonFk + ORDER BY salesPersonFk,dated ASC; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `userSundayRole` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userSundayRole`() +BEGIN + -- 4996 Fran Natek Echevarria + DECLARE vDay INT; + SET vDay := (SELECT DAYOFWEEK(CURDATE())); + IF vDay = 1 THEN + UPDATE account.user u + JOIN account.role r + SET u.role = r.id + WHERE u.id = 4996 AND r.name = "salesAssistant"; + ELSE + UPDATE account.user u + JOIN account.role r + SET u.role = r.id + WHERE u.id = 4996 AND r.name = "salesPerson"; END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add`(intYEAR INT, vQuarter INT) +BEGIN -END IF; + DECLARE vCommissionRate DOUBLE DEFAULT 0.029; + + -- vaciar tabla + DELETE v.* FROM vendedores v + JOIN vn.`time` t ON t.`year` = v.año AND t.`month` = v.mes + WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter; + + REPLACE vendedores(Id_Trabajador, año, mes, importe, comision) + SELECT c.Id_Trabajador + , intYEAR + , MONTH(v.fecha) intMONTH + , sum(v.importe) + , sum(v.importe) * vCommissionRate + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn.`time` t on t.dated = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter + GROUP BY c.Id_Trabajador, t.`month`; + + -- Ventas nuevas + UPDATE vendedores v + JOIN + ( + SELECT c.Id_Trabajador + , sum(importe) * vCommissionRate as comisionNueva + , t.`month` + , t.`year` + FROM ventas v + JOIN bs.clientNewBorn cnb on v.Id_Cliente = cnb.clientFk + JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY c.Id_Trabajador, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionNuevos = sub.comisionNueva, v.comision = v.comision - sub.comisionNueva; + + -- Ventas cedidas + UPDATE vendedores v + JOIN ( + SELECT cc.Id_Trabajador_old as Id_Trabajador + , sum(importe) * vCommissionRate * comision_old as cedido + , sum(importe) * vCommissionRate * comision_new as arrendada + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY cc.Id_Trabajador_old, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionCedida = sub.cedido, v.comision = v.comision - sub.cedido - sub.arrendada; + + -- Ventas arrendadas + UPDATE vendedores v + JOIN ( + SELECT cc.Id_Trabajador_new as Id_Trabajador + , sum(importe) * vCommissionRate * comision_new as arrendada + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY cc.Id_Trabajador_new, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionArrendada = sub.arrendada; + + -- Sustitucion cedidas - lended + INSERT INTO vendedores (Id_Trabajador, mes, año, comision) + SELECT c.salesPersonFk + , sum(importe) * vCommissionRate as lended + , t.`month` + , t.`year` + FROM ventas v + JOIN vn.client c ON c.id = v.Id_Cliente + JOIN vn.sharingCartDaily scd on scd.ownerFk = c.salesPersonFk AND scd.dated = v.fecha + JOIN vn.`time` t ON t.dated = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter + GROUP BY c.salesPersonFk, t.`month` + ON DUPLICATE KEY UPDATE comision = comision - VALUES(comision); + + -- Sustitucion arrendadas - borrowed + INSERT INTO vendedores (Id_Trabajador, mes, año, sustitucionArrendada) + SELECT scd.substituteFk + , sum(importe) * vCommissionRate as borrowed + , t.`month` + , t.`year` + FROM ventas v + JOIN vn.client c ON c.id = v.Id_Cliente + JOIN vn.sharingCartDaily scd on scd.ownerFk = c.salesPersonFk AND scd.dated = v.fecha + JOIN vn.`time` t ON t.dated = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter + GROUP BY scd.substituteFk, t.`month` + ON DUPLICATE KEY UPDATE sustitucionArrendada = sustitucionArrendada + VALUES(sustitucionArrendada); + + DROP TEMPORARY TABLE IF EXISTS tmp.workerItemType; + CREATE TEMPORARY TABLE tmp.workerItemType + (INDEX(ownerWorkerFk, itemTypeFk)) + SELECT wd.workerFk ownerWorkerFk, itemTypeFk, dit.workerFk substituteFk + FROM vn.departmentItemType dit + JOIN vn.workerDepartment wd ON wd.departmentFk = dit.departmentFk; + + -- itemType Lended, prestado + UPDATE vendedores v + JOIN ( + SELECT c.Id_Trabajador + , sum(importe) * vCommissionRate as amount + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN tmp.workerItemType wit ON wit.ownerWorkerFk = c.Id_Trabajador AND wit.itemTypeFk = v.tipo_id + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY c.Id_Trabajador, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comision = v.comision - sub.amount; + + -- itemType borrowed, tomado prestado + INSERT INTO vendedores (Id_Trabajador, año, mes, itemTypeBorrowed) + SELECT wit.substituteFk + , t.`year` + , t.`month` + , importe * vCommissionRate + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN tmp.workerItemType wit ON wit.ownerWorkerFk = c.Id_Trabajador AND wit.itemTypeFk = v.tipo_id + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + ON DUPLICATE KEY UPDATE itemTypeBorrowed = itemTypeBorrowed + values(itemTypeBorrowed); + + DROP TEMPORARY TABLE tmp.workerItemType; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add_launcher` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add_launcher`() +BEGIN + + call bs.vendedores_add(YEAR(CURDATE()),QUARTER(CURDATE())); + + call bs.vendedores_evolution_add; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add__`(intYEAR INT, vQuarter INT) +BEGIN + + DECLARE comisionRate DOUBLE DEFAULT 0.029; + + REPLACE vendedores + SELECT c.Id_Trabajador + , intYEAR + , MONTH(v.fecha) intMONTH + , sum(importe) as importe + , sum(importe) * 0.029 as comision + , 0 as comisionArrendada + , 0 as comisionCedida + , 0 as comisionNuevos + , 0 as sustitucionArrendada + , 0 as sustitucionCedida + , 0 as itemTypeLended + , 0 as itemTypeBorrowed + + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY c.Id_Trabajador, t.`month`; + + -- Ventas nuevas + UPDATE vendedores v + JOIN + ( + SELECT c.Id_Trabajador + , sum(importe) * 0.029 as comisionNueva + , t.`month` + , t.`year` + FROM ventas v + JOIN bs.clientNewBorn cnb on v.Id_Cliente = cnb.clientFk + JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY c.Id_Trabajador, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionNuevos = sub.comisionNueva, v.comision = v.comision - sub.comisionNueva; + + -- Ventas cedidas + UPDATE vendedores v + JOIN ( + SELECT cc.Id_Trabajador_old as Id_Trabajador + , sum(importe) * 0.029 * comision_old as cedido + , sum(importe) * 0.029 * comision_new as arrendada + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY cc.Id_Trabajador_old, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionCedida = sub.cedido, v.comision = v.comision - sub.cedido - sub.arrendada; + + -- Ventas arrendadas + UPDATE vendedores v + JOIN ( + SELECT cc.Id_Trabajador_new as Id_Trabajador + , sum(importe) * 0.029 * comision_new as arrendada + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY cc.Id_Trabajador_new, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionArrendada = sub.arrendada; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vendedores_evolution_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_evolution_add`() +BEGIN +/* + +Inserta en la tabla compradores_evolution las ventas acumuladas en el ultimo mes + +*/ + +DECLARE vYear, vMonth INTEGER; +DECLARE vCurYear, vCurMonth INTEGER; +DECLARE vFirstYear INTEGER DEFAULT 2017; +DECLARE vFirstMonth INTEGER DEFAULT 1; + +DECLARE vDateFrom DATE; +DECLARE vDateTo DATE; + +SET vCurYear = year(CURDATE()); +SET vCurMonth = month(CURDATE()); + +SELECT IFNULL(max(year),vFirstYear), IFNULL(max(month),vFirstMonth) + INTO vYear, vMonth + FROM bs.vendedores_evolution; + + WHILE (vYear < vCurYear) OR (vYear = vCurYear AND vMonth < vCurMonth) DO + + SELECT max(dated), TIMESTAMPADD(DAY,-364,max(dated)) INTO vDateTo, vDateFrom + FROM vn.time + WHERE year = vYear + AND month = vMonth; + + SELECT vDateTo, vDateFrom, vYear, vMonth; + + REPLACE bs.vendedores_evolution( workerFk + , year + , month + , sales) + SELECT c.salesPersonFk + , vYear as year + , vMonth as month + , sum(v.importe) as sales + FROM bs.ventas v + JOIN vn.client c on c.id = v.Id_Cliente + WHERE v.fecha BETWEEN vDateFrom AND vDateTo + AND c.salesPersonFk is not null + GROUP BY c.salesPersonFk; + + SET vMonth = vMonth + 1; + + IF vMonth = 13 THEN + + SET vMonth = 1; + SET vYear = vYear + 1; + + END IF; + + END WHILE; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ventas_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add`(IN datSTART DATETIME, IN datEND DATETIME) +BEGIN + + DECLARE vStartingDate DATETIME; + DECLARE vEndingDate DATETIME; + DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; + + IF datSTART < '2015-10-01' OR datEND < '2015-10-01' THEN + CALL util.throw('fechaDemasiadoAntigua'); + END IF; + + SET datEND = util.dayEnd(datEND); + SET vStartingDate = datSTART; + SET vEndingDate = vn2008.dayend(vStartingDate); + + DELETE + FROM ventas + WHERE fecha between vStartingDate and datEND; + + WHILE vEndingDate <= datEND DO + + REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id) + SELECT Id_Movimiento, + SUM(IF(base, Cantidad * Valor, 0)) as importe, + SUM(IF(base, 0, Cantidad * Valor)) as recargo, + vStartingDate, + a.tipo_id, + cs.Id_Cliente, + t.empresa_id + FROM vn2008.Movimientos_componentes mc + JOIN bi.tarifa_componentes tc using(Id_Componente) + JOIN bi.tarifa_componentes_series tcs using(tarifa_componentes_series_id) + JOIN vn2008.Movimientos m using(Id_Movimiento) + JOIN vn2008.Articles a using(Id_Article) + JOIN vn2008.Tipos tp using(tipo_id) + JOIN vn2008.reinos r on r.id = tp.reino_id + JOIN vn2008.Tickets t using(Id_Ticket) + JOIN vn2008.Consignatarios cs using(Id_Consigna) + JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente + WHERE t.Fecha between vStartingDate and vEndingDate + AND c.typeFk IN ('Normal','handMaking','internalUse') + AND m.Cantidad <> 0 + AND a.tipo_id != TIPO_PATRIMONIAL + AND m.Descuento <> 100 + AND (m.Id_Article = 98 or m.Id_Article = 95 or r.mercancia != 0) + GROUP BY mc.Id_Movimiento + HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0; + + SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate); + SET vEndingDate = util.dayEnd(vStartingDate); + + END WHILE; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ventas_add_launcher` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add_launcher`() +BEGIN + + call bs.ventas_add(timestampadd(week,-1,curdate()),curdate()); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ventas_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add__`(IN datSTART DATETIME, IN datEND DATETIME) +BEGIN + + DECLARE vStartingDate DATETIME; + DECLARE vEndingDate DATETIME; + DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; + + SET datEND = util.dayEnd(datEND); + SET vStartingDate = GREATEST('2015-10-01',datSTART); + SET vEndingDate = vn2008.dayend(vStartingDate); + + DELETE + FROM ventas + WHERE fecha between vStartingDate and datEND; + + WHILE vEndingDate <= datEND DO + + REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id) + SELECT Id_Movimiento, + SUM(IF(base, Cantidad * Valor, 0)) as importe, + SUM(IF(base, 0, Cantidad * Valor)) as recargo, + vStartingDate, + a.tipo_id, + cs.Id_Cliente, + t.empresa_id + FROM vn2008.Movimientos_componentes mc + JOIN bi.tarifa_componentes tc using(Id_Componente) + JOIN bi.tarifa_componentes_series tcs using(tarifa_componentes_series_id) + JOIN vn2008.Movimientos m using(Id_Movimiento) + JOIN vn2008.Articles a using(Id_Article) + JOIN vn2008.Tipos tp using(tipo_id) + JOIN vn2008.reinos r on r.id = tp.reino_id + JOIN vn2008.Tickets t using(Id_Ticket) + JOIN vn2008.Consignatarios cs using(Id_Consigna) + JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente + WHERE t.Fecha between vStartingDate and vEndingDate + AND datEND >= '2015-10-01' + AND c.typeFk IN ('Normal','handMaking','internalUse') + AND m.Cantidad <> 0 + AND a.tipo_id != TIPO_PATRIMONIAL + AND c.Id_Trabajador IS NOT NULL + AND m.Descuento <> 100 + AND (m.Id_Article = 98 or m.Id_Article = 95 or r.mercancia != 0) + GROUP BY mc.Id_Movimiento + HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0; + + SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate); + SET vEndingDate = util.dayEnd(vStartingDate); + + END WHILE; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ventas_contables_add`(IN vYear INT, IN vMonth INT) +BEGIN +/** + * Reemplaza las ventas contables. Es el origen de datos para el balance de Entradas + * + * @param vYear Año a reemplazar + * @param vMonth Mes a reemplazar + * + * + **/ +DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; + +DELETE FROM bs.ventas_contables + WHERE year = vYear + AND month = vMonth; + +DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; + +CREATE TEMPORARY TABLE tmp.ticket_list + (PRIMARY KEY (Id_Ticket)) + SELECT Id_Ticket + FROM vn2008.Tickets t + JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura + WHERE year(f.Fecha) = vYear + AND month(f.Fecha) = vMonth; + + +INSERT INTO bs.ventas_contables(year + , month + , venta + , grupo + , reino_id + , tipo_id + , empresa_id + , gasto) + + SELECT vYear + , vMonth + , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) + , if( + e.empresa_grupo = e2.empresa_grupo + ,1 + ,if(e2.empresa_grupo,2,0) + ) as grupo + , tp.reino_id + , a.tipo_id + , t.empresa_id + , 7000000000 + + if(e.empresa_grupo = e2.empresa_grupo + ,1 + ,if(e2.empresa_grupo,2,0) + ) * 1000000 + + tp.reino_id * 10000 as Gasto + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna + JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente + JOIN tmp.ticket_list tt on tt.Id_Ticket = t.Id_Ticket + JOIN vn2008.Articles a on m.Id_Article = a.Id_Article + JOIN vn2008.empresa e on e.id = t.empresa_id + LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente + JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id + WHERE Cantidad <> 0 + AND Preu <> 0 + AND m.Descuento <> 100 + AND a.tipo_id != TIPO_PATRIMONIAL + GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; + + +DROP TEMPORARY TABLE tmp.ticket_list; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_add_launcher` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ventas_contables_add_launcher`() +BEGIN + + call bs.ventas_contables_add(YEAR(TIMESTAMPADD(MONTH,-1,CURDATE())), MONTH(TIMESTAMPADD(MONTH,-1,CURDATE()))); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_por_cliente` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ventas_contables_por_cliente`(IN vYear INT, IN vMonth INT) +BEGIN + + +DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; + +CREATE TEMPORARY TABLE tmp.ticket_list + (PRIMARY KEY (Id_Ticket)) + SELECT Id_Ticket + FROM vn2008.Tickets t + JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura + WHERE year(f.Fecha) = vYear + AND month(f.Fecha) = vMonth; + + + + SELECT vYear Año + , vMonth Mes + , t.Id_Cliente + , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) Venta + , if( + e.empresa_grupo = e2.empresa_grupo + ,1 + ,if(e2.empresa_grupo,2,0) + ) as grupo + , t.empresa_id empresa + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna + JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente + JOIN tmp.ticket_list tt on tt.Id_Ticket = t.Id_Ticket + JOIN vn2008.Articles a on m.Id_Article = a.Id_Article + JOIN vn2008.empresa e on e.id = t.empresa_id + LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente + JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id + WHERE Cantidad <> 0 + AND Preu <> 0 + AND m.Descuento <> 100 + AND a.tipo_id != 188 + GROUP BY t.Id_Cliente, grupo,t.empresa_id; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vivosMuertos` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `vivosMuertos`() +BEGIN + +SET @datSTART = TIMESTAMPADD(YEAR,-2,CURDATE()); +SET @datEND = TIMESTAMPADD(DAY,-DAY(CURDATE()),CURDATE()); + +DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos; + +CREATE TEMPORARY TABLE tmp.VivosMuertos +SELECT c.Id_Cliente, tm.yearMonth, f.Compra, 0 as Nuevo, 0 as Muerto +FROM vn2008.Clientes c +JOIN (SELECT DISTINCT yearMonth FROM vn2008.time WHERE date BETWEEN @datSTART AND @datEND ) tm +LEFT JOIN + (SELECT DISTINCT tm.yearMonth, f.Id_Cliente , 1 as Compra + FROM vn2008.Facturas f + JOIN vn2008.time tm ON tm.date = f.Fecha + WHERE Fecha BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; + +UPDATE tmp.VivosMuertos vm +JOIN ( + SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente + FROM vn2008.Facturas f + JOIN vn2008.time tm ON tm.date = f.Fecha + WHERE Fecha BETWEEN @datSTART AND @datEND + GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente +SET Nuevo = 1; + +SELECT max(yearMonth) INTO @lastYearMonth FROM tmp.VivosMuertos; + +UPDATE tmp.VivosMuertos vm +JOIN ( + SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente + FROM vn2008.Facturas f + JOIN vn2008.time tm ON tm.date = f.Fecha + WHERE Fecha BETWEEN @datSTART AND @datEND + GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente +SET Muerto = 1 +WHERE yearMonth < @lastYearMonth; + + SELECT * FROM tmp.VivosMuertos; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `waste_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `waste_Add`() +BEGIN + + DECLARE vWeek INT; + DECLARE vYear INT; + + SELECT week, year + INTO vWeek, vYear + FROM vn.time + WHERE dated = CURDATE(); + + REPLACE bs.waste + SELECT *, 100 * mermas / total as porcentaje + FROM ( + SELECT buyer, + year, + week, + family, + floor(sum(value)) as total, + floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas + FROM vn.saleValue + where year = vYear and week = vWeek + + GROUP BY family + + ) sub + ORDER BY mermas DESC; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `weekWaste` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `weekWaste`() +BEGIN + DECLARE vWeek INT; + DECLARE vYear INT; + + SELECT week, year + INTO vWeek, vYear + FROM vn.time + WHERE dated = DATE_ADD(CURDATE(), INTERVAL -1 WEEK); + + SELECT *, 100 * dwindle / total AS percentage + FROM ( + SELECT buyer, + sum(saleTotal) as total, + sum(saleWaste) as dwindle + FROM bs.waste + WHERE year = vYear and week = vWeek + GROUP BY buyer + ) sub + ORDER BY percentage DESC; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `weekWaste_byWorker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `weekWaste_byWorker`(vWorkerFk INT) +BEGIN + + DECLARE vWeek INT; + DECLARE vYear INT; + + SELECT week, year + INTO vWeek, vYear + FROM vn.time + WHERE dated = TIMESTAMPADD(WEEK,-1,CURDATE()); + + SELECT *, 100 * mermas / total as porcentaje + FROM ( + SELECT ws.family, + sum(ws.saleTotal) as total, + sum(ws.saleWaste) as mermas + FROM bs.waste ws + JOIN vn.worker w ON w.user = ws.buyer + WHERE year = vYear AND week = vWeek + AND w.id = vWorkerFk + GROUP BY family + + ) sub + ORDER BY porcentaje DESC; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `weekWaste_getDetail` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `weekWaste_getDetail`() +BEGIN + DECLARE vLastWeek DATE; + DECLARE vWeek INT; + DECLARE vYear INT; + + SET vLastWeek = TIMESTAMPADD(WEEK,-1,CURDATE()); + SET vYear = YEAR(vLastWeek); + SET vWeek = WEEK(vLastWeek, 1); + + SELECT *, 100 * dwindle / total AS percentage + FROM ( + SELECT buyer, + ws.family, + sum(ws.saleTotal) AS total, + sum(ws.saleWaste) AS dwindle + FROM bs.waste ws + WHERE year = vYear AND week = vWeek + GROUP BY buyer, family + ) sub + ORDER BY percentage DESC; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerSpeed` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `workerSpeed`() +BEGIN + + /* #UPDATED PAK 2019/09/02 + * #PENDING REVIEW + * + * + * + * + */ + + DECLARE vLastUpdated DATETIME; + DECLARE vSecondsDelay INT DEFAULT 300; + + SELECT IFNULL(MAX(lastUpdated),CURDATE()) INTO vLastUpdated + FROM bs.workerSpeed; + + IF TIMESTAMPDIFF(SECOND, vLastUpdated, NOW()) > vSecondsDelay THEN + + DELETE FROM bs.workerSpeed ; + -- WHERE lastUpdated < CURDATE(); + + -- Sacadores + REPLACE bs.workerSpeed + SELECT workerCode, + accion, + warehouseFk, + CAST(60 * sumaLitros / time_to_sec(timediff(finished, started)) AS DECIMAL(10,1)) as LitrosMinuto, + CAST(sumaLitrosLastHour / 60 AS DECIMAL(10,1)) as LitrosMinutoLastHour, + now() as lastUpdated + FROM + ( + SELECT warehouseFk, + accion, + workerCode, + sum(litros) as sumaLitros, + min(created) as started, + max(created) as finished, + sum(IF(created >= TIMESTAMPADD(HOUR, -1, NOW()),litros, 0)) as sumaLitrosLastHour + FROM + ( + SELECT t.warehouseFk, + st.saleFk, + st.isChecked, + st.originalQuantity, + a.accion, + st.created, + e.code, + w.firstname, + w.lastName, + w.code as workerCode, + r.cm3 * s.quantity / 1000 as litros, + s.concept + FROM vn.saleTracking st + LEFT JOIN + (SELECT saleFk + FROM vn.saleTracking st + JOIN vn.state e ON e.id = st.stateFk + WHERE st.created > CURDATE() + AND e.code LIKE 'PREVIOUS_PREPARATION') prevPrepSales ON prevPrepSales.saleFk = st.saleFk + JOIN vn.sale s ON s.id = st.saleFk + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN bi.rotacion r ON r.warehouse_id = t.warehouseFk AND r.Id_Article = s.itemFk + JOIN vn.worker w ON w.id = st.workerFk + JOIN vn.state e ON e.id = st.stateFk + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + WHERE st.created > TIMESTAMPADD(HOUR,-1,NOW()) + AND prevPrepSales.saleFk IS NULL + ) sub + GROUP BY warehouseFk, accion, workerCode + ) sub2; + + -- Encajadores + REPLACE bs.workerSpeed + SELECT code as workerCode, + 'ENCAJAR' as accion, + warehouseFk, + CAST(60 * sum(Litros) / time_to_sec(timediff(MAX(finished), MIN(started))) AS DECIMAL(10,1)) as LitrosMinuto, + CAST(sum(litrosUltimaHora) / 60 AS DECIMAL(10,1)) as LitrosMinutoLastHour, + now() as lastUpdated + FROM ( + SELECT sv.ticketFk, + sum(sv.litros) as litros, + sum(IF(started > TIMESTAMPADD(HOUR,-1,NOW()),sv.litros,0)) as litrosUltimaHora, + code, + started, + finished, + cajas, + warehouseFk + FROM vn.saleVolume sv + JOIN + ( + SELECT ticketFk, + min(e.created) as started, + max(e.created) as finished, + max(counter) as cajas, + w.code, + t.warehouseFk + FROM vn.expedition e + JOIN vn.worker w ON w.id = e.workerFk + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE e.created > CURDATE() + GROUP BY ticketFk + ) sub ON sub.ticketFk = sv.ticketFk + GROUP BY sv.ticketFk) sub2 + GROUP BY code; + + END IF; + + SELECT * FROM bs.workerSpeed; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerSpeed_detail` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `workerSpeed_detail`(vWorkerCode VARCHAR(3), vAction VARCHAR(25)) +BEGIN + + SELECT * FROM + ( + SELECT time_format(st.created,'%H:%i') as hora, + t.warehouseFk as Almacen, + t.id as ticketFk, + floor(sum(s.quantity * r.cm3) / 1000) as Litros + + FROM vn.saleTracking st + JOIN vn.sale s ON s.id = st.saleFk + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN bi.rotacion r ON r.warehouse_id = t.warehouseFk AND r.Id_Article = s.itemFk + JOIN vn.worker w ON w.id = st.workerFk + JOIN vn.state e ON e.id = st.stateFk + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + WHERE st.created > CURDATE() + AND a.accion LIKE vAction + AND w.code LIKE vWorkerCode + GROUP BY t.id) sub + ORDER BY hora; END ;; DELIMITER ; @@ -6593,8 +7521,7 @@ CREATE TABLE `item` ( `change_date_time` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `group_id` (`group_id`), - KEY `plant_id` (`plant_id`), - CONSTRAINT `item_fk1` FOREIGN KEY (`group_id`) REFERENCES `item_group` (`group_code`) ON DELETE CASCADE ON UPDATE CASCADE + KEY `plant_id` (`plant_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FP130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -10792,9 +11719,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -10920,6 +11847,7 @@ BEGIN WHERE o.id = vOrder AND t.invoiceOutFk IS NULL AND IFNULL(tls.alertLevel,0) = 0 + AND t.clientFk <> 1118 LIMIT 1; -- Crea el ticket en el caso de no existir uno adecuado @@ -13606,6 +14534,10 @@ CREATE TABLE `business_labour_payroll` ( `cod_contrato` int(11) DEFAULT NULL, `importepactado` decimal(10,2) NOT NULL DEFAULT '0.00', PRIMARY KEY (`business_id`), + KEY `business_labour_payroll_cod_categoria_idx` (`cod_categoria`), + KEY `business_labour_payroll_cod_contrato` (`cod_contrato`), + CONSTRAINT `business_labour_payroll_cod_categoria` FOREIGN KEY (`cod_categoria`) REFERENCES `vn2008`.`payroll_categorias` (`codcategoria`) ON UPDATE CASCADE, + CONSTRAINT `business_labour_payroll_cod_contrato` FOREIGN KEY (`cod_contrato`) REFERENCES `vn2008`.`payroll_contratos` (`CodContrato`) ON UPDATE CASCADE, CONSTRAINT `business_labour_payroll_fk1` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -16958,11 +17890,11 @@ CREATE TABLE `agencyMode` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `deliveryMethodFk` int(11) DEFAULT '0', + `deliveryMethodFk` int(11) DEFAULT NULL, `m3` double DEFAULT '0', `cod71` tinyint(3) unsigned DEFAULT '0', `web` smallint(1) unsigned zerofill NOT NULL DEFAULT '0', - `agencyFk` smallint(6) NOT NULL, + `agencyFk` smallint(5) unsigned NOT NULL, `agencyServiceFk` tinyint(4) NOT NULL DEFAULT '1', `inflation` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT 'Este valor se utiliza para aumentar el valor del componente porte.', `isVolumetric` tinyint(1) NOT NULL DEFAULT '0', @@ -16974,7 +17906,10 @@ CREATE TABLE `agencyMode` ( `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `Agencias` (`name`), - KEY `Vista` (`deliveryMethodFk`) + KEY `Vista` (`deliveryMethodFk`), + KEY `agencyMode_agencyFk` (`agencyFk`), + CONSTRAINT `agencyMode_agencyFk` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `agencyMode_deliveryMethodFk` FOREIGN KEY (`deliveryMethodFk`) REFERENCES `deliveryMethod` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -17204,8 +18139,6 @@ CREATE TABLE `botanicExport` ( KEY `Id_Paises` (`countryFk`), KEY `botanicExport_ibfk_2_idx` (`ediGenusFk`), KEY `botanicExport_ibfk_3_idx` (`ediSpecieFk`), - CONSTRAINT `botanicExport_ediGenusFk` FOREIGN KEY (`ediGenusFk`) REFERENCES `edi`.`genus` (`genus_id`) ON UPDATE CASCADE, - CONSTRAINT `botanicExport_ediSpecieFk` FOREIGN KEY (`ediSpecieFk`) REFERENCES `edi`.`specie` (`specie_id`) ON UPDATE CASCADE, CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -17793,14 +18726,33 @@ CREATE TABLE `claimLog` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `claimRatio` +-- Table structure for table `claimRatio` -- DROP TABLE IF EXISTS `claimRatio`; -/*!50001 DROP VIEW IF EXISTS `claimRatio`*/; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `claimRatio` ( + `clientFk` int(11) NOT NULL DEFAULT '0', + `yearSale` decimal(10,2) DEFAULT NULL, + `claimAmount` decimal(10,2) DEFAULT NULL, + `claimingRate` decimal(5,2) DEFAULT NULL, + `priceIncreasing` decimal(5,2) DEFAULT NULL, + `packingRate` decimal(5,2) NOT NULL DEFAULT '1.00', + PRIMARY KEY (`clientFk`), + CONSTRAINT `claimRatio_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `claimRatio__` +-- + +DROP TABLE IF EXISTS `claimRatio__`; +/*!50001 DROP VIEW IF EXISTS `claimRatio__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `claimRatio` AS SELECT +/*!50001 CREATE VIEW `claimRatio__` AS SELECT 1 AS `clientFk`, 1 AS `yearSale`, 1 AS `claimAmount`, @@ -18321,14 +19273,32 @@ CREATE TABLE `clientProtected` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `clientRisk` +-- Table structure for table `clientRisk` -- DROP TABLE IF EXISTS `clientRisk`; -/*!50001 DROP VIEW IF EXISTS `clientRisk`*/; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientRisk` ( + `clientFk` int(11) NOT NULL DEFAULT '0', + `companyFk` smallint(6) unsigned NOT NULL DEFAULT '0', + `amount` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`clientFk`,`companyFk`), + KEY `company_id` (`companyFk`), + CONSTRAINT `clientRisk_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `clientRisk_ibfk_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `clientRisk__` +-- + +DROP TABLE IF EXISTS `clientRisk__`; +/*!50001 DROP VIEW IF EXISTS `clientRisk__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientRisk` AS SELECT +/*!50001 CREATE VIEW `clientRisk__` AS SELECT 1 AS `clientFk`, 1 AS `companyFk`, 1 AS `amount`*/; @@ -18391,7 +19361,7 @@ CREATE TABLE `cmr` ( `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `cmr_fk1_idx` (`ticketFk`), - CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE + CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -18487,8 +19457,11 @@ CREATE TABLE `collection` ( `id` int(11) NOT NULL AUTO_INCREMENT, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `workerFk` int(11) DEFAULT NULL, + `stateFk` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `ticketCollection_idx` (`workerFk`), + KEY `collection_id2_idx` (`stateFk`), + CONSTRAINT `collection_id2` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `ticketCollection` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -18524,6 +19497,7 @@ CREATE TABLE `collectionVolumetry` ( `level` int(10) unsigned NOT NULL DEFAULT '0', `lines` int(10) unsigned NOT NULL DEFAULT '1', `liters` int(10) unsigned NOT NULL DEFAULT '0', + `height` int(10) NOT NULL DEFAULT '20', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -18584,32 +19558,36 @@ CREATE TABLE `companyGroup` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `component` +-- Table structure for table `component` -- DROP TABLE IF EXISTS `component`; -/*!50001 DROP VIEW IF EXISTS `component`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `component` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `typeFk`, - 1 AS `classRate`, - 1 AS `tax`, - 1 AS `isRenewable`, - 1 AS `code`*/; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `component` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `typeFk` int(11) NOT NULL, + `classRate` smallint(6) DEFAULT NULL, + `tax` double DEFAULT NULL, + `isRenewable` tinyint(2) NOT NULL DEFAULT '1', + `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `series_componentes_idx` (`typeFk`), + KEY `comp` (`classRate`), + CONSTRAINT `serie_componente` FOREIGN KEY (`typeFk`) REFERENCES `componentType` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `componentRate` +-- Temporary table structure for view `componentRate__` -- -DROP TABLE IF EXISTS `componentRate`; -/*!50001 DROP VIEW IF EXISTS `componentRate`*/; +DROP TABLE IF EXISTS `componentRate__`; +/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `componentRate` AS SELECT +/*!50001 CREATE VIEW `componentRate__` AS SELECT 1 AS `id`, 1 AS `name`, 1 AS `componentTypeRate`, @@ -18620,32 +19598,67 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `componentType` +-- Table structure for table `componentType` -- DROP TABLE IF EXISTS `componentType`; -/*!50001 DROP VIEW IF EXISTS `componentType`*/; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `componentType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `base` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', + `isMargin` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `Serie_UNIQUE` (`type`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `componentTypeRate__` +-- + +DROP TABLE IF EXISTS `componentTypeRate__`; +/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `componentType` AS SELECT +/*!50001 CREATE VIEW `componentTypeRate__` AS SELECT 1 AS `id`, 1 AS `type`, - 1 AS `base`, + 1 AS `base`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `componentType__` +-- + +DROP TABLE IF EXISTS `componentType__`; +/*!50001 DROP VIEW IF EXISTS `componentType__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `componentType__` AS SELECT + 1 AS `id`, + 1 AS `type`, + 1 AS `isBase`, 1 AS `isMargin`*/; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `componentTypeRate` +-- Temporary table structure for view `component__` -- -DROP TABLE IF EXISTS `componentTypeRate`; -/*!50001 DROP VIEW IF EXISTS `componentTypeRate`*/; +DROP TABLE IF EXISTS `component__`; +/*!50001 DROP VIEW IF EXISTS `component__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `componentTypeRate` AS SELECT +/*!50001 CREATE VIEW `component__` AS SELECT 1 AS `id`, - 1 AS `type`, - 1 AS `base`*/; + 1 AS `name`, + 1 AS `typeFk`, + 1 AS `classRate`, + 1 AS `tax`, + 1 AS `isRenewable`, + 1 AS `code`*/; SET character_set_client = @saved_cs_client; -- @@ -18805,9 +19818,9 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`country_beforeUpdate` BEFORE UPDATE ON `country` FOR EACH ROW BEGIN - IF !(OLD.geoFk <=> NEW.geoFk) THEN - CALL zoneGeo_throwNotEditable; - END IF; + -- IF !(OLD.geoFk <=> NEW.geoFk) THEN + -- CALL zoneGeo_throwNotEditable; + -- END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -20971,9 +21984,6 @@ DELIMITER ;; BEFORE INSERT ON `item` FOR EACH ROW BEGIN DECLARE vDensity DOUBLE; - DECLARE vInsertId INT; - DECLARE vProducerFk VARCHAR(50); - DECLARE vInkName VARCHAR(50); IF NEW.density IS NULL THEN SELECT density INTO vDensity @@ -21178,8 +22188,10 @@ CREATE TABLE `itemCategory` ( `merchandise` tinyint(1) NOT NULL DEFAULT '1', `icon` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `isReclining` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), - UNIQUE KEY `reino_UNIQUE` (`name`) + UNIQUE KEY `reino_UNIQUE` (`name`), + KEY `itemCategory_idx3` (`merchandise`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -21211,6 +22223,19 @@ SET character_set_client = utf8; 1 AS `name`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `itemColor` +-- + +DROP TABLE IF EXISTS `itemColor`; +/*!50001 DROP VIEW IF EXISTS `itemColor`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `itemColor` AS SELECT + 1 AS `itemFk`, + 1 AS `color`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `itemConversor` -- @@ -21228,6 +22253,71 @@ CREATE TABLE `itemConversor` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona los item específicos con los genéricos'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `itemCost` +-- + +DROP TABLE IF EXISTS `itemCost`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemCost` ( + `itemFk` int(11) NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + `quantity` int(10) NOT NULL DEFAULT '0', + `rotation` decimal(10,4) NOT NULL DEFAULT '0.0000', + `cm3` int(11) NOT NULL DEFAULT '0', + `storage` decimal(10,4) NOT NULL DEFAULT '0.0000', + `handling` decimal(10,4) NOT NULL DEFAULT '0.0000', + `extraCharge` decimal(10,4) NOT NULL DEFAULT '0.0000', + `wasted` decimal(10,4) NOT NULL DEFAULT '0.0000', + `cm3delivery` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`itemFk`,`warehouseFk`), + KEY `warehouse_id_rotacion_idx` (`warehouseFk`), + CONSTRAINT `id_article_rotaci` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `warehouse_id_rotaci` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de rotacion en los ultimos 365 dias'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`itemCost_beforeInsert` BEFORE INSERT ON `vn`.`itemCost` FOR EACH ROW +BEGIN + IF NEW.itemFk IN (95, 98) THEN + SET NEW.cm3 = 0; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`itemCost_beforeUpdate` BEFORE UPDATE ON `vn`.`itemCost` FOR EACH ROW +BEGIN + IF NEW.itemFk IN (95, 98) THEN + SET NEW.cm3 = 0; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + -- -- Temporary table structure for view `itemEntryIn` -- @@ -21432,6 +22522,19 @@ SET character_set_client = utf8; 1 AS `sectorFk`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `itemProductor` +-- + +DROP TABLE IF EXISTS `itemProductor`; +/*!50001 DROP VIEW IF EXISTS `itemProductor`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `itemProductor` AS SELECT + 1 AS `itemFk`, + 1 AS `productor`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `itemRepo` -- @@ -22126,6 +23229,23 @@ CREATE TABLE `labourTree` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `lastTopClaims` +-- + +DROP TABLE IF EXISTS `lastTopClaims`; +/*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `lastTopClaims` AS SELECT + 1 AS `itemFk`, + 1 AS `itemName`, + 1 AS `itemTypeName`, + 1 AS `claimsNumber`, + 1 AS `claimedAmount`, + 1 AS `totalAmount`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `ledgerConfig` -- @@ -22419,7 +23539,9 @@ CREATE TABLE `orderTicket` ( `orderFk` int(10) unsigned NOT NULL, `ticketFk` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ticketFk`,`orderFk`), - KEY `order_id` (`orderFk`) + KEY `order_id` (`orderFk`), + CONSTRAINT `hedera_id` FOREIGN KEY (`orderFk`) REFERENCES `hedera`.`order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `idTicketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -22595,8 +23717,9 @@ CREATE TABLE `parking` ( `row` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT '--', `sectorFk` int(11) NOT NULL DEFAULT '2', `code` varchar(8) CHARACTER SET utf8 DEFAULT NULL, + `pickingOrder` int(11) DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `column_UNIQUE` (`column`,`row`), + UNIQUE KEY `column_UNIQUE` (`column`,`row`,`sectorFk`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `parking_fk1_idx` (`sectorFk`), CONSTRAINT `parking_fk1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -22857,9 +23980,9 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `postCode_beforeUpdate` BEFORE UPDATE ON `postCode` FOR EACH ROW BEGIN - IF !(OLD.geoFk <=> NEW.geoFk) THEN - CALL zoneGeo_throwNotEditable; - END IF; + -- IF !(OLD.geoFk <=> NEW.geoFk) THEN + -- CALL zoneGeo_throwNotEditable; + -- END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -22913,22 +24036,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Table structure for table `postCodeBack__` --- - -DROP TABLE IF EXISTS `postCodeBack__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `postCodeBack__` ( - `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `townFk` int(11) NOT NULL, - `geoFk` int(11) DEFAULT NULL, - PRIMARY KEY (`code`,`townFk`), - KEY `postCodeTownFk_idx2` (`townFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `priceBuilderTag__` -- @@ -23270,9 +24377,9 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`province_beforeUpdate` BEFORE UPDATE ON `province` FOR EACH ROW BEGIN - IF !(OLD.geoFk <=> NEW.geoFk) THEN - CALL zoneGeo_throwNotEditable; - END IF; + -- IF !(OLD.geoFk <=> NEW.geoFk) THEN + -- CALL zoneGeo_throwNotEditable; + -- END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -23962,7 +25069,7 @@ CREATE TABLE `saleComponent` ( PRIMARY KEY (`saleFk`,`componentFk`), KEY `fk_mov_comp_idx` (`componentFk`), CONSTRAINT `mc_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `mc_fk2` FOREIGN KEY (`componentFk`) REFERENCES `bi`.`tarifa_componentes` (`Id_Componente`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `mc_fk2` FOREIGN KEY (`componentFk`) REFERENCES `component` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -24074,6 +25181,29 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Temporary table structure for view `saleValue` +-- + +DROP TABLE IF EXISTS `saleValue`; +/*!50001 DROP VIEW IF EXISTS `saleValue`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `saleValue` AS SELECT + 1 AS `warehouse`, + 1 AS `client`, + 1 AS `clientTypeFk`, + 1 AS `buyer`, + 1 AS `family`, + 1 AS `itemFk`, + 1 AS `concept`, + 1 AS `quantity`, + 1 AS `cost`, + 1 AS `value`, + 1 AS `year`, + 1 AS `week`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `saleVolume` -- @@ -24127,6 +25257,8 @@ CREATE TABLE `sector` ( `pickingPlacement` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `path` int(11) DEFAULT NULL, `isPreviousPrepared` tinyint(1) NOT NULL DEFAULT '0', + `isPackagingArea` tinyint(1) NOT NULL DEFAULT '0', + `labelReport` int(11) DEFAULT NULL, PRIMARY KEY (`id`,`warehouseFk`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `sector_fk1_idx` (`warehouseFk`), @@ -24158,21 +25290,18 @@ CREATE TABLE `sharingCart` ( /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeInsert` BEFORE INSERT ON `sharingCart` FOR EACH ROW BEGIN - SET NEW.started = GREATEST(CURDATE(),NEW.started); - SET NEW.ended = GREATEST(CURDATE(),NEW.ended); - - IF NEW.workerFk = NEW.workerSubstitute THEN - SET NEW.workerFk = NULL; -END IF; + IF NEW.workerFk = NEW.workerSubstitute THEN + CALL util.throw ('worker and workerSubstitute must be different'); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24182,20 +25311,16 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeUpdate` BEFORE UPDATE ON `sharingCart` FOR EACH ROW - BEGIN - SET NEW.started = GREATEST(CURDATE(),NEW.started); - SET NEW.ended = GREATEST(CURDATE(),NEW.ended); - - IF NEW.workerFk = NEW.workerSubstitute THEN - SET NEW.workerFk = NULL; + IF NEW.workerFk = NEW.workerSubstitute THEN + CALL util.throw ('worker and workerSubstitute must be different'); END IF; END */;; DELIMITER ; @@ -24204,6 +25329,27 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `sharingCartDaily` +-- + +DROP TABLE IF EXISTS `sharingCartDaily`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sharingCartDaily` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ownerFk` int(11) NOT NULL, + `substituteFk` int(11) NOT NULL, + `dated` date NOT NULL, + `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `sharingCartDailyWorker_idx` (`ownerFk`,`dated`), + KEY `sharingCartDailySubstitute_idx` (`substituteFk`), + CONSTRAINT `sharingCartDailySubstitute` FOREIGN KEY (`substituteFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sharingCartDailyWorker` FOREIGN KEY (`ownerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='para calcular las comisiones de las sustituciones de los comerciales'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `sharingClient` -- @@ -24484,6 +25630,7 @@ CREATE TABLE `state` ( `isPreviousPreparable` tinyint(1) NOT NULL DEFAULT '0', `isPicked` tinyint(1) NOT NULL DEFAULT '0', `isPreparable` tinyint(1) NOT NULL DEFAULT '0', + `semaphore` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -24845,6 +25992,20 @@ CREATE TABLE `taxType` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `thermograph` +-- + +DROP TABLE IF EXISTS `thermograph`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `thermograph` ( + `id` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `model` enum('TL30','SENSITECH','TREKVIEW1','TREKVIEW2','DISPOSABLE','TEMPMATE') COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `ticket` -- @@ -25109,6 +26270,19 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `ticketDocumentation` +-- + +DROP TABLE IF EXISTS `ticketDocumentation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketDocumentation` ( + `ticketFk` int(11) NOT NULL, + PRIMARY KEY (`ticketFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Marca si se ha revisado el ticket para aportar la documentación CRM/DUA (relativa al trasporte internacional de mercancias)'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `ticketDown` -- @@ -25337,6 +26511,7 @@ CREATE TABLE `ticketParking` ( `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `ticketParking_idx1` (`ticketFk`,`parkingFk`), + UNIQUE KEY `ticketFk_UNIQUE` (`ticketFk`), KEY `ticketParking_fk1_idx` (`parkingFk`), CONSTRAINT `ticketParking_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketParking_fk2` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON UPDATE CASCADE @@ -25735,9 +26910,9 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `town_beforeUpdate` BEFORE UPDATE ON `town` FOR EACH ROW BEGIN - IF !(OLD.geoFk <=> NEW.geoFk) THEN - CALL zoneGeo_throwNotEditable; - END IF; + -- IF !(OLD.geoFk <=> NEW.geoFk) THEN + -- CALL zoneGeo_throwNotEditable; + -- END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25947,7 +27122,7 @@ BEGIN SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) WHERE travelFk = NEW.id; END IF; - +/* IF !(ABS(NEW.isDelivered) <=> ABS(OLD.isDelivered)) THEN INSERT INTO vn2008.travel_dits SET @@ -25956,7 +27131,7 @@ BEGIN Id_Ticket = NEW.id, value_old = OLD.isDelivered, value_new = NEW.isDelivered; - END IF; + END IF; */ END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25988,7 +27163,7 @@ CREATE TABLE `travelLog` ( KEY `userFk` (`userFk`), CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26042,7 +27217,7 @@ CREATE TABLE `travelThermograph` ( KEY `travel_id` (`travelFk`), KEY `warehouse_id` (`warehouseFk`), CONSTRAINT `travelThermographDmsFgn` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelThermographThermographFgn` FOREIGN KEY (`thermographFk`) REFERENCES `vn2008`.`thermograph` (`thermograph_id`) ON UPDATE CASCADE, + CONSTRAINT `travelThermographThermographFgn` FOREIGN KEY (`thermographFk`) REFERENCES `thermograph` (`id`) ON UPDATE CASCADE, CONSTRAINT `travelThermographTravelFgn` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`), CONSTRAINT `travelThermographWarehouseFgn` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registra cada termografo que se ha introducido en cada travel'; @@ -26199,11 +27374,15 @@ CREATE TABLE `warehouse` ( `hasDms` tinyint(1) NOT NULL DEFAULT '0', `pickUpAgencyModeFk` int(11) DEFAULT NULL, `isBuyerToBeEmailed` tinyint(2) NOT NULL DEFAULT '0', + `aliasFk` smallint(5) unsigned DEFAULT NULL, + `labelReport` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `Id_Paises` (`countryFk`), KEY `isComparativeIdx` (`isComparative`), - CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) + KEY `warehouse_ibfk_1_idx` (`aliasFk`), + CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`), + CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk`) REFERENCES `warehouseAlias` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -26261,7 +27440,8 @@ DROP TABLE IF EXISTS `warehouseAlias`; CREATE TABLE `warehouseAlias` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27062,6 +28242,7 @@ CREATE TABLE `zone` ( `bonus` double NOT NULL DEFAULT '0', `isVolumetric` tinyint(1) NOT NULL DEFAULT '0', `inflation` decimal(5,2) NOT NULL DEFAULT '1.00', + `m3Max` decimal(10,2) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_zone_1_idx` (`warehouseFk__`), KEY `fk_zone_2_idx` (`agencyModeFk`), @@ -27088,6 +28269,35 @@ CREATE TABLE `zoneCalendar` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `zoneClosure` +-- + +DROP TABLE IF EXISTS `zoneClosure`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneClosure` ( + `zoneFk` int(11) NOT NULL, + `dated` date NOT NULL, + `hour` time NOT NULL, + PRIMARY KEY (`zoneFk`,`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneConfig` +-- + +DROP TABLE IF EXISTS `zoneConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `scope` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `zoneEvent` -- @@ -27391,7 +28601,7 @@ DELIMITER ;; CLOSE vCur; INSERT INTO vn2008.mail (`to`, subject, text) - VALUES ('cau@verdnatura.es', + VALUES ('cau@verdnatura.es, sysadmin@verdnatura.es', 'servidor de impresion parado', CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '')); @@ -28065,9 +29275,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -28122,8 +29332,8 @@ BEGIN AND payed > vDateEnd UNION ALL SELECT SUM(amount) - FROM bi.customer_risk r - WHERE customer_id = vClient + FROM clientRisk + WHERE clientFk = vClient UNION ALL SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2)) FROM hedera.tpvTransaction @@ -29130,9 +30340,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -29187,14 +30397,14 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.workerComercial; CREATE TEMPORARY TABLE tmp.workerComercial ENGINE = MEMORY - SELECT worker FROM `grant` g - JOIN grantGroup gg ON g.`group` = gg.id + SELECT workerFk as worker FROM `grant` g + JOIN grantGroup gg ON g.`groupFk` = gg.id WHERE gg.description = 'Comerciales'; DELETE wc.* FROM tmp.workerComercial wc - JOIN `grant` g ON g.worker = wc.worker - JOIN grantGroup gg ON g.`group` = gg.id + JOIN `grant` g ON g.workerFk = wc.worker + JOIN grantGroup gg ON g.`groupFk` = gg.id WHERE gg.description = 'Gerencia'; DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; @@ -30195,10 +31405,10 @@ BEGIN DECLARE vWarehouseId INTEGER; DECLARE vVolume DECIMAL(10,3); - SELECT IFNULL(SUM(o.amount * i.compression * r.cm3)/1000000,0) INTO vVolume + SELECT IFNULL(SUM(o.amount * i.compression * ic.cm3)/1000000,0) INTO vVolume FROM hedera.orderRow o - JOIN vn.item i ON i.id = o.itemFk - JOIN bi.rotacion r on r.Id_Article = o.itemFk AND r.warehouse_id = o.warehouseFk + JOIN item i ON i.id = o.itemFk + JOIN itemCost ic on ic.itemFk = o.itemFk AND ic.warehouseFk = o.warehouseFk WHERE o.orderFk = vOrderId; RETURN vVolume; @@ -30886,6 +32096,45 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `worker_isWorking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN +/** + * Comprueba si el trabajador está trabajando en el momento de la consulta + * @return Devuelve TRUE en caso de que este trabajando. Si se encuentra en un descanso devolverá FALSE + */ + DECLARE vLastIn DATETIME ; + + SELECT MAX(timed) INTO vLastIn + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND + direction = 'in'; + + IF (SELECT MOD(COUNT(*),2) + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND + timed >= vLastIn + ) THEN + RETURN TRUE; + ELSE + RETURN FALSE; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `xdiario_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -32107,9 +33356,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -32238,13 +33487,13 @@ proc: BEGIN INSERT INTO tmp.ticketComponent SELECT tcb.warehouseFk, tcb.itemFk, - cr.id, - GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3) + c.id, + GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3) FROM tmp.ticketComponentBase tcb - JOIN componentRate cr + JOIN `component` c JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; + WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; INSERT INTO tmp.ticketComponent SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3 @@ -32291,9 +33540,9 @@ proc: BEGIN vSpecialPriceComponent, sp.value - SUM(tcc.cost) sumCost FROM tmp.ticketComponentCopy tcc - JOIN componentRate cr ON cr.id = tcc.componentFk + JOIN `component` c ON c.id = tcc.componentFk JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - WHERE cr.classRate IS NULL + WHERE c.classRate IS NULL GROUP BY tcc.itemFk, tcc.warehouseFk HAVING ABS(sumCost) > 0.001; @@ -32301,10 +33550,10 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.ticketComponentSum (INDEX (itemFk, warehouseFk)) ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate + SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate FROM tmp.ticketComponent tc - JOIN componentRate cr ON cr.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate; + JOIN `component` c ON c.id = tc.componentFk + GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY @@ -32373,9 +33622,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -32414,6 +33663,7 @@ BEGIN LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL; DELETE FROM claim WHERE ticketCreated < v18Month; DELETE FROM message WHERE sendDate < vDateShort; + DELETE FROM travelLog WHERE creationDate < v3Month; DELETE sc FROM saleChecked sc JOIN sale s ON sc.saleFk = s.id WHERE s.created < vDateShort; DELETE bm @@ -32678,9 +33928,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -32713,10 +33963,10 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tClientRisk; CREATE TEMPORARY TABLE tClientRisk ENGINE = MEMORY - SELECT cr.customer_id clientFk, SUM(cr.amount) amount - FROM bi.customer_risk cr - JOIN tmp.clientGetDebt c ON c.clientFk = cr.customer_id - GROUP BY cr.customer_id; + SELECT cr.clientFk, SUM(cr.amount) amount + FROM clientRisk cr + JOIN tmp.clientGetDebt c ON c.clientFk = cr.clientFk + GROUP BY cr.clientFk; INSERT INTO tClientRisk SELECT c.clientFk, SUM(r.amountPaid) @@ -33164,35 +34414,31 @@ BEGIN DECLARE vNewTicket INT DEFAULT 0; - IF account.myUserHasRole('administrative') THEN - - CALL vn.clientPackagingOverstock(vClientFk,vGraceDays); - - CALL vn.ticketCreate( - vClientFk - ,curdate() - ,1 -- Silla FV - ,442 -- Verdnatura - ,NULL -- address - ,2 -- Rec_Silla - ,NULL -- route - ,curdate() - ,vNewTicket); - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) - SELECT vNewTicket, cpo.itemFk, - cpo.abonables, i.longName, p.price - FROM tmp.clientPackagingOverstock cpo - JOIN vn.item i ON i.id = cpo.itemFk - JOIN vn.packaging p ON p.itemFk = cpo.itemFk - WHERE cpo.abonables > 0; - - INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) - SELECT vNewTicket, p.id, cpo.abonables - FROM tmp.clientPackagingOverstock cpo - JOIN vn.packaging p ON p.itemFk = cpo.itemFk - WHERE cpo.abonables > 0; + CALL vn.clientPackagingOverstock(vClientFk,vGraceDays); - END IF; + CALL vn.ticketCreate( + vClientFk + ,curdate() + ,1 -- Silla FV + ,442 -- Verdnatura + ,NULL -- address + ,2 -- Rec_Silla + ,NULL -- route + ,curdate() + ,vNewTicket); + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) + SELECT vNewTicket, cpo.itemFk, - cpo.abonables, i.longName, p.price + FROM tmp.clientPackagingOverstock cpo + JOIN vn.item i ON i.id = cpo.itemFk + JOIN vn.packaging p ON p.itemFk = cpo.itemFk + WHERE cpo.abonables > 0; + + INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) + SELECT vNewTicket, p.id, cpo.abonables + FROM tmp.clientPackagingOverstock cpo + JOIN vn.packaging p ON p.itemFk = cpo.itemFk + WHERE cpo.abonables > 0; SELECT vNewTicket; @@ -33327,70 +34573,56 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clonTravelComplete`(IN `vTravelFk` INT, IN `vDateStart` DATE, IN `vDateEnd` DATE, IN `vRef` VARCHAR(255)) BEGIN - DECLARE vTravelNew INT; - DECLARE vEntryNew INT; - DECLARE vDone BIT DEFAULT 0; - DECLARE vAuxEntryFk INT; - DECLARE vRsEntry CURSOR FOR - SELECT e.id - FROM entry e - JOIN travel t - ON t.id = e.travelFk - WHERE e.travelFk = vTravelFk; - - DECLARE vRsBuy CURSOR FOR - SELECT b.* - FROM buy b - JOIN entry e - ON b.entryFk = e.id - WHERE e.travelFk = vTravelNew and b.entryFk=entryNew - ORDER BY e.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) - SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg - FROM travel - WHERE id = vTravelFk; - - SET vTravelNew = LAST_INSERT_ID(); - SET vDone = 0; - OPEN vRsEntry ; - FETCH vRsEntry INTO vAuxEntryFk; + DECLARE vTravelNew INT; + DECLARE vEntryNew INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vAuxEntryFk INT; + DECLARE vRsEntry CURSOR FOR + SELECT e.id + FROM entry e + JOIN travel t + ON t.id = e.travelFk + WHERE e.travelFk = vTravelFk; - WHILE NOT vDone DO - INSERT INTO entry (supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - travelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk) - SELECT supplierFk, + DECLARE vRsBuy CURSOR FOR + SELECT b.* + FROM buy b + JOIN entry e + ON b.entryFk = e.id + WHERE e.travelFk = vTravelNew and b.entryFk=entryNew + ORDER BY e.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) + SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg + FROM travel + WHERE id = vTravelFk; + + SET vTravelNew = LAST_INSERT_ID(); + SET vDone = FALSE; + OPEN vRsEntry ; + FETCH vRsEntry INTO vAuxEntryFk; + + WHILE NOT vDone DO + INSERT INTO entry (supplierFk, ref, isInventory, isConfirmed, @@ -33399,66 +34631,295 @@ BEGIN commission, created, evaNotes, - vTravelNew, + travelFk, currencyFk, companyFk, gestDocFk, - invoiceInFk - FROM entry - WHERE id = vAuxEntryFk; - - SET vEntryNew = LAST_INSERT_ID(); - + invoiceInFk) + SELECT supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + vTravelNew, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk + FROM entry + WHERE id = vAuxEntryFk; + + SET vEntryNew = LAST_INSERT_ID(); + + + INSERT INTO buy (entryFk, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight) + SELECT vEntryNew, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight + FROM buy + WHERE entryFk = vAuxEntryFk; + + + FETCH vRsEntry INTO vAuxEntryFk; + END WHILE; + CLOSE vRsEntry; + COMMIT; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collectionPlacement_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionPlacement_get`(vCollectionFk INT) +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.parked; + CREATE TEMPORARY TABLE tmp.parked + ENGINE MEMORY + SELECT s.itemFk, 0 as quantity + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk; + + UPDATE tmp.parked pk + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = pk.itemFk + SET pk.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + ENGINE MEMORY + SELECT itemFk, `grouping` + FROM ( + SELECT itemFk, + CASE groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN packing + ELSE `grouping` + END AS `grouping` + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + WHERE tr.warehouseInFk = vWarehouseFk + AND landed BETWEEN (SELECT FechaInventario FROM vn2008.tblContadores LIMIT 1) AND CURDATE() + AND b.isIgnored = FALSE + ORDER BY tr.landed DESC + ) sub + GROUP BY sub.itemFk ; - INSERT INTO buy (entryFk, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked) - SELECT vEntryNew, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked - FROM buy - WHERE entryFk = vAuxEntryFk; - - - FETCH vRsEntry INTO vAuxEntryFk; - END WHILE; - CLOSE vRsEntry; - COMMIT; - END ;; + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE MEMORY + SELECT * FROM tmp.`grouping`; + + SELECT s.id as saleFk, s.itemFk, + p.code COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + IFNULL(p.pickingOrder,0) as `order`, + IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`) as `grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + JOIN tmp.`grouping` g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + AND w.aliasFk = vWarehouseAliasFk + UNION ALL + SELECT s.id as saleFk, s.itemFk, + ip.code COLLATE utf8_general_ci as placement, + '' COLLATE utf8_general_ci as shelving, + modificationDate as created, + v.visible - p.quantity as visible, + IFNULL(cpd.id,0) as `order`, + g.`grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemPlacement ip ON ip.itemFk = s.itemFk AND ip.warehouseFk = vWarehouseFk + LEFT JOIN vn.coolerPathDetail cpd ON cpd.hallway = LEFT(ip.`code`,3) + JOIN tmp.parked p ON p.itemFk = s.itemFk + JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vCalcFk + LEFT JOIN tmp.grouping2 g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + -- HAVING visible > 0 + ; + + DROP TEMPORARY TABLE + tmp.parked, + tmp.`grouping`, + tmp.grouping2; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collectionSale_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionSale_get`(vCollectionFk INT) +BEGIN + + SELECT ticketFk, + saleFk, + itemFk, + quantity, + longName, + size, + reserved, + max(isPreviousPrepared) as isPreviousPrepared, + max(isPrepared) as isPrepared, + max(isControlled) as isControlled, + color, + productor, + discount, + price, + stems, + category, + origin, + clientFk + FROM ( + SELECT s.ticketFk, + s.id as saleFk, + s.itemFk, + s.quantity, + i.longName, + i.size, + s.reserved, + IF(st.semaphore <=> 1, TRUE, FALSE) as isPreviousPrepared, + IF(st.semaphore <=> 2, TRUE, FALSE) as isPrepared, + IF(st.semaphore <=> 3, TRUE, FALSE) as isControlled, + ic.color, + ip.productor, + s.discount, + s.price, + i.stems, + i.category, + o.code AS origin, + t.clientFk + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.saleTracking str ON str.saleFk = s.id AND str.isChecked = 1 + LEFT JOIN vn.state st ON st.id = str.stateFk + LEFT JOIN vn.itemColor ic ON ic.itemFk = s.itemFk + LEFT JOIN vn.itemProductor ip ON ip.itemFk = s.itemFk + LEFT JOIN vn.origin o ON o.id = i.originFk + JOIN vn.ticketCollection tc ON tc.ticketFk = s.ticketFk + JOIN vn.ticket t ON t.id = tc.ticketFk + + WHERE tc.collectionFk = vCollectionFk + + ) sub + GROUP BY saleFk + HAVING quantity > 0 + + UNION ALL + + SELECT stow.shipFk, + stow.id as stowawayFk, + 0, + 1, + CONCAT('POLIZON T',stow.id), + 0 AS size, + 0 AS reserved, + IF(st.semaphore <=> 1,TRUE, FALSE) as isPreviousPrepared, + IF(st.semaphore <=> 2,TRUE, FALSE) as isPrepared, + IF(st.semaphore <=> 3,TRUE, FALSE) as isControlled, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + FROM vn.ticketCollection tc + JOIN vn.stowaway stow ON stow.shipFk = tc.ticketFk + LEFT JOIN vn.ticketState ts ON ts.ticketFk = stow.id + LEFT JOIN vn.state st ON st.id = ts.stateFk + WHERE tc.collectionFk = vCollectionFk; + +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -33476,17 +34937,87 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `collectionStickers_print`(vCollectionFk INT) BEGIN - + UPDATE vn.ticket t JOIN vn.ticketCollection tc ON tc.ticketFk = t.id SET t.notes = CONCAT('COL ',vCollectionFk,'-',tc.`level`) WHERE tc.collectionFk = vCollectionFk; - - INSERT INTO vn.printServerQueue(reportFk, param1, workerFk) - SELECT 23, tc.ticketFk, getUser() + + INSERT INTO vn.printServerQueue(reportFk, param1, workerFk) + SELECT w.labelReport, tc.ticketFk, getUser() FROM vn.ticketCollection tc + JOIN vn.ticket t ON t.id = tc.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk WHERE tc.collectionFk = vCollectionFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collectionSticker_print` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionSticker_print`(vCollectionFk INT, vSectorFk INT) +BEGIN + DECLARE vLabelReport INT; + + UPDATE vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + SET t.notes = CONCAT('COL ',vCollectionFk,'-',tc.`level`) + WHERE tc.collectionFk = vCollectionFk; + + SELECT labelReport INTO vLabelReport + FROM vn.sector + WHERE id = vSectorFk; + + IF vLabelReport THEN + + INSERT INTO vn.printServerQueue(reportFk, param1, workerFk) + SELECT vLabelReport, ticketFk, getUser() + FROM vn.ticketCollection + WHERE collectionFk = vCollectionFk; + + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collectionTicket_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionTicket_get`(vCollectionFk INT) +BEGIN + + SELECT tc.ticketFk, + tc.level, + am.name as agencyName, + t.warehouseFk + FROM vn.ticketCollection tc + JOIN vn.ticket t ON t.id = tc.ticketFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk + WHERE tc.collectionFk = vCollectionFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -33509,37 +35040,41 @@ proc:BEGIN DECLARE vIsPreviousPrepared BOOLEAN; DECLARE vCollectionFk INT; DECLARE vWarehouseFk INT; + DECLARE vTicketLiters INT; DECLARE vTicketLines INT; DECLARE vTicketFk INT; + DECLARE vTicketHeight INT; + DECLARE vTicketHeightTop INT; + DECLARE vTicketHeightFloor INT; DECLARE vIsTicketCollected BOOLEAN; DECLARE vMaxTickets INT; DECLARE vStateFk INT; + DECLARE vTopTicketFk INT; + DECLARE vFloorTicketFk INT; + DECLARE vVolumetryLiters INT; DECLARE vVolumetryLines INT; DECLARE vVolumetryFk INT; DECLARE vVolumetryLevel INT; + DECLARE vVolumetryHeight INT; DECLARE vVolumetryLitersMax INT; DECLARE vVolumetryLinesMax INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vVolumetryHeightTop INT; + DECLARE vVolumetryHeightFloor INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vWorkerCode VARCHAR(3); + DECLARE cVolumetry CURSOR FOR - SELECT level, liters, `lines` + SELECT level, liters, `lines`, height FROM vn.collectionVolumetry ORDER BY `level`; DECLARE cTicket CURSOR FOR - SELECT pb.Id_Ticket ticketFk, - pb.lines, - pb.m3 * 1000 liters - FROM tmp.production_buffer pb - JOIN vn.state s ON s.id = pb.state - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket - WHERE pb.problems = 0 - AND tc.ticketFk IS NULL - AND s.isPreparable - ORDER BY pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT vMaxTickets; + SELECT * + FROM tmp.ticket + ORDER BY height DESC; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -33548,6 +35083,11 @@ proc:BEGIN FROM vn.sector WHERE id = vSectorFk; + SELECT w.code + INTO vWorkerCode + FROM vn.worker w + WHERE w.id = account.myUserGetId(); + IF vIsPreviousPrepared THEN SELECT id INTO vStateFk @@ -33567,26 +35107,116 @@ proc:BEGIN CALL vn2008.production_control_source(vWarehouseFk, 0); - -- Empieza el bucle - OPEN cVolumetry; - OPEN cTicket; + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - DROP TEMPORARY TABLE IF EXISTS tmp.kk; - CREATE TEMPORARY TABLE tmp.kk - SELECT pb.Id_Ticket ticketFk,pb.Hora, pb.Minuto, + -- Recogida Silla requiere carros individuales + + IF (SELECT pb.Agencia + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT 1) = 'REC_SILLA' THEN + + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.Id_Ticket ticketFk, pb.lines, - pb.m3 * 1000 liters + pb.m3 * 1000 liters, + 0 as height FROM tmp.production_buffer pb JOIN vn.state s ON s.id = pb.state LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket WHERE pb.problems = 0 AND tc.ticketFk IS NULL - AND s.isPreparable - ORDER BY pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT vMaxTickets; + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT 1; - FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters; - FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines; + ELSE + + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.Id_Ticket ticketFk, + pb.lines, + pb.m3 * 1000 liters, + 0 as height + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND pb.Agencia != 'REC_SILLA' + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT vMaxTickets; + + -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + CREATE TEMPORARY TABLE tmp.ticket2 + SELECT MAX(i.size) maxHeigth, t.ticketFk + FROM tmp.ticket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.isReclining = FALSE + GROUP BY t.ticketFk; + + UPDATE tmp.ticket t + JOIN tmp.ticket2 t2 ON t2.ticketFk = t.ticketFk + SET t.height = t2.maxHeigth; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + -- Si hay un ticket con una planta que supera la máxima altura para la bandeja superior, el pedido ha de ser único. Por tanto, eliminamos el resto. + -- Si hay dos tickets con plantas que superen la medida inferior, el carro llevará una bandeja. Hay que eliminar los otros dos. + + SELECT height, ticketFk + INTO vTicketHeightTop, vTopTicketFk + FROM tmp.ticket + ORDER BY height DESC + LIMIT 1; + + SELECT max(height) + INTO vVolumetryHeightTop + FROM vn.collectionVolumetry; + + SELECT height, ticketFk + INTO vTicketHeightFloor, vFloorTicketFk + FROM tmp.ticket + WHERE ticketFk != vTopTicketFk + ORDER BY height DESC + LIMIT 1; + + SELECT height + INTO vVolumetryHeightFloor + FROM vn.collectionVolumetry + WHERE level = 1; + /* + IF vTicketHeightTop > vVolumetryHeightTop + OR vTicketHeightFloor > vVolumetryHeightFloor THEN + + DELETE FROM tmp.ticket WHERE ticketFk != vTopTicketFk; + + ELSEIF vTicketHeightFloor <= vVolumetryHeightFloor THEN + + DELETE FROM tmp.ticket WHERE ticketFk NOT IN (vTopTicketFk, vFloorTicketFk); + + END IF; + */ + + + END IF; + + + -- Empieza el bucle + OPEN cVolumetry; + OPEN cTicket; + + FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters, vTicketHeight; + FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; IF NOT vDone THEN @@ -33600,7 +35230,9 @@ proc:BEGIN bucle:WHILE NOT vDone DO IF (vVolumetryLitersMax < vTicketLiters OR vVolumetryLinesMax < vTicketLines) AND vVolumetryLevel > 1 THEN - LEAVE bucle; + + LEAVE bucle; + END IF; SELECT COUNT(*) INTO vIsTicketCollected @@ -33635,7 +35267,520 @@ proc:BEGIN SET vTicketLines = GREATEST(0,vTicketLines - vVolumetryLines); IF vVolumetryLitersMax = 0 OR vVolumetryLinesMax = 0 THEN + LEAVE bucle; + + END IF; + + IF vTicketLiters > 0 OR vTicketLines > 0 THEN + + FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; + + ELSE + + FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters, vTicketHeight; + FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; + + END IF; + + END WHILE; + + + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + INSERT IGNORE INTO vn.ticketDown(ticketFk) + SELECT DISTINCT tc.ticketFk + FROM vn.ticketCollection tc + JOIN vncontrol.inter vi ON vi.Id_Ticket = tc.ticketFk + JOIN vn.state st ON st.id = vi.state_id + JOIN vn.ticket t ON t.id = tc.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + AND w.name = 'Silla FV' + AND st.code = 'PREVIOUS_PREPARATION'; + + + SELECT vCollectionFk; + + CLOSE cVolumetry; + CLOSE cTicket; + -- DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + -- DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collection_new_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collection_new_beta`(vSectorFk INT) +proc:BEGIN + + DECLARE vIsPreviousPrepared BOOLEAN; + DECLARE vCollectionFk INT; + DECLARE vWarehouseFk INT; + + DECLARE vTicketLiters INT; + DECLARE vTicketLines INT; + DECLARE vTicketFk INT; + DECLARE vTicketHeight INT; + DECLARE vTicketHeightTop INT; + DECLARE vTicketHeightFloor INT; + DECLARE vIsTicketCollected BOOLEAN; + DECLARE vMaxTickets INT; + DECLARE vStateFk INT; + DECLARE vTopTicketFk INT; + DECLARE vFloorTicketFk INT; + + DECLARE vVolumetryLiters INT; + DECLARE vVolumetryLines INT; + DECLARE vVolumetryFk INT; + DECLARE vVolumetryLevel INT; + DECLARE vVolumetryHeight INT; + DECLARE vVolumetryLitersMax INT; + DECLARE vVolumetryLinesMax INT; + DECLARE vVolumetryHeightTop INT; + DECLARE vVolumetryHeightFloor INT; + + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vWorkerCode VARCHAR(3); + + DECLARE cVolumetry CURSOR FOR + SELECT level, liters, `lines`, height + FROM vn.collectionVolumetry + ORDER BY `level`; + + DECLARE cTicket CURSOR FOR + SELECT * + FROM tmp.ticket + ORDER BY height DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SELECT isPreviousPrepared, warehouseFk + INTO vIsPreviousPrepared, vWarehouseFk + FROM vn.sector + WHERE id = vSectorFk; + + SELECT w.code + INTO vWorkerCode + FROM vn.worker w + WHERE w.id = account.myUserGetId(); + + IF vIsPreviousPrepared THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'PREVIOUS_PREPARATION'; + ELSE + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'ON_PREPARATION'; + + END IF; + + SELECT COUNT(*), sum(liters), sum(`lines`) + INTO vMaxTickets, vVolumetryLitersMax, vVolumetryLinesMax + FROM vn.collectionVolumetry; + + CALL vn2008.production_control_source(vWarehouseFk, 0); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + + -- Recogida Silla requiere carros individuales + + IF (SELECT pb.Agencia + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT 1) = 'REC_SILLA' THEN + + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.Id_Ticket ticketFk, + pb.lines, + pb.m3 * 1000 liters, + 0 as height + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT 1; + + ELSE + + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.Id_Ticket ticketFk, + pb.lines, + pb.m3 * 1000 liters, + 0 as height + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND pb.Agencia != 'REC_SILLA' + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT vMaxTickets; + + -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + CREATE TEMPORARY TABLE tmp.ticket2 + SELECT MAX(i.size) maxHeigth, t.ticketFk + FROM tmp.ticket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.isReclining = FALSE + GROUP BY t.ticketFk; + + UPDATE tmp.ticket t + JOIN tmp.ticket2 t2 ON t2.ticketFk = t.ticketFk + SET t.height = t2.maxHeigth; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + -- Si hay un ticket con una planta que supera la máxima altura para la bandeja superior, el pedido ha de ser único. Por tanto, eliminamos el resto. + -- Si hay dos tickets con plantas que superen la medida inferior, el carro llevará una bandeja. Hay que eliminar los otros dos. + + SELECT height, ticketFk + INTO vTicketHeightTop, vTopTicketFk + FROM tmp.ticket + ORDER BY height DESC + LIMIT 1; + + SELECT max(height) + INTO vVolumetryHeightTop + FROM vn.collectionVolumetry; + + SELECT height, ticketFk + INTO vTicketHeightFloor, vFloorTicketFk + FROM tmp.ticket + WHERE ticketFk != vTopTicketFk + ORDER BY height DESC + LIMIT 1; + + SELECT height + INTO vVolumetryHeightFloor + FROM vn.collectionVolumetry + WHERE level = 1; + + IF vTicketHeightTop > vVolumetryHeightTop + OR vTicketHeightFloor > vVolumetryHeightFloor THEN + + DELETE FROM tmp.ticket WHERE ticketFk != vTopTicketFk; + + ELSEIF vTicketHeightFloor <= vVolumetryHeightFloor THEN + + DELETE FROM tmp.ticket WHERE ticketFk NOT IN (vTopTicketFk, vFloorTicketFk); + + END IF; + + + + END IF; + + + -- Empieza el bucle + OPEN cVolumetry; + OPEN cTicket; + + FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters, vTicketHeight; + FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; + + IF NOT vDone THEN + + INSERT INTO vn.collection + SET workerFk = account.myUserGetId(); + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + END IF; + + bucle:WHILE NOT vDone DO + + IF (vVolumetryLitersMax < vTicketLiters OR vVolumetryLinesMax < vTicketLines) AND vVolumetryLevel > 1 THEN + + LEAVE bucle; + + END IF; + + SELECT COUNT(*) INTO vIsTicketCollected + FROM vn.ticketCollection + WHERE ticketFk = vTicketFk + AND collectionFk = vCollectionFk; + + IF vIsTicketCollected THEN + + UPDATE vn.ticketCollection + SET level = CONCAT(level, vVolumetryLevel) + WHERE ticketFk = vTicketFk + AND collectionFk = vCollectionFk; + + ELSE + + INSERT INTO vn.ticketCollection + SET collectionFk = vCollectionFk, + ticketFk = vTicketFk, + level = vVolumetryLevel; + + INSERT INTO vncontrol.inter + SET state_id = vStateFk, + Id_Ticket = vTicketFk, + Id_Trabajador = account.myUserGetId(); + + END IF; + + SET vVolumetryLitersMax = GREATEST(0,vVolumetryLitersMax - vVolumetryLiters); + SET vVolumetryLinesMax = GREATEST(0,vVolumetryLinesMax - vVolumetryLines); + SET vTicketLiters = GREATEST(0,vTicketLiters - vVolumetryLiters); + SET vTicketLines = GREATEST(0,vTicketLines - vVolumetryLines); + + IF vVolumetryLitersMax = 0 OR vVolumetryLinesMax = 0 THEN + + LEAVE bucle; + + END IF; + + IF vTicketLiters > 0 OR vTicketLines > 0 THEN + + FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; + + ELSE + + FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters, vTicketHeight; + FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; + + END IF; + + END WHILE; + + + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + INSERT IGNORE INTO vn.ticketDown(ticketFk) + SELECT DISTINCT tc.ticketFk + FROM vn.ticketCollection tc + JOIN vncontrol.inter vi ON vi.Id_Ticket = tc.ticketFk + JOIN vn.state st ON st.id = vi.state_id + JOIN vn.ticket t ON t.id = tc.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + AND w.name = 'Silla FV' + AND st.code = 'PREVIOUS_PREPARATION'; + + + SELECT vCollectionFk; + + CLOSE cVolumetry; + CLOSE cTicket; + -- DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + -- DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collection_new__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collection_new__`(vSectorFk INT) +proc:BEGIN + + DECLARE vIsPreviousPrepared BOOLEAN; + DECLARE vCollectionFk INT; + DECLARE vWarehouseFk INT; + DECLARE vTicketLiters INT; + DECLARE vTicketLines INT; + DECLARE vTicketFk INT; + DECLARE vIsTicketCollected BOOLEAN; + DECLARE vMaxTickets INT; + DECLARE vStateFk INT; + DECLARE vVolumetryLiters INT; + DECLARE vVolumetryLines INT; + DECLARE vVolumetryFk INT; + DECLARE vVolumetryLevel INT; + DECLARE vVolumetryLitersMax INT; + DECLARE vVolumetryLinesMax INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vWorkerCode VARCHAR(3); + + DECLARE cVolumetry CURSOR FOR + SELECT level, liters, `lines` + FROM vn.collectionVolumetry + ORDER BY `level`; + + DECLARE cTicket CURSOR FOR + SELECT * + FROM tmp.ticket; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SELECT isPreviousPrepared, warehouseFk + INTO vIsPreviousPrepared, vWarehouseFk + FROM vn.sector + WHERE id = vSectorFk; + + SELECT w.code + INTO vWorkerCode + FROM vn.worker w + WHERE w.id = account.myUserGetId(); + + IF vIsPreviousPrepared THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'PREVIOUS_PREPARATION'; + ELSE + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'ON_PREPARATION'; + + END IF; + + SELECT COUNT(*), sum(liters), sum(`lines`) + INTO vMaxTickets, vVolumetryLitersMax, vVolumetryLinesMax + FROM vn.collectionVolumetry; + + CALL vn2008.production_control_source(vWarehouseFk, 0); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + + IF (SELECT pb.Agencia + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT 1) = 'REC_SILLA' THEN + + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.Id_Ticket ticketFk, + pb.lines, + pb.m3 * 1000 liters + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT 1; + + ELSE + + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.Id_Ticket ticketFk, + pb.lines, + pb.m3 * 1000 liters + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE pb.problems = 0 + AND pb.Agencia != 'REC_SILLA' + AND tc.ticketFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC + LIMIT vMaxTickets; + + END IF; + + -- Empieza el bucle + OPEN cVolumetry; + OPEN cTicket; + + FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters; + FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines; + + IF NOT vDone THEN + + INSERT INTO vn.collection + SET workerFk = account.myUserGetId(); + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + END IF; + + bucle:WHILE NOT vDone DO + + IF (vVolumetryLitersMax < vTicketLiters OR vVolumetryLinesMax < vTicketLines) AND vVolumetryLevel > 1 THEN + + LEAVE bucle; + + END IF; + + SELECT COUNT(*) INTO vIsTicketCollected + FROM vn.ticketCollection + WHERE ticketFk = vTicketFk + AND collectionFk = vCollectionFk; + + IF vIsTicketCollected THEN + + UPDATE vn.ticketCollection + SET level = CONCAT(level, vVolumetryLevel) + WHERE ticketFk = vTicketFk + AND collectionFk = vCollectionFk; + + ELSE + + INSERT INTO vn.ticketCollection + SET collectionFk = vCollectionFk, + ticketFk = vTicketFk, + level = vVolumetryLevel; + + INSERT INTO vncontrol.inter + SET state_id = vStateFk, + Id_Ticket = vTicketFk, + Id_Trabajador = account.myUserGetId(); + + END IF; + + SET vVolumetryLitersMax = GREATEST(0,vVolumetryLitersMax - vVolumetryLiters); + SET vVolumetryLinesMax = GREATEST(0,vVolumetryLinesMax - vVolumetryLines); + SET vTicketLiters = GREATEST(0,vTicketLiters - vVolumetryLiters); + SET vTicketLines = GREATEST(0,vTicketLines - vVolumetryLines); + + IF vVolumetryLitersMax = 0 OR vVolumetryLinesMax = 0 THEN + + LEAVE bucle; + END IF; IF vTicketLiters > 0 OR vTicketLines > 0 THEN @@ -33651,10 +35796,29 @@ proc:BEGIN END WHILE; - SELECT vCollectionFk; + + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + INSERT IGNORE INTO vn.ticketDown(ticketFk) + SELECT DISTINCT tc.ticketFk + FROM vn.ticketCollection tc + JOIN vncontrol.inter vi ON vi.Id_Ticket = tc.ticketFk + JOIN vn.state st ON st.id = vi.state_id + JOIN vn.ticket t ON t.id = tc.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + AND w.name = 'Silla FV' + AND st.code = 'PREVIOUS_PREPARATION'; + + + SELECT vCollectionFk; CLOSE cVolumetry; CLOSE cTicket; + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; END ;; DELIMITER ; @@ -35673,17 +37837,17 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `getItemVisibleAvailable` */; +/*!50003 DROP PROCEDURE IF EXISTS `getItemVisibleAvailable__` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `getItemVisibleAvailable`( +CREATE DEFINER=`root`@`%` PROCEDURE `getItemVisibleAvailable__`( vItem INT, vDate DATE, vWarehouse TINYINT, @@ -36053,8 +38217,8 @@ proc: BEGIN SET @isModeInventory := FALSE; DELETE e, t - FROM travel t - JOIN entry e ON e.travelFk = t.id + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id WHERE e.supplierFk = 4 AND t.shipped <= vDeleteDate AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, CURDATE())); @@ -38421,14 +40585,71 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25)) BEGIN +/** + * Factura un conjunto de tickets. + * + * @param vInvoice, vTaxAreaFk + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + */ + DELETE FROM invoiceOutTax + WHERE invoiceOutFk = vInvoice; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM ticketToInvoice; + + CALL ticket_getTax(vTaxArea); + + INSERT INTO invoiceOutTax( + invoiceOutFk, + pgcFk, + taxableBase, + vat + ) + SELECT vInvoice, + pgcFk, + SUM(taxableBase) as BASE, + CAST(SUM(taxableBase) * rate / 100 AS DECIMAL (10,2)) + FROM tmp.ticketTax + GROUP BY pgcFk + HAVING BASE + ORDER BY priority; + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticketAmount; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceTaxMake__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceTaxMake__`(vInvoice INT, vTaxArea VARCHAR(25)) +BEGIN /** * Factura un conjunto de tickets. * @@ -38903,17 +41124,17 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemGetVisibleAvailable` */; +/*!50003 DROP PROCEDURE IF EXISTS `itemGetVisibleAvailable__` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemGetVisibleAvailable`( +CREATE DEFINER=`root`@`%` PROCEDURE `itemGetVisibleAvailable__`( vItem INT, vDate DATE, vWarehouse TINYINT, @@ -40917,6 +43138,201 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `item_ValuateInventory` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `item_ValuateInventory`(IN vDated DATE, IN vIsDetailed BOOLEAN) +BEGIN + + DECLARE vInventoried DATE; + DECLARE vHasNotInventory BOOLEAN DEFAULT 0; + DECLARE vInventoried2 DATE; + DECLARE vDateDayEnd DATETIME; + + SET vDateDayEnd = util.dayEnd(vDated); + SELECT landed INTO vInventoried + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed <= vDateDayEnd + AND E.supplierFk = 4 + ORDER BY landed DESC + LIMIT 1; + + SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); + + IF vHasNotInventory THEN + + SELECT landed INTO vInventoried2 + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed >= vDated + AND E.supplierFk = 4 + ORDER BY landed ASC + LIMIT 1; + + SET vInventoried = TIMESTAMPADD(DAY,1,vDated); + SET vDateDayEnd = vInventoried2; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS inv; + + CREATE TEMPORARY TABLE inv + (warehouseFk SMALLINT, + Id_Article BIGINT, + cantidad INT, + coste DOUBLE DEFAULT 0, + total DOUBLE DEFAULT 0, + Almacen VARCHAR(20), + PRIMARY KEY (Almacen, Id_Article) USING HASH) + ENGINE = MEMORY; + + IF vHasNotInventory = TRUE THEN + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, SUM(b.quantity), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = warehouseInFk + WHERE landed = vDateDayEnd + AND e.supplierFk = 4 + AND w.valuatedInventory + AND t.isInventory + GROUP BY tr.warehouseInFk, b.itemFk; + + END IF; + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity * IF(vHasNotInventory,-1,1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseInFk + WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd + AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseOutFk, b.itemFk, b.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,1,-1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); + + IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vDated AND vDateDayEnd + AND (s.isPicked <> 0 or t.isLabeled <> 0 ) + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); + + END IF; + + -- Mercancia en transito + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity, CONCAT(wOut.`name`,' - ', wIn.`name`) + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + WHERE vDated >= tr.shipped AND vDated < tr.landed + AND NOT isRaid + AND wIn.valuatedInventory + AND t.isInventory + AND e.isConfirmed + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); + + CALL vn.buyUltimate(NULL,vDateDayEnd); + + UPDATE inv i + JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.Id_Article = bu.itemFk + JOIN buy b ON b.id = bu.buyFk + SET total = i.cantidad * (ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0)), + coste = ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0) + WHERE i.cantidad <> 0; + + DELETE FROM inv WHERE Cantidad IS NULL or Cantidad = 0; + + IF vIsDetailed THEN + + SELECT inv.warehouseFk, i.id, i.name, i.size, inv.Cantidad, tp.code, + tp.categoryFk, inv.coste, cast(inv.total as decimal(10,2)) total,Almacen + FROM inv + JOIN warehouse w on w.id = warehouseFk + JOIN item i ON i.id = inv.Id_Article + JOIN itemType tp ON tp.id = i.typeFk + WHERE w.valuatedInventory + and inv.total > 0 + order by inv.total desc; + + ELSE + + SELECT i.Almacen, ic.name as Reino, cast(i.total as decimal(10,2)) as Euros, w.code as Comprador,it.id + FROM inv i + JOIN warehouse wh on wh.id = warehouseFk + JOIN item it ON it.id = i.Id_Article + JOIN itemType itp ON itp.id = it.typeFk + LEFT JOIN worker w ON w.id = itp.workerFk + JOIN itemCategory ic ON ic.id = itp.categoryFk + WHERE wh.valuatedInventory + AND i.total > 0; + + END IF; + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE inv; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `ledger_next` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -41818,10 +44234,10 @@ BEGIN o.itemFk, i.description, o.amount, - round(r.cm3 * i.compression * o.amount / 1000000,3) as volume + round(ic.cm3 * i.compression * o.amount / 1000000,3) as volume FROM hedera.orderRow o - JOIN vn.item i ON i.id = o.itemFk - JOIN bi.rotacion r ON r.Id_Article = o.itemFk AND r.warehouse_id = o.warehouseFk + JOIN item i ON i.id = o.itemFk + JOIN itemCost ic ON ic.itemFk = o.itemFk AND ic.warehouseFk = o.warehouseFk WHERE o.orderFk = vOrderId; END ;; DELIMITER ; @@ -42025,16 +44441,19 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT) +CREATE DEFINER=`root`@`%` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN) BEGIN DECLARE vColumn INT; DECLARE vRow INT; + DECLARE vLetters VARCHAR(26) DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; DECLARE vMaxId INT; + DECLARE vCode VARCHAR(8); SET vColumn = vFromColumn; SET vRow = vFromRow; - + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + SELECT MAX(id) INTO vMaxId FROM vn.parking; @@ -42042,20 +44461,23 @@ BEGIN WHILE vRow <= vToRow DO - INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`) - VALUES (vColumn, vRow, vSectorFk, CONCAT(LPAD(vColumn,3,'0'),'-',LPAD(vRow, 2,'0'))); + INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) + VALUES (vColumn, vRow, vSectorFk, vCode, vColumn ) + ON DUPLICATE KEY UPDATE `code` = vCode; SET vRow = vRow + 1; + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); END WHILE; SET vRow = vFromRow; - - SET vColumn = vColumn + 1; - + SET vColumn = vColumn + 1; + + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + END WHILE; - SELECT * FROM vn.parking WHERE id > vMaxId; + SELECT * FROM vn.parking WHERE `column` BETWEEN vFromColumn AND vToColumn; END ;; DELIMITER ; @@ -42627,9 +45049,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -42734,9 +45156,9 @@ BEGIN JOIN vn.ticket t ON t.routeFk = r.id JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.saleComponent sc ON sc.saleFk = s.id - JOIN vn.componentRate cr ON cr.id = sc.componentFk - JOIN vn.componentTypeRate ctr ON ctr.id = cr.componentTypeRate - WHERE ctr.type = 'agencia' + JOIN vn.`component` c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE ct.type = 'agencia' AND tm.year = vYear AND tm.month = vMonth GROUP BY r.id @@ -42965,48 +45387,46 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `saleMove`(IN vSaleFk BIGINT, IN vQuantity BIGINT) BEGIN --- JGF is working in this file 2019-12-20 - DECLARE vclientFk INT; + DECLARE vShipped DATE; DECLARE vWarehouseFk INT; - DECLARE vCompanyFk INT; DECLARE vAddressFk INT; DECLARE vAgencyModeFk INT; DECLARE vNewTicket BIGINT; DECLARE vNewSale BIGINT; DECLARE vLanded DATE; - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - DECLARE vAuxId INT; - DECLARE vNumLine INT; + DECLARE vShippedDayEnd DATETIME; + DECLARE vTicketOriginalFk INT; + DECLARE hasAlreadyItem BOOLEAN; DECLARE vItemFk INT; + DECLARE vClientTypeFk VARCHAR(20); - SELECT clientFk,shipped,warehouseFk,companyFk,addressFk,agencyModeFk,landed,t.id - INTO vclientFk,vShipped,vWarehouseFk,vCompanyFk,vAddressFk,vAgencyModeFk,vLanded,vAuxId + SELECT t.shipped, t.warehouseFk, t.addressFk, agencyModeFk, landed, t.id, s.itemfk, c.typeFk + INTO vShipped, vWarehouseFk, vAddressFk, vAgencyModeFk, vLanded, vTicketOriginalFk, vItemFk, vClientTypeFk FROM ticket t - JOIN sale s ON s.ticketFk=t.id + JOIN sale s ON s.ticketFk = t.id + JOIN `client` c ON t.clientFk = c.id WHERE s.id = vSaleFk; - - SET vDateStart = TIMESTAMP(vShipped); - SET vDateEnd = TIMESTAMP(vShipped, '23:59:59'); - - SELECT t.id INTO vNewTicket - FROM ticket t - JOIN ticketState ts ON ts.ticketFk=t.id - WHERE t.addressFk = vAddressFk - AND t.warehouseFk = vWarehouseFk - AND t.agencyModeFk = vAgencyModeFk - AND t.landed <=> vLanded - AND t.shipped BETWEEN vDateStart AND vDateEnd - AND t.refFk IS NULL - AND t.clientFk <> 1118 - AND t.id <> vAuxId - AND IFNULL(ts.alertLevel,0) = 0 - LIMIT 1; + SET vShippedDayEnd = util.dayEnd(vShipped); + + IF vClientTypeFk <> 'handMaking' THEN + SELECT t.id INTO vNewTicket + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id + WHERE t.addressFk = vAddressFk + AND t.warehouseFk = vWarehouseFk + AND t.agencyModeFk = vAgencyModeFk + AND t.landed <=> vLanded + AND t.shipped BETWEEN vShipped AND vShippedDayEnd + AND t.refFk IS NULL + AND t.id <> vTicketOriginalFk + AND IFNULL(ts.alertLevel,0) = 0 + LIMIT 1; + END IF; + IF vNewTicket IS NULL THEN - CALL vn.ticket_Clone(vAuxId, vNewTicket); - /*CALL vn2008.bionic_calc_ticket(vNewTicket);*/ + CALL vn.ticket_Clone(vTicketOriginalFk, vNewTicket); END IF; INSERT INTO ticketTracking(ticketFk, workerFk, stateFk) @@ -43014,34 +45434,30 @@ BEGIN FROM state s WHERE s.code = 'FIXING'; - - /*parche para campapña, eliminar y modificar el front*/ - SELECT COUNT(id) INTO vNumLine + SELECT COUNT(id) INTO hasAlreadyItem FROM sale s - WHERE s.ticketFk = vNewTicket AND s.itemFk = (SELECT itemFk FROM sale WHERE id = vSaleFk); + WHERE s.ticketFk = vNewTicket AND s.itemFk = vItemFk; + + IF hasAlreadyItem = FALSE THEN - IF vNumLine = 0 THEN - - INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) SELECT vNewTicket, itemFk, concept, vQuantity, price, discount FROM sale s WHERE s.id = vSaleFk; - SELECT LAST_INSERT_ID() INTO vNewSale; + SELECT LAST_INSERT_ID() INTO vNewSale; - INSERT INTO saleComponent(saleFk, componentFk, `value`) + INSERT INTO saleComponent(saleFk, componentFk, `value`) SELECT vNewSale, componentFk, `value` FROM saleComponent WHERE saleFk = vSaleFk; - ELSE - IF vQuantity <> 0 THEN + ELSE - SELECT itemFk INTO vItemFk FROM sale WHERE id = vSaleFk; - UPDATE sale SET quantity = vQuantity - WHERE ticketFk = vNewTicket AND itemFk = vItemFk; + UPDATE sale + SET quantity = quantity + vQuantity + WHERE ticketFk = vNewTicket AND itemFk = vItemFk; - END IF; END IF; END ;; @@ -44310,6 +46726,8 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `subordinateGetList`(vBossFk INT) BEGIN + + -- deprecated usar vn.worker_GetHierarch DECLARE vBossId INT; DECLARE vDone BOOL; DECLARE workerCur CURSOR FOR @@ -46058,8 +48476,8 @@ BEGIN DELETE sc.* FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk - JOIN componentRate cr ON cr.id = sc.componentFk - WHERE cr.isRenewable; + JOIN `component` c ON c.id = sc.componentFk + WHERE c.isRenewable; REPLACE INTO saleComponent(saleFk, componentFk, value) SELECT s.id, tc.componentFk, tc.cost @@ -46068,8 +48486,8 @@ BEGIN JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk LEFT JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk - LEFT JOIN componentRate cr ON cr.id = tc.componentFk - WHERE IF(sc.componentFk IS NULL AND NOT cr.isRenewable, FALSE, TRUE); + LEFT JOIN `component` c ON c.id = tc.componentFk + WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); END IF; IF vKeepPrices THEN @@ -46107,8 +48525,8 @@ BEGIN SELECT SUM(sc.value) sumValue, sc.saleFk FROM saleComponent sc JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN componentRate cr ON cr.id = sc.componentFk - JOIN componentTypeRate ctr on ctr.id = cr.componentTypeRate AND ctr.base + JOIN `component` c ON c.id = sc.componentFk + JOIN componentType ct on ct.id = c.typeFk AND ct.base GROUP BY sc.saleFk) sc ON sc.saleFk = s.id SET s.priceFixed = sumValue, s.isPriceFixed = 1; @@ -46937,19 +49355,77 @@ BEGIN DECLARE vWarehouseId INTEGER; DECLARE vShippedDate DATE; - SELECT warehouseFk, shipped INTO vWarehouseId,vShippedDate FROM vn.ticket WHERE id = vTicketId; + SELECT warehouseFk, shipped INTO vWarehouseId,vShippedDate FROM ticket WHERE id = vTicketId; SELECT s.quantity, - round(r.cm3 * i.compression * s.quantity / 1000000,3) as m3, + round(ic.cm3 * i.compression * s.quantity / 1000000,3) as m3, s.itemFk, s.id AS saleFk, s.concept, t.agencyModeFk FROM sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticket t on t.id = s.ticketFk - JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk + JOIN item i ON i.id = s.itemFk + JOIN ticket t on t.id = s.ticketFk + JOIN itemCost ic ON ic.itemFk = s.itemFk AND ic.warehouseFk = t.warehouseFk WHERE s.ticketFk = vTicketId; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticketMissed_List` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketMissed_List`(vTicketFk INT) +BEGIN + + DECLARE vParkingFk INT; + DECLARE vParked DATETIME; + DECLARE vLevel INT; + DECLARE vCollectionFk INT; + + SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) + INTO vLevel, vCollectionFk + FROM vn.ticketCollection + WHERE ticketFk = vTicketFk; + + SELECT created, parkingFk + INTO vParked, vParkingFk + FROM vn.ticketParking + WHERE ticketFk = vTicketFk; + + SELECT tp.ticketFk, CONCAT(vCollectionFk, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia + FROM vn.ticketParking tp + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.zone z ON z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.state s ON s.id = tst.state + WHERE s.alertLevel < 2 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND ( + ( + ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) + OR + ( tc.collectionFk = vCollectionFk AND LEFT(tc.level,1) < LEFT(vLevel,1) ) + ) + ); + + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47631,9 +50107,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -47718,13 +50194,13 @@ BEGIN FROM saleComponent sc JOIN sale s ON s.id = sc.saleFk JOIN ticket t ON t.id = s.ticketFk - JOIN componentRate cr ON cr.id = sc.componentFk + JOIN `component` c ON c.id = sc.componentFk WHERE s.ticketFk = vTicketFk - AND (cr.isRenewable = FALSE + AND (c.isRenewable = FALSE OR (NOT vHasChangeAll - AND (NOT (cr.componentTypeRate <=> vAddressTypeRateFk - OR cr.componentTypeRate <=> vAgencyModeTypeRateFk)))); + AND (NOT (c.typeFk <=> vAddressTypeRateFk + OR c.typeFk <=> vAgencyModeTypeRateFk)))); SET @shipped = vShipped; @@ -47982,9 +50458,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -48023,11 +50499,11 @@ BEGIN AND tc.warehouseFk = t.warehouseFk LEFT JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk - LEFT JOIN componentRate cr ON cr.id = tc.componentFk + LEFT JOIN `component` c ON c.id = tc.componentFk WHERE t.id = vTicketFk AND IF(sc.componentFk IS NULL - AND cr.classRate IS NOT NULL, FALSE, TRUE) + AND c.classRate IS NOT NULL, FALSE, TRUE) GROUP BY s.id ORDER BY s.id; DROP TEMPORARY TABLE @@ -48806,9 +51282,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -48816,6 +51292,43 @@ CREATE DEFINER=`root`@`%` PROCEDURE `travel_weeklyClone`(vSinceWeek INT, vToWeek BEGIN DECLARE vCounter INT; + SET vCounter = vSinceWeek; + vWeekLoop :LOOP + INSERT IGNORE INTO travel (shipped, landed, warehouseOutFk, warehouseInFk, agencyFk, ref, cargoSupplierFk, kg) + SELECT @a := TIMESTAMPADD(DAY,vCounter * 7 - WEEKDAY(CURDATE()) - 1 + weekDay,CURDATE()), + @a := TIMESTAMPADD(DAY,duration,@a), + warehouseOutFk, + warehouseInFk, + agencyModeFk, + ref, + cargoSupplierFk, + kg + FROM travel_cloneWeekly; + IF vCounter = vToWeek THEN + LEAVE vWeekLoop; + END IF; + SET vCounter = vCounter + 1; + END LOOP; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `travel_weeklyClone__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `travel_weeklyClone__`(vSinceWeek INT, vToWeek INT) +BEGIN + DECLARE vCounter INT; + SET vCounter = vSinceWeek; vWeekLoop :LOOP INSERT IGNORE INTO travel (shipped, landed, warehouseOutFk, warehouseInFk, agencyFk, ref, cargoSupplierFk) @@ -50603,7 +53116,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `worker_getHierarch` */; +/*!50003 DROP PROCEDURE IF EXISTS `worker_getHierarchy` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -50613,12 +53126,70 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `worker_getHierarch`(vBoss INT) +CREATE DEFINER=`root`@`%` PROCEDURE `worker_getHierarchy`(vBoss INT) BEGIN DECLARE EXIT HANDLER FOR 1062 BEGIN CALL util.throw('INFINITE_LOOP'); END; + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; + CREATE TEMPORARY TABLE workerHierarchy + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchyList; + CREATE TEMPORARY TABLE tmp.workerHierarchyList + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk, 0 AS isChecked; + + + WHILE (SELECT COUNT(*) FROM tmp.workerHierarchyList WHERE NOT isChecked) > 0 DO + + INSERT INTO tmp.workerHierarchyList + SELECT w.id, 0 + FROM worker w + JOIN workerHierarchy wh ON wh.workerFk = w.bossFk; + + UPDATE tmp.workerHierarchyList whl + JOIN workerHierarchy wh ON wh.workerFk = whl.workerFk + SET whl.isChecked = 1; + + TRUNCATE workerHierarchy; + + INSERT INTO workerHierarchy + SELECT workerFk + FROM tmp.workerHierarchyList + WHERE NOT isChecked; + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `worker_getHierarch__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `worker_getHierarch__`(vBoss INT) +BEGIN +-- eliminar no se usa + -- usar worker_getHierarchy + DECLARE EXIT HANDLER FOR 1062 BEGIN + CALL util.throw('INFINITE_LOOP'); + END; + DROP TEMPORARY TABLE IF EXISTS workerHierarch; CREATE TEMPORARY TABLE workerHierarch (PRIMARY KEY (workerFk)) @@ -50659,6 +53230,49 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `worker_getProductionErrors` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `worker_getProductionErrors`(vDepartment VARCHAR(25), vStateCode VARCHAR(25) CHARSET utf8, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +DROP TEMPORARY TABLE IF EXISTS tmp.total; + CREATE TEMPORARY TABLE tmp.total + ENGINE = MEMORY + SELECT tt.workerFk, Count(tt.ticketFk) AS CuentaDeId_Ticket + FROM state s + INNER JOIN ticketTracking tt ON s.id = tt.stateFk + INNER JOIN ticket t ON tt.ticketFk = t.id + INNER JOIN worker w ON tt.workerFk = w.id + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND s.code = vStateCode + GROUP BY tt.workerFk; + +SELECT w.code, w.firstName, w.lastName, CAST(tmp.total.CuentaDeId_Ticket AS DECIMAL(10,0)) AS Totaltickets, + CAST(sub.CuentaDeId_Ticket AS DECIMAL(10,0)) AS Fallos +fROM tmp.total + JOIN worker w ON w.id= tmp.total.workerFk +LEFT JOIN ( SELECT Count(s.ticketFk) AS CuentaDeId_Ticket, cd.workerFk + FROM (claimDevelopment cd + INNER JOIN ((sale s + INNER JOIN claimBeginning cb ON s.id = cb.saleFk) + INNER JOIN ticket t ON s.ticketFk = t.id) ON cd.claimFk = cb.claimFk) + INNER JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id + WHERE t.shipped BETwEEN vDatedFrom AND vDatedTo AND cr.description=vDepartment + GROUP BY cd.workerFk)sub ON tmp.total.workerFk = sub.workerFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `workingHours` */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -50813,6 +53427,64 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `zoneClosure_recalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `zoneClosure_recalc`() +proc: BEGIN +/** + * Recalculates the delivery time (hour) for every zone in days + scope in future + */ + DECLARE vScope INT; + DECLARE vCounter INT DEFAULT 0; + DECLARE vShipped DATE DEFAULT CURDATE(); + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.zoneClosure_recalc'); + RESIGNAL; + END; + + IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN + LEAVE proc; + END IF; + + SELECT scope INTO vScope + FROM zoneConfig; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT id FROM zone; + + TRUNCATE TABLE zoneClosure; + + REPEAT + CALL zone_getOptionsForShipment(vShipped, TRUE); + INSERT INTO zoneClosure(zoneFk, dated, `hour`) + SELECT zoneFk, vShipped, `hour` FROM tmp.zoneOption; + + SET vCounter = vCounter + 1; + SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); + UNTIL vCounter > vScope + END REPEAT; + + DROP TEMPORARY TABLE tmp.zone; + DO RELEASE_LOCK('vn.zoneClosure_recalc'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_calcTree` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51116,17 +53788,39 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `zoneGetLanded`(vShipped DATE, vAddress INT, vAgencyMode INT, vWarehouse INT) +CREATE DEFINER=`root`@`%` PROCEDURE `zoneGetLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT) BEGIN /** +* JGF procedimiento TEMPORAL +* ATENCION hablad conmigo si queréis cambiar algo de aquí * Devuelve una tabla temporal con el dia de recepcion para vShipped. * * @param vShipped Fecha de preparacion de mercancia -* @param vAddress Id de consignatario, %NULL para recogida -* @param vAgencyMode Id agencia -* @table tmp.zoneGetLanded Datos de recepción +* @param vAddressFk Id de consignatario, %NULL para recogida +* @param vAgencyModeFk Id agencia +* @param vWarehouseFk vWarehouseFk +* @table tmp.zoneGetLanded Datos de recepción */ - CALL zone_getLanded(vShipped,vAddress,vAgencyMode,vWarehouse); + + CALL zone_getFromGeo(address_getGeo(vAddressFk)); + CALL zone_getOptionsForShipment(vShipped, FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; + CREATE TEMPORARY TABLE tmp.zoneGetLanded + ENGINE = MEMORY + SELECT vWarehouseFk warehouseFk, + TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed, + zo.zoneFk + FROM tmp.zoneOption zo + JOIN zone z ON z.id = zo.zoneFk + JOIN zoneWarehouse zw ON zw.zoneFk = z.id + WHERE agencyModeFk = vAgencyModeFk + AND zw.warehouseFk = vWarehouseFk; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51524,9 +54218,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -51543,7 +54237,7 @@ BEGIN */ CALL zone_getFromGeo(address_getGeo(vAddressFk)); - CALL zone_getOptionsForShipment(vShipped); + CALL zone_getOptionsForShipment(vShipped, TRUE); DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; CREATE TEMPORARY TABLE tmp.zoneGetLanded @@ -51750,7 +54444,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN) BEGIN /** * Gets computed options for the passed zones and shipping date. @@ -51759,6 +54453,8 @@ BEGIN * @param vShipped The shipping date * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options */ + DECLARE vHour TIME DEFAULT TIME(NOW()); + DROP TEMPORARY TABLE IF EXISTS tLandings; CREATE TEMPORARY TABLE tLandings (INDEX (eventFk)) @@ -51803,7 +54499,13 @@ BEGIN DELETE t FROM tTemp t JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; - + + IF NOT vShowExpiredZones THEN + DELETE FROM tTemp + WHERE vShipped < CURDATE() + OR (vShipped = CURDATE() AND vHour > `hour`); + END IF; + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; CREATE TEMPORARY TABLE tmp.zoneOption ENGINE = MEMORY @@ -52000,52 +54702,20 @@ DELIMITER ;; BEFORE INSERT ON `inter` FOR EACH ROW BEGIN -/* - -- PAK 08/05/18 Los tickets no se pueden marcar como servidos en el futuro - - IF NEW.state_id = 16 AND (SELECT date(landed) FROM vn.ticket WHERE id = NEW.Id_Ticket) > CURDATE() THEN -- Entregado - SET NEW.state_id = 22; -- ¿ Fecha ? - END IF; -*//* - -- PAK 08/05/18 Los sacadores no deben de poner los tickets en revisión - - DECLARE vIsSacador BOOL; + DECLARE vState VARCHAR(15); + DECLARE vZoneFk INT; + + SELECT s.code INTO vState + FROM vn.state s + WHERE s.id = NEW.state_id; + + SELECT t.zonefk INTO vZoneFk + FROM vn.ticket t + WHERE t.id = NEW.Id_Ticket; - IF NEW.state_id = 6 THEN -- Revisión - SELECT COUNT(*) > 0 INTO vIsSacador - FROM inter - WHERE state_id = 5 -- Preparacion - AND Id_Trabajador = NEW.Id_Trabajador - AND Id_Ticket = NEW.Id_Ticket; - - IF vIsSacador THEN - SET NEW.state_id = 5; - END IF; - END IF; -*//* - -- PAK 08/05/18 Este código parece fósil. Lo comento. - - DECLARE contados INT; - DECLARE vSupervisor INT; - - SELECT Id_Trabajador INTO vSupervisor - FROM vn2008.Trabajadores WHERE user_id = account.userGetId(); - - SET NEW.Id_Supervisor = IFNULL(vSupervisor,20); - - IF NEW.state_id = 5 THEN -- Preparación - SELECT COUNT(Id_Ticket) INTO contados - FROM vncontrol.inter - WHERE state_id = 5 - AND Id_Ticket = NEW.Id_Ticket - AND IFNULL(Id_Supervisor,-1) <> vSupervisor - AND TIMESTAMPADD(SECOND, 60, odbc_date) >= NOW(); - - IF contados <> 0 THEN - CALL util.throw ('FALLO_AL_INSERTAR'); - END IF; - END IF; -*/ + IF vState = 'OK' AND vZoneFk IS NULL THEN + CALL util.throw("ASSIGN_ZONE_FIRST"); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52270,16 +54940,16 @@ USE `account`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Current Database: `bi` +-- Current Database: `bs` -- -USE `bi`; +USE `bs`; -- --- Final view structure for view `analisis_grafico_ventas` +-- Final view structure for view `bajasLaborales` -- -/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/; +/*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -52288,16 +54958,16 @@ USE `bi`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `analisis_grafico_ventas` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */; +/*!50001 VIEW `bajasLaborales` AS select `p`.`firstname` AS `firstname`,`p`.`name` AS `name`,`b`.`business_id` AS `business_id`,max(`ce`.`date`) AS `lastDate`,max(ifnull(`b`.`date_end`,curdate())) AS `endContract`,`cs`.`type` AS `type`,cast(count(0) as decimal(10,0)) AS `dias`,`w`.`userFk` AS `userFk` from (((((`postgresql`.`calendar_employee` `ce` join `postgresql`.`business` `b` on((`b`.`business_id` = `ce`.`business_id`))) join `postgresql`.`profile` `pr` on((`pr`.`profile_id` = `b`.`client_id`))) join `postgresql`.`person` `p` on((`p`.`person_id` = `pr`.`person_id`))) join `postgresql`.`calendar_state` `cs` on((`cs`.`calendar_state_id` = `ce`.`calendar_state_id`))) join `vn`.`worker` `w` on((`w`.`id` = `p`.`id_trabajador`))) where ((`ce`.`date` >= (curdate() + interval -(1) year)) and (`cs`.`type` not in ('Vacaciones','Vacaciones 1/2 día','Compensar','Festivo'))) group by `p`.`firstname`,`p`.`name`,`cs`.`type` having (`endContract` >= curdate()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `analisis_ventas_simple` +-- Final view structure for view `lastIndicators` -- -/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/; +/*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -52306,34 +54976,34 @@ USE `bi`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `analisis_ventas_simple` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */; +/*!50001 VIEW `lastIndicators` AS select `i`.`updated` AS `updated`,`i`.`lastYearSales` AS `lastYearSales`,(`i`.`lastYearSales` - `yi`.`lastYearSales`) AS `incLastYearSales`,`i`.`totalGreuge` AS `totalGreuge`,(`i`.`totalGreuge` - `yi`.`totalGreuge`) AS `incTotalGreuge`,`i`.`latePaymentRate` AS `latePaymentRate`,(`i`.`latePaymentRate` - `yi`.`latePaymentRate`) AS `incLatePaymentRate`,`i`.`countEmployee` AS `countEmployee`,(`i`.`countEmployee` - `yi`.`countEmployee`) AS `incCountEmployee`,`i`.`averageMana` AS `averageMana`,(`i`.`averageMana` - `yi`.`averageMana`) AS `incAverageMana`,`i`.`bankingPool` AS `bankingPool`,(`i`.`bankingPool` - `yi`.`bankingPool`) AS `incbankingPool`,`i`.`lastMonthActiveClients` AS `lastMonthActiveClients`,(`i`.`lastMonthActiveClients` - `yi`.`lastMonthActiveClients`) AS `incLastMonthActiveClients`,`i`.`lastMonthLostClients` AS `lastMonthLostClients`,(`i`.`lastMonthLostClients` - `yi`.`lastMonthLostClients`) AS `incLastMonthLostClients`,`i`.`lastMonthNewClients` AS `lastMonthNewClients`,(`i`.`lastMonthNewClients` - `yi`.`lastMonthNewClients`) AS `incLastMonthNewClients`,`i`.`lastMonthWebBuyingRate` AS `lastMonthWebBuyingRate`,(`i`.`lastMonthWebBuyingRate` - `yi`.`lastMonthWebBuyingRate`) AS `incLastMonthWebBuyingRate`,`i`.`productionHours` AS `productionHours`,`i`.`dailyWorkersCost` AS `dailyWorkersCost`,`i`.`volumeM3` AS `volumeM3`,`i`.`salesValue` AS `salesValue`,`i`.`valueM3` AS `valueM3`,`i`.`hoursM3` AS `hoursM3`,`i`.`workerCostM3` AS `workerCostM3`,`i`.`salesWorkersCostRate` AS `salesWorkersCostRate`,`i`.`thisWeekSales` AS `thisWeekSales`,`i`.`lastYearWeekSales` AS `lastYearWeekSales` from (`indicators` `i` join `indicators` `yi` on((`yi`.`updated` = (select (max(`indicators`.`updated`) + interval -(1) day) from `indicators`)))) where (`i`.`updated` = (select max(`indicators`.`updated`) from `indicators`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `customerRiskOverdue` +-- Final view structure for view `m3Silla` -- -/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/; +/*!50001 DROP VIEW IF EXISTS `m3Silla`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `customerRiskOverdue` AS select `cr`.`customer_id` AS `customer_id`,`cr`.`amount` AS `amount`,`cr`.`company_id` AS `company_id` from (((`bi`.`customer_risk` `cr` join `vn`.`company` `co` on((`co`.`id` = `cr`.`company_id`))) join `vn`.`client` `c` on((`cr`.`customer_id` = `c`.`id`))) join `vn`.`payMethod` `pm` on((`pm`.`id` = `c`.`payMethodFk`))) where (`cr`.`amount` and `co`.`isDefaulter` and `pm`.`outstandingDebt` and (`c`.`typeFk` = 'normal')) union all select `i`.`clientFk` AS `Id_Cliente`,-(round(`i`.`amount`,2)) AS `importe`,`i`.`companyFk` AS `empresa_id` from (((`vn`.`invoiceOut` `i` join `vn`.`client` `c` on((`i`.`clientFk` = `c`.`id`))) join `vn`.`company` `co` on((`co`.`id` = `i`.`companyFk`))) join `vn`.`payMethod` `pm` on((`pm`.`id` = `c`.`payMethodFk`))) where ((`i`.`issued` > (curdate() + interval -(101) day)) and ((`i`.`dued` + interval `pm`.`graceDays` day) > curdate()) and (`i`.`amount` > 0) and `co`.`isDefaulter` and `pm`.`outstandingDebt` and (`c`.`typeFk` = 'normal')) */; +/*!50001 VIEW `m3Silla` AS select `m3`.`fecha` AS `fecha`,`m3`.`year` AS `year`,`m3`.`month` AS `month`,`m3`.`week` AS `week`,`m3`.`day` AS `day`,`m3`.`dayName` AS `dayName`,cast(sum(`m3`.`m3`) as decimal(10,0)) AS `Volumen`,cast(sum(`m3`.`euros`) as decimal(10,0)) AS `Euros` from `m3` where (`m3`.`warehouseFk` in (1,44)) group by `m3`.`fecha` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `saleVolume` +-- Final view structure for view `m3analisis` -- -/*!50001 DROP VIEW IF EXISTS `saleVolume`*/; +/*!50001 DROP VIEW IF EXISTS `m3analisis`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -52342,7 +55012,115 @@ USE `bi`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleVolume` AS select `s`.`id` AS `saleFk`,sum((((`r`.`cm3` * `i`.`compression`) * `s`.`quantity`) / 1000000)) AS `m3` from (((`vn`.`ticket` `t` join `vn`.`sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `bi`.`rotacion` `r` on(((`r`.`Id_Article` = `i`.`id`) and (`r`.`warehouse_id` = `t`.`warehouseFk`)))) */; +/*!50001 VIEW `m3analisis` AS select `m`.`fecha` AS `fecha`,`m`.`year` AS `year`,`m`.`month` AS `month`,`m`.`week` AS `week`,`m`.`day` AS `day`,`m`.`dayName` AS `dayName`,`m`.`Volumen` AS `Volumen`,`m`.`Euros` AS `Euros`,`h`.`Departamento` AS `Departamento`,`h`.`Horas` AS `Horas`,`h`.`Salarios` AS `Salarios`,(`h`.`Horas` / `m`.`Volumen`) AS `tiempoM3`,(`m`.`Euros` / `m`.`Volumen`) AS `valorM3`,(`h`.`Salarios` / `m`.`Volumen`) AS `costeLaboralM3`,(`h`.`Salarios` / `m`.`Euros`) AS `costeEuros`,(`h`.`Salarios` / `h`.`Horas`) AS `precioHora` from (`bs`.`m3Silla` `m` join `bs`.`horasSilla` `h` on((`h`.`Fecha` = `m`.`fecha`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `manaCustomer` +-- + +/*!50001 DROP VIEW IF EXISTS `manaCustomer`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `manaCustomer` AS select `cmc`.`clientFk` AS `Id_Cliente`,`cmc`.`mana` AS `Mana`,`cmc`.`dated` AS `dated` from `vn`.`clientManaCache` `cmc` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `manaSpellersExcluded` +-- + +/*!50001 DROP VIEW IF EXISTS `manaSpellersExcluded`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `manaSpellersExcluded` AS select `m`.`Id_Trabajador` AS `workerFk` from `bs`.`mana_spellers_excluded` `m` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `mana_spellers` +-- + +/*!50001 DROP VIEW IF EXISTS `mana_spellers`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `mana_spellers` AS select `wm`.`workerFk` AS `Id_Trabajador`,`wm`.`size` AS `size`,`wm`.`amount` AS `used`,`wm`.`pricesModifierRate` AS `prices_modifier_rate`,`wm`.`isPricesModifierActivated` AS `prices_modifier_activated`,`wm`.`minRate` AS `minRate`,`wm`.`maxRate` AS `maxRate` from `vn`.`workerMana` `wm` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `mana_spellers_excluded` +-- + +/*!50001 DROP VIEW IF EXISTS `mana_spellers_excluded`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `mana_spellers_excluded` AS select `wme`.`workerFk` AS `Id_Trabajador` from `vn`.`workerManaExcluded` `wme` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `mermas` +-- + +/*!50001 DROP VIEW IF EXISTS `mermas`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `mermas` AS select `w`.`code` AS `Comprador`,`it`.`name` AS `Familia`,`i`.`id` AS `Referencia`,`i`.`name` AS `Item`,`s`.`quantity` AS `Cantidad`,(((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) AS `Coste_Unitario`,(`s`.`quantity` * (((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`)) AS `Importe`,`c`.`name` AS `Cliente`,`s`.`ticketFk` AS `ticketFk`,`t`.`shipped` AS `Fecha` from (((((((`vn`.`worker` `w` join `vn`.`itemType` `it` on((`it`.`workerFk` = `w`.`id`))) join `vn`.`item` `i` on((`i`.`typeFk` = `it`.`id`))) join `vn`.`sale` `s` on((`s`.`itemFk` = `i`.`id`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) left join `bi`.`Last_buy_id` `lb` on(((`lb`.`Id_Article` = `s`.`itemFk`) and (`lb`.`warehouse_id` = `t`.`warehouseFk`)))) left join `vn`.`buy` `b` on((`b`.`id` = `lb`.`Id_Compra`))) where ((`t`.`shipped` > '2018-01-01') and (`c`.`isRelevant` or (`c`.`id` in (200,400)))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerMana` +-- + +/*!50001 DROP VIEW IF EXISTS `workerMana`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerMana` AS select `m`.`Id_Trabajador` AS `workerFk`,`m`.`used` AS `amount` from `bs`.`mana_spellers` `m` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -52948,16 +55726,16 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `annualAverageInvoiced` AS select `e`.`Id_Cliente` AS `clientFk`,`e`.`Consumo` AS `invoiced` from `bi`.`facturacion_media_anual` `e` */; +/*!50001 VIEW `annualAverageInvoiced` AS select `cec`.`clientFk` AS `clientFk`,`cec`.`invoiced` AS `invoiced` from `bs`.`clientAnnualConsumption` `cec` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `claimRatio` +-- Final view structure for view `claimRatio__` -- -/*!50001 DROP VIEW IF EXISTS `claimRatio`*/; +/*!50001 DROP VIEW IF EXISTS `claimRatio__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -52966,7 +55744,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `claimRatio` AS select `bi`.`claims_ratio`.`Id_Cliente` AS `clientFk`,`bi`.`claims_ratio`.`Consumo` AS `yearSale`,`bi`.`claims_ratio`.`Reclamaciones` AS `claimAmount`,`bi`.`claims_ratio`.`Ratio` AS `claimingRate`,`bi`.`claims_ratio`.`recobro` AS `priceIncreasing`,`bi`.`claims_ratio`.`inflacion` AS `packingRate` from `bi`.`claims_ratio` */; +/*!50001 VIEW `claimRatio__` AS select `claims_ratio`.`Id_Cliente` AS `clientFk`,`claims_ratio`.`Consumo` AS `yearSale`,`claims_ratio`.`Reclamaciones` AS `claimAmount`,`claims_ratio`.`Ratio` AS `claimingRate`,`claims_ratio`.`recobro` AS `priceIncreasing`,`claims_ratio`.`inflacion` AS `packingRate` from `bi`.`claims_ratio` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -52990,10 +55768,10 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `clientRisk` +-- Final view structure for view `clientRisk__` -- -/*!50001 DROP VIEW IF EXISTS `clientRisk`*/; +/*!50001 DROP VIEW IF EXISTS `clientRisk__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -53002,7 +55780,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientRisk` AS select `c`.`customer_id` AS `clientFk`,`c`.`company_id` AS `companyFk`,`c`.`amount` AS `amount` from `bi`.`customer_risk` `c` */; +/*!50001 VIEW `clientRisk__` AS select `c`.`customer_id` AS `clientFk`,`c`.`company_id` AS `companyFk`,`c`.`amount` AS `amount` from `bi`.`customer_risk` `c` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -53044,46 +55822,46 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `component` +-- Final view structure for view `componentRate__` -- -/*!50001 DROP VIEW IF EXISTS `component`*/; +/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `component` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `typeFk`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; +/*!50001 VIEW `componentRate__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `componentTypeRate`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `componentRate` +-- Final view structure for view `componentTypeRate__` -- -/*!50001 DROP VIEW IF EXISTS `componentRate`*/; +/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentRate` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `componentTypeRate`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; +/*!50001 VIEW `componentTypeRate__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base` from `bi`.`tarifa_componentes_series` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `componentType` +-- Final view structure for view `componentType__` -- -/*!50001 DROP VIEW IF EXISTS `componentType`*/; +/*!50001 DROP VIEW IF EXISTS `componentType__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -53092,16 +55870,16 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentType` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base`,`t`.`margen` AS `isMargin` from `bi`.`tarifa_componentes_series` `t` */; +/*!50001 VIEW `componentType__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `isBase`,`t`.`margen` AS `isMargin` from `bi`.`tarifa_componentes_series` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `componentTypeRate` +-- Final view structure for view `component__` -- -/*!50001 DROP VIEW IF EXISTS `componentTypeRate`*/; +/*!50001 DROP VIEW IF EXISTS `component__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -53110,7 +55888,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentTypeRate` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base` from `bi`.`tarifa_componentes_series` `t` */; +/*!50001 VIEW `component__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `typeFk`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -53128,7 +55906,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `defaulter` AS select `d`.`client` AS `clientFk`,`d`.`date` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSince` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged` from `bi`.`defaulters` `d` */; +/*!50001 VIEW `defaulter` AS select `d`.`clientFk` AS `clientFk`,`d`.`created` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSinced` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged` from `bs`.`defaulter` `d` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -53439,6 +56217,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `itemColor` +-- + +/*!50001 DROP VIEW IF EXISTS `itemColor`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemColor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `color` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'COLOR') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `itemEntryIn` -- @@ -53511,6 +56307,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `itemProductor` +-- + +/*!50001 DROP VIEW IF EXISTS `itemProductor`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemProductor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `productor` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'PRODUCER') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `itemShelvingAvailable` -- @@ -53560,7 +56374,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`quantity` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `itemShelvingSale` `iss` on((`iss`.`itemShelvingFk` = `ish`.`id`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) group by `ish`.`id` */; +/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`quantity` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) group by `ish`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -53709,6 +56523,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `lastTopClaims` +-- + +/*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(((((`cb`.`quantity` * `s`.`price`) * (1 - ((`c`.`responsibility` - 1) / 4))) * (100 - `s`.`discount`)) / 100)),2) AS `claimedAmount`,round(sum((((`cb`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on((`cb`.`claimFk` = `c`.`id`))) join `sale` `s` on((`s`.`id` = `cb`.`saleFk`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) where (`c`.`created` >= (curdate() + interval -(1) week)) group by `s`.`itemFk` having (((`claimedAmount` > 100) and (`claimsNumber` > 2)) or (`claimsNumber` > 4)) order by `claimedAmount` desc */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `originL10n` -- @@ -53799,6 +56631,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `saleValue` +-- + +/*!50001 DROP VIEW IF EXISTS `saleValue`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleValue` AS select `wh`.`name` AS `warehouse`,`c`.`name` AS `client`,`c`.`typeFk` AS `clientTypeFk`,`u`.`name` AS `buyer`,`it`.`name` AS `family`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,(((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) AS `cost`,((((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) * `s`.`quantity`) AS `value`,`tm`.`year` AS `year`,`tm`.`week` AS `week` from (((((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `account`.`user` `u` on((`u`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`warehouse` `wh` on((`wh`.`id` = `t`.`warehouseFk`))) join `vn`.`time` `tm` on((`tm`.`dated` = cast(`t`.`shipped` as date)))) join `cache`.`last_buy` `lb` on(((`lb`.`item_id` = `i`.`id`) and (`lb`.`warehouse_id` = `wh`.`id`)))) join `vn`.`buy` `b` on((`b`.`id` = `lb`.`buy_id`))) where `wh`.`isManaged` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `saleVolume` -- @@ -53812,7 +56662,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,ifnull(round(((((`i`.`compression` * (greatest(`i`.`density`,167) / 167)) * `r`.`cm3`) * `s`.`quantity`) / 1000),2),0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,(((`s`.`quantity` * `r`.`cm3`) * `i`.`compression`) / 1000000) AS `volume`,((((`s`.`quantity` * `r`.`cm3`) * `i`.`compression`) * (greatest(`i`.`density`,167) / 167)) / 1000000) AS `physicalWeight`,(((`s`.`quantity` * `r`.`cm3`) * `i`.`density`) / 1000000) AS `weight`,(((`s`.`quantity` * `r`.`cm3`) * `i`.`compression`) / 1000000) AS `physicalVolume` from (((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `bi`.`rotacion` `r` on(((`r`.`Id_Article` = `s`.`itemFk`) and (`r`.`warehouse_id` = `t`.`warehouseFk`)))) */; +/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,ifnull(round(((((`i`.`compression` * (greatest(`i`.`density`,167) / 167)) * `ic`.`cm3`) * `s`.`quantity`) / 1000),2),0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,(((`s`.`quantity` * `ic`.`cm3`) * `i`.`compression`) / 1000000) AS `volume`,((((`s`.`quantity` * `ic`.`cm3`) * `i`.`compression`) * (greatest(`i`.`density`,167) / 167)) / 1000000) AS `physicalWeight`,(((`s`.`quantity` * `ic`.`cm3`) * `i`.`density`) / 1000000) AS `weight`,(((`s`.`quantity` * `ic`.`cm3`) * `i`.`compression`) / 1000000) AS `physicalVolume` from (((`sale` `s` join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `itemCost` `ic` on(((`ic`.`itemFk` = `s`.`itemFk`) and (`ic`.`warehouseFk` = `t`.`warehouseFk`)))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -54005,12 +56855,12 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` > curdate()) and (`b`.`date_start` <= curdate()))) */; +/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` >= curdate()) and (`b`.`date_start` <= curdate()))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -54174,4 +57024,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-23 14:34:48 +-- Dump completed on 2020-01-24 12:08:27 diff --git a/db/export-data.sh b/db/export-data.sh index 4dc57db41..9f3997cf7 100755 --- a/db/export-data.sh +++ b/db/export-data.sh @@ -49,13 +49,8 @@ TABLES=( state sample department -) -dump_tables ${TABLES[@]} - -TABLES=( - bi - tarifa_componentes - tarifa_componentes_series + component + componentType ) dump_tables ${TABLES[@]} diff --git a/db/export-structure.sh b/db/export-structure.sh index 5e1b62f03..ec9578aad 100755 --- a/db/export-structure.sh +++ b/db/export-structure.sh @@ -2,7 +2,7 @@ SCHEMAS=( account - bi + bs cache edi hedera diff --git a/db/tests/vn/buyUltimate.spec.js b/db/tests/vn/buyUltimate.spec.js index 8a5e6a3df..e0b3fa568 100644 --- a/db/tests/vn/buyUltimate.spec.js +++ b/db/tests/vn/buyUltimate.spec.js @@ -48,7 +48,7 @@ describe('buyUltimate()', () => { expect(buyUltimateTable[1].buyFk).toEqual(4); expect(buyUltimateTable[0].buyFk).toEqual(3); expect(buyUltimateTable[2].buyFk).toEqual(5); - expect(buyUltimateTable[3].buyFk).toEqual(8); + expect(buyUltimateTable[3].buyFk).toEqual(9); expect(buyUltimateTable[4].buyFk).toEqual(6); expect(buyUltimateTable[5].buyFk).toEqual(7); }); diff --git a/docker-compose.yml b/docker-compose.yml index c9011bdf4..fabd968a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,45 @@ -version: '3.5' +version: '3.7' services: - front: - image: registry.verdnatura.es/salix-front:${TAG} - restart: unless-stopped - build: - context: . - dockerfile: front/Dockerfile - ports: - - ${PORT_FRONT}:80 - links: - - back - deploy: - replicas: 3 - back: - image: registry.verdnatura.es/salix-back:${TAG} - restart: unless-stopped - build: . - ports: - - ${PORT_BACK}:3000 - environment: - - NODE_ENV - volumes: - - /mnt/storage/containers/salix:/etc/salix - - /mnt/storage/pdfs:/var/lib/salix/pdfs - - /mnt/storage/dms:/var/lib/salix/dms - deploy: - replicas: 6 + front: + image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?} + build: + context: . + dockerfile: front/Dockerfile + ports: + - 80 + deploy: + replicas: 3 + back: + image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?} + build: . + ports: + - 3000 + environment: + - NODE_ENV + configs: + - source: datasources + target: /etc/salix/datasources.json + - source: datasources_local + target: /etc/salix/datasources.local.json + - source: print + target: /etc/salix/print.json + - source: print_local + target: /etc/salix/print.local.json + volumes: + - /mnt/storage/pdfs:/var/lib/salix/pdfs + - /mnt/storage/dms:/var/lib/salix/dms + deploy: + replicas: 6 +configs: + datasources: + external: true + name: salix_datasources + datasources_local: + external: true + name: salix-${BRANCH_NAME:?}_datasources + print: + external: true + name: salix_print + print_local: + external: true + name: salix-${BRANCH_NAME:?}_print diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 03a50bc45..13ec7099b 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -1,15 +1,15 @@ /* eslint no-invalid-this: "off" */ - -import Nightmare from 'nightmare'; -import {URL} from 'url'; -import config from './config.js'; - -let currentUser; +import {url as defaultURL} from './config'; let actions = { clickIfExists: async function(selector) { - let exists = await this.exists(selector); - if (exists) await this.click(selector); + let exists; + try { + exists = await this.waitForSelector(selector, {timeout: 500}); + } catch (error) { + exists = false; + } + if (exists) await this.waitToClick(selector); return exists; }, @@ -26,54 +26,43 @@ let actions = { changeLanguageToEnglish: async function() { let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]'; - let lang = await this.waitToClick('#user') - .wait(langSelector) - .waitToGetProperty(`${langSelector} input`, 'value'); + await this.waitToClick('#user'); + await this.wait(langSelector); + let lang = await this.waitToGetProperty(`${langSelector} input`, 'value'); if (lang !== 'English') await this.autocompleteSearch(langSelector, 'English'); + + await this.keyboard.press('Escape'); + await this.waitForSelector(langSelector, {hidden: true}); }, - doLogin: async function(userName, password) { - if (password == null) password = 'nightmare'; - await this.wait(`vn-login [name=user]`) - .clearInput(`vn-login [name=user]`) - .write(`vn-login [name=user]`, userName) - .write(`vn-login [name=password]`, password) - .click(`vn-login button[type=submit]`); + doLogin: async function(userName, password = 'nightmare') { + await this.wait(`vn-login [ng-model="$ctrl.user"]`); + await this.clearInput(`vn-login [ng-model="$ctrl.user"]`); + await this.write(`vn-login [ng-model="$ctrl.user"]`, userName); + await this.clearInput(`vn-login [ng-model="$ctrl.password"]`); + await this.write(`vn-login [ng-model="$ctrl.password"]`, password); + await this.click('vn-login button[type=submit]'); }, login: async function(userName) { - if (currentUser !== userName) { - let accountClicked = await this.clickIfExists('#user'); + try { + await this.waitForURL('#!/login'); + } catch (e) { + await this.goto(`${defaultURL}/#!/login`); + let dialog = await this.evaluate(() => { + return document.querySelector('button[response="accept"]'); + }); + if (dialog) + await this.waitToClick('button[response="accept"]'); + } - if (accountClicked) { - let buttonSelector = '.vn-dialog.shown button[response=accept]'; - await this.waitToClick('#logout') - .wait(buttonSelector => { - return document.querySelector(buttonSelector) != null - || location.hash == '#!/login'; - }, buttonSelector); - await this.clickIfExists(buttonSelector); - } - - try { - await this.waitForURL('#!/login'); - } catch (e) { - await this.goto(`${config.url}/#!/login`); - } - - await this.doLogin(userName, null) - .waitForURL('#!/') - .changeLanguageToEnglish(); - - currentUser = userName; - } else - await this.waitToClick('a[ui-sref=home]'); - }, - - waitForLogin: async function(userName) { - await this.login(userName); + await this.doLogin(userName); + await this.wait(() => { + return document.location.hash === '#!/'; + }, {}); + await this.changeLanguageToEnglish(); }, selectModule: async function(moduleName) { @@ -81,13 +70,14 @@ let actions = { return m[0] + '-' + m[1]; }).toLowerCase(); - await this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`) - .waitForURL(snakeName); + let selector = `vn-home a[ui-sref="${moduleName}.index"]`; + await this.waitToClick(selector); + await this.waitForURL(snakeName); }, loginAndModule: async function(userName, moduleName) { - await this.login(userName) - .selectModule(moduleName); + await this.login(userName); + await this.selectModule(moduleName); }, datePicker: async function(selector, changeMonth, day) { @@ -96,369 +86,434 @@ let actions = { date.setDate(day ? day : 16); date = date.toISOString().substr(0, 10); - await this.wait(selector) - .evaluate((selector, date) => { - let input = document.querySelector(selector).$ctrl.input; - input.value = date; - input.dispatchEvent(new Event('change')); - }, selector, date); + await this.wait(selector); + await this.evaluate((selector, date) => { + let input = document.querySelector(selector).$ctrl.input; + input.value = date; + input.dispatchEvent(new Event('change')); + }, selector, date); }, pickTime: async function(selector, time) { - await this.wait(selector) - .evaluate((selector, time) => { - let input = document.querySelector(selector).$ctrl.input; - input.value = time; - input.dispatchEvent(new Event('change')); - }, selector, time); + await this.wait(selector); + await this.evaluate((selector, time) => { + let input = document.querySelector(selector).$ctrl.input; + input.value = time; + input.dispatchEvent(new Event('change')); + }, selector, time); }, - clearTextarea: function(selector) { - return this.wait(selector) - .evaluate(inputSelector => { - return document.querySelector(inputSelector).value = ''; + clearTextarea: async function(selector) { + await this.wait(selector); + await this.evaluate(inputSelector => { + return document.querySelector(inputSelector).value = ''; + }, selector); + }, + + clearInput: async function(selector) { + await this.wait(selector); + let field = await this.evaluate(selector => { + return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field; + }, selector); + if ((field != null && field != '') || field == '0') { + let coords = await this.evaluate(selector => { + let rect = document.querySelector(selector).getBoundingClientRect(); + return {x: rect.x + (rect.width / 2), y: rect.y + (rect.height / 2), width: rect.width}; }, selector); + await this.mouse.move(coords.x, coords.y); + await this.waitForSelector(`${selector} [icon="clear"]`, {visible: true}); + await this.waitToClick(`${selector} [icon="clear"]`); + } + await this.evaluate(selector => { + return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field == ''; + }, selector); }, - clearInput: function(selector) { - return this.wait(selector) - .evaluate(selector => { - let $ctrl = document.querySelector(selector).closest('.vn-field').$ctrl; - $ctrl.field = null; - $ctrl.$.$apply(); - $ctrl.input.dispatchEvent(new Event('change')); - }, selector); - }, - - getProperty: function(selector, property) { - return this.evaluate((selector, property) => { + getProperty: async function(selector, property) { + return await this.evaluate((selector, property) => { return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim(); }, selector, property); }, - waitPropertyLength: function(selector, property, minLength) { - return this.wait((selector, property, minLength) => { + waitPropertyLength: async function(selector, property, minLength) { + await this.wait((selector, property, minLength) => { const element = document.querySelector(selector); return element && element[property] != null && element[property] !== '' && element[property].length >= minLength; - }, selector, property, minLength) - .getProperty(selector, property); + }, {}, selector, property, minLength); + return await this.getProperty(selector, property); }, - waitPropertyValue: function(selector, property, status) { - return this.wait(selector) - .wait((selector, property, status) => { - const element = document.querySelector(selector); - return element[property] === status; - }, selector, property, status); - }, - - waitToGetProperty: function(selector, property) { - return this.wait((selector, property) => { + waitPropertyValue: async function(selector, property, status) { + await this.waitForSelector(selector); + return await this.waitForFunction((selector, property, status) => { const element = document.querySelector(selector); - - return element && element[property] != null && element[property] !== ''; - }, selector, property) - .getProperty(selector, property); + return element[property] === status; + }, {}, selector, property, status); }, - write: function(selector, text) { - return this.wait(selector) - .type(selector, text); + waitToGetProperty: async function(selector, property) { + try { + await this.waitForFunction((selector, property) => { + const element = document.querySelector(selector); + + return element && element[property] != null && element[property] !== ''; + }, {}, selector, property); + return await this.getProperty(selector, property); + } catch (error) { + throw new Error(`couldn't get property: ${property} of ${selector}`); + } }, - waitToClick: function(selector) { - return this.wait(selector) - .click(selector); + write: async function(selector, text) { + await this.waitForSelector(selector, {}); + await this.type(`${selector} input`, text); + await this.waitForTextInInput(selector, text); }, - focusElement: function(selector) { - return this.wait(selector) - .evaluate(selector => { - let element = document.querySelector(selector); - element.focus(); - }, selector); + waitToClick: async function(selector) { + await this.waitForSelector(selector, {}); + await this.click(selector, {waitUntil: 'domcontentloaded'}); }, - isVisible: function(selector) { - return this.wait(selector) - .evaluate(elementSelector => { - let selectorMatches = document.querySelectorAll(elementSelector); - let element = selectorMatches[0]; - - if (selectorMatches.length > 1) - throw new Error(`Multiple matches of ${elementSelector} found`); - - let isVisible = false; - if (element) { - let eventHandler = event => { - event.preventDefault(); - isVisible = true; - }; - element.addEventListener('mouseover', eventHandler); - let rect = element.getBoundingClientRect(); - let x = rect.left + rect.width / 2; - let y = rect.top + rect.height / 2; - let elementInCenter = document.elementFromPoint(x, y); - let elementInTopLeft = document.elementFromPoint(rect.left, rect.top); - let elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom); - - let e = new MouseEvent('mouseover', { - view: window, - bubbles: true, - cancelable: true, - }); - - if (elementInCenter) - elementInCenter.dispatchEvent(e); - - if (elementInTopLeft) - elementInTopLeft.dispatchEvent(e); - - if (elementInBottomRight) - elementInBottomRight.dispatchEvent(e); - - element.removeEventListener('mouseover', eventHandler); - } - return isVisible; - }, selector); + focusElement: async function(selector) { + await this.wait(selector); + return await this.evaluate(selector => { + let element = document.querySelector(selector); + element.focus(); + }, selector); }, - waitImgLoad: function(selector) { - return this.wait(selector) - .wait(selector => { - const imageReady = document.querySelector(selector).complete; - return imageReady; - }, selector); + isVisible: async function(selector) { + await this.wait(selector); + return await this.evaluate(elementSelector => { + let selectorMatches = document.querySelectorAll(elementSelector); + let element = selectorMatches[0]; + + if (selectorMatches.length > 1) + throw new Error(`Multiple matches of ${elementSelector} found`); + + let isVisible = false; + if (element) { + let eventHandler = event => { + event.preventDefault(); + isVisible = true; + }; + element.addEventListener('mouseover', eventHandler); + let rect = element.getBoundingClientRect(); + let x = rect.left + rect.width / 2; + let y = rect.top + rect.height / 2; + let elementInCenter = document.elementFromPoint(x, y); + let elementInTopLeft = document.elementFromPoint(rect.left, rect.top); + let elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom); + + let e = new MouseEvent('mouseover', { + view: window, + bubbles: true, + cancelable: true, + }); + + if (elementInCenter) + elementInCenter.dispatchEvent(e); + + if (elementInTopLeft) + elementInTopLeft.dispatchEvent(e); + + if (elementInBottomRight) + elementInBottomRight.dispatchEvent(e); + + element.removeEventListener('mouseover', eventHandler); + } + return isVisible; + }, selector); }, - clickIfVisible: function(selector) { - return this.wait(selector) - .isVisible(selector) - .then(visible => { - if (visible) - return this.click(selector); - - throw new Error(`invisible selector: ${selector}`); - }); + waitImgLoad: async function(selector) { + await this.wait(selector); + return await this.wait(selector => { + const imageReady = document.querySelector(selector).complete; + return imageReady; + }, {}, selector); }, - countElement: function(selector) { - return this.evaluate(selector => { + clickIfVisible: async function(selector) { + await this.wait(selector); + let isVisible = await this.isVisible(selector); + + if (isVisible) + return await this.click(selector); + + throw new Error(`invisible selector: ${selector}`); + }, + + countElement: async function(selector) { + return await this.evaluate(selector => { return document.querySelectorAll(selector).length; }, selector); }, - waitForNumberOfElements: function(selector, count) { - return this.wait((selector, count) => { + waitForNumberOfElements: async function(selector, count) { + return await this.waitForFunction((selector, count) => { return document.querySelectorAll(selector).length === count; - }, selector, count); + }, {}, selector, count); }, - waitForClassNotPresent: function(selector, className) { - return this.wait(selector) - .wait((selector, className) => { - if (!document.querySelector(selector).classList.contains(className)) - return true; - }, selector, className); + waitForClassNotPresent: async function(selector, className) { + await this.wait(selector); + return await this.wait((selector, className) => { + if (!document.querySelector(selector).classList.contains(className)) + return true; + }, {}, selector, className); }, - waitForClassPresent: function(selector, className) { - return this.wait(selector) - .wait((elementSelector, targetClass) => { - if (document.querySelector(elementSelector).classList.contains(targetClass)) - return true; - }, selector, className); + waitForClassPresent: async function(selector, className) { + await this.wait(selector); + return await this.wait((elementSelector, targetClass) => { + if (document.querySelector(elementSelector).classList.contains(targetClass)) + return true; + }, {}, selector, className); }, - waitForTextInElement: function(selector, text) { - return this.wait(selector) - .wait((selector, text) => { - return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase()); - }, selector, text); + waitForTextInElement: async function(selector, text) { + await this.wait(selector); + return await this.wait((selector, text) => { + return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase()); + }, {}, selector, text); }, - waitForTextInInput: function(selector, text) { - return this.wait(selector) - .wait((selector, text) => { - return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase()); - }, selector, text); + waitForTextInInput: async function(selector, text) { + await this.wait(selector); + return await this.wait((selector, text) => { + return document.querySelector(`${selector} input`).value.toLowerCase().includes(text.toLowerCase()); + }, {}, selector, text); }, - waitForInnerText: function(selector) { - return this.wait(selector) - .wait(selector => { - const innerText = document.querySelector(selector).innerText; - return innerText != null && innerText != ''; - }, selector) - .evaluate(selector => { - return document.querySelector(selector).innerText; - }, selector); + waitForInnerText: async function(selector) { + await this.waitForSelector(selector, {}); + await this.waitForFunction(selector => { + const innerText = document.querySelector(selector).innerText; + return innerText != null && innerText != ''; + }, {}, selector); + return await this.evaluate(selector => { + return document.querySelector(selector).innerText; + }, selector); }, - waitForEmptyInnerText: function(selector) { - return this.wait(selector => { + waitForEmptyInnerText: async function(selector) { + return await this.wait(selector => { return document.querySelector(selector).innerText == ''; }, selector); }, - waitForURL: function(hashURL) { - return this.wait(hash => { - return document.location.hash.includes(hash); - }, hashURL); + waitForURL: async function(hashURL) { + await this.waitForFunction(expectedHash => { + return document.location.hash.includes(expectedHash); + }, {}, hashURL); }, - waitForShapes: function(selector) { - return this.wait(selector) - .evaluate(selector => { - const shapes = document.querySelectorAll(selector); - const shapesList = []; + hideSnackbar: async function() { + await this.waitToClick('#shapes .shown button'); + }, - for (const shape of shapes) - shapesList.push(shape.innerText); + waitForLastShape: async function(selector) { + await this.wait(selector); + let snackBarText = await this.evaluate(selector => { + const shape = document.querySelector(selector); + return shape.innerText; + }, selector); + await this.hideSnackbar(); + return snackBarText; + }, - return shapesList; + waitForLastSnackbar: async function() { + await this.wait(2000); // this needs a refactor to be somehow dynamic ie: page.waitForResponse(urlOrPredicate[, options]) or something to fire waitForLastShape once the request is completed + await this.waitForSpinnerLoad(); + return await this.waitForLastShape('vn-snackbar .shown .text'); + }, + + accessToSearchResult: async function(searchValue) { + await this.clearInput('vn-searchbar'); + await this.write('vn-searchbar', searchValue); + await this.waitToClick('vn-searchbar vn-icon[icon="search"]'); + await this.waitForNumberOfElements('.search-result', 1); + await this.waitFor(1000); + await this.evaluate(() => { + return document.querySelector('.search-result').click(); + }); + }, + + accessToSection: async function(sectionRoute) { + await this.waitForSelector(`vn-left-menu`, {visible: true}); + let nested = await this.evaluate(sectionRoute => { + return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null; + }, sectionRoute); + + if (nested) { + await this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]'); + await this.wait('vn-left-menu .expanded'); + } + + await this.evaluate(sectionRoute => { + let navButton = document.querySelector(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`); + navButton.scrollIntoViewIfNeeded(); + return navButton.click(); + }, sectionRoute); + await this.waitForNavigation({waitUntil: ['networkidle0']}); + }, + + autocompleteSearch: async function(selector, searchValue) { + try { + await this.waitToClick(`${selector} input`); + await this.waitForSelector(selector => { + document + .querySelector(`${selector} vn-drop-down`).$ctrl.content + .querySelectorAll('li'); }, selector); - }, - waitForSnackbar: function() { - return this.wait(500) - .waitForShapes('vn-snackbar .shape .text'); - }, - waitForLastShape: function(selector) { - return this.wait(selector) - .evaluate(selector => { - const shape = document.querySelector(selector); + await this.write(`.vn-drop-down.shown`, searchValue); + await this.waitForFunction((selector, searchValue) => { + let element = document + .querySelector(`${selector} vn-drop-down`).$ctrl.content + .querySelector('li.active'); + if (element) + return element.innerText.toLowerCase().includes(searchValue.toLowerCase()); + }, {}, selector, searchValue); - return shape.innerText; - }, selector); - }, - - waitForLastSnackbar: function() { - return this.wait(500) - .waitForSpinnerLoad() - .waitForLastShape('vn-snackbar .shape .text'); - }, - - accessToSearchResult: function(searchValue) { - return this.clearInput('vn-searchbar input') - .write('vn-searchbar input', searchValue) - .click('vn-searchbar vn-icon[icon="search"]') - .wait(100) - .waitForNumberOfElements('.search-result', 1) - .evaluate(() => { - return document.querySelector('ui-view vn-card vn-table') != null; - }) - .then(result => { - if (result) - return this.waitToClick('ui-view vn-card vn-td'); - - return this.waitToClick('ui-view vn-card a'); - }); - }, - - accessToSection: function(sectionRoute) { - return this.wait(`vn-left-menu`) - .evaluate(sectionRoute => { - return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null; - }, sectionRoute) - .then(nested => { - if (nested) { - this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]') - .wait('vn-left-menu .expanded'); - } - - return this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`) - .waitForSpinnerLoad(); - }); - }, - - autocompleteSearch: function(autocompleteSelector, searchValue) { - return this.waitToClick(`${autocompleteSelector} input`) - .write(`.vn-drop-down.shown input`, searchValue) - .waitToClick(`.vn-drop-down.shown li.active`) - .wait((autocompleteSelector, searchValue) => { - return document.querySelector(`${autocompleteSelector} input`).value - .toLowerCase() + await this.keyboard.press('Enter'); + await this.waitForFunction((selector, searchValue) => { + return document.querySelector(`${selector} input`).value.toLowerCase() .includes(searchValue.toLowerCase()); - }, autocompleteSelector, searchValue); + }, {}, selector, searchValue); + } catch (error) { + throw new Error(`${selector} failed to autocomplete ${searchValue}! ${error}`); + } + await this.waitForMutation(`.vn-drop-down`, 'childList'); }, - reloadSection: function(sectionRoute) { - return this.waitToClick('vn-icon[icon="desktop_windows"]') - .wait('vn-card.summary') - .waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`); + reloadSection: async function(sectionRoute) { + await this.waitFor(1000); + await Promise.all([ + this.waitForNavigation({waitUntil: 'networkidle0'}), + this.click('vn-icon[icon="desktop_windows"]', {}), + ]); + + await Promise.all([ + this.waitForNavigation({waitUntil: 'networkidle0'}), + this.click(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`, {}), + ]); }, - forceReloadSection: function(sectionRoute) { - return this.waitToClick('vn-icon[icon="desktop_windows"]') - .waitToClick('button[response="accept"]') - .wait('vn-card.summary') - .waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`); + forceReloadSection: async function(sectionRoute) { + await this.waitToClick('vn-icon[icon="desktop_windows"]'); + await this.waitToClick('button[response="accept"]'); + await this.wait('vn-card.summary'); + await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`); }, - checkboxState: function(selector) { - return this.wait(selector) - .evaluate(selector => { - let checkbox = document.querySelector(selector); - switch (checkbox.$ctrl.field) { - case null: - return 'intermediate'; - case true: - return 'checked'; - default: - return 'unchecked'; - } - }, selector); + checkboxState: async function(selector) { + await this.wait(selector); + return await this.evaluate(selector => { + let checkbox = document.querySelector(selector); + switch (checkbox.$ctrl.field) { + case null: + return 'intermediate'; + case true: + return 'checked'; + default: + return 'unchecked'; + } + }, selector); }, - isDisabled: function(selector) { - return this.wait(selector) - .evaluate(selector => { - let element = document.querySelector(selector); - return element.$ctrl.disabled; - }, selector); + isDisabled: async function(selector) { + await this.wait(selector); + return await this.evaluate(selector => { + let element = document.querySelector(selector); + return element.$ctrl.disabled; + }, selector); }, - waitForStylePresent: function(selector, property, value) { - return this.wait((selector, property, value) => { + waitForStylePresent: async function(selector, property, value) { + return await this.wait((selector, property, value) => { const element = document.querySelector(selector); return element.style[property] == value; - }, selector, property, value); + }, {}, selector, property, value); }, - waitForSpinnerLoad: function() { - return this.waitUntilNotPresent('vn-topbar vn-spinner'); + waitForSpinnerLoad: async function() { + await this.waitUntilNotPresent('vn-topbar vn-spinner'); }, - waitForWatcherData: function(selector) { - return this.wait(selector) - .wait(selector => { - const watcher = document.querySelector(selector); - let orgData = watcher.$ctrl.orgData; - return !angular.equals({}, orgData) && orgData != null; - }, selector) - .waitForSpinnerLoad(); + waitForWatcherData: async function(selector) { + await this.wait(selector); + await this.wait(selector => { + let watcher = document.querySelector(selector); + let orgData = watcher.$ctrl.orgData; + return !angular.equals({}, orgData) && orgData != null; + }, {}, selector); + await this.waitForSpinnerLoad(); + }, + + waitForMutation: async function(selector, type) { + try { + await this.evaluate((selector, type) => { + return new Promise(resolve => { + const config = {attributes: true, childList: true, subtree: true}; + const target = document.querySelector(selector); + + const onEnd = function(mutationsList, observer) { + resolve(); + + observer.disconnect(); + }; + const observer = new MutationObserver(onEnd); + observer.expectedType = type; + + observer.observe(target, config); + }); + }, selector, type); + } catch (error) { + throw new Error(`failed to wait for mutation type: ${type}`); + } + }, + + waitForTransitionEnd: async function(selector) { + await this.evaluate(selector => { + return new Promise(resolve => { + const transition = document.querySelector(selector); + const onEnd = function() { + transition.removeEventListener('transitionend', onEnd); + resolve(); + }; + transition.addEventListener('transitionend', onEnd); + }); + }, selector); + }, + + waitForContentLoaded: async function() { + await this.waitFor(1000); + // to be implemented in base of a directive loaded once al modules are done loading, further investigation required. + // await this.waitForFunction(() => { + // return new Promise(resolve => { + // angular.element(document).ready(() => resolve()); + // const $rootScope = angular.element(document).find('ui-view').injector().get('$rootScope'); + // $rootScope.$$postDigest(resolve()); + // $rootScope.$on('$viewContentLoaded', resolve()); + // }); + // }); } }; -for (let name in actions) { - Nightmare.action(name, function(...args) { - let fnArgs = args.slice(0, args.length - 1); - let done = args[args.length - 1]; +export function extendPage(page) { + for (let name in actions) { + page[name] = async(...args) => { + return await actions[name].call(page, ...args); + }; + } - actions[name].apply(this, fnArgs) - .then(res => done(null, res)) - .catch(err => { - let stringArgs = fnArgs - .map(i => typeof i == 'function' ? 'Function' : i) - .join(', '); + page.wait = page.waitFor; - let orgMessage = err.message.startsWith('.wait()') - ? '.wait() timed out' - : err.message; - - done(new Error(`.${name}(${stringArgs}) failed: ${orgMessage}`)); - }); - }); + return page; } + +export default actions; diff --git a/e2e/helpers/nightmare.js b/e2e/helpers/nightmare.js deleted file mode 100644 index 5b87f2dca..000000000 --- a/e2e/helpers/nightmare.js +++ /dev/null @@ -1,29 +0,0 @@ -const Nightmare = require('nightmare'); -const config = require('./config.js'); - -let nightmare; - -module.exports = function createNightmare(width = 1280, height = 800) { - if (nightmare) - return nightmare; - - nightmare = new Nightmare({ - show: process.env.E2E_SHOW, - typeInterval: 10, - x: 0, - y: 0, - waitTimeout: 2000, - // openDevTools: {mode: 'detach'} - }).viewport(width, height); - - nightmare.on('console', (type, message, ...args) => { - if (type === 'error') { - console[type](message, ...args); - throw new Error(message); - } else - console[type](message, ...args); - }); - - nightmare.header('Accept-Language', 'en'); - return nightmare.goto(config.url); -}; diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js new file mode 100644 index 000000000..01496be20 --- /dev/null +++ b/e2e/helpers/puppeteer.js @@ -0,0 +1,23 @@ + +import Puppeteer from 'puppeteer'; +import {extendPage} from './extensions'; +import {url as defaultURL} from './config'; + +export async function getBrowser() { + const browser = await Puppeteer.launch({ + args: [ + '--no-sandbox', + `--window-size=${ 1920 },${ 1080 }` + ], + defaultViewport: null, + headless: false, + slowMo: 0, // slow down by ms + }); + let page = (await browser.pages())[0]; + page = extendPage(page); + page.setDefaultTimeout(5000); + await page.goto(defaultURL, {waitUntil: 'networkidle0'}); + return {page, close: browser.close.bind(browser)}; +} + +export default getBrowser; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 347590a74..95f7610ba 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -15,29 +15,29 @@ export default { userLocalCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.localCompanyFk"]', userWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.warehouseFk"]', userCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.companyFk"]', - userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]', - userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]', - userConfigThirdAutocompleteClear: '#localCompany .icons > vn-icon[icon=clear]', + userConfigFirstAutocomplete: '#localWarehouse', + userConfigSecondAutocomplete: '#localBank', + userConfigThirdAutocomplete: '#localCompany', acceptButton: '.vn-confirm.shown button[response=accept]' }, clientsIndex: { - searchClientInput: `vn-textfield input`, + searchClientInput: 'vn-topbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', searchResult: 'vn-client-index .vn-item', createClientButton: `vn-float-button`, othersButton: 'vn-left-menu li[name="Others"] > a' }, createClientView: { - name: `vn-textfield input[name="name"]`, - taxNumber: `vn-textfield input[name="fi"]`, - socialName: `vn-textfield input[name="socialName"]`, - street: `vn-textfield input[name="street"]`, - postcode: `vn-textfield input[name="postcode"]`, - city: `vn-textfield input[name="city"]`, + name: `vn-client-create [ng-model="$ctrl.client.name"]`, + taxNumber: 'vn-client-create [ng-model="$ctrl.client.fi"]', + socialName: 'vn-client-create [ng-model="$ctrl.client.socialName"]', + street: 'vn-client-create [ng-model="$ctrl.client.street"]', + postcode: 'vn-client-create [ng-model="$ctrl.client.postcode"]', + city: 'vn-client-create [ng-model="$ctrl.client.city"]', province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`, country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`, - userName: `vn-textfield input[name="userName"]`, - email: `vn-textfield input[name="email"]`, + userName: 'vn-client-create [ng-model="$ctrl.client.userName"]', + email: 'vn-client-create [ng-model="$ctrl.client.email"]', salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`, createButton: `button[type=submit]`, cancelButton: 'vn-button[href="#!/client/index"]' @@ -48,22 +48,24 @@ export default { }, clientBasicData: { basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]', - nameInput: 'vn-textfield[ng-model="$ctrl.client.name"] input', - contactInput: 'vn-textfield[ng-model="$ctrl.client.contact"] input', - emailInput: 'vn-textfield[ng-model="$ctrl.client.email"] input', + nameInput: 'vn-client-basic-data [ng-model="$ctrl.client.name"]', + contactInput: 'vn-client-basic-data [ng-model="$ctrl.client.contact"]', + phoneInput: 'vn-client-basic-data [ng-model="$ctrl.client.phone"]', + mobileInput: 'vn-client-basic-data [ng-model="$ctrl.client.mobile"]', + emailInput: 'vn-client-basic-data [ng-model="$ctrl.client.email"]', salesPersonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]', saveButton: `button[type=submit]` }, clientFiscalData: { fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]', - socialNameInput: `vn-textfield input[name="socialName"]`, - fiscalIdInput: `vn-textfield input[name="fi"]`, + socialNameInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.socialName"]', + fiscalIdInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.fi"]', equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]', acceptPropagationButton: '.vn-confirm.shown button[response=accept]', - addressInput: `vn-textfield input[name="street"]`, - postcodeInput: `vn-textfield input[name="postcode"]`, - cityInput: `vn-textfield input[name="city"]`, + addressInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.street"]', + postcodeInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.postcode"]', + cityInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.city"]', provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]', countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]', activeCheckbox: 'vn-check[label="Active"]', @@ -78,17 +80,17 @@ export default { }, clientBillingData: { payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]', - IBANInput: `vn-client-billing-data vn-textfield input[name="iban"]`, - dueDayInput: `vn-client-billing-data vn-input-number input[name="dueDay"]`, + IBANInput: 'vn-client-billing-data [ng-model="$ctrl.client.iban"]', + dueDayInput: 'vn-client-billing-data [ng-model="$ctrl.client.dueDay"]', receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]', receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]', receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]', swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]', clearswiftBicButton: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"] .icons > vn-icon[icon=clear]', newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button', - newBankEntityName: '.vn-dialog.shown vn-textfield[label="Name"] input', - newBankEntityBIC: '.vn-dialog.shown vn-textfield[label="Swift / BIC"] input', - newBankEntityCode: '.vn-dialog.shown vn-textfield[label="Entity Code"] input', + newBankEntityName: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.name"]', + newBankEntityBIC: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.bic"]', + newBankEntityCode: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.id"]', acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]', saveButton: `button[type=submit]`, watcher: 'vn-client-billing-data vn-watcher' @@ -97,26 +99,28 @@ export default { addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]', createAddress: `vn-client-address-index vn-float-button`, defaultCheckboxInput: 'vn-check[label="Default"]', - consigneeInput: `vn-textfield input[name="nickname"]`, - streetAddressInput: `vn-textfield input[name="street"]`, - postcodeInput: `vn-textfield input[name="postalCode"]`, - cityInput: `vn-textfield input[name="city"]`, - provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceFk"]', - agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeFk"]', - phoneInput: `vn-textfield input[name="phone"]`, - mobileInput: `vn-textfield input[name="mobile"]`, + consigneeInput: '[ng-model="$ctrl.address.nickname"]', + streetAddressInput: '[ng-model="$ctrl.address.street"]', + postcodeInput: '[ng-model="$ctrl.address.postalCode"]', + cityInput: '[ng-model="$ctrl.address.city"]', + provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceId"]', + agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeId"]', + phoneInput: '[ng-model="$ctrl.address.phone"]', + mobileInput: '[ng-model="$ctrl.address.mobile"]', defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]', + incotermsAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.incotermsId"]', + customsAgentAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.customsAgentId"]', secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]', firstEditAddress: 'vn-client-address-index div:nth-child(1) > a', secondEditAddress: 'vn-client-address-index div:nth-child(2) > a', activeCheckbox: 'vn-check[label="Enabled"]', equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"]', - firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.observationTypeFk"]', - firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.description"] input', - secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.observationTypeFk"]', - secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.description"] input', + firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.observationTypeFk"]', + firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.description"]', + secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.observationTypeFk"]', + secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.description"]', addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]', - saveButton: `button[type=submit]`, + saveButton: 'button[type=submit]', cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]', cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button', watcher: 'vn-client-address-edit vn-watcher' @@ -124,27 +128,27 @@ export default { clientWebAccess: { webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]', enableWebAccessCheckbox: 'vn-check[label="Enable web access"]', - userNameInput: `vn-textfield input[name="name"]`, - saveButton: `button[type=submit]` + userNameInput: 'vn-client-web-access [ng-model="$ctrl.account.name"]', + saveButton: 'button[type=submit]' }, clientNotes: { - addNoteFloatButton: `vn-float-button`, - noteInput: 'vn-textarea[label="Note"]', - saveButton: `button[type=submit]`, + addNoteFloatButton: 'vn-float-button', + noteInput: '[ng-model="$ctrl.note.text"]', + saveButton: 'button[type=submit]', firstNoteText: 'vn-client-note .text' }, clientCredit: { - addCreditFloatButton: `vn-float-button`, - creditInput: `vn-input-number input[name="credit"]`, - saveButton: `button[type=submit]`, + addCreditFloatButton: 'vn-float-button', + creditInput: 'vn-client-credit-create [ng-model="$ctrl.client.credit"]', + saveButton: 'button[type=submit]', firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr' }, clientGreuge: { - addGreugeFloatButton: `vn-float-button`, - amountInput: `vn-input-number input[name="amount"]`, - descriptionInput: `vn-textfield input[name="description"]`, + addGreugeFloatButton: 'vn-float-button', + amountInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.amount"]', + descriptionInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.description"]', typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]', - saveButton: `button[type=submit]`, + saveButton: 'button[type=submit]', firstGreugeText: 'vn-client-greuge-index vn-card vn-table vn-tbody > vn-tr' }, clientMandate: { @@ -162,10 +166,10 @@ export default { }, clientBalance: { balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]', - companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyFk"]', + companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', newPaymentButton: `vn-float-button`, newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', - newPaymentAmountInput: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"] input', + newPaymentAmountInput: '.vn-dialog.shown [ng-model="$ctrl.receipt.amountPaid"]', saveButton: '.vn-dialog.shown vn-button[label="Save"]', firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' @@ -187,7 +191,7 @@ export default { searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]', searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]', acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]', - searchItemInput: 'vn-searchbar vn-textfield input', + searchItemInput: 'vn-searchbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', closeItemSummaryPreview: '.vn-popup.shown', fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]', @@ -209,18 +213,18 @@ export default { saveFieldsButton: '.vn-dialog.shown vn-horizontal:nth-child(16) > vn-button > button' }, itemCreateView: { - temporalName: `vn-textfield input[name="provisionalName"]`, + temporalName: 'vn-item-create [ng-model="$ctrl.item.provisionalName"]', typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]', intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]', originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', - createButton: `button[type=submit]`, + createButton: 'button[type=submit]', cancelButton: 'vn-button[ui-sref="item.index"]' }, itemDescriptor: { goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]', moreMenu: 'vn-item-descriptor vn-icon-menu[icon=more_vert]', moreMenuRegularizeButton: '.vn-drop-down.shown li[name="Regularize stock"]', - regularizeQuantityInput: '.vn-dialog.shown tpl-body > div > vn-textfield input', + regularizeQuantityInput: '.vn-dialog.shown [ng-model="$ctrl.quantity"]', regularizeWarehouseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.warehouseFk"]', editButton: 'vn-item-descriptor vn-float-button[icon="edit"]', regularizeSaveButton: '.vn-dialog.shown tpl-buttons > button', @@ -232,11 +236,11 @@ export default { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]', intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]', - nameInput: 'vn-textfield[label="Name"] input', - relevancyInput: 'vn-input-number[ng-model="$ctrl.item.relevancy"] input', + nameInput: 'vn-item-basic-data [ng-model="$ctrl.item.name"]', + relevancyInput: 'vn-item-basic-data [ng-model="$ctrl.item.relevancy"]', originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', expenseAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.expenseFk"]', - longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"] input', + longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"]', isActiveCheckbox: 'vn-check[label="Active"]', priceInKgCheckbox: 'vn-check[label="Price in kg"]', submitBasicDataButton: `button[type=submit]` @@ -245,47 +249,47 @@ export default { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', tagsButton: 'vn-left-menu a[ui-sref="item.card.tags"]', fourthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(4) > vn-autocomplete[ng-model="itemTag.tagFk"]', - fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Value"] input', - fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Relevancy"] input', + fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.value"]', + fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.priority"]', fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]', fifthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]', - fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Value"] input', - fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] input', + fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.value"]', + fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.priority"]', sixthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]', - sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] input', - sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] input', + sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.value"]', + sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.priority"]', seventhTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[ng-model="itemTag.tagFk"]', - seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Value"] input', - seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Relevancy"] input', + seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.value"]', + seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.priority"]', addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]', - submitItemTagsButton: `vn-item-tags button[type=submit]` + submitItemTagsButton: 'vn-item-tags button[type=submit]' }, itemTax: { undoChangesButton: 'vn-item-tax vn-button-bar > vn-button[label="Undo changes"]', firstClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[ng-model="tax.taxClassFk"]', secondClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="tax.taxClassFk"]', thirdClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="tax.taxClassFk"]', - submitTaxButton: `vn-item-tax button[type=submit]` + submitTaxButton: 'vn-item-tax button[type=submit]' }, itemBarcodes: { addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]', - thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(3) > vn-textfield input`, - submitBarcodesButton: `vn-item-barcode button[type=submit]`, + thirdCodeInput: 'vn-item-barcode vn-horizontal:nth-child(3) [ng-model="barcode.code"]', + submitBarcodesButton: 'vn-item-barcode button[type=submit]', firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]' }, itemNiches: { addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]', firstWarehouseAutocomplete: 'vn-item-niche vn-autocomplete[ng-model="niche.warehouseFk"]', - firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) > vn-textfield[label="Code"] input', + firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) [ng-model="niche.code"]', secondWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="niche.warehouseFk"]', - secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input', + secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) [ng-model="niche.code"]', secondNicheRemoveButton: 'vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]', thirdWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="niche.warehouseFk"]', - thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input', - submitNichesButton: `vn-item-niche button[type=submit]` + thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) [ng-model="niche.code"]', + submitNichesButton: 'vn-item-niche button[type=submit]' }, itemBotanical: { - botanicalInput: `vn-item-botanical vn-horizontal:nth-child(1) > vn-textfield input`, + botanicalInput: 'vn-item-botanical vn-horizontal:nth-child(1) [ng-model="$ctrl.botanical.botanical"]', genusAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]', speciesAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]', submitBotanicalButton: `vn-item-botanical button[type=submit]` @@ -326,20 +330,19 @@ export default { }, ticketsIndex: { openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', - advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"] input', + advancedSearchInvoiceOut: 'vn-ticket-search-panel [ng-model="filter.refFk"]', newTicketButton: 'vn-ticket-index > a', searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr', searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)', - searchTicketInput: `vn-searchbar input`, - searchWeeklyTicketInput: `vn-searchbar input`, + searchTicketInput: 'vn-searchbar', searchWeeklyClearInput: 'vn-searchbar vn-icon[icon=clear]', advancedSearchButton: 'vn-ticket-search-panel button[type=submit]', searchButton: 'vn-searchbar vn-icon[icon="search"]', searchWeeklyButton: 'vn-searchbar vn-icon[icon="search"]', moreMenu: 'vn-ticket-index vn-icon-menu[icon=more_vert]', menuWeeklyTickets: 'vn-left-menu [ui-sref="ticket.weekly.index"]', - sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[ng-model="weekly.weekDay"] input', + sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)', weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr', firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]', acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]' @@ -379,8 +382,8 @@ export default { firstNoteRemoveButton: 'vn-icon[icon="delete"]', addNoteButton: 'vn-icon[icon="add_circle"]', firstNoteTypeAutocomplete: 'vn-autocomplete[ng-model="observation.observationTypeFk"]', - firstDescriptionInput: 'vn-textfield[label="Description"] input', - submitNotesButton: `button[type=submit]` + firstDescriptionInput: 'vn-ticket-observation [ng-model="observation.description"]', + submitNotesButton: 'button[type=submit]' }, ticketExpedition: { expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]', @@ -391,7 +394,7 @@ export default { ticketPackages: { packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package"]', firstPackageAutocomplete: 'vn-autocomplete[label="Package"]', - firstQuantityInput: 'vn-input-number[ng-model="package.quantity"] input', + firstQuantityInput: 'vn-ticket-package vn-horizontal:nth-child(1) [ng-model="package.quantity"]', firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]', addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]', clearPackageAutocompleteButton: 'vn-autocomplete[label="Package"] .icons > vn-icon[icon=clear]', @@ -410,7 +413,6 @@ export default { moreMenuReserve: '.vn-drop-down.shown li[name="Mark as reserved"]', moreMenuUnmarkReseved: '.vn-drop-down.shown li[name="Unmark as reserved"]', moreMenuUpdateDiscount: '.vn-drop-down.shown li[name="Update discount"]', - moreMenuUpdateDiscountInput: '.vn-dialog.shown form vn-ticket-sale-edit-discount vn-input-number[ng-model="$ctrl.newDiscount"] input', transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text', transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable', firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]', @@ -418,15 +420,14 @@ export default { firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)', firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img', firstSaleZoomedImage: 'body > div > div > img', - firstSaleQuantity: 'vn-input-number[ng-model="sale.quantity"]:nth-child(1) input', + firstSaleQuantity: 'vn-ticket-sale [ng-model="sale.quantity"]', firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)', firstSaleQuantityClearInput: 'vn-textfield[ng-model="sale.quantity"] div.suffix > i', firstSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete', - idAutocompleteFirstResult: '.vn-drop-down.shown li', firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span', - firstSalePriceInput: '.vn-popover.shown vn-input-number input', + firstSalePriceInput: '.vn-popover.shown [ng-model="$ctrl.editedPrice"]', firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span', - firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-input-number input', + firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]', firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)', firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-fetched-tags section', @@ -439,18 +440,18 @@ export default { secondSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(2)', secondSaleId: 'vn-ticket-sale:nth-child(2) vn-td-editable:nth-child(4) text > span', secondSaleIdCell: 'vn-ticket-sale vn-tr:nth-child(2) > vn-td-editable:nth-child(4)', - secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete input', + secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete', secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete', - secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number input', + secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number', secondSaleConceptCell: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6) > div', - secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield input', + secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield', totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong', selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check', secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[ng-model="sale.checked"]', thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[ng-model="sale.checked"]', deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]', transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]', - moveToTicketInput: '.vn-popover.shown vn-textfield[ng-model="$ctrl.transfer.ticketId"] input', + moveToTicketInput: '.vn-popover.shown vn-textfield[ng-model="$ctrl.transfer.ticketId"]', moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]', moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]', moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]', @@ -482,13 +483,13 @@ export default { ticketRequests: { addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button', request: 'vn-ticket-request-index vn-table vn-tr', - descriptionInput: 'vn-ticket-request-create > form > div > vn-card > vn-horizontal:nth-child(1) > vn-textfield input', + descriptionInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.description"]', atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]', - quantityInput: 'vn-ticket-request-create vn-input-number input[name=quantity]', - priceInput: 'vn-ticket-request-create vn-input-number input[name=price]', + quantityInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.quantity"]', + priceInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.price"]', firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)', saveButton: 'vn-ticket-request-create button[type=submit]', - firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2)', + firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2) vn-textfield', }, ticketLog: { @@ -501,11 +502,11 @@ export default { addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button', firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]', firstServiceTypeAutocomplete: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]', - firstQuantityInput: 'vn-ticket-service vn-input-number[label="Quantity"] input', - firstPriceInput: 'vn-ticket-service vn-input-number[label="Price"] input', + firstQuantityInput: 'vn-ticket-service [ng-model="service.quantity"]', + firstPriceInput: 'vn-ticket-service [ng-model="service.price"]', firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]', fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]', - newServiceTypeNameInput: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"] input', + newServiceTypeNameInput: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]', newServiceTypeExpenseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newServiceType.expenseFk"]', serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal', saveServiceButton: `button[type=submit]`, @@ -518,7 +519,7 @@ export default { saveStateButton: `button[type=submit]` }, claimsIndex: { - searchClaimInput: `vn-searchbar input`, + searchClaimInput: 'vn-searchbar', searchResult: 'vn-claim-index vn-card > vn-table > div > vn-tbody > a', searchButton: 'vn-searchbar vn-icon[icon="search"]' }, @@ -548,12 +549,11 @@ export default { }, claimDetail: { secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(6) > span', - discountInput: '.vn-popover.shown vn-input-number[ng-model="$ctrl.newDiscount"] input', + discountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]', discoutPopoverMana: '.vn-popover.shown .content > div > vn-horizontal > h5', addItemButton: 'vn-claim-detail a vn-float-button', firstClaimableSaleFromTicket: '.vn-dialog.shown vn-tbody > vn-tr', claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr', - firstItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(1) vn-input-number[ng-model="saleClaimed.quantity"] input', totalClaimed: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-horizontal > div > vn-label-value:nth-child(2) > section > span', secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(8) > vn-icon-button > button > vn-icon > i' }, @@ -570,7 +570,7 @@ export default { secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]', secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.workerFk"]', secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', - saveDevelopmentButton: `button[type=submit]` + saveDevelopmentButton: 'button[type=submit]' }, claimAction: { importClaimButton: 'vn-claim-action vn-button[label="Import claim"]', @@ -585,9 +585,8 @@ export default { searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr', searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)', searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)', - searchOrderInput: `vn-order-index vn-textfield input`, searchButton: 'vn-searchbar vn-icon[icon="search"]', - createOrderButton: `vn-float-button`, + createOrderButton: 'vn-float-button', }, orderDescriptor: { returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]', @@ -598,21 +597,21 @@ export default { addressAutocomplete: 'vn-autocomplete[label="Address"]', agencyAutocomplete: 'vn-autocomplete[label="Agency"]', landedDatePicker: 'vn-date-picker[label="Landed"]', - createButton: `button[type=submit]`, + createButton: 'button[type=submit]', cancelButton: 'vn-button[href="#!/client/index"]' }, orderCatalog: { orderByAutocomplete: 'vn-autocomplete[label="Order by"]', plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]', - itemIdInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemFk"] input', - itemTagValueInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"] input', - openTagSearch: 'vn-catalog-filter > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i', + itemIdInput: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.itemId"]', + itemTagValueInput: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.value"]', + openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i', tagAutocomplete: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]', - tagValueInput: 'vn-order-catalog-search-panel vn-textfield[ng-model="filter.value"] input', + tagValueInput: 'vn-order-catalog-search-panel [ng-model="filter.value"]', searchTagButton: 'vn-order-catalog-search-panel button[type=submit]', - thirdFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]', - fourthFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]', + thirdFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]', + fourthFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]', }, orderBasicData: { clientAutocomplete: 'vn-autocomplete[label="Client"]', @@ -636,7 +635,7 @@ export default { createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]', vehicleAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', agencyAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', - descriptionInput: 'vn-route-create vn-textfield[ng-model="$ctrl.route.description"] input', + descriptionInput: 'vn-route-create [ng-model="$ctrl.route.description"]', submitButton: 'vn-route-create button[type=submit]' }, routeDescriptor: { @@ -649,26 +648,26 @@ export default { workerAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]', vehicleAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', agencyAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', - kmStartInput: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmStart"] input', - kmEndInput: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmEnd"] input', + kmStartInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmStart"]', + kmEndInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmEnd"]', createdDateInput: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]', - startedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.started"] input', - finishedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.finished"] input', + startedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.started"]', + finishedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.finished"]', saveButton: 'vn-route-basic-data button[type=submit]' }, routeTickets: { - firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"] input', - secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[ng-model="ticket.priority"] input', - thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[ng-model="ticket.priority"] input', - fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[ng-model="ticket.priority"] input', - eleventhTicketPriority: 'vn-route-tickets vn-tr:nth-child(11) vn-textfield[ng-model="ticket.priority"] input', + firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"]', + secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[ng-model="ticket.priority"]', + thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[ng-model="ticket.priority"]', + fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[ng-model="ticket.priority"]', + eleventhTicketPriority: 'vn-route-tickets vn-tr:nth-child(11) vn-textfield[ng-model="ticket.priority"]', firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check', buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]', firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]', confirmButton: '.vn-confirm.shown button[response="accept"]' }, workerPbx: { - extensionInput: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"] input', + extensionInput: 'vn-worker-pbx [ng-model="$ctrl.worker.sip.extension"]', saveButton: 'vn-worker-pbx button[type=submit]' }, workerTimeControl: { @@ -724,7 +723,7 @@ export default { acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]' }, invoiceOutIndex: { - searchInvoiceOutInput: `vn-searchbar input`, + searchInvoiceOutInput: 'vn-searchbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr', }, diff --git a/e2e/paths/01-login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js index f612ad23c..ff9752b2b 100644 --- a/e2e/paths/01-login/01_login.spec.js +++ b/e2e/paths/01-login/01_login.spec.js @@ -1,37 +1,42 @@ -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; -describe('Login path', () => { - const nightmare = createNightmare(); +describe('Login path', async() => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + }); + + afterAll(async() => { + await browser.close(); + }); it('should receive an error when the username is incorrect', async() => { - const result = await nightmare - .doLogin('badUser', null) - .waitForLastSnackbar(); + await page.doLogin('badUser', ''); + const result = await page.waitForLastSnackbar(); expect(result.length).toBeGreaterThan(0); }); it('should receive an error when the username is blank', async() => { - const result = await nightmare - .doLogin('', null) - .waitForLastSnackbar(); + await page.doLogin('', ''); + const result = await page.waitForLastSnackbar(); expect(result.length).toBeGreaterThan(0); }); it('should receive an error when the password is incorrect', async() => { - const result = await nightmare - .doLogin('employee', 'badPassword') - .waitForLastSnackbar(); + await page.doLogin('employee', 'badPassword'); + const result = await page.waitForLastSnackbar(); expect(result.length).toBeGreaterThan(0); }); it('should log in', async() => { - const url = await nightmare - .doLogin('employee', null) - .wait('#user') - .parsedUrl(); + await page.doLogin('employee', 'nightmare'); + await page.waitForNavigation(); + let url = await page.parsedUrl(); expect(url.hash).toEqual('#!/'); }); diff --git a/e2e/paths/02-client-module/01_create_client.spec.js b/e2e/paths/02-client-module/01_create_client.spec.js index f2fe30464..ea5ffb17d 100644 --- a/e2e/paths/02-client-module/01_create_client.spec.js +++ b/e2e/paths/02-client-module/01_create_client.spec.js @@ -1,90 +1,90 @@ import selectors from '../../helpers/selectors'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; -describe('Client create path', () => { - const nightmare = createNightmare(); +describe('Client create path', async() => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + }); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client'); + afterAll(async() => { + await browser.close(); }); it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => { - const result = await nightmare - .write(selectors.clientsIndex.searchClientInput, 'Carol Danvers') - .waitToClick(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 0) - .countElement(selectors.clientsIndex.searchResult); + await page.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers'); + await page.waitToClick(selectors.clientsIndex.searchButton); + await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0); + const result = await page.countElement(selectors.clientsIndex.searchResult); expect(result).toEqual(0); }); it('should now access to the create client view by clicking the create-client floating button', async() => { - const url = await nightmare - .waitToClick(selectors.clientsIndex.createClientButton) - .wait(selectors.createClientView.createButton) - .parsedUrl(); + await page.waitToClick(selectors.clientsIndex.createClientButton); + await page.wait(selectors.createClientView.createButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/client/create'); }); it('should receive an error when clicking the create button having all the form fields empty', async() => { - const result = await nightmare - .waitToClick(selectors.createClientView.createButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.createClientView.createButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); it('should receive an error when clicking the create button having name and Business name fields empty', async() => { - const result = await nightmare - .write(selectors.createClientView.taxNumber, '74451390E') - .write(selectors.createClientView.userName, 'CaptainMarvel') - .write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') - .autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher') - .waitToClick(selectors.createClientView.createButton) - .waitForLastSnackbar(); + await page.write(selectors.createClientView.taxNumber, '74451390E'); + await page.write(selectors.createClientView.userName, 'CaptainMarvel'); + await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es'); + await page.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher'); + await page.waitToClick(selectors.createClientView.createButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); it(`should attempt to create a new user with all it's data but wrong email`, async() => { - const result = await nightmare - .write(selectors.createClientView.name, 'Carol Danvers') - .write(selectors.createClientView.socialName, 'AVG tax') - .write(selectors.createClientView.street, 'Many places') - .autocompleteSearch(selectors.createClientView.country, 'España') - .autocompleteSearch(selectors.createClientView.province, 'Province one') - .write(selectors.createClientView.city, 'Valencia') - .write(selectors.createClientView.postcode, '46000') - .clearInput(selectors.createClientView.email) - .write(selectors.createClientView.email, 'incorrect email format') - .waitToClick(selectors.createClientView.createButton) - .waitForLastSnackbar(); + await page.write(selectors.createClientView.name, 'Carol Danvers'); + await page.write(selectors.createClientView.socialName, 'AVG tax'); + await page.write(selectors.createClientView.street, 'Many places'); + await page.waitForContentLoaded(); + await page.autocompleteSearch(selectors.createClientView.country, 'España'); + await page.autocompleteSearch(selectors.createClientView.province, 'Province one'); + await page.write(selectors.createClientView.city, 'Valencia'); + await page.write(selectors.createClientView.postcode, '46000'); + await page.clearInput(selectors.createClientView.email); + await page.write(selectors.createClientView.email, 'incorrect email format'); + await page.waitToClick(selectors.createClientView.createButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); it(`should attempt to create a new user with all it's data but wrong postal code`, async() => { - const result = await nightmare - .clearInput(selectors.createClientView.email) - .write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') - .clearInput(selectors.createClientView.postcode) - .write(selectors.createClientView.postcode, '479999') - .waitToClick(selectors.createClientView.createButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.createClientView.email); + await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es'); + await page.clearInput(selectors.createClientView.postcode); + await page.write(selectors.createClientView.postcode, '479999'); + await page.waitToClick(selectors.createClientView.createButton); + const result = await page.waitForLastSnackbar(); - expect(result).toEqual(`The postcode doesn't exists. Ensure you put the correct format`); + expect(result).toEqual(`The postcode doesn't exist. Please enter a correct one`); }); it(`should check for autocompleted city, province and country`, async() => { - const clientCity = await nightmare - .waitToGetProperty(`${selectors.createClientView.city}`, 'value'); + const clientCity = await page + .waitToGetProperty(`${selectors.createClientView.city} input`, 'value'); - const clientProvince = await nightmare + const clientProvince = await page .waitToGetProperty(`${selectors.createClientView.province} input`, 'value'); - const clientCountry = await nightmare + const clientCountry = await page .waitToGetProperty(`${selectors.createClientView.country} input`, 'value'); expect(clientCity).toEqual('Valencia'); @@ -93,33 +93,31 @@ describe('Client create path', () => { }); it(`should create a new user with all correct data`, async() => { - const result = await nightmare - .clearInput(selectors.createClientView.postcode) - .write(selectors.createClientView.postcode, '46000') - .waitToClick(selectors.createClientView.createButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.createClientView.postcode); + await page.write(selectors.createClientView.postcode, '46000'); + await page.waitToClick(selectors.createClientView.createButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should click on the Clients button of the top bar menu', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl(); + await page.waitFor(500); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.clientsButton); + await page.wait(selectors.clientsIndex.createClientButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/client/index'); }); it(`should search for the user Carol Danvers to confirm it exists`, async() => { - const result = await nightmare - .write(selectors.clientsIndex.searchClientInput, 'Carol Danvers') - .waitToClick(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countElement(selectors.clientsIndex.searchResult); + await page.waitForContentLoaded(); + await page.accessToSearchResult('Carol Danvers'); + await page.waitForURL('#!/client/114/summary'); + const url = await page.parsedUrl(); - expect(result).toEqual(1); + expect(url.hash).toEqual('#!/client/114/summary'); }); }); diff --git a/e2e/paths/02-client-module/02_edit_basic_data.spec.js b/e2e/paths/02-client-module/02_edit_basic_data.spec.js index dc0631613..94b617ed9 100644 --- a/e2e/paths/02-client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client-module/02_edit_basic_data.spec.js @@ -1,65 +1,68 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Edit basicData path', () => { - const nightmare = createNightmare(); - describe('as employee', () => { - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Bruce Wayne') - .accessToSection('client.card.basicData'); - }); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Bruce Wayne'); + await page.accessToSection('client.card.basicData'); + }); + afterAll(async() => { + await browser.close(); + }); + + describe('as employee', () => { it('should not be able to change the salesPerson', async() => { - const result = await nightmare - .wait(selectors.clientBasicData.nameInput) - .evaluate(selector => { - return document.querySelector(selector).disabled; - }, `${selectors.clientBasicData.salesPersonAutocomplete} input`); + await page.wait(selectors.clientBasicData.nameInput); + const result = await page.evaluate(selector => { + return document.querySelector(selector).disabled; + }, `${selectors.clientBasicData.salesPersonAutocomplete} input`); expect(result).toBeTruthy(); }); it('should edit the client basic data but leave salesPerson untainted', async() => { - const result = await nightmare - .clearInput(selectors.clientBasicData.nameInput) - .write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace') - .clearInput(selectors.clientBasicData.contactInput) - .write(selectors.clientBasicData.contactInput, 'David Haller') - .clearInput(selectors.clientBasicData.emailInput) - .write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es') - .autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets') - .waitToClick(selectors.clientBasicData.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.clientBasicData.nameInput); + await page.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace'); + await page.clearInput(selectors.clientBasicData.contactInput); + await page.write(selectors.clientBasicData.contactInput, 'David Haller'); + await page.clearInput(selectors.clientBasicData.emailInput); + await page.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es'); + await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets'); + await page.waitToClick(selectors.clientBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the name have been edited', async() => { - const result = await nightmare - .reloadSection('client.card.basicData') - .waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); + await page.reloadSection('client.card.basicData'); + const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value'); expect(result).toEqual('Ptonomy Wallace'); }); it('should confirm the contact name have been edited', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value'); expect(result).toEqual('David Haller'); }); it('should confirm the email have been edited', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value'); expect(result).toEqual('PWallace@verdnatura.es'); }); it('should confirm the channel have been selected', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value'); expect(result).toEqual('Rumors on the streets'); @@ -67,70 +70,66 @@ describe('Client Edit basicData path', () => { }); describe('as salesAssistant', () => { - beforeAll(() => { - nightmare - .loginAndModule('salesASsistant', 'client') - .accessToSearchResult('Ptonomy Wallace') - .accessToSection('client.card.basicData'); + beforeAll(async() => { + await page.loginAndModule('salesASsistant', 'client'); + await page.accessToSearchResult('Ptonomy Wallace'); + await page.accessToSection('client.card.basicData'); }); it('should be able to change the salesPerson', async() => { - const result = await nightmare - .wait(selectors.clientBasicData.nameInput) - .evaluate(selector => { - return document.querySelector(selector).disabled; - }, `${selectors.clientBasicData.salesPersonAutocomplete} input`); + await page.wait(selectors.clientBasicData.nameInput); + const result = await page.evaluate(selector => { + return document.querySelector(selector).disabled; + }, `${selectors.clientBasicData.salesPersonAutocomplete} input`); expect(result).toBeFalsy(); }); it('should edit the client basic data including salesPerson', async() => { - const result = await nightmare - .clearInput(selectors.clientBasicData.nameInput) - .write(selectors.clientBasicData.nameInput, 'Ororo Munroe') - .clearInput(selectors.clientBasicData.contactInput) - .write(selectors.clientBasicData.contactInput, 'Black Panther') - .clearInput(selectors.clientBasicData.emailInput) - .write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') - .autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick') - .autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper') - .waitToClick(selectors.clientBasicData.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.clientBasicData.nameInput); + await page.write(selectors.clientBasicData.nameInput, 'Ororo Munroe'); + await page.clearInput(selectors.clientBasicData.contactInput); + await page.write(selectors.clientBasicData.contactInput, 'Black Panther'); + await page.clearInput(selectors.clientBasicData.emailInput); + await page.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es'); + await page.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick'); + await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper'); + await page.waitToClick(selectors.clientBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should now confirm the name have been edited', async() => { - const result = await nightmare - .reloadSection('client.card.basicData') - .waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); + await page.reloadSection('client.card.basicData'); + const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value'); expect(result).toEqual('Ororo Munroe'); }); it('should now confirm the contact name have been edited', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value'); expect(result).toEqual('Black Panther'); }); it('should now confirm the email have been edited', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value'); expect(result).toEqual('Storm@verdnatura.es'); }); it('should confirm the sales person have been selected', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value'); expect(result).toEqual('replenisherNick'); }); it('should now confirm the channel have been selected', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value'); expect(result).toEqual('Metropolis newspaper'); diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js index 9d41ed223..25127e314 100644 --- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js @@ -1,314 +1,287 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Edit fiscalData path', () => { - const nightmare = createNightmare(); - describe('as employee', () => { - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Bruce Banner') - .accessToSection('client.card.address.index'); - }); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Bruce Banner'); + await page.accessToSection('client.card.address.index'); + }); + afterAll(async() => { + await browser.close(); + }); + + describe('as employee', () => { // Confirms all addresses have EQtax false for future propagation test step 1 it(`should click on the 1st edit icon to check EQtax isnt checked`, async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.firstEditAddress) - .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientAddresses.firstEditAddress); + const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); expect(result).toBe('unchecked'); }); // Confirms all addresses have EQtax false for future propagation test step 2 it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .waitToClick(selectors.clientAddresses.secondEditAddress) - .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientAddresses.addressesButton); + await page.waitToClick(selectors.clientAddresses.secondEditAddress); + const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); expect(result).toBe('unchecked'); }); it(`should click on the fiscal data button`, async() => { - const url = await nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl(); + await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); + await page.waitForURL('fiscal-data'); + const url = await page.parsedUrl(); expect(url.hash).toContain('fiscal-data'); }); it('should not be able to edit the verified data checkbox', async() => { - const result = await nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckbox) - .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); + await page.wait(selectors.clientFiscalData.verifiedDataCheckbox); + const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeTruthy(); }); }); describe('as administrative', () => { - beforeAll(() => { - nightmare - .loginAndModule('administrative', 'client') - .accessToSearchResult('Bruce Banner') - .accessToSection('client.card.fiscalData'); + beforeAll(async() => { + await page.loginAndModule('administrative', 'client'); + await page.accessToSearchResult('Bruce Banner'); + await page.accessToSection('client.card.fiscalData'); }); it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => { - const result = await nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .write(selectors.clientFiscalData.socialNameInput, 'SMASH') - .clearInput(selectors.clientFiscalData.fiscalIdInput) - .write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!') - .clearInput(selectors.clientFiscalData.addressInput) - .write(selectors.clientFiscalData.addressInput, 'Somewhere edited') - .autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España') - .autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one') - .clearInput(selectors.clientFiscalData.cityInput) - .write(selectors.clientFiscalData.cityInput, 'Valencia') - .clearInput(selectors.clientFiscalData.postcodeInput) - .write(selectors.clientFiscalData.postcodeInput, '46000') - .waitToClick(selectors.clientFiscalData.activeCheckbox) - .waitToClick(selectors.clientFiscalData.frozenCheckbox) - .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox) - .waitToClick(selectors.clientFiscalData.viesCheckbox) - .waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox) - .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox) - .waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox) - .waitToClick(selectors.clientFiscalData.verifiedDataCheckbox) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.wait(selectors.clientFiscalData.socialNameInput); + await page.clearInput(selectors.clientFiscalData.socialNameInput); + await page.write(selectors.clientFiscalData.socialNameInput, 'SMASH'); + await page.clearInput(selectors.clientFiscalData.fiscalIdInput); + await page.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!'); + await page.clearInput(selectors.clientFiscalData.addressInput); + await page.write(selectors.clientFiscalData.addressInput, 'Somewhere edited'); + await page.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España'); + await page.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one'); + await page.clearInput(selectors.clientFiscalData.cityInput); + await page.write(selectors.clientFiscalData.cityInput, 'Valencia'); + await page.clearInput(selectors.clientFiscalData.postcodeInput); + await page.write(selectors.clientFiscalData.postcodeInput, '46000'); + await page.waitToClick(selectors.clientFiscalData.activeCheckbox); + await page.waitToClick(selectors.clientFiscalData.frozenCheckbox); + await page.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox); + await page.waitToClick(selectors.clientFiscalData.viesCheckbox); + await page.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox); + await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox); + await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Invalid Tax number'); - }); + }, 15000); it(`should edit the fiscal this time with a valid fiscal id`, async() => { - const result = await nightmare - .clearInput(selectors.clientFiscalData.fiscalIdInput) - .write(selectors.clientFiscalData.fiscalIdInput, '94980061C') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.clientFiscalData.fiscalIdInput); + await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should propagate the Equalization tax', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.acceptPropagationButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Equivalent tax spreaded'); }); it('should receive an error if the fiscal id contains A or B at the beginning', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.viesCheckbox) - .clearInput(selectors.clientFiscalData.fiscalIdInput) - .write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientFiscalData.viesCheckbox); + await page.clearInput(selectors.clientFiscalData.fiscalIdInput); + await page.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Cannot check Equalization Tax in this NIF/CIF'); }); it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => { - const result = await nightmare - .clearInput(selectors.clientFiscalData.fiscalIdInput) - .write(selectors.clientFiscalData.fiscalIdInput, '94980061C') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.clientFiscalData.fiscalIdInput); + await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); // confirm all addresses have now EQtax checked step 1 it(`should click on the addresses button to access to the client's addresses`, async() => { - const url = await nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .waitForURL('/address/index') - .parsedUrl(); + await page.waitToClick(selectors.clientAddresses.addressesButton); + await page.waitForURL('/address/index'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/address/index'); }); // confirm all addresses have now EQtax checked step 2 it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.firstEditAddress) - .waitForWatcherData(selectors.clientAddresses.watcher) - .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientAddresses.firstEditAddress); + await page.waitForWatcherData(selectors.clientAddresses.watcher); + const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); expect(result).toBe('checked'); }); // confirm all addresses have now EQtax checked step 3 it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .waitToClick(selectors.clientAddresses.secondEditAddress) - .waitForWatcherData(selectors.clientAddresses.watcher) - .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientAddresses.addressesButton); + await page.waitToClick(selectors.clientAddresses.secondEditAddress); + await page.waitForWatcherData(selectors.clientAddresses.watcher); + const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); expect(result).toBe('checked'); }); it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitToClick(selectors.clientFiscalData.viesCheckbox) - .waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); + await page.waitToClick(selectors.clientFiscalData.viesCheckbox); + await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should propagate the Equalization tax changes', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.acceptPropagationButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Equivalent tax spreaded'); }); it('should confirm its name have been edited', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); expect(result).toEqual('SMASH'); }); it('should confirm the fiscal id have been edited', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.fiscalIdInput} input`, 'value'); expect(result).toEqual('94980061C'); }); it('should confirm the address have been edited', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientFiscalData.addressInput, 'value'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.addressInput} input`, 'value'); expect(result).toEqual('Somewhere edited'); }); it('should confirm the postcode have been edited', async() => { - const result = await nightmare - .waitToGetProperty(`${selectors.clientFiscalData.postcodeInput}`, 'value'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput} input`, 'value'); expect(result).toContain('46000'); }); it('should confirm the city have been autocompleted', async() => { - const result = await nightmare - .waitToGetProperty(`${selectors.clientFiscalData.cityInput}`, 'value'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.cityInput} input`, 'value'); expect(result).toEqual('Valencia'); }); it(`should confirm the province have been autocompleted`, async() => { - const result = await nightmare - .waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value'); expect(result).toEqual('Province one'); }); it('should confirm the country have been autocompleted', async() => { - const result = await nightmare - .waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value'); expect(result).toEqual('España'); }); it('should confirm active checkbox is unchecked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.activeCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.activeCheckbox); expect(result).toBe('unchecked'); }); it('should confirm frozen checkbox is checked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.frozenCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.frozenCheckbox); expect(result).toBe('checked'); }); it('should confirm Has to invoice checkbox is unchecked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox); expect(result).toBe('unchecked'); }); it('should confirm Vies checkbox is checked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.viesCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.viesCheckbox); expect(result).toBe('checked'); }); it('should confirm Invoice by mail checkbox is unchecked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox); expect(result).toBe('unchecked'); }); it('should confirm invoice by address checkbox is unchecked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox); expect(result).toBe('unchecked'); }); it('should confirm Equalization tax checkbox is unchecked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox); expect(result).toBe('unchecked'); }); it('should confirm Verified data checkbox is checked', async() => { - const result = await nightmare - .checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBe('checked'); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1 it(`should click on the addresses button to access to the client's addresses`, async() => { - const url = await nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .waitForURL('/address/index') - .parsedUrl(); + await page.waitToClick(selectors.clientAddresses.addressesButton); + await page.waitForURL('/address/index'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/address/index'); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2 it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.firstEditAddress) - .waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla') - .waitToClick(selectors.clientAddresses.equalizationTaxCheckbox) - .waitToClick(selectors.clientAddresses.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientAddresses.firstEditAddress); + await page.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla'); + await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3 it('should navigate back to fiscal data to confirm invoice by address is now checked', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForWatcherData(selectors.clientFiscalData.watcher) - .checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox); + await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); + await page.waitForWatcherData(selectors.clientFiscalData.watcher); + const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox); expect(result).toBe('checked'); }); diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index ffea943f1..4b6d83651 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -1,121 +1,105 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Edit billing data path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('administrative', 'client'); + await page.accessToSearchResult('Bruce Banner'); + await page.accessToSection('client.card.billingData'); + }); - beforeAll(() => { - nightmare - .loginAndModule('administrative', 'client') - .accessToSearchResult('Bruce Banner') - .accessToSection('client.card.billingData'); + afterAll(async() => { + await browser.close(); }); it(`should attempt to edit the billing data without an IBAN but fail`, async() => { - const snackbarMessage = await nightmare - .autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN') - .autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM') - .clearInput(selectors.clientBillingData.dueDayInput) - .write(selectors.clientBillingData.dueDayInput, '60') - .waitForTextInInput(selectors.clientBillingData.dueDayInput, '60') - .waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox) - .waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox) - .waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox) - .waitToClick(selectors.clientBillingData.saveButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN'); + await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM'); + await page.clearInput(selectors.clientBillingData.dueDayInput); + await page.write(selectors.clientBillingData.dueDayInput, '60'); + await page.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60'); + await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox); + await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox); + await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox); + await page.waitToClick(selectors.clientBillingData.saveButton); + let snackbarMessage = await page.waitForLastSnackbar(); expect(snackbarMessage).toEqual('That payment method requires an IBAN'); }); - it(`should add the IBAN but fail as it requires a BIC code`, async() => { - const snackbarMessage = await nightmare - .waitToClick(selectors.clientBillingData.clearswiftBicButton) - .clearInput(selectors.clientBillingData.IBANInput) - .write(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332') - .waitForTextInInput(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332') - .wait(1000) - .waitToClick(selectors.clientBillingData.saveButton) - .waitForLastSnackbar(); - - expect(snackbarMessage).toEqual('That payment method requires a BIC'); - }); - it(`should create a new BIC code`, async() => { - const newcode = await nightmare - .waitToClick(selectors.clientBillingData.newBankEntityButton) - .write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank') - .write(selectors.clientBillingData.newBankEntityCode, 9999) - .write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT') - .waitToClick(selectors.clientBillingData.acceptBankEntityButton) - .waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); + await page.waitToClick(selectors.clientBillingData.newBankEntityButton); + await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank'); + await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); + await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT'); + await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton); + await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank'); + let newcode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); expect(newcode).toEqual('GTHMCT Gotham City Bank'); }); - it(`should confirm the IBAN pay method is sucessfully saved`, async() => { - const payMethod = await nightmare - .waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value'); + it(`should confirm the IBAN pay method was sucessfully saved`, async() => { + let payMethod = await page.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value'); expect(payMethod).toEqual('PayMethod with IBAN'); }); it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => { - const AutomaticCode = await nightmare - .clearInput(selectors.clientBillingData.IBANInput) - .write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332') - .waitForTextInInput(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'caixesbb') - .waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); + await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332'); + await page.keyboard.press('Tab'); + await page.keyboard.press('Tab'); + await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb'); + let automaticCode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); - expect(AutomaticCode).toEqual('CAIXESBB Caixa Bank'); + expect(automaticCode).toEqual('CAIXESBB Caixa Bank'); }); it(`should save the form with all its new data`, async() => { - const snackbarMessages = await nightmare - .waitForWatcherData(selectors.clientBillingData.watcher) - .waitToClick(selectors.clientBillingData.saveButton) - .waitForSnackbar(); + await page.waitForContentLoaded(); + await page.waitForWatcherData(selectors.clientBillingData.watcher); + await page.waitToClick(selectors.clientBillingData.saveButton); + let snackbarMessage = await page.waitForLastSnackbar(); - expect(snackbarMessages).toEqual(jasmine.arrayContaining(['Data saved!'])); + expect(snackbarMessage).toEqual('Notification sent!'); }); it('should confirm the due day have been edited', async() => { - const dueDate = await nightmare - .waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value'); + let dueDate = await page.waitToGetProperty(`${selectors.clientBillingData.dueDayInput} input`, 'value'); expect(dueDate).toEqual('60'); }); it('should confirm the IBAN was saved', async() => { - const IBAN = await nightmare - .waitToGetProperty(selectors.clientBillingData.IBANInput, 'value'); + let IBAN = await page.waitToGetProperty(`${selectors.clientBillingData.IBANInput} input`, 'value'); expect(IBAN).toEqual('ES9121000418450200051332'); }); it('should confirm the swift / BIC code was saved', async() => { - const code = await nightmare - .waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); + let code = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); expect(code).toEqual('CAIXESBB Caixa Bank'); }); it('should confirm Received LCR checkbox is checked', async() => { - const result = await nightmare - .checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox); + let result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox); expect(result).toBe('checked'); }); it('should confirm Received core VNL checkbox is unchecked', async() => { - const result = await nightmare - .checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox); + let result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox); expect(result).toBe('unchecked'); }); it('should confirm Received B2B VNL checkbox is unchecked', async() => { - const result = await nightmare - .checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox); + let result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox); expect(result).toBe('unchecked'); }); diff --git a/e2e/paths/02-client-module/05_add_address.spec.js b/e2e/paths/02-client-module/05_add_address.spec.js index 4502a9be1..8eb4a86bf 100644 --- a/e2e/paths/02-client-module/05_add_address.spec.js +++ b/e2e/paths/02-client-module/05_add_address.spec.js @@ -1,119 +1,112 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Add address path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Bruce Banner'); + await page.accessToSection('client.card.address.index'); + }); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Bruce Banner') - .accessToSection('client.card.address.index'); + afterAll(async() => { + await browser.close(); }); it(`should click on the add new address button to access to the new address form`, async() => { - const url = await nightmare - .waitToClick(selectors.clientAddresses.createAddress) - .waitForURL('address/create') - .parsedUrl(); + await page.waitToClick(selectors.clientAddresses.createAddress); + await page.waitForURL('address/create'); + const url = await page.parsedUrl(); expect(url.hash).toContain('address/create'); }); it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.defaultCheckboxInput) - .clearInput(selectors.clientAddresses.streetAddressInput) - .autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one') - .clearInput(selectors.clientAddresses.cityInput) - .write(selectors.clientAddresses.cityInput, 'Valencia') - .clearInput(selectors.clientAddresses.postcodeInput) - .write(selectors.clientAddresses.postcodeInput, '46000') - .autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement') - .write(selectors.clientAddresses.phoneInput, '999887744') - .write(selectors.clientAddresses.mobileInput, '999887744') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientAddresses.defaultCheckboxInput); + await page.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province five'); + await page.write(selectors.clientAddresses.cityInput, 'Valencia'); + await page.write(selectors.clientAddresses.postcodeInput, '46000'); + await page.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement'); + await page.write(selectors.clientAddresses.phoneInput, '999887744'); + await page.write(selectors.clientAddresses.mobileInput, '999887744'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); - it('should confirm the postcode have been edited', async() => { - const result = await nightmare - .waitToGetProperty(`${selectors.clientAddresses.postcodeInput}`, 'value'); - expect(result).toContain('46000'); + it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => { + await page.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner'); + await page.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York'); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Incoterms is required for a non UEE member'); }); - it('should confirm the city have been autocompleted', async() => { - const result = await nightmare - .waitToGetProperty(`${selectors.clientAddresses.cityInput}`, 'value'); + it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => { + await page.autocompleteSearch(selectors.clientAddresses.incotermsAutocomplete, 'Free Alongside Ship'); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); - expect(result).toEqual('Valencia'); - }); - - - it(`should confirm the province have been autocompleted`, async() => { - const result = await nightmare - .waitToGetProperty(`${selectors.clientAddresses.provinceAutocomplete} input`, 'value'); - - expect(result).toEqual('Province one'); + expect(result).toEqual('Customs agent is required for a non UEE member'); }); it(`should create a new address with all it's data`, async() => { - const result = await nightmare - .write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner') - .write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York') - .waitToClick(selectors.clientAddresses.saveButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.clientAddresses.customsAgentAutocomplete, 'Agent one'); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); - it(`should click on the addresses button confirm the new address exists and it's the default one`, async() => { - const result = await nightmare - // .waitToClick(selectors.clientAddresses.addressesButton) - .waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText'); + it(`should click on the first address button to confirm the new address exists and it's the default one`, async() => { + const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText'); expect(result).toContain('320 Park Avenue New York'); }); - it(`should click on the make default icon of the second address then confirm it is the default one now`, async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.secondMakeDefaultStar) - .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') - .waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText'); + it(`should click on the make default icon of the second address`, async() => { + await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar); + const result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it(`should confirm the default address is the expected one`, async() => { + await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand'); + const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText'); expect(result).toContain('Somewhere in Thailand'); }); it(`should click on the edit icon of the default address`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') - .waitToClick(selectors.clientAddresses.firstEditAddress) - .waitForURL('/edit') - .parsedUrl(); + await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand'); + await page.waitToClick(selectors.clientAddresses.firstEditAddress); + await page.waitForURL('/edit'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/edit'); }); it(`should click on the active checkbox and receive an error to save it because it is the default address`, async() => { - const result = await nightmare - .waitForWatcherData(selectors.clientAddresses.watcher) - .waitToClick(selectors.clientAddresses.activeCheckbox) - .waitToClick(selectors.clientAddresses.saveButton) - .waitForLastSnackbar(); + await page.waitForWatcherData(selectors.clientAddresses.watcher); + await page.waitToClick(selectors.clientAddresses.activeCheckbox); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('The default consignee can not be unchecked'); }); - // this "it" should be removed if the watcher doesn't prevent the navigation upon state changes it(`should go back to the addreses section by clicking the cancel button`, async() => { - const url = await nightmare - .waitToClick(selectors.clientAddresses.cancelEditAddressButton) - .waitToClick('.vn-confirm.shown button[response="accept"]') - .waitForURL('address/index') - .parsedUrl(); + await page.waitToClick(selectors.clientAddresses.cancelEditAddressButton); + await page.waitToClick('.vn-confirm.shown button[response="accept"]'); + await page.waitForURL('address/index'); + const url = await page.parsedUrl(); expect(url.hash).toContain('address/index'); }); diff --git a/e2e/paths/02-client-module/06_add_address_notes.spec.js b/e2e/paths/02-client-module/06_add_address_notes.spec.js index a37fef529..c19de91b8 100644 --- a/e2e/paths/02-client-module/06_add_address_notes.spec.js +++ b/e2e/paths/02-client-module/06_add_address_notes.spec.js @@ -1,54 +1,55 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client add address notes path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Petter Parker'); + await page.accessToSection('client.card.address.index'); + }); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Petter Parker') - .accessToSection('client.card.address.index'); + afterAll(async() => { + await browser.close(); }); it(`should click on the edit icon of the default address`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') - .waitToClick(selectors.clientAddresses.firstEditAddress) - .waitForURL('/edit') - .parsedUrl(); + await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street'); + await page.waitToClick(selectors.clientAddresses.firstEditAddress); + await page.waitForURL('/edit'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/edit'); }); it('should not save a description without observation type', async() => { - const result = await nightmare - .waitToClick(selectors.clientAddresses.addObservationButton) - .write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') - .waitToClick(selectors.clientAddresses.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientAddresses.addObservationButton); + await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description'); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); it('should not save an observation type without description', async() => { - const result = await nightmare - .clearInput(selectors.clientAddresses.firstObservationDescriptionInput) - .autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial') - .waitToClick(selectors.clientAddresses.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.clientAddresses.firstObservationDescriptionInput); + await page.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial'); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); it('should create two new observations', async() => { - const result = await nightmare - .write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') - .waitToClick(selectors.clientAddresses.addObservationButton) - .autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one') - .write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description') - .waitToClick(selectors.clientAddresses.saveButton) - .waitForLastSnackbar(); + await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description'); + await page.waitToClick(selectors.clientAddresses.addObservationButton); + await page.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one'); + await page.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description'); + await page.waitToClick(selectors.clientAddresses.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); diff --git a/e2e/paths/02-client-module/07_edit_web_access.spec.js b/e2e/paths/02-client-module/07_edit_web_access.spec.js index 999b1c123..835c8c25e 100644 --- a/e2e/paths/02-client-module/07_edit_web_access.spec.js +++ b/e2e/paths/02-client-module/07_edit_web_access.spec.js @@ -1,41 +1,43 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Edit web access path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Bruce Banner'); + await page.accessToSection('client.card.webAccess'); + }); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Bruce Banner') - .accessToSection('client.card.webAccess'); + afterAll(async() => { + await browser.close(); }); it(`should uncheck the Enable web access checkbox and update the name`, async() => { - const result = await nightmare - .waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox) - .clearInput(selectors.clientWebAccess.userNameInput) - .write(selectors.clientWebAccess.userNameInput, 'Hulk') - .waitToClick(selectors.clientWebAccess.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox); + await page.clearInput(selectors.clientWebAccess.userNameInput); + await page.write(selectors.clientWebAccess.userNameInput, 'Hulk'); + await page.waitToClick(selectors.clientWebAccess.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm web access is now unchecked', async() => { - const result = await nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientsIndex.othersButton) - .waitToClick(selectors.clientWebAccess.webAccessButton) - .checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); + await page.waitToClick(selectors.clientBasicData.basicDataButton); + await page.wait(selectors.clientBasicData.nameInput); + await page.waitToClick(selectors.clientsIndex.othersButton); + await page.waitToClick(selectors.clientWebAccess.webAccessButton); + const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); expect(result).toBe('unchecked'); }); it('should confirm web access name have been updated', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value'); + const result = await page.waitToGetProperty(`${selectors.clientWebAccess.userNameInput} input`, 'value'); expect(result).toEqual('Hulk'); }); diff --git a/e2e/paths/02-client-module/08_add_notes.spec.js b/e2e/paths/02-client-module/08_add_notes.spec.js index 1528dd79b..6a9ae26f0 100644 --- a/e2e/paths/02-client-module/08_add_notes.spec.js +++ b/e2e/paths/02-client-module/08_add_notes.spec.js @@ -1,37 +1,40 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Add notes path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Bruce Banner'); + await page.accessToSection('client.card.note.index'); + }); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Bruce Banner') - .accessToSection('client.card.note.index'); + afterAll(async() => { + await browser.close(); }); it(`should click on the add note button`, async() => { - const url = await nightmare - .waitToClick(selectors.clientNotes.addNoteFloatButton) - .waitForURL('/note/create') - .parsedUrl(); + await page.waitToClick(selectors.clientNotes.addNoteFloatButton); + await page.waitForURL('/note/create'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/note/create'); }); it(`should create a note`, async() => { - const result = await nightmare - .write(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am') - .waitToClick(selectors.clientNotes.saveButton) - .waitForLastSnackbar(); + await page.waitFor(selectors.clientNotes.noteInput); + await page.type(`${selectors.clientNotes.noteInput} textarea`, 'Meeting with Black Widow 21st 9am'); + await page.waitToClick(selectors.clientNotes.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the note was created', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText'); + const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText'); expect(result).toEqual('Meeting with Black Widow 21st 9am'); }); diff --git a/e2e/paths/02-client-module/09_add_credit.spec.js b/e2e/paths/02-client-module/09_add_credit.spec.js index 60ff2d347..3f8aa0912 100644 --- a/e2e/paths/02-client-module/09_add_credit.spec.js +++ b/e2e/paths/02-client-module/09_add_credit.spec.js @@ -1,38 +1,42 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Add credit path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesAssistant', 'client'); + await page.accessToSearchResult('Hank Pym'); + await page.accessToSection('client.card.credit.index'); + }); - beforeAll(() => { - nightmare - .loginAndModule('salesAssistant', 'client') - .accessToSearchResult('Hank Pym') - .accessToSection('client.card.credit.index'); + afterAll(async() => { + await browser.close(); }); it(`should click on the add credit button`, async() => { - const url = await nightmare - .waitToClick(selectors.clientCredit.addCreditFloatButton) - .waitForURL('/credit/create') - .parsedUrl(); + await page.waitToClick(selectors.clientCredit.addCreditFloatButton); + await page.waitForURL('/credit/create'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/credit/create'); }); it(`should edit the credit`, async() => { - const result = await nightmare - .clearInput(selectors.clientCredit.creditInput) - .write(selectors.clientCredit.creditInput, 999) - .waitToClick(selectors.clientCredit.saveButton) - .waitForLastSnackbar(); + await page.waitForContentLoaded(); + await page.clearInput(selectors.clientCredit.creditInput); + await page.write(selectors.clientCredit.creditInput, '999'); + await page.waitToClick(selectors.clientCredit.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the credit was updated', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText'); + await page.waitForContentLoaded(); + const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText'); expect(result).toContain(999); expect(result).toContain('salesAssistant'); diff --git a/e2e/paths/02-client-module/10_add_greuge.spec.js b/e2e/paths/02-client-module/10_add_greuge.spec.js index 46fdf65e3..3a127ab12 100644 --- a/e2e/paths/02-client-module/10_add_greuge.spec.js +++ b/e2e/paths/02-client-module/10_add_greuge.spec.js @@ -1,48 +1,49 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client Add greuge path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesAssistant', 'client'); + await page.accessToSearchResult('Petter Parker'); + await page.accessToSection('client.card.greuge.index'); + }); - beforeAll(() => { - nightmare - .loginAndModule('salesAssistant', 'client') - .accessToSearchResult('Petter Parker') - .accessToSection('client.card.greuge.index'); + afterAll(async() => { + await browser.close(); }); it(`should click on the add greuge button`, async() => { - const url = await nightmare - .waitToClick(selectors.clientGreuge.addGreugeFloatButton) - .waitForURL('greuge/create') - .parsedUrl(); + await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton); + await page.waitForURL('greuge/create'); + const url = await page.parsedUrl(); expect(url.hash).toContain('greuge/create'); }); it(`should receive an error if all fields are empty but date and type on submit`, async() => { - const result = await nightmare - .autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff') - .waitToClick(selectors.clientGreuge.saveButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff'); + await page.waitToClick(selectors.clientGreuge.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); it(`should create a new greuge with all its data`, async() => { - const result = await nightmare - .write(selectors.clientGreuge.amountInput, 999) - .waitForTextInInput(selectors.clientGreuge.amountInput, '999') - .write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!') - .waitToClick(selectors.clientGreuge.saveButton) - .waitForLastSnackbar(); + await page.write(selectors.clientGreuge.amountInput, '999'); + await page.waitForTextInInput(selectors.clientGreuge.amountInput, '999'); + await page.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!'); + await page.waitToClick(selectors.clientGreuge.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the greuge was added to the list', async() => { - const result = await nightmare - .waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText'); + const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText'); expect(result).toContain(999); expect(result).toContain('new armor for Batman!'); diff --git a/e2e/paths/02-client-module/11_mandate.spec.js b/e2e/paths/02-client-module/11_mandate.spec.js index 4048ae8a2..a713a9c9d 100644 --- a/e2e/paths/02-client-module/11_mandate.spec.js +++ b/e2e/paths/02-client-module/11_mandate.spec.js @@ -1,18 +1,23 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client mandate path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'client'); + await page.accessToSearchResult('Petter Parker'); + await page.accessToSection('client.card.mandate'); + }); - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'client') - .accessToSearchResult('Petter Parker') - .accessToSection('client.card.mandate'); + afterAll(async() => { + await browser.close(); }); it('should confirm the client has a mandate of the CORE type', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText'); expect(result).toContain('1'); diff --git a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js index 398185ba5..ddb5f6d04 100644 --- a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js @@ -1,180 +1,167 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client lock verified data path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'client'); + await page.accessToSearchResult('Hank Pym'); + await page.accessToSection('client.card.fiscalData'); + }); + + afterAll(async() => { + await browser.close(); + }); describe('as salesPerson', () => { - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'client') - .accessToSearchResult('Hank Pym') - .accessToSection('client.card.fiscalData'); - }); - it('should confirm verified data button is disabled for salesPerson', async() => { - const result = await nightmare - .wait(200) - .wait(selectors.clientFiscalData.verifiedDataCheckbox) - .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); + await page.wait(200); + await page.wait(selectors.clientFiscalData.verifiedDataCheckbox); + const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeTruthy(); }); it('should edit the social name', async() => { - const result = await nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.wait(selectors.clientFiscalData.socialNameInput); + await page.clearInput(selectors.clientFiscalData.socialNameInput); + await page.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the social name have been edited', async() => { - const result = await nightmare - .reloadSection('client.card.fiscalData') - .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + await page.reloadSection('client.card.fiscalData'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); expect(result).toEqual('Captain America Civil War'); }); }); describe('as administrative', () => { - beforeAll(() => { - nightmare - .loginAndModule('administrative', 'client') - .accessToSearchResult('Hank Pym') - .accessToSection('client.card.fiscalData'); + beforeAll(async() => { + await page.loginAndModule('administrative', 'client'); + await page.accessToSearchResult('Hank Pym'); + await page.accessToSection('client.card.fiscalData'); }); it('should confirm verified data button is enabled for administrative', async() => { - const result = await nightmare - .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); + const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeFalsy(); }); it('should check the Verified data checkbox', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.verifiedDataCheckbox) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm Verified data checkbox is checked', async() => { - const isChecked = await nightmare - .reloadSection('client.card.fiscalData') - .checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); + await page.reloadSection('client.card.fiscalData'); + const isChecked = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); expect(isChecked).toEqual('checked'); }); it('should again edit the social name', async() => { - const result = await nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.wait(selectors.clientFiscalData.socialNameInput); + await page.clearInput(selectors.clientFiscalData.socialNameInput); + await page.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should again confirm the social name have been edited', async() => { - const result = await nightmare - .reloadSection('client.card.fiscalData') - .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + await page.reloadSection('client.card.fiscalData'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); expect(result).toEqual('Ant man and the Wasp'); }); }); describe('as salesPerson second run', () => { - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'client') - .accessToSearchResult('Hank Pym') - .accessToSection('client.card.fiscalData'); + beforeAll(async() => { + await page.loginAndModule('salesPerson', 'client'); + await page.accessToSearchResult('Hank Pym'); + await page.accessToSection('client.card.fiscalData'); }); it('should confirm verified data button is disabled once again for salesPerson', async() => { - const isDisabled = await nightmare - .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); + const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(isDisabled).toBeTruthy(); }); it('should not be able to save change throwing a verified data error', async() => { - const result = await nightmare - .clearInput(selectors.clientFiscalData.socialNameInput) - .write(selectors.clientFiscalData.socialNameInput, 'This wont happen') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar(); + await page.clearInput(selectors.clientFiscalData.socialNameInput); + await page.write(selectors.clientFiscalData.socialNameInput, 'This wont happen'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`])); }); }); describe('as salesAssistant', () => { - beforeAll(() => { - nightmare - .forceReloadSection('client.card.fiscalData') - .loginAndModule('salesAssistant', 'client') - .accessToSearchResult('Hank Pym') - .accessToSection('client.card.fiscalData'); + beforeAll(async() => { + await page.forceReloadSection('client.card.fiscalData'); + await page.loginAndModule('salesAssistant', 'client'); + await page.accessToSearchResult('Hank Pym'); + await page.accessToSection('client.card.fiscalData'); }); it('should confirm verified data button is enabled for salesAssistant', async() => { - const isDisabled = await nightmare - .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); + const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(isDisabled).toBeFalsy(); }); it('should now edit the social name', async() => { - const result = await nightmare - .clearInput(selectors.clientFiscalData.socialNameInput) - .write(selectors.clientFiscalData.socialNameInput, 'new social name edition') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.clientFiscalData.socialNameInput); + await page.write(selectors.clientFiscalData.socialNameInput, 'new social name edition'); + await page.waitToClick(selectors.clientFiscalData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should now confirm the social name have been edited once and for all', async() => { - const result = await nightmare - .reloadSection('client.card.fiscalData') - .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + await page.reloadSection('client.card.fiscalData'); + const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); expect(result).toEqual('new social name edition'); }); }); describe('as salesPerson third run', () => { - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'client') - .accessToSearchResult('Hank Pym') - .accessToSection('client.card.fiscalData'); + beforeAll(async() => { + await page.loginAndModule('salesPerson', 'client'); + await page.accessToSearchResult('Hank Pym'); + await page.accessToSection('client.card.fiscalData'); }); it('should confirm verified data button is enabled once again', async() => { - const isDisabled = await nightmare - .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); + const isDisabled = await page; + await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(isDisabled).toBeTruthy(); }); it('should confirm the form is enabled for salesPerson', async() => { - const result = await nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .evaluate(selector => { - return document.querySelector(selector).disabled; - }, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div'); + await page.wait(selectors.clientFiscalData.socialNameInput); + const result = await page.evaluate(selector => { + return document.querySelector(selector).disabled; + }, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div'); expect(result).toBeFalsy(); }); diff --git a/e2e/paths/02-client-module/13_log.spec.js b/e2e/paths/02-client-module/13_log.spec.js index 60ab6e7bc..4b09b0500 100644 --- a/e2e/paths/02-client-module/13_log.spec.js +++ b/e2e/paths/02-client-module/13_log.spec.js @@ -1,48 +1,51 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client log path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('DavidCharlesHaller'); + await page.accessToSection('client.card.basicData'); + }); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('DavidCharlesHaller') - .accessToSection('client.card.basicData'); + afterAll(async() => { + await browser.close(); }); it('should update the clients name', async() => { - let result = await nightmare - .clearInput(selectors.clientBasicData.nameInput) - .write(selectors.clientBasicData.nameInput, 'this is a test') - .waitToClick(selectors.clientBasicData.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.clientBasicData.nameInput); + await page.write(selectors.clientBasicData.nameInput, 'this is a test'); + await page.waitToClick(selectors.clientBasicData.saveButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should navigate to the log section', async() => { - let url = await nightmare - .waitToClick(selectors.clientLog.logButton) - .waitForURL('log') - .parsedUrl(); + await page.waitToClick(selectors.clientLog.logButton); + await page.waitForURL('log'); + let url = await page.parsedUrl(); expect(url.hash).toContain('log'); }); it('should check the previous value of the last logged change', async() => { - let lastModificationPreviousValue = await nightmare + let lastModificationPreviousValue = await page .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); expect(lastModificationPreviousValue).toContain('DavidCharlesHaller'); }); it('should check the current value of the last logged change', async() => { - let lastModificationPreviousValue = await nightmare + let lastModificationPreviousValue = await page .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); - let lastModificationCurrentValue = await nightmare - .waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); + let lastModificationCurrentValue = await page. + waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller'); diff --git a/e2e/paths/02-client-module/14_balance.spec.js b/e2e/paths/02-client-module/14_balance.spec.js index 56e1336c8..37b118ef2 100644 --- a/e2e/paths/02-client-module/14_balance.spec.js +++ b/e2e/paths/02-client-module/14_balance.spec.js @@ -1,66 +1,71 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client balance path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('administrative', 'client'); + await page.accessToSearchResult('Petter Parker'); + }, 30000); - beforeAll(() => { - nightmare - .loginAndModule('administrative', 'client') - .accessToSearchResult('Petter Parker'); + afterAll(async() => { + await browser.close(); }); it('should now edit the local user config data', async() => { - let result = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) - .autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs') - .waitForLastSnackbar(); + await page.waitToClick(selectors.globalItems.userMenuButton); + await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs'); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should access to the balance section to check the data shown matches the local settings', async() => { - let result = await nightmare - .accessToSection('client.card.balance.index') - .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); + await page.accessToSection('client.card.balance.index'); + let result = await page.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); expect(result).toEqual('CCs'); }); it('should now clear the user local settings', async() => { - let result = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) - .waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear) - .waitForLastSnackbar(); + await page.waitToClick(selectors.globalItems.userMenuButton); + await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should click the new payment button', async() => { - let url = await nightmare - .reloadSection('client.card.balance.index') - .waitToClick(selectors.clientBalance.newPaymentButton) - .waitForURL('/balance') - .parsedUrl(); + await page.keyboard.press('Escape'); + await page.reloadSection('client.card.balance.index'); + await page.waitForURL('/balance'); + + let url = await page.parsedUrl(); expect(url.hash).toContain('/balance'); }); it('should create a new payment that clears the debt', async() => { - let result = await nightmare - .autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt') - .waitToClick(selectors.clientBalance.saveButton) - .waitForLastSnackbar(); + await Promise.all([ + page.waitToClick(selectors.clientBalance.newPaymentButton), + page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true}) + ]); + await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt'); + await page.waitToClick(selectors.clientBalance.saveButton); + let result = await page.waitForLastSnackbar(); expect(result).toContain('Data saved!'); }); it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => { - let company = await nightmare - .waitForSpinnerLoad() + await page.waitForSpinnerLoad(); + let company = await page .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); - let firstBalanceLine = await nightmare + let firstBalanceLine = await page .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); @@ -68,95 +73,75 @@ describe('Client balance path', () => { expect(firstBalanceLine).toContain('0.00'); }); - it('should now click the new payment button', async() => { - let url = await nightmare - .waitToClick(selectors.clientBalance.newPaymentButton) - .waitForURL('/balance') - .parsedUrl(); - - expect(url.hash).toContain('/balance'); - }); - it('should create a new payment that sets the balance to positive value', async() => { - let result = await nightmare - .clearInput(selectors.clientBalance.newPaymentAmountInput) - .write(selectors.clientBalance.newPaymentAmountInput, '100') - .waitToClick(selectors.clientBalance.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientBalance.newPaymentButton); + await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :( + await page.clearInput(selectors.clientBalance.newPaymentAmountInput); + await page.write(selectors.clientBalance.newPaymentAmountInput, '100'); + await page.waitToClick(selectors.clientBalance.saveButton); + let result = await page.waitForLastSnackbar(); expect(result).toContain('Data saved!'); }); it('should check balance is now -100', async() => { - let result = await nightmare + let result = await page .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(result).toContain('-€100.00'); }); - it('should again click the new payment button', async() => { - let url = await nightmare - .waitToClick(selectors.clientBalance.newPaymentButton) - .waitForURL('/balance') - .parsedUrl(); - - expect(url.hash).toContain('/balance'); - }); - it('should create a new payment that sets the balance back to the original negative value', async() => { - let result = await nightmare - .clearInput(selectors.clientBalance.newPaymentAmountInput) - .write(selectors.clientBalance.newPaymentAmountInput, '-150') - .waitToClick(selectors.clientBalance.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.clientBalance.newPaymentButton); + await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :( + await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true}); + await page.clearInput(selectors.clientBalance.newPaymentAmountInput); + await page.write(selectors.clientBalance.newPaymentAmountInput, '-150'); + await page.waitToClick(selectors.clientBalance.saveButton); + let result = await page.waitForLastSnackbar(); expect(result).toContain('Data saved!'); }); it('should check balance is now 50', async() => { - let result = await nightmare + let result = await page .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(result).toEqual('€50.00'); }); it('should now click on the Clients button of the top bar menu', async() => { - let url = await nightmare - .waitForLogin('employee') - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl(); + await page.login('employee'); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.clientsButton); + await page.wait(selectors.clientsIndex.createClientButton); + let url = await page.parsedUrl(); expect(url.hash).toEqual('#!/client/index'); }); it('should now search for the user Petter Parker', async() => { - let resultCount = await nightmare - .write(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countElement(selectors.clientsIndex.searchResult); + await page.write(selectors.clientsIndex.searchClientInput, 'Petter Parker'); + await page.waitToClick(selectors.clientsIndex.searchButton); + await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1); + let resultCount = await page.countElement(selectors.clientsIndex.searchResult); expect(resultCount).toEqual(1); }); it(`should click on the search result to access to the client's balance`, async() => { - let url = await nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientBalance.balanceButton) - .waitForURL('/balance') - .parsedUrl(); + await page.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker'); + await page.waitToClick(selectors.clientsIndex.searchResult); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.clientBalance.balanceButton); + await page.waitForURL('/balance'); + let url = await page.parsedUrl(); expect(url.hash).toContain('/balance'); }); it('should not be able to click the new payment button as it isnt present', async() => { - let result = await nightmare - .exists(selectors.clientBalance.newPaymentButton); - - expect(result).toBeFalsy(); + await page.waitFor(selectors.clientBalance.newPaymentButton, {hidden: true}); }); }); diff --git a/e2e/paths/02-client-module/15_user_config.spec.js b/e2e/paths/02-client-module/15_user_config.spec.js index d47e4a447..cb91b1e37 100644 --- a/e2e/paths/02-client-module/15_user_config.spec.js +++ b/e2e/paths/02-client-module/15_user_config.spec.js @@ -1,30 +1,40 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('User config', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + }); + + afterAll(async() => { + await browser.close(); + }); describe('as salesPerson', () => { - beforeAll(() => { - nightmare - .waitForLogin('salesPerson'); + it('should login', async() => { + await page.login('salesPerson'); }); it('should now open the user config form to check the settings', async() => { - let userLocalWarehouse = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) + await page.waitToClick(selectors.globalItems.userMenuButton); + + let userLocalWarehouse = await page .getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); - let userLocalBank = await nightmare + + let userLocalBank = await page .getProperty(`${selectors.globalItems.userLocalBank} input`, 'value'); - let userLocalCompany = await nightmare + let userLocalCompany = await page .getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value'); - let userWarehouse = await nightmare + let userWarehouse = await page .waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value'); - let userCompany = await nightmare + let userCompany = await page .waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value'); expect(userLocalWarehouse).toEqual(''); @@ -36,26 +46,25 @@ describe('User config', () => { }); describe('as employee', () => { - beforeAll(() => { - nightmare - .waitForLogin('employee'); + it('should log in', async() => { + await page.login('employee'); }); it('should open the user config form to check the settings', async() => { - let userLocalWarehouse = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) + await page.waitToClick(selectors.globalItems.userMenuButton); + let userLocalWarehouse = await page .getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); - let userLocalBank = await nightmare + let userLocalBank = await page .getProperty(`${selectors.globalItems.userLocalBank} input`, 'value'); - let userLocalCompany = await nightmare + let userLocalCompany = await page .getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value'); - let userWarehouse = await nightmare + let userWarehouse = await page .waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value'); - let userCompany = await nightmare + let userCompany = await page .waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value'); expect(userLocalWarehouse).toEqual(''); @@ -66,37 +75,35 @@ describe('User config', () => { }); it('should now edit the user config data', async() => { - let result = await nightmare - .autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four') - .autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt') - .autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL') - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four'); + await page.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt'); + await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL'); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); }); describe('as salesPerson 2nd run', () => { - beforeAll(() => { - nightmare - .waitForLogin('salesPerson'); + it('should log in once more', async() => { + await page.login('salesPerson'); }); it('should again open the user config form to check the local settings', async() => { - let userLocalWarehouse = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) + await page.waitToClick(selectors.globalItems.userMenuButton); + let userLocalWarehouse = await page .waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); - let userLocalBank = await nightmare + let userLocalBank = await page .waitToGetProperty(`${selectors.globalItems.userLocalBank} input`, 'value'); - let userLocalCompany = await nightmare + let userLocalCompany = await page .waitToGetProperty(`${selectors.globalItems.userLocalCompany} input`, 'value'); - let userWarehouse = await nightmare + let userWarehouse = await page .waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value'); - let userCompany = await nightmare + let userCompany = await page .waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value'); expect(userLocalWarehouse).toContain('Warehouse Four'); @@ -107,12 +114,10 @@ describe('User config', () => { }); it('should now clear the local settings', async() => { - let result = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) - .waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear) - .waitToClick(selectors.globalItems.userConfigSecondAutocompleteClear) - .waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear) - .waitForLastSnackbar(); + await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete); + await page.clearInput(selectors.globalItems.userConfigSecondAutocomplete); + await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); diff --git a/e2e/paths/02-client-module/16_web_payment.spec.js b/e2e/paths/02-client-module/16_web_payment.spec.js index 3e9a26b75..3a4f50e76 100644 --- a/e2e/paths/02-client-module/16_web_payment.spec.js +++ b/e2e/paths/02-client-module/16_web_payment.spec.js @@ -1,40 +1,37 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client web Payment', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Tony Stark'); + await page.accessToSection('client.card.webPayment'); + }); + + afterAll(async() => { + await browser.close(); + }); describe('as employee', () => { - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Tony Stark') - .accessToSection('client.card.webPayment'); - }); - it('should not be able to confirm payments', async() => { - let exists = await nightmare - .exists(selectors.webPayment.confirmFirstPaymentButton); - - expect(exists).toBeFalsy(); + await page.waitFor(selectors.webPayment.confirmFirstPaymentButton, {hidden: true}); }); }); describe('as administrative', () => { - beforeAll(() => { - nightmare - .loginAndModule('administrative', 'client') - .accessToSearchResult('Tony Stark') - .accessToSection('client.card.webPayment'); + beforeAll(async() => { + await page.loginAndModule('administrative', 'client'); + await page.accessToSearchResult('Tony Stark'); + await page.accessToSection('client.card.webPayment'); }); it('should be able to confirm payments', async() => { - let exists = await nightmare - .waitToClick(selectors.webPayment.confirmFirstPaymentButton) - .wait(selectors.webPayment.firstPaymentConfirmed) - .exists(selectors.webPayment.firstPaymentConfirmed); - - expect(exists).toBeTruthy(); + await page.waitToClick(selectors.webPayment.confirmFirstPaymentButton); + await page.waitFor(selectors.webPayment.firstPaymentConfirmed, {hidden: true}); }); }); }); diff --git a/e2e/paths/02-client-module/17_dms.spec.js b/e2e/paths/02-client-module/17_dms.spec.js index 236401cf4..01a197c84 100644 --- a/e2e/paths/02-client-module/17_dms.spec.js +++ b/e2e/paths/02-client-module/17_dms.spec.js @@ -1,31 +1,34 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; describe('Client DMS', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'client'); + await page.accessToSearchResult('Tony Stark'); + await page.accessToSection('client.card.dms.index'); + }); + + afterAll(async() => { + await browser.close(); + }); describe('as salesPerson', () => { - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'client') - .accessToSearchResult('Tony Stark') - .accessToSection('client.card.dms.index'); - }); - it('should delete de first file', async() => { - let result = await nightmare - .waitToClick(selectors.dms.deleteFileButton) - .waitToClick(selectors.dms.acceptDeleteButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.dms.deleteFileButton); + await page.waitToClick(selectors.dms.acceptDeleteButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should click on the first document line worker name making the descriptor visible`, async() => { - const visible = await nightmare - .waitToClick(selectors.dms.firstDocWorker) - .wait(selectors.dms.firstDocWorkerDescriptor) - .isVisible(selectors.dms.firstDocWorkerDescriptor); + await page.waitToClick(selectors.dms.firstDocWorker); + await page.wait(selectors.dms.firstDocWorkerDescriptor); + const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor); expect(visible).toBeTruthy(); }); diff --git a/e2e/paths/03-worker-module/01_pbx.spec.js b/e2e/paths/03-worker-module/01_pbx.spec.js index 49d4db133..7b0de917c 100644 --- a/e2e/paths/03-worker-module/01_pbx.spec.js +++ b/e2e/paths/03-worker-module/01_pbx.spec.js @@ -1,32 +1,35 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Worker pbx path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('hr', 'worker'); + await page.accessToSearchResult('employee'); + await page.accessToSection('worker.card.pbx'); + }); - beforeAll(() => { - nightmare - .loginAndModule('hr', 'worker') - .accessToSearchResult('employee') - .accessToSection('worker.card.pbx'); + afterAll(async() => { + await browser.close(); }); it('should receive an error when the extension exceeds 4 characters', async() => { - const result = await nightmare - .write(selectors.workerPbx.extensionInput, 55555) - - .waitToClick(selectors.workerPbx.saveButton) - .waitForLastSnackbar(); + await page.waitForContentLoaded(); + await page.write(selectors.workerPbx.extensionInput, '55555'); + await page.waitToClick(selectors.workerPbx.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Extension format is invalid'); }); it('should sucessfully save the changes', async() => { - const result = await nightmare - .clearInput(selectors.workerPbx.extensionInput) - .write(selectors.workerPbx.extensionInput, 4444) - .waitToClick(selectors.workerPbx.saveButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.workerPbx.extensionInput); + await page.write(selectors.workerPbx.extensionInput, '4444'); + await page.waitToClick(selectors.workerPbx.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved! User must access web'); }); diff --git a/e2e/paths/03-worker-module/02_time_control.spec.js b/e2e/paths/03-worker-module/02_time_control.spec.js index 706fc2a74..6f5815665 100644 --- a/e2e/paths/03-worker-module/02_time_control.spec.js +++ b/e2e/paths/03-worker-module/02_time_control.spec.js @@ -1,95 +1,102 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; -describe('Worker time control path', () => { - const nightmare = createNightmare(); - - beforeAll(() => { - nightmare - .loginAndModule('hr', 'worker') - .accessToSearchResult('HankPym') - .accessToSection('worker.card.timeControl'); +// #2047 WorkerTimeControl no suma horas +xdescribe('Worker time control path', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesBoss', 'worker'); + await page.accessToSearchResult('HankPym'); + await page.accessToSection('worker.card.timeControl'); }); - describe('as HHRR', () => { + afterAll(async() => { + await browser.close(); + }); + + describe('as salesBoss', () => { describe('on Monday', () => { it('should scan in Hank Pym', async() => { const scanTime = '07:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.mondayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should scan out Hank Pym for break`, async() => { const scanTime = '10:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.mondayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => { const scanTime = '18:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.mondayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should delete the wrong entry for Hank Pym`, async() => { const wrongScanTime = '18:00'; - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime) - .waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete) - .waitToClick(selectors.workerTimeControl.acceptDeleteDialog) - .waitForLastSnackbar(); + + await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime); + await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete); + await page.waitToClick(selectors.workerTimeControl.acceptDeleteDialog); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Entry removed'); }); it(`should scan out Hank Pym to leave early`, async() => { const scanTime = '14:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.mondayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should add the break's scan in for Hank Pym and be in the right order`, async() => { const scanTime = '10:20'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.mondayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText'); expect(result).toEqual('14:00'); }); it(`should the third entry be the scan in from break`, async() => { const scanTime = '10:20'; - const result = await nightmare + + const result = await page .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should check Hank Pym worked 8 hours`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.') + await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.'); + const result = await page .waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText'); expect(result).toEqual('07:00 h.'); @@ -99,52 +106,51 @@ describe('Worker time control path', () => { describe('on Tuesday', () => { it('should happily scan in Hank Pym', async() => { const scanTime = '08:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should happily scan out Hank Pym for break`, async() => { const scanTime = '10:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should happily scan in Hank Pym from the break`, async() => { const scanTime = '10:20'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should happily scan out Hank Pym for the day`, async() => { const scanTime = '16:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should check Hank Pym worked 8 happy hours`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.') - .waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText'); + await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText'); expect(result).toEqual('08:00 h.'); }); @@ -153,52 +159,51 @@ describe('Worker time control path', () => { describe('on Wednesday', () => { it('should cheerfully scan in Hank Pym', async() => { const scanTime = '09:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should cheerfully scan out Hank Pym for break`, async() => { const scanTime = '10:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should cheerfully scan in Hank Pym from the break`, async() => { const scanTime = '10:20'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should cheerfully scan out Hank Pym for the day`, async() => { const scanTime = '17:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should check Hank Pym worked 8 cheerfull hours`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.') - .waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText'); + await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText'); expect(result).toEqual('08:00 h.'); }); @@ -207,52 +212,48 @@ describe('Worker time control path', () => { describe('on Thursday', () => { it('should joyfully scan in Hank Pym', async() => { const scanTime = '09:59'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.thursdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText'); + + await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should joyfully scan out Hank Pym for break`, async() => { const scanTime = '10:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.thursdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should joyfully scan in Hank Pym from the break`, async() => { const scanTime = '10:20'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.thursdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should joyfully scan out Hank Pym for the day`, async() => { const scanTime = '17:59'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.thursdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should check Hank Pym worked 8 joyfull hours`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.') - .waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText'); + await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText'); expect(result).toEqual('08:00 h.'); }); @@ -261,93 +262,88 @@ describe('Worker time control path', () => { describe('on Friday', () => { it('should smilingly scan in Hank Pym', async() => { const scanTime = '07:30'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.fridayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should smilingly scan out Hank Pym for break`, async() => { const scanTime = '10:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.fridayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should smilingly scan in Hank Pym from the break`, async() => { const scanTime = '10:20'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.fridayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should smilingly scan out Hank Pym for the day`, async() => { const scanTime = '15:30'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.fridayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.') - .waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText'); + await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText'); expect(result).toEqual('08:00 h.'); }); }); }); - describe('as hr', () => { + describe('as HHRR', () => { describe('on Saturday', () => { - beforeAll(() => { - nightmare - .loginAndModule('hr', 'worker') - .accessToSearchResult('HankPym') - .accessToSection('worker.card.timeControl'); + it('should log in and navigate to timeControl', async() => { + await page.loginAndModule('hr', 'worker'); + await page.accessToSearchResult('HankPym'); + await Promise.all([ + page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), + page.waitForContentLoaded(), + page.accessToSection('worker.card.timeControl') + ]); }); it('should lovingly scan in Hank Pym', async() => { const scanTime = '06:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.saturdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => { const scanTime = '13:40'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.saturdayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should check Hank Pym worked 8 hours with all his will`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.') - .waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText'); + await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText'); expect(result).toEqual('08:00 h.'); }); @@ -356,49 +352,48 @@ describe('Worker time control path', () => { describe('on Sunday', () => { it('should gladly scan in Hank Pym', async() => { const scanTime = '05:00'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.sundayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => { const scanTime = '12:40'; - const result = await nightmare - .waitToClick(selectors.workerTimeControl.sundayAddTimeButton) - .pickTime(selectors.workerTimeControl.timeDialogInput, scanTime) - .waitToClick(selectors.workerTimeControl.confirmButton) - .waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText'); + await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.waitToClick(selectors.workerTimeControl.confirmButton); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText'); expect(result).toEqual(scanTime); }); it(`should check Hank Pym worked 8 glad hours`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.') - .waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText'); + await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText'); expect(result).toEqual('08:00 h.'); }); it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => { - const wholeWeekHours = await nightmare - .waitToClick(selectors.workerTimeControl.nextMonthButton) - .waitToClick(selectors.workerTimeControl.secondWeekDay) - .waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.') + await page.waitToClick(selectors.workerTimeControl.nextMonthButton); + await page.waitToClick(selectors.workerTimeControl.secondWeekDay); + await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.'); + const wholeWeekHours = await page .waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); expect(wholeWeekHours).toEqual('00:00 h.'); }); it(`should check he didn't scan in this week yet`, async() => { - const wholeWeekHours = await nightmare - .waitToClick(selectors.workerTimeControl.navigateBackToIndex) - .accessToSearchResult('salesBoss') - .accessToSection('worker.card.timeControl') + await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex); + await page.accessToSearchResult('salesBoss'); + await page.accessToSection('worker.card.timeControl'); + await page.waitFor(1000); + + const wholeWeekHours = await page .waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); expect(wholeWeekHours).toEqual('00:00 h.'); @@ -407,17 +402,15 @@ describe('Worker time control path', () => { }); describe('after all this amazing week', () => { - beforeAll(() => { - nightmare - .loginAndModule('HankPym', 'worker') - .accessToSearchResult('HankPym') - .accessToSection('worker.card.timeControl'); + it('should log in Hank', async() => { + await page.loginAndModule('HankPym', 'worker'); + await page.accessToSearchResult('HankPym'); + await page.accessToSection('worker.card.timeControl'); }); - it('should Hank Pym check his hours are alright', async() => { - const wholeWeekHours = await nightmare - .waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.') - .waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); + it('should check his hours are alright', async() => { + await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.'); + const wholeWeekHours = await page.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); expect(wholeWeekHours).toEqual('55:00 h.'); }); diff --git a/e2e/paths/04-item-module/01_summary.spec.js b/e2e/paths/04-item-module/01_summary.spec.js index 8f493bfac..f08900142 100644 --- a/e2e/paths/04-item-module/01_summary.spec.js +++ b/e2e/paths/04-item-module/01_summary.spec.js @@ -1,202 +1,175 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item summary path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'item'); + }); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'item'); + afterAll(async() => { + await browser.close(); }); it('should search for an item', async() => { - const result = await nightmare - .clearInput(selectors.itemsIndex.searchItemInput) - .write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countElement(selectors.itemsIndex.searchResult); + await page.clearInput(selectors.itemsIndex.searchItemInput); + await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); + const result = await page.countElement(selectors.itemsIndex.searchResult); expect(result).toEqual(1); }); it(`should click on the search result summary button to open the item summary popup`, async() => { - const isVisible = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m') - .waitToClick(selectors.itemsIndex.searchResultPreviewButton) - .isVisible(selectors.itemSummary.basicData); + await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m'); + await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton); + const isVisible = await page.isVisible(selectors.itemSummary.basicData); expect(isVisible).toBeTruthy(); }); it(`should check the item summary preview shows fields from basic data`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m') - .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m'); + const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); expect(result).toContain('Ranged weapon longbow 2m'); }); it(`should check the item summary preview shows fields from tags`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.tags, 'Brown') - .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.tags, 'Brown'); + const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText'); expect(result).toContain('Brown'); }); it(`should check the item summary preview shows fields from niche`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.niche, 'A1') - .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.niche, 'A1'); + const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText'); expect(result).toContain('A1'); }); it(`should check the item summary preview shows fields from botanical`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix') - .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix'); + const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); expect(result).toContain('Hedera helix'); }); it(`should check the item summary preview shows fields from barcode`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.barcode, '1') - .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.barcode, '1'); + const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); expect(result).toContain('1'); }); it(`should close the summary popup`, async() => { - const result = await nightmare - .mousedown(selectors.itemsIndex.closeItemSummaryPreview) - .waitUntilNotPresent(selectors.itemSummary.basicData) - .visible(selectors.itemSummary.basicData); - - expect(result).toBeFalsy(); + await page.keyboard.press('Escape'); + await page.waitUntilNotPresent(selectors.itemSummary.basicData); + await page.waitFor(selectors.itemSummary.basicData, {hidden: true}); }); it('should search for other item', async() => { - const result = await nightmare - .clearInput('vn-searchbar input') - .waitToClick(selectors.itemsIndex.searchButton) - .write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countElement(selectors.itemsIndex.searchResult); + await page.clearInput('vn-searchbar'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); + const result = await page.countElement(selectors.itemsIndex.searchResult); expect(result).toEqual(1); }); it(`should now click on the search result summary button to open the item summary popup`, async() => { - const isVisible = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Melee weapon combat fist 15cm') - .waitToClick(selectors.itemsIndex.searchResultPreviewButton) - .isVisible(selectors.itemSummary.basicData); - - - expect(isVisible).toBeTruthy(); + await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton); + await page.waitForSelector(selectors.itemSummary.basicData, {visible: true}); }); it(`should now check the item summary preview shows fields from basic data`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm') - .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm'); + const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); expect(result).toContain('Melee weapon combat fist 15cm'); }); it(`should now check the item summary preview shows fields from tags`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.tags, 'Silver') - .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.tags, 'Silver'); + const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText'); expect(result).toContain('Silver'); }); it(`should now check the item summary preview shows fields from niche`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.niche, 'A4') - .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.niche, 'A4'); + const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText'); expect(result).toContain('A4'); }); it(`should now check the item summary preview shows fields from botanical`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.botanical, '-') - .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.botanical, '-'); + const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); expect(result).toContain('-'); }); it(`should now check the item summary preview shows fields from barcode`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.barcode, '4') - .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.barcode, '4'); + const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); expect(result).toContain('4'); }); it(`should now close the summary popup`, async() => { - const result = await nightmare - .mousedown(selectors.itemsIndex.closeItemSummaryPreview) - .waitUntilNotPresent(selectors.itemSummary.basicData) - .visible(selectors.itemSummary.basicData); - - expect(result).toBeFalsy(); + await page.keyboard.press('Escape'); + await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true}); }); it(`should navigate to the one of the items detailed section`, async() => { - const url = await nightmare - .waitToClick(selectors.itemsIndex.searchResult) - .waitForURL('summary') - .parsedUrl(); + await page.waitToClick(selectors.itemsIndex.searchResult); + await page.waitForURL('summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('summary'); }); it(`should check the descritor edit button is not visible for employee`, async() => { - const visibleButton = await nightmare - .isVisible(selectors.itemDescriptor.editButton); + const visibleButton = await page.isVisible(selectors.itemDescriptor.editButton); expect(visibleButton).toBeFalsy(); }); it(`should check the item summary shows fields from basic data section`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm') - .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); + await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm'); + const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); expect(result).toContain('Melee weapon combat fist 15cm'); }); it(`should check the item summary shows fields from tags section`, async() => { - const result = await nightmare - .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); + const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText'); expect(result).toContain('Silver'); }); it(`should check the item summary shows fields from niches section`, async() => { - const result = await nightmare - .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); + const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText'); expect(result).toContain('One A4'); }); it(`should check the item summary shows fields from botanical section`, async() => { - const result = await nightmare - .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); + const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); expect(result).toContain('-'); }); it(`should check the item summary shows fields from barcodes section`, async() => { - const result = await nightmare - .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); + const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); expect(result).toContain('4'); }); diff --git a/e2e/paths/04-item-module/02_basic_data.spec.js b/e2e/paths/04-item-module/02_basic_data.spec.js index 02f09b626..ab4b224f0 100644 --- a/e2e/paths/04-item-module/02_basic_data.spec.js +++ b/e2e/paths/04-item-module/02_basic_data.spec.js @@ -1,102 +1,103 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item Edit basic data path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + await page.accessToSearchResult('Melee weapon combat fist 15cm'); + await page.accessToSection('item.card.basicData'); + }); - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item') - .accessToSearchResult('Melee weapon combat fist 15cm') - .accessToSection('item.card.basicData'); + afterAll(async() => { + await browser.close(); }); it(`should check the descritor edit button is visible for buyer`, async() => { - const visibleButton = await nightmare - .isVisible(selectors.itemDescriptor.editButton); - - expect(visibleButton).toBeTruthy(); + await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true}); }); it(`should edit the item basic data`, async() => { - const result = await nightmare - .clearInput(selectors.itemBasicData.nameInput) - .write(selectors.itemBasicData.nameInput, 'Rose of Purity') - .autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium') - .autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares') - .clearInput(selectors.itemBasicData.relevancyInput) - .write(selectors.itemBasicData.relevancyInput, '1') - .autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain') - .autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH') - .clearInput(selectors.itemBasicData.longNameInput) - .write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity') - .waitToClick(selectors.itemBasicData.isActiveCheckbox) - .waitToClick(selectors.itemBasicData.priceInKgCheckbox) - .waitToClick(selectors.itemBasicData.submitBasicDataButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.itemBasicData.nameInput); + await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity'); + await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium'); + await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares'); + await page.clearInput(selectors.itemBasicData.relevancyInput); + await page.write(selectors.itemBasicData.relevancyInput, '1'); + await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain'); + await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH'); + await page.clearInput(selectors.itemBasicData.longNameInput); + await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity'); + await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); + await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox); + await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); - }, 15000); + }, 20000); it(`should confirm the item name was edited`, async() => { - const result = await nightmare - .reloadSection('item.card.basicData') - .waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); + await page.reloadSection('item.card.basicData'); + await page.waitForContentLoaded(); + const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value'); expect(result).toEqual('Rose of Purity'); }); it(`should confirm the item type was edited`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value'); expect(result).toEqual('Anthurium'); }); it(`should confirm the item intrastad was edited`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value'); expect(result).toEqual('5080000 Coral y materiales similares'); }); it(`should confirm the item relevancy was edited`, async() => { - const result = await nightmare - .waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.itemBasicData.relevancyInput} input`, 'value'); expect(result).toEqual('1'); }); it(`should confirm the item origin was edited`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value'); expect(result).toEqual('Spain'); }); it(`should confirm the item expence was edited`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value'); expect(result).toEqual('Alquiler VNH'); }); it(`should confirm the item long name was edited`, async() => { - const result = await nightmare - .waitToGetProperty(selectors.itemBasicData.longNameInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, 'value'); expect(result).toEqual('RS Rose of Purity'); }); it('should confirm isActive checkbox is unchecked', async() => { - const result = await nightmare + const result = await page .checkboxState(selectors.itemBasicData.isActiveCheckbox); expect(result).toBe('unchecked'); }); it('should confirm the priceInKg checkbox is checked', async() => { - const result = await nightmare + const result = await page .checkboxState(selectors.itemBasicData.priceInKgCheckbox); expect(result).toBe('checked'); diff --git a/e2e/paths/04-item-module/03_tax.spec.js b/e2e/paths/04-item-module/03_tax.spec.js index 903d05f10..3f3b387d4 100644 --- a/e2e/paths/04-item-module/03_tax.spec.js +++ b/e2e/paths/04-item-module/03_tax.spec.js @@ -1,61 +1,62 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item edit tax path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + await page.accessToSearchResult('Ranged weapon longbow 2m'); + await page.accessToSection('item.card.tax'); + }); - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item') - .accessToSearchResult('Ranged weapon longbow 2m') - .accessToSection('item.card.tax'); + afterAll(async() => { + await browser.close(); }); it(`should add the item tax to all countries`, async() => { - const result = await nightmare - .autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT') - .autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT') - .autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT') - .waitToClick(selectors.itemTax.submitTaxButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT'); + await page.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT'); + await page.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT'); + await page.waitToClick(selectors.itemTax.submitTaxButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the first item tax class was edited`, async() => { - const firstVatType = await nightmare - .reloadSection('item.card.tax') - .waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); + await page.reloadSection('item.card.tax'); + const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); expect(firstVatType).toEqual('General VAT'); }); it(`should confirm the second item tax class was edited`, async() => { - const secondVatType = await nightmare + const secondVatType = await page .waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, 'value'); expect(secondVatType).toEqual('General VAT'); }); it(`should confirm the third item tax class was edited`, async() => { - const thirdVatType = await nightmare + const thirdVatType = await page .waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value'); expect(thirdVatType).toEqual('General VAT'); }); it(`should edit the first class without saving the form`, async() => { - const firstVatType = await nightmare - .autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT') - .waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); + await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT'); + const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); expect(firstVatType).toEqual('Reduced VAT'); }); it(`should now click the undo changes button and see the changes works`, async() => { - const firstVatType = await nightmare - .waitToClick(selectors.itemTax.undoChangesButton) - .waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); + await page.waitToClick(selectors.itemTax.undoChangesButton); + const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); expect(firstVatType).toEqual('General VAT'); }); diff --git a/e2e/paths/04-item-module/04_tags.spec.js b/e2e/paths/04-item-module/04_tags.spec.js index 8c9c9bb94..1665d3bab 100644 --- a/e2e/paths/04-item-module/04_tags.spec.js +++ b/e2e/paths/04-item-module/04_tags.spec.js @@ -1,58 +1,61 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item create tags path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + await page.accessToSearchResult('Ranged weapon longbow 2m'); + await page.accessToSection('item.card.tags'); + }); - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item') - .accessToSearchResult('Ranged weapon longbow 2m') - .accessToSection('item.card.tags'); + afterAll(async() => { + await browser.close(); }); it(`should create a new tag and delete a former one`, async() => { - const result = await nightmare - .waitToClick(selectors.itemTags.fourthRemoveTagButton) - .waitToClick(selectors.itemTags.addItemTagButton) - .autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base') - .write(selectors.itemTags.seventhValueInput, '50') - .clearInput(selectors.itemTags.seventhRelevancyInput) - .write(selectors.itemTags.seventhRelevancyInput, '4') - .waitToClick(selectors.itemTags.submitItemTagsButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.itemTags.fourthRemoveTagButton); + await page.waitToClick(selectors.itemTags.addItemTagButton); + await page.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base'); + await page.write(selectors.itemTags.seventhValueInput, '50'); + await page.clearInput(selectors.itemTags.seventhRelevancyInput); + await page.write(selectors.itemTags.seventhRelevancyInput, '4'); + await page.waitToClick(selectors.itemTags.submitItemTagsButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the fourth row data is the expected one`, async() => { - let result = await nightmare - .reloadSection('item.card.tags') - .wait('vn-item-tags') - .waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value'); + await page.reloadSection('item.card.tags'); + await page.wait('vn-item-tags'); + let result = await page.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value'); expect(result).toEqual('Ancho de la base'); - result = await nightmare - .waitToGetProperty(selectors.itemTags.fourthValueInput, 'value'); + result = await page + .waitToGetProperty(`${selectors.itemTags.fourthValueInput} input`, 'value'); expect(result).toEqual('50'); - result = await nightmare - .waitToGetProperty(selectors.itemTags.fourthRelevancyInput, 'value'); + result = await page + .waitToGetProperty(`${selectors.itemTags.fourthRelevancyInput} input`, 'value'); expect(result).toEqual('4'); }); it(`should confirm the fifth row data is the expected one`, async() => { - let tag = await nightmare + let tag = await page .waitToGetProperty(`${selectors.itemTags.fifthTagAutocomplete} input`, 'value'); - let value = await nightmare - .waitToGetProperty(selectors.itemTags.fifthValueInput, 'value'); + let value = await page + .waitToGetProperty(`${selectors.itemTags.fifthValueInput} input`, 'value'); - let relevancy = await nightmare - .waitToGetProperty(selectors.itemTags.fifthRelevancyInput, 'value'); + let relevancy = await page + .waitToGetProperty(`${selectors.itemTags.fifthRelevancyInput} input`, 'value'); expect(tag).toEqual('Color'); expect(value).toEqual('Brown'); @@ -60,14 +63,14 @@ describe('Item create tags path', () => { }); it(`should confirm the sixth row data is the expected one`, async() => { - let tag = await nightmare + let tag = await page .waitToGetProperty(`${selectors.itemTags.sixthTagAutocomplete} input`, 'value'); - let value = await nightmare - .waitToGetProperty(selectors.itemTags.sixthValueInput, 'value'); + let value = await page + .waitToGetProperty(`${selectors.itemTags.sixthValueInput} input`, 'value'); - let relevancy = await nightmare - .waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value'); + let relevancy = await page + .waitToGetProperty(`${selectors.itemTags.sixthRelevancyInput} input`, 'value'); expect(tag).toEqual('Categoria'); expect(value).toEqual('+1 precission'); diff --git a/e2e/paths/04-item-module/05_niche.spec.js b/e2e/paths/04-item-module/05_niche.spec.js index 042b28638..345b5eb8c 100644 --- a/e2e/paths/04-item-module/05_niche.spec.js +++ b/e2e/paths/04-item-module/05_niche.spec.js @@ -1,61 +1,65 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item create niche path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + await page.accessToSearchResult('Ranged weapon longbow 2m'); + await page.accessToSection('item.card.niche'); + }); - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item') - .accessToSearchResult('Ranged weapon longbow 2m') - .accessToSection('item.card.niche'); + afterAll(async() => { + await browser.close(); }); it(`should click create a new niche and delete a former one`, async() => { - const result = await nightmare - .waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One') - .waitToClick(selectors.itemNiches.addNicheButton) - .waitToClick(selectors.itemNiches.secondNicheRemoveButton) - .autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two') - .write(selectors.itemNiches.thirdCodeInput, 'A4') - .waitToClick(selectors.itemNiches.submitNichesButton) - .waitForLastSnackbar(); + await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); + await page.waitToClick(selectors.itemNiches.addNicheButton); + await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton); + await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two'); + await page.write(selectors.itemNiches.thirdCodeInput, 'A4'); + await page.waitToClick(selectors.itemNiches.submitNichesButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the first niche is the expected one`, async() => { - let result = await nightmare - .reloadSection('item.card.niche') - .waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One') + await page.reloadSection('item.card.niche'); + await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); + let result = await page .waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value'); expect(result).toEqual('Warehouse One'); - result = await nightmare - .waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value'); + + result = await page + .waitToGetProperty(`${selectors.itemNiches.firstCodeInput} input`, 'value'); expect(result).toEqual('A1'); }); it(`should confirm the second niche is the expected one`, async() => { - let result = await nightmare + let result = await page .waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value'); expect(result).toEqual('Warehouse Three'); - result = await nightmare - .waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value'); - + result = await page + .waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, 'value'); expect(result).toEqual('A3'); }); it(`should confirm the third niche is the expected one`, async() => { - let result = await nightmare + let result = await page .waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, 'value'); expect(result).toEqual('Warehouse Two'); - result = await nightmare - .waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value'); + result = await page + .waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value'); expect(result).toEqual('A4'); }); diff --git a/e2e/paths/04-item-module/06_botanical.spec.js b/e2e/paths/04-item-module/06_botanical.spec.js index 864705056..407dd6fc7 100644 --- a/e2e/paths/04-item-module/06_botanical.spec.js +++ b/e2e/paths/04-item-module/06_botanical.spec.js @@ -1,82 +1,85 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item Create botanical path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + await page.accessToSearchResult('Ranged weapon pistol 9mm'); + await page.accessToSection('item.card.botanical'); + }); - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item') - .accessToSearchResult('Ranged weapon pistol 9mm') - .accessToSection('item.card.botanical'); + afterAll(async() => { + await browser.close(); }); it(`should create a new botanical for the item`, async() => { - const result = await nightmare - .write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') - .autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia') - .autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata') - .waitToClick(selectors.itemBotanical.submitBotanicalButton) - .waitForLastSnackbar(); + await page.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata'); + await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia'); + await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata'); + await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the botanical for the item was created`, async() => { - const result = await nightmare - .reloadSection('item.card.botanical') - .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') - .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); + await page.reloadSection('item.card.botanical'); + await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata'); + const result = await page + .waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value'); expect(result).toEqual('Cicuta maculata'); }); it(`should confirm the Genus for the item was created`, async() => { - const result = await nightmare - .waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abelia') + await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abelia'); + const result = await page .waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value'); expect(result).toEqual('Abelia'); }); it(`should confirm the Species for the item was created`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value'); expect(result).toEqual('dealbata'); }); it(`should edit botanical for the item`, async() => { - const result = await nightmare - .clearInput(selectors.itemBotanical.botanicalInput) - .write(selectors.itemBotanical.botanicalInput, 'Herp Derp') - .autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies') - .autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens') - .waitToClick(selectors.itemBotanical.submitBotanicalButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.itemBotanical.botanicalInput); + await page.write(selectors.itemBotanical.botanicalInput, 'Herp Derp'); + await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies'); + await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens'); + await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the botanical for the item was edited`, async() => { - const result = await nightmare - .reloadSection('item.card.botanical') - .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp') - .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); + await page.reloadSection('item.card.botanical'); + await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp'); + const result = await page + .waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value'); expect(result).toEqual('Herp Derp'); }); it(`should confirm the Genus for the item was edited`, async() => { - const result = await nightmare - .waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abies') + await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abies'); + const result = await page .waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value'); expect(result).toEqual('Abies'); }); it(`should confirm the Species for the item was edited`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value'); expect(result).toEqual('decurrens'); diff --git a/e2e/paths/04-item-module/07_barcode.spec.js b/e2e/paths/04-item-module/07_barcode.spec.js index db588cfe6..dfe16f384 100644 --- a/e2e/paths/04-item-module/07_barcode.spec.js +++ b/e2e/paths/04-item-module/07_barcode.spec.js @@ -1,32 +1,36 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item Create barcodes path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + await page.accessToSearchResult('Ranged weapon longbow 2m'); + await page.accessToSection('item.card.itemBarcode'); + }); - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item') - .accessToSearchResult('Ranged weapon longbow 2m') - .accessToSection('item.card.itemBarcode'); + afterAll(async() => { + await browser.close(); }); it(`should click create a new code and delete a former one`, async() => { - const result = await nightmare - .waitToClick(selectors.itemBarcodes.firstCodeRemoveButton) - .waitToClick(selectors.itemBarcodes.addBarcodeButton) - .write(selectors.itemBarcodes.thirdCodeInput, '5') - .waitToClick(selectors.itemBarcodes.submitBarcodesButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton); + await page.waitToClick(selectors.itemBarcodes.addBarcodeButton); + await page.write(selectors.itemBarcodes.thirdCodeInput, '5'); + await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => { - const result = await nightmare - .reloadSection('item.card.itemBarcode') - .waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5') - .waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value'); + await page.reloadSection('item.card.itemBarcode'); + await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5'); + const result = await page + .waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value'); expect(result).toEqual('5'); }); diff --git a/e2e/paths/04-item-module/08_create_and_clone.spec.js b/e2e/paths/04-item-module/08_create_and_clone.spec.js index 8f4952fb1..209e4f1cf 100644 --- a/e2e/paths/04-item-module/08_create_and_clone.spec.js +++ b/e2e/paths/04-item-module/08_create_and_clone.spec.js @@ -1,82 +1,84 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item Create/Clone path', () => { - const nightmare = createNightmare(); - describe('create', () => { - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item'); - }); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + }); + afterAll(async() => { + await browser.close(); + }); + + describe('create', () => { it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => { - const result = await nightmare - .clearInput(selectors.itemsIndex.searchItemInput) - .write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 0) - .countElement(selectors.itemsIndex.searchResult); + await page.clearInput(selectors.itemsIndex.searchItemInput); + await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0); + const result = await page.countElement(selectors.itemsIndex.searchResult); expect(result).toEqual(0); }); it('should access to the create item view by clicking the create floating button', async() => { - const url = await nightmare - .waitToClick(selectors.itemsIndex.createItemButton) - .wait(selectors.itemCreateView.createButton) - .parsedUrl(); + await page.waitToClick(selectors.itemsIndex.createItemButton); + await page.wait(selectors.itemCreateView.createButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/item/create'); }); it('should return to the item index by clickig the cancel button', async() => { - const url = await nightmare - .waitToClick(selectors.itemCreateView.cancelButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl(); + await page.waitToClick(selectors.itemCreateView.cancelButton); + await page.wait(selectors.itemsIndex.createItemButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/item/index'); }); it('should now access to the create item view by clicking the create floating button', async() => { - const url = await nightmare - .waitToClick(selectors.itemsIndex.createItemButton) - .wait(selectors.itemCreateView.createButton) - .parsedUrl(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.itemsIndex.createItemButton); + await page.wait(selectors.itemCreateView.createButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/item/create'); }); it('should create the Infinity Gauntlet item', async() => { - const result = await nightmare - .write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet') - .autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo') - .autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares') - .autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand') - .waitToClick(selectors.itemCreateView.createButton) - .waitForLastSnackbar(); + await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet'); + await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo'); + await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares'); + await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand'); + await page.waitToClick(selectors.itemCreateView.createButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm Infinity Gauntlet item was created', async() => { - let result = await nightmare - .waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); + let result = await page + .waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value'); expect(result).toEqual('Infinity Gauntlet'); - result = await nightmare + result = await page .waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value'); expect(result).toEqual('Crisantemo'); - result = await nightmare + result = await page .waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value'); expect(result).toEqual('5080000 Coral y materiales similares'); - result = await nightmare + result = await page .waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value'); expect(result).toEqual('Holand'); @@ -85,45 +87,41 @@ describe('Item Create/Clone path', () => { describe('clone', () => { it('should return to the items index by clicking the return to items button', async() => { - const url = await nightmare - .waitToClick(selectors.itemBasicData.goToItemIndexButton) - .wait(selectors.itemsIndex.createItemButton) - .waitForURL('#!/item/index') - .parsedUrl(); + await page.waitToClick(selectors.itemBasicData.goToItemIndexButton); + await page.wait(selectors.itemsIndex.createItemButton); + await page.waitForURL('#!/item/index'); + const url = await page.parsedUrl(); expect(url.hash).toContain('#!/item/index'); }); it(`should search for the item Infinity Gauntlet`, async() => { - const result = await nightmare - .clearInput(selectors.itemsIndex.searchItemInput) - .write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countElement(selectors.itemsIndex.searchResult); + await page.clearInput(selectors.itemsIndex.searchItemInput); + await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); + const result = await page.countElement(selectors.itemsIndex.searchResult); expect(result).toEqual(1); }); it(`should clone the Infinity Gauntlet`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet') - .waitToClick(selectors.itemsIndex.searchResultCloneButton) - .waitToClick(selectors.itemsIndex.acceptClonationAlertButton) - .waitForURL('tags') - .parsedUrl(); + await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet'); + await page.waitToClick(selectors.itemsIndex.searchResultCloneButton); + await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton); + await page.waitForURL('tags'); + const url = await page.parsedUrl(); expect(url.hash).toContain('tags'); }); it('should search for the item Infinity Gauntlet and find two', async() => { - const result = await nightmare - .waitToClick(selectors.itemTags.goToItemIndexButton) - .clearInput(selectors.itemsIndex.searchItemInput) - .write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 2) - .countElement(selectors.itemsIndex.searchResult); + await page.waitToClick(selectors.itemTags.goToItemIndexButton); + await page.clearInput(selectors.itemsIndex.searchItemInput); + await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); + const result = await page.countElement(selectors.itemsIndex.searchResult); expect(result).toEqual(2); }); diff --git a/e2e/paths/04-item-module/09_regularize.spec.js b/e2e/paths/04-item-module/09_regularize.spec.js index a83b9ef7f..4c023113c 100644 --- a/e2e/paths/04-item-module/09_regularize.spec.js +++ b/e2e/paths/04-item-module/09_regularize.spec.js @@ -1,206 +1,203 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item regularize path', () => { - const nightmare = createNightmare(); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'item'); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'item'); }); + afterAll(async() => { + await browser.close(); + }); it('should edit the user local warehouse', async() => { - let result = await nightmare - .waitForSpinnerLoad() - .waitToClick(selectors.globalItems.userMenuButton) - .autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four') - .waitForLastSnackbar(); + await page.waitForSpinnerLoad(); + await page.waitToClick(selectors.globalItems.userMenuButton); + await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four'); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); - it('should open the user config form to check the local settings', async() => { - let userLocalWarehouse = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) + it('should check the local settings were saved', async() => { + const userLocalWarehouse = await page .waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); + await page.keyboard.press('Escape'); + await page.waitForSelector('.user-popover.vn-popover', {hidden: true}); + expect(userLocalWarehouse).toContain('Warehouse Four'); }); - it('should search for an item', async() => { - const resultCount = await nightmare - .clearInput(selectors.itemsIndex.searchItemInput) - .write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countElement(selectors.itemsIndex.searchResult); + it('should search for an specific item', async() => { + await page.clearInput(selectors.itemsIndex.searchItemInput); + await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); + const resultCount = await page.countElement(selectors.itemsIndex.searchResult); expect(resultCount).toEqual(1); }); it(`should click on the search result to access to the item tax`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm') - .waitToClick(selectors.itemsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm'); + await page.waitToClick(selectors.itemsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it('should open the regularize dialog and check the warehouse matches the local user settings', async() => { - const result = await nightmare - .waitToClick(selectors.itemDescriptor.moreMenu) - .waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton) - .waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value'); + await page.waitToClick(selectors.itemDescriptor.moreMenu); + await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton); + const result = await page.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value'); expect(result).toEqual('Warehouse Four'); }); it('should regularize the item', async() => { - const result = await nightmare - .write(selectors.itemDescriptor.regularizeQuantityInput, 100) - .autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One') - .waitToClick(selectors.itemDescriptor.regularizeSaveButton) - .waitForLastSnackbar(); + await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100'); + await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One'); + await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should click on the Tickets button of the top bar menu', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await Promise.all([ + page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), + page.waitToClick(selectors.globalItems.ticketsButton) + ]); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); }); - it('should now clear the user local settings', async() => { - let result = await nightmare - .waitToClick(selectors.globalItems.userMenuButton) - .waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear) - .waitForLastSnackbar(); + it('should clear the user local settings now', async() => { + await page.waitForTransitionEnd('vn-searchbar'); + await page.waitToClick(selectors.globalItems.userMenuButton); + await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should search for the ticket with alias missing', async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 'missing') - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); + await page.keyboard.press('Escape'); + await page.write(selectors.ticketsIndex.searchTicketInput, 'missing'); + await page.keyboard.press('Enter'); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(1); }); it(`should click on the search result to access to the ticket summary`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing'); + await page.waitToClick(selectors.ticketsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should check the ticket sale quantity is showing a negative value`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100') + await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100'); + const result = await page .waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText'); expect(result).toContain('-100'); }); it(`should check the ticket sale discount is 100%`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText'); expect(result).toContain('100 %'); }); it('should now click on the Items button of the top bar menu', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.itemsButton) - .wait(selectors.itemsIndex.searchItemInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.itemsButton); + await page.wait(selectors.itemsIndex.searchItemInput); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/item/index'); }); it('should search for the item once again', async() => { - const resultCount = await nightmare - .clearInput(selectors.itemsIndex.searchItemInput) - .write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countElement(selectors.itemsIndex.searchResult); + await page.clearInput(selectors.itemsIndex.searchItemInput); + await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); + const resultCount = await page.countElement(selectors.itemsIndex.searchResult); expect(resultCount).toEqual(1); }); it(`should click on the search result to access to the item tax`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm') - .waitToClick(selectors.itemsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm'); + await page.waitToClick(selectors.itemsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it('should regularize the item once more', async() => { - const result = await nightmare - .waitToClick(selectors.itemDescriptor.moreMenu) - .waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton) - .write(selectors.itemDescriptor.regularizeQuantityInput, 100) - .autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One') - .waitToClick(selectors.itemDescriptor.regularizeSaveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.itemDescriptor.moreMenu); + await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton); + await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100'); + await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One'); + await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should again click on the Tickets button of the top bar menu', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await Promise.all([ + page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), + page.waitToClick(selectors.globalItems.ticketsButton) + ]); + await page.waitForTransitionEnd('vn-searchbar'); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); }); it('should search for the ticket with id 25 once again', async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 25) - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); + await page.write(selectors.ticketsIndex.searchTicketInput, '25'); + await page.waitToClick(selectors.ticketsIndex.searchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(1); }); it(`should now click on the search result to access to the ticket summary`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, '25') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitForTextInElement(selectors.ticketsIndex.searchResult, '25'); + await page.waitToClick(selectors.ticketsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should check the ticket contains now two sales`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100') - .countElement(selectors.ticketSummary.sale); + await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100'); + const result = await page.countElement(selectors.ticketSummary.sale); expect(result).toEqual(2); }); diff --git a/e2e/paths/04-item-module/10_item_index.spec.js b/e2e/paths/04-item-module/10_item_index.spec.js index 32a6effda..d09555755 100644 --- a/e2e/paths/04-item-module/10_item_index.spec.js +++ b/e2e/paths/04-item-module/10_item_index.spec.js @@ -1,86 +1,83 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item index path', () => { - const nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'item'); + await page.waitToClick(selectors.itemsIndex.searchIcon); + }); - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'item') - .waitToClick(selectors.itemsIndex.searchIcon); + afterAll(async() => { + await browser.close(); }); it('should click on the fields to show button to open the list of columns to show', async() => { - const visible = await nightmare - .waitToClick(selectors.itemsIndex.fieldsToShowButton) - .isVisible(selectors.itemsIndex.fieldsToShowForm); + await page.waitToClick(selectors.itemsIndex.fieldsToShowButton); + const visible = await page.isVisible(selectors.itemsIndex.fieldsToShowForm); expect(visible).toBeTruthy(); }); it('should unmark all checkboxes except the first and the last ones', async() => { - const result = await nightmare - .waitToClick(selectors.itemsIndex.idCheckbox) - .waitToClick(selectors.itemsIndex.stemsCheckbox) - .waitToClick(selectors.itemsIndex.sizeCheckbox) - .waitToClick(selectors.itemsIndex.nicheCheckbox) - .waitToClick(selectors.itemsIndex.typeCheckbox) - .waitToClick(selectors.itemsIndex.categoryCheckbox) - .waitToClick(selectors.itemsIndex.intrastadCheckbox) - .waitToClick(selectors.itemsIndex.originCheckbox) - .waitToClick(selectors.itemsIndex.buyerCheckbox) - .waitToClick(selectors.itemsIndex.destinyCheckbox) - .waitToClick(selectors.itemsIndex.saveFieldsButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.itemsIndex.idCheckbox); + await page.waitToClick(selectors.itemsIndex.stemsCheckbox); + await page.waitToClick(selectors.itemsIndex.sizeCheckbox); + await page.waitToClick(selectors.itemsIndex.nicheCheckbox); + await page.waitToClick(selectors.itemsIndex.typeCheckbox); + await page.waitToClick(selectors.itemsIndex.categoryCheckbox); + await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); + await page.waitToClick(selectors.itemsIndex.originCheckbox); + await page.waitToClick(selectors.itemsIndex.buyerCheckbox); + await page.waitToClick(selectors.itemsIndex.destinyCheckbox); + await page.waitToClick(selectors.itemsIndex.saveFieldsButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should navigate forth and back to see the images column is still visible', async() => { - const imageVisible = await nightmare - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton) - .waitToClick(selectors.itemsIndex.searchIcon) - .wait(selectors.itemsIndex.searchResult) - .waitImgLoad(selectors.itemsIndex.firstItemImage) - .isVisible(selectors.itemsIndex.firstItemImageTd); + await page.waitToClick(selectors.itemsIndex.searchResult); + await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton); + await page.waitToClick(selectors.itemsIndex.searchIcon); + await page.wait(selectors.itemsIndex.searchResult); + await page.waitImgLoad(selectors.itemsIndex.firstItemImage); + const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd); expect(imageVisible).toBeTruthy(); }); it('should check the ids column is not visible', async() => { - const idVisible = await nightmare - .isVisible(selectors.itemsIndex.firstItemId); - - expect(idVisible).toBeFalsy(); + await page.waitForSelector(selectors.itemsIndex.firstItemId, {hidden: true}); }); it('should mark all unchecked boxes to leave the index as it was', async() => { - const result = await nightmare - .waitToClick(selectors.itemsIndex.fieldsToShowButton) - .waitToClick(selectors.itemsIndex.idCheckbox) - .waitToClick(selectors.itemsIndex.stemsCheckbox) - .waitToClick(selectors.itemsIndex.sizeCheckbox) - .waitToClick(selectors.itemsIndex.nicheCheckbox) - .waitToClick(selectors.itemsIndex.typeCheckbox) - .waitToClick(selectors.itemsIndex.categoryCheckbox) - .waitToClick(selectors.itemsIndex.intrastadCheckbox) - .waitToClick(selectors.itemsIndex.originCheckbox) - .waitToClick(selectors.itemsIndex.buyerCheckbox) - .waitToClick(selectors.itemsIndex.destinyCheckbox) - .waitToClick(selectors.itemsIndex.saveFieldsButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.itemsIndex.fieldsToShowButton); + await page.waitToClick(selectors.itemsIndex.idCheckbox); + await page.waitToClick(selectors.itemsIndex.stemsCheckbox); + await page.waitToClick(selectors.itemsIndex.sizeCheckbox); + await page.waitToClick(selectors.itemsIndex.nicheCheckbox); + await page.waitToClick(selectors.itemsIndex.typeCheckbox); + await page.waitToClick(selectors.itemsIndex.categoryCheckbox); + await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); + await page.waitToClick(selectors.itemsIndex.originCheckbox); + await page.waitToClick(selectors.itemsIndex.buyerCheckbox); + await page.waitToClick(selectors.itemsIndex.destinyCheckbox); + await page.waitToClick(selectors.itemsIndex.saveFieldsButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should now navigate forth and back to see the ids column is now visible', async() => { - const idVisible = await nightmare - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton) - .waitToClick(selectors.itemsIndex.searchIcon) - .wait(selectors.itemsIndex.searchResult) - .isVisible(selectors.itemsIndex.firstItemId); + await page.waitToClick(selectors.itemsIndex.searchResult); + await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton); + await page.waitToClick(selectors.itemsIndex.searchIcon); + await page.wait(selectors.itemsIndex.searchResult); + const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId); expect(idVisible).toBeTruthy(); }); diff --git a/e2e/paths/04-item-module/11_item_log.spec.js b/e2e/paths/04-item-module/11_item_log.spec.js index cf3beb528..8c75ed0c1 100644 --- a/e2e/paths/04-item-module/11_item_log.spec.js +++ b/e2e/paths/04-item-module/11_item_log.spec.js @@ -1,74 +1,74 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item log path', () => { - const nightmare = createNightmare(); - beforeAll(() => { - nightmare - .loginAndModule('developer', 'item'); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('developer', 'item'); + }); + + afterAll(async() => { + await browser.close(); }); it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => { - const result = await nightmare - .write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact') - .waitToClick(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 0) - .countElement(selectors.itemsIndex.searchResult); + await page.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact'); + await page.waitToClick(selectors.itemsIndex.searchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0); + const result = await page.countElement(selectors.itemsIndex.searchResult); expect(result).toEqual(0); }); it('should access to the create item view by clicking the create floating button', async() => { - const url = await nightmare - .waitToClick(selectors.itemsIndex.createItemButton) - .wait(selectors.itemCreateView.createButton) - .parsedUrl(); + await page.waitToClick(selectors.itemsIndex.createItemButton); + await page.wait(selectors.itemCreateView.createButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/item/create'); }); it('should create the Knowledge artifact item', async() => { - const result = await nightmare - .write(selectors.itemCreateView.temporalName, 'Knowledge artifact') - .autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo') - .autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares') - .autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand') - .waitToClick(selectors.itemCreateView.createButton) - .waitForLastSnackbar(); + await page.write(selectors.itemCreateView.temporalName, 'Knowledge artifact'); + await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo'); + await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares'); + await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand'); + await page.waitToClick(selectors.itemCreateView.createButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should return to the items index by clicking the return to items button', async() => { - const url = await nightmare - .waitToClick(selectors.itemBasicData.goToItemIndexButton) - .wait(selectors.itemsIndex.createItemButton) - .waitForURL('#!/item/index') - .parsedUrl(); + await page.waitToClick(selectors.itemBasicData.goToItemIndexButton); + await page.wait(selectors.itemsIndex.createItemButton); + await page.waitForURL('#!/item/index'); + const url = await page.parsedUrl(); expect(url.hash).toContain('#!/item/index'); }); it(`should search for the created item and navigate to it's log section`, async() => { - const url = await nightmare - .accessToSearchResult('Knowledge artifact') - .accessToSection('item.card.log') - .waitForURL('/log') - .parsedUrl(); + await page.accessToSearchResult('Knowledge artifact'); + await page.accessToSection('item.card.log'); + await page.waitForURL('/log'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/log'); }); it(`should confirm the log is showing 5 entries`, async() => { - const anyLineCreatedCount = await nightmare - .wait(selectors.itemLog.anyLineCreated) - .countElement(selectors.itemLog.anyLineCreated); + await page.wait(selectors.itemLog.anyLineCreated); + const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated); expect(anyLineCreatedCount).toEqual(5); }); it(`should confirm the log is showing the intrastat for the created item`, async() => { - const fifthLineCreatedProperty = await nightmare + const fifthLineCreatedProperty = await page .waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText'); expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares'); diff --git a/e2e/paths/04-item-module/12_descriptor.spec.js b/e2e/paths/04-item-module/12_descriptor.spec.js index d008d0d4e..84614cf30 100644 --- a/e2e/paths/04-item-module/12_descriptor.spec.js +++ b/e2e/paths/04-item-module/12_descriptor.spec.js @@ -1,47 +1,49 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Item descriptor path', () => { - const nightmare = createNightmare(); - beforeAll(() => { - nightmare - .loginAndModule('buyer', 'item') - .accessToSearchResult(1) - .accessToSection('item.card.basicData'); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'item'); + await page.accessToSearchResult('1'); + await page.accessToSection('item.card.basicData'); + }); + + afterAll(async() => { + await browser.close(); }); it('should check the descriptor inactive icon is dark as the item is active', async() => { - let darkIcon = await nightmare - .wait(selectors.itemDescriptor.inactiveIcon) - .waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright') - .isVisible(selectors.itemDescriptor.inactiveIcon); + await page.wait(selectors.itemDescriptor.inactiveIcon); + await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright'); + let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon); expect(darkIcon).toBeTruthy(); }); it('should set the item to inactive', async() => { - let result = await nightmare - .waitToClick(selectors.itemBasicData.isActiveCheckbox) - .waitToClick(selectors.itemBasicData.submitBasicDataButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); + await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should reload the section and check the inactive icon is bright', async() => { - let brightIcon = await nightmare - .reloadSection('item.card.basicData') - .waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright') - .isVisible(selectors.itemDescriptor.inactiveIcon); + await page.reloadSection('item.card.basicData'); + await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright'); + let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon); expect(brightIcon).toBeTruthy(); }); it('should set the item back to active', async() => { - let result = await nightmare - .waitToClick(selectors.itemBasicData.isActiveCheckbox) - .waitToClick(selectors.itemBasicData.submitBasicDataButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); + await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); diff --git a/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js b/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js index a5f7aa423..aefdaa4cb 100644 --- a/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js +++ b/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js @@ -1,94 +1,114 @@ import selectors from '../../../helpers/selectors.js'; -import createNightmare from '../../../helpers/nightmare'; +import getBrowser from '../../../helpers/puppeteer'; describe('Ticket List sale path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - return nightmare - .loginAndModule('employee', 'ticket') - .accessToSearchResult(13) - .accessToSection('ticket.card.sale'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult('13'); + await page.accessToSection('ticket.card.sale'); }); - it('should confirm the first ticket sale contains the colour', async() => { - const value = await nightmare + afterAll(async() => { + await browser.close(); + }); + + it('should confirm the first ticket sale contains the colour tag', async() => { + await page.waitForContentLoaded(); + const value = await page .waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText'); expect(value).toContain('Black'); }); it('should confirm the first sale contains the price', async() => { - const value = await nightmare + const value = await page .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText'); expect(value).toContain('1.72'); }); it('should confirm the first sale contains the discount', async() => { - const value = await nightmare + const value = await page .waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText'); - expect(value).toContain('0 %'); + expect(value).toContain('0.00%'); }); it('should confirm the first sale contains the total import', async() => { - const value = await nightmare + const value = await page .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText'); expect(value).toContain('34.40'); }); it('should add an empty item to the sale list', async() => { - const sales = await nightmare - .waitToClick(selectors.ticketSales.newItemButton) + await page.waitToClick(selectors.ticketSales.newItemButton); + const sales = await page .countElement(selectors.ticketSales.saleLine); expect(sales).toEqual(2); }); it('should select a valid item to be added as the second item in the sales list', async() => { - const result = await nightmare - .waitToClick(selectors.ticketSales.secondSaleIdInput) - .write(selectors.ticketSales.secondSaleIdAutocomplete, 'Melee weapon heavy shield 1x0.5m') - .waitToClick(selectors.ticketSales.idAutocompleteFirstResult) - .write(selectors.ticketSales.secondSaleQuantity, '1\u000d') - .waitForLastSnackbar(); + let searchValue = 'Melee weapon heavy shield 1x0.5m'; + await page.waitToClick(`${selectors.ticketSales.secondSaleIdAutocomplete} input`); + await page.waitForSelector(selector => { + document + .querySelector(`${selector} vn-drop-down`).$ctrl.content + .querySelectorAll('li'); + }, selectors.ticketSales.secondSaleIdAutocomplete); + + await page.write(`.vn-drop-down.shown`, searchValue); + await page.waitForFunction((selector, searchValue) => { + let element = document + .querySelector(`${selector} vn-drop-down`).$ctrl.content + .querySelector('li.active'); + if (element) + return element.innerText.includes(searchValue); + }, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue); + + await page.keyboard.press('Enter'); + await page.write(selectors.ticketSales.secondSaleQuantity, '1'); + await page.keyboard.press('Enter'); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); + // #1865 xit('should update the description of the new sale', async() => { - const result = await nightmare - .focusElement(selectors.ticketSales.secondSaleConceptCell) - .write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor\u000d') - .waitForLastSnackbar(); + await page.focusElement(selectors.ticketSales.secondSaleConceptCell); + await page.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor'); + await page.keyboard.press('Enter'); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should add a third empty item to the sale list', async() => { - const sales = await nightmare - .waitToClick(selectors.ticketSales.newItemButton) - .countElement(selectors.ticketSales.saleLine); + await page.waitToClick(selectors.ticketSales.newItemButton); + const sales = await page.countElement(selectors.ticketSales.saleLine); expect(sales).toEqual(3); }); it('should select the 2nd and 3th item and delete both', async() => { - const result = await nightmare - .waitToClick(selectors.ticketSales.secondSaleCheckbox) - .waitToClick(selectors.ticketSales.thirdSaleCheckbox) - .waitToClick(selectors.ticketSales.deleteSaleButton) - .waitToClick(selectors.ticketSales.acceptDeleteLineButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketSales.secondSaleCheckbox); + await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox); + await page.waitToClick(selectors.ticketSales.deleteSaleButton); + await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should verify there's only 1 single line remaining`, async() => { - const sales = await nightmare - .countElement(selectors.ticketSales.saleLine); + const sales = await page.countElement(selectors.ticketSales.saleLine); expect(sales).toEqual(1); }); diff --git a/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js index 5a6d6cd62..3ef2b1c3d 100644 --- a/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js @@ -1,15 +1,21 @@ import selectors from '../../../helpers/selectors.js'; -import createNightmare from '../../../helpers/nightmare'; +import getBrowser from '../../../helpers/puppeteer'; // #1632 [e2e] ticket.sale - Transferir líneas xdescribe('Ticket Edit sale path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'ticket') - .accessToSearchResult(16) - .accessToSection('ticket.card.sale'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'ticket'); + await page.accessToSearchResult(16); + await page.accessToSection('ticket.card.sale'); + }); + + afterAll(async() => { + await browser.close(); }); it(`should click on the first sale claim icon to navigate over there`, async() => { @@ -59,7 +65,6 @@ xdescribe('Ticket Edit sale path', () => { it(`should click on the zoomed image to close it`, async() => { const result = await nightmare - .wait(100) .clickIfVisible(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage); @@ -149,7 +154,6 @@ xdescribe('Ticket Edit sale path', () => { it('should confirm the price have been updated', async() => { const result = await nightmare - .wait(1999) .waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText'); expect(result).toContain('5.00'); @@ -173,10 +177,10 @@ xdescribe('Ticket Edit sale path', () => { it('should confirm the discount have been updated', async() => { const result = await nightmare - .waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50 %') + .waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50.00%') .waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText'); - expect(result).toContain('50 %'); + expect(result).toContain('50.00%'); }); it('should confirm the total import for that item have been updated', async() => { @@ -426,7 +430,7 @@ xdescribe('Ticket Edit sale path', () => { const result = await nightmare .waitToClick(selectors.ticketSales.moreMenu) .waitToClick(selectors.ticketSales.moreMenuUpdateDiscount) - .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) + // .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed? .write('body', '\u000d') .waitForTextInElement(selectors.ticketSales.totalImport, '0.00') .waitToGetProperty(selectors.ticketSales.totalImport, 'innerText'); diff --git a/e2e/paths/05-ticket-module/01_observations.spec.js b/e2e/paths/05-ticket-module/01_observations.spec.js index 42193ea57..1215e6423 100644 --- a/e2e/paths/05-ticket-module/01_observations.spec.js +++ b/e2e/paths/05-ticket-module/01_observations.spec.js @@ -1,45 +1,50 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket Create notes path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - return nightmare - .loginAndModule('employee', 'ticket') - .accessToSearchResult(1) - .accessToSection('ticket.card.observation'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult('1'); + await page.accessToSection('ticket.card.observation'); + }); + + afterAll(async() => { + await browser.close(); }); it('should create a new note', async() => { - let result = await nightmare - .waitToClick(selectors.ticketNotes.addNoteButton) - .autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one') - .write(selectors.ticketNotes.firstDescriptionInput, 'description') - .waitToClick(selectors.ticketNotes.submitNotesButton) - .waitForLastSnackbar(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketNotes.addNoteButton); + await page.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one'); + await page.write(selectors.ticketNotes.firstDescriptionInput, 'description'); + await page.waitToClick(selectors.ticketNotes.submitNotesButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); - }); + }, 15000); it('should confirm the note is the expected one', async() => { - let result = await nightmare - .reloadSection('ticket.card.observation') + await page.reloadSection('ticket.card.observation'); + const result = await page .waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value'); expect(result).toEqual('observation one'); - let firstDescription = await nightmare - .waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); + const firstDescription = await page + .waitToGetProperty(`${selectors.ticketNotes.firstDescriptionInput} input`, 'value'); expect(firstDescription).toEqual('description'); }); it('should delete the note', async() => { - let result = await nightmare - .waitToClick(selectors.ticketNotes.firstNoteRemoveButton) - .waitToClick(selectors.ticketNotes.submitNotesButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton); + await page.waitToClick(selectors.ticketNotes.submitNotesButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); diff --git a/e2e/paths/05-ticket-module/02_expeditions_and_log.spec.js b/e2e/paths/05-ticket-module/02_expeditions_and_log.spec.js index ec9b16fa4..94fad9b69 100644 --- a/e2e/paths/05-ticket-module/02_expeditions_and_log.spec.js +++ b/e2e/paths/05-ticket-module/02_expeditions_and_log.spec.js @@ -1,36 +1,42 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket expeditions and log path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - return nightmare - .loginAndModule('production', 'ticket') - .accessToSearchResult('1') - .accessToSection('ticket.card.expedition'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('production', 'ticket'); + await page.accessToSearchResult('1'); + await page.accessToSection('ticket.card.expedition'); + }); + + afterAll(async() => { + await browser.close(); }); it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => { - const result = await nightmare - .waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) - .waitToClick(selectors.ticketExpedition.acceptDeleteRowButton) - .waitToClick(selectors.ticketPackages.packagesButton) - .wait(selectors.ticketPackages.firstPackageAutocomplete) - .waitToClick(selectors.ticketExpedition.expeditionButton) - .wait(selectors.ticketExpedition.expeditionRow) + await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton); + await page.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton), + await page.reloadSection('ticket.card.expedition'); + await page.waitForSelector(selectors.ticketExpedition.expeditionRow, {}); + const result = await page .countElement(selectors.ticketExpedition.expeditionRow); expect(result).toEqual(3); }); it(`should confirm the expedition deleted is shown now in the ticket log`, async() => { - const changedBy = await nightmare - .waitToClick(selectors.ticketLog.logButton) + await page.waitToClick(selectors.ticketLog.logButton); + const changedBy = await page .waitToGetProperty(selectors.ticketLog.changedBy, 'innerText'); - const actionTaken = await nightmare + + const actionTaken = await page .waitToGetProperty(selectors.ticketLog.actionTaken, 'innerText'); - const id = await nightmare + + const id = await page .waitToGetProperty(selectors.ticketLog.id, 'innerText'); expect(changedBy).toEqual('production'); diff --git a/e2e/paths/05-ticket-module/04_packages.spec.js b/e2e/paths/05-ticket-module/04_packages.spec.js index b51bb8b95..a4b52c3a4 100644 --- a/e2e/paths/05-ticket-module/04_packages.spec.js +++ b/e2e/paths/05-ticket-module/04_packages.spec.js @@ -1,69 +1,70 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket Create packages path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - return nightmare - .loginAndModule('employee', 'ticket') - .accessToSearchResult('1') - .accessToSection('ticket.card.package'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult('1'); + await page.accessToSection('ticket.card.package'); + }); + + afterAll(async() => { + await browser.close(); }); it(`should attempt create a new package but receive an error if package is blank`, async() => { - const result = await nightmare - .waitToClick(selectors.ticketPackages.firstRemovePackageButton) - .waitToClick(selectors.ticketPackages.addPackageButton) - .write(selectors.ticketPackages.firstQuantityInput, 99) - .waitToClick(selectors.ticketPackages.savePackagesButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketPackages.firstRemovePackageButton); + await page.waitToClick(selectors.ticketPackages.addPackageButton); + await page.write(selectors.ticketPackages.firstQuantityInput, '99'); + await page.waitToClick(selectors.ticketPackages.savePackagesButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Package cannot be blank'); }); it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => { - const result = await nightmare - .clearInput(selectors.ticketPackages.firstQuantityInput) - .autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m') - .waitToClick(selectors.ticketPackages.savePackagesButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.ticketPackages.firstQuantityInput); + await page.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m'); + await page.waitToClick(selectors.ticketPackages.savePackagesButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Some fields are invalid'); }); it(`should confirm the quantity input isn't invalid yet`, async() => { - const result = await nightmare + const result = await page .evaluate(selector => { - return document.querySelector(selector).checkValidity(); + return document.querySelector(`${selector} input`).checkValidity(); }, selectors.ticketPackages.firstQuantityInput); expect(result).toBeTruthy(); }); it(`should create a new package with correct data`, async() => { - const result = await nightmare - .clearInput(selectors.ticketPackages.firstQuantityInput) - .write(selectors.ticketPackages.firstQuantityInput, -99) - .waitToClick(selectors.ticketPackages.savePackagesButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.ticketPackages.firstQuantityInput); + await page.write(selectors.ticketPackages.firstQuantityInput, '-99'); + await page.waitToClick(selectors.ticketPackages.savePackagesButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the first select is the expected one`, async() => { - const result = await nightmare - .reloadSection('ticket.card.package') - .waitForTextInInput(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'Container medical box 1m') - .waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value'); + await page.reloadSection('ticket.card.package'); + await page.waitForTextInInput(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m'); + const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value'); expect(result).toEqual('7 : Container medical box 1m'); }); it(`should confirm the first quantity is just a number and the string part was ignored by the imput number`, async() => { - const result = await nightmare - .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99') - .waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value'); + await page.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99'); + const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstQuantityInput} input`, 'value'); expect(result).toEqual('-99'); }); diff --git a/e2e/paths/05-ticket-module/05_tracking_state.spec.js b/e2e/paths/05-ticket-module/05_tracking_state.spec.js index 7c319f1c9..339042e3b 100644 --- a/e2e/paths/05-ticket-module/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket-module/05_tracking_state.spec.js @@ -1,83 +1,83 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket Create new tracking state path', () => { - const nightmare = createNightmare(); + let browser; + let page; + + afterAll(async() => { + await browser.close(); + }); describe('as production', () => { - beforeAll(() => { - return nightmare - .loginAndModule('production', 'ticket') - .accessToSearchResult('1') - .accessToSection('ticket.card.tracking.index'); + it('should log into the ticket 1 tracking', async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('production', 'ticket'); + await page.accessToSearchResult('1'); + await page.accessToSection('ticket.card.tracking.index'); }); it('should access to the create state view by clicking the create floating button', async() => { - let url = await nightmare - .clickIfVisible(selectors.ticketTracking.createStateButton) - .wait(selectors.createStateView.stateAutocomplete) - .parsedUrl(); - + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketTracking.createStateButton); + await page.waitForSelector(selectors.createStateView.stateAutocomplete, {visible: true}); + let url = await page.parsedUrl(); expect(url.hash).toContain('tracking/edit'); }); it(`should attempt create a new state but receive an error if state is empty`, async() => { - let result = await nightmare - .waitToClick(selectors.createStateView.saveStateButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.createStateView.saveStateButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('State cannot be blank'); }); it(`should create a new state`, async() => { - let result = await nightmare - .autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?') - .waitToClick(selectors.createStateView.saveStateButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?'); + await page.waitToClick(selectors.createStateView.saveStateButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); }); describe('as salesPerson', () => { - beforeAll(() => { - return nightmare - .loginAndModule('salesPerson', 'ticket') - .accessToSearchResult('1') - .accessToSection('ticket.card.tracking.index'); + it('should now log into the ticket 1 tracking', async() => { + await page.loginAndModule('salesPerson', 'ticket'); + await page.accessToSearchResult('1'); + await page.accessToSection('ticket.card.tracking.index'); }); it('should now access to the create state view by clicking the create floating button', async() => { - let url = await nightmare - .waitToClick(selectors.ticketTracking.createStateButton) - .wait(selectors.createStateView.stateAutocomplete) - .parsedUrl(); + await page.waitToClick(selectors.ticketTracking.createStateButton); + await page.waitForURL('tracking/edit'); + let url = await page.parsedUrl(); expect(url.hash).toContain('tracking/edit'); }); it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => { - let result = await nightmare - .autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado') - .waitToClick(selectors.createStateView.saveStateButton) - .waitForLastSnackbar(); + await page.waitFor(1500); + await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado'); + await page.waitToClick(selectors.createStateView.saveStateButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual(`You don't have enough privileges`); }); it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => { - let result = await nightmare - .autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado') + await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado'); + let result = await page .waitToGetProperty(`${selectors.createStateView.workerAutocomplete} input`, 'value'); expect(result).toEqual('salesPersonNick'); }); it(`should succesfully create a valid state`, async() => { - let result = await nightmare - .waitToClick(selectors.createStateView.saveStateButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.createStateView.saveStateButton); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js index 3dcac0765..01bd80fb9 100644 --- a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js @@ -1,98 +1,98 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket Edit basic data path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - return nightmare - .loginAndModule('employee', 'ticket') - .accessToSearchResult(11) - .accessToSection('ticket.card.basicData.stepOne'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult('11'); + await page.accessToSection('ticket.card.basicData.stepOne'); + }); + + afterAll(async() => { + await browser.close(); }); it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => { - const disabled = await nightmare - .wait(selectors.ticketBasicData.zoneAutocomplete) - .evaluate(selector => { - return document.querySelector(selector).disabled; - }, `${selectors.ticketBasicData.zoneAutocomplete} input`); + await page.waitForSelector(selectors.ticketBasicData.zoneAutocomplete, {}); + const disabled = await page.evaluate(selector => { + return document.querySelector(selector).disabled; + }, `${selectors.ticketBasicData.zoneAutocomplete} input`); expect(disabled).toBeTruthy(); }); it(`should now log as productionBoss to perform the rest of the tests`, async() => { - await nightmare - .loginAndModule('productionBoss', 'ticket') - .accessToSearchResult(11) - .accessToSection('ticket.card.basicData.stepOne'); + await page.loginAndModule('productionBoss', 'ticket'); + await page.accessToSearchResult('11'); + await page.accessToSection('ticket.card.basicData.stepOne'); }); it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => { - const disabled = await nightmare - .waitForSpinnerLoad() - .wait(selectors.ticketBasicData.zoneAutocomplete) - .evaluate(selector => { - return document.querySelector(selector).disabled; - }, `${selectors.ticketBasicData.zoneAutocomplete} input`); + await page.waitForSpinnerLoad(); + await page.wait(selectors.ticketBasicData.zoneAutocomplete); + const disabled = await page.evaluate(selector => { + return document.querySelector(selector).disabled; + }, `${selectors.ticketBasicData.zoneAutocomplete} input`); expect(disabled).toBeFalsy(); }); it(`should check the zone is for Silla247`, async() => { - let zone = await nightmare + let zone = await page .waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value'); expect(zone).toContain('Zone 247 A'); }); it(`should edit the ticket agency then check there are no zones for it`, async() => { - let zone = await nightmare - .autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement') + await page.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement'); + let zone = await page .getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value'); expect(zone.length).toEqual(0); }); it(`should edit the ticket zone then check the agency is for the new zone`, async() => { - let zone = await nightmare - .autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A') + await page.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A'); + let zone = await page .waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value'); expect(zone).toContain('Silla247Expensive'); }); it(`should click next`, async() => { - let url = await nightmare - .waitToClick(selectors.ticketBasicData.nextStepButton) - .waitForURL('data/step-two') - .parsedUrl(); + await page.waitToClick(selectors.ticketBasicData.nextStepButton); + await page.waitForURL('data/step-two'); + let url = await page.parsedUrl(); expect(url.hash).toContain('data/step-two'); }); it(`should have a price diference`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); expect(result).toContain('-€248.00'); }); it(`should then click next to move on to step three`, async() => { - let url = await nightmare - .waitToClick(selectors.ticketBasicData.nextStepButton) - .waitForURL('data/step-three') - .parsedUrl(); + await page.waitToClick(selectors.ticketBasicData.nextStepButton); + await page.waitForURL('data/step-three'); + let url = await page.parsedUrl(); expect(url.hash).toContain('data/step-three'); }); it(`should select a new reason for the changes made then click on finalize`, async() => { - let url = await nightmare - .autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket') - .waitToClick(selectors.ticketBasicData.finalizeButton) - .waitForURL('summary') - .parsedUrl(); + await page.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket'); + await page.waitToClick(selectors.ticketBasicData.finalizeButton); + await page.waitForURL('summary'); + let url = await page.parsedUrl(); expect(url.hash).toContain('summary'); }); diff --git a/e2e/paths/05-ticket-module/08_components.spec.js b/e2e/paths/05-ticket-module/08_components.spec.js index 501c2eaad..ae631d5dd 100644 --- a/e2e/paths/05-ticket-module/08_components.spec.js +++ b/e2e/paths/05-ticket-module/08_components.spec.js @@ -1,23 +1,28 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket List components path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - return nightmare - .loginAndModule('employee', 'ticket') - .accessToSearchResult('1') - .accessToSection('ticket.card.components'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult('1'); + await page.accessToSection('ticket.card.components'); + }); + + afterAll(async() => { + await browser.close(); }); it('should confirm the total base is correct', async() => { const name = 'Base €'; const minLength = name.length; - const base = await nightmare - .waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength) - .waitToGetProperty(selectors.ticketComponents.base, 'innerText'); + await page.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength); + const base = await page.waitToGetProperty(selectors.ticketComponents.base, 'innerText'); expect(base).toContain('Base'); diff --git a/e2e/paths/05-ticket-module/09_weekly.spec.js b/e2e/paths/05-ticket-module/09_weekly.spec.js index ad8a8020c..0734d2f7b 100644 --- a/e2e/paths/05-ticket-module/09_weekly.spec.js +++ b/e2e/paths/05-ticket-module/09_weekly.spec.js @@ -1,166 +1,140 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket descriptor path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('employee', 'ticket'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSection('ticket.weekly.index'); + }); + + afterAll(async() => { + await browser.close(); }); it('should count the amount of tickets in the turns section', async() => { - const result = await nightmare - .waitToClick(selectors.ticketsIndex.menuWeeklyTickets) - .wait(selectors.ticketsIndex.weeklyTicket) - .countElement(selectors.ticketsIndex.weeklyTicket); + await page.waitForNumberOfElements(selectors.ticketsIndex.weeklyTicket, 5); + const result = await page.countElement(selectors.ticketsIndex.weeklyTicket); expect(result).toEqual(5); }); - it('should now click on the Tickets button of the top bar menu', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl(); - - expect(url.hash).toEqual('#!/ticket/index'); - }); - - it('should search for the ticket 11', async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 11) - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); - - expect(result).toEqual(1); - }); - - it(`should click on the search result to access to the ticket`, async() => { - const url = await nightmare - .waitToClick(selectors.ticketsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); - - expect(url.hash).toContain('/summary'); + it('should go back to the ticket index then search and access a ticket summary', async() => { + await page.accessToSection('ticket.index'); + await page.accessToSearchResult('11'); + await page.waitForContentLoaded(); }); it('should add the ticket to thursday turn using the descriptor more menu', async() => { - const result = await nightmare - .waitToClick(selectors.ticketDescriptor.moreMenu) - .waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn) - .waitToClick(selectors.ticketDescriptor.thursdayButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn); + await page.waitToClick(selectors.ticketDescriptor.thursdayButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should again click on the Tickets button of the top bar menu', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.ticketsButton); + await page.waitForContentLoaded(); + + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); }); - it('should confirm the ticket 11 was added on thursday', async() => { - const result = await nightmare - .waitToClick(selectors.ticketsIndex.menuWeeklyTickets) - .waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value'); + it('should confirm the ticket 11 was added to thursday', async() => { + await page.accessToSection('ticket.weekly.index'); + const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value'); expect(result).toEqual('Thursday'); }); it('should click on the Tickets button of the top bar menu once more', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.ticketsButton); + await page.waitForURL('#!/ticket/index'); + + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); }); it('should now search for the ticket 11', async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 11) - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); + await page.waitForContentLoaded(); + await page.write(selectors.ticketsIndex.searchTicketInput, '11'); + await page.waitToClick(selectors.ticketsIndex.searchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(1); }); it(`should click on the search result to access to the ticket`, async() => { - const url = await nightmare - .waitToClick(selectors.ticketsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitToClick(selectors.ticketsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it('should add the ticket to saturday turn using the descriptor more menu', async() => { - const result = await nightmare - .waitToClick(selectors.ticketDescriptor.moreMenu) - .waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn) - .waitToClick(selectors.ticketDescriptor.saturdayButton) - .waitForLastSnackbar(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn); + await page.waitToClick(selectors.ticketDescriptor.saturdayButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should click on the Tickets button of the top bar menu once again', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.ticketsButton); + await page.wait(selectors.ticketsIndex.searchTicketInput); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); }); it('should confirm the ticket 11 was added on saturday', async() => { - const result = await nightmare - .waitToClick(selectors.ticketsIndex.menuWeeklyTickets) - .waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value'); + await page.accessToSection('ticket.weekly.index'); + const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value'); expect(result).toEqual('Saturday'); }); it('should now search for the weekly ticket 11', async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchWeeklyTicketInput, 11) - .waitToClick(selectors.ticketsIndex.searchWeeklyButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1) - .countElement(selectors.ticketsIndex.searchWeeklyResult); + await page.write(selectors.ticketsIndex.searchTicketInput, '11'); + await page.waitToClick(selectors.ticketsIndex.searchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); expect(result).toEqual(1); }); it('should delete the weekly ticket 11', async() => { - const result = await nightmare - .waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon) - .waitToClick(selectors.ticketsIndex.acceptDeleteTurn) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon); + await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the sixth weekly ticket was deleted', async() => { - const result = await nightmare - .waitToClick('vn-searchbar vn-icon[icon=clear]') - .waitToClick(selectors.ticketsIndex.searchWeeklyButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5) - .countElement(selectors.ticketsIndex.searchWeeklyResult); + await page.waitForContentLoaded(); + await page.clearInput('vn-searchbar'); + await page.waitToClick(selectors.ticketsIndex.searchWeeklyButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5); + const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); expect(result).toEqual(5); }); diff --git a/e2e/paths/05-ticket-module/10_request.spec.js b/e2e/paths/05-ticket-module/10_request.spec.js index 44dc3e1af..f4fea9c2b 100644 --- a/e2e/paths/05-ticket-module/10_request.spec.js +++ b/e2e/paths/05-ticket-module/10_request.spec.js @@ -1,59 +1,58 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket purchase request path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'ticket') - .accessToSearchResult('16') - .accessToSection('ticket.card.request.index'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'ticket'); + await page.accessToSearchResult('16'); + await page.accessToSection('ticket.card.request.index'); + }); + + afterAll(async() => { + await browser.close(); }); it(`should add a new request`, async() => { - const result = await nightmare - .waitToClick(selectors.ticketRequests.addRequestButton) - .write(selectors.ticketRequests.descriptionInput, 'New stuff') - .write(selectors.ticketRequests.quantityInput, 99) - .autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick') - .write(selectors.ticketRequests.priceInput, 999) - .waitToClick(selectors.ticketRequests.saveButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketRequests.addRequestButton); + await page.write(selectors.ticketRequests.descriptionInput, 'New stuff'); + await page.write(selectors.ticketRequests.quantityInput, '99'); + await page.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick'); + await page.write(selectors.ticketRequests.priceInput, '999'); + await page.waitToClick(selectors.ticketRequests.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should have been redirected to the request index`, async() => { - const url = await nightmare - .waitForURL('/request') - .parsedUrl(); + await page.waitForURL('/request'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/request'); }); it(`should confirm the new request was added`, async() => { - const result = await nightmare - .reloadSection('ticket.card.request.index') - .waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText'); + await page.reloadSection('ticket.card.request.index'); + const result = await page.waitToGetProperty(`${selectors.ticketRequests.firstDescription} input`, 'value'); expect(result).toEqual('New stuff'); }); it(`should delete the added request`, async() => { - const result = await nightmare - .waitToClick(selectors.ticketRequests.firstRemoveRequestButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketRequests.firstRemoveRequestButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the request was deleted`, async() => { - const result = await nightmare - .reloadSection('ticket.card.request.index') - .wait(selectors.ticketRequests.addRequestButton) - .exists(selectors.ticketRequests.request); - - expect(result).toBeFalsy(); + await page.reloadSection('ticket.card.request.index'); + await page.wait(selectors.ticketRequests.addRequestButton); + await page.waitForSelector(selectors.ticketRequests.request, {hidden: true}); }); }); diff --git a/e2e/paths/05-ticket-module/11_diary.spec.js b/e2e/paths/05-ticket-module/11_diary.spec.js index 1f053d29f..363901050 100644 --- a/e2e/paths/05-ticket-module/11_diary.spec.js +++ b/e2e/paths/05-ticket-module/11_diary.spec.js @@ -1,61 +1,66 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; -describe('Ticket diary path', () => { - const nightmare = createNightmare(); +// #2026 Fallo en relocate de descriptor popover +xdescribe('Ticket diary path', () => { + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('employee', 'ticket'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + }); + + afterAll(async() => { + await browser.close(); }); it('should search for a specific ticket', async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 1) - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); + await page.write(selectors.ticketsIndex.searchTicketInput, '1'); + await page.waitToClick(selectors.ticketsIndex.searchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(1); }); it(`should click on the search result to access to the ticket summary`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave'); + await page.waitToClick(selectors.ticketsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => { - const url = await nightmare - .waitToClick(selectors.ticketSummary.firstSaleItemId) - .waitToClick(selectors.ticketSummary.popoverDiaryButton) - .waitForURL('/diary') - .parsedUrl(); + await page.waitToClick(selectors.ticketSummary.firstSaleItemId); + await page.waitForTransitionEnd('.vn-popover'); + await page.waitToClick(selectors.ticketSummary.popoverDiaryButton); + await page.waitForURL('/diary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/diary'); }); it(`should check the second line id is marked as message`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.itemDiary.secondTicketId, 'className'); expect(result).toContain('message'); }); it(`should check the third line balance is marked as message`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className'); expect(result).toContain('message'); }); it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => { - const result = await nightmare - .autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two') + await page.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two'); + const result = await page .waitToGetProperty(selectors.itemDiary.firstBalance, 'className'); expect(result).toContain('balance'); diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js index 9442f1be0..dec11dfa2 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js @@ -1,77 +1,78 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket descriptor path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('salesperson', 'ticket'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesperson', 'ticket'); + }); + + afterAll(async() => { + await browser.close(); }); describe('Delete ticket', () => { it('should search for an specific ticket', async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 18) - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); + await page.write(selectors.ticketsIndex.searchTicketInput, '18'); + await page.waitToClick(selectors.ticketsIndex.searchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(1); }); it(`should click on the search result to access to the ticket summary`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Cerebro') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Cerebro'); + await page.waitToClick(selectors.ticketsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should update the shipped hour using the descriptor menu`, async() => { - const result = await nightmare - .waitToClick(selectors.ticketDescriptor.moreMenu) - .waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour) - .pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15') - .waitToClick(selectors.ticketDescriptor.acceptChangeHourButton) - .waitForLastSnackbar(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour); + await page.pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15'); + await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Shipped hour updated'); }); it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText'); expect(result).toContain('08:15'); }); it('should delete the ticket using the descriptor more menu', async() => { - const result = await nightmare - .waitToClick(selectors.ticketDescriptor.moreMenu) - .waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket) - .waitToClick(selectors.ticketDescriptor.acceptDeleteButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket); + await page.waitToClick(selectors.ticketDescriptor.acceptDeleteButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Ticket deleted'); }); it('should have been relocated to the ticket index', async() => { - const url = await nightmare - .parsedUrl(); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); }); it(`should search for the deleted ticket and check it's date`, async() => { - const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 18) - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .wait(selectors.ticketsIndex.searchResultDate) - .waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText'); + await page.write(selectors.ticketsIndex.searchTicketInput, '18'); + await page.waitToClick(selectors.ticketsIndex.searchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + await page.wait(selectors.ticketsIndex.searchResultDate); + const result = await page.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText'); expect(result).toContain(2000); }); @@ -79,116 +80,105 @@ describe('Ticket descriptor path', () => { describe('add stowaway', () => { it('should search for a ticket', async() => { - const result = await nightmare - .clearInput(selectors.ticketsIndex.searchTicketInput) - .write(selectors.ticketsIndex.searchTicketInput, 16) - .waitToClick(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); + await page.clearInput(selectors.ticketsIndex.searchTicketInput); + await page.write(selectors.ticketsIndex.searchTicketInput, '16'); + await page.waitToClick(selectors.ticketsIndex.searchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(1); }); it(`should now click on the search result to access to the ticket summary`, async() => { - const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Many Places') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitForURL('/summary') - .parsedUrl(); + await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Many Places'); + await page.waitToClick(selectors.ticketsIndex.searchResult); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it('should open the add stowaway dialog', async() => { - const isVisible = await nightmare - .wait(() => { - let element = document.querySelector('vn-ticket-descriptor'); - return element.$ctrl.canShowStowaway === true; - }) - .waitToClick(selectors.ticketDescriptor.moreMenu) - .waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway) - .wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket) - .visible(selectors.ticketDescriptor.addStowawayDialogFirstTicket); + await page.waitForFunction(() => { + let element = document.querySelector('vn-ticket-descriptor'); + return element.$ctrl.canShowStowaway === true; + }); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway); + await page.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket); + const isVisible = await page.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket); expect(isVisible).toBeTruthy(); }); it('should add a ticket as stowaway', async() => { - const result = await nightmare - .waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should check the state of the stowaway ticket is embarked`, async() => { - const state = await nightmare - .waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText'); + const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText'); expect(state).toEqual('State Embarcando'); }); it(`should navigate back to the added ticket using the descriptors ship button`, async() => { - const url = await nightmare - .waitToClick(selectors.ticketDescriptor.shipButton) - .waitForURL('#!/ticket/17/summary') - .parsedUrl(); + await page.waitToClick(selectors.ticketDescriptor.shipButton); + await page.waitForURL('#!/ticket/17/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('#!/ticket/17/summary'); }); it('should delete the stowaway', async() => { - const result = await nightmare - .waitToClick(selectors.ticketDescriptor.moreMenu) - .waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton) - .waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton) - .waitForLastSnackbar(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton); + await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the ship buton doesn't exisist any more`, async() => { - const exists = await nightmare - .exists(selectors.ticketDescriptor.shipButton); - - expect(exists).toBeFalsy(); + await page.waitForSelector(selectors.ticketDescriptor.shipButton, {hidden: true}); }); }); describe('Make invoice', () => { it('should login as adminBoss role then search for a ticket', async() => { - const invoiceableTicketId = 14; + const invoiceableTicketId = '14'; - const url = await nightmare - .loginAndModule('adminBoss', 'ticket') - .accessToSearchResult(invoiceableTicketId) - .waitForURL('/summary') - .parsedUrl(); + await page.loginAndModule('adminBoss', 'ticket'); + await page.accessToSearchResult(invoiceableTicketId); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain(`ticket/${invoiceableTicketId}/summary`); }); it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText'); expect(result).toEqual('-'); }); it('should invoice the ticket using the descriptor more menu', async() => { - const result = await nightmare - .waitToClick(selectors.ticketDescriptor.moreMenu) - .waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice) - .waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton) - .waitForLastSnackbar(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice); + await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Ticket invoiced'); }); it(`should make sure the ticket summary have an invoiceOutFk`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445') - .waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText'); + await page.waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445'); + const result = await page.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText'); expect(result).toEqual('T4444445'); }); diff --git a/e2e/paths/05-ticket-module/13_services.spec.js b/e2e/paths/05-ticket-module/13_services.spec.js index 472e23315..05f00249b 100644 --- a/e2e/paths/05-ticket-module/13_services.spec.js +++ b/e2e/paths/05-ticket-module/13_services.spec.js @@ -1,141 +1,139 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket services path', () => { - const nightmare = createNightmare(); - const invoicedTicketId = 1; + let browser; + let page; + const invoicedTicketId = '1'; + + afterAll(async() => { + await browser.close(); + }); describe('as employee', () => { - beforeAll(() => { - nightmare - .loginAndModule('employee', 'ticket') - .accessToSearchResult(invoicedTicketId) - .accessToSection('ticket.card.service'); + it('should log in as employee, search for an invoice and get to services', async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult(invoicedTicketId); + await page.accessToSection('ticket.card.service'); }); it('should find the add descripton button disabled for this user role', async() => { - const result = await nightmare - .waitForClassPresent(selectors.ticketService.firstAddServiceTypeButton, 'disabled') - .waitToClick(selectors.ticketService.addServiceButton) - .wait(selectors.ticketService.firstAddServiceTypeButton) - .isDisabled(selectors.ticketService.firstAddServiceTypeButton); + await page.waitForClassPresent(selectors.ticketService.firstAddServiceTypeButton, 'disabled'); + await page.waitToClick(selectors.ticketService.addServiceButton); + await page.wait(selectors.ticketService.firstAddServiceTypeButton); + const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton); expect(result).toBeTruthy(); - }, 100000); + }, 15000); it('should receive an error if you attempt to save a service without access rights', async() => { - const result = await nightmare - .clearInput(selectors.ticketService.firstPriceInput) - .write(selectors.ticketService.firstPriceInput, 999) - .waitToClick(selectors.ticketService.saveServiceButton) - .waitForLastSnackbar(); + await page.clearInput(selectors.ticketService.firstPriceInput); + await page.write(selectors.ticketService.firstPriceInput, '999'); + await page.waitToClick(selectors.ticketService.saveServiceButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(`The current ticket can't be modified`); }); }); describe('as administrative', () => { - let editableTicketId = 16; + let editableTicketId = '16'; it('should navigate to the services of a target ticket', async() => { - const url = await nightmare - .loginAndModule('administrative', 'ticket') - .accessToSearchResult(editableTicketId) - .accessToSection('ticket.card.service') - .waitForURL('/service') - .parsedUrl(); + await page.loginAndModule('administrative', 'ticket'); + await page.accessToSearchResult(editableTicketId); + await page.accessToSection('ticket.card.service'); + await page.waitForURL('/service'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/service'); }); it('should click on the add button to prepare the form to create a new service', async() => { - const result = await nightmare - .waitToClick(selectors.ticketService.addServiceButton) + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketService.addServiceButton); + const result = await page .isVisible(selectors.ticketService.firstServiceTypeAutocomplete); expect(result).toBeTruthy(); }); it('should receive an error if you attempt to save it with empty fields', async() => { - const result = await nightmare - .waitToClick(selectors.ticketService.saveServiceButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketService.saveServiceButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(`can't be blank`); }); it('should click on the add new service type to open the dialog', async() => { - const result = await nightmare - .waitToClick(selectors.ticketService.firstAddServiceTypeButton) - .wait('.vn-dialog.shown') - .isVisible(selectors.ticketService.newServiceTypeNameInput); + await page.waitToClick(selectors.ticketService.firstAddServiceTypeButton); + await page.wait('.vn-dialog.shown'); + const result = await page.isVisible(selectors.ticketService.newServiceTypeNameInput); expect(result).toBeTruthy(); }); it('should receive an error if service type is empty on submit', async() => { - const result = await nightmare - .waitToClick(selectors.ticketService.saveServiceTypeButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketService.saveServiceTypeButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(`Name can't be empty`); }); it('should create a new service type then add price then create the service', async() => { - const result = await nightmare - .write(selectors.ticketService.newServiceTypeNameInput, 'Documentos') - .autocompleteSearch(selectors.ticketService.newServiceTypeExpenseAutocomplete, 'Retencion') - .waitToClick(selectors.ticketService.saveServiceTypeButton) - .write(selectors.ticketService.firstPriceInput, 999) - .waitToClick(selectors.ticketService.saveServiceButton) - .waitForLastSnackbar(); + await page.write(selectors.ticketService.newServiceTypeNameInput, 'Documentos'); + await page.autocompleteSearch(selectors.ticketService.newServiceTypeExpenseAutocomplete, 'Retencion'); + await page.waitToClick(selectors.ticketService.saveServiceTypeButton); + await page.write(selectors.ticketService.firstPriceInput, '999'); + await page.waitToClick(selectors.ticketService.saveServiceButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the service description was created correctly', async() => { - const result = await nightmare - .reloadSection('ticket.card.service') + await page.reloadSection('ticket.card.service'); + const result = await page .waitToGetProperty(`${selectors.ticketService.firstServiceTypeAutocomplete} input`, 'value'); expect(result).toEqual('Documentos'); }); it('should confirm the service quantity was created correctly', async() => { - const result = await nightmare - .waitToGetProperty(selectors.ticketService.firstQuantityInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.ticketService.firstQuantityInput} input`, 'value'); expect(result).toEqual('1'); }); it('should confirm the service price was created correctly', async() => { - const result = await nightmare - .waitToGetProperty(selectors.ticketService.firstPriceInput, 'value'); + const result = await page + .waitToGetProperty(`${selectors.ticketService.firstPriceInput} input`, 'value'); expect(result).toEqual('999'); }); it('should confirm the service VAT was created correctly', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.ticketService.firstVatTypeAutocomplete} input`, 'value'); expect(result).toEqual('General VAT'); }); it('should delete the service', async() => { - const result = await nightmare - .waitToClick(selectors.ticketService.fistDeleteServiceButton) - .waitForNumberOfElements(selectors.ticketService.serviceLine, 0) - .waitToClick(selectors.ticketService.saveServiceButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketService.fistDeleteServiceButton); + await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0); + await page.waitToClick(selectors.ticketService.saveServiceButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the service was removed`, async() => { - const result = await nightmare - .reloadSection('ticket.card.service') - .waitForNumberOfElements(selectors.ticketService.serviceLine, 0) - .countElement(selectors.ticketService.serviceLine); + await page.reloadSection('ticket.card.service'); + await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0); + const result = await page.countElement(selectors.ticketService.serviceLine); expect(result).toEqual(0); }); diff --git a/e2e/paths/05-ticket-module/14_create_ticket.spec.js b/e2e/paths/05-ticket-module/14_create_ticket.spec.js index 773ea3602..843658c94 100644 --- a/e2e/paths/05-ticket-module/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket-module/14_create_ticket.spec.js @@ -1,40 +1,43 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket create path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('employee', 'ticket'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + }); + + afterAll(async() => { + await browser.close(); }); it('should open the new ticket form', async() => { - const url = await nightmare - .waitToClick(selectors.ticketsIndex.newTicketButton) - .wait(selectors.createTicketView.clientAutocomplete) - .parsedUrl(); + await page.waitToClick(selectors.ticketsIndex.newTicketButton); + await page.wait(selectors.createTicketView.clientAutocomplete); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/create'); }); it('should succeed to create a ticket', async() => { - const result = await nightmare - .autocompleteSearch(selectors.createTicketView.clientAutocomplete, 'Tony Stark') - .autocompleteSearch(selectors.createTicketView.addressAutocomplete, 'Tony Stark') - .datePicker(selectors.createTicketView.deliveryDateInput, 1, null) - .autocompleteSearch(selectors.createTicketView.warehouseAutocomplete, 'Warehouse One') - .autocompleteSearch(selectors.createTicketView.agencyAutocomplete, 'Silla247') - .waitToClick(selectors.createTicketView.createButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.createTicketView.clientAutocomplete, 'Tony Stark'); + await page.autocompleteSearch(selectors.createTicketView.addressAutocomplete, 'Tony Stark'); + await page.datePicker(selectors.createTicketView.deliveryDateInput, 1, null); + await page.autocompleteSearch(selectors.createTicketView.warehouseAutocomplete, 'Warehouse One'); + await page.autocompleteSearch(selectors.createTicketView.agencyAutocomplete, 'Silla247'); + await page.waitToClick(selectors.createTicketView.createButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should check the url is now the summary of the ticket', async() => { - const url = await nightmare - .waitForURL('/summary') - .parsedUrl(); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); diff --git a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js index 30eac6f04..2b7e15a92 100644 --- a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js @@ -1,30 +1,35 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket create from client path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('employee', 'client') - .accessToSearchResult('Petter Parker'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Petter Parker'); + }); + + afterAll(async() => { + await browser.close(); }); it('should click the create simple ticket on the descriptor menu', async() => { - const url = await nightmare - .waitToClick(selectors.clientDescriptor.moreMenu) - .waitToClick(selectors.clientDescriptor.simpleTicketButton) - .waitForURL('#!/ticket/create?clientFk=102') - .parsedUrl(); + await page.waitToClick(selectors.clientDescriptor.moreMenu); + await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); + await page.waitForURL('#!/ticket/create?clientFk=102'); + const url = await page.parsedUrl(); expect(url.hash).toContain('clientFk=102'); }); it('should check if the client details are the expected ones', async() => { - const client = await nightmare + const client = await page .waitToGetProperty(`${selectors.createTicketView.clientAutocomplete} input`, 'value'); - const address = await nightmare + const address = await page .waitToGetProperty(`${selectors.createTicketView.addressAutocomplete} input`, 'value'); diff --git a/e2e/paths/05-ticket-module/16_summary.spec.js b/e2e/paths/05-ticket-module/16_summary.spec.js index 2832da428..17c1ca71d 100644 --- a/e2e/paths/05-ticket-module/16_summary.spec.js +++ b/e2e/paths/05-ticket-module/16_summary.spec.js @@ -1,24 +1,32 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Ticket Summary path', () => { - const nightmare = createNightmare(); - const ticketId = 20; + let browser; + let page; + const ticketId = '20'; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + }); + + afterAll(async() => { + await browser.close(); + }); it('should navigate to the target ticket summary section', async() => { - let url = await nightmare - .loginAndModule('employee', 'ticket') - .accessToSearchResult(ticketId) - .waitForURL('/summary') - .parsedUrl(); + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult(ticketId); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should display details from the ticket and it's client on the top of the header`, async() => { - let result = await nightmare - .waitForTextInElement(selectors.ticketSummary.header, 'Bruce Banner') - .waitToGetProperty(selectors.ticketSummary.header, 'innerText'); + await page.waitForTextInElement(selectors.ticketSummary.header, 'Bruce Banner'); + const result = await page.waitToGetProperty(selectors.ticketSummary.header, 'innerText'); expect(result).toContain(`Ticket #${ticketId}`); expect(result).toContain('Bruce Banner (109)'); @@ -26,71 +34,64 @@ describe('Ticket Summary path', () => { }); it('should display ticket details', async() => { - let result = await nightmare + let result = await page .waitToGetProperty(selectors.ticketSummary.state, 'innerText'); expect(result).toContain('Arreglar'); }); it('should display delivery details', async() => { - let result = await nightmare + let result = await page .waitToGetProperty(selectors.ticketSummary.route, 'innerText'); expect(result).toContain('3'); }); it('should display the ticket total', async() => { - let result = await nightmare + let result = await page .waitToGetProperty(selectors.ticketSummary.total, 'innerText'); expect(result).toContain('€155.54'); }); it('should display the ticket line(s)', async() => { - let result = await nightmare + let result = await page .waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText'); expect(result).toContain('000002'); }); it(`should click on the first sale ID making the item descriptor visible`, async() => { - const visible = await nightmare - .waitToClick(selectors.ticketSummary.firstSaleItemId) - .waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage) - .isVisible(selectors.ticketSummary.itemDescriptorPopover); + await page.waitToClick(selectors.ticketSummary.firstSaleItemId); + await page.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage); + const visible = await page.isVisible(selectors.ticketSummary.itemDescriptorPopover); expect(visible).toBeTruthy(); }); it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => { - const exists = await nightmare - .exists(selectors.ticketSummary.itemDescriptorPopoverItemDiaryButton); - - expect(exists).toBeTruthy(); + await page.waitForSelector(selectors.ticketSummary.itemDescriptorPopoverItemDiaryButton, {visible: true}); }); it('should log in as production then navigate to the summary of the same ticket', async() => { - let url = await nightmare - .loginAndModule('production', 'ticket') - .accessToSearchResult(ticketId) - .waitForURL('/summary') - .parsedUrl(); + await page.loginAndModule('production', 'ticket'); + await page.accessToSearchResult(ticketId); + await page.waitForURL('/summary'); + let url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it('should click on the SET OK button', async() => { - let result = await nightmare - .waitToClick(selectors.ticketSummary.setOk) - .waitForLastSnackbar(); + await page.waitToClick(selectors.ticketSummary.setOk); + let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the ticket state was updated', async() => { - let result = await nightmare - .waitForSpinnerLoad() - .waitToGetProperty(selectors.ticketSummary.state, 'innerText'); + await page.waitForSpinnerLoad(); + let result = await page.waitToGetProperty(selectors.ticketSummary.state, 'innerText'); expect(result).toContain('OK'); }); diff --git a/e2e/paths/06-claim-module/01_basic_data.spec.js b/e2e/paths/06-claim-module/01_basic_data.spec.js index 2df37a147..f19cc28f0 100644 --- a/e2e/paths/06-claim-module/01_basic_data.spec.js +++ b/e2e/paths/06-claim-module/01_basic_data.spec.js @@ -1,58 +1,60 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Claim edit basic data path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('salesAssistant', 'claim') - .accessToSearchResult('1') - .accessToSection('claim.card.basicData'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesAssistant', 'claim'); + await page.accessToSearchResult('1'); + await page.accessToSection('claim.card.basicData'); + }); + + afterAll(async() => { + await browser.close(); }); it(`should edit claim state and observation fields`, async() => { - const result = await nightmare - .autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado') - .clearTextarea(selectors.claimBasicData.observationInput) - .write(selectors.claimBasicData.observationInput, 'edited observation') - .waitToClick(selectors.claimBasicData.saveButton) - .waitForSnackbar(); + await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado'); + await page.clearTextarea(selectors.claimBasicData.observationInput); + await page.type(selectors.claimBasicData.observationInput, 'edited observation'); + await page.waitToClick(selectors.claimBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(jasmine.arrayContaining(['Data saved!'])); }); it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => { - const url = await nightmare - .waitForURL('/detail') - .parsedUrl(); + await page.waitForURL('/detail'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/detail'); }); it('should confirm the claim state was edited', async() => { - const result = await nightmare - .reloadSection('claim.card.basicData') - .wait(selectors.claimBasicData.claimStateAutocomplete) - .waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value'); + await page.reloadSection('claim.card.basicData'); + await page.wait(selectors.claimBasicData.claimStateAutocomplete); + const result = await page.waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value'); expect(result).toEqual('Gestionado'); }); it('should confirm the claim observation was edited', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.claimBasicData.observationInput, 'value'); expect(result).toEqual('edited observation'); }); it(`should edit the claim to leave it untainted`, async() => { - const result = await nightmare - .autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente') - .clearTextarea(selectors.claimBasicData.observationInput) - .write(selectors.claimBasicData.observationInput, 'Observation one') - .waitToClick(selectors.claimBasicData.saveButton) - .waitForSnackbar(); + await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente'); + await page.clearTextarea(selectors.claimBasicData.observationInput); + await page.type(selectors.claimBasicData.observationInput, 'Observation one'); + await page.waitToClick(selectors.claimBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(jasmine.arrayContaining(['Data saved!'])); }); diff --git a/e2e/paths/06-claim-module/02_development.spec.js b/e2e/paths/06-claim-module/02_development.spec.js index 640eff636..9e7dbbe36 100644 --- a/e2e/paths/06-claim-module/02_development.spec.js +++ b/e2e/paths/06-claim-module/02_development.spec.js @@ -1,68 +1,71 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Claim development', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('salesAssistant', 'claim') - .accessToSearchResult('1') - .accessToSection('claim.card.development'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesAssistant', 'claim'); + await page.accessToSearchResult('1'); + await page.accessToSection('claim.card.development'); + }); + + afterAll(async() => { + await browser.close(); }); it('should delete a development and create a new one', async() => { - const result = await nightmare - .waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton) - .waitToClick(selectors.claimDevelopment.addDevelopmentButton) - .autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad') - .autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion') - .autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general') - .autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'deliveryNick') - .autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto') - .waitToClick(selectors.claimDevelopment.saveDevelopmentButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton); + await page.waitToClick(selectors.claimDevelopment.addDevelopmentButton); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'deliveryNick'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto'); + await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }, 15000); it(`should redirect to the next section of claims as the role is salesAssistant`, async() => { - const url = await nightmare - .waitForURL('/action') - .parsedUrl(); + await page.waitForURL('/action'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/action'); }); it('should edit a development', async() => { - const result = await nightmare - .reloadSection('claim.card.development') - .autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor') - .autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido') - .autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general') - .autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistantNick') - .autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente') - .waitToClick(selectors.claimDevelopment.saveDevelopmentButton) - .waitForLastSnackbar(); + await page.reloadSection('claim.card.development'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistantNick'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente'); + await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the first development is the expected one', async() => { - const reason = await nightmare - .reloadSection('claim.card.development') + await page.reloadSection('claim.card.development'); + const reason = await page .waitToGetProperty(`${selectors.claimDevelopment.firstClaimReasonAutocomplete} input`, 'value'); - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.claimDevelopment.firstClaimResultAutocomplete} input`, 'value'); - const responsible = await nightmare + const responsible = await page .waitToGetProperty(`${selectors.claimDevelopment.firstClaimResponsibleAutocomplete} input`, 'value'); - const worker = await nightmare + const worker = await page .waitToGetProperty(`${selectors.claimDevelopment.firstClaimWorkerAutocomplete} input`, 'value'); - const redelivery = await nightmare + const redelivery = await page .waitToGetProperty(`${selectors.claimDevelopment.firstClaimRedeliveryAutocomplete} input`, 'value'); expect(reason).toEqual('Calor'); @@ -73,19 +76,19 @@ describe('Claim development', () => { }); it('should confirm the second development is the expected one', async() => { - const reason = await nightmare + const reason = await page .waitToGetProperty(`${selectors.claimDevelopment.secondClaimReasonAutocomplete} input`, 'value'); - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.claimDevelopment.secondClaimResultAutocomplete} input`, 'value'); - const responsible = await nightmare + const responsible = await page .waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value'); - const worker = await nightmare + const worker = await page .waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value'); - const redelivery = await nightmare + const redelivery = await page .waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value'); expect(reason).toEqual('Baja calidad'); diff --git a/e2e/paths/06-claim-module/03_detail.spec.js b/e2e/paths/06-claim-module/03_detail.spec.js index 43d291bb3..e62a2981f 100644 --- a/e2e/paths/06-claim-module/03_detail.spec.js +++ b/e2e/paths/06-claim-module/03_detail.spec.js @@ -1,48 +1,51 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; // #1528 e2e claim/detail xdescribe('Claim detail', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'claim') - .accessToSearchResult(1) - .accessToSection('claim.card.detail'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'claim'); + await page.accessToSearchResult('1'); + await page.accessToSection('claim.card.detail'); + }); + + afterAll(async() => { + await browser.close(); }); it('should add the first claimable item from ticket to the claim', async() => { - const result = await nightmare - .waitToClick(selectors.claimDetail.addItemButton) - .waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimDetail.addItemButton); + await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the claim contains now two items', async() => { - const result = await nightmare - .countElement(selectors.claimDetail.claimDetailLine); + const result = await page.countElement(selectors.claimDetail.claimDetailLine); expect(result).toEqual(2); }); it('should edit de first item claimed quantity', async() => { - const result = await nightmare - .clearInput(selectors.claimDetail.firstItemQuantityInput) - .write(selectors.claimDetail.firstItemQuantityInput, 4) - .write('body', '\u000d') // simulates enter - .waitForLastSnackbar(); + await page.clearInput(selectors.claimDetail.firstItemQuantityInput); // selector deleted, find new upon fixes + await page.write(selectors.claimDetail.firstItemQuantityInput, '4'); // selector deleted, find new upon fixes + await page.keyboard.press('Enter'); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the first item quantity, and the claimed total were correctly edited', async() => { - const claimedQuantity = await nightmare - .waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value'); + const claimedQuantity = page + .waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value'); // selector deleted, find new upon fixes - const totalClaimed = await nightmare + const totalClaimed = page .waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText'); expect(claimedQuantity).toEqual('4'); @@ -50,71 +53,63 @@ xdescribe('Claim detail', () => { }); it('should login as salesAssistant and navigate to the claim.detail section', async() => { - const url = await nightmare - .loginAndModule('salesAssistant', 'claim') - .accessToSearchResult(1) - .accessToSection('claim.card.detail') - .waitForURL('/detail') - .parsedUrl(); + await page.loginAndModule('salesAssistant', 'claim'); + await page.accessToSearchResult('1'); + await page.accessToSection('claim.card.detail'); + await page.waitForURL('/detail'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/detail'); }); it('should edit de second item claimed discount', async() => { - const result = await nightmare - .waitToClick(selectors.claimDetail.secondItemDiscount) - .write(selectors.claimDetail.discountInput, 100) - .write('body', '\u000d') // simulates enter - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimDetail.secondItemDiscount); + await page.write(selectors.claimDetail.discountInput, '100'); + await page.keyboard.press('Enter'); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should check the mana is the expected one', async() => { - const result = await nightmare - .waitToClick(selectors.claimDetail.secondItemDiscount) - .waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText'); + await page.waitToClick(selectors.claimDetail.secondItemDiscount); + const result = await page.waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText'); expect(result).toContain('MANÁ: €106'); }); it('should delete the second item from the claim', async() => { - const result = await nightmare - .waitToClick(selectors.claimDetail.secondItemDeleteButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimDetail.secondItemDeleteButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the claim contains now one item', async() => { - const result = await nightmare - .countElement(selectors.claimDetail.claimDetailLine); + const result = await page.countElement(selectors.claimDetail.claimDetailLine); expect(result).toEqual(1); }); it('should add the deleted ticket from to the claim', async() => { - const result = await nightmare - .waitToClick(selectors.claimDetail.addItemButton) - .waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimDetail.addItemButton); + await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should have been redirected to the next section in claims`, async() => { - const url = await nightmare - .waitForURL('/development') - .parsedUrl(); + await page.waitForURL('/development'); + const url = await page.parsedUrl(); expect(url.hash).toContain('development'); }); it('should navigate back to claim.detail to confirm the claim contains now two items', async() => { - const result = await nightmare - .accessToSection('claim.card.detail') - .wait(selectors.claimDetail.claimDetailLine) - .countElement(selectors.claimDetail.claimDetailLine); + await page.accessToSection('claim.card.detail'); + await page.wait(selectors.claimDetail.claimDetailLine); + const result = await page.countElement(selectors.claimDetail.claimDetailLine); expect(result).toEqual(2); }); diff --git a/e2e/paths/06-claim-module/04_claim_action.spec.js b/e2e/paths/06-claim-module/04_claim_action.spec.js index 5bf6ed3d2..996cf5e11 100644 --- a/e2e/paths/06-claim-module/04_claim_action.spec.js +++ b/e2e/paths/06-claim-module/04_claim_action.spec.js @@ -1,77 +1,76 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Claim action path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('administrative', 'claim') - .accessToSearchResult(2) - .accessToSection('claim.card.action'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('administrative', 'claim'); + await page.accessToSearchResult('2'); + await page.accessToSection('claim.card.action'); + }); + + afterAll(async() => { + await browser.close(); }); it('should import the claim', async() => { - const result = await nightmare - .waitToClick(selectors.claimAction.importClaimButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimAction.importClaimButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should import the second importable ticket', async() => { - const result = await nightmare - .waitToClick(selectors.claimAction.importTicketButton) - .waitToClick(selectors.claimAction.secondImportableTicket) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimAction.importTicketButton); + await page.waitToClick(selectors.claimAction.secondImportableTicket); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); + // #2036 claim.action destinatario it('should edit the second line destination field', async() => { - const result = await nightmare - .autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno') - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno'); + // const result = await page.waitForLastSnackbar(); - expect(result).toEqual('Data saved!'); + // expect(result).toEqual('Data saved!'); }); it('should delete the first line', async() => { - const result = await nightmare - .waitToClick(selectors.claimAction.firstDeleteLine) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimAction.firstDeleteLine); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should refresh the view to check the remaining line is the expected one', async() => { - const result = await nightmare - .reloadSection('claim.card.action') - .waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value'); + await page.reloadSection('claim.card.action'); + const result = await page.waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value'); expect(result).toEqual('Bueno'); }); it('should delete the current first line', async() => { - const result = await nightmare - .waitToClick(selectors.claimAction.firstDeleteLine) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimAction.firstDeleteLine); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should check the "is paid with mana" checkbox', async() => { - const result = await nightmare - .waitToClick(selectors.claimAction.isPaidWithManaCheckbox) - .waitForSnackbar(); + await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(jasmine.arrayContaining(['Data saved!'])); }); it('should confirm the "is paid with mana" checkbox is checked', async() => { - const result = await nightmare - .reloadSection('claim.card.action') - .checkboxState(selectors.claimAction.isPaidWithManaCheckbox); + await page.reloadSection('claim.card.action'); + const result = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox); expect(result).toBe('checked'); }); diff --git a/e2e/paths/06-claim-module/05_summary.spec.js b/e2e/paths/06-claim-module/05_summary.spec.js index b6d16cb6b..71f8b7252 100644 --- a/e2e/paths/06-claim-module/05_summary.spec.js +++ b/e2e/paths/06-claim-module/05_summary.spec.js @@ -1,96 +1,95 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('claim Summary path', () => { - const nightmare = createNightmare(); - const claimId = 4; + let browser; + let page; + const claimId = '4'; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + }); + + afterAll(async() => { + await browser.close(); + }); it('should navigate to the target claim summary section', async() => { - let url = await nightmare - .loginAndModule('employee', 'claim') - .accessToSearchResult(claimId) - .waitForURL('/summary') - .parsedUrl(); + await page.loginAndModule('employee', 'claim'); + await page.accessToSearchResult(claimId); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should display details from the claim and it's client on the top of the header`, async() => { - let result = await nightmare - .waitForTextInElement(selectors.claimSummary.header, 'Tony Stark') - .waitToGetProperty(selectors.claimSummary.header, 'innerText'); + await page.waitForTextInElement(selectors.claimSummary.header, 'Tony Stark'); + const result = await page.waitToGetProperty(selectors.claimSummary.header, 'innerText'); expect(result).toContain('4 -'); expect(result).toContain('Tony Stark'); }); it('should display the claim state', async() => { - let result = await nightmare - .waitToGetProperty(selectors.claimSummary.state, 'innerText'); + const result = await page.waitToGetProperty(selectors.claimSummary.state, 'innerText'); expect(result).toContain('Resuelto'); }); it('should display the observation', async() => { - let result = await nightmare - .waitToGetProperty(selectors.claimSummary.observation, 'value'); + const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'value'); expect(result).toContain('observation four'); }); it('should display the claimed line(s)', async() => { - let result = await nightmare - .waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText'); + const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText'); expect(result).toContain('000002'); }); it(`should click on the first sale ID making the item descriptor visible`, async() => { - const visible = await nightmare - .waitToClick(selectors.claimSummary.firstSaleItemId) - .waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage) - .isVisible(selectors.claimSummary.itemDescriptorPopover); + await page.waitToClick(selectors.claimSummary.firstSaleItemId); + await page.waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage); + const visible = await page.isVisible(selectors.claimSummary.itemDescriptorPopover); expect(visible).toBeTruthy(); }); it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => { - const exists = await nightmare - .exists(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton); + await page.waitForSelector(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton, {visible: true}); - expect(exists).toBeTruthy(); - await nightmare.mousedown('.vn-popover.shown'); + await page.keyboard.press('Escape'); + await page.waitFor(1000); }); it('should display the claim development details', async() => { - let result = await nightmare - .waitToGetProperty(selectors.claimSummary.firstDevelopmentWorker, 'innerText'); + const result = await page.waitToGetProperty(selectors.claimSummary.firstDevelopmentWorker, 'innerText'); expect(result).toContain('salesAssistantNick'); }); it(`should click on the first development worker making the worker descriptor visible`, async() => { - const visible = await nightmare - .waitToClick(selectors.claimSummary.firstDevelopmentWorker) - .wait(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton) - .isVisible(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton); + await page.waitToClick(selectors.claimSummary.firstDevelopmentWorker); + + const visible = await page.isVisible(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton); expect(visible).toBeTruthy(); }); it(`should check the url for the go to clientlink of the descriptor is for the right client id`, async() => { - const exists = await nightmare - .exists(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton); + await page.waitForSelector(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton, {visible: true}); - expect(exists).toBeTruthy(); - await nightmare.mousedown('.vn-popover.shown'); + await page.keyboard.press('Escape'); + await page.waitFor(1000); }); it(`should click on the first action ticket ID making the ticket descriptor visible`, async() => { - const visible = await nightmare - .waitToClick(selectors.claimSummary.firstActionTicketId) - .wait(selectors.claimSummary.firstActionTicketDescriptor) - .isVisible(selectors.claimSummary.firstActionTicketDescriptor); + await page.waitToClick(selectors.claimSummary.firstActionTicketId); + await page.waitForSelector(selectors.claimSummary.firstActionTicketDescriptor); + const visible = await page.isVisible(selectors.claimSummary.firstActionTicketDescriptor); expect(visible).toBeTruthy(); }); diff --git a/e2e/paths/06-claim-module/06_descriptor.spec.js b/e2e/paths/06-claim-module/06_descriptor.spec.js index 67faaa224..83dbec5fd 100644 --- a/e2e/paths/06-claim-module/06_descriptor.spec.js +++ b/e2e/paths/06-claim-module/06_descriptor.spec.js @@ -1,70 +1,69 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('claim Descriptor path', () => { - const nightmare = createNightmare(); - const claimId = 1; + let browser; + let page; + const claimId = '1'; - it('should navigate to the target claim summary section', async() => { - let url = await nightmare - .loginAndModule('employee', 'claim') - .accessToSearchResult(claimId) - .waitForURL('/summary') - .parsedUrl(); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should now navigate to the target claim summary section', async() => { + await page.loginAndModule('employee', 'claim'); + await page.accessToSearchResult(claimId); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should not be able to see the delete claim button of the descriptor more menu`, async() => { - let exists = await nightmare - .waitToClick(selectors.claimDescriptor.moreMenu) - .exists(selectors.claimDescriptor.moreMenuDeleteClaim); - - expect(exists).toBeFalsy(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.claimDescriptor.moreMenu); + await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {hidden: true}); }); it(`should log in as salesAssistant and navigate to the target claim`, async() => { - let url = await nightmare - .loginAndModule('salesAssistant', 'claim') - .accessToSearchResult(claimId) - .waitForURL('/summary') - .parsedUrl(); + await page.loginAndModule('salesAssistant', 'claim'); + await page.accessToSearchResult(claimId); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should be able to see the delete claim button of the descriptor more menu`, async() => { - let exists = await nightmare - .waitToClick(selectors.claimDescriptor.moreMenu) - .wait(selectors.claimDescriptor.moreMenuDeleteClaim) - .exists(selectors.claimDescriptor.moreMenuDeleteClaim); - - expect(exists).toBeTruthy(); + await page.waitToClick(selectors.claimDescriptor.moreMenu); + await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {visible: true}); }); it(`should delete the claim`, async() => { - let result = await nightmare - .waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim) - .waitToClick(selectors.claimDescriptor.acceptDeleteClaim) - .waitForLastSnackbar(); + await page.waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim); + await page.waitToClick(selectors.claimDescriptor.acceptDeleteClaim); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Claim deleted!'); }); it(`should have been relocated to the claim index`, async() => { - let url = await nightmare - .waitForURL('/claim/index') - .parsedUrl(); + await page.waitForURL('/claim/index'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/claim/index'); }); it(`should search for the deleted claim to find no results`, async() => { - const result = await nightmare - .write(selectors.claimsIndex.searchClaimInput, claimId) - .waitToClick(selectors.claimsIndex.searchButton) - .waitForNumberOfElements(selectors.claimsIndex.searchResult, 0) - .countElement(selectors.claimsIndex.searchResult); + await page.write(selectors.claimsIndex.searchClaimInput, claimId); + await page.waitToClick(selectors.claimsIndex.searchButton); + await page.waitForNumberOfElements(selectors.claimsIndex.searchResult, 0); + const result = await page.countElement(selectors.claimsIndex.searchResult); expect(result).toEqual(0); }); diff --git a/e2e/paths/07-order-module/01_edit_basic_data.spec.js b/e2e/paths/07-order-module/01_edit_basic_data.spec.js index 4cc04bfa0..1dd89b4b7 100644 --- a/e2e/paths/07-order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/07-order-module/01_edit_basic_data.spec.js @@ -1,24 +1,30 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Order edit basic data path', () => { - const nightmare = createNightmare(); + let browser; + let page; const today = new Date().getDate(); - describe('when confirmed order', () => { - beforeAll(() => { - nightmare - .loginAndModule('employee', 'order') - .accessToSearchResult(1) - .accessToSection('order.card.basicData'); - }); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'order'); + await page.accessToSearchResult('1'); + await page.accessToSection('order.card.basicData'); + }); + + afterAll(async() => { + await browser.close(); + }); + + describe('when confirmed order', () => { it('should not be able to change the client', async() => { - const result = await nightmare - .autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark') - .autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark') - .waitToClick(selectors.orderBasicData.saveButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark'); + await page.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark'); + await page.waitToClick(selectors.orderBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`); }, 15000); @@ -26,24 +32,25 @@ describe('Order edit basic data path', () => { describe('when order with rows', () => { it('should now navigate to order index', async() => { - const orderId = 16; - const url = await nightmare - .waitToClick(selectors.orderDescriptor.returnToModuleIndexButton) - .waitToClick(selectors.orderDescriptor.acceptNavigationButton) - .wait(selectors.ordersIndex.createOrderButton) - .accessToSearchResult(orderId) - .accessToSection('order.card.basicData') - .wait(selectors.orderBasicData.observationInput) - .parsedUrl(); + const orderId = '16'; + + await page.waitToClick(selectors.orderDescriptor.returnToModuleIndexButton); + await page.waitToClick(selectors.orderDescriptor.acceptNavigationButton); + await page.waitForContentLoaded(); + await page.accessToSearchResult(orderId); + await page.accessToSection('order.card.basicData'); + await page.waitForContentLoaded(); + await page.waitForSelector(selectors.orderBasicData.observationInput, {visible: true}); + await page.waitForURL('basic-data'); + const url = await page.parsedUrl(); expect(url.hash).toEqual(`#!/order/${orderId}/basic-data`); }); it('should not be able to change anything', async() => { - const result = await nightmare - .write(selectors.orderBasicData.observationInput, 'observation') - .waitToClick(selectors.orderBasicData.saveButton) - .waitForLastSnackbar(); + await page.type(selectors.orderBasicData.observationInput, 'observation'); + await page.waitToClick(selectors.orderBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`); }); @@ -51,66 +58,63 @@ describe('Order edit basic data path', () => { describe('when new order', () => { it('should navigate to the order index and click the new order button', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.returnToModuleIndexButton) - .waitToClick(selectors.orderBasicData.acceptButton) - .waitToClick(selectors.ordersIndex.createOrderButton) - .waitForURL('#!/order/create') - .parsedUrl(); + await page.waitToClick(selectors.globalItems.returnToModuleIndexButton); + await page.waitToClick(selectors.orderBasicData.acceptButton); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.ordersIndex.createOrderButton); + await page.waitForURL('#!/order/create'); + const url = await page.parsedUrl(); expect(url.hash).toContain('#!/order/create'); }); it('should now create a new one', async() => { - const url = await nightmare - .autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Jessica Jones') - .datePicker(selectors.createOrderView.landedDatePicker, 0, today) - .autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'inhouse pickup') - .waitToClick(selectors.createOrderView.createButton) - .waitForURL('/catalog') - .parsedUrl(); + await page.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Jessica Jones'); + await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today); + await page.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'Other agency'); + await page.waitToClick(selectors.createOrderView.createButton); + await page.waitForURL('/catalog'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/catalog'); }); it('should navigate to the basic data section of the new order', async() => { - const url = await nightmare - .accessToSection('order.card.basicData') - .wait(selectors.orderBasicData.observationInput) - .parsedUrl(); + await page.accessToSection('order.card.basicData'); + await page.wait(selectors.orderBasicData.observationInput); + const url = await page.parsedUrl(); expect(url.hash).toContain('/basic-data'); }); it('should be able to modify all the properties', async() => { - const result = await nightmare - .autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark') - .autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark') - .autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247') - .write(selectors.orderBasicData.observationInput, 'my observation') - .waitToClick(selectors.orderBasicData.saveButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark'); + await page.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark'); + await page.autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247'); + await page.type(selectors.orderBasicData.observationInput, 'my observation'); + await page.waitToClick(selectors.orderBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should now confirm the client have been edited', async() => { - const result = await nightmare - .reloadSection('order.card.basicData') + await page.reloadSection('order.card.basicData'); + const result = await page .waitToGetProperty(`${selectors.orderBasicData.clientAutocomplete} input`, 'value'); expect(result).toEqual('104: Tony Stark'); }); it('should now confirm the agency have been edited', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(`${selectors.orderBasicData.agencyAutocomplete} input`, 'value'); expect(result).toEqual('7: Silla247'); }); it('should now confirm the observations have been edited', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.orderBasicData.observationInput, 'value'); expect(result).toEqual('my observation'); diff --git a/e2e/paths/07-order-module/02_catalog.spec.js b/e2e/paths/07-order-module/02_catalog.spec.js index cad95741e..430eba007 100644 --- a/e2e/paths/07-order-module/02_catalog.spec.js +++ b/e2e/paths/07-order-module/02_catalog.spec.js @@ -1,82 +1,87 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Order catalog', () => { - const nightmare = createNightmare(); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'order'); + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'order'); + }); + + afterAll(async() => { + await browser.close(); }); it('should open the create new order form', async() => { - const url = await nightmare - .waitToClick(selectors.ordersIndex.createOrderButton) - .waitForURL('order/create') - .parsedUrl(); + await page.waitToClick(selectors.ordersIndex.createOrderButton); + await page.waitForURL('order/create'); + const url = await page.parsedUrl(); expect(url.hash).toContain('order/create'); }); it('should create a new order', async() => { let today = new Date().getDate(); - const url = await nightmare - .autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Tony Stark') - .datePicker(selectors.createOrderView.landedDatePicker, 0, today) - .autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'inhouse pickup') - .waitToClick(selectors.createOrderView.createButton) - .waitForURL('/catalog') - .parsedUrl(); + + await page.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Tony Stark'); + await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today); + await page.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'Other agency'); + await page.waitToClick(selectors.createOrderView.createButton); + await page.waitForURL('/catalog'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/catalog'); }); it('should add the realm and type filters and obtain results', async() => { - const result = await nightmare - .waitToClick(selectors.orderCatalog.plantRealmButton) - .autocompleteSearch(selectors.orderCatalog.typeAutocomplete, 'Anthurium') - .waitForNumberOfElements('section.product', 4) - .countElement('section.product'); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.orderCatalog.plantRealmButton); + await page.autocompleteSearch(selectors.orderCatalog.typeAutocomplete, 'Anthurium'); + await page.waitForNumberOfElements('section.product', 4); + const result = await page.countElement('section.product'); expect(result).toEqual(4); }); it('should search for the item tag value +1 and find two results', async() => { - const result = await nightmare - .write(selectors.orderCatalog.itemTagValueInput, '+1\u000d') - .waitForNumberOfElements('section.product', 2) - .countElement('section.product'); + await page.write(selectors.orderCatalog.itemTagValueInput, '+1'); + await page.keyboard.press('Enter'); + await page.waitForNumberOfElements('section.product', 2); + const result = await page.countElement('section.product'); expect(result).toEqual(2); }); it('should search for the item tag categoria +1 and find two results', async() => { - const result = await nightmare - .waitToClick(selectors.orderCatalog.openTagSearch) - .autocompleteSearch(selectors.orderCatalog.tagAutocomplete, 'categoria') - .write(selectors.orderCatalog.tagValueInput, '+1') - .waitToClick(selectors.orderCatalog.searchTagButton) - .waitForNumberOfElements('section.product', 1) - .countElement('section.product'); + await page.waitToClick(selectors.orderCatalog.openTagSearch); + await page.autocompleteSearch(selectors.orderCatalog.tagAutocomplete, 'categoria'); + await page.write(selectors.orderCatalog.tagValueInput, '+1'); + await page.waitToClick(selectors.orderCatalog.searchTagButton); + await page.waitForNumberOfElements('section.product', 1); + const result = await page.countElement('section.product'); expect(result).toEqual(1); }); it('should remove the tag filters and have 4 results', async() => { - const result = await nightmare - .waitToClick(selectors.orderCatalog.fourthFilterRemoveButton) - .waitToClick(selectors.orderCatalog.thirdFilterRemoveButton) - .waitForNumberOfElements('.product', 4) - .countElement('section.product'); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.orderCatalog.fourthFilterRemoveButton); + await page.waitToClick(selectors.orderCatalog.thirdFilterRemoveButton); + await page.waitForNumberOfElements('.product', 4); + const result = await page.countElement('section.product'); expect(result).toEqual(4); }); - it('should search for the item id 1 and have only 1 result', async() => { - const result = await nightmare - .write(selectors.orderCatalog.itemIdInput, '2\u000d') - .waitForNumberOfElements('section.product', 1) - .countElement('section.product'); + it('should search for an item by id', async() => { + await page.write(selectors.orderCatalog.itemIdInput, '2'); + await page.keyboard.press('Enter'); + await page.waitForNumberOfElements('section.product', 1); + const result = await page.countElement('section.product'); expect(result).toEqual(1); }); diff --git a/e2e/paths/07-order-module/03_lines.spec.js b/e2e/paths/07-order-module/03_lines.spec.js index 8128fdc07..99c8a221b 100644 --- a/e2e/paths/07-order-module/03_lines.spec.js +++ b/e2e/paths/07-order-module/03_lines.spec.js @@ -1,43 +1,47 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Order lines', () => { - const nightmare = createNightmare(); - beforeAll(() => { - nightmare - .loginAndModule('employee', 'order') - .accessToSearchResult(16) - .accessToSection('order.card.line'); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'order'); + await page.accessToSearchResult('16'); + await page.accessToSection('order.card.line'); + }); + + afterAll(async() => { + await browser.close(); }); it('should check the order subtotal', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText'); expect(result).toContain('135.60'); }); it('should delete the first line in the order', async() => { - const result = await nightmare - .waitToClick(selectors.orderLine.firstLineDeleteButton) - .waitToClick(selectors.orderLine.confirmButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.orderLine.firstLineDeleteButton); + await page.waitToClick(selectors.orderLine.confirmButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the order subtotal has changed', async() => { - const result = await nightmare + const result = await page .waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText'); expect(result).toContain('90.10'); }); it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => { - const url = await nightmare - .waitToClick(selectors.orderLine.confirmOrder) - .waitForURL('ticket/index') - .parsedUrl(); + await page.waitToClick(selectors.orderLine.confirmOrder); + await page.waitForURL('ticket/index'); + const url = await page.parsedUrl(); expect(url.hash).toContain('ticket/index'); expect(url.hash).toContain('clientFk'); diff --git a/e2e/paths/08-route-module/01_create.spec.js b/e2e/paths/08-route-module/01_create.spec.js index 1282eabd9..74b5d9173 100644 --- a/e2e/paths/08-route-module/01_create.spec.js +++ b/e2e/paths/08-route-module/01_create.spec.js @@ -1,67 +1,69 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Route create path', () => { - const nightmare = createNightmare(); - describe('as employee', () => { - beforeAll(() => { - nightmare - .loginAndModule('employee', 'route'); - }); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'route'); + }); + + afterAll(async() => { + await browser.close(); + }); + + describe('as employee', () => { it('should click on the add new route button and open the creation form', async() => { - const url = await nightmare - .waitToClick(selectors.routeIndex.addNewRouteButton) - .wait(selectors.createRouteView.workerAutocomplete) - .parsedUrl(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.routeIndex.addNewRouteButton); + await page.wait(selectors.createRouteView.workerAutocomplete); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/route/create'); }); it(`should attempt to create a new route but fail since employee has no access rights`, async() => { - const result = await nightmare - .write(selectors.createRouteView.descriptionInput, 'faster faster!!') - .waitToClick(selectors.createRouteView.submitButton) - .waitForLastSnackbar(); + await page.write(selectors.createRouteView.descriptionInput, 'faster faster!!'); + await page.waitToClick(selectors.createRouteView.submitButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Access denied'); }); }); describe('as delivery', () => { - beforeAll(() => { - nightmare - .login('delivery') - .selectModule('route') - .changeLanguageToEnglish(); + beforeAll(async() => { + await page.login('delivery'); + await page.selectModule('route'); + await page.changeLanguageToEnglish(); }); it('should again click on the add new route button and open the creation form', async() => { - const url = await nightmare - .waitToClick(selectors.routeIndex.addNewRouteButton) - .wait(selectors.createRouteView.workerAutocomplete) - .parsedUrl(); + await page.waitToClick(selectors.routeIndex.addNewRouteButton); + await page.wait(selectors.createRouteView.workerAutocomplete); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/route/create'); }); it(`should create a new route`, async() => { - const result = await nightmare - .autocompleteSearch(selectors.createRouteView.workerAutocomplete, 'teamManagerNick') - .datePicker(selectors.createRouteView.createdDatePicker, 0, null) - .autocompleteSearch(selectors.createRouteView.vehicleAutoComplete, '4444-IMK') - .autocompleteSearch(selectors.createRouteView.agencyAutoComplete, 'Teleportation device') - .write(selectors.createRouteView.descriptionInput, 'faster faster!!') - .waitToClick(selectors.createRouteView.submitButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.createRouteView.workerAutocomplete, 'teamManagerNick'); + await page.datePicker(selectors.createRouteView.createdDatePicker, 0, null); + await page.autocompleteSearch(selectors.createRouteView.vehicleAutoComplete, '4444-IMK'); + await page.autocompleteSearch(selectors.createRouteView.agencyAutoComplete, 'Teleportation device'); + await page.write(selectors.createRouteView.descriptionInput, 'faster faster!!'); + await page.waitToClick(selectors.createRouteView.submitButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the redirection to the created route summary`, async() => { - const url = await nightmare - .wait(selectors.routeSummary.routeId) - .parsedUrl(); + await page.wait(selectors.routeSummary.routeId); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); diff --git a/e2e/paths/08-route-module/02_basic_data.spec.js b/e2e/paths/08-route-module/02_basic_data.spec.js index 63ed673d9..29b205172 100644 --- a/e2e/paths/08-route-module/02_basic_data.spec.js +++ b/e2e/paths/08-route-module/02_basic_data.spec.js @@ -1,62 +1,60 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('Route basic Data path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('delivery', 'route') - .accessToSearchResult(1) - .accessToSection('route.card.basicData'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('delivery', 'route'); + await page.accessToSearchResult('1'); + await page.accessToSection('route.card.basicData'); + }); + + afterAll(async() => { + await browser.close(); }); it('should edit the route basic data', async() => { - const result = await nightmare - .autocompleteSearch(selectors.routeBasicData.workerAutoComplete, 'adminBossNick') - .autocompleteSearch(selectors.routeBasicData.vehicleAutoComplete, '1111-IMK') - .datePicker(selectors.routeBasicData.createdDateInput, 1, null) - .clearInput(selectors.routeBasicData.kmStartInput) - .write(selectors.routeBasicData.kmStartInput, 1) - .clearInput(selectors.routeBasicData.kmEndInput) - .write(selectors.routeBasicData.kmEndInput, 2) - .write(selectors.routeBasicData.startedHourInput, '0800') - .write(selectors.routeBasicData.finishedHourInput, '1230') - .waitToClick(selectors.routeBasicData.saveButton) - .waitForLastSnackbar(); + await page.autocompleteSearch(selectors.routeBasicData.workerAutoComplete, 'adminBossNick'); + await page.autocompleteSearch(selectors.routeBasicData.vehicleAutoComplete, '1111-IMK'); + await page.datePicker(selectors.routeBasicData.createdDateInput, 1, null); + await page.clearInput(selectors.routeBasicData.kmStartInput); + await page.write(selectors.routeBasicData.kmStartInput, '1'); + await page.clearInput(selectors.routeBasicData.kmEndInput); + await page.write(selectors.routeBasicData.kmEndInput, '2'); + await page.type(`${selectors.routeBasicData.startedHourInput} input`, '0800'); + await page.type(`${selectors.routeBasicData.finishedHourInput} input`, '1230'); + await page.waitToClick(selectors.routeBasicData.saveButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }, 15000); it('should confirm the worker was edited', async() => { - const worker = await nightmare - .reloadSection('route.card.basicData') - .waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value'); + await page.reloadSection('route.card.basicData'); + const worker = await page.waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value'); - expect(worker).toEqual('adminBossNick'); + expect(worker).toEqual('adminBoss - adminBossNick'); }); it('should confirm the vehicle was edited', async() => { - const vehicle = await nightmare - .waitToGetProperty(`${selectors.routeBasicData.vehicleAutoComplete} input`, 'value'); - + const vehicle = await page.waitToGetProperty(`${selectors.routeBasicData.vehicleAutoComplete} input`, 'value'); expect(vehicle).toEqual('1111-IMK'); }); it('should confirm the km start was edited', async() => { - const kmStart = await nightmare - .waitToGetProperty(selectors.routeBasicData.kmStartInput, 'value'); - + const kmStart = await page.waitToGetProperty(`${selectors.routeBasicData.kmStartInput} input`, 'value'); expect(kmStart).toEqual('1'); }); it('should confirm the km end was edited', async() => { - const kmEnd = await nightmare - .waitToGetProperty(selectors.routeBasicData.kmEndInput, 'value'); - + const kmEnd = await page.waitToGetProperty(`${selectors.routeBasicData.kmEndInput} input`, 'value'); expect(kmEnd).toEqual('2'); }); diff --git a/e2e/paths/08-route-module/03_tickets.spec.js b/e2e/paths/08-route-module/03_tickets.spec.js index 24a3ebbcf..53b8f56c8 100644 --- a/e2e/paths/08-route-module/03_tickets.spec.js +++ b/e2e/paths/08-route-module/03_tickets.spec.js @@ -1,87 +1,93 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; // #1528 e2e claim/detail xdescribe('Route basic Data path', () => { - const nightmare = createNightmare(); + let browser; + let page; - beforeAll(() => { - nightmare - .loginAndModule('delivery', 'route') - .accessToSearchResult(3) - .accessToSection('route.card.tickets'); + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('delivery', 'route'); + await page.accessToSearchResult('3'); + await page.accessToSection('route.card.tickets'); + }); + + afterAll(async() => { + await browser.close(); }); it('should modify the first ticket priority', async() => { - const result = await nightmare - .write(selectors.routeTickets.firstTicketPriority, 2) - .write('body', '\u000d') // simulates enter - .waitForLastSnackbar(); + const result = await nightmare; + await page.write(selectors.routeTickets.firstTicketPriority, '2'); + await page.keyboard.press('Enter'); + await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the buscamanButton is disabled', async() => { - const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector); - }, `${selectors.routeTickets.buscamanButton} :disabled`); + const result = await nightmare; + await page.evaluate(selector => { + return document.querySelector(selector); + }, `${selectors.routeTickets.buscamanButton} :disabled`); expect(result).toBeTruthy(); }); it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => { - const result = await nightmare - .waitToClick(selectors.routeTickets.firstTicketCheckbox) - .evaluate(selector => { - return document.querySelector(selector); - }, `${selectors.routeTickets.buscamanButton} :disabled`); + const result = await nightmare; + await page.waitToClick(selectors.routeTickets.firstTicketCheckbox); + await page.evaluate(selector => { + return document.querySelector(selector); + }, `${selectors.routeTickets.buscamanButton} :disabled`); expect(result).toBeFalsy(); }); it('should check the route volume on the descriptor', async() => { - const result = await nightmare - .waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); + const result = await nightmare; + await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); expect(result).toEqual('1.1 / 18 m³'); }); it('should count how many tickets are in route', async() => { - const result = await nightmare - .countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); + const result = await nightmare; + await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); expect(result).toEqual(11); }); it('should delete the first ticket in route', async() => { - const result = await nightmare - .waitToClick(selectors.routeTickets.firstTicketDeleteButton) - .waitToClick(selectors.routeTickets.confirmButton) - .waitForLastSnackbar(); + const result = await nightmare; + await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton); + await page.waitToClick(selectors.routeTickets.confirmButton); + await page.waitForLastSnackbar(); expect(result).toEqual('Ticket removed from route'); }); it('should again delete the first ticket in route', async() => { - const result = await nightmare - .waitToClick(selectors.routeTickets.firstTicketDeleteButton) - .waitToClick(selectors.routeTickets.confirmButton) - .waitForLastSnackbar(); + const result = await nightmare; + await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton); + await page.waitToClick(selectors.routeTickets.confirmButton); + await page.waitForLastSnackbar(); expect(result).toEqual('Ticket removed from route'); }); it('should now count how many tickets are in route to find one less', async() => { - const result = await nightmare - .countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); + const result = await nightmare; + await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); expect(result).toEqual(9); }); it('should confirm the route volume on the descriptor has been updated by the changes made', async() => { - const result = await nightmare - .waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); + const result = await nightmare; + await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); expect(result).toEqual('0.9 / 18 m³'); }); diff --git a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js index 9701d2238..a98d2eb02 100644 --- a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js +++ b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js @@ -1,139 +1,137 @@ import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/nightmare'; +import getBrowser from '../../helpers/puppeteer'; describe('InvoiceOut descriptor path', () => { - const nightmare = createNightmare(); + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('administrative', 'ticket'); + }); + + afterAll(async() => { + await browser.close(); + }); describe('as Administrative', () => { - beforeAll(() => { - nightmare - .loginAndModule('administrative', 'ticket'); - }); - it('should search for tickets with an specific invoiceOut', async() => { - const result = await nightmare - .waitToClick(selectors.ticketsIndex.openAdvancedSearchButton) - .write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222') - .waitToClick(selectors.ticketsIndex.advancedSearchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); + await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton); + await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222'); + await page.waitToClick(selectors.ticketsIndex.advancedSearchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(1); }); it('should navigate to the invoiceOut index', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.invoiceOutButton) - .wait(selectors.invoiceOutIndex.searchInvoiceOutInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.invoiceOutButton); + await page.wait(selectors.invoiceOutIndex.searchInvoiceOutInput); + await page.waitForURL('#!/invoice-out/index'); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/invoice-out/index'); }); it('should search for the target invoiceOut', async() => { - const result = await nightmare - .write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222') - .waitToClick(selectors.invoiceOutIndex.searchButton) - .waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1) - .countElement(selectors.invoiceOutIndex.searchResult); + await page.waitForContentLoaded(); + await page.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222'); + await page.waitToClick(selectors.invoiceOutIndex.searchButton); + await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1); + const result = await page.countElement(selectors.invoiceOutIndex.searchResult); expect(result).toEqual(1); }); it(`should click on the search result to access to the invoiceOut summary`, async() => { - const url = await nightmare - .accessToSearchResult('T2222222') - .waitForURL('/summary') - .parsedUrl(); + await page.accessToSearchResult('T2222222'); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it('should delete the invoiceOut using the descriptor more menu', async() => { - const result = await nightmare - .waitToClick(selectors.invoiceOutDescriptor.moreMenu) - .waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut) - .waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu); + await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut); + await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('InvoiceOut deleted'); }); it('should have been relocated to the invoiceOut index', async() => { - const url = await nightmare - .parsedUrl(); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/invoice-out/index'); }); it(`should search for the deleted invouceOut to find no results`, async() => { - const result = await nightmare - .write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222') - .waitToClick(selectors.invoiceOutIndex.searchButton) - .waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0) - .countElement(selectors.invoiceOutIndex.searchResult); + await page.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222'); + await page.waitToClick(selectors.invoiceOutIndex.searchButton); + await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0); + const result = await page.countElement(selectors.invoiceOutIndex.searchResult); expect(result).toEqual(0); }); it('should navigate to the ticket index', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.ticketsButton); + await page.wait(selectors.ticketsIndex.searchTicketInput); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); }); it('should search for tickets with an specific invoiceOut to find no results', async() => { - const result = await nightmare - .waitToClick(selectors.ticketsIndex.openAdvancedSearchButton) - .write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222') - .waitToClick(selectors.ticketsIndex.advancedSearchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0) - .countElement(selectors.ticketsIndex.searchResult); + await page.waitFor(2000); + await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton); + await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222'); + await page.waitToClick(selectors.ticketsIndex.advancedSearchButton); + await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0); + const result = await page.countElement(selectors.ticketsIndex.searchResult); expect(result).toEqual(0); }); it('should now navigate to the invoiceOut index', async() => { - const url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.invoiceOutButton) - .wait(selectors.invoiceOutIndex.searchInvoiceOutInput) - .parsedUrl(); + await page.waitForContentLoaded(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitToClick(selectors.globalItems.invoiceOutButton); + await page.wait(selectors.invoiceOutIndex.searchInvoiceOutInput); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/invoice-out/index'); }); it(`should search and access to the invoiceOut summary`, async() => { - const url = await nightmare - .accessToSearchResult('T1111111') - .waitForURL('/summary') - .parsedUrl(); + await page.waitForContentLoaded(); + await page.accessToSearchResult('T1111111'); + await page.waitForURL('/summary'); + const url = await page.parsedUrl(); expect(url.hash).toContain('/summary'); }); it(`should check the invoiceOut is booked in the summary data`, async() => { - const result = await nightmare - .waitForTextInElement(selectors.invoiceOutSummary.bookedLabel, '/') - .waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText'); + await page.waitForTextInElement(selectors.invoiceOutSummary.bookedLabel, '/'); + const result = await page.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText'); expect(result.length).toBeGreaterThan(1); }); it('should re-book the invoiceOut using the descriptor more menu', async() => { - const result = await nightmare - .waitToClick(selectors.invoiceOutDescriptor.moreMenu) - .waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut) - .waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton) - .waitForLastSnackbar(); + await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu); + await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut); + await page.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton); + const result = await page.waitForLastSnackbar(); expect(result).toEqual('InvoiceOut booked'); }); @@ -149,7 +147,7 @@ describe('InvoiceOut descriptor path', () => { let expectedDate = `${day}/${month}/${today.getFullYear()}`; - const result = await nightmare + const result = await page .waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText'); expect(result).toEqual(expectedDate); @@ -157,26 +155,19 @@ describe('InvoiceOut descriptor path', () => { }); describe('as salesPerson', () => { - beforeAll(() => { - nightmare - .loginAndModule('salesPerson', 'invoiceOut') - .accessToSearchResult('A1111111'); + it(`should log in as salesPerson then go to the target invoiceOut summary`, async() => { + await page.loginAndModule('salesPerson', 'invoiceOut'); + await page.accessToSearchResult('A1111111'); }); it(`should check the salesPerson role doens't see the book option in the more menu`, async() => { - const result = await nightmare - .waitToClick(selectors.invoiceOutDescriptor.moreMenu) - .wait(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf) - .exists(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut); - - expect(result).toBeFalsy(); + await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu); + await page.wait(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf); + await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut, {hidden: true}); }); it(`should check the salesPerson role doens't see the delete option in the more menu`, async() => { - const result = await nightmare - .exists(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut); - - expect(result).toBeFalsy(); + await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut, {hidden: true}); }); }); }); diff --git a/e2e/smokes/01_client_path.spec.js b/e2e/smokes/01_client_path.spec.js index 2c70ae959..4ac4d331d 100644 --- a/e2e/smokes/01_client_path.spec.js +++ b/e2e/smokes/01_client_path.spec.js @@ -1,29 +1,32 @@ -import selectors from '../helpers/selectors'; -import createNightmare from '../helpers/nightmare'; +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; describe('create client path', () => { - let nightmare = createNightmare(); + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + }); - beforeAll(() => { - return nightmare - .loginAndModule('employee', 'client'); + afterAll(async() => { + await browser.close(); }); it('should access to the create client view by clicking the create-client floating button', async() => { - let url = await nightmare - .waitToClick(selectors.clientsIndex.createClientButton) - .wait(selectors.createClientView.createButton) - .parsedUrl(); + await page.waitToClick(selectors.clientsIndex.createClientButton); + await page.wait(selectors.createClientView.createButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/client/create'); }); it('should cancel the client creation to go back to clients index', async() => { - let url = await nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl(); + await page.waitToClick(selectors.globalItems.applicationsMenuButton); + await page.waitToClick(selectors.globalItems.clientsButton); + await page.wait(selectors.clientsIndex.createClientButton); + const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/client/index'); }); diff --git a/front/core/components/data-viewer/locale/es.yml b/front/core/components/data-viewer/locale/es.yml new file mode 100644 index 000000000..0368321f2 --- /dev/null +++ b/front/core/components/data-viewer/locale/es.yml @@ -0,0 +1 @@ +No service for the specified zone: No hay servicio para la zona especificada \ No newline at end of file diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js index 4106ffedd..2c794bdae 100644 --- a/front/core/components/snackbar/snackbar.js +++ b/front/core/components/snackbar/snackbar.js @@ -46,11 +46,11 @@ export default class Controller extends Component { let parent = this.snackbar.querySelectorAll('.shape')[0]; - if (parent) { + if (parent) this.snackbar.insertBefore(shape, parent); - } else { + else this.snackbar.appendChild(shape); - } + return shape; } @@ -108,11 +108,10 @@ export default class Controller extends Component { } onButtonClick(shape) { - if (this.actionHandler) { + if (this.actionHandler) this.actionHandler(); - } else { + else this.hide(shape); - } } } Controller.$inject = ['$element', '$translate']; diff --git a/front/core/components/textarea/index.js b/front/core/components/textarea/index.js index 8fcae7b0f..1954b12c6 100644 --- a/front/core/components/textarea/index.js +++ b/front/core/components/textarea/index.js @@ -16,11 +16,21 @@ export default class Textarea extends Field { get rows() { return this.input.rows; } + + set maxlength(value) { + let length = typeof value == 'number' && value > 1 ? value : 50; + this.input.setAttribute('maxlength', length); + } + + get maxlength() { + return this.input.getAttribute('maxlength', length); + } } ngModule.vnComponent('vnTextarea', { controller: Textarea, bindings: { - rows: ' { expect($ctrl.rows).toEqual(3); }); }); + + describe('maxlength() setter', () => { + it(`should set maxlength property of the element to the given value if it's a valid number`, () => { + $ctrl.maxlength = 100; + + expect($ctrl.maxlength).toEqual('100'); + }); + + it(`should set maxlength property of the element to 3 if the given value if it's null`, () => { + $ctrl.maxlength = null; + + expect($ctrl.maxlength).toEqual('50'); + }); + + it(`should set maxlength property of the element to 3 if the given value if it's not a valid number`, () => { + $ctrl.maxlength = 'a'; + + expect($ctrl.maxlength).toEqual('50'); + }); + }); }); diff --git a/front/core/directives/droppable.scss b/front/core/directives/droppable.scss index 97e6f8a19..f2e18a3ad 100644 --- a/front/core/directives/droppable.scss +++ b/front/core/directives/droppable.scss @@ -11,11 +11,9 @@ .vn-droppable, [vn-droppable] { - display: block; - &.dropping { background-color: $color-hover-cd; - border-color: $color-bg-dark; + border-color: $color-font-secondary; } } diff --git a/front/core/directives/specs/id.spec.js b/front/core/directives/specs/id.spec.js index 9d400701a..171f09556 100644 --- a/front/core/directives/specs/id.spec.js +++ b/front/core/directives/specs/id.spec.js @@ -23,13 +23,10 @@ describe('Directive vnId', () => { }).toThrow(new Error(`vnId: Attribute can't be null`)); }); - // FIXME: Sometimes fails with '$scope is undefined' - xit(`should set the controller into the $scope as there are no errors being thrown`, () => { - let html = `
`; - - expect($scope['1']).not.toBeDefined(); + it(`should set the controller into the $scope as there are no errors being thrown`, () => { + let html = `
`; compile(html); - expect($scope['1']).toBeDefined(); + expect($scope.myId).toBeDefined(); }); }); diff --git a/front/core/filters/percentage.js b/front/core/filters/percentage.js index 58e67ffa6..41e3f8288 100644 --- a/front/core/filters/percentage.js +++ b/front/core/filters/percentage.js @@ -1,15 +1,22 @@ import ngModule from '../module'; -/** - * Formats a number multiplying by 100 and adding character %. - * - * @return {String} The formated number - */ -export default function percentage() { - return function(input) { +export default function percentage($translate) { + function percentage(input, fractionSize = 2) { if (input == null || input === '') return null; - return `${input} %`; - }; + + return new Intl.NumberFormat($translate.use(), { + style: 'percent', + minimumFractionDigits: fractionSize, + maximumFractionDigits: fractionSize + }).format(parseFloat(input)); + } + + percentage.$stateful = true; + + return percentage; } + +percentage.$inject = ['$translate']; + ngModule.filter('percentage', percentage); diff --git a/front/core/mocks/crud-model.js b/front/core/mocks/crud-model.js index af6406eec..7dd32e93f 100644 --- a/front/core/mocks/crud-model.js +++ b/front/core/mocks/crud-model.js @@ -1,4 +1,5 @@ -module.exports = { +const crudModel = { + _data: [1, 2, 3], data: [], filter: {}, order: {}, @@ -31,7 +32,28 @@ module.exports = { } }; }, - refresh: () => {}, - addFilter: () => {}, - applyFilter: () => {}, + refresh: () => { + return { + then: callback => { + return callback({data: {id: 1234}}); + } + }; + }, + addFilter: () => { + return { + then: callback => { + return callback({data: {id: 1234}}); + } + }; + }, + applyFilter: () => { + crudModel.data = crudModel._data; + return { + then: callback => { + return callback({data: {id: 1234}}); + } + }; + }, }; + +module.exports = crudModel; diff --git a/front/core/styles/icons/salixfont.css b/front/core/styles/icons/salixfont.css index e3bdda503..64f2776ea 100644 --- a/front/core/styles/icons/salixfont.css +++ b/front/core/styles/icons/salixfont.css @@ -23,6 +23,18 @@ -moz-osx-font-smoothing: grayscale; } +.icon-buyrequest:before { + content: "\e914"; +} +.icon-entry:before { + content: "\e959"; +} +.icon-thermometer:before { + content: "\e95a"; +} +.icon-deletedTicket:before { + content: "\e958"; +} .icon-fruit:before { content: "\e957"; } @@ -134,9 +146,6 @@ .icon-doc:before { content: "\e913"; } -.icon-entry:before { - content: "\e914"; -} .icon-exit:before { content: "\e947"; } @@ -287,6 +296,3 @@ .icon-worker:before { content: "\e943"; } -.icon-deletedTicket:before { - content: "\e958"; -} diff --git a/front/core/styles/icons/salixfont.svg b/front/core/styles/icons/salixfont.svg index 26b1a31e9..2c13f601b 100644 --- a/front/core/styles/icons/salixfont.svg +++ b/front/core/styles/icons/salixfont.svg @@ -27,7 +27,7 @@ - + @@ -96,4 +96,6 @@ + + \ No newline at end of file diff --git a/front/core/styles/icons/salixfont.ttf b/front/core/styles/icons/salixfont.ttf index 3242d75be..7a6ad2721 100644 Binary files a/front/core/styles/icons/salixfont.ttf and b/front/core/styles/icons/salixfont.ttf differ diff --git a/front/core/styles/icons/salixfont.woff b/front/core/styles/icons/salixfont.woff index e2f312391..0e6d9a21a 100644 Binary files a/front/core/styles/icons/salixfont.woff and b/front/core/styles/icons/salixfont.woff differ diff --git a/front/module-import.js b/front/module-import.js index 21d468931..0bfe7f8ca 100755 --- a/front/module-import.js +++ b/front/module-import.js @@ -17,5 +17,6 @@ export default function moduleImport(moduleName) { case 'worker' : return import('worker/front'); case 'invoiceOut' : return import('invoiceOut/front'); case 'route' : return import('route/front'); + case 'entry' : return import('entry/front'); } } diff --git a/front/nginx.conf b/front/nginx.conf index 22bce2283..4b08f3564 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -11,4 +11,8 @@ server { location / { autoindex on; } + location /index.html { + expires -1; + add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; + } } diff --git a/front/salix/components/app/app.html b/front/salix/components/app/app.html index 5432609c2..310ce8166 100644 --- a/front/salix/components/app/app.html +++ b/front/salix/components/app/app.html @@ -6,4 +6,5 @@ ng-if="!$ctrl.showLayout"> - \ No newline at end of file + + diff --git a/front/salix/components/app/style.scss b/front/salix/components/app/style.scss index aab37c8a3..96d6a6193 100644 --- a/front/salix/components/app/style.scss +++ b/front/salix/components/app/style.scss @@ -7,7 +7,7 @@ vn-app { ui-view { display: block; box-sizing: border-box; - height: inherit; + height: 100%; &.ng-enter { animation-name: nothing, slideIn; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 9a9d903a6..1a483ab96 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -87,6 +87,7 @@ vn-layout { & > * { display: block; padding: $spacing-md; + box-sizing: border-box } &.ng-enter { vn-side-menu { diff --git a/front/salix/components/module-card/style.scss b/front/salix/components/module-card/style.scss index 0ae943efc..cc3c5b81b 100644 --- a/front/salix/components/module-card/style.scss +++ b/front/salix/components/module-card/style.scss @@ -2,4 +2,5 @@ .vn-module-card { padding: 0; + height: 100% } \ No newline at end of file diff --git a/front/salix/components/module-main/style.scss b/front/salix/components/module-main/style.scss index d9bdbd940..cab874d68 100644 --- a/front/salix/components/module-main/style.scss +++ b/front/salix/components/module-main/style.scss @@ -2,4 +2,5 @@ .vn-module-main { padding: 0; + height: 100% } \ No newline at end of file diff --git a/front/salix/locale/es.yml b/front/salix/locale/es.yml index 2f65ab255..34e1a2487 100644 --- a/front/salix/locale/es.yml +++ b/front/salix/locale/es.yml @@ -43,6 +43,7 @@ Workers: Trabajadores Routes: Rutas Locator: Localizador Invoices out: Facturas emitidas +Entries: Entradas # Common diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index 3737c508a..b0c926def 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -11,7 +11,6 @@ transition: all 0.5s; padding: $spacing-sm; position: relative; - opacity: 0.7; width: 28em; .image { @@ -20,6 +19,7 @@ 0 1px 5px 0 rgba(0,0,0,.12); background: no-repeat center center fixed; background-size: cover !important; + border: 2px solid transparent; overflow: hidden; cursor: zoom-in; height: 100%; @@ -34,7 +34,7 @@ top: 1em } } - .photo:hover { - opacity: 1 + .photo:hover .image { + border: 2px solid $color-primary } } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index dcb0aa6f1..7864290e4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -101,6 +101,7 @@ async function backTestOnce() { gulp.src(backSpecFiles) .pipe(jasmine(options)) .on('end', resolve) + .on('error', reject) .resume(); }); @@ -110,27 +111,33 @@ backTestOnce.description = `Runs the backend tests once, can receive --junit arg async function backTestDockerOnce() { let containerId = await docker(); + let err; + try { await backTestOnce(); } catch (e) { - throw e; - } finally { - if (argv['random']) - await execP(`docker rm -fv ${containerId}`); + err = e; } + + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); + if (err) throw err; } backTestDockerOnce.description = `Runs backend tests using in site container once`; async function backTestDocker() { let containerId = await docker(); + let err; + try { await backTest(); } catch (e) { - throw e; - } finally { - if (argv['random']) - await execP(`docker rm -fv ${containerId}`); + err = e; } + + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); + if (err) throw err; } backTestDocker.description = `Runs backend tests restoring fixtures first`; @@ -147,19 +154,12 @@ function backTest(done) { backTest.description = `Watches for changes in modules to execute backTest task`; // End to end tests - -function e2eOnly() { +function e2eSingleRun() { require('@babel/register')({presets: ['@babel/preset-env']}); require('@babel/polyfill'); const jasmine = require('gulp-jasmine'); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - const createNightmare = require('./e2e/helpers/nightmare'); - - if (argv.show || argv.s) - process.env.E2E_SHOW = true; - process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true; - const specFiles = [ `${__dirname}/e2e/paths/01*/*[sS]pec.js`, @@ -171,8 +171,7 @@ function e2eOnly() { `${__dirname}/e2e/paths/07*/*[sS]pec.js`, `${__dirname}/e2e/paths/08*/*[sS]pec.js`, `${__dirname}/e2e/paths/09*/*[sS]pec.js`, - `${__dirname}/e2e/paths/**/*[sS]pec.js`, - `${__dirname}/e2e/helpers/extensions.js` + `${__dirname}/e2e/paths/**/*[sS]pec.js` ]; return gulp.src(specFiles).pipe(jasmine({ @@ -188,14 +187,9 @@ function e2eOnly() { } }) ] - }) - .on('jasmineDone', function() { - const nightmare = createNightmare(); - nightmare.end(() => {}); - }) - ); + })); } -e2eOnly.description = `Runs the e2e tests only`; +e2eSingleRun.description = `Runs the e2e tests just once`; async function backendStatus() { const milliseconds = 250; @@ -223,7 +217,7 @@ e2e = gulp.series(docker, async function isBackendReady() { log(`Backend ready after ${attempts} attempt(s)`); return attempts; -}, e2eOnly); +}, e2eSingleRun); e2e.description = `Restarts database and runs the e2e tests`; function smokesOnly() { @@ -240,14 +234,15 @@ function install() { const install = require('gulp-install'); const print = require('gulp-print'); + let npmArgs = []; + if (argv.ci) npmArgs = ['--no-audit', '--prefer-offline']; + let packageFiles = ['front/package.json', 'print/package.json']; return gulp.src(packageFiles) .pipe(print(filepath => { return `Installing packages in ${filepath}`; })) - .pipe(install({ - npm: ['--no-package-lock'] - })); + .pipe(install({npm: npmArgs})); } install.description = `Installs node dependencies in all directories`; @@ -429,15 +424,22 @@ async function docker() { let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); containerId = result.stdout; - if (argv['random']) { - let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`); - let netSettings = JSON.parse(inspect.stdout); + try { + if (argv['random']) { + let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`); + let netSettings = JSON.parse(inspect.stdout); - dbConf.host = netSettings.Gateway; - dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; + dbConf.host = netSettings.Gateway; + dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; + } + + if (runChown) await dockerWait(); + } catch (err) { + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); + throw err; } - if (runChown) await dockerWait(); return containerId; } docker.description = `Builds the database image and runs a container`; @@ -555,7 +557,6 @@ module.exports = { backTest, backTestDocker, e2e, - e2eOnly, smokes, smokesOnly, i, @@ -571,5 +572,6 @@ module.exports = { docker, dockerStart, dockerWait, - backendStatus + backendStatus, + e2eSingleRun }; diff --git a/loopback/common/models/loggable.js b/loopback/common/models/loggable.js index a6d0e8474..d9116a0de 100644 --- a/loopback/common/models/loggable.js +++ b/loopback/common/models/loggable.js @@ -219,7 +219,7 @@ module.exports = function(Self) { userFk: userFk, action: action, changedModel: ctx.Model.definition.name, - changedModelId: changedModelId, + changedModelId: changedModelId, // Model property with an different data type will throw a NaN error changedModelValue: where, oldInstance: oldInstance, newInstance: newInstance diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index 0191967b1..c6f535b7a 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -155,10 +155,10 @@ module.exports = function(Self) { const result = await realMethod.call(this, data, options); if (cb) cb(null, result); + else return result; } catch (err) { let myErr = replaceErr(err, replaceErrFunc); - if (cb) - cb(myErr); + if (cb) cb(myErr); else throw myErr; } diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 91339d14e..2ea2b1a3a 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -54,8 +54,14 @@ "This ticket can not be modified": "This ticket can not be modified", "You can't delete a confirmed order": "You can't delete a confirmed order", "Value has an invalid format": "Value has an invalid format", - "The postcode doesn't exists. Ensure you put the correct format": "The postcode doesn't exists. Ensure you put the correct format", + "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one", "Can't create stowaway for this ticket": "Can't create stowaway for this ticket", "Has deleted the ticket id": "Has deleted the ticket id [#{{id}}]({{{url}}})", - "Swift / BIC can't be empty": "Swift / BIC can't be empty" + "Swift / BIC can't be empty": "Swift / BIC can't be empty", + "MESSAGE_BOUGHT_UNITS": "Bought {{quantity}} units of {{concept}} (#{{itemId}}) for the ticket id [#{{ticketId}}]({{{url}}})", + "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} (#{{clientId}})]({{{url}}}) to *{{credit}} €*", + "MESSAGE_CHANGED_PAYMETHOD": "I have changed the pay method for client [{{clientName}} (#{{clientId}})]({{{url}}})", + "MESSAGE_CLAIM_ITEM_REGULARIZE": "I sent *{{quantity}}* units of [{{concept}} (#{{itemId}})]({{{itemUrl}}}) to {{nickname}} coming from ticket id [#{{ticketId}}]({{{ticketUrl}}})", + "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", + "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 15fd89f5e..a3490b372 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -106,7 +106,7 @@ "Invalid quantity": "Cantidad invalida", "This postal code is not valid": "This postal code is not valid", "is invalid": "is invalid", - "The postcode doesn't exists. Ensure you put the correct format": "El código postal no existe. Asegúrate de ponerlo con el formato correcto", + "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto", "The department name can't be repeated": "El nombre del departamento no puede repetirse", "This phone already exists": "Este teléfono ya existe", "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos", @@ -118,5 +118,11 @@ "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fín", "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fín", "You should mark at least one week day": "Debes marcar al menos un día de la semana", - "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío" + "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío", + "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios", + "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios", + "MESSAGE_BOUGHT_UNITS": "Se ha comprado {{quantity}} unidades de {{concept}} (#{{itemId}}) para el ticket id [#{{ticketId}}]({{{url}}})", + "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} (#{{clientId}})]({{{url}}}) a *{{credit}} €*", + "MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})", + "MESSAGE_CLAIM_ITEM_REGULARIZE": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a {{nickname}} provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})" } \ No newline at end of file diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index bbd8ce0d5..0ea634484 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -14,7 +14,7 @@ "multipleStatements": true, "legacyUtcDateProcessing": false, "timezone": "local", - "connectTimeout": 20000, + "connectTimeout": 40000, "acquireTimeout": 20000 }, "storage": { diff --git a/modules/agency/back/methods/zone/getEvents.js b/modules/agency/back/methods/zone/getEvents.js index 1c70dfffd..abf3d7e19 100644 --- a/modules/agency/back/methods/zone/getEvents.js +++ b/modules/agency/back/methods/zone/getEvents.js @@ -9,7 +9,7 @@ module.exports = Self => { description: 'The province id', required: true }, { - arg: 'search', + arg: 'postCode', type: 'String', description: 'The postcode' }, { diff --git a/modules/agency/back/model-config.json b/modules/agency/back/model-config.json index cfdbb83d3..7638e3f6c 100644 --- a/modules/agency/back/model-config.json +++ b/modules/agency/back/model-config.json @@ -11,7 +11,7 @@ "Zone": { "dataSource": "vn" }, - "ZoneGeo": { + "ZoneClosure": { "dataSource": "vn" }, "ZoneEvent": { @@ -20,6 +20,9 @@ "ZoneExclusion": { "dataSource": "vn" }, + "ZoneGeo": { + "dataSource": "vn" + }, "ZoneIncluded": { "dataSource": "vn" }, diff --git a/modules/agency/back/models/zone-closure.js b/modules/agency/back/models/zone-closure.js new file mode 100644 index 000000000..8b66e31ae --- /dev/null +++ b/modules/agency/back/models/zone-closure.js @@ -0,0 +1,13 @@ +module.exports = Self => { + Self.doRecalc = async function() { + try { + await Self.rawSql(` + CREATE EVENT zoneClosure_doRecalc + ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 15 SECOND + DO CALL zoneClosure_recalc; + `); + } catch (err) { + if (err.code != 'ER_EVENT_ALREADY_EXISTS') throw err; + } + }; +}; diff --git a/modules/agency/back/models/zone-closure.json b/modules/agency/back/models/zone-closure.json new file mode 100644 index 000000000..895374838 --- /dev/null +++ b/modules/agency/back/models/zone-closure.json @@ -0,0 +1,30 @@ +{ + "name": "ZoneClosure", + "base": "VnModel", + "options": { + "mysql": { + "table": "zoneClosure" + } + }, + "properties": { + "zoneFk": { + "id": true, + "type": "Number" + }, + "dated": { + "type": "Date", + "required": true + }, + "hour": { + "type": "date", + "required": true + } + }, + "relations": { + "zone": { + "type": "belongsTo", + "model": "Zone", + "foreignKey": "zoneFk" + } + } +} \ No newline at end of file diff --git a/modules/agency/back/models/zone-event.js b/modules/agency/back/models/zone-event.js index 6af031a23..46b2df202 100644 --- a/modules/agency/back/models/zone-event.js +++ b/modules/agency/back/models/zone-event.js @@ -1,3 +1,5 @@ +const app = require('vn-loopback/server/server'); + module.exports = Self => { Self.validate('range', function(err) { if (this.type == 'range' @@ -32,4 +34,12 @@ module.exports = Self => { }, { message: `You should mark at least one week day` }); + + Self.observe('after save', async function() { + await app.models.ZoneClosure.doRecalc(); + }); + + Self.observe('after delete', async function() { + await app.models.ZoneClosure.doRecalc(); + }); }; diff --git a/modules/agency/back/models/zone-exclusion.js b/modules/agency/back/models/zone-exclusion.js new file mode 100644 index 000000000..51998aab8 --- /dev/null +++ b/modules/agency/back/models/zone-exclusion.js @@ -0,0 +1,11 @@ +const app = require('vn-loopback/server/server'); + +module.exports = Self => { + Self.observe('after save', async function() { + await app.models.ZoneClosure.doRecalc(); + }); + + Self.observe('after delete', async function() { + await app.models.ZoneClosure.doRecalc(); + }); +}; diff --git a/modules/agency/back/models/zone.js b/modules/agency/back/models/zone.js index 0c3ac24f6..9d715a8d8 100644 --- a/modules/agency/back/models/zone.js +++ b/modules/agency/back/models/zone.js @@ -1,3 +1,5 @@ +const app = require('vn-loopback/server/server'); + module.exports = Self => { require('../methods/zone/clone')(Self); require('../methods/zone/getLeaves')(Self); @@ -7,4 +9,12 @@ module.exports = Self => { Self.validatesPresenceOf('agencyModeFk', { message: `Agency cannot be blank` }); + + Self.observe('after save', async function() { + await app.models.ZoneClosure.doRecalc(); + }); + + Self.observe('after delete', async function() { + await app.models.ZoneClosure.doRecalc(); + }); }; diff --git a/modules/agency/back/models/zone.json b/modules/agency/back/models/zone.json index 853f1f4d2..e94146946 100644 --- a/modules/agency/back/models/zone.json +++ b/modules/agency/back/models/zone.json @@ -33,6 +33,9 @@ }, "inflation": { "type": "Number" + }, + "m3Max": { + "type": "Number" } }, "relations": { diff --git a/modules/agency/front/basic-data/index.html b/modules/agency/front/basic-data/index.html index ec5cc3b20..f0122c475 100644 --- a/modules/agency/front/basic-data/index.html +++ b/modules/agency/front/basic-data/index.html @@ -29,6 +29,15 @@ vn-acl="deliveryBoss" rule> + + this.$.data = res.data); + .then(res => { + let data = res.data; + this.$.data = data; + if (!data.events.length) + this.vnApp.showMessage(this.$t('No service for the specified zone')); + }); } } diff --git a/modules/agency/front/events/index.html b/modules/agency/front/events/index.html index 274d79997..693b24a85 100644 --- a/modules/agency/front/events/index.html +++ b/modules/agency/front/events/index.html @@ -160,12 +160,12 @@ response="cancel" translate-attr="{value: 'Cancel'}"> - + translate-attr="{value: 'Delete'}"> + + + \ No newline at end of file diff --git a/modules/client/front/address/create/index.js b/modules/client/front/address/create/index.js index 3cd8af614..f21ec73ff 100644 --- a/modules/client/front/address/create/index.js +++ b/modules/client/front/address/create/index.js @@ -1,17 +1,14 @@ import ngModule from '../../module'; +import Component from 'core/lib/component'; -export default class Controller { - constructor($, $state) { - this.$ = $; - this.$state = $state; - this.data = { - address: { - clientFk: parseInt($state.params.id), - isActive: true - }, +export default class Controller extends Component { + constructor($element, $) { + super($element, $); + + this.address = { + isActive: true, isDefaultAddress: false }; - this.address = this.data.address; } get postcodeSelection() { @@ -36,15 +33,27 @@ export default class Controller { onSubmit() { this.$.watcher.submit().then(res => { - if (res.data && this.data.isDefaultAddress) + if (this.address.isDefaultAddress) this.client.defaultAddressFk = res.data.id; this.$state.go('client.card.address.index'); }); } + + showCustomAgent(event) { + if (event.defaultPrevented) return; + event.preventDefault(); + + this.$.customAgent.show(); + } + + onCustomAgentAccept() { + return this.$http.post(`CustomsAgents`, this.newCustomsAgent) + .then(res => this.address.customsAgentFk = res.data.id); + } } -Controller.$inject = ['$scope', '$state']; +Controller.$inject = ['$element', '$scope']; ngModule.component('vnClientAddressCreate', { template: require('./index.html'), diff --git a/modules/client/front/address/create/index.spec.js b/modules/client/front/address/create/index.spec.js index e840ec2d8..6bd53cb72 100644 --- a/modules/client/front/address/create/index.spec.js +++ b/modules/client/front/address/create/index.spec.js @@ -3,17 +3,21 @@ import watcher from 'core/mocks/watcher'; describe('Client', () => { describe('Component vnClientAddressCreate', () => { + let $scope; let controller; - let $componentController; + let $httpBackend; + let $element; let $state; beforeEach(ngModule('client')); - beforeEach(angular.mock.inject((_$componentController_, _$state_) => { - $componentController = _$componentController_; + beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { + $scope = $rootScope.$new(); + $httpBackend = _$httpBackend_; $state = _$state_; $state.params.id = '1234'; - controller = $componentController('vnClientAddressCreate', {$state}); + $element = angular.element(''); + controller = $componentController('vnClientAddressCreate', {$element, $scope}); controller.$.watcher = watcher; controller.$.watcher.submit = () => { return { @@ -26,14 +30,13 @@ describe('Client', () => { })); it('should define and set address property', () => { - expect(controller.data.address.clientFk).toBe(1234); - expect(controller.data.address.isActive).toBe(true); + expect(controller.address.isActive).toBe(true); }); describe('onSubmit()', () => { it('should perform a PATCH and not set value to defaultAddressFk property', () => { spyOn(controller.$state, 'go'); - controller.data.isDefaultAddress = false; + controller.address.isDefaultAddress = false; controller.onSubmit(); expect(controller.client.defaultAddressFk).toEqual(121); @@ -42,7 +45,7 @@ describe('Client', () => { it('should perform a PATCH and set a value to defaultAddressFk property', () => { spyOn(controller.$state, 'go'); - controller.data.isDefaultAddress = true; + controller.address.isDefaultAddress = true; controller.onSubmit(); expect(controller.client.defaultAddressFk).toEqual(124); @@ -73,5 +76,16 @@ describe('Client', () => { expect(controller.address.provinceFk).toEqual(1); }); }); + + describe('onCustomAgentAccept()', () => { + it(`should create a new customs agent and then set the customsAgentFk property on the address`, () => { + const expectedResult = {id: 1, fiscalName: 'Customs agent one'}; + $httpBackend.when('POST', 'CustomsAgents').respond(200, expectedResult); + controller.onCustomAgentAccept(); + $httpBackend.flush(); + + expect(controller.address.customsAgentFk).toEqual(1); + }); + }); }); }); diff --git a/modules/client/front/address/create/locale/es.yml b/modules/client/front/address/create/locale/es.yml deleted file mode 100644 index 922d758d5..000000000 --- a/modules/client/front/address/create/locale/es.yml +++ /dev/null @@ -1,9 +0,0 @@ -Street address: Dirección postal -Default: Predeterminado -Consignee: Consignatario -Postcode: Código postal -Town/City: Ciudad -Province: Provincia -Agency: Agencia -Phone: Teléfono -Mobile: Móvil \ No newline at end of file diff --git a/modules/client/front/address/edit/index.html b/modules/client/front/address/edit/index.html index ed3758e33..035608120 100644 --- a/modules/client/front/address/edit/index.html +++ b/modules/client/front/address/edit/index.html @@ -6,16 +6,16 @@ @@ -99,8 +99,8 @@ ng-model="$ctrl.address.postalCode" rule> - + + +
New customs agent
+ + + + + + + + + + + + +
+ + + + +
\ No newline at end of file diff --git a/modules/client/front/address/edit/index.js b/modules/client/front/address/edit/index.js index 7c7b274a6..4e5ed7237 100644 --- a/modules/client/front/address/edit/index.js +++ b/modules/client/front/address/edit/index.js @@ -1,12 +1,7 @@ import ngModule from '../../module'; +import Component from 'core/lib/component'; -export default class Controller { - constructor($scope, $state) { - this.$ = $scope; - this.$state = $state; - this.$stateParams = $state.params; - } - +export default class Controller extends Component { removeObservation(index) { this.$.watcher.setDirty(); this.$.model.remove(index); @@ -25,17 +20,26 @@ export default class Controller { } onSubmit() { - this.$.watcher.check(); - this.$.watcher.realSubmit() + this.$.watcher.submit() .then(() => this.$.model.save(true)) .then(() => { - this.$.watcher.notifySaved(); this.card.reload(); this.goToIndex(); }); } + + showCustomAgent(event) { + if (event.defaultPrevented) return; + event.preventDefault(); + + this.$.customAgent.show(); + } + + onCustomAgentAccept() { + return this.$http.post(`CustomsAgents`, this.newCustomsAgent) + .then(res => this.address.customsAgentFk = res.data.id); + } } -Controller.$inject = ['$scope', '$state']; ngModule.component('vnClientAddressEdit', { template: require('./index.html'), diff --git a/modules/client/front/address/edit/index.spec.js b/modules/client/front/address/edit/index.spec.js index aa1f59669..3d91ad440 100644 --- a/modules/client/front/address/edit/index.spec.js +++ b/modules/client/front/address/edit/index.spec.js @@ -2,15 +2,22 @@ import './index'; describe('Client', () => { describe('Component vnClientAddressEdit', () => { - let $state; + let $scope; let controller; + let $httpBackend; + let $element; + let $state; beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$state_) => { + beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { + $scope = $rootScope.$new(); + $httpBackend = _$httpBackend_; $state = _$state_; $state.params.addressId = '1'; - controller = $componentController('vnClientAddressEdit', {$state}); + $element = angular.element(''); + controller = $componentController('vnClientAddressEdit', {$element, $scope}); + controller.address = {id: 1, customsAgentFk: null}; controller.$.watcher = { setDirty: () => {}, setPristine: () => {}, @@ -55,5 +62,16 @@ describe('Client', () => { expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index'); }); }); + + describe('onCustomAgentAccept()', () => { + it(`should create a new customs agent and then set the customsAgentFk property on the address`, () => { + const expectedResult = {id: 1, fiscalName: 'Customs agent one'}; + $httpBackend.when('POST', 'CustomsAgents').respond(200, expectedResult); + controller.onCustomAgentAccept(); + $httpBackend.flush(); + + expect(controller.address.customsAgentFk).toEqual(1); + }); + }); }); }); diff --git a/modules/client/front/address/edit/locale/es.yml b/modules/client/front/address/edit/locale/es.yml deleted file mode 100644 index f1aa52834..000000000 --- a/modules/client/front/address/edit/locale/es.yml +++ /dev/null @@ -1,7 +0,0 @@ -Enabled: Activo -Is equalizated: Recargo de equivalencia -Observation type: Tipo de observación -Description: Descripción -The observation type must be unique: El tipo de observación ha de ser único -Remove note: Quitar nota -Add note: Añadir nota \ No newline at end of file diff --git a/modules/client/front/address/index/index.js b/modules/client/front/address/index/index.js index 5ba2ad063..a7b9bc23b 100644 --- a/modules/client/front/address/index/index.js +++ b/modules/client/front/address/index/index.js @@ -2,10 +2,12 @@ import ngModule from '../../module'; import './style.scss'; class Controller { - constructor($http, $scope, $stateParams) { + constructor($http, $scope, $stateParams, $translate, vnApp) { this.$http = $http; this.$scope = $scope; this.$stateParams = $stateParams; + this.$translate = $translate; + this.vnApp = vnApp; this.filter = { fields: [ 'id', @@ -51,6 +53,7 @@ class Controller { if (res.data) { this.client.defaultAddressFk = res.data.defaultAddressFk; this.sortAddresses(); + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); } }); } @@ -69,7 +72,7 @@ class Controller { }); } } -Controller.$inject = ['$http', '$scope', '$stateParams']; +Controller.$inject = ['$http', '$scope', '$stateParams', '$translate', 'vnApp']; ngModule.component('vnClientAddressIndex', { template: require('./index.html'), diff --git a/modules/client/front/address/index/locale/es.yml b/modules/client/front/address/index/locale/es.yml deleted file mode 100644 index 5df8b3275..000000000 --- a/modules/client/front/address/index/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Set as default: Establecer como predeterminado -Active first to set as default: Active primero para marcar como predeterminado \ No newline at end of file diff --git a/modules/client/front/address/locale/es.yml b/modules/client/front/address/locale/es.yml new file mode 100644 index 000000000..dc39175d6 --- /dev/null +++ b/modules/client/front/address/locale/es.yml @@ -0,0 +1,27 @@ +# Index +Set as default: Establecer como predeterminado +Active first to set as default: Active primero para marcar como predeterminado +# Edit +Enabled: Activo +Is equalizated: Recargo de equivalencia +Observation type: Tipo de observación +Description: Descripción +The observation type must be unique: El tipo de observación ha de ser único +Remove note: Quitar nota +Add note: Añadir nota +Customs agent: Agente de aduanas +New customs agent: Nuevo agente de aduanas +# Create +Street address: Dirección postal +Default: Predeterminado +Consignee: Consignatario +Postcode: Código postal +Town/City: Ciudad +Province: Provincia +Agency: Agencia +Phone: Teléfono +Mobile: Móvil + +# Common +Fiscal name: Nombre fiscal +Street: Dirección fiscal \ No newline at end of file diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index 29f3d02e6..f42998bbd 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -1,10 +1,8 @@ + data="$ctrl.balances"> { - if (response.data) { - this.clientRisks = response.data; - - this.getBalances(); } - }); + }; } - get balances() { - return this._balances; + get companyId() { + if (!this._companyId) + this.companyId = this.vnConfig.companyFk; + + return this._companyId; } + set companyId(value) { + this._companyId = value; + + if (value) this.getData(); + } + + getData() { + return this.$.model.applyFilter(null, { + clientId: this.$stateParams.id, + companyId: this.companyId + }).then(() => this.$.riskModel.applyFilter({ + where: { + clientFk: this.$stateParams.id, + companyFk: this.companyId + } + })).then(() => this.getBalances()); + } + + getCurrentBalance() { - const selectedCompany = this.$.company.selection; - const currentBalance = this.clientRisks.find(balance => { - return balance.companyFk === selectedCompany.id; + const clientRisks = this.$.riskModel.data; + const selectedCompany = this.companyId; + const currentBalance = clientRisks.find(balance => { + return balance.companyFk === selectedCompany; }); return currentBalance.amount; } getBalances() { - this.balances.forEach((balance, index) => { + const balances = this.$.model.data; + balances.forEach((balance, index) => { if (index === 0) balance.balance = this.getCurrentBalance(); if (index > 0) { - let previousBalance = this.balances[index - 1]; - + let previousBalance = balances[index - 1]; balance.balance = previousBalance.balance - (previousBalance.debit - previousBalance.credit); } }); @@ -92,10 +70,8 @@ class Controller { openCreateDialog() { - this.$.balanceCreateDialog.companyFk = this.companyFk; - this.$.balanceCreateDialog.onResponse = () => { - this.refresh(); - }; + this.$.balanceCreateDialog.companyFk = this.companyId; + this.$.balanceCreateDialog.onResponse = () => this.getData(); this.$.balanceCreateDialog.show(); } diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js index 6de7bb3cb..8551d12f5 100644 --- a/modules/client/front/balance/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -3,41 +3,98 @@ import './index'; describe('Client', () => { describe('Component vnClientBalanceIndex', () => { let $componentController; - let $scope; - let $httpBackend; - let $httpParamSerializer; let controller; beforeEach(ngModule('client')); - beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(angular.mock.inject((_$componentController_, $rootScope) => { $componentController = _$componentController_; - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - $scope = $rootScope.$new(); + let $scope = $rootScope.$new(); controller = $componentController('vnClientBalanceIndex', {$scope}); + controller.$.model = {applyFilter: () => {}}; + controller.$.riskModel = { + applyFilter: () => {}, + data: + [{ + clientFk: 101, + companyFk: 442, + amount: 713.24, + company: { + id: 442, + code: 'VNL' + } + }] + }; })); - describe('balances() setter', () => { - it('should calculate the balance for each line from the oldest date to the newest', () => { - controller.getCurrentBalance = jasmine.createSpy(controller, 'getCurrentBalance').and.returnValue(1000); - let balances = [ - {credit: -100, debit: 0}, - {credit: 0, debit: 300}, - {credit: 100, debit: 0}, - {credit: 0, debit: -300} - ]; - const params = {filter: controller.filter}; - let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `ClientRisks?${serializedParams}`).respond(balances); - $httpBackend.expect('GET', `ClientRisks?${serializedParams}`); - controller.balances = balances; - $httpBackend.flush(); + describe('getData()', () => { + it('should apply the filters on he models and get the client balance', () => { + controller._companyId = 442; + controller.$stateParams.id = 101; + spyOn(controller, 'getBalances'); + spyOn(controller.$.model, 'applyFilter').and.returnValue(Promise.resolve()); + spyOn(controller.$.riskModel, 'applyFilter').and.returnValue(Promise.resolve()); - expect(controller.balances[0].balance).toEqual(1000); - expect(controller.balances[1].balance).toEqual(900); - expect(controller.balances[2].balance).toEqual(600); - expect(controller.balances[3].balance).toEqual(700); + controller.getData().then(() => { + expect(controller.$.model.applyFilter).toHaveBeenCalledWith(null, {'clientId': 101, 'companyId': 442}); + expect(controller.$.riskModel.applyFilter).toHaveBeenCalledWith({'where': {'clientFk': 101, 'companyFk': 442}}); + expect(controller.getBalances).toHaveBeenCalledWith(); + }); + }); + }); + + describe('company setter/getter', () => { + it('should return the company', () => { + controller.companyId = null; + + expect(controller._companyId).toEqual(jasmine.any(Object)); + }); + + it('should return the company and then call getData()', () => { + spyOn(controller, 'getData'); + controller.companyId = 442; + + expect(controller._companyId).toEqual(442); + expect(controller.getData).toHaveBeenCalledWith(); + }); + }); + + describe('getCurrentBalance()', () => { + it('should return the client balance amount', () => { + controller._companyId = 442; + let result = controller.getCurrentBalance(); + + expect(result).toEqual(713.24); + }); + }); + + describe('getBalances()', () => { + it('should return the total client balance amount', () => { + spyOn(controller, 'getCurrentBalance').and.callThrough(); + controller._companyId = 442; + controller.$.model = {data: + [{ + id: 1, + debit: 1000, + credit: null + }, + { + id: 2, + debit: null, + credit: 500 + }, + { + id: 3, + debit: null, + credit: 300 + } + ]}; + controller.getBalances(); + const expectedBalances = controller.$.model.data; + + expect(expectedBalances[0].balance).toEqual(713.24); + expect(expectedBalances[1].balance).toEqual(-286.76); + expect(expectedBalances[2].balance).toEqual(213.24); }); }); }); diff --git a/modules/client/front/basic-data/index.html b/modules/client/front/basic-data/index.html index fbf883d98..8c00f7a18 100644 --- a/modules/client/front/basic-data/index.html +++ b/modules/client/front/basic-data/index.html @@ -31,6 +31,20 @@ info="You can save multiple emails">
+ + + + + + - + url="ClientContacts" + fields="['id', 'name', 'phone', 'clientFk']" + link="{clientFk: $ctrl.$stateParams.id}" + data="contacts" + auto-load="true"> + data="contacts" + form="form">
- - - + + + + ng-model="contact.phone" + rule="ClientContact" + vn-focus> + tabindex="-1" + ng-click="model.remove($index)"> @@ -51,4 +48,4 @@ - + \ No newline at end of file diff --git a/modules/client/front/contact/index.js b/modules/client/front/contact/index.js new file mode 100644 index 000000000..4b0cc95ca --- /dev/null +++ b/modules/client/front/contact/index.js @@ -0,0 +1,35 @@ +import ngModule from '../module'; + +class Controller { + constructor($scope, $stateParams, $translate) { + this.$scope = $scope; + this.$stateParams = $stateParams; + this.$translate = $translate; + } + + add() { + this.$scope.model.insert({ + clientFk: this.client.id, + name: this.$translate.instant('Phone'), + phone: null + }); + } + + onSubmit() { + this.$scope.watcher.check(); + this.$scope.model.save().then(() => { + this.$scope.watcher.notifySaved(); + this.$scope.model.refresh(); + }); + } +} + +Controller.$inject = ['$scope', '$stateParams', '$translate']; + +ngModule.component('vnClientContact', { + template: require('./index.html'), + controller: Controller, + bindings: { + client: '<' + } +}); diff --git a/modules/client/front/index.js b/modules/client/front/index.js index 514319ee2..324046206 100644 --- a/modules/client/front/index.js +++ b/modules/client/front/index.js @@ -30,7 +30,7 @@ import './credit-insurance/index'; import './credit-insurance/create'; import './credit-insurance/insurance/index'; import './credit-insurance/insurance/create'; -import './phones'; +import './contact'; import './sample/index'; import './sample/create'; import './web-payment'; diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index 184f18727..f3c3fb728 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -25,6 +25,10 @@ label="Id" value="{{::client.id}}"> + + diff --git a/modules/client/front/phones/index.js b/modules/client/front/phones/index.js deleted file mode 100644 index 9839d27d7..000000000 --- a/modules/client/front/phones/index.js +++ /dev/null @@ -1,44 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - get client() { - return this._client; - } - - set client(value) { - this._client = value; - if (value) - this.setLink(value); - } - - setLink(value) { - this.$.$applyAsync(()=> { - this.$.model.link = {userFk: value.id}; - this.$.model.refresh(); - }); - } - - onSubmit() { - this.$.watcher.check(); - return this.$.model.save().then(() => { - this.$.watcher.updateOriginalData(); - this.$.watcher.notifySaved(); - this.card.reload(); - }); - } - - add() { - this.$.model.insert(); - } -} - - -ngModule.component('vnClientPhones', { - template: require('./index.html'), - controller: Controller, - require: {card: '^vnClientCard'}, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/phones/index.spec.js b/modules/client/front/phones/index.spec.js deleted file mode 100644 index 3d0befd68..000000000 --- a/modules/client/front/phones/index.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Component vnClientPhones', () => { - let controller; - let $element; - let $scope; - - beforeEach(ngModule('client')); - - beforeEach(angular.mock.inject(($componentController, $rootScope) => { - $scope = $rootScope.$new(); - $element = angular.element('
'); - $scope.watcher = watcher; - $scope.model = { - link: 1, - save: () => {} - }; - controller = $componentController('vnClientPhones', {$element, $scope}); - controller.card = {reload: () => {}}; - })); - - describe('setLink()', () => { - it('set the link in the model and refreshes it', () => { - spyOn(controller.$, '$applyAsync'); - let value = {id: 106}; - controller.setLink(value); - - expect(controller.$.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); - }); - }); - - describe('onSubmit()', () => { - it('should call watcher functions, reload the card and save the model', done => { - spyOn(controller.$.watcher, 'check'); - spyOn(controller.$.model, 'save').and.returnValue(Promise.resolve()); - - spyOn(controller.$.watcher, 'updateOriginalData'); - spyOn(controller.$.watcher, 'notifySaved'); - spyOn(controller.card, 'reload'); - controller.onSubmit(); - controller.onSubmit().then(() => { - expect(controller.$.watcher.updateOriginalData).toHaveBeenCalledWith(); - expect(controller.$.watcher.notifySaved).toHaveBeenCalledWith(); - expect(controller.card.reload).toHaveBeenCalledWith(); - done(); - }).catch(done.fail); - }); - }); -}); diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 6d96bd284..ef0d8cc7a 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -26,7 +26,7 @@ {"state": "client.card.webAccess", "icon": "cloud"}, {"state": "client.card.mandate", "icon": "pan_tool"}, {"state": "client.card.creditInsurance.index", "icon": "icon-solunion"}, - {"state": "client.card.phones", "icon": "contact_phone"}, + {"state": "client.card.contact", "icon": "contact_phone"}, {"state": "client.card.sample.index", "icon": "mail"}, {"state": "client.card.webPayment", "icon": "icon-onlinepayment"}, {"state": "client.card.dms.index", "icon": "cloud_upload"} @@ -282,10 +282,10 @@ "client": "$ctrl.client" } }, { - "url": "/phones", - "state": "client.card.phones", - "component": "vn-client-phones", - "description": "Client phones", + "url": "/contact", + "state": "client.card.contact", + "component": "vn-client-contact", + "description": "Contacts", "params": { "client": "$ctrl.client" } diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index 501558512..ac7a20651 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -2,22 +2,31 @@ vn-id="SMSDialog" on-response="$ctrl.onResponse($response)"> -
Send SMS
- - - - - - - - +
+
Send SMS
+ + + + + + + + + + + {{'Characters remaining' | translate}}: {{$ctrl.charactersRemaining()}} + + +
diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js index 580a02d27..1bf2fb99c 100644 --- a/modules/client/front/sms/index.js +++ b/modules/client/front/sms/index.js @@ -16,9 +16,19 @@ class Controller extends Component { this.$scope.SMSDialog.show(); } + charactersRemaining() { + let elementMaxLength; + let textAreaLength; + const element = this.$scope.message; + + textAreaLength = element.input.textLength; + elementMaxLength = element.maxlength; + return elementMaxLength - textAreaLength; + } + onResponse(response) { if (response === 'accept') { - this.$http.post(`Sms/send`, this.sms).then(res => { + this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { this.vnApp.showMessage(this.$translate.instant('SMS sent!')); if (res.data) this.emit('send', {response: res.data}); diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js index bda1cc013..c2a7eb935 100644 --- a/modules/client/front/sms/index.spec.js +++ b/modules/client/front/sms/index.spec.js @@ -8,11 +8,13 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; + let $scope = $rootScope.$new(); $element = angular.element(''); - controller = $componentController('vnClientSms', {$element}); + controller = $componentController('vnClientSms', {$element, $scope}); controller.client = {id: 101}; + controller.$params = {id: 101}; })); describe('onResponse()', () => { @@ -21,8 +23,7 @@ describe('Client', () => { controller.sms = {destinationFk: 101, destination: 111111111, message: 'My SMS'}; spyOn(controller.vnApp, 'showMessage'); - $httpBackend.when('POST', `Sms/send`, params).respond(200, params); - $httpBackend.expect('POST', `Sms/send`, params).respond(params); + $httpBackend.expect('POST', `Clients/101/sendSms`, params).respond(200, params); controller.onResponse('accept'); $httpBackend.flush(); @@ -30,5 +31,20 @@ describe('Client', () => { expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); }); }); + + describe('charactersRemaining()', () => { + it('should return the characters remaining in a element', () => { + controller.$scope.message = { + input: { + textLength: 50 + }, + maxlength: 150 + }; + + let result = controller.charactersRemaining(); + + expect(result).toEqual(100); + }); + }); }); }); diff --git a/modules/client/front/sms/locale/es.yml b/modules/client/front/sms/locale/es.yml index 10247b926..f26c8ba24 100644 --- a/modules/client/front/sms/locale/es.yml +++ b/modules/client/front/sms/locale/es.yml @@ -1,4 +1,5 @@ Send SMS: Enviar SMS Destination: Destinatario Message: Mensaje -SMS sent!: ¡SMS enviado! \ No newline at end of file +SMS sent!: ¡SMS enviado! +Characters remaining: Carácteres restantes \ No newline at end of file diff --git a/modules/client/front/sms/style.scss b/modules/client/front/sms/style.scss index 60a625880..89723b196 100644 --- a/modules/client/front/sms/style.scss +++ b/modules/client/front/sms/style.scss @@ -1,7 +1,5 @@ @import "variables"; -vn-client-sms { - textarea { - height: 8em - } +.SMSDialog { + min-width: 25em } \ No newline at end of file diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index 7016a19ff..eccf45873 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -12,9 +12,11 @@ - + + + diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js index f8eb7b2ef..d7329bf8c 100644 --- a/modules/client/front/web-access/index.spec.js +++ b/modules/client/front/web-access/index.spec.js @@ -29,13 +29,24 @@ describe('Component VnClientWebAccess', () => { }); describe('isCustomer()', () => { - it(`should perform a query if client is defined with an ID`, () => { + it('should return true if the password can be modified', () => { controller.client = {id: '1234'}; - controller.isCustomer(); - $httpBackend.when('GET', `Clients/${controller.client.id}/hasCustomerRole`).respond('ok'); - $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`); + $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond({isCustomer: true}); + controller.isCustomer(); $httpBackend.flush(); + + expect(controller.canChangePassword).toBeTruthy(); + }); + + it(`should return a false if the password can't be modified`, () => { + controller.client = {id: '1234'}; + + $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond({isCustomer: false}); + controller.isCustomer(); + $httpBackend.flush(); + + expect(controller.canChangePassword).toBeFalsy(); }); }); diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js new file mode 100644 index 000000000..8cbe5e15e --- /dev/null +++ b/modules/entry/back/methods/entry/filter.js @@ -0,0 +1,149 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; + +module.exports = Self => { + Self.remoteMethodCtx('filter', { + description: 'Find all instances of the model matched by filter from the data source.', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'Object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + }, { + arg: 'search', + type: 'String', + description: 'Searchs the entry by id', + http: {source: 'query'} + }, { + arg: 'id', + type: 'Integer', + description: 'The entry id', + http: {source: 'query'} + }, { + arg: 'created', + type: 'Date', + description: 'The created date to filter', + http: {source: 'query'} + }, { + arg: 'travelFk', + type: 'Number', + description: 'The travel id to filter', + http: {source: 'query'} + }, { + arg: 'companyFk', + type: 'Number', + description: 'The company to filter', + http: {source: 'query'} + }, { + arg: 'isBooked', + type: 'Boolean', + description: 'The isBokked filter', + http: {source: 'query'} + }, { + arg: 'isConfirmed', + type: 'Boolean', + description: 'The isConfirmed filter', + http: {source: 'query'} + }, { + arg: 'isOrdered', + type: 'Boolean', + description: 'The isOrdered filter', + http: {source: 'query'} + }, { + arg: 'ref', + type: 'String', + description: 'The ref filter', + http: {source: 'query'} + }, { + arg: 'supplierFk', + type: 'Number', + description: 'The supplier id to filter', + http: {source: 'query'} + }, { + arg: 'currencyFk', + type: 'Number', + description: 'The currency id to filter', + http: {source: 'query'} + } + ], + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/filter`, + verb: 'GET' + } + }); + + Self.filter = async(ctx, filter) => { + let conn = Self.dataSource.connector; + let where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'search': + return {'e.id': value}; + case 'ref': + param = `e.${param}`; + return {[param]: {like: `%${value}%`}}; + case 'created': + return {'e.created': {gte: value}}; + case 'id': + case 'isBooked': + case 'isConfirmed': + case 'isOrdered': + case 'companyFk': + case 'travelFk': + case 'currencyFk': + case 'supplierFk': + param = `e.${param}`; + return {[param]: value}; + } + }); + filter = mergeFilters(ctx.args.filter, {where}); + + let stmts = []; + let stmt; + stmt = new ParameterizedSQL( + `SELECT + e.id, + e.supplierFk, + e.dated, + e.ref, + e.isBooked, + e.isInventory, + e.notes, + e.isConfirmed, + e.isOrdered, + e.isRaid, + e.commission, + e.created, + e.evaNotes, + e.travelFk, + e.currencyFk, + e.companyFk, + e.gestDocFk, + e.invoiceInFk, + s.name AS supplierName, + co.code AS companyCode, + cu.code AS currencyCode + FROM vn.entry e + JOIN vn.supplier s ON s.id = e.supplierFk + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.company co ON co.id = e.companyFk + JOIN vn.currency cu ON cu.id = e.currencyFk` + ); + + + stmt.merge(conn.makeSuffix(filter)); + let itemsIndex = stmts.push(stmt) - 1; + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + return itemsIndex === 0 ? result : result[itemsIndex]; + }; +}; + diff --git a/modules/entry/back/methods/entry/specs/filter.spec.js b/modules/entry/back/methods/entry/specs/filter.spec.js new file mode 100644 index 000000000..9b935d831 --- /dev/null +++ b/modules/entry/back/methods/entry/specs/filter.spec.js @@ -0,0 +1,77 @@ +const app = require('vn-loopback/server/server'); + +describe('Entry filter()', () => { + it('should return the entry matching "search"', async() => { + let ctx = { + args: { + search: 1 + } + }; + + let result = await app.models.Entry.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].id).toEqual(1); + }); + + it('should return the entry matching the currency', async() => { + let ctx = { + args: { + currencyFk: 1 + } + }; + + let result = await app.models.Entry.filter(ctx); + + expect(result.length).toEqual(7); + }); + + it('should return the entry matching the supplier', async() => { + let ctx = { + args: { + supplierFk: 2 + } + }; + + let result = await app.models.Entry.filter(ctx); + + expect(result.length).toEqual(5); + }); + + it('should return the entry matching the company', async() => { + let ctx = { + args: { + companyFk: 442 + } + }; + + let result = await app.models.Entry.filter(ctx); + + expect(result.length).toEqual(6); + }); + + it('should return the entries matching isBooked', async() => { + let ctx = { + args: { + isBooked: true, + } + }; + + let result = await app.models.Entry.filter(ctx); + + expect(result.length).toEqual(0); + }); + + it('should return the routes matching the reference and travel', async() => { + let ctx = { + args: { + reference: 'movement', + travelFk: '2' + } + }; + + let result = await app.models.Entry.filter(ctx); + + expect(result.length).toEqual(2); + }); +}); diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json new file mode 100644 index 000000000..cd763c4ea --- /dev/null +++ b/modules/entry/back/model-config.json @@ -0,0 +1,5 @@ +{ + "Entry": { + "dataSource": "vn" + } +} diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js new file mode 100644 index 000000000..4034b7e0a --- /dev/null +++ b/modules/entry/back/models/entry.js @@ -0,0 +1,4 @@ + +module.exports = Self => { + require('../methods/entry/filter')(Self); +}; diff --git a/modules/travel/back/models/entry.json b/modules/entry/back/models/entry.json similarity index 100% rename from modules/travel/back/models/entry.json rename to modules/entry/back/models/entry.json diff --git a/modules/entry/front/card/index.html b/modules/entry/front/card/index.html new file mode 100644 index 000000000..d386a9ebf --- /dev/null +++ b/modules/entry/front/card/index.html @@ -0,0 +1,5 @@ + + + + + diff --git a/modules/entry/front/card/index.js b/modules/entry/front/card/index.js new file mode 100644 index 000000000..62fed7db0 --- /dev/null +++ b/modules/entry/front/card/index.js @@ -0,0 +1,33 @@ +import ngModule from '../module'; +import ModuleCard from 'salix/components/module-card'; + +class Controller extends ModuleCard { + reload() { + let filter = { + include: [ + { + relation: 'company', + scope: { + fields: ['id', 'code'] + } + }, { + relation: 'travel' + }, { + relation: 'supplier', + scope: { + fields: ['id', 'name'] + } + }, { + relation: 'currency' + } + ] + }; + this.$http.get(`Entries/${this.$params.id}`, {filter}) + .then(response => this.entry = response.data); + } +} + +ngModule.component('vnEntry Card', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/entry/front/descriptor/index.html b/modules/entry/front/descriptor/index.html new file mode 100644 index 000000000..372479c79 --- /dev/null +++ b/modules/entry/front/descriptor/index.html @@ -0,0 +1,21 @@ +
+
+ + + + + + + +
+
+
+ + + + +
+
+
diff --git a/modules/entry/front/descriptor/index.js b/modules/entry/front/descriptor/index.js new file mode 100644 index 000000000..a9f5cd679 --- /dev/null +++ b/modules/entry/front/descriptor/index.js @@ -0,0 +1,20 @@ +import ngModule from '../module'; + +class Controller { + constructor($scope) { + this.$ = $scope; + } +} + +Controller.$inject = ['$scope']; + +ngModule.component('vnEntryDescriptor', { + template: require('./index.html'), + bindings: { + entry: '<' + }, + require: { + card: '^?vnEntryCard' + }, + controller: Controller +}); diff --git a/modules/entry/front/descriptor/locale/es.yml b/modules/entry/front/descriptor/locale/es.yml new file mode 100644 index 000000000..e5b926f1d --- /dev/null +++ b/modules/entry/front/descriptor/locale/es.yml @@ -0,0 +1 @@ +Reference: Referencia diff --git a/modules/entry/front/index.js b/modules/entry/front/index.js new file mode 100644 index 000000000..a0272fccf --- /dev/null +++ b/modules/entry/front/index.js @@ -0,0 +1,11 @@ +export * from './module'; + +import './main'; +import './index/'; +import './search-panel'; +import './descriptor'; +import './card'; +// import './summary'; +// import './basic-data'; +// import './log'; +// import './create'; diff --git a/modules/entry/front/index/index.html b/modules/entry/front/index/index.html new file mode 100644 index 000000000..8ddd4d3a3 --- /dev/null +++ b/modules/entry/front/index/index.html @@ -0,0 +1,63 @@ + + + + + + + + + + Id + Created + Travel + Notes + Reference + Booked + Is inventory + Confirmed + Ordered + Is raid + Commission + Supplier + Currency + Company + + + + + {{::entry.id}} + {{::entry.created | date:'dd/MM/yyyy'}} + {{::entry.travelFk}} + {{::entry.notes}} + {{::entry.ref}} + + + + + + {{::entry.commission}} + {{::entry.supplierName}} + {{::entry.currencyCode}} + {{::entry.companyCode}} + + + + +
+ + + + + \ No newline at end of file diff --git a/modules/entry/front/index/index.js b/modules/entry/front/index/index.js new file mode 100644 index 000000000..ec78c06df --- /dev/null +++ b/modules/entry/front/index/index.js @@ -0,0 +1,21 @@ +import ngModule from '../module'; + +export default class Controller { + constructor($scope) { + this.$ = $scope; + } + + onSearch(params) { + if (params) + this.$.model.applyFilter(null, params); + else + this.$.model.clear(); + } +} + +Controller.$inject = ['$scope']; + +ngModule.component('vnEntryIndex', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/entry/front/locale/es.yml b/modules/entry/front/locale/es.yml new file mode 100644 index 000000000..214be93d4 --- /dev/null +++ b/modules/entry/front/locale/es.yml @@ -0,0 +1,15 @@ +#Ordenar alfabeticamente +Reference: Referencia +Created: Creado +Booked: Facturado +Is inventory: Inventario +Notes: Notas +Travel: Envío +Supplier: Proveedor +Currency: Moneda +Company: Empresa +Confirmed: Confirmada +Ordered: Pedida +Is raid: Redada +Commission: Comisión +# Sections diff --git a/modules/entry/front/main/index.html b/modules/entry/front/main/index.html new file mode 100644 index 000000000..44b1b2b4e --- /dev/null +++ b/modules/entry/front/main/index.html @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/modules/entry/front/main/index.js b/modules/entry/front/main/index.js new file mode 100644 index 000000000..75f1d098a --- /dev/null +++ b/modules/entry/front/main/index.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import ModuleMain from 'salix/components/module-main'; + +export default class Entry extends ModuleMain {} + +ngModule.vnComponent('vnEntry', { + controller: Entry, + template: require('./index.html') +}); diff --git a/modules/entry/front/module.js b/modules/entry/front/module.js new file mode 100644 index 000000000..7a2d9943b --- /dev/null +++ b/modules/entry/front/module.js @@ -0,0 +1,3 @@ +import {ng} from 'core/vendor'; + +export default ng.module('entry', ['vnCore']); diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json new file mode 100644 index 000000000..f23ff02bf --- /dev/null +++ b/modules/entry/front/routes.json @@ -0,0 +1,32 @@ +{ + "module": "entry", + "name": "Entries", + "icon": "icon-entry", + "validations": true, + "menus": { + "main": [ + {"state": "entry.index", "icon": "icon-entry"} + ], + "card": [ + ] + }, + "routes": [ + { + "url": "/entry", + "state": "entry", + "abstract": true, + "component": "vn-entry", + "description": "Entries" + }, { + "url": "/index?q", + "state": "entry.index", + "component": "vn-entry-index", + "description": "Entries" + }, { + "url": "/:id", + "state": "entry.card", + "abstract": true, + "component": "vn-entry-card" + } + ] +} \ No newline at end of file diff --git a/modules/entry/front/search-panel/index.html b/modules/entry/front/search-panel/index.html new file mode 100644 index 000000000..d648edcdd --- /dev/null +++ b/modules/entry/front/search-panel/index.html @@ -0,0 +1,78 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/modules/entry/front/search-panel/index.js b/modules/entry/front/search-panel/index.js new file mode 100644 index 000000000..d728fe5e8 --- /dev/null +++ b/modules/entry/front/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import SearchPanel from 'core/components/searchbar/search-panel'; + +ngModule.component('vnEntrySearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/modules/entry/front/search-panel/locale/es.yml b/modules/entry/front/search-panel/locale/es.yml new file mode 100644 index 000000000..1f892a742 --- /dev/null +++ b/modules/entry/front/search-panel/locale/es.yml @@ -0,0 +1,7 @@ +Ticket id: Id ticket +Client id: Id cliente +Nickname: Alias +From: Desde +To: Hasta +Agency: Agencia +Warehouse: Almacén \ No newline at end of file diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js index fece307de..85821773c 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js @@ -1,7 +1,7 @@ const app = require('vn-loopback/server/server'); describe('invoiceOut book()', () => { - const invoiceOutId = 1; + const invoiceOutId = 5; let bookedDate; let OriginalInvoiceOut; let updatedInvoiceOut; diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 100f27c1f..a69f6ed8b 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -53,7 +53,7 @@ class Controller { } showInvoiceOutPdf() { - let url = `InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`; + let url = `api/InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`; window.open(url, '_blank'); } diff --git a/modules/invoiceOut/front/index/index.js b/modules/invoiceOut/front/index/index.js index c75b2bebe..dd8219fae 100644 --- a/modules/invoiceOut/front/index/index.js +++ b/modules/invoiceOut/front/index/index.js @@ -27,7 +27,7 @@ export default class Controller { } openPdf(id, event) { - let url = `InvoiceOuts/${id}/download?access_token=${this.accessToken}`; + let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`; window.open(url, '_blank'); event.preventDefault(); event.stopImmediatePropagation(); diff --git a/modules/item/back/methods/item/getWasteDetail.js b/modules/item/back/methods/item/getWasteDetail.js new file mode 100644 index 000000000..906269044 --- /dev/null +++ b/modules/item/back/methods/item/getWasteDetail.js @@ -0,0 +1,41 @@ +module.exports = Self => { + Self.remoteMethod('getWasteDetail', { + description: 'Returns the ', + accessType: 'READ', + accepts: [], + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/getWasteDetail`, + verb: 'GET' + } + }); + + Self.getWasteDetail = async() => { + const [wastes] = await Self.rawSql(`CALL bs.weekWaste_getDetail()`); + + const details = []; + + for (let waste of wastes) { + const buyerName = waste.buyer; + + let buyerDetail = details.find(waste => { + return waste.buyer == buyerName; + }); + + if (!buyerDetail) { + buyerDetail = { + buyer: buyerName, + lines: [] + }; + details.push(buyerDetail); + } + + buyerDetail.lines.push(waste); + } + + return details; + }; +}; diff --git a/modules/item/back/methods/item/specs/getWasteDetail.spec.js b/modules/item/back/methods/item/specs/getWasteDetail.spec.js new file mode 100644 index 000000000..6ed202178 --- /dev/null +++ b/modules/item/back/methods/item/specs/getWasteDetail.spec.js @@ -0,0 +1,23 @@ +const app = require('vn-loopback/server/server'); + +xdescribe('item getWasteDetail()', () => { + it('should check for the waste breakdown for every worker', async() => { + let result = await app.models.Item.getWasteDetail(); + + const firstBuyer = result[0].buyer; + const firstBuyerLines = result[0].lines; + const secondBuyer = result[1].buyer; + const secondBuyerLines = result[1].lines; + const thirdBuyer = result[2].buyer; + const thirdBuyerLines = result[2].lines; + + expect(result.length).toEqual(3); + expect(firstBuyer).toEqual('CharlesXavier'); + expect(firstBuyerLines.length).toEqual(4); + expect(secondBuyer).toEqual('DavidCharlesHaller'); + expect(secondBuyerLines.length).toEqual(3); + + expect(thirdBuyer).toEqual('HankPym'); + expect(thirdBuyerLines.length).toEqual(3); + }); +}); diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index 628bd5a03..6c221e94d 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -11,6 +11,7 @@ module.exports = Self => { require('../methods/item/regularize')(Self); require('../methods/item/getVisibleAvailable')(Self); require('../methods/item/new')(Self); + require('../methods/item/getWasteDetail')(Self); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 2ee454c0d..81f8299b0 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -81,8 +81,6 @@ + + + +
+ +
{{detail.buyer}}
+
+ + + + Family + Percentage + Dwindle + Total + + + + + {{::waste.family}} + {{::(waste.percentage / 100) | percentage: 2}} + {{::waste.dwindle | currency: 'EUR'}} + {{::waste.total | currency: 'EUR'}} + + + +
+
+
diff --git a/modules/item/front/waste/index.js b/modules/item/front/waste/index.js new file mode 100644 index 000000000..9344c2222 --- /dev/null +++ b/modules/item/front/waste/index.js @@ -0,0 +1,8 @@ +import ngModule from '../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +ngModule.component('vnItemWaste', { + template: require('./index.html'), + controller: Component +}); diff --git a/modules/item/front/waste/locale/es.yml b/modules/item/front/waste/locale/es.yml new file mode 100644 index 000000000..9f08e3a72 --- /dev/null +++ b/modules/item/front/waste/locale/es.yml @@ -0,0 +1,3 @@ +Family: Familia +Percentage: Porcentaje +Dwindle: Mermas \ No newline at end of file diff --git a/modules/item/front/waste/style.scss b/modules/item/front/waste/style.scss new file mode 100644 index 000000000..59e9a3b68 --- /dev/null +++ b/modules/item/front/waste/style.scss @@ -0,0 +1,25 @@ +@import "variables"; + +vn-item-waste { + .header { + margin-bottom: 16px; + text-transform: uppercase; + font-size: 15pt; + line-height: 1; + padding: 7px; + padding-bottom: 7px; + padding-bottom: 4px; + font-weight: lighter; + background-color: #fde6ca; + border-bottom: 0.1em solid #f7931e; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + vn-table vn-th.waste-family, + vn-table vn-td.waste-family { + max-width: 4em; + width: 4em + } +} \ No newline at end of file diff --git a/modules/order/back/methods/order/specs/new.spec.js b/modules/order/back/methods/order/specs/new.spec.js index 1cd3e8ce8..84e33b779 100644 --- a/modules/order/back/methods/order/specs/new.spec.js +++ b/modules/order/back/methods/order/specs/new.spec.js @@ -24,7 +24,7 @@ describe('order new()', () => { expect(error).toEqual(new UserError(`You can't create an order for a inactive client`)); }); - it('should create a new order a user when all conditions are met', async() => { + it('should now create a new order when all conditions are met', async() => { let landed = new Date(); let addressFk = 121; let agencyModeFk = 1; diff --git a/modules/order/front/catalog-view/index.html b/modules/order/front/catalog-view/index.html new file mode 100644 index 000000000..7a588a464 --- /dev/null +++ b/modules/order/front/catalog-view/index.html @@ -0,0 +1,61 @@ + + +
+ +
+ +
+
+

+ {{::item.name}} +

+

+ {{::item.subName}} +

+
+ + + + + + +
+ +
+
+
+
+
+ + diff --git a/modules/order/front/catalog-view/index.js b/modules/order/front/catalog-view/index.js new file mode 100644 index 000000000..fe1f1c712 --- /dev/null +++ b/modules/order/front/catalog-view/index.js @@ -0,0 +1,24 @@ +import ngModule from '../module'; +import Component from 'core/lib/component'; +import './style.scss'; + + +class Controller extends Component { + preview(event, item) { + event.preventDefault(); + this.$.pricesPopover.show(event, item); + } + + onDescriptorLoad() { + this.$.popover.relocate(); + } +} + +ngModule.component('vnOrderCatalogView', { + template: require('./index.html'), + controller: Controller, + bindings: { + order: '<', + model: '<' + } +}); diff --git a/modules/order/front/catalog/locale/es.yml b/modules/order/front/catalog-view/locale/es.yml similarity index 100% rename from modules/order/front/catalog/locale/es.yml rename to modules/order/front/catalog-view/locale/es.yml diff --git a/modules/order/front/catalog-view/style.scss b/modules/order/front/catalog-view/style.scss new file mode 100644 index 000000000..18dc51bb0 --- /dev/null +++ b/modules/order/front/catalog-view/style.scss @@ -0,0 +1,31 @@ +@import "variables"; + +vn-order-catalog { + .catalog-header { + border-bottom: $border-thin; + padding: $spacing-md; + align-items: center; + + & > vn-one { + display: flex; + flex: 1; + + span { + color: $color-font-secondary + } + } + & > vn-auto { + width: 28em; + display: flex; + overflow: hidden; + + & > * { + padding-left: $spacing-md; + } + } + } + .catalog-list { + padding-top: $spacing-sm; + } +} + diff --git a/modules/order/front/catalog/index.html b/modules/order/front/catalog/index.html index 8002c2b10..86b209e59 100644 --- a/modules/order/front/catalog/index.html +++ b/modules/order/front/catalog/index.html @@ -1,72 +1,140 @@ + + + + data="$ctrl.items"> - - -
- -
- -
-
-

- {{::item.name}} -

-

- {{::item.subName}} -

-
- - - - - - -
- -
-
-
-
-
- - - - - + + + + + + + + + + + + + +
{{name}}
+
+ {{categoryName}} +
+
+
+
+ + + + + +
+ More than {{model.limit}} results +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + {{category.selection.name}} + + + {{type.selection.name}} + + + {{::tag.value}} + +
+
\ No newline at end of file diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index adb66171e..a53d62089 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -2,10 +2,15 @@ import ngModule from '../module'; import './style.scss'; class Controller { - constructor($scope, $state) { - this.$scope = $scope; + constructor($http, $scope, $state, $compile, $transitions) { + this.$http = $http; + this.$ = $scope; this.$state = $state; this.$stateParams = $state.params; + this.$compile = $compile; + this.$transitions = $transitions; + this.itemTypes = []; + this.tags = []; // Static autocomplete data this.orderWays = [ @@ -20,19 +25,52 @@ class Controller { ]; this.orderFields = [].concat(this.defaultOrderFields); this._orderWay = this.orderWays[0].way; - this._orderField = this.orderFields[0].field; + this.orderField = this.orderFields[0].field; + } + + $onChanges() { + if (this.order && this.order.isConfirmed) + this.$state.go('order.card.line'); } /** * Fills order autocomplete with tags * obtained from last filtered */ - onDataChange() { - const items = this.$scope.model.data; - const newFilterList = []; - if (!items) return; + get order() { + return this._order; + } - items.forEach(item => { + /** + * Sets filter values from state params + * + * @param {Object} value - Order data + */ + set order(value) { + this._order = value; + + if (!value) return; + + this.$.$applyAsync(() => { + if (this.$stateParams.categoryId) + this.categoryId = this.$stateParams.categoryId; + + if (this.$stateParams.typeId) + this.typeId = this.$stateParams.typeId; + }); + } + + get items() { + return this._items; + } + + set items(value) { + this._items = value; + + if (!value) return; + + const newFilterList = []; + value.forEach(item => { // Add new tag filters item.tags.forEach(itemTag => { const alreadyAdded = newFilterList.findIndex(filter => { @@ -64,6 +102,40 @@ class Controller { this.orderFields = newFilterList; } + get categoryId() { + return this._categoryId; + } + + set categoryId(value) { + if (!value || (this.categoryId == value)) + value = null; + + this._categoryId = value; + this.itemTypes = []; + this.typeId = null; + + this.updateStateParams(); + + if (this.tags.length > 0) + this.applyFilters(); + + if (value) + this.updateItemTypes(); + } + + get typeId() { + return this._typeId; + } + + set typeId(value) { + this._typeId = value; + + this.updateStateParams(); + + if (value || this.tags.length > 0) + this.applyFilters(); + } + /** * Get order way ASC/DESC */ @@ -77,58 +149,136 @@ class Controller { } /** - * Get order fields + * Returns the order way selection */ - get orderField() { - return this._orderField; + get orderSelection() { + return this._orderSelection; } - set orderField(value) { - this._orderField = value; + set orderSelection(value) { + this._orderSelection = value; + if (value) this.applyOrder(); } + /** + * Apply order to model + */ + applyOrder() { + if (this.typeId || this.tags.length > 0) + this.$.model.addFilter(null, {orderBy: this.getOrderBy()}); + } + /** * Returns order param * * @return {Object} - Order param */ getOrderBy() { + const isTag = !!(this.orderSelection && this.orderSelection.isTag); return { field: this.orderField, way: this.orderWay, - isTag: !!(this.orderSelection && this.orderSelection.isTag) + isTag: isTag }; } /** - * Apply order to model + * Refreshes item type dropdown data */ - applyOrder() { - this.$scope.model.addFilter(null, {orderBy: this.getOrderBy()}); + updateItemTypes() { + let params = { + itemCategoryId: this.categoryId + }; + + const query = `Orders/${this.order.id}/getItemTypeAvailable`; + this.$http.get(query, {params}).then(res => + this.itemTypes = res.data); } - preview(event, item) { + onSearchById(event) { + const hasValue = this.tags.length > 0 || this.itemId || this.typeId; + if (event.key === 'Enter' && hasValue) + this.applyFilters(); + } + + onSearchByTag(event) { + if (event.key !== 'Enter' || !this.value) return; + this.tags.push({ + value: this.value, + }); + this.$.search.value = null; + this.applyFilters(); + } + + remove(index) { + this.tags.splice(index, 1); + + if (this.tags.length >= 0 || this.itemId || this.typeId) + this.applyFilters(); + } + + applyFilters() { + let newParams = {}; + let newFilter = {}; + const model = this.$.model; + + if (this.categoryId) + newFilter.categoryFk = this.categoryId; + + if (this.typeId) + newFilter.typeFk = this.typeId; + + if (this.itemId) + newFilter = {'i.id': this.itemId}; + + newParams = { + orderFk: this.order.id, + orderBy: this.getOrderBy(), + tags: this.tags, + }; + + model.applyFilter({where: newFilter}, newParams); + } + + openPanel(event) { + if (event.defaultPrevented) return; event.preventDefault(); - this.$scope.pricesPopover.show(event, item); + + this.panelFilter = {}; + this.$.popover.show(this.$.search.element); } - onDescriptorLoad() { - this.$scope.popover.relocate(); + onPanelSubmit(filter) { + this.$.popover.hide(); + this.tags.push(filter); + this.applyFilters(); } - $onChanges() { - if (this.order && this.order.isConfirmed) - this.$state.go('order.card.line'); + /** + * Updates url state params from filter values + */ + updateStateParams() { + const params = {}; + + if (this.categoryId) + params.categoryId = this.categoryId; + else params.categoryId = undefined; + + if (this.typeId) + params.typeId = this.typeId; + else params.typeId = undefined; + + this.$state.go(this.$state.current.name, params); } } -Controller.$inject = ['$scope', '$state']; +Controller.$inject = ['$http', '$scope', '$state', '$compile', '$transitions']; ngModule.component('vnOrderCatalog', { template: require('./index.html'), controller: Controller, bindings: { - order: '<', + order: '<' } }); diff --git a/modules/order/front/catalog/index.spec.js b/modules/order/front/catalog/index.spec.js index b6e70bb4a..9f778ee41 100644 --- a/modules/order/front/catalog/index.spec.js +++ b/modules/order/front/catalog/index.spec.js @@ -4,26 +4,44 @@ import crudModel from 'core/mocks/crud-model'; describe('Order', () => { describe('Component vnOrderCatalog', () => { let $scope; + let $state; let controller; + let $httpBackend; beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { + $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.model = crudModel; - $scope.field = {}; - controller = $componentController('vnOrderCatalog', {$scope: $scope}); + $scope.search = {}; + $state = _$state_; + $state.params.categoryId = 1; + $state.params.typeId = 2; + $state.current.name = 'my.current.state'; + controller = $componentController('vnOrderCatalog', {$scope, $state}); })); - describe('onDataChange()', () => { + describe('order() setter', () => { + it(`should call scope $applyAsync() method and apply filters from state params`, () => { + $httpBackend.expect('GET', `Orders/4/getItemTypeAvailable?itemCategoryId=1`).respond(); + controller.order = {id: 4}; + + $scope.$apply(); + + expect(controller.categoryId).toEqual(1); + expect(controller.typeId).toEqual(2); + }); + }); + + describe('items() setter', () => { it(`should return an object with order params`, () => { - $scope.model.data = [{id: 1, name: 'My Item', tags: [ + let expectedResult = [{field: 'showOrder, price', name: 'Color'}]; + let unexpectedResult = [{tagFk: 5, name: 'Color'}]; + controller.items = [{id: 1, name: 'My Item', tags: [ {tagFk: 4, name: 'Length'}, {tagFk: 5, name: 'Color'} ]}]; - let expectedResult = [{field: 'showOrder, price', name: 'Color'}]; - let unexpectedResult = [{tagFk: 5, name: 'Color'}]; - controller.onDataChange(); expect(controller.orderFields.length).toEqual(5); expect(controller.orderFields).toEqual(jasmine.arrayContaining(expectedResult)); @@ -31,6 +49,134 @@ describe('Order', () => { }); }); + describe('categoryId() setter', () => { + it(`should set category property to null, call updateStateParams() method and not call applyFilters()`, () => { + spyOn(controller, 'updateStateParams'); + controller.categoryId = null; + + expect(controller.updateStateParams).toHaveBeenCalledWith(); + }); + + it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { + spyOn(controller, 'updateStateParams'); + controller._order = {id: 4}; + controller.categoryId = 2; + + expect(controller.updateStateParams).toHaveBeenCalledWith(); + }); + }); + + describe('typeId() setter', () => { + it(`should set type property to null, call updateStateParams() method and not call applyFilters()`, () => { + spyOn(controller, 'updateStateParams'); + spyOn(controller, 'applyFilters'); + controller.typeId = null; + + expect(controller.updateStateParams).toHaveBeenCalledWith(); + expect(controller.applyFilters).not.toHaveBeenCalledWith(); + }); + + it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { + spyOn(controller, 'updateStateParams'); + spyOn(controller, 'applyFilters'); + controller.typeId = 2; + + expect(controller.updateStateParams).toHaveBeenCalledWith(); + expect(controller.applyFilters).toHaveBeenCalledWith(); + }); + }); + + describe('onSearchByTag()', () => { + it(`should not add a new tag if the event key code doesn't equals to 'Enter'`, () => { + spyOn(controller, 'applyFilters'); + controller.order = {id: 4}; + controller.value = 'Color'; + controller.onSearchByTag({key: 'Tab'}); + + expect(controller.applyFilters).not.toHaveBeenCalledWith(); + }); + + it(`should add a new tag if the event key code equals to 'Enter' an then call applyFilters()`, () => { + spyOn(controller, 'applyFilters'); + controller.order = {id: 4}; + controller.value = 'Color'; + + controller.onSearchByTag({key: 'Enter'}); + + expect(controller.applyFilters).toHaveBeenCalledWith(); + }); + }); + + describe('onSearchById()', () => { + it(`should not filter by id if the event key code doesn't equals to 'Enter'`, () => { + spyOn(controller, 'applyFilters'); + controller.itemId = 1; + controller.onSearchById({key: 'Tab'}); + + expect(controller.applyFilters).not.toHaveBeenCalledWith(); + }); + + it(`should filter by id if the event key code equals to 'Enter' an then call applyFilters()`, () => { + spyOn(controller, 'applyFilters'); + controller.itemId = 1; + + controller.onSearchById({key: 'Enter'}); + + expect(controller.applyFilters).toHaveBeenCalledWith(); + }); + }); + + describe('applyFilters()', () => { + it(`should call model applyFilter() method with a new filter`, () => { + let model = controller.$.model; + spyOn(model, 'applyFilter'); + controller._categoryId = 2; + controller._typeId = 4; + controller._order = {id: 4}; + + controller.applyFilters(); + + expect(model.applyFilter).toHaveBeenCalledWith( + {where: {categoryFk: 2, typeFk: 4}}, + {orderFk: 4, orderBy: controller.getOrderBy(), tags: []}); + }); + }); + + describe('remove()', () => { + it(`should remove a tag from tags property`, () => { + spyOn(controller, 'applyFilters'); + controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}]; + controller.remove(0); + + expect(controller.tags.length).toEqual(1); + expect(controller.tags[0].tagFk).toEqual(2); + expect(controller.applyFilters).toHaveBeenCalledWith(); + }); + + it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => { + spyOn(controller, 'applyFilters'); + controller._categoryId = 1; + controller._typeId = 1; + controller.tags = [{tagFk: 1, value: 'Blue'}]; + controller.remove(0); + + expect(controller.tags.length).toEqual(0); + expect(controller.applyFilters).toHaveBeenCalledWith(); + }); + }); + + describe('updateStateParams()', () => { + it(`should call state go() method passing category and type state params`, () => { + spyOn(controller.$state, 'go'); + controller._categoryId = 2; + controller._typeId = 4; + let result = {categoryId: 2, typeId: 4}; + controller.updateStateParams(); + + expect(controller.$state.go).toHaveBeenCalledWith('my.current.state', result); + }); + }); + describe('getOrderBy()', () => { it(`should return an object with order params`, () => { controller.orderField = 'relevancy DESC, name'; @@ -50,13 +196,15 @@ describe('Order', () => { it(`should apply order param to model calling getOrderBy()`, () => { controller.field = 'relevancy DESC, name'; controller.way = 'ASC'; + controller._categoryId = 1; + controller._typeId = 1; let expectedOrder = {orderBy: controller.getOrderBy()}; spyOn(controller, 'getOrderBy').and.callThrough(); - spyOn(controller.$scope.model, 'addFilter'); + spyOn(controller.$.model, 'addFilter'); controller.applyOrder(); expect(controller.getOrderBy).toHaveBeenCalledWith(); - expect(controller.$scope.model.addFilter).toHaveBeenCalledWith(null, expectedOrder); + expect(controller.$.model.addFilter).toHaveBeenCalledWith(null, expectedOrder); }); }); }); diff --git a/modules/order/front/catalog/style.scss b/modules/order/front/catalog/style.scss index 18dc51bb0..308acb6b2 100644 --- a/modules/order/front/catalog/style.scss +++ b/modules/order/front/catalog/style.scss @@ -1,31 +1,54 @@ @import "variables"; -vn-order-catalog { - .catalog-header { +vn-order-catalog vn-side-menu div { + & > .input { + padding-left: $spacing-md; + padding-right: $spacing-md; + border-color: $color-spacer; border-bottom: $border-thin; - padding: $spacing-md; - align-items: center; + } + .item-category { + padding: $spacing-sm; + justify-content: flex-start; + align-items: flex-start; + flex-wrap: wrap; + + vn-autocomplete[vn-id="category"] { + display: none + } & > vn-one { - display: flex; - flex: 1; + padding: $spacing-sm; + min-width: 33.33%; + text-align: center; + box-sizing: border-box; - span { - color: $color-font-secondary - } - } - & > vn-auto { - width: 28em; - display: flex; - overflow: hidden; - - & > * { - padding-left: $spacing-md; + & > vn-icon { + padding: $spacing-sm; + background-color: $color-font-secondary; + border-radius: 50%; + cursor: pointer; + + &.active { + background-color: $color-main; + color: #FFF + } + & > i:before { + font-size: 32pt; + width: 1em; + height: 1em; + } } } } - .catalog-list { - padding-top: $spacing-sm; + .chips { + display: flex; + flex-wrap: wrap; + padding: $spacing-md; + overflow: hidden; + max-width: 100%; } -} - + vn-autocomplete[vn-id="type"] .list { + max-height: 20em + } +} \ No newline at end of file diff --git a/modules/order/front/filter/index.html b/modules/order/front/filter/index.html deleted file mode 100644 index 2b92b5f4a..000000000 --- a/modules/order/front/filter/index.html +++ /dev/null @@ -1,133 +0,0 @@ - - -
- - - - - - - - - -
{{name}}
-
- {{categoryName}} -
-
- - - -
-
- - - - - -
- More than {{model.limit}} results -
-
- - - - - - - - - - - - - - - - - - - - -
- - {{$ctrl.category.value}} - - - {{$ctrl.type.value}} - - - {{::tag.value}} - -
-
\ No newline at end of file diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js deleted file mode 100644 index 03dd0fa33..000000000 --- a/modules/order/front/filter/index.js +++ /dev/null @@ -1,190 +0,0 @@ -import ngModule from '../module'; -import './style.scss'; - -class Controller { - constructor($element, $http, $scope, $state, $compile, $transitions) { - this.$element = $element; - this.$http = $http; - this.$ = $scope; - this.$state = $state; - this.$stateParams = $state.params; - this.$compile = $compile; - this.$transitions = $transitions; - this.itemTypes = []; - this.tags = []; - } - - get order() { - return this._order; - } - - /** - * Sets filter values from state params - * - * @param {Object} value - Order data - */ - set order(value) { - if (!value || !value.id || this._order) return; - this._order = value; - - this.$.$applyAsync(() => { - let category; - let type; - - if (this.$stateParams.category) - category = JSON.parse(this.$stateParams.category); - - if (this.$stateParams.type) - type = JSON.parse(this.$stateParams.type); - - if (category && category.id) - this.category = category; - - if (type && type.id) - this.type = type; - }); - } - - get category() { - return this._category; - } - - set category(value) { - this.catalog.$scope.model.data = []; - this.itemTypes = []; - this.type = null; - - if (!value || (this.category && this.category.id == value.id)) - this._category = null; - else - this._category = value; - - this.updateStateParams(); - - if (this.tags.length > 0) - this.applyFilters(); - - if (this._category) - this.updateItemTypes(); - } - - get type() { - return this._type; - } - - set type(value) { - if (value && this.type && this.type.id == value.id) return; - - this._type = value; - - if (!value || !value.id) - this._type = null; - - this.updateStateParams(); - - if ((value && value.id) || this.tags.length > 0) - this.applyFilters(); - } - - /** - * Refreshes item type dropdown data - */ - updateItemTypes() { - let params = { - itemCategoryId: this.category.id - }; - - const query = `Orders/${this.order.id}/getItemTypeAvailable`; - this.$http.get(query, {params}).then(res => { - this.itemTypes = res.data; - }); - } - - onSearchById(event) { - if (event.key === 'Enter' && (this.tags.length > 0 || this.itemFk || this.type)) - this.applyFilters(); - } - - onSearchByTag(event) { - if (event.key !== 'Enter' || !this.value) return; - this.tags.push({ - value: this.value, - }); - this.$.search.value = null; - this.applyFilters(); - } - - remove(index) { - this.tags.splice(index, 1); - - if (this.tags.length >= 0 || this.itemFk || this.type) - this.applyFilters(); - } - - applyFilters() { - let newParams = {}; - let newFilter = {}; - const model = this.catalog.$scope.model; - - if (this.category) - newFilter.categoryFk = this.category.id; - - if (this.type) - newFilter.typeFk = this.type.id; - - if (this.itemFk) - newFilter = {'i.id': this.itemFk}; - - newParams = { - orderFk: this.order.id, - orderBy: this.catalog.getOrderBy(), - tags: this.tags, - }; - - model.applyFilter({where: newFilter}, newParams); - } - - openPanel(event) { - if (event.defaultPrevented) return; - event.preventDefault(); - - this.panelFilter = {}; - this.$.popover.show(this.$.search.element); - } - - onPanelSubmit(filter) { - this.$.popover.hide(); - this.tags.push(filter); - this.applyFilters(); - } - - /** - * Updates url state params from filter values - */ - updateStateParams() { - const params = {}; - - if (this.category) - params.category = JSON.stringify(this.category); - - if (this.type) - params.type = JSON.stringify(this.type); - else - params.type = undefined; - - this.$state.go(this.$state.current.name, params); - } -} - -Controller.$inject = ['$element', '$http', '$scope', '$state', '$compile', '$transitions']; - -ngModule.component('vnCatalogFilter', { - template: require('./index.html'), - controller: Controller, - require: { - catalog: '^vnOrderCatalog' - }, - bindings: { - order: '<' - } -}); diff --git a/modules/order/front/filter/index.spec.js b/modules/order/front/filter/index.spec.js deleted file mode 100644 index 8fb4baeca..000000000 --- a/modules/order/front/filter/index.spec.js +++ /dev/null @@ -1,172 +0,0 @@ -import './index.js'; -import crudModel from 'core/mocks/crud-model'; - -describe('Order', () => { - describe('Component vnCatalogFilter', () => { - let $scope; - let $state; - let controller; - let $httpBackend; - - beforeEach(ngModule('order')); - - beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - $scope.model = crudModel; - $scope.search = {}; - $state = _$state_; - $state.params.category = '{"id": 1, "value": "My Category"}'; - $state.params.type = '{"id": 1, "value": "My type"}'; - $state.current.name = 'my.current.state'; - controller = $componentController('vnCatalogFilter', {$element: null, $scope, $state}); - controller.catalog = { - $scope: $scope, - getOrderBy: () => { - return {field: 'relevancy DESC, name', way: 'DESC'}; - } - }; - })); - - describe('order() setter', () => { - it(`should call scope $applyAsync() method and apply filters from state params`, () => { - $httpBackend.expect('GET', `Orders/4/getItemTypeAvailable?itemCategoryId=1`).respond(); - controller.order = {id: 4}; - - $scope.$apply(); - - expect(controller.category).toEqual({id: 1, value: 'My Category'}); - expect(controller.type).toEqual({id: 1, value: 'My type'}); - }); - }); - - describe('category() setter', () => { - it(`should set category property to null, call updateStateParams() method and not call applyFilters()`, () => { - spyOn(controller, 'updateStateParams'); - controller.category = null; - - expect(controller.updateStateParams).toHaveBeenCalledWith(); - }); - - it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { - spyOn(controller, 'updateStateParams'); - controller._order = {id: 4}; - controller.category = {id: 2, value: 'My category'}; - - expect(controller.updateStateParams).toHaveBeenCalledWith(); - }); - }); - - describe('type() setter', () => { - it(`should set type property to null, call updateStateParams() method and not call applyFilters()`, () => { - spyOn(controller, 'updateStateParams'); - spyOn(controller, 'applyFilters'); - controller.type = null; - - expect(controller.updateStateParams).toHaveBeenCalledWith(); - expect(controller.applyFilters).not.toHaveBeenCalledWith(); - }); - - it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { - spyOn(controller, 'updateStateParams'); - spyOn(controller, 'applyFilters'); - controller.type = {id: 2, value: 'My type'}; - - expect(controller.updateStateParams).toHaveBeenCalledWith(); - expect(controller.applyFilters).toHaveBeenCalledWith(); - }); - }); - - describe('onSearchByTag()', () => { - it(`should not add a new tag if the event key code doesn't equals to 'Enter'`, () => { - spyOn(controller, 'applyFilters'); - controller.order = {id: 4}; - controller.value = 'Color'; - controller.onSearchByTag({key: 'Tab'}); - - expect(controller.applyFilters).not.toHaveBeenCalledWith(); - }); - - it(`should add a new tag if the event key code equals to 'Enter' an then call applyFilters()`, () => { - spyOn(controller, 'applyFilters'); - controller.order = {id: 4}; - controller.value = 'Color'; - - controller.onSearchByTag({key: 'Enter'}); - - expect(controller.applyFilters).toHaveBeenCalledWith(); - }); - }); - - describe('onSearchById()', () => { - it(`should not filter by id if the event key code doesn't equals to 'Enter'`, () => { - spyOn(controller, 'applyFilters'); - controller.itemFk = 1; - controller.onSearchById({key: 'Tab'}); - - expect(controller.applyFilters).not.toHaveBeenCalledWith(); - }); - - it(`should filter by id if the event key code equals to 'Enter' an then call applyFilters()`, () => { - spyOn(controller, 'applyFilters'); - controller.itemFk = 1; - - controller.onSearchById({key: 'Enter'}); - - expect(controller.applyFilters).toHaveBeenCalledWith(); - }); - }); - - describe('applyFilters()', () => { - it(`should call model applyFilter() method with a new filter`, () => { - let model = controller.catalog.$scope.model; - spyOn(model, 'applyFilter'); - controller._category = {id: 1, value: 'My Category'}; - controller._type = {id: 1, value: 'My type'}; - controller._order = {id: 4}; - - controller.applyFilters(); - - expect(model.applyFilter).toHaveBeenCalledWith( - {where: {categoryFk: 1, typeFk: 1}}, - {orderFk: 4, orderBy: controller.catalog.getOrderBy(), tags: []}); - }); - }); - - describe('remove()', () => { - it(`should remove a tag from tags property`, () => { - spyOn(controller, 'applyFilters'); - controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}]; - controller.remove(0); - - expect(controller.tags.length).toEqual(1); - expect(controller.tags[0].tagFk).toEqual(2); - expect(controller.applyFilters).toHaveBeenCalledWith(); - }); - - it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => { - spyOn(controller, 'applyFilters'); - controller._category = {id: 1, value: 'My Category'}; - controller._type = {id: 1, value: 'My type'}; - controller.tags = [{tagFk: 1, value: 'Blue'}]; - controller.remove(0); - - expect(controller.tags.length).toEqual(0); - expect(controller.applyFilters).toHaveBeenCalledWith(); - }); - }); - - describe('updateStateParams()', () => { - it(`should call state go() method passing category and type state params`, () => { - spyOn(controller.$state, 'go'); - controller._category = {id: 1, value: 'My Category'}; - controller._type = {id: 1, value: 'My type'}; - let result = {category: '{"id":1,"value":"My Category"}', type: '{"id":1,"value":"My type"}'}; - controller.updateStateParams(); - - expect(controller.$state.go).toHaveBeenCalledWith('my.current.state', result); - }); - }); - }); -}); - diff --git a/modules/order/front/filter/style.scss b/modules/order/front/filter/style.scss deleted file mode 100644 index 0cac5765f..000000000 --- a/modules/order/front/filter/style.scss +++ /dev/null @@ -1,51 +0,0 @@ -@import "variables"; -@import "variables"; - -vn-catalog-filter > div { - & > .input { - padding-left: $spacing-md; - padding-right: $spacing-md; - border-color: $color-spacer; - border-bottom: $border-thin; - } - .item-category { - padding: $spacing-sm; - justify-content: flex-start; - align-items: flex-start; - flex-wrap: wrap; - - & > vn-one { - padding: $spacing-sm; - min-width: 33.33%; - text-align: center; - box-sizing: border-box; - - & > vn-icon { - padding: $spacing-sm; - background-color: $color-font-secondary; - border-radius: 50%; - cursor: pointer; - - &.active { - background-color: $color-main; - color: #FFF - } - & > i:before { - font-size: 32pt; - width: 1em; - height: 1em; - } - } - } - } - .chips { - display: flex; - flex-wrap: wrap; - padding: $spacing-md; - overflow: hidden; - max-width: 100%; - } - vn-autocomplete[vn-id="type"] .list { - max-height: 20em - } -} \ No newline at end of file diff --git a/modules/order/front/index.js b/modules/order/front/index.js index 0d8d0d686..4d5b5615e 100644 --- a/modules/order/front/index.js +++ b/modules/order/front/index.js @@ -6,9 +6,9 @@ import './card'; import './descriptor'; import './search-panel'; import './catalog-search-panel'; -import './filter'; -import './summary'; +import './catalog-view'; import './catalog'; +import './summary'; import './line'; import './prices-popover'; import './volume'; diff --git a/modules/order/front/routes.json b/modules/order/front/routes.json index 86eda488f..789870fd1 100644 --- a/modules/order/front/routes.json +++ b/modules/order/front/routes.json @@ -41,7 +41,7 @@ "order": "$ctrl.order" } }, { - "url": "/catalog?category&type", + "url": "/catalog?categoryId&typeId", "state": "order.card.catalog", "component": "vn-order-catalog", "description": "Catalog", diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index dcdfd37d7..4f05680ed 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -8,7 +8,7 @@
- + +
{{name}} - {{nickname}}
+
{ if (!isEditable) throw new UserError(`The sales of this ticket can't be modified`); - return Self.rawSql('CALL vn.ticketCalculateSale(?)', [id]); + return Self.rawSql('CALL vn.sale_calculateComponent(?, null)', [id]); }; }; diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js index 72c41737a..938efa7e5 100644 --- a/modules/ticket/back/methods/ticket-request/confirm.js +++ b/modules/ticket/back/methods/ticket-request/confirm.js @@ -32,8 +32,9 @@ module.exports = Self => { Self.confirm = async ctx => { const models = Self.app.models; + const tx = await Self.beginTransaction({}); + const $t = ctx.req.__; // $translate let sale; - let tx = await Self.beginTransaction({}); try { let options = {transaction: tx}; @@ -59,7 +60,7 @@ module.exports = Self => { if (request.saleFk) { sale = await models.Sale.findById(request.saleFk, null, options); - sale.updateAttributes({ + await sale.updateAttributes({ itemFk: ctx.args.itemFk, quantity: ctx.args.quantity, concept: item.name, @@ -71,7 +72,7 @@ module.exports = Self => { quantity: ctx.args.quantity, concept: item.name }, options); - request.updateAttributes({ + await request.updateAttributes({ saleFk: sale.id, itemFk: sale.itemFk, isOk: true @@ -81,13 +82,16 @@ module.exports = Self => { query = `CALL vn.ticketCalculateSale(?)`; await Self.rawSql(query, [sale.id], options); - const message = `Se ha comprado ${sale.quantity} unidades de "${sale.concept}" (#${sale.itemFk}) ` - + `para el ticket #${sale.ticketFk}`; - - await models.Message.send(ctx, { - recipientFk: request.requesterFk, - message: message - }, options); + const origin = ctx.req.headers.origin; + const requesterId = request.requesterFk; + const message = $t('MESSAGE_BOUGHT_UNITS', { + quantity: sale.quantity, + concept: sale.concept, + itemId: sale.itemFk, + ticketId: sale.ticketFk, + url: `${origin}/#!/ticket/${sale.ticketFk}/summary` + }); + await models.Chat.sendCheckingPresence(ctx, requesterId, message); await tx.commit(); diff --git a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js index 2383fe560..6cce70b9c 100644 --- a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js +++ b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js @@ -4,6 +4,15 @@ describe('ticket-request confirm()', () => { let originalRequest; let originalSale; let createdSaleId; + let ctx = { + req: { + accessToken: {userId: 9}, + headers: {origin: 'http://localhost'} + } + }; + ctx.req.__ = value => { + return value; + }; afterAll(async done => { await originalRequest.updateAttributes(originalRequest); @@ -13,9 +22,9 @@ describe('ticket-request confirm()', () => { }); it(`should throw an error if the item doesn't exist`, async() => { - let ctx = {req: {accessToken: {userId: 9}}, args: {itemFk: 999}}; - let error; + ctx.args = {itemFk: 999}; + let error; try { await app.models.TicketRequest.confirm(ctx); } catch (err) { @@ -30,11 +39,12 @@ describe('ticket-request confirm()', () => { const itemId = 4; const quantity = 99999; - let ctx = {req: {accessToken: {userId: 9}}, args: { + ctx.args = { itemFk: itemId, id: requestId, quantity: quantity - }}; + }; + let error; try { @@ -52,18 +62,17 @@ describe('ticket-request confirm()', () => { const itemId = 1; const quantity = 10; + ctx.args = { + itemFk: itemId, + id: requestId, + quantity: quantity + }; + originalRequest = await app.models.TicketRequest.findById(requestId); originalSale = await app.models.Sale.findById(saleId); const request = await app.models.TicketRequest.findById(requestId); await request.updateAttributes({saleFk: saleId}); - - let ctx = {req: {accessToken: {userId: 9}}, args: { - itemFk: itemId, - id: requestId, - quantity: quantity - }}; - await app.models.TicketRequest.confirm(ctx); let updatedSale = await app.models.Sale.findById(saleId); @@ -77,16 +86,14 @@ describe('ticket-request confirm()', () => { const itemId = 1; const quantity = 10; - const request = await app.models.TicketRequest.findById(requestId); - await request.updateAttributes({saleFk: null}); - - let ctx = {req: {accessToken: {userId: 9}}, args: { + ctx.args = { itemFk: itemId, id: requestId, - quantity: quantity, - ticketFk: 1 - }}; + quantity: quantity + }; + const request = await app.models.TicketRequest.findById(requestId); + await request.updateAttributes({saleFk: null}); await app.models.TicketRequest.confirm(ctx); let updatedRequest = await app.models.TicketRequest.findById(requestId); diff --git a/modules/ticket/back/methods/ticket/sendSms.js b/modules/ticket/back/methods/ticket/sendSms.js new file mode 100644 index 000000000..efcaf4eda --- /dev/null +++ b/modules/ticket/back/methods/ticket/sendSms.js @@ -0,0 +1,57 @@ + +module.exports = Self => { + Self.remoteMethodCtx('sendSms', { + description: 'Log the message in ticketLog and call the send method', + accessType: 'WRITE', + accepts: [{ + arg: 'id', + type: 'Number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'destination', + type: 'String', + required: true, + }, + { + arg: 'message', + type: 'String', + required: true, + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/:id/sendSms`, + verb: 'POST' + } + }); + + Self.sendSms = async(ctx, id, destination, message) => { + const userId = ctx.req.accessToken.userId; + + let sms = await Self.app.models.Sms.send(ctx, id, destination, message); + let logRecord = { + originFk: id, + userFk: userId, + action: 'insert', + changedModel: 'sms', + newInstance: { + destinationFk: id, + destination: destination, + message: message, + statusCode: sms.statusCode, + status: sms.status + } + }; + + const ticketLog = await Self.app.models.TicketLog.create(logRecord); + + sms.logId = ticketLog.id; + + return sms; + }; +}; diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index fb72c7dbc..6daad7c39 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -94,7 +94,7 @@ module.exports = Self => { id: id, url: `${origin}/#!/ticket/${id}/summary` }); - await models.Chat.sendMessage(ctx, `@${salesPersonUser}`, message); + await models.Chat.send(ctx, `@${salesPersonUser}`, message); } return ticket.updateAttribute('isDeleted', true); diff --git a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js new file mode 100644 index 000000000..20066a5ba --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js @@ -0,0 +1,27 @@ +const app = require('vn-loopback/server/server'); + +describe('ticket sendSms()', () => { + let logId; + + afterAll(async done => { + await app.models.TicketLog.destroyById(logId); + + done(); + }); + + it('should send a message and log it', async() => { + let ctx = {req: {accessToken: {userId: 9}}}; + let id = 11; + let destination = 222222222; + let message = 'this is the message created in a test'; + + let sms = await app.models.Ticket.sendSms(ctx, id, destination, message); + + logId = sms.logId; + + let createdLog = await app.models.TicketLog.findById(logId); + let json = JSON.parse(JSON.stringify(createdLog.newInstance)); + + expect(json.message).toEqual(message); + }); +}); diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index 2b1d8711c..d1037f251 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -51,6 +51,7 @@ module.exports = Self => { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, {relation: 'agencyMode', scope: {fields: ['name']}}, + {relation: 'zone', scope: {fields: ['name']}}, { relation: 'client', scope: { diff --git a/modules/ticket/back/models/component-type.json b/modules/ticket/back/models/component-type.json index ced725309..d72217a24 100644 --- a/modules/ticket/back/models/component-type.json +++ b/modules/ticket/back/models/component-type.json @@ -16,10 +16,7 @@ "type": "String" }, "isBase":{ - "type":"String", - "mysql": { - "columnName": "base" - } + "type":"Boolean" } } } diff --git a/modules/ticket/back/models/ticket.js b/modules/ticket/back/models/ticket.js index 8ba2bfb0d..45284d60d 100644 --- a/modules/ticket/back/models/ticket.js +++ b/modules/ticket/back/models/ticket.js @@ -28,6 +28,7 @@ module.exports = Self => { require('../methods/ticket/canHaveStowaway')(Self); require('../methods/ticket/recalculateComponents')(Self); require('../methods/ticket/deleteStowaway')(Self); + require('../methods/ticket/sendSms')(Self); Self.observe('before save', async function(ctx) { if (ctx.isNewInstance) return; diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html index 3632d37f1..f47f3d6ef 100644 --- a/modules/ticket/front/descriptor/index.html +++ b/modules/ticket/front/descriptor/index.html @@ -193,7 +193,7 @@ - + - - Verdnatura le comunica: Su pedido está pendiente de pago. - Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias. +SMSPayment: "Verdnatura le comunica:\rSu pedido está pendiente de pago.\rPor favor, entre en la página web y efectue el pago con tarjeta.\rMuchas gracias." Ticket invoiced: Ticket facturado Make invoice: Crear factura Regenerate invoice: Regenerar factura diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 58ee9136e..2625d35f3 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -34,3 +34,4 @@ import './weekly'; import './dms/index'; import './dms/create'; import './dms/edit'; +import './sms'; diff --git a/modules/ticket/front/package/index.html b/modules/ticket/front/package/index.html index 87c424ff1..12ac13862 100644 --- a/modules/ticket/front/package/index.html +++ b/modules/ticket/front/package/index.html @@ -3,7 +3,7 @@ url="TicketPackagings" fields="['id', 'ticketFk', 'packagingFk', 'quantity', 'created']" link="{ticketFk: $ctrl.$stateParams.id}" - data="packages" on-data-change="$ctrl.onDataChange()" + data="packages" auto-load="true"> {{::request.id}} - {{::request.description}} - {{::request.created | date: 'dd/MM/yyyy'}} + + + + {{::request.created | date: 'dd/MM/yyyy'}} + {{::request.requester.user.nickname | dashIfEmpty}} - + {{::request.atender.user.nickname | dashIfEmpty}} - {{::request.quantity}} - {{::request.price | currency: 'EUR': 2}} + + + + + + + + - {{request.saleFk | zeroFill:6}} + {{::request.saleFk | zeroFill:6}} diff --git a/modules/ticket/front/request/index/index.js b/modules/ticket/front/request/index/index.js index 2c8996760..38d800aeb 100644 --- a/modules/ticket/front/request/index/index.js +++ b/modules/ticket/front/request/index/index.js @@ -78,6 +78,18 @@ class Controller { return 'Acepted'; } } + + updateData() { + this.$.model.save().then(() => { + this.$.watcher.notifySaved(); + this.$.watcher.updateOriginalData(); + }); + } + + isEditable(isOk) { + if (isOk != null) + return true; + } } Controller.$inject = ['$scope', '$stateParams']; diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index bd9b390b5..998f481ea 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -168,7 +168,7 @@ - {{sale.discount | percentage}} + {{(sale.discount / 100) | percentage}} diff --git a/modules/ticket/front/sale/locale/es.yml b/modules/ticket/front/sale/locale/es.yml index 3ccdd528e..74f888f56 100644 --- a/modules/ticket/front/sale/locale/es.yml +++ b/modules/ticket/front/sale/locale/es.yml @@ -24,9 +24,7 @@ Sales to transfer: Líneas a transferir Destination ticket: Ticket destinatario Change ticket state to 'Ok': Cambiar estado del ticket a 'Ok' Reserved: Reservado -SMSAvailability: >- - Verdnatura le comunica: Pedido {{ticketFk}} día {{created | date: "dd/MM/yyyy"}}. - {{notAvailables}} no disponible/s. Disculpe las molestias. +SMSAvailability: "Verdnatura le comunica:\rPedido {{ticketFk}} día {{created | date: 'dd/MM/yyyy'}}.\r{{notAvailables}} no disponible/s.\rDisculpe las molestias." Continue anyway?: ¿Continuar de todas formas? This ticket is now empty: El ticket ha quedado vacio Do you want to delete it?: ¿Quieres eliminarlo? diff --git a/modules/ticket/front/sms/index.html b/modules/ticket/front/sms/index.html new file mode 100644 index 000000000..ac7a20651 --- /dev/null +++ b/modules/ticket/front/sms/index.html @@ -0,0 +1,35 @@ + + +
+
Send SMS
+ + + + + + + + + + + {{'Characters remaining' | translate}}: {{$ctrl.charactersRemaining()}} + + +
+
+ + + + +
\ No newline at end of file diff --git a/modules/ticket/front/sms/index.js b/modules/ticket/front/sms/index.js new file mode 100644 index 000000000..1f2c7f9c0 --- /dev/null +++ b/modules/ticket/front/sms/index.js @@ -0,0 +1,48 @@ +import ngModule from '../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +class Controller extends Component { + constructor($element, $scope, $http, $translate, vnApp) { + super($element, $scope); + + this.$scope = $scope; + this.$http = $http; + this.$translate = $translate; + this.vnApp = vnApp; + } + + open() { + this.$scope.SMSDialog.show(); + } + + charactersRemaining() { + let elementMaxLength; + let textAreaLength; + const element = this.$scope.message; + + textAreaLength = element.input.textLength; + elementMaxLength = element.maxlength; + return elementMaxLength - textAreaLength; + } + + onResponse(response) { + if (response === 'accept') { + this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + + if (res.data) this.emit('send', {response: res.data}); + }); + } + } +} + +Controller.$inject = ['$element', '$scope', '$http', '$translate', 'vnApp']; + +ngModule.component('vnTicketSms', { + template: require('./index.html'), + controller: Controller, + bindings: { + sms: '<', + } +}); diff --git a/modules/ticket/front/sms/index.spec.js b/modules/ticket/front/sms/index.spec.js new file mode 100644 index 000000000..5565c3623 --- /dev/null +++ b/modules/ticket/front/sms/index.spec.js @@ -0,0 +1,49 @@ +import './index'; + +describe('Ticket', () => { + describe('Component vnTicketSms', () => { + let controller; + let $httpBackend; + let $element; + + beforeEach(ngModule('ticket')); + + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + let $scope = $rootScope.$new(); + $element = angular.element(''); + controller = $componentController('vnTicketSms', {$element, $scope}); + controller.$params = {id: 11}; + })); + + describe('onResponse()', () => { + it('should perform a POST query and show a success snackbar', () => { + let params = {destinationFk: 101, destination: 111111111, message: 'My SMS'}; + controller.sms = {destinationFk: 101, destination: 111111111, message: 'My SMS'}; + + spyOn(controller.vnApp, 'showMessage'); + $httpBackend.expect('POST', `Tickets/11/sendSms`, params).respond(200, params); + + controller.onResponse('accept'); + $httpBackend.flush(); + + expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); + }); + }); + + describe('charactersRemaining()', () => { + it('should return the characters remaining in a element', () => { + controller.$scope.message = { + input: { + textLength: 50 + }, + maxlength: 150 + }; + + let result = controller.charactersRemaining(); + + expect(result).toEqual(100); + }); + }); + }); +}); diff --git a/modules/ticket/front/sms/locale/es.yml b/modules/ticket/front/sms/locale/es.yml new file mode 100644 index 000000000..f26c8ba24 --- /dev/null +++ b/modules/ticket/front/sms/locale/es.yml @@ -0,0 +1,5 @@ +Send SMS: Enviar SMS +Destination: Destinatario +Message: Mensaje +SMS sent!: ¡SMS enviado! +Characters remaining: Carácteres restantes \ No newline at end of file diff --git a/modules/ticket/front/sms/style.scss b/modules/ticket/front/sms/style.scss new file mode 100644 index 000000000..89723b196 --- /dev/null +++ b/modules/ticket/front/sms/style.scss @@ -0,0 +1,5 @@ +@import "variables"; + +.SMSDialog { + min-width: 25em +} \ No newline at end of file diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 9ef27d093..7bbff4f28 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -24,12 +24,12 @@ + + - - @@ -46,6 +46,9 @@ {{$ctrl.summary.routeFk}} + + diff --git a/modules/ticket/front/summary/index.js b/modules/ticket/front/summary/index.js index 5b5f9fb90..0cfa5614f 100644 --- a/modules/ticket/front/summary/index.js +++ b/modules/ticket/front/summary/index.js @@ -21,7 +21,7 @@ class Controller { } get formattedAddress() { - if (!this.summary) return; + if (!this.summary) return ''; let address = this.summary.address; let province = address.province ? `(${address.province.name})` : ''; diff --git a/modules/travel/back/methods/travel-thermograph/allowedContentTypes.js b/modules/travel/back/methods/travel-thermograph/allowedContentTypes.js new file mode 100644 index 000000000..2f5183f92 --- /dev/null +++ b/modules/travel/back/methods/travel-thermograph/allowedContentTypes.js @@ -0,0 +1,23 @@ +module.exports = Self => { + Self.remoteMethodCtx('allowedContentTypes', { + description: 'Returns a list of allowed contentTypes', + accessType: 'READ', + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/allowedContentTypes`, + verb: 'GET' + } + }); + + Self.allowedContentTypes = async() => { + const storageConnector = Self.app.dataSources.storage.connector; + const allowedContentTypes = storageConnector.allowedContentTypes; + const modelAllowedContentTypes = Self.definition.settings.allowedContentTypes; + + return modelAllowedContentTypes || allowedContentTypes; + }; +}; + diff --git a/modules/travel/back/methods/travel/createThermograph.js b/modules/travel/back/methods/travel/createThermograph.js new file mode 100644 index 000000000..cbf0678d1 --- /dev/null +++ b/modules/travel/back/methods/travel/createThermograph.js @@ -0,0 +1,84 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('createThermograph', { + description: 'Upload and attach a document', + accessType: 'WRITE', + accepts: [{ + arg: 'id', + type: 'Number', + description: 'The travel id', + http: {source: 'path'} + }, { + arg: 'thermographId', + type: 'String', + description: 'The thermograph id', + required: true + }, { + arg: 'warehouseId', + type: 'Number', + description: 'The warehouse id', + required: true + }, { + arg: 'companyId', + type: 'Number', + description: 'The company id', + required: true + }, { + arg: 'dmsTypeId', + type: 'Number', + description: 'The dms type id', + required: true + }, { + arg: 'reference', + type: 'String', + required: true + }, { + arg: 'description', + type: 'String', + required: true + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/:id/createThermograph`, + verb: 'POST' + } + }); + + Self.createThermograph = async(ctx, id, thermographId) => { + const models = Self.app.models; + const tx = await Self.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const travelThermograph = await models.TravelThermograph.findOne({ + where: { + thermographFk: thermographId, + travelFk: null + } + }, options); + + if (!travelThermograph) + throw new UserError('No valid travel thermograph found'); + + const uploadedFiles = await models.Dms.uploadFile(ctx, options); + const firstDms = uploadedFiles[0]; + + await travelThermograph.updateAttributes({ + dmsFk: firstDms.id, + travelFk: id + }, options); + + await tx.commit(); + + return travelThermograph; + } catch (err) { + await tx.rollback(); + throw err; + } + }; +}; diff --git a/modules/travel/back/methods/travel/deleteThermograph.js b/modules/travel/back/methods/travel/deleteThermograph.js new file mode 100644 index 000000000..ba541c560 --- /dev/null +++ b/modules/travel/back/methods/travel/deleteThermograph.js @@ -0,0 +1,53 @@ + +module.exports = Self => { + Self.remoteMethodCtx('deleteThermograph', { + description: 'Deletes a travel thermograph', + accessType: 'WRITE', + accepts: { + arg: 'id', + type: 'Number', + description: 'The thermograph id', + required: true + }, + returns: { + type: 'object', + root: true + }, + http: { + path: '/deleteThermograph', + verb: 'DELETE' + } + }); + + Self.deleteThermograph = async(ctx, id) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + const travelThermograph = await models.TravelThermograph.findById(id); + + await models.Dms.removeFile(ctx, travelThermograph.dmsFk); + await Self.rawSql(` + UPDATE travelThermograph + SET travelFk = NULL, dmsFk = NULL + WHERE id = ?`, [id]); + + const oldInstance = { + travelFk: travelThermograph.travelFk, + dmsFk: travelThermograph.dmsFk + }; + + await models.TravelLog.create({ + originFk: travelThermograph.travelFk, + userFk: userId, + action: 'delete', + changedModel: 'TravelThermograph', + changedModelId: id, + oldInstance: oldInstance, + newInstance: {} + }); + + travelThermograph.travelFk = null; + travelThermograph.dmsFk = null; + + return travelThermograph; + }; +}; diff --git a/modules/travel/back/methods/travel/specs/createThermograph.spec.js b/modules/travel/back/methods/travel/specs/createThermograph.spec.js new file mode 100644 index 000000000..b85dcca04 --- /dev/null +++ b/modules/travel/back/methods/travel/specs/createThermograph.spec.js @@ -0,0 +1,50 @@ +const app = require('vn-loopback/server/server'); + +describe('Travel createThermograph()', () => { + const models = app.models; + const travelId = 3; + const currentUserId = 102; + const thermographId = '138350-0'; + const ctx = {req: {accessToken: {userId: currentUserId}}, args: {dmsTypeId: 1}}; + let travelThermographBefore; + + afterAll(async done => { + await app.models.TravelThermograph.rawSql(` + UPDATE travelThermograph + SET travelFk = NULL, dmsFk = NULL + WHERE id = ?`, [travelThermographBefore.id]); + + done(); + }); + + it(`should set the travelFk and dmsFk properties to the travel thermograph`, async() => { + spyOn(app.models.Dms, 'uploadFile').and.returnValue([{id: 5}]); + + travelThermographBefore = await models.TravelThermograph.findOne({ + where: { + thermographFk: thermographId, + travelFk: null + } + }); + + await models.Travel.createThermograph(ctx, travelId, thermographId); + + const travelThermographAfter = await models.TravelThermograph.findOne({ + where: { + thermographFk: thermographId, + travelFk: travelId + } + }); + + expect(app.models.Dms.uploadFile).toHaveBeenCalledWith(ctx, jasmine.any(Object)); + + expect(travelThermographBefore).toBeDefined(); + expect(travelThermographBefore.thermographFk).toEqual(thermographId); + expect(travelThermographBefore.travelFk).toBeNull(); + expect(travelThermographAfter).toBeDefined(); + + expect(travelThermographAfter.thermographFk).toEqual(thermographId); + expect(travelThermographAfter.travelFk).toEqual(travelId); + expect(travelThermographAfter.dmsFk).toEqual(5); + }); +}); diff --git a/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js b/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js new file mode 100644 index 000000000..843fa046c --- /dev/null +++ b/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js @@ -0,0 +1,56 @@ +const app = require('vn-loopback/server/server'); + +describe('Travel deleteThermograph()', () => { + const models = app.models; + const travelId = 1; + const currentUserId = 102; + const thermographId = 'TZ1905012010'; + const travelThermographId = 4; + const dmsId = 5; + const ctx = {req: {accessToken: {userId: currentUserId}}}; + let travelThermographBefore; + + afterAll(async done => { + await app.models.TravelThermograph.rawSql(` + UPDATE travelThermograph + SET travelFk = ?, dmsFk = ? + WHERE id = ?`, [ + travelThermographBefore.travelFk, + travelThermographBefore.dmsFk, + travelThermographBefore.id + ]); + + done(); + }); + + it(`should set the travelFk and dmsFk properties to null for travel thermograph removal`, async() => { + spyOn(app.models.Dms, 'removeFile').and.returnValue([{id: 5}]); + + travelThermographBefore = await models.TravelThermograph.findOne({ + where: { + thermographFk: thermographId, + travelFk: travelId + } + }); + + await models.Travel.deleteThermograph(ctx, travelThermographId); + + const travelThermographAfter = await models.TravelThermograph.findOne({ + where: { + thermographFk: thermographId, + travelFk: null + } + }); + + expect(app.models.Dms.removeFile).toHaveBeenCalledWith(ctx, dmsId); + + expect(travelThermographBefore).toBeDefined(); + expect(travelThermographBefore.thermographFk).toEqual(thermographId); + expect(travelThermographBefore.travelFk).toEqual(travelId); + expect(travelThermographBefore.dmsFk).toEqual(5); + + expect(travelThermographAfter).toBeDefined(); + expect(travelThermographAfter.thermographFk).toEqual(thermographId); + expect(travelThermographAfter.travelFk).toBeNull(); + }); +}); diff --git a/modules/travel/back/model-config.json b/modules/travel/back/model-config.json index ceea6bceb..03307bd45 100644 --- a/modules/travel/back/model-config.json +++ b/modules/travel/back/model-config.json @@ -1,11 +1,13 @@ { "Travel": { "dataSource": "vn" - },"Entry": { - "dataSource": "vn" },"TravelLog": { "dataSource": "vn" },"Currency": { "dataSource": "vn" + },"Thermograph": { + "dataSource": "vn" + },"TravelThermograph": { + "dataSource": "vn" } } diff --git a/modules/travel/back/models/currency.json b/modules/travel/back/models/currency.json index 036da89f1..9ee7640b2 100644 --- a/modules/travel/back/models/currency.json +++ b/modules/travel/back/models/currency.json @@ -21,5 +21,13 @@ "ratio": { "type": "Number" } - } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/modules/travel/back/models/thermograph.json b/modules/travel/back/models/thermograph.json new file mode 100644 index 000000000..421ae4341 --- /dev/null +++ b/modules/travel/back/models/thermograph.json @@ -0,0 +1,19 @@ +{ + "name": "Thermograph", + "base": "VnModel", + "options": { + "mysql": { + "table": "thermograph" + } + }, + "properties": { + "id": { + "type": "String", + "id": true, + "description": "Identifier" + }, + "model": { + "type": "String" + } + } +} diff --git a/modules/travel/back/models/travel-log.json b/modules/travel/back/models/travel-log.json index d21821127..d53be88f1 100644 --- a/modules/travel/back/models/travel-log.json +++ b/modules/travel/back/models/travel-log.json @@ -36,7 +36,7 @@ "type": "Date" }, "changedModelId": { - "type": "Number" + "type": "String" }, "changedModelValue": { "type": "String" diff --git a/modules/travel/back/models/travel-thermograph.js b/modules/travel/back/models/travel-thermograph.js new file mode 100644 index 000000000..0d70edd7e --- /dev/null +++ b/modules/travel/back/models/travel-thermograph.js @@ -0,0 +1,4 @@ +module.exports = Self => { + require('../methods/travel-thermograph/allowedContentTypes')(Self); +}; + diff --git a/modules/travel/back/models/travel-thermograph.json b/modules/travel/back/models/travel-thermograph.json new file mode 100644 index 000000000..b8f7fa41a --- /dev/null +++ b/modules/travel/back/models/travel-thermograph.json @@ -0,0 +1,52 @@ +{ + "name": "TravelThermograph", + "base": "Loggable", + "log": { + "model":"TravelLog", + "relation": "travel", + "showField": "ref" + }, + "options": { + "mysql": { + "table": "travelThermograph" + } + }, + "properties": { + "id": { + "type": "Number", + "description": "Identifier", + "id": true + }, + "created": { + "type": "Date" + }, + "temperature": { + "type": "String" + }, + "result": { + "type": "String" + } + }, + "relations": { + "travel": { + "type": "belongsTo", + "model": "Travel", + "foreignKey": "travelFk" + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + }, + "dms": { + "type": "belongsTo", + "model": "Dms", + "foreignKey": "dmsFk" + }, + "thermograph": { + "type": "belongsTo", + "model": "Thermograph", + "foreignKey": "thermographFk" + } + } +} diff --git a/modules/travel/back/models/travel.js b/modules/travel/back/models/travel.js index 5fa55a366..895de7af1 100644 --- a/modules/travel/back/models/travel.js +++ b/modules/travel/back/models/travel.js @@ -2,4 +2,6 @@ module.exports = Self => { require('../methods/travel/getTravel')(Self); require('../methods/travel/getEntries')(Self); require('../methods/travel/filter')(Self); + require('../methods/travel/createThermograph')(Self); + require('../methods/travel/deleteThermograph')(Self); }; diff --git a/modules/travel/back/models/travel.json b/modules/travel/back/models/travel.json index b4f154525..0eafe4010 100644 --- a/modules/travel/back/models/travel.json +++ b/modules/travel/back/models/travel.json @@ -2,7 +2,8 @@ "name": "Travel", "base": "Loggable", "log": { - "model":"TravelLog" + "model":"TravelLog", + "showField": "ref" }, "options": { "mysql": { diff --git a/modules/travel/front/index.js b/modules/travel/front/index.js index 02bbb997b..1f5346e98 100644 --- a/modules/travel/front/index.js +++ b/modules/travel/front/index.js @@ -9,3 +9,6 @@ import './summary'; import './basic-data'; import './log'; import './create'; +import './thermograph/index/'; +import './thermograph/create/'; + diff --git a/modules/travel/front/locale/es.yml b/modules/travel/front/locale/es.yml index 0986729f8..931f79ab8 100644 --- a/modules/travel/front/locale/es.yml +++ b/modules/travel/front/locale/es.yml @@ -15,4 +15,5 @@ Search travels by id: Buscar envíos por identificador New travel: Nuevo envío # Sections Travels: Envíos -Log: Historial \ No newline at end of file +Log: Historial +Thermographs: Termógrafos \ No newline at end of file diff --git a/modules/travel/front/routes.json b/modules/travel/front/routes.json index d9b520816..fcbe5b92f 100644 --- a/modules/travel/front/routes.json +++ b/modules/travel/front/routes.json @@ -10,7 +10,8 @@ ], "card": [ {"state": "travel.card.basicData", "icon": "settings"}, - {"state": "travel.card.log", "icon": "history"} + {"state": "travel.card.log", "icon": "history"}, + {"state": "travel.card.thermograph.index", "icon": "icon-thermometer"} ] }, "routes": [ @@ -57,6 +58,29 @@ "state": "travel.create", "component": "vn-travel-create", "description": "New travel" + }, { + "url": "/thermograph", + "state": "travel.card.thermograph", + "abstract": true, + "component": "ui-view" + }, { + "url" : "/index", + "state": "travel.card.thermograph.index", + "component": "vn-travel-thermograph-index", + "description": "Thermographs", + "params": { + "travel": "$ctrl.travel" + }, + "acl": ["buyer"] + }, { + "url" : "/create", + "state": "travel.card.thermograph.create", + "component": "vn-travel-thermograph-create", + "description": "Add thermograph", + "params": { + "travel": "$ctrl.travel" + }, + "acl": ["buyer"] } ] } \ No newline at end of file diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index 0ce4517f2..5397c72ca 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -43,7 +43,7 @@

Entries

- + Confirmed @@ -51,8 +51,8 @@ Supplier Reference HB - Freight cost - Package cost + Freight + Package CC Pallet m3 @@ -61,16 +61,18 @@ - - + + + + {{entry.id}} {{entry.supplierName}} {{entry.ref}} {{entry.hb}} - {{entry.freightValue}} - {{entry.packageValue}} + {{entry.freightValue | currency: 'EUR': 2}} + {{entry.packageValue | currency: 'EUR': 2}} {{entry.cc}} {{entry.pallet}} {{entry.m3}} @@ -81,13 +83,51 @@ icon="insert_drive_file">
+ + + + + + + {{$ctrl.total('hb')}} + {{$ctrl.total('freightValue') | currency: 'EUR': 2}} + {{$ctrl.total('packageValue') | currency: 'EUR': 2}} + {{$ctrl.total('cc')}} + {{$ctrl.total('pallet')}} + {{$ctrl.total('m3')}} + + + + + + +

Thermographs

+ + + + Code + Temperature + State + Destination + Created + + + + + {{thermograph.thermographFk}} + {{thermograph.temperature}} + {{thermograph.result}} + {{thermograph.warehouse.name}} + {{thermograph.created | date: 'dd/MM/yyyy'}} + +
diff --git a/modules/travel/front/summary/index.js b/modules/travel/front/summary/index.js index 20946ed3b..8ee2da49d 100644 --- a/modules/travel/front/summary/index.js +++ b/modules/travel/front/summary/index.js @@ -1,10 +1,12 @@ import ngModule from '../module'; import './style.scss'; +import Component from 'core/lib/component'; -class Controller { - constructor($scope, $http) { - this.$ = $scope; - this.$http = $http; +class Controller extends Component { + constructor($element, $, $httpParamSerializer) { + super($element, $); + this.entries = []; + this.$httpParamSerializer = $httpParamSerializer; } get travel() { @@ -17,6 +19,7 @@ class Controller { if (value && value.id) { this.getTravel(); this.getEntries(); + this.getThermographs(); } } @@ -31,9 +34,39 @@ class Controller { this.entries = response.data; }); } + + getThermographs() { + const params = { + filter: { + include: { + relation: 'warehouse', + scope: { + fields: ['id', 'name'] + } + }, + where: { + travelFk: this.travel.id + } + } + }; + + const serializedParams = this.$httpParamSerializer(params); + return this.$http.get(`TravelThermographs?${serializedParams}`).then(res => { + this.travelThermographs = res.data; + }); + } + + total(field) { + let total = 0; + + for (let entry of this.entries) + total += entry[field]; + + return total; + } } -Controller.$inject = ['$scope', '$http']; +Controller.$inject = ['$element', '$scope', '$httpParamSerializer']; ngModule.component('vnTravelSummary', { template: require('./index.html'), diff --git a/modules/travel/front/summary/index.spec.js b/modules/travel/front/summary/index.spec.js index dc6e4b23a..5411d8a0d 100644 --- a/modules/travel/front/summary/index.spec.js +++ b/modules/travel/front/summary/index.spec.js @@ -3,15 +3,20 @@ import './index'; describe('component vnTravelSummary', () => { let controller; let $httpBackend; - + let $scope; + let $element; + let $httpParamSerializer; beforeEach(angular.mock.module('travel', $translateProvider => { $translateProvider.translations('en', {}); })); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; - controller = $componentController('vnTravelSummary'); + $httpParamSerializer = _$httpParamSerializer_; + $scope = $rootScope.$new(); + $element = angular.element(``); + controller = $componentController('vnTravelSummary', {$element, $scope}); })); describe('travel setter/getter', () => { @@ -24,12 +29,14 @@ describe('component vnTravelSummary', () => { it('should return the travel and then call both getTravel() and getEntries()', () => { spyOn(controller, 'getTravel'); spyOn(controller, 'getEntries'); + spyOn(controller, 'getThermographs'); controller.travel = {id: 99}; expect(controller._travel.id).toEqual(99); expect(controller.getTravel).toHaveBeenCalledWith(); expect(controller.getEntries).toHaveBeenCalledWith(); + expect(controller.getThermographs).toHaveBeenCalledWith(); }); }); @@ -58,4 +65,44 @@ describe('component vnTravelSummary', () => { expect(controller.entries).toEqual('I am the entries'); }); }); + + describe('getThermographs()', () => { + it('should call the getThermographs method to get the thermographs', () => { + controller._travel = {id: 2}; + const params = { + filter: { + include: { + relation: 'warehouse', + scope: { + fields: ['id', 'name'] + } + }, + where: { + travelFk: controller._travel.id + } + } + }; + const serializedParams = $httpParamSerializer(params); + const query = `TravelThermographs?${serializedParams}`; + $httpBackend.expectGET(query).respond('I am the thermographs'); + controller.getThermographs(); + $httpBackend.flush(); + + expect(controller.travelThermographs).toEqual('I am the thermographs'); + }); + }); + + describe('total()', () => { + it('should calculate the total amount of a given property for every row', () => { + controller.entries = [ + {id: 1, freightValue: 1, packageValue: 2, cc: 0.01}, + {id: 2, freightValue: 1, packageValue: 2, cc: 0.01}, + {id: 3, freightValue: 1, packageValue: 2, cc: 0.01} + ]; + + expect(controller.total('freightValue')).toEqual(3); + expect(controller.total('packageValue')).toEqual(6); + expect(controller.total('cc')).toEqual(0.03); + }); + }); }); diff --git a/modules/travel/front/summary/locale/es.yml b/modules/travel/front/summary/locale/es.yml index 16f21fdde..c82508dfc 100644 --- a/modules/travel/front/summary/locale/es.yml +++ b/modules/travel/front/summary/locale/es.yml @@ -12,6 +12,6 @@ Confirmed: Confirmada Entry Id: Entrada Id Supplier: Proveedor Pallet: Pallet -Freight cost: Coste porte -Package cost: Coste embalaje +Freight: Porte +Package: Embalaje Half box: Media caja diff --git a/modules/travel/front/thermograph/create/index.html b/modules/travel/front/thermograph/create/index.html new file mode 100644 index 000000000..02ef54264 --- /dev/null +++ b/modules/travel/front/thermograph/create/index.html @@ -0,0 +1,79 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/modules/travel/front/thermograph/create/index.js b/modules/travel/front/thermograph/create/index.js new file mode 100644 index 000000000..8e10aca0f --- /dev/null +++ b/modules/travel/front/thermograph/create/index.js @@ -0,0 +1,97 @@ +import ngModule from '../../module'; + +class Controller { + constructor($scope, $http, $state, $translate, vnApp, vnConfig) { + this.$ = $scope; + this.$http = $http; + this.$state = $state; + this.$translate = $translate; + this.vnApp = vnApp; + this.vnConfig = vnConfig; + this.dms = {files: []}; + } + + get travel() { + return this._travel; + } + + set travel(value) { + this._travel = value; + + if (value) { + this.setDefaultParams(); + this.getAllowedContentTypes(); + } + } + + getAllowedContentTypes() { + this.$http.get('TravelThermographs/allowedContentTypes').then(res => { + const contentTypes = res.data.join(', '); + this.allowedContentTypes = contentTypes; + }); + } + + get contentTypesInfo() { + return this.$translate.instant('ContentTypesInfo', { + allowedContentTypes: this.allowedContentTypes + }); + } + + setDefaultParams() { + const params = {filter: { + where: {code: 'miscellaneous'} + }}; + this.$http.get('DmsTypes/findOne', {params}).then(res => { + const dmsTypeId = res.data && res.data.id; + const companyId = this.vnConfig.companyFk; + const warehouseId = this.vnConfig.warehouseFk; + const defaultParams = { + reference: this.travel.id, + warehouseId: warehouseId, + companyId: companyId, + dmsTypeId: dmsTypeId, + description: this.$translate.instant('FileDescription', { + travelId: this.travel.id + }).toUpperCase() + }; + + this.dms = Object.assign(this.dms, defaultParams); + }); + } + + onSubmit() { + const query = `Travels/${this.travel.id}/createThermograph`; + const options = { + method: 'POST', + url: query, + params: this.dms, + headers: { + 'Content-Type': undefined + }, + transformRequest: files => { + const formData = new FormData(); + + for (let i = 0; i < files.length; i++) + formData.append(files[i].name, files[i]); + + return formData; + }, + data: this.dms.files + }; + this.$http(options).then(res => { + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.$.watcher.updateOriginalData(); + this.$state.go('travel.card.thermograph.index'); + }); + } +} + +Controller.$inject = ['$scope', '$http', '$state', '$translate', 'vnApp', 'vnConfig']; + +ngModule.component('vnTravelThermographCreate', { + template: require('./index.html'), + controller: Controller, + bindings: { + travel: '<' + } +}); diff --git a/modules/travel/front/thermograph/create/index.spec.js b/modules/travel/front/thermograph/create/index.spec.js new file mode 100644 index 000000000..bf5b8bec5 --- /dev/null +++ b/modules/travel/front/thermograph/create/index.spec.js @@ -0,0 +1,68 @@ +import './index'; + +describe('Ticket', () => { + describe('Component vnTravelThermographCreate', () => { + let controller; + let $scope; + let $httpBackend; + let $httpParamSerializer; + const travelId = 3; + const dmsTypeId = 5; + + beforeEach(ngModule('travel')); + + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + $scope = $rootScope.$new(); + $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; + controller = $componentController('vnTravelThermographCreate', {$scope}); + controller._travel = { + id: travelId + }; + })); + + describe('travel() setter', () => { + it('should set the travel data and then call setDefaultParams() and getAllowedContentTypes()', () => { + spyOn(controller, 'setDefaultParams'); + spyOn(controller, 'getAllowedContentTypes'); + controller.travel = { + id: travelId + }; + + expect(controller.travel).toBeDefined(); + expect(controller.setDefaultParams).toHaveBeenCalledWith(); + expect(controller.getAllowedContentTypes).toHaveBeenCalledWith(); + }); + }); + + describe('setDefaultParams()', () => { + it('should perform a GET query and define the dms property on controller', () => { + const params = {filter: { + where: {code: 'miscellaneous'} + }}; + let serializedParams = $httpParamSerializer(params); + $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: dmsTypeId, code: 'miscellaneous'}); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); + controller.setDefaultParams(); + $httpBackend.flush(); + + expect(controller.dms).toBeDefined(); + expect(controller.dms.reference).toEqual(travelId); + expect(controller.dms.dmsTypeId).toEqual(dmsTypeId); + }); + }); + + describe('getAllowedContentTypes()', () => { + it('should make an HTTP GET request to get the allowed content types', () => { + const expectedResponse = ['application/pdf', 'image/png', 'image/jpg']; + $httpBackend.when('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); + $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`); + controller.getAllowedContentTypes(); + $httpBackend.flush(); + + expect(controller.allowedContentTypes).toBeDefined(); + expect(controller.allowedContentTypes).toEqual('application/pdf, image/png, image/jpg'); + }); + }); + }); +}); diff --git a/modules/travel/front/thermograph/index/index.html b/modules/travel/front/thermograph/index/index.html new file mode 100644 index 000000000..ca9ebcaea --- /dev/null +++ b/modules/travel/front/thermograph/index/index.html @@ -0,0 +1,67 @@ + + + +
+ + + + + Code + Temperature + State + Destination + Created + + + + + + {{thermograph.thermographFk}} + {{thermograph.temperature}} + {{thermograph.result}} + {{thermograph.warehouse.name}} + {{thermograph.created | date: 'dd/MM/yyyy'}} + + + + + + + + + + + + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/modules/travel/front/thermograph/index/index.js b/modules/travel/front/thermograph/index/index.js new file mode 100644 index 000000000..48487eb7c --- /dev/null +++ b/modules/travel/front/thermograph/index/index.js @@ -0,0 +1,47 @@ +import ngModule from '../../module'; +import './style.scss'; +import Component from 'core/lib/component'; + +class Controller extends Component { + constructor($element, $, vnToken) { + super($element, $); + this.accessToken = vnToken.token; + this.filter = { + include: + {relation: 'warehouse', + scope: { + fields: ['id', 'name'] + } + } + }; + } + + showDeleteConfirm(index) { + this.thermographIndex = index; + this.$.confirm.show(); + } + + deleteThermograph() { + const data = this.travelThermographs; + const thermographId = data[this.thermographIndex].id; + const query = `Travels/deleteThermograph?id=${thermographId}`; + this.$http.delete(query).then(() => { + this.vnApp.showSuccess(this.$translate.instant('Thermograph deleted')); + this.$.model.remove(this.thermographIndex); + this.thermographIndex = null; + }); + } +} + +Controller.$inject = ['$element', '$scope', 'vnToken']; + +ngModule.component('vnTravelThermographIndex', { + template: require('./index.html'), + controller: Controller, + require: { + card: '^vnTravelCard' + }, + bindings: { + travel: '<' + } +}); diff --git a/modules/travel/front/thermograph/index/style.scss b/modules/travel/front/thermograph/index/style.scss new file mode 100644 index 000000000..2c287ed9d --- /dev/null +++ b/modules/travel/front/thermograph/index/style.scss @@ -0,0 +1,6 @@ +@import "variables"; + +vn-route-tickets form{ + margin: 0 auto; + max-width: $width-lg; +} \ No newline at end of file diff --git a/modules/travel/front/thermograph/locale/es.yml b/modules/travel/front/thermograph/locale/es.yml new file mode 100644 index 000000000..184e95e73 --- /dev/null +++ b/modules/travel/front/thermograph/locale/es.yml @@ -0,0 +1,17 @@ +Code: Código +Temperature: Temperatura +State: Estado +Destination: Destino +Created: Creado +Remove thermograph: Eliminar termógrafo +Upload file: Subir fichero +Edit file: Editar fichero +Upload: Subir +File: Fichero +FileDescription: Travel id {{travelId}} +ContentTypesInfo: 'Tipos de archivo permitidos: {{allowedContentTypes}}' +Are you sure you want to continue?: ¿Seguro que quieres continuar? +Add thermograph: Añadir termógrafo +Thermograph deleted: Termógrafo eliminado +Thermograph: Termógrafo +Are you sure you want to remove the thermograph?: ¿Seguro que quieres quitar el termógrafo? \ No newline at end of file diff --git a/modules/worker/back/methods/worker-calendar/specs/absences.spec.js b/modules/worker/back/methods/worker-calendar/specs/absences.spec.js index aebe5a24b..eb5865a17 100644 --- a/modules/worker/back/methods/worker-calendar/specs/absences.spec.js +++ b/modules/worker/back/methods/worker-calendar/specs/absences.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -// #1924 - Fix hours +// 2066 xdescribe('Worker absences()', () => { it('should get the absence calendar for a full year contract', async() => { let ctx = {req: {accessToken: {userId: 106}}}; @@ -27,8 +27,8 @@ xdescribe('Worker absences()', () => { let firstType = absences[0].absenceType().name; let sixthType = absences[5].absenceType().name; - expect(firstType).toEqual('Leave of absence'); - expect(sixthType).toEqual('Holidays'); + expect(firstType).toMatch(/(Holidays|Leave of absence)/); + expect(sixthType).toMatch(/(Holidays|Leave of absence)/); }); it('should get the absence calendar for a permanent contract', async() => { @@ -64,8 +64,8 @@ xdescribe('Worker absences()', () => { let firstType = absences[0].absenceType().name; let sixthType = absences[5].absenceType().name; - expect(firstType).toEqual('Leave of absence'); - expect(sixthType).toEqual('Holidays'); + expect(firstType).toMatch(/(Holidays|Leave of absence)/); + expect(sixthType).toMatch(/(Holidays|Leave of absence)/); // restores the contract end date await app.models.WorkerLabour.rawSql( @@ -134,6 +134,7 @@ xdescribe('Worker absences()', () => { let remainingDays = 0; for (let i = today.getMonth(); i < 12; i++) { + today.setDate(1); today.setMonth(i + 1); today.setDate(0); @@ -146,8 +147,8 @@ xdescribe('Worker absences()', () => { let firstType = absences[0].absenceType().name; let sixthType = absences[5].absenceType().name; - expect(firstType).toEqual('Leave of absence'); - expect(sixthType).toEqual('Holidays'); + expect(firstType).toMatch(/(Holidays|Leave of absence)/); + expect(sixthType).toMatch(/(Holidays|Leave of absence)/); // resets the holidays per year with originalHolidaysValue and the contract starting date await app.models.WorkCenterHoliday.updateAll( diff --git a/modules/worker/back/methods/worker/getWorkedHours.js b/modules/worker/back/methods/worker/getWorkedHours.js index e96d30f8d..dfb219c72 100644 --- a/modules/worker/back/methods/worker/getWorkedHours.js +++ b/modules/worker/back/methods/worker/getWorkedHours.js @@ -33,10 +33,11 @@ module.exports = Self => { } }); - Self.getWorkedHours = async(id, from, to) => { + Self.getWorkedHours = async(id, started, ended) => { const conn = Self.dataSource.connector; const stmts = []; - + const startedMinusOne = new Date(started); + const endedPlusOne = new Date(ended); let worker = await Self.app.models.Worker.findById(id); let userId = worker.userFk; @@ -45,20 +46,21 @@ module.exports = Self => { tmp.timeControlCalculate, tmp.timeBusinessCalculate `); - - stmts.push(new ParameterizedSQL('CALL vn.timeControl_calculateByUser(?, ?, ?)', [userId, from, to])); - stmts.push(new ParameterizedSQL('CALL vn.timeBusiness_calculateByUser(?, ?, ?)', [userId, from, to])); - let resultIndex = stmts.push(` + startedMinusOne.setDate(started.getDate() - 1); + endedPlusOne.setDate(ended.getDate() + 1); + stmts.push(new ParameterizedSQL('CALL vn.timeControl_calculateByUser(?, ?, ?)', [userId, startedMinusOne, endedPlusOne])); + stmts.push(new ParameterizedSQL('CALL vn.timeBusiness_calculateByUser(?, ?, ?)', [userId, startedMinusOne, endedPlusOne])); + let resultIndex = stmts.push(new ParameterizedSQL(` SELECT tbc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours FROM tmp.timeBusinessCalculate tbc LEFT JOIN tmp.timeControlCalculate tcc ON tcc.dated = tbc.dated - `) - 1; + WHERE tbc.dated BETWEEN ? AND ? + `, [started, ended])) - 1; stmts.push(` DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate, tmp.timeBusinessCalculate `); - let sql = ParameterizedSQL.join(stmts, ';'); let result = await conn.executeStmt(sql); diff --git a/modules/worker/back/methods/worker/isSubordinate.js b/modules/worker/back/methods/worker/isSubordinate.js index a85484668..18c7df17e 100644 --- a/modules/worker/back/methods/worker/isSubordinate.js +++ b/modules/worker/back/methods/worker/isSubordinate.js @@ -29,7 +29,7 @@ module.exports = Self => { const mySubordinates = await Self.mySubordinates(ctx); const isSubordinate = mySubordinates.find(subordinate => { - return subordinate.workerFk === id; + return subordinate.workerFk == id; }); const isHr = await models.Account.hasRole(myUserId, 'hr'); diff --git a/modules/worker/back/models/department.json b/modules/worker/back/models/department.json index 7de76e039..d8ec7313a 100644 --- a/modules/worker/back/models/department.json +++ b/modules/worker/back/models/department.json @@ -25,6 +25,9 @@ }, "sons": { "type": "Number" + }, + "chatName": { + "type": "String" } } } diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index c5c770fcd..7456a3caa 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -54,12 +54,6 @@ "type": "hasMany", "model": "WorkerTeamCollegues", "foreignKey": "workerFk" - }, - "phones": { - "type": "hasMany", - "model": "UserPhone", - "foreignKey": "userFk", - "primaryKey": "userFk" } } } \ No newline at end of file diff --git a/modules/worker/front/basic-data/index.html b/modules/worker/front/basic-data/index.html index 1d0d705e7..67439b350 100644 --- a/modules/worker/front/basic-data/index.html +++ b/modules/worker/front/basic-data/index.html @@ -23,6 +23,14 @@ rule>
+ + + + diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index dd2a24448..14723947e 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -28,12 +28,6 @@ class Controller extends ModuleCard { relation: 'department' } } - }, { - relation: 'phones', - scope: { - fields: ['phone'], - order: 'typeFk ASC' - } } ] }; diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 26c2f193e..d26892bfd 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -26,9 +26,8 @@ - + diff --git a/modules/worker/front/index.js b/modules/worker/front/index.js index 775524a3d..f703e7c21 100644 --- a/modules/worker/front/index.js +++ b/modules/worker/front/index.js @@ -13,7 +13,6 @@ import './department'; import './calendar'; import './time-control'; import './log'; -import './phones'; import './dms/index'; import './dms/create'; import './dms/edit'; diff --git a/modules/worker/front/log/index.html b/modules/worker/front/log/index.html index 9fb96ec10..9624d4aed 100644 --- a/modules/worker/front/log/index.html +++ b/modules/worker/front/log/index.html @@ -14,7 +14,7 @@ - Date + Date Author Model Action @@ -25,7 +25,7 @@ - + {{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}
diff --git a/modules/worker/front/log/style.scss b/modules/worker/front/log/style.scss index bf5e763d7..0943cbc77 100644 --- a/modules/worker/front/log/style.scss +++ b/modules/worker/front/log/style.scss @@ -18,8 +18,12 @@ vn-log { max-width: 250px; } + vn-table .firstColumn { + min-width: 150px + } + @media screen and (max-width: 1570px) { - .expendable { + vn-table .expendable { display: none; } .changes { diff --git a/modules/worker/front/phones/index.html b/modules/worker/front/phones/index.html deleted file mode 100644 index 95e0366c1..000000000 --- a/modules/worker/front/phones/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - -
- - - - - - - - - - - - - - - - - - - -
diff --git a/modules/worker/front/phones/index.js b/modules/worker/front/phones/index.js deleted file mode 100644 index 91d69ac16..000000000 --- a/modules/worker/front/phones/index.js +++ /dev/null @@ -1,48 +0,0 @@ -import ngModule from '../module'; - -class Controller { - constructor($scope) { - this.$scope = $scope; - } - - get worker() { - return this._worker; - } - - set worker(value) { - this._worker = value; - if (value) - this.setLink(value); - } - - setLink(value) { - this.$scope.$applyAsync(()=> { - this.$scope.model.link = {userFk: value.userFk}; - this.$scope.model.refresh(); - }); - } - - onSubmit() { - this.$scope.watcher.check(); - return this.$scope.model.save().then(() => { - this.$scope.watcher.updateOriginalData(); - this.$scope.watcher.notifySaved(); - this.card.reload(); - }); - } - - add() { - this.$scope.model.insert(); - } -} - -Controller.$inject = ['$scope']; - -ngModule.component('vnWorkerPhones', { - template: require('./index.html'), - controller: Controller, - require: {card: '^vnWorkerCard'}, - bindings: { - worker: '<' - } -}); diff --git a/modules/worker/front/phones/index.spec.js b/modules/worker/front/phones/index.spec.js deleted file mode 100644 index e3f6f9bf5..000000000 --- a/modules/worker/front/phones/index.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Component vnWorkerPhones', () => { - let controller; - - beforeEach(ngModule('worker')); - - beforeEach(angular.mock.inject(($componentController, $rootScope) => { - let $scope = $rootScope.$new(); - controller = $componentController('vnWorkerPhones', $scope); - controller.$scope.watcher = watcher; - controller.$scope.model = { - link: 1, - save: () => {} - }; - controller.card = {reload: () => {}}; - })); - - describe('setLink()', () => { - it('set the link in the model and refreshes it', () => { - spyOn(controller.$scope, '$applyAsync'); - let value = {userFk: 106}; - controller.setLink(value); - - expect(controller.$scope.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); - }); - }); - - describe('onSubmit()', () => { - it('should call watcher functions, reload the card and save the model', done => { - spyOn(controller.$scope.watcher, 'check'); - spyOn(controller.$scope.model, 'save').and.returnValue(Promise.resolve()); - - spyOn(controller.$scope.watcher, 'updateOriginalData'); - spyOn(controller.$scope.watcher, 'notifySaved'); - spyOn(controller.card, 'reload'); - controller.onSubmit(); - controller.onSubmit().then(() => { - expect(controller.$scope.watcher.updateOriginalData).toHaveBeenCalledWith(); - expect(controller.$scope.watcher.notifySaved).toHaveBeenCalledWith(); - expect(controller.card.reload).toHaveBeenCalledWith(); - done(); - }).catch(done.fail); - }); - }); -}); diff --git a/modules/worker/front/phones/locale/es.yml b/modules/worker/front/phones/locale/es.yml deleted file mode 100644 index 8628f38ee..000000000 --- a/modules/worker/front/phones/locale/es.yml +++ /dev/null @@ -1,4 +0,0 @@ -Phones: Teléfonos -Type: Tipo -Remove phone: Eliminar teléfono -Add phone: Añadir teléfono \ No newline at end of file diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json index 6414c9ed2..d7eded94b 100644 --- a/modules/worker/front/routes.json +++ b/modules/worker/front/routes.json @@ -13,7 +13,6 @@ {"state": "worker.card.pbx", "icon": "icon-pbx"}, {"state": "worker.card.calendar", "icon": "icon-calendar"}, {"state": "worker.card.timeControl", "icon": "access_time"}, - {"state": "worker.card.phones", "icon": "contact_phone"}, {"state": "worker.card.dms.index", "icon": "cloud_upload"} ] }, @@ -84,16 +83,6 @@ "description": "Departments", "acl": ["hr"] }, { - "url": "/phones", - "state": "worker.card.phones", - "component": "vn-worker-phones", - "description": "Phones", - "params": { - "worker": "$ctrl.worker" - }, - "acl": ["hr"] - }, - { "url": "/dms", "state": "worker.card.dms", "abstract": true, diff --git a/modules/worker/front/summary/index.html b/modules/worker/front/summary/index.html index de86c1f84..e2c93ea48 100644 --- a/modules/worker/front/summary/index.html +++ b/modules/worker/front/summary/index.html @@ -12,9 +12,8 @@ - + diff --git a/modules/worker/front/summary/index.js b/modules/worker/front/summary/index.js index f055a0903..a3fbb34f5 100644 --- a/modules/worker/front/summary/index.js +++ b/modules/worker/front/summary/index.js @@ -50,12 +50,6 @@ class Controller { relation: 'department' } } - }, { - relation: 'phones', - scope: { - fields: ['phone'], - order: 'typeFk ASC' - } } ] }; diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index c355138c3..13829e0c5 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -77,16 +77,63 @@ class Controller extends Component { {timed: {lte: this.ended}} ]} }; - this.$.model.applyFilter(filter, params); - - this.getAbsences(); - this.getWorkedHours(this.started, this.ended); + this.$.model.applyFilter(filter, params).then(() => { + this.getWorkedHours(this.started, this.ended); + this.getAbsences(); + }); } hasEvents(day) { return day >= this.started && day < this.ended; } + getAbsences() { + let params = { + workerFk: this.$params.id, + started: this.started, + ended: this.ended + }; + + return this.$http.get(`WorkerCalendars/absences`, {params}) + .then(res => this.onData(res.data)); + } + + onData(data) { + const events = {}; + + let addEvent = (day, event) => { + events[new Date(day).getTime()] = event; + }; + + if (data.holidays) { + data.holidays.forEach(holiday => { + const holidayDetail = holiday.detail && holiday.detail.description; + const holidayType = holiday.type && holiday.type.name; + const holidayName = holidayDetail || holidayType; + + addEvent(holiday.dated, { + name: holidayName, + color: '#ff0' + }); + }); + } + if (data.absences) { + data.absences.forEach(absence => { + const type = absence.absenceType; + addEvent(absence.dated, { + name: type.name, + color: type.rgb + }); + }); + } + + this.weekDays.forEach(day => { + const timestamp = day.dated.getTime(); + if (events[timestamp]) + day.event = events[timestamp]; + }); + } + getWorkedHours(from, to) { this.weekTotalHours = null; let weekTotalHours = 0; @@ -208,53 +255,6 @@ class Controller extends Component { this.vnApp.showSuccess(this.$t('Entry removed')); }); } - - getAbsences() { - let params = { - workerFk: this.$params.id, - started: this.started, - ended: this.ended - }; - - return this.$http.get(`WorkerCalendars/absences`, {params}) - .then(res => this.onData(res.data)); - } - - onData(data) { - const events = {}; - - let addEvent = (day, event) => { - events[new Date(day).getTime()] = event; - }; - - if (data.holidays) { - data.holidays.forEach(holiday => { - const holidayDetail = holiday.detail && holiday.detail.description; - const holidayType = holiday.type && holiday.type.name; - const holidayName = holidayDetail || holidayType; - - addEvent(holiday.dated, { - name: holidayName, - color: '#ff0' - }); - }); - } - if (data.absences) { - data.absences.forEach(absence => { - const type = absence.absenceType; - addEvent(absence.dated, { - name: type.name, - color: type.rgb - }); - }); - } - - this.weekDays.forEach(day => { - const timestamp = day.dated.getTime(); - if (events[timestamp]) - day.event = events[timestamp]; - }); - } } Controller.$inject = ['$element', '$scope', 'vnWeekDays']; diff --git a/package-lock.json b/package-lock.json index c51e1b9f3..ab01db432 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,19 +14,19 @@ } }, "@babel/core": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.0.tgz", - "integrity": "sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw==", + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.7.tgz", + "integrity": "sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ==", "dev": true, "requires": { "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.6.0", - "@babel/helpers": "^7.6.0", - "@babel/parser": "^7.6.0", - "@babel/template": "^7.6.0", - "@babel/traverse": "^7.6.0", - "@babel/types": "^7.6.0", - "convert-source-map": "^1.1.0", + "@babel/generator": "^7.7.7", + "@babel/helpers": "^7.7.4", + "@babel/parser": "^7.7.7", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4", + "convert-source-map": "^1.7.0", "debug": "^4.1.0", "json5": "^2.1.0", "lodash": "^4.17.13", @@ -44,6 +44,101 @@ "@babel/highlight": "^7.0.0" } }, + "@babel/generator": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz", + "integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -53,12 +148,6 @@ "ms": "^2.1.1" } }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -89,62 +178,364 @@ } }, "@babel/helper-annotate-as-pure": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz", - "integrity": "sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.4.tgz", + "integrity": "sha512-2BQmQgECKzYKFPpiycoF9tlb5HA4lrVyAmLLVK177EcQAqjVLciUb2/R+n1boQ9y5ENV3uz2ZqiNw7QMBBw1Og==", "dev": true, "requires": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz", - "integrity": "sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.7.4.tgz", + "integrity": "sha512-Biq/d/WtvfftWZ9Uf39hbPBYDUo986m5Bb4zhkeYDGUllF43D+nUe5M6Vuo6/8JDK/0YX/uBdeoQpyaNhNugZQ==", "dev": true, "requires": { - "@babel/helper-explode-assignable-expression": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-explode-assignable-expression": "^7.7.4", + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-call-delegate": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz", - "integrity": "sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.7.4.tgz", + "integrity": "sha512-8JH9/B7J7tCYJ2PpWVpw9JhPuEVHztagNVuQAFBVFYluRMlpG7F1CgKEgGeL6KFqcsIa92ZYVj6DSc0XwmN1ZA==", "dev": true, "requires": { - "@babel/helper-hoist-variables": "^7.4.4", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.4.4" - } - }, - "@babel/helper-define-map": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz", - "integrity": "sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.1.0", - "@babel/types": "^7.5.5", - "lodash": "^4.17.13" + "@babel/helper-hoist-variables": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4" }, "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/generator": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz", + "integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true } } }, - "@babel/helper-explode-assignable-expression": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz", - "integrity": "sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA==", + "@babel/helper-create-regexp-features-plugin": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.4.tgz", + "integrity": "sha512-Mt+jBKaxL0zfOIWrfQpnfYCN7/rS6GKx6CCCfuoqVVd+17R8zNDlzVYmIi9qyb2wOk002NsmSTDymkIygDUH7A==", "dev": true, "requires": { - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.6.0" + } + }, + "@babel/helper-define-map": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.7.4.tgz", + "integrity": "sha512-v5LorqOa0nVQUvAUTUF3KPastvUt/HzByXNamKQ6RdJRTV7j8rLL+WB5C/MzzWAwOomxDhYFb1wLLxHqox86lg==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.7.4", + "@babel/types": "^7.7.4", + "lodash": "^4.17.13" + }, + "dependencies": { + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.7.4.tgz", + "integrity": "sha512-2/SicuFrNSXsZNBxe5UGdLr+HZg+raWBLE9vC98bdYOKX/U6PY0mdGlYUJdtTDPSU0Lw0PNbKKDpwYHJLn2jLg==", + "dev": true, + "requires": { + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/generator": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz", + "integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "@babel/helper-function-name": { @@ -168,61 +559,144 @@ } }, "@babel/helper-hoist-variables": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz", - "integrity": "sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.4.tgz", + "integrity": "sha512-wQC4xyvc1Jo/FnLirL6CEgPgPCa8M74tOdjWpRhQYapz5JC7u3NYU1zCVoVAGCE3EaIP9T1A3iW0WLJ+reZlpQ==", "dev": true, "requires": { - "@babel/types": "^7.4.4" + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-member-expression-to-functions": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz", - "integrity": "sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.7.4.tgz", + "integrity": "sha512-9KcA1X2E3OjXl/ykfMMInBK+uVdfIVakVe7W7Lg3wfXUNyS3Q1HWLFRwZIjhqiCGbslummPDnmb7vIekS0C1vw==", "dev": true, "requires": { - "@babel/types": "^7.5.5" + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-module-imports": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz", - "integrity": "sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.7.4.tgz", + "integrity": "sha512-dGcrX6K9l8258WFjyDLJwuVKxR4XZfU0/vTUgOQYWEnRD8mgr+p4d6fCUMq/ys0h4CCt/S5JhbvtyErjWouAUQ==", "dev": true, "requires": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-module-transforms": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.5.5.tgz", - "integrity": "sha512-jBeCvETKuJqeiaCdyaheF40aXnnU1+wkSiUs/IQg3tB85up1LyL8x77ClY8qJpuRJUcXQo+ZtdNESmZl4j56Pw==", + "version": "7.7.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.7.5.tgz", + "integrity": "sha512-A7pSxyJf1gN5qXVcidwLWydjftUN878VkalhXX5iQDuGyiGK3sOrrKKHF4/A4fwHtnsotv/NipwAeLzY4KQPvw==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/template": "^7.4.4", - "@babel/types": "^7.5.5", + "@babel/helper-module-imports": "^7.7.4", + "@babel/helper-simple-access": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4", "lodash": "^4.17.13" }, "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } } } }, "@babel/helper-optimise-call-expression": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz", - "integrity": "sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.4.tgz", + "integrity": "sha512-VB7gWZ2fDkSuqW6b1AKXkJWO5NyNI3bFL/kK79/30moK57blr6NbH8xcl2XcKCwOmJosftWunZqfO84IGq3ZZg==", "dev": true, "requires": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-plugin-utils": { @@ -238,49 +712,297 @@ "dev": true, "requires": { "lodash": "^4.17.13" + } + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.4.tgz", + "integrity": "sha512-Sk4xmtVdM9sA/jCI80f+KS+Md+ZHIpjuqmYPk1M7F/upHou5e4ReYmExAiu6PVe65BhJPZA2CY9x9k4BqE5klw==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.7.4", + "@babel/helper-wrap-function": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4" }, "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "@babel/generator": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz", + "integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + } + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true } } }, - "@babel/helper-remap-async-to-generator": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz", - "integrity": "sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-wrap-function": "^7.1.0", - "@babel/template": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, "@babel/helper-replace-supers": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz", - "integrity": "sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.7.4.tgz", + "integrity": "sha512-pP0tfgg9hsZWo5ZboYGuBn/bbYT/hdLPVSS4NMmiRJdwWhP0IznPwN9AE1JwyGsjSPLC364I0Qh5p+EPkGPNpg==", "dev": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.5.5", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5" + "@babel/helper-member-expression-to-functions": "^7.7.4", + "@babel/helper-optimise-call-expression": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/generator": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz", + "integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "@babel/helper-simple-access": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz", - "integrity": "sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.7.4.tgz", + "integrity": "sha512-zK7THeEXfan7UlWsG2A6CI/L9jVnI5+xxKZOdej39Y0YtDYKx9raHk5F2EtK9K8DHRTihYwg20ADt9S36GR78A==", "dev": true, "requires": { - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-split-export-declaration": { @@ -293,26 +1015,254 @@ } }, "@babel/helper-wrap-function": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz", - "integrity": "sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.7.4.tgz", + "integrity": "sha512-VsfzZt6wmsocOaVU0OokwrIytHND55yvyT4BPB9AIIgwr8+x7617hetdJTsuGwygN5RC6mxA9EJztTjuwm2ofg==", "dev": true, "requires": { - "@babel/helper-function-name": "^7.1.0", - "@babel/template": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.2.0" + "@babel/helper-function-name": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/generator": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz", + "integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + } + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "@babel/helpers": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.6.0.tgz", - "integrity": "sha512-W9kao7OBleOjfXtFGgArGRX6eCP0UEcA2ZWEWNkJdRZnHhW4eEbeswbG3EwaRsnQUAEGWYgMq1HsIXuNNNy2eQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.7.4.tgz", + "integrity": "sha512-ak5NGZGJ6LV85Q1Zc9gn2n+ayXOizryhjSUBTdu5ih1tlVCJeuQENzc4ItyCVhINVXvIT/ZQ4mheGIsfBkpskg==", "dev": true, "requires": { - "@babel/template": "^7.6.0", - "@babel/traverse": "^7.6.0", - "@babel/types": "^7.6.0" + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4" + }, + "dependencies": { + "@babel/generator": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz", + "integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + } + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "@babel/highlight": { @@ -333,89 +1283,99 @@ "dev": true }, "@babel/plugin-proposal-async-generator-functions": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz", - "integrity": "sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.4.tgz", + "integrity": "sha512-1ypyZvGRXriY/QP668+s8sFr2mqinhkRDMPSQLNghCQE+GAkFtp+wkHVvg2+Hdki8gwP+NFzJBJ/N1BfzCCDEw==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0", - "@babel/plugin-syntax-async-generators": "^7.2.0" + "@babel/helper-remap-async-to-generator": "^7.7.4", + "@babel/plugin-syntax-async-generators": "^7.7.4" } }, "@babel/plugin-proposal-dynamic-import": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz", - "integrity": "sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.7.4.tgz", + "integrity": "sha512-StH+nGAdO6qDB1l8sZ5UBV8AC3F2VW2I8Vfld73TMKyptMU9DY5YsJAS8U81+vEtxcH3Y/La0wG0btDrhpnhjQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0" + "@babel/plugin-syntax-dynamic-import": "^7.7.4" } }, "@babel/plugin-proposal-json-strings": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz", - "integrity": "sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.7.4.tgz", + "integrity": "sha512-wQvt3akcBTfLU/wYoqm/ws7YOAQKu8EVJEvHip/mzkNtjaclQoCCIqKXFP5/eyfnfbQCDV3OLRIK3mIVyXuZlw==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-json-strings": "^7.2.0" + "@babel/plugin-syntax-json-strings": "^7.7.4" } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz", - "integrity": "sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw==", + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz", + "integrity": "sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0" + "@babel/plugin-syntax-object-rest-spread": "^7.7.4" + }, + "dependencies": { + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.7.4.tgz", + "integrity": "sha512-mObR+r+KZq0XhRVS2BrBKBpr5jqrqzlPvS9C9vuOf5ilSwzloAl7RPWLrgKdWS6IreaVrjHxTjtyqFiOisaCwg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + } } }, "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz", - "integrity": "sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.7.4.tgz", + "integrity": "sha512-DyM7U2bnsQerCQ+sejcTNZh8KQEUuC3ufzdnVnSiUv/qoGJp2Z3hanKL18KDhsBT5Wj6a7CMT5mdyCNJsEaA9w==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding": "^7.7.4" } }, "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz", - "integrity": "sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA==", + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.7.tgz", + "integrity": "sha512-80PbkKyORBUVm1fbTLrHpYdJxMThzM1UqFGh0ALEhO9TYbG86Ah9zQYAB/84axz2vcxefDLdZwWwZNlYARlu9w==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.7.4", + "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-syntax-async-generators": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz", - "integrity": "sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.7.4.tgz", + "integrity": "sha512-Li4+EjSpBgxcsmeEF8IFcfV/+yJGxHXDirDkEoyFjumuwbmfCVHUt0HuowD/iGM7OhIRyXJH9YXxqiH6N815+g==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-syntax-dynamic-import": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz", - "integrity": "sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.7.4.tgz", + "integrity": "sha512-jHQW0vbRGvwQNgyVxwDh4yuXu4bH1f5/EICJLAhl1SblLs2CDhrsmCk+v5XLdE9wxtAFRyxx+P//Iw+a5L/tTg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-syntax-json-strings": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz", - "integrity": "sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.7.4.tgz", + "integrity": "sha512-QpGupahTQW1mHRXddMG5srgpHWqRLwJnJZKXTigB9RPFCCGbDGCgBeM/iC82ICXp414WeYx/tD54w7M2qRqTMg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" @@ -431,294 +1391,425 @@ } }, "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz", - "integrity": "sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.7.4.tgz", + "integrity": "sha512-4ZSuzWgFxqHRE31Glu+fEr/MirNZOMYmD/0BhBWyLyOOQz/gTAl7QmWm2hX1QxEIXsr2vkdlwxIzTyiYRC4xcQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.4.tgz", + "integrity": "sha512-wdsOw0MvkL1UIgiQ/IFr3ETcfv1xb8RMM0H9wbiDyLaJFyiDg5oZvDLCXosIXmFeIlweML5iOBXAkqddkYNizg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-arrow-functions": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz", - "integrity": "sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.7.4.tgz", + "integrity": "sha512-zUXy3e8jBNPiffmqkHRNDdZM2r8DWhCB7HhcoyZjiK1TxYEluLHAvQuYnTT+ARqRpabWqy/NHkO6e3MsYB5YfA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-async-to-generator": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz", - "integrity": "sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.4.tgz", + "integrity": "sha512-zpUTZphp5nHokuy8yLlyafxCJ0rSlFoSHypTUWgpdwoDXWQcseaect7cJ8Ppk6nunOM6+5rPMkod4OYKPR5MUg==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-module-imports": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0" + "@babel/helper-remap-async-to-generator": "^7.7.4" } }, "@babel/plugin-transform-block-scoped-functions": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz", - "integrity": "sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.7.4.tgz", + "integrity": "sha512-kqtQzwtKcpPclHYjLK//3lH8OFsCDuDJBaFhVwf8kqdnF6MN4l618UDlcA7TfRs3FayrHj+svYnSX8MC9zmUyQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-block-scoping": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.0.tgz", - "integrity": "sha512-tIt4E23+kw6TgL/edACZwP1OUKrjOTyMrFMLoT5IOFrfMRabCgekjqFd5o6PaAMildBu46oFkekIdMuGkkPEpA==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.7.4.tgz", + "integrity": "sha512-2VBe9u0G+fDt9B5OV5DQH4KBf5DoiNkwFKOz0TCvBWvdAN2rOykCTkrL+jTLxfCAm76l9Qo5OqL7HBOx2dWggg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", "lodash": "^4.17.13" - }, - "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - } } }, "@babel/plugin-transform-classes": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.5.5.tgz", - "integrity": "sha512-U2htCNK/6e9K7jGyJ++1p5XRU+LJjrwtoiVn9SzRlDT2KubcZ11OOwy3s24TjHxPgxNwonCYP7U2K51uVYCMDg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.4.tgz", + "integrity": "sha512-sK1mjWat7K+buWRuImEzjNf68qrKcrddtpQo3swi9j7dUcG6y6R6+Di039QN2bD1dykeswlagupEmpOatFHHUg==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-define-map": "^7.5.5", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/helper-annotate-as-pure": "^7.7.4", + "@babel/helper-define-map": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-optimise-call-expression": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5", - "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/helper-replace-supers": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", "globals": "^11.1.0" + }, + "dependencies": { + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/plugin-transform-computed-properties": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz", - "integrity": "sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.7.4.tgz", + "integrity": "sha512-bSNsOsZnlpLLyQew35rl4Fma3yKWqK3ImWMSC/Nc+6nGjC9s5NFWAer1YQ899/6s9HxO2zQC1WoFNfkOqRkqRQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-destructuring": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz", - "integrity": "sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.7.4.tgz", + "integrity": "sha512-4jFMXI1Cu2aXbcXXl8Lr6YubCn6Oc7k9lLsu8v61TZh+1jny2BWmdtvY9zSUlLdGUvcy9DMAWyZEOqjsbeg/wA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-dotall-regex": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz", - "integrity": "sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg==", + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.7.tgz", + "integrity": "sha512-b4in+YlTeE/QmTgrllnb3bHA0HntYvjz8O3Mcbx75UBPJA2xhb5A8nle498VhxSXJHQefjtQxpnLPehDJ4TRlg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.7.4", + "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-duplicate-keys": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz", - "integrity": "sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.7.4.tgz", + "integrity": "sha512-g1y4/G6xGWMD85Tlft5XedGaZBCIVN+/P0bs6eabmcPP9egFleMAo65OOjlhcz1njpwagyY3t0nsQC9oTFegJA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-exponentiation-operator": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz", - "integrity": "sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.7.4.tgz", + "integrity": "sha512-MCqiLfCKm6KEA1dglf6Uqq1ElDIZwFuzz1WH5mTf8k2uQSxEJMbOIEh7IZv7uichr7PMfi5YVSrr1vz+ipp7AQ==", "dev": true, "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.1.0", + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-for-of": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz", - "integrity": "sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.7.4.tgz", + "integrity": "sha512-zZ1fD1B8keYtEcKF+M1TROfeHTKnijcVQm0yO/Yu1f7qoDoxEIc/+GX6Go430Bg84eM/xwPFp0+h4EbZg7epAA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-function-name": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz", - "integrity": "sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.4.tgz", + "integrity": "sha512-E/x09TvjHNhsULs2IusN+aJNRV5zKwxu1cpirZyRPw+FyyIKEHPXTsadj48bVpc1R5Qq1B5ZkzumuFLytnbT6g==", "dev": true, "requires": { - "@babel/helper-function-name": "^7.1.0", + "@babel/helper-function-name": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0" + }, + "dependencies": { + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/parser": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz", + "integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/plugin-transform-literals": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz", - "integrity": "sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.7.4.tgz", + "integrity": "sha512-X2MSV7LfJFm4aZfxd0yLVFrEXAgPqYoDG53Br/tCKiKYfX0MjVjQeWPIhPHHsCqzwQANq+FLN786fF5rgLS+gw==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-member-expression-literals": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz", - "integrity": "sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.7.4.tgz", + "integrity": "sha512-9VMwMO7i69LHTesL0RdGy93JU6a+qOPuvB4F4d0kR0zyVjJRVJRaoaGjhtki6SzQUu8yen/vxPKN6CWnCUw6bA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-modules-amd": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz", - "integrity": "sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg==", + "version": "7.7.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.7.5.tgz", + "integrity": "sha512-CT57FG4A2ZUNU1v+HdvDSDrjNWBrtCmSH6YbbgN3Lrf0Di/q/lWRxZrE72p3+HCCz9UjfZOEBdphgC0nzOS6DQ==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-module-transforms": "^7.7.5", "@babel/helper-plugin-utils": "^7.0.0", "babel-plugin-dynamic-import-node": "^2.3.0" } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.6.0.tgz", - "integrity": "sha512-Ma93Ix95PNSEngqomy5LSBMAQvYKVe3dy+JlVJSHEXZR5ASL9lQBedMiCyVtmTLraIDVRE3ZjTZvmXXD2Ozw3g==", + "version": "7.7.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.5.tgz", + "integrity": "sha512-9Cq4zTFExwFhQI6MT1aFxgqhIsMWQWDVwOgLzl7PTWJHsNaqFvklAU+Oz6AQLAS0dJKTwZSOCo20INwktxpi3Q==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.4.4", + "@babel/helper-module-transforms": "^7.7.5", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", + "@babel/helper-simple-access": "^7.7.4", "babel-plugin-dynamic-import-node": "^2.3.0" } }, "@babel/plugin-transform-modules-systemjs": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz", - "integrity": "sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.4.tgz", + "integrity": "sha512-y2c96hmcsUi6LrMqvmNDPBBiGCiQu0aYqpHatVVu6kD4mFEXKjyNxd/drc18XXAf9dv7UXjrZwBVmTTGaGP8iw==", "dev": true, "requires": { - "@babel/helper-hoist-variables": "^7.4.4", + "@babel/helper-hoist-variables": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0", "babel-plugin-dynamic-import-node": "^2.3.0" } }, "@babel/plugin-transform-modules-umd": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz", - "integrity": "sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.4.tgz", + "integrity": "sha512-u2B8TIi0qZI4j8q4C51ktfO7E3cQ0qnaXFI1/OXITordD40tt17g/sXqgNNCcMTcBFKrUPcGDx+TBJuZxLx7tw==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-module-transforms": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.0.tgz", - "integrity": "sha512-jem7uytlmrRl3iCAuQyw8BpB4c4LWvSpvIeXKpMb+7j84lkx4m4mYr5ErAcmN5KM7B6BqrAvRGjBIbbzqCczew==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.4.tgz", + "integrity": "sha512-jBUkiqLKvUWpv9GLSuHUFYdmHg0ujC1JEYoZUfeOOfNydZXp1sXObgyPatpcwjWgsdBGsagWW0cdJpX/DO2jMw==", "dev": true, "requires": { - "regexp-tree": "^0.1.13" + "@babel/helper-create-regexp-features-plugin": "^7.7.4" } }, "@babel/plugin-transform-new-target": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz", - "integrity": "sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.7.4.tgz", + "integrity": "sha512-CnPRiNtOG1vRodnsyGX37bHQleHE14B9dnnlgSeEs3ek3fHN1A1SScglTCg1sfbe7sRQ2BUcpgpTpWSfMKz3gg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-object-super": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz", - "integrity": "sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.7.4.tgz", + "integrity": "sha512-ho+dAEhC2aRnff2JCA0SAK7V2R62zJd/7dmtoe7MHcso4C2mS+vZjn1Pb1pCVZvJs1mgsvv5+7sT+m3Bysb6eg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5" + "@babel/helper-replace-supers": "^7.7.4" } }, "@babel/plugin-transform-parameters": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz", - "integrity": "sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw==", + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.7.tgz", + "integrity": "sha512-OhGSrf9ZBrr1fw84oFXj5hgi8Nmg+E2w5L7NhnG0lPvpDtqd7dbyilM2/vR8CKbJ907RyxPh2kj6sBCSSfI9Ew==", "dev": true, "requires": { - "@babel/helper-call-delegate": "^7.4.4", - "@babel/helper-get-function-arity": "^7.0.0", + "@babel/helper-call-delegate": "^7.7.4", + "@babel/helper-get-function-arity": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0" + }, + "dependencies": { + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/plugin-transform-property-literals": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz", - "integrity": "sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz", + "integrity": "sha512-MatJhlC4iHsIskWYyawl53KuHrt+kALSADLQQ/HkhTjX954fkxIEh4q5slL4oRAnsm/eDoZ4q0CIZpcqBuxhJQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-regenerator": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz", - "integrity": "sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA==", + "version": "7.7.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.5.tgz", + "integrity": "sha512-/8I8tPvX2FkuEyWbjRCt4qTAgZK0DVy8QRguhA524UH48RfGJy94On2ri+dCuwOpcerPRl9O4ebQkRcVzIaGBw==", "dev": true, "requires": { "regenerator-transform": "^0.14.0" } }, "@babel/plugin-transform-reserved-words": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz", - "integrity": "sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.7.4.tgz", + "integrity": "sha512-OrPiUB5s5XvkCO1lS7D8ZtHcswIC57j62acAnJZKqGGnHP+TIc/ljQSrgdX/QyOTdEK5COAhuc820Hi1q2UgLQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-shorthand-properties": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz", - "integrity": "sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.7.4.tgz", + "integrity": "sha512-q+suddWRfIcnyG5YiDP58sT65AJDZSUhXQDZE3r04AuqD6d/XLaQPPXSBzP2zGerkgBivqtQm9XKGLuHqBID6Q==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-spread": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz", - "integrity": "sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.7.4.tgz", + "integrity": "sha512-8OSs0FLe5/80cndziPlg4R0K6HcWSM0zyNhHhLsmw/Nc5MaA49cAsnoJ/t/YZf8qkG7fD+UjTRaApVDB526d7Q==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-sticky-regex": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz", - "integrity": "sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.7.4.tgz", + "integrity": "sha512-Ls2NASyL6qtVe1H1hXts9yuEeONV2TJZmplLONkMPUG158CtmnrzW5Q5teibM5UVOFjG0D3IC5mzXR6pPpUY7A==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", @@ -726,39 +1817,38 @@ } }, "@babel/plugin-transform-template-literals": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz", - "integrity": "sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.7.4.tgz", + "integrity": "sha512-sA+KxLwF3QwGj5abMHkHgshp9+rRz+oY9uoRil4CyLtgEuE/88dpkeWgNk5qKVsJE9iSfly3nvHapdRiIS2wnQ==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-annotate-as-pure": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-typeof-symbol": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz", - "integrity": "sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.7.4.tgz", + "integrity": "sha512-KQPUQ/7mqe2m0B8VecdyaW5XcQYaePyl9R7IsKd+irzj6jvbhoGnRE+M0aNkyAzI07VfUQ9266L5xMARitV3wg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-unicode-regex": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz", - "integrity": "sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.4.tgz", + "integrity": "sha512-N77UUIV+WCvE+5yHw+oks3m18/umd7y392Zv7mYTpFqHtkpcc+QUz+gLJNTWVlWROIWeLqY0f3OjZxV5TcXnRw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.7.4", + "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/polyfill": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz", - "integrity": "sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg==", + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.7.0.tgz", + "integrity": "sha512-/TS23MVvo34dFmf8mwCisCbWGrfhbiWZSwBo6HkADTBhUa2Q/jWltyY/tpofz/b6/RIhqaqQcquptCirqIhOaQ==", "dev": true, "requires": { "core-js": "^2.6.5", @@ -766,90 +1856,122 @@ }, "dependencies": { "regenerator-runtime": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", - "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==", + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==", "dev": true } } }, "@babel/preset-env": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.6.0.tgz", - "integrity": "sha512-1efzxFv/TcPsNXlRhMzRnkBFMeIqBBgzwmZwlFDw5Ubj0AGLeufxugirwZmkkX/ayi3owsSqoQ4fw8LkfK9SYg==", + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.7.7.tgz", + "integrity": "sha512-pCu0hrSSDVI7kCVUOdcMNQEbOPJ52E+LrQ14sN8uL2ALfSqePZQlKrOy+tM4uhEdYlCHi4imr8Zz2cZe9oSdIg==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-module-imports": "^7.7.4", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-dynamic-import": "^7.5.0", - "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", - "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-syntax-async-generators": "^7.2.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-syntax-json-strings": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", - "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.5.0", - "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.6.0", - "@babel/plugin-transform-classes": "^7.5.5", - "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.6.0", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/plugin-transform-duplicate-keys": "^7.5.0", - "@babel/plugin-transform-exponentiation-operator": "^7.2.0", - "@babel/plugin-transform-for-of": "^7.4.4", - "@babel/plugin-transform-function-name": "^7.4.4", - "@babel/plugin-transform-literals": "^7.2.0", - "@babel/plugin-transform-member-expression-literals": "^7.2.0", - "@babel/plugin-transform-modules-amd": "^7.5.0", - "@babel/plugin-transform-modules-commonjs": "^7.6.0", - "@babel/plugin-transform-modules-systemjs": "^7.5.0", - "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.6.0", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/plugin-transform-object-super": "^7.5.5", - "@babel/plugin-transform-parameters": "^7.4.4", - "@babel/plugin-transform-property-literals": "^7.2.0", - "@babel/plugin-transform-regenerator": "^7.4.5", - "@babel/plugin-transform-reserved-words": "^7.2.0", - "@babel/plugin-transform-shorthand-properties": "^7.2.0", - "@babel/plugin-transform-spread": "^7.2.0", - "@babel/plugin-transform-sticky-regex": "^7.2.0", - "@babel/plugin-transform-template-literals": "^7.4.4", - "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-unicode-regex": "^7.4.4", - "@babel/types": "^7.6.0", + "@babel/plugin-proposal-async-generator-functions": "^7.7.4", + "@babel/plugin-proposal-dynamic-import": "^7.7.4", + "@babel/plugin-proposal-json-strings": "^7.7.4", + "@babel/plugin-proposal-object-rest-spread": "^7.7.7", + "@babel/plugin-proposal-optional-catch-binding": "^7.7.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.7.7", + "@babel/plugin-syntax-async-generators": "^7.7.4", + "@babel/plugin-syntax-dynamic-import": "^7.7.4", + "@babel/plugin-syntax-json-strings": "^7.7.4", + "@babel/plugin-syntax-object-rest-spread": "^7.7.4", + "@babel/plugin-syntax-optional-catch-binding": "^7.7.4", + "@babel/plugin-syntax-top-level-await": "^7.7.4", + "@babel/plugin-transform-arrow-functions": "^7.7.4", + "@babel/plugin-transform-async-to-generator": "^7.7.4", + "@babel/plugin-transform-block-scoped-functions": "^7.7.4", + "@babel/plugin-transform-block-scoping": "^7.7.4", + "@babel/plugin-transform-classes": "^7.7.4", + "@babel/plugin-transform-computed-properties": "^7.7.4", + "@babel/plugin-transform-destructuring": "^7.7.4", + "@babel/plugin-transform-dotall-regex": "^7.7.7", + "@babel/plugin-transform-duplicate-keys": "^7.7.4", + "@babel/plugin-transform-exponentiation-operator": "^7.7.4", + "@babel/plugin-transform-for-of": "^7.7.4", + "@babel/plugin-transform-function-name": "^7.7.4", + "@babel/plugin-transform-literals": "^7.7.4", + "@babel/plugin-transform-member-expression-literals": "^7.7.4", + "@babel/plugin-transform-modules-amd": "^7.7.5", + "@babel/plugin-transform-modules-commonjs": "^7.7.5", + "@babel/plugin-transform-modules-systemjs": "^7.7.4", + "@babel/plugin-transform-modules-umd": "^7.7.4", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.4", + "@babel/plugin-transform-new-target": "^7.7.4", + "@babel/plugin-transform-object-super": "^7.7.4", + "@babel/plugin-transform-parameters": "^7.7.7", + "@babel/plugin-transform-property-literals": "^7.7.4", + "@babel/plugin-transform-regenerator": "^7.7.5", + "@babel/plugin-transform-reserved-words": "^7.7.4", + "@babel/plugin-transform-shorthand-properties": "^7.7.4", + "@babel/plugin-transform-spread": "^7.7.4", + "@babel/plugin-transform-sticky-regex": "^7.7.4", + "@babel/plugin-transform-template-literals": "^7.7.4", + "@babel/plugin-transform-typeof-symbol": "^7.7.4", + "@babel/plugin-transform-unicode-regex": "^7.7.4", + "@babel/types": "^7.7.4", "browserslist": "^4.6.0", - "core-js-compat": "^3.1.1", + "core-js-compat": "^3.6.0", "invariant": "^2.2.2", "js-levenshtein": "^1.1.3", "semver": "^5.5.0" + }, + "dependencies": { + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.7.4.tgz", + "integrity": "sha512-mObR+r+KZq0XhRVS2BrBKBpr5jqrqzlPvS9C9vuOf5ilSwzloAl7RPWLrgKdWS6IreaVrjHxTjtyqFiOisaCwg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/register": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.4.4.tgz", - "integrity": "sha512-sn51H88GRa00+ZoMqCVgOphmswG4b7mhf9VOB0LUBAieykq2GnRFerlN+JQkO/ntT7wz4jaHNSRPg9IdMPEUkA==", + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.7.7.tgz", + "integrity": "sha512-S2mv9a5dc2pcpg/ConlKZx/6wXaEwHeqfo7x/QbXsdCAZm+WJC1ekVvL1TVxNsedTs5y/gG63MhJTEsmwmjtiA==", "dev": true, "requires": { - "core-js": "^3.0.0", "find-cache-dir": "^2.0.0", - "lodash": "^4.17.11", - "mkdirp": "^0.5.1", + "lodash": "^4.17.13", + "make-dir": "^2.1.0", "pirates": "^4.0.0", - "source-map-support": "^0.5.9" + "source-map-support": "^0.5.16" }, "dependencies": { - "core-js": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.1.4.tgz", - "integrity": "sha512-YNZN8lt82XIMLnLirj9MhKDFZHalwzzrL9YLt6eb0T5D0EDl4IQ90IGkua8mHbnxNrkj1d8hbdizMc0Qmg1WnQ==", + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true + }, + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } } } }, @@ -942,77 +2064,6 @@ "minimist": "^1.2.0" } }, - "@electron/get": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.7.1.tgz", - "integrity": "sha512-+BOIzkmYbe+oOBGqSByq8zXYXCFztccoymR3uNkvX5ckJ/5xU+4peVyEvFyH6+zfv58hCo99RxgIpwuaMfRtRg==", - "requires": { - "debug": "^4.1.1", - "env-paths": "^2.2.0", - "fs-extra": "^8.1.0", - "global-agent": "^2.0.2", - "global-tunnel-ng": "^2.7.1", - "got": "^9.6.0", - "sanitize-filename": "^1.6.2", - "sumchecker": "^3.0.0" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" - }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "requires": { - "prepend-http": "^2.0.0" - } - } - } - }, "@google-cloud/common": { "version": "0.32.1", "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.32.1.tgz", @@ -1087,14 +2138,6 @@ "xdg-basedir": "^3.0.0" }, "dependencies": { - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "requires": { - "lodash": "^4.17.11" - } - }, "mime": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", @@ -1364,19 +2407,6 @@ "resolved": "https://registry.npmjs.org/@kyleshockey/object-assign-deep/-/object-assign-deep-0.4.2.tgz", "integrity": "sha1-hJAPDu/DcnmPR1G1JigwuCCJIuw=" }, - "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" - }, - "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "requires": { - "defer-to-connect": "^1.0.1" - } - }, "@types/babel__core": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz", @@ -1465,14 +2495,6 @@ "@types/range-parser": "*" } }, - "@types/form-data": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", - "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", - "requires": { - "@types/node": "*" - } - }, "@types/glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", @@ -1531,14 +2553,26 @@ "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==" }, "@types/request": { - "version": "2.48.1", - "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.1.tgz", - "integrity": "sha512-ZgEZ1TiD+KGA9LiAAPPJL68Id2UWfeSO62ijSXZjFJArVV+2pKcsVHmrcu+1oiE3q6eDGiFiSolRc4JHoerBBg==", + "version": "2.48.4", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.4.tgz", + "integrity": "sha512-W1t1MTKYR8PxICH+A4HgEIPuAC3sbljoEVfyZbeFJJDbr30guDspJri2XOaM2E+Un7ZjrihaDi7cf6fPa2tbgw==", "requires": { "@types/caseless": "*", - "@types/form-data": "*", "@types/node": "*", - "@types/tough-cookie": "*" + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + }, + "dependencies": { + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } } }, "@types/serve-static": { @@ -1557,9 +2591,9 @@ "dev": true }, "@types/tough-cookie": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.5.tgz", - "integrity": "sha512-SCcK7mvGi3+ZNz833RRjFIxrn4gI1PPR3NtuIS+6vMkvmsGjosqTJwRt5bAEFLRz+wtJMWv8+uOnZf2hi2QXTg==" + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.6.tgz", + "integrity": "sha512-wHNBMnkoEBiRAd3s8KTKwIuO9biFtTf0LehITzBhSco+HQI0xkXZbLOD55SW3Aqw3oUkHstkm5SPv58yaAdFPQ==" }, "@types/yargs": { "version": "13.0.2", @@ -1782,7 +2816,8 @@ "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true }, "abort-controller": { "version": "3.0.0", @@ -1816,12 +2851,6 @@ "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==", "dev": true }, - "acorn-dynamic-import": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz", - "integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==", - "dev": true - }, "acorn-globals": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", @@ -1875,36 +2904,6 @@ "integrity": "sha512-aUjdRFISbuFOl0EIZc+9e4FfZp0bDZgAdOOf30bJmw8VM9v84SHyVyxDfbWxpGYbdZD/9XoKxfHVNmxPkhwyGw==", "dev": true }, - "ambi": { - "version": "2.5.0", - "resolved": "http://registry.npmjs.org/ambi/-/ambi-2.5.0.tgz", - "integrity": "sha1-fI43K+SIkRV+fOoBy2+RQ9H3QiA=", - "requires": { - "editions": "^1.1.1", - "typechecker": "^4.3.0" - }, - "dependencies": { - "typechecker": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/typechecker/-/typechecker-4.7.0.tgz", - "integrity": "sha512-4LHc1KMNJ6NDGO+dSM/yNfZQRtp8NN7psYrPHUblD62Dvkwsp3VShsbM78kOgpcmMkRTgvwdKOTjctS+uMllgQ==", - "requires": { - "editions": "^2.1.0" - }, - "dependencies": { - "editions": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/editions/-/editions-2.1.3.tgz", - "integrity": "sha512-xDZyVm0A4nLgMNWVVLJvcwMjI80ShiH/27RyLiCnW1L273TcJIA25C4pwJ33AWV01OX6UriP35Xu+lH4S7HWQw==", - "requires": { - "errlop": "^1.1.1", - "semver": "^5.6.0" - } - } - } - } - } - }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", @@ -1912,9 +2911,9 @@ "dev": true }, "angular-mocks": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/angular-mocks/-/angular-mocks-1.7.8.tgz", - "integrity": "sha512-LB13ESBT0eJrhQhfPXyLR9qm4LI9g44hyBFwUqZKEHEA4DpfxVTu0ONipiNoN0zWtmEAezA8u2gjcoaO2TStig==", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/angular-mocks/-/angular-mocks-1.7.9.tgz", + "integrity": "sha512-LQRqqiV3sZ7NTHBnNmLT0bXtE5e81t97+hkJ56oU0k3dqKv1s6F+nBWRlOVzqHWPGFOiPS8ZJVdrS8DFzHyNIA==", "dev": true }, "ansi-align": { @@ -2250,7 +3249,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -2283,9 +3282,12 @@ "dev": true }, "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "requires": { + "lodash": "^4.17.14" + } }, "async-done": { "version": "1.3.2", @@ -2346,13 +3348,13 @@ "dev": true }, "aws-sdk": { - "version": "2.487.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.487.0.tgz", - "integrity": "sha512-bdImYaIzvRL4nn8DEvI39VCrQYPDeC/PTYg++EBobhaFh8ksbsTzBnIFAn5IxtlRsXWUzaZVyOgRTGqiiS6YHA==", + "version": "2.610.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.610.0.tgz", + "integrity": "sha512-kqcoCTKjbxrUo2KeLQR2Jw6l4PvkbHXSDk8KqF2hXcpHibiOcMXZZPVe9X+s90RC/B2+qU95M7FImp9ByMcw7A==", "requires": { "buffer": "4.9.1", "events": "1.1.1", - "ieee754": "1.1.8", + "ieee754": "1.1.13", "jmespath": "0.15.0", "querystring": "0.2.0", "sax": "1.2.1", @@ -2361,10 +3363,29 @@ "xml2js": "0.4.19" }, "dependencies": { + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, "sax": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } } } }, @@ -3044,7 +4065,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -3234,12 +4255,6 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", "dev": true }, - "boolean": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.0.tgz", - "integrity": "sha512-OElxJ1lUSinuoUnkpOgLmxp0DC4ytEhODEL6QJU0NpxE/mI4rUSh8h1P1Wkvfi3xQEBcxXR2gBIPNYNuaFcAbQ==", - "optional": true - }, "bops": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/bops/-/bops-1.0.0.tgz", @@ -3250,9 +4265,9 @@ } }, "bowser": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.6.1.tgz", - "integrity": "sha512-hySGUuLhi0KetfxPZpuJOsjM0kRvCiCgPBygBkzGzJNsq/nbJmaO8QJc6xlWfeFFnMvtd/LeKkhDJGVrmVobUA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.8.1.tgz", + "integrity": "sha512-FxxltGKqMHkVa3KtpA+kdnxH0caHPDewccyrK3vW1bsMw6Zco4vRPmMunowX0pXlDZqhxkKSpToADQI2Sk4OeQ==" }, "boxen": { "version": "1.3.0", @@ -3416,14 +4431,14 @@ } }, "browserslist": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.7.0.tgz", - "integrity": "sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA==", + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.8.3.tgz", + "integrity": "sha512-iU43cMMknxG1ClEZ2MDKeonKE1CCrFVkQK2AqO2YWFmvIrx4JWrvQ4w4hQez6EpVI8rHTtqh/ruHHDHSOKxvUg==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000989", - "electron-to-chromium": "^1.3.247", - "node-releases": "^1.1.29" + "caniuse-lite": "^1.0.30001017", + "electron-to-chromium": "^1.3.322", + "node-releases": "^1.1.44" } }, "bser": { @@ -3525,9 +4540,9 @@ "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" }, "cacache": { - "version": "11.3.3", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-11.3.3.tgz", - "integrity": "sha512-p8WcneCytvzPxhDvYp31PD039vi77I12W+/KfR9S8AZbaiARFBCpsPJS+9uhWfeBfeAtW7o/4vt3MUqLkbY6nA==", + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz", + "integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==", "dev": true, "requires": { "bluebird": "^3.5.5", @@ -3535,6 +4550,7 @@ "figgy-pudding": "^3.5.1", "glob": "^7.1.4", "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", "lru-cache": "^5.1.1", "mississippi": "^3.0.0", "mkdirp": "^0.5.1", @@ -3546,24 +4562,10 @@ "y18n": "^4.0.0" }, "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "requires": { "glob": "^7.1.3" @@ -3580,7 +4582,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -3594,35 +4596,6 @@ "unset-value": "^1.0.0" } }, - "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "dependencies": { - "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" - } - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -3669,9 +4642,9 @@ "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" }, "caniuse-lite": { - "version": "1.0.30000989", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000989.tgz", - "integrity": "sha512-vrMcvSuMz16YY6GSVZ0dWDTJP8jqk3iFQ/Aq5iqblPwxSVVZI+zxDyTX0VPqtQsDnfdrBDcsmhgTEOh5R8Lbpw==", + "version": "1.0.30001019", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001019.tgz", + "integrity": "sha512-6ljkLtF1KM5fQ+5ZN0wuyVvvebJxgJPTmScOMaFuQN2QuOzvRJnWSKfzQskQU5IOU4Gap3zasYPIinzwUjoj/g==", "dev": true }, "canonical-json": { @@ -3753,9 +4726,9 @@ } }, "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", "dev": true }, "chrome-trace-event": { @@ -3786,7 +4759,7 @@ "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -3910,23 +4883,14 @@ "dev": true }, "clone-deep": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-2.0.2.tgz", - "integrity": "sha512-SZegPTKjCgpQH63E+eN6mVEEPdQBOUzjyJm5Pora4lrwWRFS8I0QAxV/KD6vV/i0WuijHZWQC1fMsPEdxfdVCQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", "dev": true, "requires": { - "for-own": "^1.0.0", "is-plain-object": "^2.0.4", - "kind-of": "^6.0.0", - "shallow-clone": "^1.0.0" - } - }, - "clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "requires": { - "mimic-response": "^1.0.0" + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" } }, "clone-stats": { @@ -4079,9 +5043,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", + "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -4107,16 +5071,6 @@ } } }, - "config-chain": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", - "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", - "optional": true, - "requires": { - "ini": "^1.3.4", - "proto-list": "~1.2.1" - } - }, "configstore": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", @@ -4128,6 +5082,21 @@ "unique-string": "^1.0.0", "write-file-atomic": "^2.0.0", "xdg-basedir": "^3.0.0" + }, + "dependencies": { + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "connect-history-api-fallback": { @@ -4137,13 +5106,10 @@ "dev": true }, "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "^0.1.4" - } + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", + "dev": true }, "console-control-strings": { "version": "1.1.0", @@ -4217,24 +5183,10 @@ "run-queue": "^1.0.0" }, "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "requires": { "glob": "^7.1.3" @@ -4264,19 +5216,19 @@ "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==" }, "core-js-compat": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.2.1.tgz", - "integrity": "sha512-MwPZle5CF9dEaMYdDeWm73ao/IflDH+FjeJCWEADcEgFSE9TLimFKwJsfmkwzI8eC0Aj0mgvMDjeQjrElkz4/A==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.6.2.tgz", + "integrity": "sha512-+G28dzfYGtAM+XGvB1C5AS1ZPKfQ47HLhcdeIQdZgQnJVdp7/D0m+W/TErwhgsX6CujRUk/LebB6dCrKrtJrvQ==", "dev": true, "requires": { - "browserslist": "^4.6.6", - "semver": "^6.3.0" + "browserslist": "^4.8.3", + "semver": "7.0.0" }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", "dev": true } } @@ -4393,11 +5345,6 @@ "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=" }, - "csextends": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/csextends/-/csextends-1.2.0.tgz", - "integrity": "sha512-S/8k1bDTJIwuGgQYmsRoE+8P+ohV32WhQ0l4zqrc0XDdxOhjQQD7/wTZwCzoZX53jSX3V/qwjT+OkPTxWQcmjg==" - }, "css-loader": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-2.1.1.tgz", @@ -4478,9 +5425,9 @@ } }, "cyclist": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", - "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", + "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", "dev": true }, "d": { @@ -4541,12 +5488,6 @@ "resolved": "https://registry.npmjs.org/date-and-time/-/date-and-time-0.6.3.tgz", "integrity": "sha512-lcWy3AXDRJOD7MplwZMmNSRM//kZtJaLz4n6D1P5z9wEmZGBKhJRBIr1Xs9KNQJmdXPblvgffynYji4iylUTcA==" }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, "dateformat": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", @@ -4573,23 +5514,6 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "deep-defaults": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/deep-defaults/-/deep-defaults-1.0.5.tgz", - "integrity": "sha512-5ev/sNkiHTmeTqbDJEDgdQa/Ub0eOMQNix9l+dLLGbwOos7/in5HdvHXI014wqxsET4YeJG9Eq4qj0PJRL8rSw==", - "dev": true, - "requires": { - "lodash": "^4.17.5" - } - }, "deep-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", @@ -4639,32 +5563,11 @@ "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", "dev": true }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - }, - "dependencies": { - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - } - } - }, - "defer-to-connect": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.0.tgz", - "integrity": "sha512-WE2sZoctWm/v4smfCAdjYbrfS55JiMRdlY9ZubFhsYbteCK9+BvAx4YV7nPjYM6ZnX5BcoVKwfmyx9sIFTgQMQ==" - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -4762,9 +5665,9 @@ "dev": true }, "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", "dev": true, "requires": { "inherits": "^2.0.1", @@ -4791,7 +5694,8 @@ "detect-node": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz", - "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==" + "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==", + "dev": true }, "diff": { "version": "1.4.0", @@ -4917,7 +5821,7 @@ "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "requires": { "is-obj": "^1.0.0" } @@ -4970,7 +5874,8 @@ "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true }, "duplexify": { "version": "3.7.1", @@ -4993,14 +5898,6 @@ "object.defaults": "^1.1.0" } }, - "eachr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/eachr/-/eachr-2.0.4.tgz", - "integrity": "sha1-Rm98qhBwj2EFCeMsgHqv5X/BIr8=", - "requires": { - "typechecker": "^2.0.8" - } - }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -5018,11 +5915,6 @@ "safe-buffer": "^5.0.1" } }, - "editions": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz", - "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==" - }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -5033,93 +5925,16 @@ "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.2.tgz", "integrity": "sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q==" }, - "electron": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/electron/-/electron-7.1.2.tgz", - "integrity": "sha512-7hjONYt2GlQfKuKgQrhhUL1P9lbGWLBfMUq+2QFU3yeLtCvM0ROfPJCRP4OF5pVp3KDyfFp4DtmhuVzAnxV3jA==", - "requires": { - "@electron/get": "^1.0.1", - "@types/node": "^12.0.12", - "extract-zip": "^1.0.3" - }, - "dependencies": { - "@types/node": { - "version": "12.12.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.12.tgz", - "integrity": "sha512-MGuvYJrPU0HUwqF7LqvIj50RZUX23Z+m583KBygKYUZLlZ88n6w28XRNJRJgsHukLEnLz6w6SvxZoLgbr5wLqQ==" - } - } - }, - "electron-download": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-3.3.0.tgz", - "integrity": "sha1-LP1U1pZsAZxNSa1l++Zcyc3vaMg=", - "dev": true, - "requires": { - "debug": "^2.2.0", - "fs-extra": "^0.30.0", - "home-path": "^1.0.1", - "minimist": "^1.2.0", - "nugget": "^2.0.0", - "path-exists": "^2.1.0", - "rc": "^1.1.2", - "semver": "^5.3.0", - "sumchecker": "^1.2.0" - }, - "dependencies": { - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "sumchecker": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-1.3.1.tgz", - "integrity": "sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0=", - "dev": true, - "requires": { - "debug": "^2.2.0", - "es6-promise": "^4.0.5" - } - } - } - }, "electron-to-chromium": { - "version": "1.3.264", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.264.tgz", - "integrity": "sha512-z8E7WkrrquCuGYv+kKyybuZIbdms+4PeHp7Zm2uIgEhAigP0bOwqXILItwj0YO73o+QyHY/7XtEfP5DsHOWQgQ==", + "version": "1.3.328", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.328.tgz", + "integrity": "sha512-x4XefnFxDxFwaQ01d/pppJP9meWhOIJ/gtI6/4jqkpsadq79uL7NYSaX64naLmJqvzUBjSrO3IM2+1b/W9KdPg==", "dev": true }, "elliptic": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.0.tgz", - "integrity": "sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", + "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", "dev": true, "requires": { "bn.js": "^4.4.0", @@ -5178,30 +5993,25 @@ } }, "enhanced-resolve": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", - "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz", + "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==", "dev": true, "requires": { "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", + "memory-fs": "^0.5.0", "tapable": "^1.0.0" - } - }, - "enqueue": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/enqueue/-/enqueue-1.0.2.tgz", - "integrity": "sha1-kBTpvOVw7pPKlubI5jrVTBkra8g=", - "dev": true, - "requires": { - "sliced": "0.0.5" }, "dependencies": { - "sliced": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", - "integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=", - "dev": true + "memory-fs": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", + "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } } } }, @@ -5215,30 +6025,6 @@ "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" }, - "env-paths": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz", - "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==" - }, - "errlop": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/errlop/-/errlop-1.1.1.tgz", - "integrity": "sha512-WX7QjiPHhsny7/PQvrhS5VMizXXKoKCS3udaBp8gjlARdbn+XmK300eKBAAN0hGyRaTCtRpOaxK+xFVPUJ3zkw==", - "requires": { - "editions": "^2.1.2" - }, - "dependencies": { - "editions": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/editions/-/editions-2.1.3.tgz", - "integrity": "sha512-xDZyVm0A4nLgMNWVVLJvcwMjI80ShiH/27RyLiCnW1L273TcJIA25C4pwJ33AWV01OX6UriP35Xu+lH4S7HWQw==", - "requires": { - "errlop": "^1.1.1", - "semver": "^5.6.0" - } - } - } - }, "errno": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", @@ -5298,12 +6084,6 @@ "next-tick": "^1.0.0" } }, - "es6-error": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", - "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", - "optional": true - }, "es6-iterator": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", @@ -5571,9 +6351,9 @@ "integrity": "sha1-YZegldX7a1folC9v1+qtY6CclFI=" }, "eventemitter3": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz", + "integrity": "sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg==", "dev": true }, "events": { @@ -5759,21 +6539,6 @@ } } }, - "extendr": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/extendr/-/extendr-2.1.0.tgz", - "integrity": "sha1-MBqgu+pWX00tyPVw8qImEahSe1Y=", - "requires": { - "typechecker": "~2.0.1" - }, - "dependencies": { - "typechecker": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/typechecker/-/typechecker-2.0.8.tgz", - "integrity": "sha1-6D2oS7ZMWEzLNFg4V2xAsDN9uC4=" - } - } - }, "external-editor": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", @@ -5850,25 +6615,11 @@ } } }, - "extract-opts": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/extract-opts/-/extract-opts-2.2.0.tgz", - "integrity": "sha1-H6KOunNSxttID4hc63GkaBC+bX0=", - "requires": { - "typechecker": "~2.0.1" - }, - "dependencies": { - "typechecker": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/typechecker/-/typechecker-2.0.8.tgz", - "integrity": "sha1-6D2oS7ZMWEzLNFg4V2xAsDN9uC4=" - } - } - }, "extract-zip": { "version": "1.6.7", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "dev": true, "requires": { "concat-stream": "1.6.2", "debug": "2.6.9", @@ -5880,6 +6631,7 @@ "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", @@ -5968,6 +6720,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "dev": true, "requires": { "pend": "~1.2.0" } @@ -6003,7 +6756,7 @@ }, "file-loader": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "dev": true, "requires": { @@ -6189,12 +6942,12 @@ } }, "follow-redirects": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz", - "integrity": "sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.9.0.tgz", + "integrity": "sha512-CRcPzsSIbXyVDl0QI01muNDu69S8trU4jArW9LpOt2WtC6LyUJetcIrmfHsRBx7/Jb6GHJUiuqyYxPooFfNt6A==", "dev": true, "requires": { - "debug": "^3.2.6" + "debug": "^3.0.0" }, "dependencies": { "debug": { @@ -6910,12 +7663,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "function-source": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/function-source/-/function-source-0.1.0.tgz", - "integrity": "sha1-2RBL8+RniLVUaMAr8bL6vPj8Ga8=", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, "functional-red-black-tree": { @@ -7081,13 +7829,15 @@ } }, "glob": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", - "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "requires": { + "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "2 || 3", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -7161,35 +7911,6 @@ "object.defaults": "^1.1.0" } }, - "global-agent": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-2.1.7.tgz", - "integrity": "sha512-ooK7eqGYZku+LgnbfH/Iv0RJ74XfhrBZDlke1QSzcBt0bw1PmJcnRADPAQuFE+R45pKKDTynAr25SBasY2kvow==", - "optional": true, - "requires": { - "boolean": "^3.0.0", - "core-js": "^3.4.1", - "es6-error": "^4.1.1", - "matcher": "^2.0.0", - "roarr": "^2.14.5", - "semver": "^6.3.0", - "serialize-error": "^5.0.0" - }, - "dependencies": { - "core-js": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.4.2.tgz", - "integrity": "sha512-bUTfqFWtNKWp73oNIfRkqwYZJeNT3lstzZcAkhhiuvDraRSgOH1/+F9ZklbpR4zpdKuo4cpXN8tKP7s61yjX+g==", - "optional": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "optional": true - } - } - }, "global-dirs": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", @@ -7202,7 +7923,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -7223,18 +7944,6 @@ "which": "^1.2.14" } }, - "global-tunnel-ng": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz", - "integrity": "sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==", - "optional": true, - "requires": { - "encodeurl": "^1.0.2", - "lodash": "^4.17.10", - "npm-conf": "^1.1.3", - "tunnel": "^0.0.6" - } - }, "globalize": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/globalize/-/globalize-1.4.2.tgz", @@ -7249,17 +7958,6 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "globalthis": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.0.tgz", - "integrity": "sha512-vcCAZTJ3r5Qcu5l8/2oyVdoFwxKgfYnMTR2vwWeux/NAVZK3PwcMaWkdUIn4GJbmKuRK7xcvDsLuK+CKcXyodg==", - "optional": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "object-keys": "^1.0.12" - } - }, "globby": { "version": "5.0.0", "resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz", @@ -7297,30 +7995,14 @@ } }, "globule": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", - "integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.0.tgz", + "integrity": "sha512-YlD4kdMqRCQHrhVdonet4TdRtv1/sZKepvoxNT4Nrhrp5HI8XFfc8kFlGlBn2myBo80aGp8Eft259mbcUJhgSg==", "dev": true, "requires": { "glob": "~7.1.1", "lodash": "~4.17.10", "minimatch": "~3.0.2" - }, - "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } } }, "glogg": { @@ -7349,9 +8031,9 @@ }, "dependencies": { "base64-js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" } } }, @@ -7364,33 +8046,6 @@ "pify": "^4.0.0" } }, - "got": { - "version": "6.7.1", - "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", - "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", - "dev": true, - "requires": { - "create-error-class": "^3.0.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-redirect": "^1.0.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "lowercase-keys": "^1.0.0", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "unzip-response": "^2.0.1", - "url-parse-lax": "^1.0.0" - }, - "dependencies": { - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - } - } - }, "graceful-fs": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", @@ -7919,7 +8574,7 @@ "dependencies": { "es6-promise": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", "dev": true }, @@ -8132,9 +8787,9 @@ } }, "hash-stream-validation": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/hash-stream-validation/-/hash-stream-validation-0.2.1.tgz", - "integrity": "sha1-7Mm5l7IYvluzEphii7gHhptz3NE=", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/hash-stream-validation/-/hash-stream-validation-0.2.2.tgz", + "integrity": "sha512-cMlva5CxWZOrlS/cY0C+9qAzesn5srhFA8IT1VPiHc9bWWBLkJfEUIZr7MWoi89oOOGmpg8ymchaOjiArsGu5A==", "requires": { "through2": "^2.0.0" }, @@ -8149,9 +8804,9 @@ } }, "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" } } }, @@ -8172,9 +8827,9 @@ "dev": true }, "helmet": { - "version": "3.21.1", - "resolved": "https://registry.npmjs.org/helmet/-/helmet-3.21.1.tgz", - "integrity": "sha512-IC/54Lxvvad2YiUdgLmPlNFKLhNuG++waTF5KPYq/Feo3NNhqMFbcLAlbVkai+9q0+4uxjxGPJ9bNykG+3zZNg==", + "version": "3.21.2", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-3.21.2.tgz", + "integrity": "sha512-okUo+MeWgg00cKB8Csblu8EXgcIoDyb5ZS/3u0W4spCimeVuCUvVZ6Vj3O2VJ1Sxpyb8jCDvzu0L1KKT11pkIg==", "requires": { "depd": "2.0.0", "dns-prefetch-control": "0.2.0", @@ -8183,7 +8838,7 @@ "feature-policy": "0.3.0", "frameguard": "3.1.0", "helmet-crossdomain": "0.4.0", - "helmet-csp": "2.9.2", + "helmet-csp": "2.9.4", "hide-powered-by": "1.1.0", "hpkp": "2.0.0", "hsts": "2.2.0", @@ -8199,11 +8854,11 @@ "integrity": "sha512-AB4DTykRw3HCOxovD1nPR16hllrVImeFp5VBV9/twj66lJ2nU75DP8FPL0/Jp4jj79JhTfG+pFI2MD02kWJ+fA==" }, "helmet-csp": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/helmet-csp/-/helmet-csp-2.9.2.tgz", - "integrity": "sha512-Lt5WqNfbNjEJ6ysD4UNpVktSyjEKfU9LVJ1LaFmPfYseg/xPealPfgHhtqdAdjPDopp5zbg/VWCyp4cluMIckw==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/helmet-csp/-/helmet-csp-2.9.4.tgz", + "integrity": "sha512-qUgGx8+yk7Xl8XFEGI4MFu1oNmulxhQVTlV8HP8tV3tpfslCs30OZz/9uQqsWPvDISiu/NwrrCowsZBhFADYqg==", "requires": { - "bowser": "^2.6.1", + "bowser": "^2.7.0", "camelize": "1.0.0", "content-security-policy-builder": "2.1.0", "dasherize": "2.0.0" @@ -8225,12 +8880,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "home-path": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.7.tgz", - "integrity": "sha512-tM1pVa+u3ZqQwIkXcWfhUlY3HWS3TsnKsfi2OHHvnhkX52s9etyktPyy1rQotkr0euWimChDq+QkQuDe8ngUlQ==", - "dev": true - }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -8346,17 +8995,40 @@ } } }, - "html-webpack-plugin": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.5.tgz", - "integrity": "sha512-y5l4lGxOW3pz3xBTFdfB9rnnrWRPVxlAhX6nrBYIcW+2k2zC3mSp/3DxlWVCMBfnO6UAnoF8OcFn0IMy6kaKAQ==", + "html-minifier-terser": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-5.0.2.tgz", + "integrity": "sha512-VAaitmbBuHaPKv9bj47XKypRhgDxT/cDLvsPiiF7w+omrN3K0eQhpigV9Z1ilrmHa9e0rOYcD6R/+LCDADGcnQ==", "dev": true, "requires": { - "html-minifier": "^3.5.20", - "loader-utils": "^1.1.0", - "lodash": "^4.17.11", + "camel-case": "^3.0.0", + "clean-css": "^4.2.1", + "commander": "^4.0.0", + "he": "^1.2.0", + "param-case": "^2.1.1", + "relateurl": "^0.2.7", + "terser": "^4.3.9" + }, + "dependencies": { + "commander": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.0.tgz", + "integrity": "sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==", + "dev": true + } + } + }, + "html-webpack-plugin": { + "version": "4.0.0-beta.11", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.11.tgz", + "integrity": "sha512-4Xzepf0qWxf8CGg7/WQM5qBB2Lc/NFI7MhU59eUDTkuQp3skZczH4UA1d6oQyDEIoMDgERVhRyTdtUPZ5s5HBg==", + "dev": true, + "requires": { + "html-minifier-terser": "^5.0.1", + "loader-utils": "^1.2.3", + "lodash": "^4.17.15", "pretty-error": "^2.1.1", - "tapable": "^1.1.0", + "tapable": "^1.1.3", "util.promisify": "1.0.0" } }, @@ -8385,11 +9057,6 @@ } } }, - "http-cache-semantics": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", - "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==" - }, "http-deceiver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", @@ -8427,12 +9094,12 @@ "dev": true }, "http-proxy": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", - "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz", + "integrity": "sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==", "dev": true, "requires": { - "eventemitter3": "^3.0.0", + "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", "requires-port": "^1.0.0" } @@ -8509,16 +9176,16 @@ } }, "i18n": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/i18n/-/i18n-0.8.3.tgz", - "integrity": "sha1-LYzxwkciYCwgQdAbpq5eqlE4jw4=", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/i18n/-/i18n-0.8.4.tgz", + "integrity": "sha512-PvMcG+yqYWXrwgdmCpL+APCGa8lRY0tdlo2cXp9UeR3u4h1bJGqFsgybfmG/MqtL1iDmdaPPPLJebXGrZ1XoMQ==", "requires": { "debug": "*", - "make-plural": "^3.0.3", - "math-interval-parser": "^1.1.0", - "messageformat": "^0.3.1", + "make-plural": "^6.0.1", + "math-interval-parser": "^2.0.1", + "messageformat": "^2.3.0", "mustache": "*", - "sprintf-js": ">=1.0.3" + "sprintf-js": "^1.1.2" } }, "iconv-lite": { @@ -8581,20 +9248,6 @@ "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", "dev": true }, - "ignorefs": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ignorefs/-/ignorefs-1.2.0.tgz", - "integrity": "sha1-2ln7hYl25KXkNwLM0fKC/byeV1Y=", - "requires": { - "editions": "^1.3.3", - "ignorepatterns": "^1.1.0" - } - }, - "ignorepatterns": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ignorepatterns/-/ignorepatterns-1.1.0.tgz", - "integrity": "sha1-rI9DbyI5td+2bV8NOpBKh6xnzF4=" - }, "import-fresh": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", @@ -8647,6 +9300,12 @@ "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", "dev": true }, + "infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, "inflection": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz", @@ -8669,7 +9328,8 @@ "ini": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true }, "inquirer": { "version": "6.4.1", @@ -8771,6 +9431,12 @@ "is-windows": "^1.0.1" } }, + "is-absolute-url": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-3.0.3.tgz", + "integrity": "sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q==", + "dev": true + }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "http://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -8987,7 +9653,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -9030,9 +9696,9 @@ } }, "is-retry-allowed": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", - "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", "dev": true }, "is-stream": { @@ -9305,33 +9971,19 @@ } }, "jasmine": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.4.0.tgz", - "integrity": "sha512-sR9b4n+fnBFDEd7VS2el2DeHgKcPiMVn44rtKFumq9q7P/t8WrxsVIZPob4UDdgcDNCwyDqwxCt4k9TDRmjPoQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz", + "integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==", "dev": true, "requires": { - "glob": "^7.1.3", - "jasmine-core": "~3.4.0" + "glob": "^7.1.4", + "jasmine-core": "~3.5.0" }, "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "jasmine-core": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.4.0.tgz", - "integrity": "sha512-HU/YxV4i6GcmiH4duATwAbJQMlE0MsDIR5XmSVxURxKHn3aGAdbY1/ZJFmVRbKtnLwIxxMJD7gYaPsypcbYimg==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz", + "integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==", "dev": true } } @@ -9363,7 +10015,7 @@ "jasmine-spec-reporter": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", - "integrity": "sha1-HWMq7ANBZwrTJPkrqEtLMrNeniI=", + "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", "dev": true, "requires": { "colors": "1.1.2" @@ -10277,9 +10929,9 @@ "dev": true }, "json5": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", - "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", "dev": true, "requires": { "minimist": "^1.2.0" @@ -10334,27 +10986,6 @@ "safe-buffer": "^5.0.1" } }, - "keypress": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz", - "integrity": "sha1-SjGI1CkbZrT2XtuZ+AaqmuKTWSo=", - "dev": true - }, - "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "requires": { - "json-buffer": "3.0.0" - }, - "dependencies": { - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" - } - } - }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -10367,15 +10998,6 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, "kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -10657,12 +11279,6 @@ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, - "lodash.tail": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz", - "integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=", - "dev": true - }, "lodash.template": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", @@ -10691,9 +11307,9 @@ } }, "loglevel": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.3.tgz", - "integrity": "sha512-LoEDv5pgpvWgPF4kNYuIp0qqSJVWak/dML0RY74xlzMZiT9w77teNAwKYKWBTYjlokMirg+o3jBwp+vlLrcfAA==", + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.6.tgz", + "integrity": "sha512-Sgr5lbboAUBo3eXCSPL4/KoVz3ROKquOjcctxmHIt+vol2DrqTQe3SwkKKuYhEiWB5kYa13YyopJ69deJ1irzQ==", "dev": true }, "long": { @@ -10783,9 +11399,9 @@ } }, "loopback-component-explorer": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/loopback-component-explorer/-/loopback-component-explorer-6.4.0.tgz", - "integrity": "sha512-vDRR4gqkvGOEXh5yL383xGuGxUW9xtF+NCY6/lJu1VAgupKltZxEx3Vw+L3nsGvQrlkJTSmiK3jk72qxkoBtbw==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/loopback-component-explorer/-/loopback-component-explorer-6.5.0.tgz", + "integrity": "sha512-h3Smxz/bNm3lUspaLBe0daFVEvnvCcOHiHWKJHLcopiB8NKuZrveFhMfpcnv97OR9aqtCw8lhRoH0sMa840kJg==", "requires": { "debug": "^3.1.0", "lodash": "^4.17.11", @@ -10822,14 +11438,6 @@ "uuid": "^3.2.1" }, "dependencies": { - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "requires": { - "lodash": "^4.17.11" - } - }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -10882,9 +11490,9 @@ } }, "loopback-connector-mysql": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/loopback-connector-mysql/-/loopback-connector-mysql-5.4.1.tgz", - "integrity": "sha512-+nXuodxmAVotvXGYrJRyzF21AT+3250Rodhsbh7lUrwRHOsYuja6ulT15P1P9NAoHeoZkzbw6XV9DQSJe6JyXw==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/loopback-connector-mysql/-/loopback-connector-mysql-5.4.2.tgz", + "integrity": "sha512-f5iIIcJdfUuBUkScGcK7m4dLZnpjFjl1iFG5OHTk8pFwDq7+Xap/0H99ulueRp2ljfqbULTUvt3Rg1y/W5smtw==", "requires": { "async": "^2.6.1", "debug": "^3.1.0", @@ -10894,14 +11502,6 @@ "strong-globalize": "^4.1.1" }, "dependencies": { - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "requires": { - "lodash": "^4.17.11" - } - }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -11044,9 +11644,9 @@ } }, "loopback-swagger": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/loopback-swagger/-/loopback-swagger-5.7.3.tgz", - "integrity": "sha512-RKmmaaiYS6gkAybiY17Poh1NBPrOI5rYlEJY+cf5VlL5p0e1MK9ivfOVDFpfPaxXEnYt7NL/Cz/iZ9QuKyfA5g==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/loopback-swagger/-/loopback-swagger-5.8.0.tgz", + "integrity": "sha512-KYui2ShRk0msuXnZUcIeZZpJVAP44Wak3YYeSjfGpj+tPlawFqXa38Fc9+C0/rlyX3x4hvtGf8W3UAb9pEjx0w==", "requires": { "async": "^2.1.4", "debug": "^3.1.0", @@ -11055,14 +11655,6 @@ "strong-globalize": "^4.1.1" }, "dependencies": { - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "requires": { - "lodash": "^4.17.11" - } - }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -11106,7 +11698,8 @@ "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true }, "lru-cache": { "version": "5.1.1", @@ -11117,18 +11710,13 @@ } }, "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - } + "pify": "^4.0.1", + "semver": "^5.6.0" } }, "make-iterator": { @@ -11141,12 +11729,9 @@ } }, "make-plural": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-3.0.6.tgz", - "integrity": "sha1-IDOgO6wpC487uRJY9lud9+iwHKc=", - "requires": { - "minimist": "^1.2.0" - } + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-6.0.1.tgz", + "integrity": "sha512-h0uBNi4tpDkiWUyYKrJNj8Kif6q3Ba5zp/8jnfPy3pQE+4XcTj6h3eZM5SYVUyDNX9Zk69Isr/dx0I+78aJUaQ==" }, "makeerror": { "version": "1.0.11", @@ -11233,30 +11818,10 @@ } } }, - "matcher": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/matcher/-/matcher-2.1.0.tgz", - "integrity": "sha512-o+nZr+vtJtgPNklyeUKkkH42OsK8WAfdgaJE2FNxcjLPg+5QbeEoT6vRj8Xq/iv18JlQ9cmKsEu0b94ixWf1YQ==", - "optional": true, - "requires": { - "escape-string-regexp": "^2.0.0" - }, - "dependencies": { - "escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "optional": true - } - } - }, "math-interval-parser": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-interval-parser/-/math-interval-parser-1.1.0.tgz", - "integrity": "sha1-2+2lsGsySZc8bfYXD94jhvCv2JM=", - "requires": { - "xregexp": "^2.0.0" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/math-interval-parser/-/math-interval-parser-2.0.1.tgz", + "integrity": "sha512-VmlAmb0UJwlvMyx8iPhXUDnVW1F9IrGEd9CIOmv+XL8AErCUUuozoDMrgImvnYt2A+53qVX/tPW6YJurMKYsvA==" }, "md5": { "version": "2.2.1", @@ -11337,17 +11902,35 @@ } }, "messageformat": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-0.3.1.tgz", - "integrity": "sha1-5Y//gkXps5cXmeW0PbWLPpQX9aI=", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-2.3.0.tgz", + "integrity": "sha512-uTzvsv0lTeQxYI2y1NPa1lItL5VRI8Gb93Y2K2ue5gBPyrbJxfDi/EYWxh2PKv5yO42AJeeqblS9MJSh/IEk4w==", "requires": { - "async": "~1.5.2", - "glob": "~6.0.4", - "make-plural": "~3.0.3", - "nopt": "~3.0.6", - "watchr": "~2.4.13" + "make-plural": "^4.3.0", + "messageformat-formatters": "^2.0.1", + "messageformat-parser": "^4.1.2" + }, + "dependencies": { + "make-plural": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-4.3.0.tgz", + "integrity": "sha512-xTYd4JVHpSCW+aqDof6w/MebaMVNTVYBZhbB/vi513xXdiPT92JMVCo0Jq8W2UZnzYRFeVbQiQ+I25l13JuKvA==", + "requires": { + "minimist": "^1.2.0" + } + } } }, + "messageformat-formatters": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/messageformat-formatters/-/messageformat-formatters-2.0.1.tgz", + "integrity": "sha512-E/lQRXhtHwGuiQjI7qxkLp8AHbMD5r2217XNe/SREbBlSawe0lOqsFb7rflZJmlQFSULNLIqlcjjsCPlB3m3Mg==" + }, + "messageformat-parser": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/messageformat-parser/-/messageformat-parser-4.1.2.tgz", + "integrity": "sha512-7dWuifeyldz7vhEuL96Kwq1fhZXBW+TUfbnHN4UCrCxoXQTYjHnR78eI66Gk9LaLLsAvzPNVJBaa66DRfFNaiA==" + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -11407,11 +11990,6 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -11434,29 +12012,9 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, - "minstache": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minstache/-/minstache-1.2.0.tgz", - "integrity": "sha1-/xzEA6woRPaNvxjGYhKb5+sO/EE=", - "dev": true, - "requires": { - "commander": "1.0.4" - }, - "dependencies": { - "commander": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz", - "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", - "dev": true, - "requires": { - "keypress": "0.1.x" - } - } - } - }, "mississippi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", @@ -11498,9 +12056,9 @@ } }, "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true } } @@ -11526,24 +12084,6 @@ } } }, - "mixin-object": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", - "integrity": "sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=", - "dev": true, - "requires": { - "for-in": "^0.1.3", - "is-extendable": "^0.1.1" - }, - "dependencies": { - "for-in": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", - "integrity": "sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=", - "dev": true - } - } - }, "mkdirp": { "version": "0.5.1", "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -11646,24 +12186,10 @@ "run-queue": "^1.0.3" }, "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "requires": { "glob": "^7.1.3" @@ -11744,15 +12270,6 @@ "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", "dev": true }, - "multiline": { - "version": "1.0.2", - "resolved": "http://registry.npmjs.org/multiline/-/multiline-1.0.2.tgz", - "integrity": "sha1-abHyX/B00oKJBPJE3dBrfZbvbJM=", - "dev": true, - "requires": { - "strip-indent": "^1.0.0" - } - }, "multipipe": { "version": "0.1.2", "resolved": "http://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", @@ -11763,9 +12280,9 @@ } }, "mustache": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.0.1.tgz", - "integrity": "sha512-jFI/4UVRsRYdUbuDTKT7KzfOp7FiD5WzYmmwNwXyUVypC0xjoTL78Fqc0jHUPIvvGD+6DQSPHIt1NE7D1ArsqA==" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.2.1.tgz", + "integrity": "sha512-RERvMFdLpaFfSRIEe632yDm5nsd0SDKn8hGmcUwswnyiE5mtdZLDybtHAz6hjJhawokF0hXvGLtx9mrQfm6FkA==" }, "mute-stdout": { "version": "1.0.1", @@ -11805,36 +12322,29 @@ } }, "mysql2": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-1.6.5.tgz", - "integrity": "sha512-zedaOOyb3msuuZcJJnxIX/EGOpmljDG7B+UevRH5lqcv+yhy9eCwkArBz8/AO+/rlY3/oCsOdG8R5oD6k0hNfg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-1.7.0.tgz", + "integrity": "sha512-xTWWQPjP5rcrceZQ7CSTKR/4XIDeH/cRkNH/uzvVGQ7W5c7EJ0dXeJUusk7OKhIoHj7uFKUxDVSCfLIl+jluog==", "dev": true, "requires": { - "denque": "^1.4.0", + "denque": "^1.4.1", "generate-function": "^2.3.1", - "iconv-lite": "^0.4.24", + "iconv-lite": "^0.5.0", "long": "^4.0.0", - "lru-cache": "^4.1.3", + "lru-cache": "^5.1.1", "named-placeholders": "^1.1.2", "seq-queue": "^0.0.5", "sqlstring": "^2.3.1" }, "dependencies": { - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "iconv-lite": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.0.tgz", + "integrity": "sha512-NnEhI9hIEKHOzJ4f697DMz9IQEXr/MMJ5w64vN2/4Ai+wRnvV7SBrL0KLoRlwaKVghOc7LQ5YkPLuX146b6Ydw==", "dev": true, "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" + "safer-buffer": ">= 2.1.2 < 3" } - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true } } }, @@ -11923,76 +12433,6 @@ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, - "nightmare": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/nightmare/-/nightmare-3.0.2.tgz", - "integrity": "sha512-z6Sr7k71pFcNHFH0orejum9xMzrsdU1lcxlbvNGRsKgDltmu4r52sK5opDnoqfyWS+w9SNthj/4Bbt5zNofzhw==", - "dev": true, - "requires": { - "debug": "^2.2.0", - "deep-defaults": "^1.0.3", - "defaults": "^1.0.2", - "electron": "^2.0.18", - "enqueue": "^1.0.2", - "function-source": "^0.1.0", - "jsesc": "^0.5.0", - "minstache": "^1.2.0", - "mkdirp": "^0.5.1", - "multiline": "^1.0.2", - "once": "^1.3.3", - "rimraf": "^2.4.3", - "sliced": "1.0.1", - "split2": "^2.0.1" - }, - "dependencies": { - "@types/node": { - "version": "8.10.59", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.59.tgz", - "integrity": "sha512-8RkBivJrDCyPpBXhVZcjh7cQxVBSmRk9QM7hOketZzp6Tg79c0N8kkpAIito9bnJ3HCVCHVYz+KHTEbfQNfeVQ==", - "dev": true - }, - "electron": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/electron/-/electron-2.0.18.tgz", - "integrity": "sha512-PQRHtFvLxHdJzMMIwTddUtkS+Te/fZIs+PHO+zPmTUTBE76V3Od3WRGzMQwiJHxN679licmCKhJpMyxZfDEVWQ==", - "dev": true, - "requires": { - "@types/node": "^8.0.24", - "electron-download": "^3.0.1", - "extract-zip": "^1.0.3" - } - }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - }, - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, "no-case": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", @@ -12037,20 +12477,6 @@ "which": "1" }, "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "semver": { "version": "5.3.0", "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", @@ -12148,18 +12574,26 @@ } }, "node-releases": { - "version": "1.1.32", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.32.tgz", - "integrity": "sha512-VhVknkitq8dqtWoluagsGPn3dxTvN9fwgR59fV3D7sLBHe0JfDramsMI8n8mY//ccq/Kkrf8ZRHRpsyVZ3qw1A==", + "version": "1.1.44", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.44.tgz", + "integrity": "sha512-NwbdvJyR7nrcGrXvKAvzc5raj/NkoJudkarh2yIpJ4t0NH4aqjUDz/486P+ynIW5eokKOfzGNRdYoLfBlomruw==", "dev": true, "requires": { - "semver": "^5.3.0" + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, "node-sass": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.12.0.tgz", - "integrity": "sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz", + "integrity": "sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA==", "dev": true, "requires": { "async-foreach": "^0.1.3", @@ -12169,7 +12603,7 @@ "get-stdin": "^4.0.1", "glob": "^7.0.3", "in-publish": "^2.0.0", - "lodash": "^4.17.11", + "lodash": "^4.17.15", "meow": "^3.7.0", "mkdirp": "^0.5.1", "nan": "^2.13.2", @@ -12216,20 +12650,6 @@ "which": "^1.2.9" } }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "lru-cache": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", @@ -12306,23 +12726,43 @@ "integrity": "sha1-EUIdLWa07m9AU1T5FMH0ZB6ySw0=" }, "nodemon": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.19.1.tgz", - "integrity": "sha512-/DXLzd/GhiaDXXbGId5BzxP1GlsqtMGM9zTmkWrgXtSqjKmGSbLicM/oAy4FR0YWm14jCHRwnR31AHS2dYFHrg==", + "version": "1.19.4", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.19.4.tgz", + "integrity": "sha512-VGPaqQBNk193lrJFotBU8nvWZPqEZY2eIzymy2jjY0fJ9qIsxA0sxQ8ATPl0gZC645gijYEc1jtZvpS8QWzJGQ==", "dev": true, "requires": { - "chokidar": "^2.1.5", - "debug": "^3.1.0", + "chokidar": "^2.1.8", + "debug": "^3.2.6", "ignore-by-default": "^1.0.1", "minimatch": "^3.0.4", - "pstree.remy": "^1.1.6", - "semver": "^5.5.0", - "supports-color": "^5.2.0", + "pstree.remy": "^1.1.7", + "semver": "^5.7.1", + "supports-color": "^5.5.0", "touch": "^3.1.0", "undefsafe": "^2.0.2", "update-notifier": "^2.5.0" }, "dependencies": { + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -12338,6 +12778,12 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -12353,6 +12799,7 @@ "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, "requires": { "abbrev": "1" } @@ -12375,11 +12822,6 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, - "normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" - }, "now-and-later": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz", @@ -12389,24 +12831,6 @@ "once": "^1.3.2" } }, - "npm-conf": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", - "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", - "optional": true, - "requires": { - "config-chain": "^1.1.11", - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "optional": true - } - } - }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -12436,21 +12860,6 @@ "boolbase": "~1.0.0" } }, - "nugget": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/nugget/-/nugget-2.0.1.tgz", - "integrity": "sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA=", - "dev": true, - "requires": { - "debug": "^2.1.3", - "minimist": "^1.1.0", - "pretty-bytes": "^1.0.2", - "progress-stream": "^1.1.0", - "request": "^2.45.0", - "single-line-log": "^1.1.2", - "throttleit": "0.0.2" - } - }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -12513,7 +12922,8 @@ "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true }, "object-visit": { "version": "1.0.1", @@ -12642,7 +13052,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, @@ -12734,11 +13144,6 @@ "os-tmpdir": "^1.0.0" } }, - "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" - }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -12824,6 +13229,48 @@ "registry-auth-token": "^3.0.1", "registry-url": "^3.0.3", "semver": "^5.1.0" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "^3.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-redirect": "^1.0.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "lowercase-keys": "^1.0.0", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "unzip-response": "^2.0.1", + "url-parse-lax": "^1.0.0" + } + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + } + } } }, "pako": { @@ -12833,12 +13280,12 @@ "dev": true }, "parallel-transform": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", - "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz", + "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==", "dev": true, "requires": { - "cyclist": "~0.2.2", + "cyclist": "^1.0.1", "inherits": "^2.0.3", "readable-stream": "^2.1.5" } @@ -12862,9 +13309,9 @@ } }, "parse-asn1": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.4.tgz", - "integrity": "sha512-Qs5duJcuvNExRfFZ99HDD3z4mAi3r9Wl/FOjEOijlxwCZs7E7mW2vjTpgQ4J8LpTF8x5v+1Vn5UQFejmWT11aw==", + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", + "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", "dev": true, "requires": { "asn1.js": "^4.0.0", @@ -13019,7 +13466,8 @@ "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true }, "performance-now": { "version": "2.1.0", @@ -13065,9 +13513,9 @@ } }, "pkgcloud": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pkgcloud/-/pkgcloud-2.1.0.tgz", - "integrity": "sha512-0029nB7g1Y9ESCPLESORiZaG19Yh9aHXZqe/odvJS9O5SJao2RUA1h8Oksz+qw4yS8ZaexcCEGqRPmQ+il7+yA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pkgcloud/-/pkgcloud-2.2.0.tgz", + "integrity": "sha512-ZbbGqJA8gMwR0peq57aNbjzgLbDj52oi59QJEShZmGUl3ckFBZ92j0h/C2L0tJeCb2VE12tnTwmftBgQ0f3gNw==", "requires": { "@google-cloud/storage": "^2.4.3", "async": "^2.6.1", @@ -13087,14 +13535,6 @@ "xml2js": "^0.4.19" }, "dependencies": { - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "requires": { - "lodash": "^4.17.11" - } - }, "mime": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", @@ -13127,14 +13567,31 @@ "dev": true }, "portfinder": { - "version": "1.0.20", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.20.tgz", - "integrity": "sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw==", + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.25.tgz", + "integrity": "sha512-6ElJnHBbxVA1XSLgBp7G1FiCkQdlqGzuF7DswL5tcea+E8UpuvPU7beVAjjRwCioTS9ZluNbu+ZyRvgTsmqEBg==", "dev": true, "requires": { - "async": "^1.5.2", - "debug": "^2.2.0", - "mkdirp": "0.5.x" + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.1" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "posix-character-classes": { @@ -13239,22 +13696,6 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, - "prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", - "dev": true - }, - "pretty-bytes": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", - "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1", - "meow": "^3.1.0" - } - }, "pretty-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", @@ -13314,67 +13755,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, - "progress-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-1.2.0.tgz", - "integrity": "sha1-LNPP6jO6OonJwSHsM0er6asSX3c=", - "dev": true, - "requires": { - "speedometer": "~0.1.2", - "through2": "~0.2.3" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "object-keys": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", - "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=", - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - }, - "through2": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", - "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", - "dev": true, - "requires": { - "readable-stream": "~1.1.9", - "xtend": "~2.1.1" - } - }, - "xtend": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", - "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", - "dev": true, - "requires": { - "object-keys": "~0.4.0" - } - } - } - }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -13391,12 +13771,6 @@ "sisteransi": "^1.0.3" } }, - "proto-list": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", - "optional": true - }, "proxy-addr": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", @@ -13406,6 +13780,12 @@ "ipaddr.js": "1.9.0" } }, + "proxy-from-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", + "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=", + "dev": true + }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -13477,6 +13857,89 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, + "puppeteer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.0.0.tgz", + "integrity": "sha512-t3MmTWzQxPRP71teU6l0jX47PHXlc4Z52sQv4LJQSZLq1ttkKS2yGM3gaI57uQwZkNaoGd0+HPPMELZkcyhlqA==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^3.0.0", + "mime": "^2.0.3", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^6.1.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "https-proxy-agent": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz", + "integrity": "sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==", + "dev": true, + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", @@ -13741,12 +14204,6 @@ "safe-regex": "^1.1.0" } }, - "regexp-tree": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.13.tgz", - "integrity": "sha512-hwdV/GQY5F8ReLZWO+W1SRoN5YfpOKY6852+tBFcma72DKBIcHjPRIlIvQN35bCOljuAfP2G2iB0FC/w236mUw==", - "dev": true - }, "regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", @@ -13787,15 +14244,15 @@ } }, "regjsgen": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.0.tgz", - "integrity": "sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.1.tgz", + "integrity": "sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg==", "dev": true }, "regjsparser": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz", - "integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.2.tgz", + "integrity": "sha512-E9ghzUtoLwDekPT0DYCp+c4h+bvuUpe6rRHCTYn6eGoqj1LgKXxT6I0Il4WbjhQkOghzi/V+y03bPKvbllL93Q==", "dev": true, "requires": { "jsesc": "~0.5.0" @@ -13803,7 +14260,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -13963,19 +14420,19 @@ } }, "request-promise-core": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", - "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", "requires": { - "lodash": "^4.17.11" + "lodash": "^4.17.15" } }, "request-promise-native": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", - "integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", "requires": { - "request-promise-core": "1.1.2", + "request-promise-core": "1.1.3", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" } @@ -14063,14 +14520,6 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "requires": { - "lowercase-keys": "^1.0.0" - } - }, "restore-cursor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", @@ -14149,20 +14598,6 @@ "inherits": "^2.0.1" } }, - "roarr": { - "version": "2.14.6", - "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.14.6.tgz", - "integrity": "sha512-qjbw0BEesKA+3XFBPt+KVe1PC/Z6ShfJ4wPlx2XifqH5h2Lj8/KQT5XJTsy3n1Es5kai+BwKALaECW3F70B1cg==", - "optional": true, - "requires": { - "boolean": "^3.0.0", - "detect-node": "^2.0.4", - "globalthis": "^1.0.0", - "json-stringify-safe": "^5.0.1", - "semver-compare": "^1.0.0", - "sprintf-js": "^1.1.2" - } - }, "rsvp": { "version": "4.8.5", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", @@ -14203,21 +14638,13 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { "ret": "~0.1.10" } }, - "safefs": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/safefs/-/safefs-3.2.2.tgz", - "integrity": "sha1-gXDBRE1wOOCMrqBaN0+uL6NJ4Vw=", - "requires": { - "graceful-fs": "*" - } - }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -14240,14 +14667,6 @@ "walker": "~1.0.5" } }, - "sanitize-filename": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", - "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", - "requires": { - "truncate-utf8-bytes": "^1.0.0" - } - }, "sass-graph": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz", @@ -14258,42 +14677,25 @@ "lodash": "^4.0.0", "scss-tokenizer": "^0.2.3", "yargs": "^7.0.0" - }, - "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } } }, "sass-loader": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-7.1.0.tgz", - "integrity": "sha512-+G+BKGglmZM2GUSfT9TLuEp6tzehHPjAMoRRItOojWIqIGPloVCMhNIQuG639eJ+y033PaGTSjLaTHts8Kw79w==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-7.3.1.tgz", + "integrity": "sha512-tuU7+zm0pTCynKYHpdqaPpe+MMTQ76I9TPZ7i4/5dZsigE350shQWe5EZNl5dBidM49TPET75tNqRbcsUZWeNA==", "dev": true, "requires": { - "clone-deep": "^2.0.1", + "clone-deep": "^4.0.1", "loader-utils": "^1.0.1", - "lodash.tail": "^4.1.1", "neo-async": "^2.5.0", - "pify": "^3.0.0", - "semver": "^5.5.0" + "pify": "^4.0.1", + "semver": "^6.3.0" }, "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -14303,16 +14705,6 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, - "scandirectory": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/scandirectory/-/scandirectory-2.5.0.tgz", - "integrity": "sha1-bOA/VKCQtmjjy+2/IO354xBZPnI=", - "requires": { - "ignorefs": "^1.0.0", - "safefs": "^3.1.2", - "taskgroup": "^4.0.5" - } - }, "schema-utils": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", @@ -14336,7 +14728,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -14352,18 +14744,18 @@ "dev": true }, "selfsigned": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.4.tgz", - "integrity": "sha512-9AukTiDmHXGXWtWjembZ5NDmVvP2695EtpgbCsxCa68w3c88B+alqbmZ4O3hZ4VWGXeGWzEVdvqgAJD8DQPCDw==", + "version": "1.10.7", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", + "integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==", "dev": true, "requires": { - "node-forge": "0.7.5" + "node-forge": "0.9.0" }, "dependencies": { "node-forge": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz", - "integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", + "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==", "dev": true } } @@ -14373,12 +14765,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" }, - "semver-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", - "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", - "optional": true - }, "semver-diff": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", @@ -14435,19 +14821,10 @@ "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=", "dev": true }, - "serialize-error": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-5.0.0.tgz", - "integrity": "sha512-/VtpuyzYf82mHYTtI4QKtwHa79vAdU5OQpNPAmE/0UDdlGT0ZxHwC+J6gXkw29wwoVI8fMPsfcVHOwXtUQYYQA==", - "optional": true, - "requires": { - "type-fest": "^0.8.0" - } - }, "serialize-javascript": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.7.0.tgz", - "integrity": "sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz", + "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", "dev": true }, "serve-favicon": { @@ -14583,22 +14960,12 @@ } }, "shallow-clone": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-1.0.0.tgz", - "integrity": "sha512-oeXreoKR/SyNJtRJMAKPDSvd28OqEwG4eR/xc856cRGBII7gX9lvAqDxusPm0846z/w/hWYjI1NpKwJ00NHzRA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", "dev": true, "requires": { - "is-extendable": "^0.1.1", - "kind-of": "^5.0.0", - "mixin-object": "^2.0.1" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } + "kind-of": "^6.0.2" } }, "shebang-command": { @@ -14643,52 +15010,6 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, - "single-line-log": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/single-line-log/-/single-line-log-1.1.2.tgz", - "integrity": "sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=", - "dev": true, - "requires": { - "string-width": "^1.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, "sisteransi": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.3.tgz", @@ -14712,12 +15033,6 @@ "is-fullwidth-code-point": "^2.0.0" } }, - "sliced": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", - "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=", - "dev": true - }, "smtp-connection": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz", @@ -14771,7 +15086,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -14822,7 +15137,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -14888,9 +15203,9 @@ } }, "sockjs-client": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.3.0.tgz", - "integrity": "sha512-R9jxEzhnnrdxLCNln0xg5uGHqMnkhPSTzUZH2eXcR03S/On9Yvoq2wyUZILRUhZCNVu2PmwWVoyuiPz8th8zbg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.4.0.tgz", + "integrity": "sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g==", "dev": true, "requires": { "debug": "^3.2.5", @@ -15015,9 +15330,9 @@ "dev": true }, "spdy": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.0.tgz", - "integrity": "sha512-ot0oEGT/PGUpzf/6uk4AWLqkq+irlqHXkrdbk51oWONh3bxQmBuljxPNl66zlRRcIJStWq0QkLUCPOPjgjvU0Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.1.tgz", + "integrity": "sha512-HeZS3PBdMA+sZSu0qwpCxl3DeALD5ASx8pAX0jZdKXSpPWbQ6SYGnlg3BBmYLx5LtiZrmkAZfErCm2oECBcioA==", "dev": true, "requires": { "debug": "^4.1.0", @@ -15086,12 +15401,6 @@ } } }, - "speedometer": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-0.1.4.tgz", - "integrity": "sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=", - "dev": true - }, "split-array-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-2.0.0.tgz", @@ -15103,39 +15412,12 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { "extend-shallow": "^3.0.0" } }, - "split2": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", - "dev": true, - "requires": { - "through2": "^2.0.2" - }, - "dependencies": { - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - } - } - }, "sprintf-js": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", @@ -15297,9 +15579,9 @@ }, "dependencies": { "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true } } @@ -15641,29 +15923,6 @@ "schema-utils": "^1.0.0" } }, - "sumchecker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.0.tgz", - "integrity": "sha512-yreseuC/z4iaodVoq07XULEOO9p4jnQazO7mbrnDSvWAU/y2cbyIKs+gWJptfcGu9R+1l27K8Rkj0bfvqnBpgQ==", - "requires": { - "debug": "^4.1.0" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, "supports-color": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.2.0.tgz", @@ -15810,15 +16069,6 @@ "inherits": "2" } }, - "taskgroup": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/taskgroup/-/taskgroup-4.3.1.tgz", - "integrity": "sha1-feGT/r12gnPEV3MElwJNUSwnkVo=", - "requires": { - "ambi": "^2.2.0", - "csextends": "^1.0.3" - } - }, "teeny-request": { "version": "3.11.3", "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-3.11.3.tgz", @@ -15889,14 +16139,14 @@ } }, "terser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.0.2.tgz", - "integrity": "sha512-IWLuJqTvx97KP3uTYkFVn93cXO+EtlzJu8TdJylq+H0VBDlPMIfQA9MBS5Vc5t3xTEUG1q0hIfHMpAP2R+gWTw==", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.6.1.tgz", + "integrity": "sha512-w0f2OWFD7ka3zwetgVAhNMeyzEbj39ht2Tb0qKflw9PmW9Qbo5tjTh01QJLkhO9t9RDDQYvk+WXqpECI2C6i2A==", "dev": true, "requires": { - "commander": "^2.19.0", + "commander": "^2.20.0", "source-map": "~0.6.1", - "source-map-support": "~0.5.10" + "source-map-support": "~0.5.12" }, "dependencies": { "source-map": { @@ -15908,20 +16158,19 @@ } }, "terser-webpack-plugin": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.3.0.tgz", - "integrity": "sha512-W2YWmxPjjkUcOWa4pBEv4OP4er1aeQJlSo2UhtCFQCuRXEHjOFscO8VyWHj9JLlA0RzQb8Y2/Ta78XZvT54uGg==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz", + "integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==", "dev": true, "requires": { - "cacache": "^11.3.2", - "find-cache-dir": "^2.0.0", + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", "is-wsl": "^1.1.0", - "loader-utils": "^1.2.3", "schema-utils": "^1.0.0", - "serialize-javascript": "^1.7.0", + "serialize-javascript": "^2.1.2", "source-map": "^0.6.1", - "terser": "^4.0.0", - "webpack-sources": "^1.3.0", + "terser": "^4.1.2", + "webpack-sources": "^1.4.0", "worker-farm": "^1.7.0" }, "dependencies": { @@ -16043,12 +16292,6 @@ "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", "dev": true }, - "throttleit": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-0.0.2.tgz", - "integrity": "sha1-z+34jmDADdlpe2H90qg0OptoDq8=", - "dev": true - }, "through": { "version": "2.3.8", "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -16091,9 +16334,9 @@ } }, "thunky": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.0.3.tgz", - "integrity": "sha512-YwT8pjmNcAXBZqrubu22P4FYsh2D4dxRmnWBOL8Jk8bUcRUtc5326kx32tuTmFDAZtLOGEVNl8POAR8j896Iow==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "dev": true }, "time-stamp": { @@ -16109,9 +16352,9 @@ "dev": true }, "timers-browserify": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", - "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", + "integrity": "sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ==", "dev": true, "requires": { "setimmediate": "^1.0.4" @@ -16179,11 +16422,6 @@ } } }, - "to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" - }, "to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", @@ -16251,7 +16489,7 @@ "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", "dev": true, "requires": { "nopt": "~1.0.10" @@ -16317,30 +16555,6 @@ "dev": true, "requires": { "glob": "^7.1.2" - }, - "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "truncate-utf8-bytes": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", - "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", - "requires": { - "utf8-byte-length": "^1.0.1" } }, "tryit": { @@ -16361,12 +16575,6 @@ "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, - "tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "optional": true - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -16395,12 +16603,6 @@ "prelude-ls": "~1.1.2" } }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "optional": true - }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -16410,11 +16612,6 @@ "mime-types": "~2.1.24" } }, - "typechecker": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/typechecker/-/typechecker-2.1.0.tgz", - "integrity": "sha1-0cIJOlT/ihn1jP+HfuqlTyJC04M=" - }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -16676,6 +16873,21 @@ "write-file-atomic": "^2.0.0", "xdg-basedir": "^3.0.0" } + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true } } }, @@ -16716,9 +16928,9 @@ } }, "url-join": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.0.tgz", - "integrity": "sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo=" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" }, "url-parse": { "version": "1.4.7", @@ -16730,26 +16942,12 @@ "requires-port": "^1.0.0" } }, - "url-parse-lax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", - "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", - "dev": true, - "requires": { - "prepend-http": "^1.0.1" - } - }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, - "utf8-byte-length": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", - "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=" - }, "utf8-bytes": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/utf8-bytes/-/utf8-bytes-0.0.1.tgz", @@ -16804,9 +17002,9 @@ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" }, "v8-compile-cache": { "version": "2.0.3", @@ -16947,9 +17145,9 @@ } }, "vm-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.0.tgz", - "integrity": "sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", "dev": true }, "vn-loopback": { @@ -16984,21 +17182,6 @@ "neo-async": "^2.5.0" } }, - "watchr": { - "version": "2.4.13", - "resolved": "https://registry.npmjs.org/watchr/-/watchr-2.4.13.tgz", - "integrity": "sha1-10hHu01vkPYf4sdPn2hmKqDgdgE=", - "requires": { - "eachr": "^2.0.2", - "extendr": "^2.1.0", - "extract-opts": "^2.2.0", - "ignorefs": "^1.0.0", - "safefs": "^3.1.2", - "scandirectory": "^2.5.0", - "taskgroup": "^4.2.0", - "typechecker": "^2.0.8" - } - }, "wbuf": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", @@ -17015,41 +17198,66 @@ "dev": true }, "webpack": { - "version": "4.35.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.35.2.tgz", - "integrity": "sha512-TZAmorNymV4q66gAM/h90cEjG+N3627Q2MnkSgKlX/z3DlNVKUtqy57lz1WmZU2+FUZwzM+qm7cGaO95PyrX5A==", + "version": "4.41.5", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.41.5.tgz", + "integrity": "sha512-wp0Co4vpyumnp3KlkmpM5LWuzvZYayDwM2n17EHFr4qxBBbRokC7DJawPJC7TfSFZ9HZ6GsdH40EBj4UV0nmpw==", "dev": true, "requires": { "@webassemblyjs/ast": "1.8.5", "@webassemblyjs/helper-module-context": "1.8.5", "@webassemblyjs/wasm-edit": "1.8.5", "@webassemblyjs/wasm-parser": "1.8.5", - "acorn": "^6.0.5", - "acorn-dynamic-import": "^4.0.0", - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0", - "chrome-trace-event": "^1.0.0", + "acorn": "^6.2.1", + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1", + "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^4.1.0", - "eslint-scope": "^4.0.0", + "eslint-scope": "^4.0.3", "json-parse-better-errors": "^1.0.2", - "loader-runner": "^2.3.0", - "loader-utils": "^1.1.0", - "memory-fs": "~0.4.1", - "micromatch": "^3.1.8", - "mkdirp": "~0.5.0", - "neo-async": "^2.5.0", - "node-libs-browser": "^2.0.0", + "loader-runner": "^2.4.0", + "loader-utils": "^1.2.3", + "memory-fs": "^0.4.1", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.1", + "neo-async": "^2.6.1", + "node-libs-browser": "^2.2.1", "schema-utils": "^1.0.0", - "tapable": "^1.1.0", - "terser-webpack-plugin": "^1.1.0", - "watchpack": "^1.5.0", - "webpack-sources": "^1.3.0" + "tapable": "^1.1.3", + "terser-webpack-plugin": "^1.4.3", + "watchpack": "^1.6.0", + "webpack-sources": "^1.4.1" + }, + "dependencies": { + "acorn": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", + "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==", + "dev": true + }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz", + "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==", + "dev": true + } } }, "webpack-cli": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.5.tgz", - "integrity": "sha512-w0j/s42c5UhchwTmV/45MLQnTVwRoaUTu9fM5LuyOd/8lFoCNCELDogFoecx5NzRUndO0yD/gF2b02XKMnmAWQ==", + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.10.tgz", + "integrity": "sha512-u1dgND9+MXaEt74sJR4PR7qkPxXUSQ0RXYq8x1L6Jg1MYVEmGPrH6Ah6C4arD4r0J1P5HKjRqpab36k0eIzPqg==", "dev": true, "requires": { "chalk": "2.4.2", @@ -17082,6 +17290,17 @@ "wrap-ansi": "^5.1.0" } }, + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "tapable": "^1.0.0" + } + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -17197,57 +17416,94 @@ } } }, - "webpack-dev-server": { + "webpack-dev-middleware": { "version": "3.7.2", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.7.2.tgz", - "integrity": "sha512-mjWtrKJW2T9SsjJ4/dxDC2fkFVUw8jlpemDERqV0ZJIkjjjamR2AbQlr3oz+j4JLhYCHImHnXZK5H06P2wvUew==", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz", + "integrity": "sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw==", + "dev": true, + "requires": { + "memory-fs": "^0.4.1", + "mime": "^2.4.4", + "mkdirp": "^0.5.1", + "range-parser": "^1.2.1", + "webpack-log": "^2.0.0" + }, + "dependencies": { + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==", + "dev": true + } + } + }, + "webpack-dev-server": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.10.1.tgz", + "integrity": "sha512-AGG4+XrrXn4rbZUueyNrQgO4KGnol+0wm3MPdqGLmmA+NofZl3blZQKxZ9BND6RDNuvAK9OMYClhjOSnxpWRoA==", "dev": true, "requires": { "ansi-html": "0.0.7", "bonjour": "^3.5.0", - "chokidar": "^2.1.6", + "chokidar": "^2.1.8", "compression": "^1.7.4", "connect-history-api-fallback": "^1.6.0", "debug": "^4.1.1", "del": "^4.1.1", "express": "^4.17.1", "html-entities": "^1.2.1", - "http-proxy-middleware": "^0.19.1", + "http-proxy-middleware": "0.19.1", "import-local": "^2.0.0", "internal-ip": "^4.3.0", "ip": "^1.1.5", + "is-absolute-url": "^3.0.3", "killable": "^1.0.1", - "loglevel": "^1.6.3", + "loglevel": "^1.6.6", "opn": "^5.5.0", "p-retry": "^3.0.1", - "portfinder": "^1.0.20", + "portfinder": "^1.0.25", "schema-utils": "^1.0.0", - "selfsigned": "^1.10.4", - "semver": "^6.1.1", + "selfsigned": "^1.10.7", + "semver": "^6.3.0", "serve-index": "^1.9.1", "sockjs": "0.3.19", - "sockjs-client": "1.3.0", - "spdy": "^4.0.0", + "sockjs-client": "1.4.0", + "spdy": "^4.0.1", "strip-ansi": "^3.0.1", "supports-color": "^6.1.0", "url": "^0.11.0", - "webpack-dev-middleware": "^3.7.0", + "webpack-dev-middleware": "^3.7.2", "webpack-log": "^2.0.0", + "ws": "^6.2.1", "yargs": "12.0.5" }, "dependencies": { - "ansi-colors": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", - "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", - "dev": true - }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, "cliui": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", @@ -17300,23 +17556,9 @@ "rimraf": "^2.6.3" } }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "globby": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { @@ -17329,16 +17571,16 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } } }, "is-path-cwd": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.1.0.tgz", - "integrity": "sha512-Sc5j3/YnM8tDeyCsVeKlm/0p95075DyLmDEIkSgQ7mXkrOX+uTCtmQFm0CYzVyJwcCCmO3k8qfJt17SxQwB5Zw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", "dev": true }, "is-path-in-cwd": { @@ -17359,12 +17601,6 @@ "path-is-inside": "^1.0.2" } }, - "mime": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", - "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==", - "dev": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -17378,18 +17614,18 @@ "dev": true }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "requires": { "glob": "^7.1.3" } }, "semver": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz", - "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, "strip-ansi": { @@ -17420,28 +17656,6 @@ "querystring": "0.2.0" } }, - "webpack-dev-middleware": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.7.0.tgz", - "integrity": "sha512-qvDesR1QZRIAZHOE3iQ4CXLZZSQ1lAUsSpnQmlB1PBfoN/xdRjmge3Dok0W4IdaVLJOGJy3sGI4sZHwjRU0PCA==", - "dev": true, - "requires": { - "memory-fs": "^0.4.1", - "mime": "^2.4.2", - "range-parser": "^1.2.1", - "webpack-log": "^2.0.0" - } - }, - "webpack-log": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz", - "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==", - "dev": true, - "requires": { - "ansi-colors": "^3.0.0", - "uuid": "^3.3.2" - } - }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", @@ -17480,19 +17694,37 @@ } } }, - "webpack-merge": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.1.tgz", - "integrity": "sha512-4p8WQyS98bUJcCvFMbdGZyZmsKuWjWVnVHnAS3FFg0HDaRVrPbkivx2RYCre8UiemD67RsiFFLfn4JhLAin8Vw==", + "webpack-log": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz", + "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==", "dev": true, "requires": { - "lodash": "^4.17.5" + "ansi-colors": "^3.0.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "ansi-colors": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", + "dev": true + } + } + }, + "webpack-merge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz", + "integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==", + "dev": true, + "requires": { + "lodash": "^4.17.15" } }, "webpack-sources": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz", - "integrity": "sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", + "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", "dev": true, "requires": { "source-list-map": "^2.0.0", @@ -17678,6 +17910,15 @@ "signal-exit": "^3.0.2" } }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, "x-xss-protection": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/x-xss-protection/-/x-xss-protection-1.3.0.tgz", @@ -17710,17 +17951,24 @@ "dev": true }, "xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "requires": { "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" + "xmlbuilder": "~11.0.0" + }, + "dependencies": { + "xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" + } } }, "xmlbuilder": { "version": "9.0.7", - "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" }, "xmlcreate": { @@ -17738,11 +17986,6 @@ "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" }, - "xregexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", - "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=" - }, "xtend": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/xtend/-/xtend-1.0.3.tgz", @@ -17755,9 +17998,9 @@ "dev": true }, "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "yaml-loader": { "version": "0.5.0", @@ -17901,6 +18144,7 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "dev": true, "requires": { "fd-slicer": "~1.0.1" } diff --git a/package.json b/package.json index d17e01ead..8077ba9a8 100644 --- a/package.json +++ b/package.json @@ -10,36 +10,35 @@ }, "dependencies": { "compression": "^1.7.3", - "electron": "^7.1.2", "fs-extra": "^5.0.0", - "helmet": "^3.21.1", - "i18n": "^0.8.3", + "helmet": "^3.21.2", + "i18n": "^0.8.4", "loopback": "^3.26.0", "loopback-boot": "^2.27.1", - "loopback-component-explorer": "^6.3.1", + "loopback-component-explorer": "^6.5.0", "loopback-component-storage": "^3.6.1", - "loopback-connector-mysql": "^5.3.1", + "loopback-connector-mysql": "^5.4.2", "loopback-connector-remote": "^3.4.1", "loopback-context": "^3.4.0", "md5": "^2.2.1", "object-diff": "0.0.4", "object.pick": "^1.3.0", "request": "^2.88.0", - "request-promise-native": "^1.0.7", + "request-promise-native": "^1.0.8", "require-yaml": "0.0.1", "soap": "^0.26.0", "strong-error-handler": "^2.3.2", - "uuid": "^3.3.2", + "uuid": "^3.3.3", "vn-loopback": "file:./loopback", - "xml2js": "^0.4.19" + "xml2js": "^0.4.23" }, "devDependencies": { - "@babel/core": "^7.6.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/polyfill": "^7.2.5", - "@babel/preset-env": "^7.6.0", - "@babel/register": "^7.0.0", - "angular-mocks": "^1.7.7", + "@babel/core": "^7.7.7", + "@babel/plugin-syntax-dynamic-import": "^7.7.4", + "@babel/polyfill": "^7.7.0", + "@babel/preset-env": "^7.7.7", + "@babel/register": "^7.7.7", + "angular-mocks": "^1.7.9", "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", "babel-preset-es2015": "^6.24.1", @@ -63,9 +62,9 @@ "gulp-yaml": "^1.0.1", "html-loader": "^0.4.5", "html-loader-jest": "^0.2.1", - "html-webpack-plugin": "^4.0.0-beta.5", + "html-webpack-plugin": "^4.0.0-beta.11", "identity-obj-proxy": "^3.0.0", - "jasmine": "^3.4.0", + "jasmine": "^3.5.0", "jasmine-reporters": "^2.3.2", "jasmine-spec-reporter": "^4.2.1", "jest": "^24.9.0", @@ -73,18 +72,18 @@ "json-loader": "^0.5.7", "merge-stream": "^1.0.1", "minimist": "^1.2.0", - "mysql2": "^1.6.5", - "nightmare": "^3.0.2", - "node-sass": "^4.9.3", - "nodemon": "^1.18.10", + "mysql2": "^1.7.0", + "node-sass": "^4.13.0", + "nodemon": "^1.19.4", "plugin-error": "^1.0.1", + "puppeteer": "^2.0.0", "raw-loader": "^1.0.0", - "sass-loader": "^7.1.0", + "sass-loader": "^7.3.1", "style-loader": "^0.23.1", - "webpack": "^4.29.5", - "webpack-cli": "^3.2.3", - "webpack-dev-server": "^3.1.14", - "webpack-merge": "^4.2.1", + "webpack": "^4.41.5", + "webpack-cli": "^3.3.10", + "webpack-dev-server": "^3.10.1", + "webpack-merge": "^4.2.2", "yaml-loader": "^0.5.0" }, "scripts": { diff --git a/print/core/config.js b/print/core/config.js index 8db388401..864e1658a 100644 --- a/print/core/config.js +++ b/print/core/config.js @@ -4,8 +4,10 @@ let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; let configPath = `/etc/salix`; let config = require('../config/print.json'); let configFiles = [ + `${appPath}/config/print.local.json`, `${appPath}/config/print.${env}.json`, `${configPath}/print.json`, + `${configPath}/print.local.json`, `${configPath}/print.${env}.json` ]; diff --git a/print/core/filters/date.js b/print/core/filters/date.js index 37b9dd16f..0988eda75 100644 --- a/print/core/filters/date.js +++ b/print/core/filters/date.js @@ -1,6 +1,6 @@ const Vue = require('vue'); const strftime = require('strftime'); -Vue.filter('date', function(value, specifiers) { +Vue.filter('date', function(value, specifiers = '%d-%m-%Y') { return strftime(specifiers, value); }); diff --git a/print/methods/closure.js b/print/methods/closure.js index 4b25c5abc..05490609d 100644 --- a/print/methods/closure.js +++ b/print/methods/closure.js @@ -4,7 +4,7 @@ const smtp = require('../core/smtp'); const config = require('../core/config'); module.exports = app => { - app.get('/api/closure', async function(req, res) { + app.get('/api/closure', async function(request, response) { const failedtickets = []; const tickets = await db.rawSql(` SELECT @@ -59,7 +59,7 @@ module.exports = app => { }); } - res.status(200).json({ + response.status(200).json({ message: 'Closure executed successfully' }); }); diff --git a/print/templates/email/buyer-week-waste/assets/css/import.js b/print/templates/email/buyer-week-waste/assets/css/import.js new file mode 100644 index 000000000..c742fdf90 --- /dev/null +++ b/print/templates/email/buyer-week-waste/assets/css/import.js @@ -0,0 +1,9 @@ +const Stylesheet = require(`${appPath}/core/stylesheet`); + +module.exports = new Stylesheet([ + `${appPath}/common/css/spacing.css`, + `${appPath}/common/css/misc.css`, + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/email.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/email/buyer-week-waste/assets/css/style.css b/print/templates/email/buyer-week-waste/assets/css/style.css new file mode 100644 index 000000000..5db85befa --- /dev/null +++ b/print/templates/email/buyer-week-waste/assets/css/style.css @@ -0,0 +1,5 @@ +.external-link { + border: 2px dashed #8dba25; + border-radius: 3px; + text-align: center +} \ No newline at end of file diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html new file mode 100644 index 000000000..b9ebd6175 --- /dev/null +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html @@ -0,0 +1,76 @@ + + + + + + {{ $t('subject') }} + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+
+
+ +
+
+ + + + + + + + + + + + + + + + + +
{{$t('buyer')}}{{$t('percentage')}}{{$t('dwindle')}}{{$t('total')}}
{{waste.buyer}}{{(waste.percentage / 100) | percentage(2, 2, locale)}}{{waste.dwindle | currency('EUR', locale)}}{{waste.total | currency('EUR', locale)}}
+

+ +
+
+ + +
+
+ +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.js b/print/templates/email/buyer-week-waste/buyer-week-waste.js new file mode 100755 index 000000000..4639e7d5b --- /dev/null +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.js @@ -0,0 +1,31 @@ +const Component = require(`${appPath}/core/component`); +const db = require(`${appPath}/core/database`); +const emailHeader = new Component('email-header'); +const emailFooter = new Component('email-footer'); + +module.exports = { + name: 'buyer-week-waste', + async serverPrefetch() { + this.wastes = await this.fetchWastes(); + + if (!this.wastes) + throw new Error('Something went wrong'); + }, + computed: { + dated: function() { + const filters = this.$options.filters; + + return filters.date(new Date(), '%d-%m-%Y'); + } + }, + methods: { + fetchWastes() { + return db.findOne(`CALL bs.weekWaste()`); + } + }, + components: { + 'email-header': emailHeader.build(), + 'email-footer': emailFooter.build() + }, + props: {} +}; diff --git a/print/templates/email/buyer-week-waste/locale/es.yml b/print/templates/email/buyer-week-waste/locale/es.yml new file mode 100644 index 000000000..d4220dd91 --- /dev/null +++ b/print/templates/email/buyer-week-waste/locale/es.yml @@ -0,0 +1,9 @@ +subject: Merma semanal +title: Merma semanal +dear: Hola +description: A continuación se muestra la merma semanal a fecha de {0}. +buyer: Comprador +percentage: Porcentaje +dwindle: Merma +total: Total +wasteDetailLink: 'Para ver el desglose de mermas haz clic en el siguiente enlace:' \ No newline at end of file diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml index 39568bd1b..77a3a7299 100644 --- a/print/templates/email/printer-setup/locale/es.yml +++ b/print/templates/email/printer-setup/locale/es.yml @@ -10,6 +10,8 @@ description: necesitarás el QLabel, el programa para imprimir las cintas. downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/gGnOPoojkP6vC1lgmrbEqQ.file?v01 + downloadDriver: En este enlace puedes descargar el driver de la impresora https://es.seagullscientific.com/support/downloads/drivers/godex/download/ sections: QLabel: title: Utilización de QLabel diff --git a/print/templates/email/printer-setup/printer-setup.html b/print/templates/email/printer-setup/printer-setup.html index 12dcf4877..6b295bd8f 100644 --- a/print/templates/email/printer-setup/printer-setup.html +++ b/print/templates/email/printer-setup/printer-setup.html @@ -28,6 +28,7 @@

{{$t('description.instructions')}}

+

{{$t('sections.QLabel.title')}}

{{$t('sections.QLabel.description')}}:

diff --git a/print/templates/reports/claim-pickup-order/locale/es.yml b/print/templates/reports/claim-pickup-order/locale/es.yml index 534fd2da8..b37793b70 100644 --- a/print/templates/reports/claim-pickup-order/locale/es.yml +++ b/print/templates/reports/claim-pickup-order/locale/es.yml @@ -12,4 +12,4 @@ claim: Reclamación {0} sections: agency: description: 'Para agilizar tu recogida, por favor, pónte en contacto con la oficina - de integrados.
Tlf: 96 166 77 88 - Ana Gómez (Ext. 2133) (agomezf@integra2.es)' + de integrados.
Tlf: 96 166 77 88 - Ana Gómez (Ext. 2113) (agomezf@integra2.es)' diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 1bad225de..77f214c07 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -231,7 +231,7 @@
{{$t('digitalSignature')}}
-
{{signature.created | date}}
+
{{signature.created | date('%d-%m-%Y')}}