From c0a3a66e6f6d6885b62d7a2cc1f259f64b7035a6 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 21 Nov 2018 13:29:46 +0100 Subject: [PATCH] #844 Claim add item descriptors --- client/claim/src/action/index.html | 13 ++++++++-- client/claim/src/action/index.js | 25 +++++++++++++++---- client/claim/src/detail/index.html | 13 ++++++++-- client/claim/src/detail/index.js | 21 +++++++++++++--- client/claim/src/summary/index.html | 20 +++++++++++++-- client/claim/src/summary/index.js | 21 ++++++++++++++-- .../common/methods/claim/getSummary.js | 2 +- 7 files changed, 98 insertions(+), 17 deletions(-) diff --git a/client/claim/src/action/index.html b/client/claim/src/action/index.html index f84d0eaacc..8f4c0953f9 100644 --- a/client/claim/src/action/index.html +++ b/client/claim/src/action/index.html @@ -44,7 +44,13 @@ - {{saleClaimed.sale.id}} + + + {{("000000"+saleClaimed.sale.itemFk).slice(-6)}} + + - \ No newline at end of file + + + \ No newline at end of file diff --git a/client/claim/src/action/index.js b/client/claim/src/action/index.js index ba1243d912..197b248767 100644 --- a/client/claim/src/action/index.js +++ b/client/claim/src/action/index.js @@ -13,7 +13,7 @@ class Controller { include: [ {relation: 'sale', scope: { - fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'], + fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'], include: { relation: 'ticket' } @@ -35,9 +35,8 @@ class Controller { let query = `/claim/api/ClaimBeginnings/${json}`; this.$http.get(query).then(res => { - if (res.data) { + if (res.data) this.claimedSales = res.data; - } }); } @@ -69,8 +68,8 @@ class Controller { } focusLastInput() { - let inputs = document.querySelectorAll("#claimDestinationFk"); - inputs[inputs.length - 1].querySelector("input").focus(); + let inputs = document.querySelectorAll('#claimDestinationFk'); + inputs[inputs.length - 1].querySelector('input').focus(); this.calculateTotals(); } @@ -129,6 +128,22 @@ class Controller { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); }); } + + // Item Descriptor + showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk} + })`, + tooltip: 'Item diary' + } + }; + this.$.descriptor.itemFk = itemFk; + this.$.descriptor.parent = event.target; + this.$.descriptor.show(); + } } Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp']; diff --git a/client/claim/src/detail/index.html b/client/claim/src/detail/index.html index 5cf5527ef8..f9b77c470b 100644 --- a/client/claim/src/detail/index.html +++ b/client/claim/src/detail/index.html @@ -33,7 +33,13 @@ - {{saleClaimed.sale.id}} + + + {{("000000"+saleClaimed.sale.itemFk).slice(-6)}} + + {{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} {{saleClaimed.sale.quantity}} @@ -111,4 +117,7 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/client/claim/src/detail/index.js b/client/claim/src/detail/index.js index 6f4a25ea7b..3fdc8ef207 100644 --- a/client/claim/src/detail/index.js +++ b/client/claim/src/detail/index.js @@ -13,7 +13,7 @@ class Controller { include: [ {relation: 'sale', scope: { - fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'], + fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'], include: { relation: 'ticket' } @@ -33,9 +33,8 @@ class Controller { let query = `/api/Sales/getClaimableFromTicket?ticketFk=${json}`; this.$http.get(query).then(res => { - if (res.data) { + if (res.data) this.salesToClaim = res.data; - } }); } @@ -77,6 +76,22 @@ class Controller { this.claimedTotal += (sale.quantity * sale.sale.price) - ((sale.sale.discount * (sale.quantity * sale.sale.price)) / 100); }); } + + // Item Descriptor + showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk} + })`, + tooltip: 'Item diary' + } + }; + this.$.descriptor.itemFk = itemFk; + this.$.descriptor.parent = event.target; + this.$.descriptor.show(); + } } Controller.$inject = ['$state', '$scope', '$http', '$translate', 'vnApp']; diff --git a/client/claim/src/summary/index.html b/client/claim/src/summary/index.html index 05ded4c62f..a99d390617 100644 --- a/client/claim/src/summary/index.html +++ b/client/claim/src/summary/index.html @@ -59,7 +59,13 @@ - {{saleClaimed.sale.id}} + + + {{("000000"+saleClaimed.sale.itemFk).slice(-6)}} + + {{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} {{saleClaimed.sale.quantity}} {{saleClaimed.quantity}} @@ -126,6 +132,13 @@ + + + {{("000000"+action.sale.itemFk).slice(-6)}} + + {{action.sale.id}} {{action.claimBeggining.description}} {{action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} @@ -149,4 +162,7 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/client/claim/src/summary/index.js b/client/claim/src/summary/index.js index f20133abce..7ef46baf26 100644 --- a/client/claim/src/summary/index.js +++ b/client/claim/src/summary/index.js @@ -1,8 +1,9 @@ import ngModule from '../module'; class Controller { - constructor($http) { + constructor($http, $scope) { this.$http = $http; + this.$ = $scope; } getSummary() { @@ -15,9 +16,25 @@ class Controller { if (this.claim && this.claim.id) this.getSummary(); } + + // Item Descriptor + showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk} + })`, + tooltip: 'Item diary' + } + }; + this.$.descriptor.itemFk = itemFk; + this.$.descriptor.parent = event.target; + this.$.descriptor.show(); + } } -Controller.$inject = ['$http']; +Controller.$inject = ['$http', '$scope']; ngModule.component('vnClaimSummary', { template: require('./index.html'), diff --git a/services/loopback/common/methods/claim/getSummary.js b/services/loopback/common/methods/claim/getSummary.js index 11ed52522b..04e12f937b 100644 --- a/services/loopback/common/methods/claim/getSummary.js +++ b/services/loopback/common/methods/claim/getSummary.js @@ -51,7 +51,7 @@ module.exports = Self => { include: [ {relation: 'sale', scope: { - fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'], + fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'], include: { relation: 'ticket' }