From 06be5351156d240fc5026ca3ff3e92922717c7b1 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 21 Feb 2019 08:43:04 +0100 Subject: [PATCH 1/5] ticket subtotal should check service prices #1151 --- .../back/methods/client/specs/getCard.spec.js | 4 +- .../back/methods/client/specs/summary.spec.js | 2 +- .../methods/ticket/specs/getTaxes.spec.js | 2 +- .../methods/ticket/specs/getTotal.spec.js | 2 +- .../back/methods/ticket/specs/getVAT.spec.js | 2 +- .../methods/ticket/specs/subtotal.spec.js | 15 +++ .../back/methods/ticket/specs/summary.spec.js | 8 +- .../ticket/back/methods/ticket/subtotal.js | 40 ++++++++ modules/ticket/back/methods/ticket/summary.js | 6 +- modules/ticket/back/models/ticket.js | 1 + modules/ticket/front/sale/index.html | 2 +- modules/ticket/front/sale/index.js | 9 +- modules/ticket/front/sale/index.spec.js | 5 +- modules/ticket/front/summary/index.html | 4 +- .../changes/1.2-CHECK/04-ticketGetTax.sql | 99 +++++++++++++++++++ .../changes/1.2-CHECK/05-ticketGetTaxAdd.sql | 34 +++++++ 16 files changed, 213 insertions(+), 22 deletions(-) create mode 100644 modules/ticket/back/methods/ticket/specs/subtotal.spec.js create mode 100644 modules/ticket/back/methods/ticket/subtotal.js create mode 100644 services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql create mode 100644 services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index 896585096..1619280f8 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -1,12 +1,12 @@ const app = require('vn-loopback/server/server'); -describe('Client card', () => { +describe('Client get', () => { it('should call the card() method to receive a formated card of Bruce Wayne', async() => { let id = 101; let result = await app.models.Client.getCard(id); expect(result.id).toEqual(101); expect(result.name).toEqual('Bruce Wayne'); - expect(result.debt).toEqual(579.1); + expect(result.debt).toEqual(595.81); }); }); diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 16527227f..aeae819ee 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -17,7 +17,7 @@ describe('client summary()', () => { it('should return a summary object containing debt', async() => { let result = await app.models.Client.summary(101); - expect(result.debt.debt).toEqual(579.1); + expect(result.debt.debt).toEqual(595.81); }); it('should return a summary object containing averageInvoiced', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/getTaxes.spec.js b/modules/ticket/back/methods/ticket/specs/getTaxes.spec.js index fe0c91e92..2d8488cd3 100644 --- a/modules/ticket/back/methods/ticket/specs/getTaxes.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getTaxes.spec.js @@ -4,6 +4,6 @@ describe('ticket getTaxes()', () => { it('should return the tax of a given ticket', async() => { let result = await app.models.Ticket.getTaxes(1); - expect(result[0].tax).toEqual(7.44); + expect(result[0].tax).toEqual(7.64); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/getTotal.spec.js b/modules/ticket/back/methods/ticket/specs/getTotal.spec.js index 4bf10539e..bcdcd4889 100644 --- a/modules/ticket/back/methods/ticket/specs/getTotal.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getTotal.spec.js @@ -4,7 +4,7 @@ describe('ticket getTotal()', () => { it('should return the total of a ticket', async() => { let result = await app.models.Ticket.getTotal(1); - expect(result).toEqual(155.89); + expect(result).toEqual(158.09); }); it(`should return zero if the ticket doesn't have lines`, async() => { diff --git a/modules/ticket/back/methods/ticket/specs/getVAT.spec.js b/modules/ticket/back/methods/ticket/specs/getVAT.spec.js index 8f80d9512..70fa0fa39 100644 --- a/modules/ticket/back/methods/ticket/specs/getVAT.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getVAT.spec.js @@ -4,7 +4,7 @@ describe('ticket getVAT()', () => { it('should call the getVAT method and return the response', async() => { await app.models.Ticket.getVAT(1) .then(response => { - expect(response).toEqual(20.29); + expect(response).toEqual(20.49); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/subtotal.spec.js b/modules/ticket/back/methods/ticket/specs/subtotal.spec.js new file mode 100644 index 000000000..c204f806a --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/subtotal.spec.js @@ -0,0 +1,15 @@ +const app = require('vn-loopback/server/server'); + +describe('ticket subtotal()', () => { + it('should return the subtotal of a ticket', async() => { + let result = await app.models.Ticket.subtotal(1); + + expect(result).toEqual(137.60); + }); + + it(`should return zero if the ticket doesn't have lines`, async() => { + let result = await app.models.Ticket.subtotal(13); + + expect(result).toEqual(0.00); + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/summary.spec.js b/modules/ticket/back/methods/ticket/specs/summary.spec.js index 34e6affba..2041555ba 100644 --- a/modules/ticket/back/methods/ticket/specs/summary.spec.js +++ b/modules/ticket/back/methods/ticket/specs/summary.spec.js @@ -14,21 +14,21 @@ describe('ticket summary()', () => { expect(result.sales.length).toEqual(4); }); - it('should return a summary object containing subTotal for 1 ticket', async() => { + it('should return a summary object containing subtotal for 1 ticket', async() => { let result = await app.models.Ticket.summary(1); - expect(Math.round(result.subTotal * 100) / 100).toEqual(135.60); + expect(Math.round(result.subtotal * 100) / 100).toEqual(137.60); }); it('should return a summary object containing VAT for 1 ticket', async() => { let result = await app.models.Ticket.summary(1); - expect(Math.round(result.VAT * 100) / 100).toEqual(20.29); + expect(Math.round(result.vat * 100) / 100).toEqual(20.49); }); it('should return a summary object containing total for 1 ticket', async() => { let result = await app.models.Ticket.summary(1); - let total = result.subTotal + result.VAT; + let total = result.subtotal + result.vat; let expectedTotal = Math.round(total * 100) / 100; expect(result.total).toEqual(expectedTotal); diff --git a/modules/ticket/back/methods/ticket/subtotal.js b/modules/ticket/back/methods/ticket/subtotal.js new file mode 100644 index 000000000..f1595e77b --- /dev/null +++ b/modules/ticket/back/methods/ticket/subtotal.js @@ -0,0 +1,40 @@ +module.exports = Self => { + Self.remoteMethod('subtotal', { + description: 'Returns the total of a ticket', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'ticket id', + http: {source: 'path'} + }], + returns: { + type: 'number', + root: true + }, + http: { + path: `/:id/subtotal`, + verb: 'GET' + } + }); + + Self.subtotal = async ticketFk => { + const sale = Self.app.models.Sale; + const ticketSales = await sale.find({where: {ticketFk}}); + const ticketService = Self.app.models.TicketService; + const ticketServices = await ticketService.find({where: {ticketFk}}); + + let subtotal = 0.00; + ticketSales.forEach(sale => { + subtotal += sale.price * sale.quantity * ((100 - sale.discount) / 100); + }); + + ticketServices.forEach(service => { + subtotal += service.price * service.quantity; + }); + + + return Math.round(subtotal * 100) / 100; + }; +}; diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index 56e17062c..8af76b981 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -23,9 +23,9 @@ module.exports = Self => { let models = Self.app.models; let summaryObj = await getTicketData(Self, ticketFk); summaryObj.sales = await getSales(models.Sale, ticketFk); - summaryObj.subTotal = getSubTotal(summaryObj.sales); - summaryObj.VAT = await models.Ticket.getVAT(ticketFk); - summaryObj.total = await models.Ticket.getTotal(ticketFk); + summaryObj.subtotal = await models.Ticket.subtotal(ticketFk); + summaryObj.vat = await models.Ticket.getVAT(ticketFk); + summaryObj.total = summaryObj.subtotal + summaryObj.vat; summaryObj.packagings = await models.TicketPackaging.find({ where: {ticketFk: ticketFk}, include: [{relation: 'packaging', diff --git a/modules/ticket/back/models/ticket.js b/modules/ticket/back/models/ticket.js index 52144ca4c..c7486a26a 100644 --- a/modules/ticket/back/models/ticket.js +++ b/modules/ticket/back/models/ticket.js @@ -5,6 +5,7 @@ module.exports = Self => { require('../methods/ticket/summary')(Self); require('../methods/ticket/getTotal')(Self); require('../methods/ticket/getTaxes')(Self); + require('../methods/ticket/subtotal')(Self); require('../methods/ticket/componentUpdate')(Self); require('../methods/ticket/new')(Self); require('../methods/ticket/isEditable')(Self); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 8e4585a2a..1a93c08c1 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -46,7 +46,7 @@ -

