From 3d86e5989054473dde883c9f769464549acceaf8 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 27 Oct 2020 12:02:49 +0100 Subject: [PATCH 1/4] #2540 - Added entry descriptor popover to referenced places --- modules/item/front/diary/index.html | 8 ++++++-- modules/item/front/diary/index.js | 8 +++++--- modules/item/front/routes.json | 2 +- modules/travel/front/routes.json | 2 +- modules/travel/front/summary/index.html | 16 ++++++++++++---- modules/travel/front/summary/locale/es.yml | 2 +- modules/zone/front/events/index.html | 4 ++-- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/modules/item/front/diary/index.html b/modules/item/front/diary/index.html index 080cc0f36..b8572dcff 100644 --- a/modules/item/front/diary/index.html +++ b/modules/item/front/diary/index.html @@ -55,8 +55,8 @@ - {{::sale.origin | dashIfEmpty}} @@ -94,3 +94,7 @@ + + + diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index 953d203e8..bf04fabe9 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -58,10 +58,12 @@ class Controller extends Section { this.$anchorScroll(); } - showTicketDescriptor(event, sale) { - if (!sale.isTicket) return; + showDescriptor(event, sale) { + let descriptor = 'entryDescriptor'; + if (sale.isTicket) + descriptor = 'ticketDescriptor'; - this.$.ticketDescriptor.show(event.target, sale.origin); + this.$[descriptor].show(event.target, sale.origin); } } diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index 2aab4301e..d3bde0205 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -3,7 +3,7 @@ "name": "Items", "icon": "icon-item", "validations" : true, - "dependencies": ["worker", "client", "ticket"], + "dependencies": ["worker", "client", "ticket", "entry"], "menus": { "main": [ {"state": "item.index", "icon": "icon-item"}, diff --git a/modules/travel/front/routes.json b/modules/travel/front/routes.json index b802aaa4a..5fa43fd1d 100644 --- a/modules/travel/front/routes.json +++ b/modules/travel/front/routes.json @@ -3,7 +3,7 @@ "name": "Travels", "icon": "local_airport", "validations": true, - "dependencies": ["worker"], + "dependencies": ["worker", "entry"], "menus": { "main": [ {"state": "travel.index", "icon": "local_airport"} diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index 12dbded4e..7e055a0f1 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -41,7 +41,7 @@ value="{{$ctrl.travelData.ref}}"> Package CC Pallet - m3 + @@ -75,7 +75,12 @@ disabled="true"> - {{entry.id}} + + + {{entry.id}} + + {{entry.supplierName}} {{entry.ref}} {{entry.hb}} @@ -141,4 +146,7 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/modules/travel/front/summary/locale/es.yml b/modules/travel/front/summary/locale/es.yml index c82508dfc..8d2e7e78c 100644 --- a/modules/travel/front/summary/locale/es.yml +++ b/modules/travel/front/summary/locale/es.yml @@ -9,7 +9,7 @@ Received: Recibida Agency: Agencia Entries: Entradas Confirmed: Confirmada -Entry Id: Entrada Id +Entry Id: Id entrada Supplier: Proveedor Pallet: Pallet Freight: Porte diff --git a/modules/zone/front/events/index.html b/modules/zone/front/events/index.html index eea24a132..d48b5f0d8 100644 --- a/modules/zone/front/events/index.html +++ b/modules/zone/front/events/index.html @@ -73,7 +73,7 @@ value="{{::row.bonus | currency:'EUR':2}}"> @@ -166,7 +166,7 @@ From c0dddba3c43221508265036d4e20ec1edaba9605 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 27 Oct 2020 12:15:05 +0100 Subject: [PATCH 2/4] Added translation --- loopback/locale/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 498635832..49b605326 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -73,6 +73,7 @@ "I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})", "I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})", "Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "The grade must be similar to the last one": "The grade must be similar to the last one", "agencyModeFk": "Agency", "clientFk": "Client", "zoneFk": "Zone", @@ -80,5 +81,5 @@ "shipped": "Shipped", "landed": "Landed", "addressFk": "Address", - "companyFk": "Company" + "companyFk": "Company", } \ No newline at end of file From a45bd0987bce98328303511a05499b7ef4f456e7 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 27 Oct 2020 12:33:43 +0100 Subject: [PATCH 3/4] Removed comma --- loopback/locale/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 49b605326..3dfb73833 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -81,5 +81,5 @@ "shipped": "Shipped", "landed": "Landed", "addressFk": "Address", - "companyFk": "Company", + "companyFk": "Company" } \ No newline at end of file From 770b6a30bbf04810abaf0251fc1e950c896a5bb5 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 27 Oct 2020 14:35:04 +0100 Subject: [PATCH 4/4] Added unit test --- modules/item/front/diary/index.spec.js | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index 52608cde3..988914978 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -60,6 +60,34 @@ describe('Item', () => { expect(controller.$anchorScroll).toHaveBeenCalledWith(); }); }); + + describe('showDescriptor ()', () => { + it('should call to the entryDescriptor show() method', () => { + controller.$.entryDescriptor = {}; + controller.$.entryDescriptor.show = jest.fn(); + + const $event = new Event('click'); + const target = document.createElement('div'); + target.dispatchEvent($event); + const data = {id: 1, origin: 1}; + controller.showDescriptor($event, data); + + expect(controller.$.entryDescriptor.show).toHaveBeenCalledWith($event.target, data.origin); + }); + + it('should call to the ticketDescriptor show() method', () => { + controller.$.ticketDescriptor = {}; + controller.$.ticketDescriptor.show = jest.fn(); + + const $event = new Event('click'); + const target = document.createElement('div'); + target.dispatchEvent($event); + const data = {id: 1, origin: 1, isTicket: true}; + controller.showDescriptor($event, data); + + expect(controller.$.ticketDescriptor.show).toHaveBeenCalledWith($event.target, data.origin); + }); + }); }); });