diff --git a/front/core/components/table/style.scss b/front/core/components/table/style.scss index 7d90d4db6..a3c339b5f 100644 --- a/front/core/components/table/style.scss +++ b/front/core/components/table/style.scss @@ -174,4 +174,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..7444dff45 100644 --- a/modules/client/back/methods/client/lastActiveTickets.js +++ b/modules/client/back/methods/client/lastActiveTickets.js @@ -26,15 +26,25 @@ 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 - WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0 - AND t.id <> ? AND t.warehouseFk = ? - ORDER BY t.shipped + 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 LIMIT 10`; return Self.rawSql(query, [id, ticketId, ticket.warehouseFk]); 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); + }); +}); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index d7dfa802c..585feb063 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -326,31 +326,49 @@ 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 + + + +