From 8dc291798f53ffaf283d0d430e91fa474f6890d6 Mon Sep 17 00:00:00 2001 From: Jorge Padawan Date: Fri, 5 Feb 2021 13:04:32 +0100 Subject: [PATCH 1/4] Added tooltip on address and removed workhouse --- front/core/components/table/style.scss | 5 ++ .../back/methods/client/lastActiveTickets.js | 22 +++++--- modules/ticket/front/sale/index.html | 54 +++++++++++-------- 3 files changed, 53 insertions(+), 28 deletions(-) diff --git a/front/core/components/table/style.scss b/front/core/components/table/style.scss index 8d35c374c..8bd059ed1 100644 --- a/front/core/components/table/style.scss +++ b/front/core/components/table/style.scss @@ -155,4 +155,9 @@ vn-table { .vn-check { margin: 0; } + .empty-rows { + color: $color-font-secondary; + font-size: 1.375rem; + text-align: center; + } } \ No newline at end of file diff --git a/modules/client/back/methods/client/lastActiveTickets.js b/modules/client/back/methods/client/lastActiveTickets.js index c69c860c9..0a9236850 100644 --- a/modules/client/back/methods/client/lastActiveTickets.js +++ b/modules/client/back/methods/client/lastActiveTickets.js @@ -26,12 +26,22 @@ module.exports = Self => { Self.lastActiveTickets = async(id, ticketId) => { const ticket = await Self.app.models.Ticket.findById(ticketId); const query = ` - SELECT t.id, t.shipped, a.name AS agencyName, w.name AS warehouseName, ad.city AS address - FROM vn.ticket t - JOIN vn.ticketState ts ON t.id = ts.ticketFk - JOIN vn.agencyMode a ON t.agencyModeFk = a.id - JOIN vn.warehouse w ON t.warehouseFk = w.id - JOIN vn.address ad ON t.addressFk = ad.id + SELECT + t.id, + t.shipped, + a.name AS agencyName, + w.name AS warehouseName, + ad.nickname AS nickname, + ad.city AS city, + ad.postalCode AS postalCode, + ad.street AS street, + pr.name AS name + FROM ticket t + JOIN vn.ticketState ts ON t.id = ts.ticketFk + JOIN vn.agencyMode a ON t.agencyModeFk = a.id + JOIN vn.warehouse w ON t.warehouseFk = w.id + JOIN vn.address ad ON t.addressFk = ad.id + JOIN vn.province pr ON ad.provinceFk = pr.id WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0 AND t.id <> ? AND t.warehouseFk = ? ORDER BY t.shipped diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index ed3cbc02b..c9a38149d 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -323,31 +323,41 @@ icon="info"> - - - - Id - Shipped - Agency - Warehouse - Address - - - - - - + + + Id + Shipped + Agency + Address + + + + - {{::ticket.id}} - {{::ticket.shipped | date: 'dd/MM/yyyy'}} - {{::ticket.agencyName}} - {{::ticket.warehouseName}} - {{::ticket.address}} - - - + {{::ticket.id}} + {{::ticket.shipped | date: 'dd/MM/yyyy'}} + {{::ticket.agencyName}} + {{::ticket.address}} + + {{::ticket.nickname}} {{::ticket.name}} {{::ticket.street}} {{::ticket.postalCode}} {{::ticket.city}} + + + + + + No results + + + +
Date: Fri, 5 Feb 2021 13:11:18 +0100 Subject: [PATCH 2/4] Line breaks have been put for better understanding --- modules/ticket/front/sale/index.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 3e7c93181..7c6b77d4e 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -345,8 +345,17 @@ {{::ticket.agencyName}} {{::ticket.address}} - {{::ticket.nickname}} {{::ticket.name}} {{::ticket.street}} {{::ticket.postalCode}} {{::ticket.city}} + vn-tooltip=" + {{::ticket.nickname}} + {{::ticket.name}} + {{::ticket.street}} + {{::ticket.postalCode}} + {{::ticket.city}}"> + {{::ticket.nickname}} + {{::ticket.name}} + {{::ticket.street}} + {{::ticket.postalCode}} + {{::ticket.city}} From 4bcb948affefb4e8376e9b411327496e403f3bb9 Mon Sep 17 00:00:00 2001 From: Jorge Padawan Date: Fri, 12 Feb 2021 16:41:29 +0100 Subject: [PATCH 3/4] Updated code for better read --- .../back/methods/client/lastActiveTickets.js | 6 +++--- modules/ticket/front/sale/index.html | 21 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/client/back/methods/client/lastActiveTickets.js b/modules/client/back/methods/client/lastActiveTickets.js index 0a9236850..7444dff45 100644 --- a/modules/client/back/methods/client/lastActiveTickets.js +++ b/modules/client/back/methods/client/lastActiveTickets.js @@ -42,9 +42,9 @@ module.exports = Self => { JOIN vn.warehouse w ON t.warehouseFk = w.id JOIN vn.address ad ON t.addressFk = ad.id JOIN vn.province pr ON ad.provinceFk = pr.id - WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0 - AND t.id <> ? AND t.warehouseFk = ? - ORDER BY t.shipped + WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0 + AND t.id <> ? AND t.warehouseFk = ? + ORDER BY t.shipped LIMIT 10`; return Self.rawSql(query, [id, ticketId, ticket.warehouseFk]); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 7c6b77d4e..585feb063 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -344,27 +344,26 @@ {{::ticket.shipped | date: 'dd/MM/yyyy'}} {{::ticket.agencyName}} {{::ticket.address}} - - {{::ticket.nickname}} - {{::ticket.name}} - {{::ticket.street}} - {{::ticket.postalCode}} - {{::ticket.city}} + {{::ticket.nickname}} + {{::ticket.name}} + {{::ticket.street}} + {{::ticket.postalCode}} + {{::ticket.city}} + ng-if="!$ctrl.transfer.lastActiveTickets.length" + class="empty-rows" + colspan="4" + translate> No results From bf3391f7f2ad686a27d5f71dd53e7c314f28f6a7 Mon Sep 17 00:00:00 2001 From: Jorge Padawan Date: Mon, 15 Feb 2021 13:20:17 +0100 Subject: [PATCH 4/4] added test of lastActiveTickets --- loopback/locale/en.json | 3 ++- .../client/specs/lastActiveTickets.spec.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 modules/client/back/methods/client/specs/lastActiveTickets.spec.js diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 44f882638..c5062c3e9 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -91,5 +91,6 @@ "The observation type can't be repeated": "The observation type can't be repeated", "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*", "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*", - "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})" + "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})", + "Swift / BIC cannot be empty": "Swift / BIC cannot be empty" } \ No newline at end of file diff --git a/modules/client/back/methods/client/specs/lastActiveTickets.spec.js b/modules/client/back/methods/client/specs/lastActiveTickets.spec.js new file mode 100644 index 000000000..8d06e0584 --- /dev/null +++ b/modules/client/back/methods/client/specs/lastActiveTickets.spec.js @@ -0,0 +1,18 @@ +const app = require('vn-loopback/server/server'); + +describe('Client last active tickets', () => { + it('should receive an array of last active tickets of Bruce Wayne', async() => { + const ticketId = 22; + const clientId = 109; + const warehouseId = 5; + const result = await app.models.Client.lastActiveTickets(clientId, ticketId, warehouseId); + + const length = result.length; + const anyResult = result[Math.floor(Math.random() * Math.floor(length))]; + + const properties = Object.keys(anyResult); + + expect(properties.length).toEqual(9); + expect(result.length).toEqual(3); + }); +});