From d83665a0c51c0c50743cc0dd36654da3860212c2 Mon Sep 17 00:00:00 2001 From: Joan Date: Wed, 1 Aug 2018 12:15:09 +0200 Subject: [PATCH] show itemDiary icon on ticket descriptor popover. #441 - CR Javi --- .../client/src/descriptor-popover/index.html | 5 ++- client/client/src/descriptor-popover/index.js | 26 +++++++++----- client/client/src/descriptor/index.html | 22 +++++++++--- client/client/src/descriptor/index.js | 34 +++++++++++++++---- client/item/src/descriptor-popover/index.html | 3 +- client/item/src/descriptor-popover/index.js | 13 +++++-- client/item/src/descriptor/index.html | 19 +++++++++++ client/item/src/descriptor/index.js | 25 +++++++++++++- client/salix/src/styles/misc.scss | 2 +- client/ticket/src/sale/index.html | 3 +- client/ticket/src/sale/index.js | 19 +++++++++++ 11 files changed, 145 insertions(+), 26 deletions(-) diff --git a/client/client/src/descriptor-popover/index.html b/client/client/src/descriptor-popover/index.html index 4cefbedbb..e0f1bd33d 100644 --- a/client/client/src/descriptor-popover/index.html +++ b/client/client/src/descriptor-popover/index.html @@ -1,4 +1,7 @@ - + diff --git a/client/client/src/descriptor-popover/index.js b/client/client/src/descriptor-popover/index.js index b39b9b66e..41c617c74 100644 --- a/client/client/src/descriptor-popover/index.js +++ b/client/client/src/descriptor-popover/index.js @@ -9,6 +9,22 @@ class Controller extends Component { this.$timeout = $timeout; this.isTooltip = true; this.client = {}; + this.links = {}; + } + + set clientFk(value) { + if (value) { + this._getClient(value); + this._getClientDebt(value); + } + } + + set quicklinks(value = {}) { + this._quicklinks = Object.assign(value, this.links); + } + + get quicklinks() { + return this._quicklinks; } clear() { @@ -34,13 +50,6 @@ class Controller extends Component { this.$state.go('ticket.index', {q: `{"clientFk": ${this.client.id}}`}); } - set clientFk(value) { - if (value) { - this._getClient(value); - this._getClientDebt(value); - } - } - show() { this.$.popover.parent = this.parent; setTimeout(() => { @@ -56,6 +65,7 @@ ngModule.component('vnClientDescriptorPopover', { controller: Controller, bindings: { client: '<', - clientFk: '<' + clientFk: '<', + quicklinks: '<' } }); diff --git a/client/client/src/descriptor/index.html b/client/client/src/descriptor/index.html index e09762c36..6f92aa78e 100644 --- a/client/client/src/descriptor/index.html +++ b/client/client/src/descriptor/index.html @@ -53,11 +53,23 @@ ng-class="{bright: $ctrl.client.isTaxDataChecked == false}"> - - + + + + + + + + \ No newline at end of file diff --git a/client/client/src/descriptor/index.js b/client/client/src/descriptor/index.js index 431d0bd5f..9ec8e5f4c 100644 --- a/client/client/src/descriptor/index.js +++ b/client/client/src/descriptor/index.js @@ -4,7 +4,31 @@ class Controller { constructor($http, $state) { this.$state = $state; this.$http = $http; + this.links = { + btnOne: { + icon: 'icon-ticket', + state: 'ticket.index', + params: {q: `{"clientFk": ${$state.params.id}}`}, + tooltip: 'Client ticket list' + } + }; } + + set clientFk(value) { + if (value) { + this._getClient(value); + this._getClientDebt(value); + } + } + + set quicklinks(value = {}) { + this._quicklinks = Object.assign(value, this.links); + } + + get quicklinks() { + return this._quicklinks; + } + _getClientDebt(clientFk) { this.$http.get(`/client/api/Clients/${clientFk}/getDebt`) .then(response => { @@ -23,11 +47,8 @@ class Controller { this.$state.go('ticket.index', {q: `{"clientFk": ${this.client.id}}`}); } - set clientFk(value) { - if (value) { - this._getClient(value); - this._getClientDebt(value); - } + quicklinkGo(state, params) { + this.$state.go(state, params); } } @@ -37,7 +58,8 @@ ngModule.component('vnClientDescriptor', { template: require('./index.html'), bindings: { client: '<', - clientFk: ' + tags="$ctrl.tags" + quicklinks="$ctrl.quicklinks"> diff --git a/client/item/src/descriptor-popover/index.js b/client/item/src/descriptor-popover/index.js index c54300119..0093c57aa 100644 --- a/client/item/src/descriptor-popover/index.js +++ b/client/item/src/descriptor-popover/index.js @@ -7,11 +7,19 @@ class Controller extends Component { super($element, $scope); this.$http = $http; this.$timeout = $timeout; - + this.links = {}; this.isTooltip = true; this.clear(); } + set quicklinks(value = {}) { + this._quicklinks = Object.assign(value, this.links); + } + + get quicklinks() { + return this._quicklinks; + } + clear() { this.item = null; this.tags = {}; @@ -90,7 +98,8 @@ Controller.$inject = ['$element', '$scope', '$http', '$timeout']; ngModule.component('vnItemDescriptorPopover', { template: require('./index.html'), bindings: { - itemFk: '<' + itemFk: '<', + quicklinks: '<' }, controller: Controller }); diff --git a/client/item/src/descriptor/index.html b/client/item/src/descriptor/index.html index 813a66c2d..9d8d3d6a8 100644 --- a/client/item/src/descriptor/index.html +++ b/client/item/src/descriptor/index.html @@ -37,4 +37,23 @@ + + + + + + + + + + diff --git a/client/item/src/descriptor/index.js b/client/item/src/descriptor/index.js index 5d443b8e9..103ebc47f 100644 --- a/client/item/src/descriptor/index.js +++ b/client/item/src/descriptor/index.js @@ -1,11 +1,34 @@ import ngModule from '../module'; import './style.scss'; +class Controller { + constructor($state) { + this.$state = $state; + this.links = {}; + } + + set quicklinks(value = {}) { + this._quicklinks = Object.assign(value, this.links); + } + + get quicklinks() { + return this._quicklinks; + } + + quicklinkGo(state, params) { + this.$state.go(state, params); + } +} + +Controller.$inject = ['$state']; + ngModule.component('vnItemDescriptor', { template: require('./index.html'), + controller: Controller, bindings: { item: '<', itemTags: '<', - tags: '<' + tags: '<', + quicklinks: '<' } }); diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index b97470b86..1af528e2d 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -206,7 +206,7 @@ vn-main-block { } } - .buttons { + .quicklinks { justify-content: center; align-items: center; diff --git a/client/ticket/src/sale/index.html b/client/ticket/src/sale/index.html index 79d4fb833..903147dc8 100644 --- a/client/ticket/src/sale/index.html +++ b/client/ticket/src/sale/index.html @@ -164,7 +164,8 @@ - + diff --git a/client/ticket/src/sale/index.js b/client/ticket/src/sale/index.js index 6c0c32c4b..09d3cfb74 100644 --- a/client/ticket/src/sale/index.js +++ b/client/ticket/src/sale/index.js @@ -20,6 +20,25 @@ class Controller { ]; } + set ticket(value) { + this._ticket = value; + + if (!value) return; + + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: 'item.card.diary', + params: {id: value.id, q: `{"warehouseFk": ${value.warehouseFk}}`}, + tooltip: 'Item diary' + } + }; + } + + get ticket() { + return this._ticket; + } + onDataChange() { this.sales = this.$scope.model.data; this.getTaxes();