Subtotal {{$ctrl.subTotal | currency: 'EUR':2}}

+

Subtotal {{$ctrl.subtotal | currency: 'EUR':2}}

VAT {{$ctrl.VAT | currency: 'EUR':2}}

Total {{$ctrl.total | currency: 'EUR':2}}

diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 6cc012b4e..129a00198 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -36,9 +36,10 @@ class Controller { } loadSubTotal() { - this.subTotal = 0.0; - if (!this.sales) return; - this.subTotal = this.sales.reduce((sum, sale) => sum + this.getSaleTotal(sale), 0.0); + if (!this.$stateParams.id || !this.sales) return; + this.$http.get(`/ticket/api/Tickets/${this.$stateParams.id}/subtotal`).then(res => { + this.subtotal = res.data || 0.0; + }); } getSaleTotal(sale) { @@ -54,7 +55,7 @@ class Controller { } get total() { - return this.subTotal + this.VAT; + return this.subtotal + this.VAT; } onMoreOpen() { diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index ceaddab90..fea921a14 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -41,6 +41,7 @@ describe('Ticket', () => { $httpBackend = _$httpBackend_; $httpBackend.whenGET(/api\/Tickets\/1\/getSales.*/).respond(sales); $httpBackend.whenGET(`/ticket/api/Tickets/1/getVAT`).respond(200, 10.5); + $httpBackend.whenGET(`/ticket/api/Tickets/1/subtotal`).respond(200, 227.5); $element = $compile('')($scope); controller = $element.controller('vnTicketSale'); @@ -67,9 +68,9 @@ describe('Ticket', () => { }); }); - describe('total/VAT/subTotal properties', () => { + describe('total/VAT/subtotal properties', () => { it('should fill total, VAT and subTotal', () => { - expect(controller.subTotal).toEqual(227.5); + expect(controller.subtotal).toEqual(227.5); expect(controller.VAT).toEqual(10.5); expect(controller.total).toEqual(238); }); diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 6071b1370..95711e3b3 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -46,8 +46,8 @@ -

Subtotal {{$ctrl.summary.subTotal | currency: 'EUR':2}}

-

VAT {{$ctrl.summary.VAT | currency: 'EUR':2}}

+

Subtotal {{$ctrl.summary.subtotal | currency: 'EUR':2}}

+

VAT {{$ctrl.summary.vat | currency: 'EUR':2}}

Total {{$ctrl.summary.total | currency: 'EUR':2}}

diff --git a/services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql b/services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql new file mode 100644 index 000000000..6e2423faa --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql @@ -0,0 +1,99 @@ + USE `vn`; +DROP procedure IF EXISTS `ticketGetTax`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`() + READS SQL DATA +BEGIN +/** + * Calcula la base imponible, el IVA y el recargo de equivalencia para + * un conjunto de tickets. + * + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + + */ + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT t.addressFk, t.companyFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; + + CALL addressTaxArea (); + + + /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente + * No se debería cambiar el sistema por problemas con los decimales + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tmpTicket.ticketFk, + bp.pgcFk, + SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticket tmpTicket + JOIN sale s ON s.ticketFk = tmpTicket.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN ticket t ON t.id = tmpTicket.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = itc.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tmpTicket.ticketFk, pgc.code,pgc.rate + HAVING taxableBase != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; + CREATE TEMPORARY TABLE tmp.ticketServiceTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk, + SUM(ts.quantity * ts.price) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticketTax tt + JOIN ticketService ts ON ts.ticketFk = tt.ticketFk + JOIN ticket t ON t.id = tt.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = ts.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tt.ticketFk, tt.code,tt.rate + HAVING taxableBase != 0; + + UPDATE tmp.ticketTax tt + JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate + SET tt.taxableBase = tt.taxableBase + ts.taxableBase; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + CREATE TEMPORARY TABLE tmp.ticketAmount + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code + FROM tmp.ticketTax + GROUP BY ticketFk, code; + + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql b/services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql new file mode 100644 index 000000000..3631a77e5 --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql @@ -0,0 +1,34 @@ +DROP PROCEDURE IF EXISTS vn.ticketGetTaxAdd; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketGetTaxAdd`(vTicketFk INT) +BEGIN +/** + * Añade un ticket a la tabla tmp.ticket para calcular + * el IVA y el recargo de equivalencia y devuelve el resultado. + */ + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT vTicketFk ticketFk; + + CALL vn.ticketGetTax(); + + SELECT + tt.ticketFk, + CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase, + CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax, + pgc.*, + CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base, + pgc.rate / 100 as vatPercent + FROM tmp.ticketTax tt + JOIN vn.pgc ON pgc.code = tt.pgcFk + LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code; + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticketAmount; + +END$$ +DELIMITER ; From c9746521dc4ee1555a0180cee0dce7109e7c6ace Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 21 Feb 2019 08:44:03 +0100 Subject: [PATCH 2/5] removed unused getSubTotal() method --- modules/ticket/back/methods/ticket/summary.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index 8af76b981..b47d325cd 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -149,14 +149,4 @@ module.exports = Self => { }; return await Self.app.models.TicketRequest.find(filter); } - - function getSubTotal(sales) { - let subTotal = 0.00; - - sales.forEach(sale => { - subTotal += sale.quantity * sale.price; - }); - - return subTotal; - } }; From 8d6fdc4b2f6ccb5e1421ab0cfb507918654dfc23 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 21 Feb 2019 10:06:38 +0100 Subject: [PATCH 3/5] added envialia and solved problems with worker popover --- .../ticket/back/methods/expedition/filter.js | 18 ++++++------------ modules/ticket/front/expedition/index.html | 5 ++++- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/modules/ticket/back/methods/expedition/filter.js b/modules/ticket/back/methods/expedition/filter.js index b8c634553..74c542806 100644 --- a/modules/ticket/back/methods/expedition/filter.js +++ b/modules/ticket/back/methods/expedition/filter.js @@ -25,23 +25,17 @@ module.exports = Self => { Self.filter = async filter => { const stmt = new ParameterizedSQL( `SELECT - e.id, - e.ticketFk, - e.isBox, - i1.name namePackage, - e.counter, - e.checked, - i2.name nameBox, - e.itemFk, - u.nickname userNickname, - u.id userId, - e.created + e.id, e.ticketFk, e.isBox, + i1.name namePackage, e.counter, + e.checked, i2.name nameBox, + e.itemFk, u.nickname userNickname, + u.id userId, e.created, e.externalId FROM vn.expedition e LEFT JOIN vn.item i2 ON i2.id = e.itemFk INNER JOIN vn.item i1 ON i1.id = e.isBox LEFT JOIN vn.worker w ON w.id = e.workerFk - JOIN account.user u ON u.id = w.id + JOIN account.user u ON u.id = w.userFk `); stmt.merge(Self.buildSuffix(filter, 'e')); diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 1b713a9e6..d10a4bdcb 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -13,6 +13,8 @@ + Expedition + Envialia Item Name Package type @@ -30,6 +32,8 @@ vn-tooltip="Delete expedition"> + {{expedition.id | zeroFill:6}} + {{expedition.externalId | zeroFill:6}} {{::expedition.nameBox}} {{::expedition.counter}} {{::expedition.checked}} - {{::expedition.userNickname}} Date: Thu, 21 Feb 2019 10:10:38 +0100 Subject: [PATCH 4/5] Styles fixed --- e2e/helpers/selectors.js | 2 +- front/salix/styles/misc.scss | 66 +++++++++++---------- modules/client/front/index/index.html | 39 ++++++++++-- modules/client/front/index/index.js | 9 ++- modules/client/front/index/item-client.html | 29 --------- modules/client/front/index/item-client.js | 24 -------- modules/client/front/index/style.scss | 3 - modules/worker/front/index/index.html | 6 ++ 8 files changed, 83 insertions(+), 95 deletions(-) delete mode 100644 modules/client/front/index/item-client.html delete mode 100644 modules/client/front/index/item-client.js delete mode 100644 modules/client/front/index/style.scss diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0df20f191..7ce57ed7c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -23,7 +23,7 @@ export default { clientsIndex: { searchClientInput: `${components.vnTextfield}`, searchButton: `vn-searchbar vn-icon[icon="search"]`, - searchResult: `vn-item-client a`, + searchResult: `vn-client-index .vn-list-item`, createClientButton: `${components.vnFloatButton}`, othersButton: `vn-left-menu li[name="Others"] > a` }, diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index 14a64cc2c..dcabb77c6 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -152,43 +152,45 @@ vn-tool-bar { .vn-list { max-width: 36em; margin: 0 auto; -} -a.vn-list-item { - @extend %clickable; -} -.vn-list-item { - padding: $pad-medium; - border-bottom: $border-thin solid $color-spacer; - display: block; - text-decoration: none; - color: inherit; - - & > vn-horizontal { - & > vn-one { - overflow: hidden; - } - & > .buttons { - align-items: center; - - vn-icon { - opacity: .4; - color: $color-main; - margin-left: .5em; - transition: opacity 250ms ease-out; - font-size: 2em; - - &:hover { - opacity: 1; + a.vn-list-item { + @extend %clickable; + } + .vn-list-item { + border-bottom: $border-thin solid $color-spacer; + display: block; + text-decoration: none; + color: inherit; + + & > vn-horizontal { + padding: $pad-medium; + + & > vn-one { + overflow: hidden; + } + & > .buttons { + align-items: center; + + vn-icon { + opacity: .4; + color: $color-main; + margin-left: .5em; + transition: opacity 250ms ease-out; + font-size: 2em; + + &:hover { + opacity: 1; + } } } } } -} -vn-empty-rows.vn-list-item { - text-align: center; - padding: 1.5em; - box-sizing: border-box; + vn-empty-rows { + display: block; + text-align: center; + padding: 1.5em; + box-sizing: border-box; + } } /** START - FORM ELEMENTS DISABLED **/ diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index 5a964cfe5..90074aa13 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -17,11 +17,42 @@ - - + ui-sref="client.card.summary({ id: {{::client.id}} })" + translate-attr="{title: 'View client'}" + class="vn-list-item searchResult"> + + +
{{::client.name}}
+ + + + + + + + +
+ + + + +
+ + + No results + + + Enter a new search +
diff --git a/modules/client/front/index/index.js b/modules/client/front/index/index.js index 482aef7e9..f7e75274c 100644 --- a/modules/client/front/index/index.js +++ b/modules/client/front/index/index.js @@ -1,5 +1,4 @@ import ngModule from '../module'; -import './item-client'; export default class Controller { constructor($scope, $stateParams) { @@ -33,7 +32,13 @@ export default class Controller { } } - openSummary(client) { + onClick(event) { + if (event.defaultPrevented) + event.stopImmediatePropagation(); + } + + openSummary(client, event) { + event.preventDefault(); this.clientSelected = client; this.$.dialogSummaryClient.show(); } diff --git a/modules/client/front/index/item-client.html b/modules/client/front/index/item-client.html deleted file mode 100644 index 4be3e42a4..000000000 --- a/modules/client/front/index/item-client.html +++ /dev/null @@ -1,29 +0,0 @@ - - - -
{{::$ctrl.client.name}}
- - - - - - - - -
- - - - -
-
diff --git a/modules/client/front/index/item-client.js b/modules/client/front/index/item-client.js deleted file mode 100644 index 5bacee25d..000000000 --- a/modules/client/front/index/item-client.js +++ /dev/null @@ -1,24 +0,0 @@ -import ngModule from '../module'; - -class Controller { - onClick(event) { - if (event.defaultPrevented) - event.stopImmediatePropagation(); - } - - preview(event) { - event.preventDefault(); - this.list.openSummary(this.client); - } -} - -ngModule.component('vnItemClient', { - template: require('./item-client.html'), - controller: Controller, - bindings: { - client: '<' - }, - require: { - list: '^vnClientIndex' - } -}); diff --git a/modules/client/front/index/style.scss b/modules/client/front/index/style.scss deleted file mode 100644 index 0f2ee429f..000000000 --- a/modules/client/front/index/style.scss +++ /dev/null @@ -1,3 +0,0 @@ -vn-item-client { - display: block; -} \ No newline at end of file diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index 53d16ccea..99a5f6912 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -48,6 +48,12 @@ + + No results + + + Enter a new search + From 03e168739b753f8840b67a3b4cc19182cca623b2 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 21 Feb 2019 10:17:13 +0100 Subject: [PATCH 5/5] updated icons --- modules/agency/front/routes.json | 2 +- modules/client/front/descriptor/index.js | 2 +- modules/client/front/routes.json | 2 +- modules/item/front/routes.json | 2 +- modules/order/front/routes.json | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/agency/front/routes.json b/modules/agency/front/routes.json index 470f971c1..de38de230 100644 --- a/modules/agency/front/routes.json +++ b/modules/agency/front/routes.json @@ -1,7 +1,7 @@ { "module": "agency", "name": "Agencies", - "icon" : "local_shipping", + "icon" : "icon-delivery", "validations" : true, "menu": [ {"state": "zone.card.basicData", "icon": "settings"}, diff --git a/modules/client/front/descriptor/index.js b/modules/client/front/descriptor/index.js index 7040b8090..533b01ef6 100644 --- a/modules/client/front/descriptor/index.js +++ b/modules/client/front/descriptor/index.js @@ -25,7 +25,7 @@ class Controller { tooltip: 'Client ticket list' }, btnTwo: { - icon: 'shopping_cart', + icon: 'icon-basket', state: `order.create({clientFk: ${value.id}})`, tooltip: 'New order' } diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index b993b6cb6..9c64fdaea 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -7,7 +7,7 @@ {"state": "client.card.basicData", "icon": "settings"}, {"state": "client.card.fiscalData", "icon": "account_balance"}, {"state": "client.card.billingData", "icon": "icon-payment"}, - {"state": "client.card.address.index", "icon": "local_shipping"}, + {"state": "client.card.address.index", "icon": "icon-delivery"}, {"state": "client.card.note.index", "icon": "insert_drive_file"}, {"state": "client.card.credit.index", "icon": "credit_card"}, {"state": "client.card.greuge.index", "icon": "work"}, diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index c7180b3df..485bd2760 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -1,7 +1,7 @@ { "module": "item", "name": "Items", - "icon": "inbox", + "icon": "icon-item", "validations" : true, "dependencies": ["worker", "client", "ticket"], "menu": [ diff --git a/modules/order/front/routes.json b/modules/order/front/routes.json index 709d75b67..0f610169d 100644 --- a/modules/order/front/routes.json +++ b/modules/order/front/routes.json @@ -1,12 +1,12 @@ { "module": "order", "name": "Orders", - "icon": "shopping_cart", + "icon": "icon-basket", "validations": true, "dependencies": ["worker", "item", "ticket"], "menu": [ {"state": "order.card.basicData", "icon": "settings"}, - {"state": "order.card.catalog", "icon": "shopping_cart"}, + {"state": "order.card.catalog", "icon": "icon-basket"}, {"state": "order.card.volume", "icon": "icon-volume"}, {"state": "order.card.line", "icon": "icon-lines"} ],