From 8679aefb4881b70f46659813e3e71e52cb40846e Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 3 Mar 2023 07:36:04 +0100 Subject: [PATCH 001/294] refs #4713 procs deprecated, originalQuantity deleted --- back/methods/collection/setSaleQuantity.js | 3 +-- db/changes/231001/00-saleTracking.sql | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 db/changes/231001/00-saleTracking.sql diff --git a/back/methods/collection/setSaleQuantity.js b/back/methods/collection/setSaleQuantity.js index 4ac3d6d4b..0638539e3 100644 --- a/back/methods/collection/setSaleQuantity.js +++ b/back/methods/collection/setSaleQuantity.js @@ -40,8 +40,7 @@ module.exports = Self => { try { const sale = await models.Sale.findById(saleId, null, myOptions); const saleUpdated = await sale.updateAttributes({ - originalQuantity: sale.quantity, - quantity: quantity + quantity }, myOptions); if (tx) await tx.commit(); diff --git a/db/changes/231001/00-saleTracking.sql b/db/changes/231001/00-saleTracking.sql new file mode 100644 index 000000000..ce9bd8505 --- /dev/null +++ b/db/changes/231001/00-saleTracking.sql @@ -0,0 +1,5 @@ +DROP PROCEDURE `vn`.`sale_setQuantity`; +DROP PROCEDURE `vn`.`collection_updateSale`; +DROP PROCEDURE `vn`.`replaceMovimientosMark`; +DROP PROCEDURE `vn`.`saleTracking_Replace`; +DROP PROCEDURE `vn`.`sale_updateOriginalQuantity`; From 106f96b9a6fb77f5b5b768a8fbe4527eb19cd441 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 8 Mar 2023 12:10:08 +0100 Subject: [PATCH 002/294] refs #4713 fixed front test --- back/methods/collection/spec/setSaleQuantity.spec.js | 2 +- db/changes/231001/.gitkeep | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 db/changes/231001/.gitkeep diff --git a/back/methods/collection/spec/setSaleQuantity.spec.js b/back/methods/collection/spec/setSaleQuantity.spec.js index 63dc3bd2d..516382606 100644 --- a/back/methods/collection/spec/setSaleQuantity.spec.js +++ b/back/methods/collection/spec/setSaleQuantity.spec.js @@ -15,7 +15,7 @@ describe('setSaleQuantity()', () => { await models.Collection.setSaleQuantity(saleId, newQuantity, options); const updateSale = await models.Sale.findById(saleId, null, options); - expect(updateSale.originalQuantity).toEqual(originalSale.quantity); + expect(updateSale.quantity).not.toEqual(originalSale.quantity); expect(updateSale.quantity).toEqual(newQuantity); await tx.rollback(); diff --git a/db/changes/231001/.gitkeep b/db/changes/231001/.gitkeep deleted file mode 100644 index e69de29bb..000000000 From 0579c563b95757fb3fba0eaca92996a39c265643 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 22 Mar 2023 15:03:12 +0100 Subject: [PATCH 003/294] refs #5327 ordernar por columnas --- .../ticket/back/methods/ticket/getSales.js | 37 ++++++++++++++----- modules/ticket/front/sale/index.html | 18 ++++----- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index 321e8e24e..17261f6fc 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -3,13 +3,20 @@ module.exports = Self => { Self.remoteMethod('getSales', { description: 'New filter', accessType: 'READ', - accepts: [{ - arg: 'id', - type: 'number', - required: true, - description: 'The ticket id', - http: {source: 'path'} - }], + accepts: [ + { + arg: 'filter', + type: 'object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + }, + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }], returns: { type: ['object'], root: true @@ -20,14 +27,24 @@ module.exports = Self => { } }); - Self.getSales = async(id, options) => { + Self.getSales = async(filter, id, options) => { const models = Self.app.models; - const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); + // let newFilter; + // if (filter && filter.order) { + // const filterOrder = filter.order; + // const saleColumns = ['itemFk', 'quantity', 'concept', 'price', 'discount']; + + // for (const saleColum of saleColumns) { + // if (filterOrder.includes(saleColum)) return newFilter = filter.order; + // else newFilter = 'concept'; + // } + // } + // console.log(newFilter); const sales = await models.Sale.find({ include: { relation: 'item', @@ -53,7 +70,7 @@ module.exports = Self => { } }, where: {ticketFk: id}, - order: 'concept' + order: newFilter }, myOptions); // Get items available diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 8764417a8..74cb101f4 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -60,15 +60,15 @@ - Visible - Available - Id - Quantity - Item - Price - Disc - Amount - Packaging + Visible + Available + Id + Quantity + Item + Price + Disc + Amount + Packaging From 34126119e2c0cd43a220b07fe573c650f59a8986 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 23 Mar 2023 09:02:22 +0100 Subject: [PATCH 004/294] fix errors --- modules/ticket/back/methods/ticket/getSales.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index 17261f6fc..e3d6af389 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -29,22 +29,13 @@ module.exports = Self => { Self.getSales = async(filter, id, options) => { const models = Self.app.models; + const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - // let newFilter; - // if (filter && filter.order) { - // const filterOrder = filter.order; - // const saleColumns = ['itemFk', 'quantity', 'concept', 'price', 'discount']; - - // for (const saleColum of saleColumns) { - // if (filterOrder.includes(saleColum)) return newFilter = filter.order; - // else newFilter = 'concept'; - // } - // } - // console.log(newFilter); + console.log(filter); const sales = await models.Sale.find({ include: { relation: 'item', @@ -70,7 +61,7 @@ module.exports = Self => { } }, where: {ticketFk: id}, - order: newFilter + order: 'concept' }, myOptions); // Get items available @@ -126,7 +117,7 @@ module.exports = Self => { if (salesWithLogs.includes(sale.id)) sale.$hasLogs = true; } - + console.log(sales); return sales; }; }; From 5b80951e3eaf1a4734a9894111f914db75cff888 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 3 Apr 2023 03:54:35 +0200 Subject: [PATCH 005/294] refs #5517 vnLog: View improved --- front/core/components/index.js | 1 + front/core/components/json-value/index.html | 1 + front/core/components/json-value/index.js | 56 +++++++ front/core/components/json-value/style.scss | 21 +++ front/core/components/table/style.scss | 21 ++- front/salix/components/log/index.html | 144 ++++++++++------- front/salix/components/log/index.js | 44 +++--- front/salix/components/log/locale/es.yml | 1 + front/salix/components/log/style.scss | 161 ++++++++++++++------ 9 files changed, 313 insertions(+), 137 deletions(-) create mode 100644 front/core/components/json-value/index.html create mode 100644 front/core/components/json-value/index.js create mode 100644 front/core/components/json-value/style.scss diff --git a/front/core/components/index.js b/front/core/components/index.js index 86ab89212..44b8beb45 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -32,6 +32,7 @@ import './float-button'; import './icon-menu'; import './icon-button'; import './input-number'; +import './json-value'; import './label-value'; import './range'; import './input-time'; diff --git a/front/core/components/json-value/index.html b/front/core/components/json-value/index.html new file mode 100644 index 000000000..dc1c97709 --- /dev/null +++ b/front/core/components/json-value/index.html @@ -0,0 +1 @@ + diff --git a/front/core/components/json-value/index.js b/front/core/components/json-value/index.js new file mode 100644 index 000000000..c92227ed3 --- /dev/null +++ b/front/core/components/json-value/index.js @@ -0,0 +1,56 @@ +import ngModule from '../../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +const maxStrLen = 25; + +/** + * Displays pretty JSON value. + * + * @property {*} value The value + */ +export default class Controller extends Component { + get value() { + return this._value; + } + + set value(value) { + this._value = value; + const span = this.element; + const formattedValue = this.formatValue(value); + span.textContent = formattedValue; + span.title = typeof value == 'string' && value.length > maxStrLen ? value : ''; + span.className = `js-${value == null ? 'null' : typeof value}`; + } + + formatValue(value) { + if (value == null) return '∅'; + switch (typeof value) { + case 'boolean': + return value ? '✓' : '✗'; + case 'string': + return value.length <= maxStrLen + ? value + : value.substring(0, maxStrLen) + '...'; + case 'object': + if (value instanceof Date) { + const hasZeroTime = + value.getHours() === 0 && + value.getMinutes() === 0 && + value.getSeconds() === 0; + const format = hasZeroTime ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm:ss'; + return this.$filter('date')(value, format); + } else + return value; + default: + return value; + } + } +} + +ngModule.vnComponent('vnJsonValue', { + controller: Controller, + bindings: { + value: ' thead, + & > tbody, + & > tfoot, + & > vn-thead, + & > vn-tbody, + & > vn-tfoot, + & > .vn-thead, + & > .vn-tbody, + & > .vn-tfoot { & > * { display: table-row; @@ -111,14 +116,14 @@ vn-table { color: inherit; } } - a.vn-tbody { + & > a.vn-tbody { &.clickable { @extend %clickable; } } - vn-tbody > *, - .vn-tbody > *, - tbody > * { + & > vn-tbody > *, + & > .vn-tbody > *, + & > tbody > * { border-bottom: $border-thin; &:last-child { diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index 79dfcef8c..1bb8b1705 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -9,63 +9,99 @@ limit="20" auto-load="true"> - + - - - - Date - User - Model - Action - Name - Changes - - - - - - {{::log.creationDate | date:'dd/MM/yyyy HH:mm'}} - - - {{::log.user.name || 'System' | translate}} + + + + + + + + + + + + + + + + + + + +
+ Action + + Model + + Date +
+ + {{::log.user.name}} - - - {{::log.changedModel}} - - - {{::$ctrl.actionsText[log.action]}} - - - {{::log.changedModelValue}} - - - - - - - - - - - - - - - - - -
FieldBeforeAfter
{{prop.name}}{{prop.old}}{{prop.new}}
-
- {{::log.description}} + + System + +
+ + {{::log.changedModel}} + + + {{::log.changedModelValue}} + + + #{{::log.changedModelId}} + + + {{::log.creationDate | date:'dd/MM/yyyy HH:mm'}} +
+ + {{::$ctrl.actionsText[log.action]}} + + +
+ + + + +
+ + + {{::prop.name}}: + , + +
+
+ {{::prop.name}}: + + + ← + +
+
+
+ + {{::log.description}} + + + No changes + +
- - - - +
diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index 1c54aa9b8..f1eedf72e 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -13,6 +13,12 @@ export default class Controller extends Section { delete: 'Deletes', select: 'Views' }; + this.actionsClass = { + insert: 'success', + update: 'warning', + delete: 'alert', + select: 'notice' + }; this.filter = { include: [{ relation: 'user', @@ -50,8 +56,8 @@ export default class Controller extends Section { for (const prop of props) { log.props.push({ name: locale[prop] || prop, - old: this.formatValue(oldValues[prop]), - new: this.formatValue(newValues[prop]) + old: this.castValue(oldValues[prop]), + new: this.castValue(newValues[prop]) }); } } @@ -61,31 +67,19 @@ export default class Controller extends Section { return !(this.changedModel && this.changedModelId); } - formatValue(value) { - let type = typeof value; + castValue(value) { + return typeof value === 'string' && validDate.test(value) + ? new Date(value) + : value; + } - if (type === 'string' && validDate.test(value)) { - value = new Date(value); - type = typeof value; - } + mainVal(prop, action) { + return action == 'delete' ? prop.old : prop.new; + } - switch (type) { - case 'boolean': - return value ? '✓' : '✗'; - case 'object': - if (value instanceof Date) { - const hasZeroTime = - value.getHours() === 0 && - value.getMinutes() === 0 && - value.getSeconds() === 0; - const format = hasZeroTime ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm:ss'; - return this.$filter('date')(value, format); - } - else - return value; - default: - return value; - } + toggleAttributes(log, changesEl, force) { + log.expand = force; + changesEl.classList.toggle('expanded', force); } showWorkerDescriptor(event, workerId) { diff --git a/front/salix/components/log/locale/es.yml b/front/salix/components/log/locale/es.yml index d341095d8..142175888 100644 --- a/front/salix/components/log/locale/es.yml +++ b/front/salix/components/log/locale/es.yml @@ -13,3 +13,4 @@ Views: Visualiza System: Sistema note: nota Changes: Cambios +No changes: No hay cambios diff --git a/front/salix/components/log/style.scss b/front/salix/components/log/style.scss index 68cd5a047..00b08df64 100644 --- a/front/salix/components/log/style.scss +++ b/front/salix/components/log/style.scss @@ -1,66 +1,127 @@ @import "variables"; vn-log { - vn-td { - vertical-align: initial !important; + .vn-table { + table-layout: fixed; + + & > thead, + & > tbody { + & > tr { + td, th { + &:first-child { + padding-left: 16px; + } + &:last-child { + padding-right: 16px; + } + } + } + } + & > thead > tr > th { + max-width: initial; + } + & > tbody { + border-bottom: 1px solid rgba(0, 0, 0, 0.3); + + &:last-child { + border-bottom: none; + } + & > tr { + border-bottom: none; + height: initial; + + & > td { + padding-top: 16px; + padding-bottom: 16px; + + &.action > .chip { + display: inline-block; + } + } + &.change-header > td { + padding-bottom: 0; + } + &.change-detail > td { + padding-top: 6px; + vertical-align: top; + } + } + } + th, td { + &.action, + &.user { + width: 90px; + } + &.date { + width: 120px; + text-align: right; + } + } + } + .model-value { + font-style: italic; + color: #c7bd2b; + } + .model-id { + color: $color-font-secondary; + font-size: .9em; } .changes { - display: none; - } - .label { + overflow: hidden; + background-color: rgba(255, 255, 255, .05); + border-radius: 4px; color: $color-font-secondary; - } - .value { - color: $color-font; - } + transition: max-height 150ms ease-in-out; + max-height: 28px; + position: relative; - @media screen and (max-width: 1570px) { - vn-table .expendable { + & > .expand-button, + & > .shrink-button { display: none; } - .changes { - padding-top: 10px; - display: block; + &.props { + padding-right: 24px; + + & > .expand-button, + & > .shrink-button { + position: absolute; + top: 6px; + right: 8px; + font-size: inherit; + float: right; + cursor: pointer; + } + & > .expand-button { + display: block; + } + &.expanded { + max-height: 500px; + padding-right: 0; + + & > .changes-wrapper { + text-overflow: initial; + white-space: initial; + } + & > .shrink-button { + display: block; + } + & > .expand-button { + display: none; + } + } } - } - .attributes { - width: 100%; + & > .changes-wrapper { + padding: 4px 6px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; - tr { - height: 10px; - - & > td { - padding: 2px; + & > .no-changes { + font-style: italic; } - & > td.field, - & > th.field { - width: 20%; - color: gray; - } - & > td.before, - & > th.before, - & > td.after, - & > th.after { - width: 40%; - white-space: pre-line; + .json-field { + text-transform: capitalize; } } } } -.ellipsis { - white-space: nowrap; - overflow: hidden; - max-width: 400px; - text-overflow: ellipsis; - display: inline-block; -} -.no-ellipsize, -[no-ellipsize] { - text-overflow: ''; - white-space: normal; - overflow: auto; -} -.alignSpan { - overflow: hidden; - display: inline-block; -} From 12074bd0f4cf896b9cf9dc7a415e0f148b33449c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 3 Apr 2023 04:13:09 +0200 Subject: [PATCH 006/294] refs #5517 vnLog: watchers fixes --- front/salix/components/log/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index 1bb8b1705..8174e19cc 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -74,15 +74,15 @@ {{::prop.name}}: - , + ,
{{::prop.name}}: - + - ← + ←
@@ -91,7 +91,7 @@ class="description"> {{::log.description}} - No changes From 7f18366ece0d61df0aaf92607966bf0f8c257036 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 3 Apr 2023 18:40:50 +0200 Subject: [PATCH 007/294] refs #5517 Relative dates, style fixes --- front/salix/components/log/index.html | 4 ++-- front/salix/components/log/index.js | 25 ++++++++++++++++++++++++ front/salix/components/log/locale/es.yml | 2 ++ front/salix/components/log/style.scss | 8 +++++++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index 8174e19cc..14a3fbe61 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -48,8 +48,8 @@ #{{::log.changedModelId}} - - {{::log.creationDate | date:'dd/MM/yyyy HH:mm'}} + + {{::$ctrl.relativeDate(log.creationDate)}} diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index f1eedf72e..63b4cedf4 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -33,6 +33,10 @@ export default class Controller extends Section { }, }], }; + this.dateFilter = this.$filter('date'); + this.lang = this.$translate.use(); + this.today = Date.vnNew(); + this.today.setHours(0, 0, 0, 0); } get logs() { @@ -82,6 +86,27 @@ export default class Controller extends Section { changesEl.classList.toggle('expanded', force); } + relativeDate(dateVal) { + const date = new Date(dateVal); + const dateZeroTime = new Date(dateVal); + dateZeroTime.setHours(0, 0, 0, 0); + const diff = Math.trunc((this.today.getTime() - dateZeroTime.getTime()) / (1000 * 3600 * 24)); + + let format; + if (diff == 0) + format = `'${this.$t('today')}'`; + else if (diff == 1) + format = `'${this.$t('yesterday')}'`; + else if (diff >= 2 && diff <= 5) + format = `'${date.toLocaleDateString(this.lang, {weekday: 'short'})}'`; + else if (this.today.getFullYear() == date.getFullYear()) + format = `dd/MM`; + else + format = `dd/MM/yyyy`; + + return this.dateFilter(date, `${format} HH:mm`); + } + showWorkerDescriptor(event, workerId) { if (!workerId) return; this.$.workerDescriptor.show(event.target, workerId); diff --git a/front/salix/components/log/locale/es.yml b/front/salix/components/log/locale/es.yml index 142175888..385b42147 100644 --- a/front/salix/components/log/locale/es.yml +++ b/front/salix/components/log/locale/es.yml @@ -14,3 +14,5 @@ System: Sistema note: nota Changes: Cambios No changes: No hay cambios +today: hoy +yesterday: ayer diff --git a/front/salix/components/log/style.scss b/front/salix/components/log/style.scss index 00b08df64..1573218f4 100644 --- a/front/salix/components/log/style.scss +++ b/front/salix/components/log/style.scss @@ -37,6 +37,12 @@ vn-log { &.action > .chip { display: inline-block; } + &.date { + color: $color-font-secondary; + text-transform: capitalize; + font-style: italic; + font-size: .9em; + } } &.change-header > td { padding-bottom: 0; @@ -53,7 +59,7 @@ vn-log { width: 90px; } &.date { - width: 120px; + width: 115px; text-align: right; } } From ae22c58ecbe2c7c40797797b7834f5db815efb19 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 3 Apr 2023 18:48:40 +0200 Subject: [PATCH 008/294] refs #5517 JSON value component code clean, max str len increased --- front/core/components/json-value/index.html | 1 - front/core/components/json-value/index.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 front/core/components/json-value/index.html diff --git a/front/core/components/json-value/index.html b/front/core/components/json-value/index.html deleted file mode 100644 index dc1c97709..000000000 --- a/front/core/components/json-value/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/front/core/components/json-value/index.js b/front/core/components/json-value/index.js index c92227ed3..02c693e54 100644 --- a/front/core/components/json-value/index.js +++ b/front/core/components/json-value/index.js @@ -2,7 +2,7 @@ import ngModule from '../../module'; import Component from 'core/lib/component'; import './style.scss'; -const maxStrLen = 25; +const maxStrLen = 50; /** * Displays pretty JSON value. From 3cc61916961dae2f06101df1af6b26bb6ef291b7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 4 Apr 2023 19:01:19 +0200 Subject: [PATCH 009/294] refs #5517 Show abr month name in relative date --- front/salix/components/log/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index 63b4cedf4..bb5ff691f 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -100,7 +100,7 @@ export default class Controller extends Section { else if (diff >= 2 && diff <= 5) format = `'${date.toLocaleDateString(this.lang, {weekday: 'short'})}'`; else if (this.today.getFullYear() == date.getFullYear()) - format = `dd/MM`; + format = `d '${date.toLocaleDateString(this.lang, {month: 'short'})}'`; else format = `dd/MM/yyyy`; From f7191f0f7fc7e4e054d3de1cce6e2fc1530c4f00 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 6 Apr 2023 08:37:26 +0200 Subject: [PATCH 010/294] refs #5517 log relativeDate function fixes --- front/salix/components/log/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index bb5ff691f..94b600325 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -97,7 +97,7 @@ export default class Controller extends Section { format = `'${this.$t('today')}'`; else if (diff == 1) format = `'${this.$t('yesterday')}'`; - else if (diff >= 2 && diff <= 5) + else if (diff < 7) format = `'${date.toLocaleDateString(this.lang, {weekday: 'short'})}'`; else if (this.today.getFullYear() == date.getFullYear()) format = `d '${date.toLocaleDateString(this.lang, {month: 'short'})}'`; From faab024e24ba61ed6095cc7e7796025642514e6a Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 6 Apr 2023 09:59:45 +0200 Subject: [PATCH 011/294] test --- modules/ticket/front/sale/index.html | 6 +++--- modules/ticket/front/sale/index.js | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 74cb101f4..2b3674a75 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -63,7 +63,7 @@ Visible Available Id - Quantity + Quantity Item Price Disc @@ -73,7 +73,7 @@ - + @@ -232,7 +232,7 @@ vn-tooltip="Add item" vn-bind="+" icon="add_circle" - ng-click="$ctrl.add()" + ng-click="$ctrl.cambiarOrden('quantity')" disabled="!$ctrl.isEditable"> diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index f3fb89d04..075532d8f 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -7,6 +7,12 @@ class Controller extends Section { super($element, $); this._sales = []; this.manaCode = 'mana'; + this.ordenarPor = 'quantity'; + } + + cambiarOrden(columna) { + this.ordenarPor = columna; + console.log(this.ordenarPor); } get manaCode() { From 9f4d027014e206ef8b281354f94550bac4d2046f Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 6 Apr 2023 15:36:14 +0200 Subject: [PATCH 012/294] refs #5316 sql --- db/changes/231401/00-kkearEntryNotes.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/changes/231401/00-kkearEntryNotes.sql diff --git a/db/changes/231401/00-kkearEntryNotes.sql b/db/changes/231401/00-kkearEntryNotes.sql new file mode 100644 index 000000000..ff5c7ce29 --- /dev/null +++ b/db/changes/231401/00-kkearEntryNotes.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`entry` DROP COLUMN `notes`; \ No newline at end of file From d7d4b9515eef07db6b9af3d00baa13a5356fe1e7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 6 Apr 2023 17:02:45 +0200 Subject: [PATCH 013/294] refs #5517 json value and date format fixes --- front/core/components/json-value/index.js | 71 +++++++++++++-------- front/core/components/json-value/style.scss | 13 ++-- front/salix/components/log/index.js | 2 +- 3 files changed, 53 insertions(+), 33 deletions(-) diff --git a/front/core/components/json-value/index.js b/front/core/components/json-value/index.js index 02c693e54..6bf0ae4aa 100644 --- a/front/core/components/json-value/index.js +++ b/front/core/components/json-value/index.js @@ -15,36 +15,53 @@ export default class Controller extends Component { } set value(value) { + const wasEmpty = this._value === undefined; this._value = value; - const span = this.element; - const formattedValue = this.formatValue(value); - span.textContent = formattedValue; - span.title = typeof value == 'string' && value.length > maxStrLen ? value : ''; - span.className = `js-${value == null ? 'null' : typeof value}`; - } - formatValue(value) { - if (value == null) return '∅'; - switch (typeof value) { - case 'boolean': - return value ? '✓' : '✗'; - case 'string': - return value.length <= maxStrLen - ? value - : value.substring(0, maxStrLen) + '...'; - case 'object': - if (value instanceof Date) { - const hasZeroTime = - value.getHours() === 0 && - value.getMinutes() === 0 && - value.getSeconds() === 0; - const format = hasZeroTime ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm:ss'; - return this.$filter('date')(value, format); - } else - return value; - default: - return value; + let text; + let cssClass; + const type = typeof value; + + if (value == null) { + text = '∅'; + cssClass = 'null'; + } else { + cssClass = type; + switch (type) { + case 'boolean': + text = value ? '✓' : '✗'; + cssClass = value ? 'true' : 'false'; + break; + case 'string': + text = value.length <= maxStrLen + ? value + : value.substring(0, maxStrLen) + '...'; + break; + case 'object': + if (value instanceof Date) { + const hasZeroTime = + value.getHours() === 0 && + value.getMinutes() === 0 && + value.getSeconds() === 0; + const format = hasZeroTime ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm:ss'; + text = this.$filter('date')(value, format); + } else + text = value; + break; + default: + text = value; + } } + + const el = this.element; + el.textContent = text; + el.title = type == 'string' && value.length > maxStrLen ? value : ''; + + cssClass = `json-${cssClass}`; + if (wasEmpty) + el.classList.add(cssClass); + else + el.classList.replace(this.className, cssClass); } } diff --git a/front/core/components/json-value/style.scss b/front/core/components/json-value/style.scss index cd9b5fae6..2d6c4023c 100644 --- a/front/core/components/json-value/style.scss +++ b/front/core/components/json-value/style.scss @@ -1,20 +1,23 @@ vn-json-value { display: inline; - &.js-string { + &.json-string { color: #d172cc; } - &.js-object { + &.json-object { /*color: #d1a572;*/ color: #d172cc; } - &.js-number { + &.json-number { color: #85d0ff; } - &.js-boolean { + &.json-true { color: #7dc489; } - &.js-null { + &.json-false { + color: #c74949; + } + &.json-null { color: #cd7c7c; font-style: italic; } diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index 94b600325..d768b2195 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -97,7 +97,7 @@ export default class Controller extends Section { format = `'${this.$t('today')}'`; else if (diff == 1) format = `'${this.$t('yesterday')}'`; - else if (diff < 7) + else if (diff > 1 && diff < 7) format = `'${date.toLocaleDateString(this.lang, {weekday: 'short'})}'`; else if (this.today.getFullYear() == date.getFullYear()) format = `d '${date.toLocaleDateString(this.lang, {month: 'short'})}'`; From cc9ce65678f175e78ad9ff15352a4578a7de0908 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Apr 2023 07:44:25 +0200 Subject: [PATCH 014/294] test --- modules/ticket/front/sale/index.html | 4 ++-- modules/ticket/front/sale/index.js | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 74cb101f4..1b378a9da 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -63,7 +63,7 @@ Visible Available Id - Quantity + Quantity Item Price Disc @@ -73,7 +73,7 @@ - + diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index f3fb89d04..379b48cc9 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -7,6 +7,11 @@ class Controller extends Section { super($element, $); this._sales = []; this.manaCode = 'mana'; + this.ordenarPor = 'nombre'; + } + + cambiarOrden(columna) { + this.ordenarPor = columna; } get manaCode() { From d21ab7a5a7f4f8db7922000a11b82321835dc4a3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 11 Apr 2023 10:32:21 +0200 Subject: [PATCH 015/294] refs #5316 primer kkeo --- db/dump/fixtures.sql | 18 +++++++++--------- e2e/helpers/selectors.js | 2 +- e2e/paths/12-entry/05_basicData.spec.js | 10 +++++----- modules/entry/back/methods/entry/filter.js | 1 - modules/entry/back/models/entry.json | 6 +++--- modules/entry/front/basic-data/index.html | 4 ++-- modules/entry/front/index/locale/es.yml | 2 +- modules/entry/front/routes.json | 2 +- modules/entry/front/summary/index.html | 4 ++-- modules/travel/front/summary/index.html | 4 ++-- .../reports/entry-order/entry-order.html | 4 ++-- 11 files changed, 28 insertions(+), 29 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 9006c6676..e9ad6d974 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1407,16 +1407,16 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1), (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2); -INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`) +INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`) VALUES - (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, '', ''), - (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'this is the note two', 'observation two'), - (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'this is the note three', 'observation three'), - (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'this is the note four', 'observation four'), - (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'this is the note five', 'observation five'), - (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'this is the note six', 'observation six'), - (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), - (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, '', ''); + (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''), + (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'), + (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'), + (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'), + (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'), + (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'), + (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'), + (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''); INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) VALUES diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 32a60a4e2..5f86443ab 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -1240,7 +1240,7 @@ export default { entryBasicData: { reference: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.reference"]', invoiceNumber: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.invoiceNumber"]', - notes: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.notes"]', + // notes: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.notes"]', observations: 'vn-entry-basic-data vn-textarea[ng-model="$ctrl.entry.observation"]', supplier: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.supplierFk"]', currency: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.currencyFk"]', diff --git a/e2e/paths/12-entry/05_basicData.spec.js b/e2e/paths/12-entry/05_basicData.spec.js index 3b5f40c35..eec00ca96 100644 --- a/e2e/paths/12-entry/05_basicData.spec.js +++ b/e2e/paths/12-entry/05_basicData.spec.js @@ -20,7 +20,7 @@ describe('Entry basic data path', () => { it('should edit the basic data', async() => { await page.write(selectors.entryBasicData.reference, 'new movement 8'); await page.write(selectors.entryBasicData.invoiceNumber, 'new movement 8'); - await page.write(selectors.entryBasicData.notes, 'new notes'); + // await page.write(selectors.entryBasicData.notes, 'new notes'); await page.write(selectors.entryBasicData.observations, ' edited'); await page.autocompleteSearch(selectors.entryBasicData.supplier, 'Plants nick'); await page.autocompleteSearch(selectors.entryBasicData.currency, 'eur'); @@ -53,11 +53,11 @@ describe('Entry basic data path', () => { expect(result).toEqual('new movement 8'); }); - it('should confirm the note was edited', async() => { - const result = await page.waitToGetProperty(selectors.entryBasicData.notes, 'value'); + // it('should confirm the note was edited', async() => { + // const result = await page.waitToGetProperty(selectors.entryBasicData.notes, 'value'); - expect(result).toEqual('new notes'); - }); + // expect(result).toEqual('new notes'); + // }); it('should confirm the observation was edited', async() => { const result = await page.waitToGetProperty(selectors.entryBasicData.observations, 'value'); diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index e90043074..1cd12b737 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -158,7 +158,6 @@ module.exports = Self => { e.invoiceNumber, e.isBooked, e.isExcludedFromAvailable, - e.notes, e.evaNotes AS observation, e.isConfirmed, e.isOrdered, diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index 5aa175758..7747b81f9 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -31,9 +31,9 @@ "isExcludedFromAvailable": { "type": "boolean" }, - "notes": { - "type": "string" - }, + // "notes": { + // "type": "string" + // }, "isConfirmed": { "type": "boolean" }, diff --git a/modules/entry/front/basic-data/index.html b/modules/entry/front/basic-data/index.html index 68a65e890..6fd23a4f7 100644 --- a/modules/entry/front/basic-data/index.html +++ b/modules/entry/front/basic-data/index.html @@ -52,13 +52,13 @@ rule vn-focus> - - + --> - - + --> diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index 113128e0e..c19a075fc 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -100,12 +100,12 @@ {{entry.pallet}} {{entry.m3}} - - + --> -
+