From 0579c563b95757fb3fba0eaca92996a39c265643 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 22 Mar 2023 15:03:12 +0100 Subject: [PATCH 01/16] 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 02/16] 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 faab024e24ba61ed6095cc7e7796025642514e6a Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 6 Apr 2023 09:59:45 +0200 Subject: [PATCH 03/16] 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 cc9ce65678f175e78ad9ff15352a4578a7de0908 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Apr 2023 07:44:25 +0200 Subject: [PATCH 04/16] 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 eaf425fb518c525ef27b798cecb1fe598981dffb Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 12:30:33 +0200 Subject: [PATCH 05/16] refs #5328 mod funcion createTicketRefund --- modules/ticket/back/methods/sale/refund.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index af58a6286..2517fbd99 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -11,7 +11,7 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] - } + }, ], returns: { type: ['number'], @@ -110,11 +110,13 @@ module.exports = Self => { } }; - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions, vTicketId) { const models = Self.app.models; const filter = {include: {relation: 'address'}}; const ticket = await models.Ticket.findById(ticketId, filter, myOptions); + const query = `CALL vn.ticket_recalc(?)`; + const [result] = await Self.rawSql(query, [vTicketId]); const refundTicket = await models.Ticket.create({ clientFk: ticket.clientFk, @@ -131,7 +133,7 @@ module.exports = Self => { await models.TicketRefund.create({ refundTicketFk: refundTicket.id, originalTicketFk: ticket.id, - }, myOptions); + }, myOptions, [result]); return refundTicket; } From 3b2e1ca8d5db0e73369f62fd29fe0f08618b5557 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 12:36:30 +0200 Subject: [PATCH 06/16] ref #5328 refundTicket.id --- modules/ticket/back/methods/sale/refund.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 2517fbd99..d58875019 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -101,6 +101,8 @@ module.exports = Self => { } } + const query = `CALL vn.ticket_recalc(?)`; + const [result] = await Self.rawSql(query, [refundTicket.id]); if (tx) await tx.commit(); return refundTicket; @@ -115,8 +117,6 @@ module.exports = Self => { const filter = {include: {relation: 'address'}}; const ticket = await models.Ticket.findById(ticketId, filter, myOptions); - const query = `CALL vn.ticket_recalc(?)`; - const [result] = await Self.rawSql(query, [vTicketId]); const refundTicket = await models.Ticket.create({ clientFk: ticket.clientFk, From 566f03c4976deb68e499e11258983b3e2de880ce Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 13:03:14 +0200 Subject: [PATCH 07/16] refs #5328 commit prueba --- modules/ticket/back/methods/sale/refund.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index d58875019..9ee7735a0 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -112,7 +112,7 @@ module.exports = Self => { } }; - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions, vTicketId) { + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { const models = Self.app.models; const filter = {include: {relation: 'address'}}; @@ -133,7 +133,7 @@ module.exports = Self => { await models.TicketRefund.create({ refundTicketFk: refundTicket.id, originalTicketFk: ticket.id, - }, myOptions, [result]); + }, myOptions); return refundTicket; } From 3ac1ce403c8873013f5c77e426cedbc2e6f5b32b Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 14:06:57 +0200 Subject: [PATCH 08/16] refs #5328 myOptions --- modules/ticket/back/methods/sale/refund.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 9ee7735a0..ffbc73db0 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -100,9 +100,7 @@ module.exports = Self => { }, myOptions); } } - - const query = `CALL vn.ticket_recalc(?)`; - const [result] = await Self.rawSql(query, [refundTicket.id]); + const query = `CALL vn.ticket_recalc(?)`; await Self.rawSql(query, [refundTicket.id], myOptions); if (tx) await tx.commit(); return refundTicket; From dbd0e5138b1d396b36b35e01a53206b02e301b51 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 14:12:26 +0200 Subject: [PATCH 09/16] refs #5328 fix --- modules/ticket/back/methods/sale/refund.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index ffbc73db0..3a633de0f 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -11,7 +11,7 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] - }, + } ], returns: { type: ['number'], From 8ed17d99c3945e8cea073f77de3f0f05ba415ce9 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 11 May 2023 10:02:45 +0200 Subject: [PATCH 10/16] refs #5327 permite filtrar por columnas (desde el front) --- .../ticket/back/methods/ticket/getSales.js | 26 +++++++------------ modules/ticket/front/sale/index.html | 20 +++++++------- modules/ticket/front/sale/index.js | 6 ++--- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index e3d6af389..321e8e24e 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -3,20 +3,13 @@ module.exports = Self => { Self.remoteMethod('getSales', { description: 'New filter', 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: 'id', - type: 'number', - required: true, - description: 'The ticket id', - http: {source: 'path'} - }], + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }], returns: { type: ['object'], root: true @@ -27,7 +20,7 @@ module.exports = Self => { } }); - Self.getSales = async(filter, id, options) => { + Self.getSales = async(id, options) => { const models = Self.app.models; const myOptions = {}; @@ -35,7 +28,6 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - console.log(filter); const sales = await models.Sale.find({ include: { relation: 'item', @@ -117,7 +109,7 @@ module.exports = Self => { if (salesWithLogs.includes(sale.id)) sale.$hasLogs = true; } - console.log(sales); + return sales; }; }; diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 3bf4e06d0..668c3b6dc 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -60,20 +60,20 @@ - Visible - Available - Id - Quantity - Item - Price - Disc - Amount - Packaging + Visible + Available + Id + Quantity + Item + Price + Disc + Amount + Packaging - + diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 379b48cc9..ec43093f8 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -7,11 +7,11 @@ class Controller extends Section { super($element, $); this._sales = []; this.manaCode = 'mana'; - this.ordenarPor = 'nombre'; } - cambiarOrden(columna) { - this.ordenarPor = columna; + sortBy(propertyName) { + this.reverse = (this.propertyName === propertyName) ? !this.reverse : false; + this.propertyName = propertyName; } get manaCode() { From a7fcd8a1bf9f12607ee799c26eaaa540d30d8c4d Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 11 May 2023 10:04:15 +0200 Subject: [PATCH 11/16] changes --- modules/ticket/front/sale/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 9d145d4fc..abdf5f88f 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -64,7 +64,7 @@ Visible Available Id - Quantity + Quantity Item Price Disc @@ -233,7 +233,7 @@ vn-tooltip="Add item" vn-bind="+" icon="add_circle" - ng-click="$ctrl.cambiarOrden('quantity')" + ng-click="$ctrl.add()" disabled="!$ctrl.isEditable"> @@ -481,7 +481,7 @@ on-accept="$ctrl.transferSales($ctrl.transfer.ticketId)"> - Add claim - + Date: Thu, 11 May 2023 10:04:59 +0200 Subject: [PATCH 12/16] borrado espacio --- modules/ticket/front/sale/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index abdf5f88f..c5fe0743f 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -63,7 +63,7 @@ Visible Available - Id + Id Quantity Item Price From 90b844062d31d3e213fe782bcffea2d5f026fb67 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 11 May 2023 10:17:41 +0200 Subject: [PATCH 13/16] refs #5327 add frontTest --- modules/ticket/front/sale/index.spec.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index 5fb3b3df3..9c340ea74 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -2,7 +2,7 @@ import './index.js'; import watcher from 'core/mocks/watcher'; import crudModel from 'core/mocks/crud-model'; -describe('Ticket', () => { +fdescribe('Ticket', () => { describe('Component vnTicketSale', () => { let controller; let $scope; @@ -758,5 +758,15 @@ describe('Ticket', () => { expect(controller.$.editDiscount.hide).toHaveBeenCalledWith(); }); }); + + describe('sortBy()', () => { + it('should set reverse and propertyName properties', () => { + const propertyName = 'id'; + controller.sortBy(propertyName); + + expect(controller.propertyName).toEqual(propertyName); + expect(controller.reverse).toEqual(false); + }); + }); }); }); From 2ed99426ef7b2c86833e83f1aadcc0abbcd13569 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 11 May 2023 10:18:02 +0200 Subject: [PATCH 14/16] eliminado focus --- modules/ticket/front/sale/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index 9c340ea74..9da8e6e7c 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -2,7 +2,7 @@ import './index.js'; import watcher from 'core/mocks/watcher'; import crudModel from 'core/mocks/crud-model'; -fdescribe('Ticket', () => { +describe('Ticket', () => { describe('Component vnTicketSale', () => { let controller; let $scope; From ec5a5be9e67ebf99aa57d1e9362839cf0befd94a Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 30 May 2023 09:18:52 +0200 Subject: [PATCH 15/16] refs #5328 remove spaces --- modules/ticket/back/methods/sale/refund.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 3a633de0f..18ccee976 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -100,7 +100,10 @@ module.exports = Self => { }, myOptions); } } - const query = `CALL vn.ticket_recalc(?)`; await Self.rawSql(query, [refundTicket.id], myOptions); + + const query = `CALL vn.ticket_recalc(?)`; + await Self.rawSql(query, [refundTicket.id], myOptions); + if (tx) await tx.commit(); return refundTicket; From 2c3869d9610eeed3b5f0a9308535419ef00379d4 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 30 May 2023 15:48:09 +0200 Subject: [PATCH 16/16] refs #5398 capital letters --- modules/client/front/dms/edit/index.html | 2 +- modules/entry/front/basic-data/index.html | 4 ++-- modules/monitor/front/index/search-panel/index.html | 2 +- modules/route/front/search-panel/index.html | 2 +- modules/ticket/front/basic-data/step-one/index.html | 2 +- modules/ticket/front/dms/edit/index.html | 2 +- modules/ticket/front/search-panel/index.html | 2 +- modules/travel/front/extra-community-search-panel/index.html | 4 ++-- modules/worker/front/dms/edit/index.html | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/client/front/dms/edit/index.html b/modules/client/front/dms/edit/index.html index 58899df2b..2d653c827 100644 --- a/modules/client/front/dms/edit/index.html +++ b/modules/client/front/dms/edit/index.html @@ -34,7 +34,7 @@ diff --git a/modules/entry/front/basic-data/index.html b/modules/entry/front/basic-data/index.html index 888205320..6bccb0b5f 100644 --- a/modules/entry/front/basic-data/index.html +++ b/modules/entry/front/basic-data/index.html @@ -157,14 +157,14 @@ diff --git a/modules/monitor/front/index/search-panel/index.html b/modules/monitor/front/index/search-panel/index.html index 822f84922..0d24c41f9 100644 --- a/modules/monitor/front/index/search-panel/index.html +++ b/modules/monitor/front/index/search-panel/index.html @@ -88,7 +88,7 @@ vn-one label="Warehouse" ng-model="filter.warehouseFk" - data="Warehouses"> + data="warehouses"> diff --git a/modules/ticket/front/basic-data/step-one/index.html b/modules/ticket/front/basic-data/step-one/index.html index 73df8c370..bbe315ca6 100644 --- a/modules/ticket/front/basic-data/step-one/index.html +++ b/modules/ticket/front/basic-data/step-one/index.html @@ -30,7 +30,7 @@ diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index d22b06a46..52bede97f 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -107,7 +107,7 @@ vn-one label="Warehouse" ng-model="filter.warehouseFk" - data="Warehouses"> + data="warehouses"> diff --git a/modules/worker/front/dms/edit/index.html b/modules/worker/front/dms/edit/index.html index e4939b4ea..39d4af801 100644 --- a/modules/worker/front/dms/edit/index.html +++ b/modules/worker/front/dms/edit/index.html @@ -34,7 +34,7 @@