From 94a51db3d59cffd35c060a6261b1fb530e99c0c1 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 7 Oct 2022 10:56:12 +0200 Subject: [PATCH 01/12] hotFix(ticket_request): autocomplete buyer --- modules/ticket/back/methods/ticket-request/getItemTypeWorker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js index fd6af2f82..0655c7bba 100644 --- a/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js +++ b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js @@ -29,7 +29,7 @@ module.exports = Self => { Object.assign(myOptions, options); const query = - `SELECT DISTINCT u.nickname + `SELECT DISTINCT u.id, u.nickname FROM itemType it JOIN worker w ON w.id = it.workerFk JOIN account.user u ON u.id = w.id`; From 6c5acc75eb9c243e3127b28454b708f24d884539 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 7 Oct 2022 12:00:06 +0200 Subject: [PATCH 02/12] Consumption fix --- .../methods/client/consumptionSendQueued.js | 80 +++++++++---------- modules/client/front/notification/index.js | 3 +- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/modules/client/back/methods/client/consumptionSendQueued.js b/modules/client/back/methods/client/consumptionSendQueued.js index 3f551d3d2..74ccf164d 100644 --- a/modules/client/back/methods/client/consumptionSendQueued.js +++ b/modules/client/back/methods/client/consumptionSendQueued.js @@ -18,50 +18,50 @@ module.exports = Self => { Self.consumptionSendQueued = async() => { const queues = await Self.rawSql(` SELECT - ccq.id, - c.id AS clientFk, - c.email AS clientEmail, - eu.email salesPersonEmail, - REPLACE(json_extract(params, '$.from'), '"', '') AS fromDate, - REPLACE(json_extract(params, '$.to'), '"', '') AS toDate - FROM clientConsumptionQueue ccq - JOIN client c ON ( - JSON_SEARCH( - JSON_ARRAY( - json_extract(params, '$.clients') - ) - , 'all', c.id) IS NOT NULL) - JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk - JOIN ticket t ON t.clientFk = c.id - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE status = '' - AND it.isPackaging = FALSE - AND DATE(t.shipped) BETWEEN - REPLACE(json_extract(params, '$.from'), '"', '') AND - REPLACE(json_extract(params, '$.to'), '"', '') - GROUP BY c.id`); + id, + params + FROM clientConsumptionQueue + WHERE status = ''`); for (const queue of queues) { try { - const args = { - id: queue.clientFk, - recipient: queue.clientEmail, - replyTo: queue.salesPersonEmail, - from: queue.fromDate, - to: queue.toDate - }; + const params = JSON.parse(queue.params); - const email = new Email('campaign-metrics', args); - await email.send(); + const clients = await Self.rawSql(` + SELECT + c.id AS clientFk, + c.email AS clientEmail, + eu.email salesPersonEmail + FROM client c + JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk + JOIN ticket t ON t.clientFk = c.id + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE c.id IN(?) + AND it.isPackaging = FALSE + AND DATE(t.shipped) BETWEEN ? AND ? + GROUP BY c.id`, [params.clients, params.from, params.to]); - await Self.rawSql(` - UPDATE clientConsumptionQueue - SET status = 'printed', - printed = ? - WHERE id = ?`, - [new Date(), queue.id]); + for (const client of clients) { + const args = { + id: client.clientFk, + recipient: client.clientEmail, + replyTo: client.salesPersonEmail, + from: params.from, + to: params.to + }; + + const email = new Email('campaign-metrics', args); + await email.send(); + + await Self.rawSql(` + UPDATE clientConsumptionQueue + SET status = 'printed', + printed = ? + WHERE id = ?`, + [new Date(), queue.id]); + } } catch (error) { await Self.rawSql(` UPDATE clientConsumptionQueue @@ -69,7 +69,7 @@ module.exports = Self => { WHERE id = ?`, [error.message, queue.id]); - throw e; + throw error; } } diff --git a/modules/client/front/notification/index.js b/modules/client/front/notification/index.js index e70af12b2..4be96bc17 100644 --- a/modules/client/front/notification/index.js +++ b/modules/client/front/notification/index.js @@ -77,12 +77,13 @@ export default class Controller extends Section { onSendClientConsumption() { const clientIds = this.checked.map(client => client.id); - const params = { + const data = { clients: clientIds, from: this.campaign.from, to: this.campaign.to }; + const params = JSON.stringify(data); this.$http.post('ClientConsumptionQueues', {params}) .then(() => this.$.filters.hide()) .then(() => this.vnApp.showSuccess(this.$t('Notifications sent!'))); From 587da840c0653d0b75f38fc971b6454da0fa6211 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 7 Oct 2022 12:16:30 +0200 Subject: [PATCH 03/12] Fix --- .../back/methods/client/consumptionSendQueued.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/client/back/methods/client/consumptionSendQueued.js b/modules/client/back/methods/client/consumptionSendQueued.js index 74ccf164d..77e0e34f2 100644 --- a/modules/client/back/methods/client/consumptionSendQueued.js +++ b/modules/client/back/methods/client/consumptionSendQueued.js @@ -54,14 +54,14 @@ module.exports = Self => { const email = new Email('campaign-metrics', args); await email.send(); - - await Self.rawSql(` - UPDATE clientConsumptionQueue - SET status = 'printed', - printed = ? - WHERE id = ?`, - [new Date(), queue.id]); } + + await Self.rawSql(` + UPDATE clientConsumptionQueue + SET status = 'printed', + printed = ? + WHERE id = ?`, + [new Date(), queue.id]); } catch (error) { await Self.rawSql(` UPDATE clientConsumptionQueue From 00d5876f8814a8af5269480c4768c0134d4c4cfa Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 7 Oct 2022 14:35:16 +0200 Subject: [PATCH 04/12] hotFix(travel_extraCommunity): fix css --- .../travel/front/extra-community/index.html | 15 ++++++------ .../travel/front/extra-community/style.scss | 23 +++++++++++-------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html index f19ab592e..fbf982b68 100644 --- a/modules/travel/front/extra-community/index.html +++ b/modules/travel/front/extra-community/index.html @@ -42,10 +42,10 @@ Id - + Supplier - + Agency @@ -100,7 +100,7 @@ {{::travel.id}} - + @@ -110,22 +110,23 @@ {{::travel.agencyModeName}} - {{::travel.stickers}} - {{::entry.ref}} + {{::entry.ref}} {{::entry.stickers}} {{::entry.loadedkg}} diff --git a/modules/travel/front/extra-community/style.scss b/modules/travel/front/extra-community/style.scss index 532a3056a..4b0dd6b22 100644 --- a/modules/travel/front/extra-community/style.scss +++ b/modules/travel/front/extra-community/style.scss @@ -3,7 +3,7 @@ vn-travel-extra-community { .header { margin-bottom: 16px; - font-size: 1.25rem; + font-size: 1.1rem; line-height: 1; padding: 7px; padding-bottom: 7px; @@ -29,10 +29,10 @@ vn-travel-extra-community { outline: 0; height: 65px; pointer-events: fill; - user-select:all; + user-select: all; } - tr[draggable] *::selection{ + tr[draggable] *::selection { background-color: transparent; } @@ -43,16 +43,19 @@ vn-travel-extra-community { tr[draggable].dragging { background-color: $color-primary-light; color: $color-font-light; - font-weight:bold; + font-weight: bold; } - .td-editable{ - input{ - font-size: 1.25rem!important; - } + .td-editable { + max-width: 200px; } - .number *{ - text-align: right; + vn-input-number.number { + min-width: 100px; + padding-right: 10px; + } + + .number * { + text-align: center; } } From 3dee50a796a0e8c5ad792623ea63eb3d04070242 Mon Sep 17 00:00:00 2001 From: joan Date: Sun, 9 Oct 2022 20:14:14 +0200 Subject: [PATCH 05/12] Updated method accessType --- modules/claim/back/methods/claim/claimPickupEmail.js | 5 +++-- modules/route/back/methods/route/driverRouteEmail.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/claim/back/methods/claim/claimPickupEmail.js b/modules/claim/back/methods/claim/claimPickupEmail.js index b946353d6..4d64cc66e 100644 --- a/modules/claim/back/methods/claim/claimPickupEmail.js +++ b/modules/claim/back/methods/claim/claimPickupEmail.js @@ -1,8 +1,9 @@ -const {Report, Email, smtp} = require('vn-print'); +const {Email} = require('vn-print'); module.exports = Self => { Self.remoteMethodCtx('claimPickupEmail', { description: 'Sends the the claim pickup order email with an attached PDF', + accessType: 'WRITE', accepts: [ { arg: 'id', @@ -40,7 +41,7 @@ module.exports = Self => { } }); - Self.claimPickupEmail = async(ctx, id) => { + Self.claimPickupEmail = async ctx => { const args = Object.assign({}, ctx.args); const params = { recipient: args.recipient, diff --git a/modules/route/back/methods/route/driverRouteEmail.js b/modules/route/back/methods/route/driverRouteEmail.js index 81d770360..4d5279d2d 100644 --- a/modules/route/back/methods/route/driverRouteEmail.js +++ b/modules/route/back/methods/route/driverRouteEmail.js @@ -3,6 +3,7 @@ const {Email} = require('vn-print'); module.exports = Self => { Self.remoteMethodCtx('driverRouteEmail', { description: 'Sends the driver route email with an attached PDF', + accessType: 'WRITE', accepts: [ { arg: 'id', From 934c0d0169456bdbaaeaa33bba2c407f1298ae65 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 10 Oct 2022 07:28:10 +0200 Subject: [PATCH 06/12] Updated unit test --- modules/client/front/notification/index.js | 2 +- modules/client/front/notification/index.spec.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/client/front/notification/index.js b/modules/client/front/notification/index.js index 4be96bc17..faa062b25 100644 --- a/modules/client/front/notification/index.js +++ b/modules/client/front/notification/index.js @@ -86,7 +86,7 @@ export default class Controller extends Section { const params = JSON.stringify(data); this.$http.post('ClientConsumptionQueues', {params}) .then(() => this.$.filters.hide()) - .then(() => this.vnApp.showSuccess(this.$t('Notifications sent!'))); + .then(() => this.vnApp.showSuccess(this.$t('Notification sent!'))); } exprBuilder(param, value) { diff --git a/modules/client/front/notification/index.spec.js b/modules/client/front/notification/index.spec.js index ea082c403..4e754f6ad 100644 --- a/modules/client/front/notification/index.spec.js +++ b/modules/client/front/notification/index.spec.js @@ -69,15 +69,16 @@ describe('Client notification', () => { data[0].$checked = true; data[1].$checked = true; - const params = Object.assign({ + const args = Object.assign({ clients: [1101, 1102] }, controller.campaign); + const params = JSON.stringify(args); $httpBackend.expect('POST', `ClientConsumptionQueues`, {params}).respond(200, params); controller.onSendClientConsumption(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Notifications sent!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Notification sent!'); }); }); From 4ecbb59ac01a88db5679afe84a68a93d56d7d99f Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 10 Oct 2022 07:49:08 +0200 Subject: [PATCH 07/12] Closure hours --- modules/ticket/back/methods/ticket/closeAll.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index 4f3813eb8..5e81e3827 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -18,6 +18,7 @@ module.exports = Self => { Self.closeAll = async() => { const toDate = new Date(); + toDate.setHours(0, 0, 0, 0); toDate.setDate(toDate.getDate() - 1); const todayMinDate = new Date(); From 18cd34bccb93c561c732601c19f1c2433a973d9b Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 10 Oct 2022 08:57:41 +0200 Subject: [PATCH 08/12] fix(travel_extraCommunity): css --- modules/travel/front/extra-community/index.html | 6 +++--- modules/travel/front/extra-community/style.scss | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html index fbf982b68..8d9b360ea 100644 --- a/modules/travel/front/extra-community/index.html +++ b/modules/travel/front/extra-community/index.html @@ -54,7 +54,7 @@ Packages - + Bl. KG @@ -100,7 +100,7 @@ {{::travel.id}} - + @@ -151,7 +151,7 @@ {{::entry.id}} - + diff --git a/modules/travel/front/extra-community/style.scss b/modules/travel/front/extra-community/style.scss index 4b0dd6b22..b3cc73a6a 100644 --- a/modules/travel/front/extra-community/style.scss +++ b/modules/travel/front/extra-community/style.scss @@ -52,10 +52,15 @@ vn-travel-extra-community { vn-input-number.number { min-width: 100px; - padding-right: 10px; } .number * { text-align: center; } + + .multi-line{ + max-width: 200px; + word-wrap: normal; + white-space: normal; + } } From e497ddd66445f83c9aaa8c37d86f048a59f1df57 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 10 Oct 2022 09:21:14 +0200 Subject: [PATCH 09/12] fix: add td-editable --- .../travel/front/extra-community/index.html | 47 +++++++++---------- .../travel/front/extra-community/style.scss | 25 +++++----- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html index 8d9b360ea..5174f8da2 100644 --- a/modules/travel/front/extra-community/index.html +++ b/modules/travel/front/extra-community/index.html @@ -54,7 +54,7 @@ Packages - + Bl. KG @@ -107,31 +107,30 @@ {{::travel.cargoSupplierNickname}} - {{::travel.agencyModeName}} - - - + {{::travel.agencyModeName}} + + + {{travel.ref}} + + + + + {{::travel.stickers}} - - - + + + {{travel.kg}} + + + + + {{::travel.loadedKg}} {{::travel.volumeKg}} diff --git a/modules/travel/front/extra-community/style.scss b/modules/travel/front/extra-community/style.scss index b3cc73a6a..fb64822f9 100644 --- a/modules/travel/front/extra-community/style.scss +++ b/modules/travel/front/extra-community/style.scss @@ -3,7 +3,6 @@ vn-travel-extra-community { .header { margin-bottom: 16px; - font-size: 1.1rem; line-height: 1; padding: 7px; padding-bottom: 7px; @@ -16,6 +15,10 @@ vn-travel-extra-community { overflow: hidden; text-overflow: ellipsis; cursor: pointer; + .multi-line{ + padding-top: 15px; + padding-bottom: 15px; + } } table[vn-droppable] { @@ -46,21 +49,19 @@ vn-travel-extra-community { font-weight: bold; } - .td-editable { - max-width: 200px; - } - - vn-input-number.number { - min-width: 100px; - } - - .number * { - text-align: center; - } .multi-line{ max-width: 200px; word-wrap: normal; white-space: normal; } + + vn-td-editable text { + background-color: transparent; + padding: 0; + border: 0; + border-bottom: 1px dashed $color-active; + border-radius: 0; + color: $color-active + } } From 31d1b84bb9efa9d69f81f84b2295eaf3dc03cedd Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 10 Oct 2022 10:25:59 +0200 Subject: [PATCH 10/12] Unfold when there's less than 100 nodes to show --- modules/zone/back/methods/zone/getLeaves.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/zone/back/methods/zone/getLeaves.js b/modules/zone/back/methods/zone/getLeaves.js index db17beb1b..1b5b116e7 100644 --- a/modules/zone/back/methods/zone/getLeaves.js +++ b/modules/zone/back/methods/zone/getLeaves.js @@ -59,7 +59,10 @@ module.exports = Self => { } const leaves = map.get(parentId); - setLeaves(leaves); + + const maxNodes = 100; + if (res.length <= maxNodes) + setLeaves(leaves); return leaves || []; }; From 990a1b3c6793d4f1cbc4b77f9c278195069e3933 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 10 Oct 2022 10:33:08 +0200 Subject: [PATCH 11/12] 250 nodes --- modules/zone/back/methods/zone/getLeaves.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/zone/back/methods/zone/getLeaves.js b/modules/zone/back/methods/zone/getLeaves.js index 1b5b116e7..ed421e339 100644 --- a/modules/zone/back/methods/zone/getLeaves.js +++ b/modules/zone/back/methods/zone/getLeaves.js @@ -60,7 +60,7 @@ module.exports = Self => { const leaves = map.get(parentId); - const maxNodes = 100; + const maxNodes = 250; if (res.length <= maxNodes) setLeaves(leaves); From 7f023d7456ff5383ab5ec0d20034d2bb64d52734 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 10 Oct 2022 12:23:40 +0200 Subject: [PATCH 12/12] Set user default warehouse --- modules/item/front/diary/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index 6d912ebe8..c997ea491 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -27,7 +27,7 @@ class Controller extends Section { if (this.$params.warehouseFk) this.warehouseFk = this.$params.warehouseFk; else if (value) - this.warehouseFk = value.itemType.warehouseFk; + this.warehouseFk = this.vnConfig.warehouseFk; if (this.$params.lineFk) this.lineFk = this.$params.lineFk;