From afb5bdf4d09e152d0a93fde9929d176549703aab Mon Sep 17 00:00:00 2001 From: Joan Date: Tue, 4 Sep 2018 12:29:22 +0200 Subject: [PATCH] descriptor quicklings fixed #593 --- client/client/src/descriptor/index.html | 35 +++++++++------- client/client/src/descriptor/index.js | 3 +- client/core/src/components/chip/index.html | 8 ++++ client/core/src/components/chip/index.js | 27 +++++++++++++ client/core/src/components/chip/style.scss | 7 ++++ client/core/src/components/index.js | 1 + client/item/src/descriptor/index.html | 42 ++++++++++++-------- client/item/src/diary/index.html | 17 ++++++-- client/item/src/diary/index.js | 10 +++++ client/item/src/ticket-descriptor/index.html | 33 ++++++++++++--- client/item/src/ticket-descriptor/index.js | 40 ++++++++++++++----- client/order/src/filter/index.html | 2 +- client/salix/src/styles/misc.scss | 18 ++++----- client/ticket/src/component/index.html | 4 +- client/ticket/src/component/index.js | 10 +++++ client/ticket/src/expedition/index.html | 6 ++- client/ticket/src/expedition/index.js | 15 ++++++- client/ticket/src/locale/es.yml | 1 + client/ticket/src/sale-checked/index.html | 4 +- client/ticket/src/sale-checked/index.js | 15 ++++++- client/ticket/src/sale-tracking/index.html | 5 ++- client/ticket/src/sale-tracking/index.js | 10 +++++ client/ticket/src/sale/index.js | 29 +++++--------- client/ticket/src/summary/index.html | 4 +- client/ticket/src/summary/index.js | 20 +++++++++- client/ticket/src/summary/index.spec.js | 4 +- client/ticket/src/volume/index.html | 4 +- client/ticket/src/volume/index.js | 10 +++++ 28 files changed, 288 insertions(+), 96 deletions(-) create mode 100644 client/core/src/components/chip/index.html create mode 100644 client/core/src/components/chip/index.js create mode 100644 client/core/src/components/chip/style.scss diff --git a/client/client/src/descriptor/index.html b/client/client/src/descriptor/index.html index 6f92aa78e..4e002c428 100644 --- a/client/client/src/descriptor/index.html +++ b/client/client/src/descriptor/index.html @@ -54,22 +54,29 @@ - - - - + + + + - - - + + + + - + ui-sref="{{::$ctrl.quicklinks.btnThree.state}}" target="_blank"> + + + \ No newline at end of file diff --git a/client/client/src/descriptor/index.js b/client/client/src/descriptor/index.js index 85bf8b516..ba8d82f85 100644 --- a/client/client/src/descriptor/index.js +++ b/client/client/src/descriptor/index.js @@ -21,8 +21,7 @@ class Controller { this._quicklinks = { btnOne: { icon: 'icon-ticket', - state: 'ticket.index', - params: {q: `{"clientFk": ${value.id}}`}, + state: `ticket.index({q: '{"clientFk": ${value.id}}'})`, tooltip: 'Client ticket list' } }; diff --git a/client/core/src/components/chip/index.html b/client/core/src/components/chip/index.html new file mode 100644 index 000000000..c687623be --- /dev/null +++ b/client/core/src/components/chip/index.html @@ -0,0 +1,8 @@ +
+ + + + +
\ No newline at end of file diff --git a/client/core/src/components/chip/index.js b/client/core/src/components/chip/index.js new file mode 100644 index 000000000..b95030d68 --- /dev/null +++ b/client/core/src/components/chip/index.js @@ -0,0 +1,27 @@ +import ngModule from '../../module'; +import './style.scss'; + +export default class Chip { + constructor($element, $scope, $transclude) { + $transclude($scope.$parent, clone => { + angular.element($element[0].querySelector('div')).append(clone); + }); + /* this.mdlElement = this.element.querySelector('.mdl-slider'); + componentHandler.upgradeElement(this.mdlElement); */ + /* this.mdlElement.addEventListener('change', () => { + this._value = this.input.value; + this.$.$applyAsync(); + }); */ + } +} + +Chip.$inject = ['$element', '$scope', '$transclude']; + +ngModule.component('vnChip', { + template: require('./index.html'), + controller: Chip, + transclude: true, + bindings: { + disabled: ' - - - - - - - - + + + + + + + + + + + + + diff --git a/client/item/src/diary/index.html b/client/item/src/diary/index.html index f4221d978..b07771097 100644 --- a/client/item/src/diary/index.html +++ b/client/item/src/diary/index.html @@ -27,7 +27,7 @@ Id State Reference - Worker + Client In Out Balance @@ -37,11 +37,14 @@ {{::sale.date | date:'dd/MM/yyyy HH:mm' }} - + {{::sale.origin | dashIfEmpty}} {{::sale.stateName | dashIfEmpty}} {{::sale.reference | dashIfEmpty}} - {{sale.name | dashIfEmpty}} + + {{sale.name | dashIfEmpty}} {{::sale.in | dashIfEmpty}} {{::sale.out | dashIfEmpty}} {{::sale.balance | dashIfEmpty}} @@ -54,4 +57,10 @@ - + + + + + \ No newline at end of file diff --git a/client/item/src/diary/index.js b/client/item/src/diary/index.js index 75a7efd53..b8fd34aec 100644 --- a/client/item/src/diary/index.js +++ b/client/item/src/diary/index.js @@ -125,6 +125,16 @@ class Controller { event.stopImmediatePropagation(); } + showClientDescriptor(event, sale) { + if (!sale.isTicket) return; + + this.$scope.clientDescriptor.clientFk = sale.clientFk; + this.$scope.clientDescriptor.parent = event.target; + this.$scope.clientDescriptor.show(); + event.preventDefault(); + event.stopImmediatePropagation(); + } + onDescriptorLoad() { this.$scope.popover.relocate(); } diff --git a/client/item/src/ticket-descriptor/index.html b/client/item/src/ticket-descriptor/index.html index 7d96845e6..c6f02eb5a 100644 --- a/client/item/src/ticket-descriptor/index.html +++ b/client/item/src/ticket-descriptor/index.html @@ -4,7 +4,7 @@ - + @@ -14,8 +14,6 @@ value="{{$ctrl.ticket.id}}"> - + + + + + + + + + + + + + + + - \ No newline at end of file diff --git a/client/item/src/ticket-descriptor/index.js b/client/item/src/ticket-descriptor/index.js index 2f3b776e6..e5c80a39d 100644 --- a/client/item/src/ticket-descriptor/index.js +++ b/client/item/src/ticket-descriptor/index.js @@ -1,25 +1,43 @@ import ngModule from '../module'; class Controller { - constructor($http, $scope) { + constructor($state, $scope) { this.$scope = $scope; - this.$http = $http; + this.$state = $state; } - showDescriptor(event, clientFk) { - this.$scope.descriptor.clientFk = clientFk; - this.$scope.descriptor.parent = event.target; - this.$scope.descriptor.show(); - event.preventDefault(); - event.stopImmediatePropagation(); + get ticket() { + return this._ticket; } - onDescriptorLoad() { - this.$scope.popover.relocate(); + set ticket(value) { + this._ticket = value; + + if (!value) return; + + this._quicklinks = { + btnOne: { + icon: 'person', + state: `client.card.summary({id: ${value.clientFk}})`, + tooltip: 'Client card' + } + }; + } + + set quicklinks(value = {}) { + this._quicklinks = Object.assign(value, this._quicklinks); + } + + get quicklinks() { + return this._quicklinks; + } + + quicklinkGo(state, params) { + this.$state.go(state, params); } } -Controller.$inject = ['$http', '$scope']; +Controller.$inject = ['$state', '$scope']; ngModule.component('vnTicketDescriptor', { template: require('./index.html'), diff --git a/client/order/src/filter/index.html b/client/order/src/filter/index.html index 369e81500..0c4c4b015 100644 --- a/client/order/src/filter/index.html +++ b/client/order/src/filter/index.html @@ -42,7 +42,7 @@ - tags + Tag1 diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index 7517ed95c..bb722f87b 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -210,18 +210,15 @@ vn-main-block { .quicklinks { justify-content: center; align-items: center; - + & > a { - background-color: $main-01; - @extend %clickable; - display: flex; - align-items: center; - padding: .5em; - color: white; - text-decoration: none; - & > vn-icon { font-size: 1.8em; + padding: 0; + } + + & > vn-icon i[class="material-icons"] { + line-height: 36px; } } } @@ -287,8 +284,11 @@ fieldset[disabled] .mdl-textfield .mdl-textfield__label, .counter { background-color: $main-header; + display: inline-block; color: $color-white; + text-align: center; border-radius: 3px; + min-width: 1.5em; padding: 5px } diff --git a/client/ticket/src/component/index.html b/client/ticket/src/component/index.html index 16175048e..57c7ccee2 100644 --- a/client/ticket/src/component/index.html +++ b/client/ticket/src/component/index.html @@ -76,4 +76,6 @@ - + + \ No newline at end of file diff --git a/client/ticket/src/component/index.js b/client/ticket/src/component/index.js index aa7cb00d9..8dd556cb1 100644 --- a/client/ticket/src/component/index.js +++ b/client/ticket/src/component/index.js @@ -88,6 +88,16 @@ class Controller { } showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + q: '{"warehouseFk": ${this.ticket.warehouseFk}}' + })`, + tooltip: 'Item diary' + } + }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); diff --git a/client/ticket/src/expedition/index.html b/client/ticket/src/expedition/index.html index df159b9e0..31a3f581c 100644 --- a/client/ticket/src/expedition/index.html +++ b/client/ticket/src/expedition/index.html @@ -56,5 +56,7 @@ scroll-selector="ui-view"> - - + + + \ No newline at end of file diff --git a/client/ticket/src/expedition/index.js b/client/ticket/src/expedition/index.js index 738083a38..85a4ecd46 100644 --- a/client/ticket/src/expedition/index.js +++ b/client/ticket/src/expedition/index.js @@ -32,6 +32,16 @@ class Controller { } showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + q: '{"warehouseFk": ${this.ticket.warehouseFk}}' + })`, + tooltip: 'Item diary' + } + }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); @@ -46,5 +56,8 @@ Controller.$inject = ['$scope', '$stateParams', '$http']; ngModule.component('vnTicketExpedition', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + ticket: '<' + } }); diff --git a/client/ticket/src/locale/es.yml b/client/ticket/src/locale/es.yml index 233928399..236e3ebdd 100644 --- a/client/ticket/src/locale/es.yml +++ b/client/ticket/src/locale/es.yml @@ -57,6 +57,7 @@ Risk: Riesgo Delay: Retraso Code 100: Código 100 Invoice: Factura +Client card: Ficha del cliente #sections List: Listado diff --git a/client/ticket/src/sale-checked/index.html b/client/ticket/src/sale-checked/index.html index 39dbf7b6f..ef070d6e1 100644 --- a/client/ticket/src/sale-checked/index.html +++ b/client/ticket/src/sale-checked/index.html @@ -47,4 +47,6 @@ - + + diff --git a/client/ticket/src/sale-checked/index.js b/client/ticket/src/sale-checked/index.js index bd544ad9f..204b393ab 100644 --- a/client/ticket/src/sale-checked/index.js +++ b/client/ticket/src/sale-checked/index.js @@ -34,6 +34,16 @@ class Controller { } showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + q: '{"warehouseFk": ${this.ticket.warehouseFk}}' + })`, + tooltip: 'Item diary' + } + }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); @@ -48,5 +58,8 @@ Controller.$inject = ['$scope', '$stateParams']; ngModule.component('vnTicketSaleChecked', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + ticket: '<' + } }); diff --git a/client/ticket/src/sale-tracking/index.html b/client/ticket/src/sale-tracking/index.html index 3ec916fb7..9a2e26b73 100644 --- a/client/ticket/src/sale-tracking/index.html +++ b/client/ticket/src/sale-tracking/index.html @@ -60,5 +60,6 @@ - - + + \ No newline at end of file diff --git a/client/ticket/src/sale-tracking/index.js b/client/ticket/src/sale-tracking/index.js index 289ea3657..0ef1a0ddf 100644 --- a/client/ticket/src/sale-tracking/index.js +++ b/client/ticket/src/sale-tracking/index.js @@ -7,6 +7,16 @@ class Controller { } showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + q: '{"warehouseFk": ${this.ticket.warehouseFk}}' + })`, + tooltip: 'Item diary' + } + }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); diff --git a/client/ticket/src/sale/index.js b/client/ticket/src/sale/index.js index 6fda41697..77ed7c2e4 100644 --- a/client/ticket/src/sale/index.js +++ b/client/ticket/src/sale/index.js @@ -20,25 +20,6 @@ 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(); @@ -241,6 +222,16 @@ class Controller { // Item Descriptor showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + q: '{"warehouseFk": ${this.ticket.warehouseFk}}' + })`, + tooltip: 'Item diary' + } + }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); diff --git a/client/ticket/src/summary/index.html b/client/ticket/src/summary/index.html index 076cfb99b..871ad30d0 100644 --- a/client/ticket/src/summary/index.html +++ b/client/ticket/src/summary/index.html @@ -92,4 +92,6 @@ - + + diff --git a/client/ticket/src/summary/index.js b/client/ticket/src/summary/index.js index 2d9bd797f..645432bcb 100644 --- a/client/ticket/src/summary/index.js +++ b/client/ticket/src/summary/index.js @@ -7,8 +7,14 @@ class Controller { this.$http = $http; } - $onChanges() { - if (!this.ticket) return; + get ticket() { + return this._ticket; + } + + set ticket(value) { + this._ticket = value; + + if (!value) return; this.$http.get(`/ticket/api/Tickets/${this.ticket.id}/summary`).then(res => { if (res && res.data) @@ -26,6 +32,16 @@ class Controller { } showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + q: '{"warehouseFk": ${this.ticket.warehouseFk}}' + })`, + tooltip: 'Item diary' + } + }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); diff --git a/client/ticket/src/summary/index.spec.js b/client/ticket/src/summary/index.spec.js index eafcd7e01..74a351927 100644 --- a/client/ticket/src/summary/index.spec.js +++ b/client/ticket/src/summary/index.spec.js @@ -18,12 +18,12 @@ describe('Ticket', () => { controller.ticket = {id: 1}; })); - describe('$onChanges()', () => { + describe('ticket()', () => { it('should perform a GET query and define summary property', () => { let res = {id: 1, nickname: 'Batman'}; $httpBackend.when('GET', `/ticket/api/Tickets/1/summary`).respond(200, res); $httpBackend.expect('GET', `/ticket/api/Tickets/1/summary`); - controller.$onChanges(); + controller.ticket = {id: 1}; $httpBackend.flush(); expect(controller.summary).toBeDefined(); diff --git a/client/ticket/src/volume/index.html b/client/ticket/src/volume/index.html index 62321ca00..1869ef0e1 100644 --- a/client/ticket/src/volume/index.html +++ b/client/ticket/src/volume/index.html @@ -53,5 +53,7 @@ - + + diff --git a/client/ticket/src/volume/index.js b/client/ticket/src/volume/index.js index 50f182d51..7da05435d 100644 --- a/client/ticket/src/volume/index.js +++ b/client/ticket/src/volume/index.js @@ -47,6 +47,16 @@ class Controller { } showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + q: '{"warehouseFk": ${this.ticket.warehouseFk}}' + })`, + tooltip: 'Item diary' + } + }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show();