From 78fd0d4d1655091e13aa98e6e39d51ef98cdf113 Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 15 Nov 2017 08:41:54 +0100 Subject: [PATCH 1/6] recargo y vies movidos de vista --- .../client/src/billing-data/billing-data.html | 31 +----------- .../client/src/billing-data/billing-data.js | 31 +----------- .../client/src/fiscal-data/fiscal-data.html | 23 ++++++++- client/client/src/fiscal-data/fiscal-data.js | 47 +++++++++++++++++++ client/core/src/paging/paging.js | 5 ++ 5 files changed, 77 insertions(+), 60 deletions(-) diff --git a/client/client/src/billing-data/billing-data.html b/client/client/src/billing-data/billing-data.html index ad4641da2..a8a7d79b0 100644 --- a/client/client/src/billing-data/billing-data.html +++ b/client/client/src/billing-data/billing-data.html @@ -22,27 +22,13 @@ - - - - - - - - + - - - - - - Documentación - @@ -55,6 +41,7 @@ + @@ -72,18 +59,4 @@ - - - - - You changes the equivalent tax - Do you want to spread the change to their consignees? - - - - - - \ No newline at end of file diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index b06f20cd7..46849c070 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -9,11 +9,9 @@ export default class Controller { this.billData = {}; this.copyData(); } - $onChanges() { this.copyData(); } - copyData() { if (this.client) { this.billData.payMethodFk = this.client.payMethodFk; @@ -22,15 +20,12 @@ export default class Controller { this.billData.discount = this.client.discount; this.billData.credit = this.client.credit; this.billData.creditInsurance = this.client.creditInsurance; - this.equalizationTax = this.client.equalizationTax; } } - submit() { return this.$.watcher.submit().then( () => this.checkPaymentChanges()); } - checkPaymentChanges() { let equals = true; Object.keys(this.billData).forEach( @@ -42,13 +37,10 @@ export default class Controller { } ); - if (equals) { - this.checkEtChanges(); - } else { + if (!equals) { this.$.sendMail.show(); } } - returnDialog(response) { if (response === 'ACCEPT') { this.$http.post(`/mailer/manuscript/payment-update/${this.client.id}`).then( @@ -57,27 +49,6 @@ export default class Controller { this.checkEtChanges(); } ); - } else { - this.checkEtChanges(); - } - } - - checkEtChanges() { - let equals = this.equalizationTax == this.client.equalizationTax; - this.equalizationTax = this.client.equalizationTax; - - if (!equals) - this.$.propagateEqualizationTax.show(); - } - - returnDialogEt(response) { - if (response === 'ACCEPT') { - this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then( - res => { - if (res.data) - this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded')); - } - ); } } } diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index 1443b0a11..9c0bf5837 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -5,7 +5,7 @@ form="form" save="patch"> -
+ Fiscal data @@ -16,6 +16,12 @@ + + + + + + @@ -47,3 +53,18 @@ + + + + You changes the equivalent tax + Do you want to spread the change to their consignees? + + + + + + + \ No newline at end of file diff --git a/client/client/src/fiscal-data/fiscal-data.js b/client/client/src/fiscal-data/fiscal-data.js index 286693f83..6ef3c3931 100644 --- a/client/client/src/fiscal-data/fiscal-data.js +++ b/client/client/src/fiscal-data/fiscal-data.js @@ -1,7 +1,54 @@ import ngModule from '../module'; +export default class ClientFiscalData { + constructor($scope, $http, vnApp, $translate) { + this.$ = $scope; + this.$http = $http; + this.vnApp = vnApp; + this.translate = $translate; + this.equalizationTax = undefined; + this.copyData(); + } + + $onChanges() { + this.copyData(); + } + + copyData() { + if (this.client) { + this.equalizationTax = this.client.equalizationTax; + } + } + + submit() { + return this.$.watcher.submit().then( + () => this.checkEtChanges()); + } + + checkEtChanges() { + let equals = this.equalizationTax == this.client.equalizationTax; + this.equalizationTax = this.client.equalizationTax; + + if (!equals) + this.$.propagateEqualizationTax.show(); + } + + returnDialogEt(response) { + if (response === 'ACCEPT') { + this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then( + res => { + if (res.data) + this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded')); + } + ); + } + } +} +ClientFiscalData.$inject = ['$scope', '$http', 'vnApp', '$translate']; + ngModule.component('vnClientFiscalData', { template: require('./fiscal-data.html'), + controller: ClientFiscalData, bindings: { client: '<' } diff --git a/client/core/src/paging/paging.js b/client/core/src/paging/paging.js index 02d1a7fc0..1e415b366 100644 --- a/client/core/src/paging/paging.js +++ b/client/core/src/paging/paging.js @@ -39,6 +39,11 @@ export default class Paging { this.pageChange(); } } + $doCheck() { + if (this.index && this.index.filter && this.index.filter.page && this.index.filter.page != this.currentPage) { + this.currentPage = this.index.filter.page; + } + } } Paging.$inject = ['$http', '$scope']; From bb4c43c2bdb37447deca7d804013d0e00ff41edc Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 15 Nov 2017 09:38:39 +0100 Subject: [PATCH 2/6] cambios en formularios de client --- client/client/routes.json | 2 +- .../client/src/address-edit/address-edit.html | 1 + client/client/src/basic-data/basic-data.html | 13 +++-- client/client/src/basic-data/locale/es.json | 5 +- .../client/src/billing-data/billing-data.html | 7 +-- .../client/src/fiscal-data/fiscal-data.html | 52 ++++++++++++------- client/client/src/locale/es.json | 3 +- 7 files changed, 51 insertions(+), 32 deletions(-) diff --git a/client/client/routes.json b/client/client/routes.json index 8b1e32a7b..c938dd8a6 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -48,7 +48,7 @@ "client": "$ctrl.client" }, "menu": { - "description": "Datos facturación", + "description": "Pay method", "icon": "assignment" } }, { diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html index 56fe01aab..afc77305b 100644 --- a/client/client/src/address-edit/address-edit.html +++ b/client/client/src/address-edit/address-edit.html @@ -36,6 +36,7 @@ Basic data - - - + + - + + - - Billing information + Pay method + label="Pay method"> @@ -26,9 +26,6 @@ - - - diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index 9c0bf5837..f9c9c418b 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -9,33 +9,25 @@ Fiscal data - - - - - - - - - - - - - + + + - - + + - + + label="Province" + vn-acl="administrative" + > + label="Country" + vn-acl="administrative" + > + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/client/src/locale/es.json b/client/client/src/locale/es.json index 4dd110d72..20089e85c 100644 --- a/client/client/src/locale/es.json +++ b/client/client/src/locale/es.json @@ -9,5 +9,6 @@ "City": "Municipio", "Postcode": "Código postal", "Province": "Provincia", - "Save": "Guardar" + "Save": "Guardar", + "Pay method" : "Forma de pago" } From d4a0cf205d1afe5bdf23c9cc51a70e77531d636f Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 15 Nov 2017 12:11:35 +0100 Subject: [PATCH 3/6] bug fixed in edit addresses --- client/client/src/address-edit/address-edit.html | 2 +- services/client/common/models/address.js | 9 ++++++++- services/client/common/models/address.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html index afc77305b..d94324c92 100644 --- a/client/client/src/address-edit/address-edit.html +++ b/client/client/src/address-edit/address-edit.html @@ -36,7 +36,7 @@ Date: Wed, 15 Nov 2017 12:53:32 +0100 Subject: [PATCH 4/6] searchbar clean filters --- client/client/src/search-panel/search-panel.js | 10 +++++----- .../salix/src/components/searchbar/searchbar.html | 2 +- .../salix/src/components/searchbar/searchbar.js | 15 +++++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/client/client/src/search-panel/search-panel.js b/client/client/src/search-panel/search-panel.js index 88aa89af3..3f78dc809 100644 --- a/client/client/src/search-panel/search-panel.js +++ b/client/client/src/search-panel/search-panel.js @@ -1,8 +1,8 @@ import ngModule from '../module'; export default class Controller { - constructor($window) { - this.$window = $window; + constructor(sessionStorage) { + this.sessionStorage = sessionStorage; // onSubmit() is defined by @vnSearchbar this.onSubmit = () => {}; } @@ -13,16 +13,16 @@ export default class Controller { } $onChanges() { - var value = JSON.parse(this.$window.sessionStorage.getItem('filter')); + var value = this.sessionStorage.get('filter'); if (value !== undefined) this.filter = value; } setStorageValue() { - this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); + this.sessionStorage.set('filter', this.filter); } } -Controller.$inject = ['$window']; +Controller.$inject = ['sessionStorage']; ngModule.component('vnClientSearchPanel', { template: require('./search-panel.html'), diff --git a/client/salix/src/components/searchbar/searchbar.html b/client/salix/src/components/searchbar/searchbar.html index 179c77f7a..d4636aaf1 100644 --- a/client/salix/src/components/searchbar/searchbar.html +++ b/client/salix/src/components/searchbar/searchbar.html @@ -9,6 +9,6 @@ style="cursor: pointer;"> - + \ No newline at end of file diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index 5f3ad79be..2f0864bf7 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -1,15 +1,22 @@ import ngModule from '../../module'; export default class Controller { - constructor($element, $scope, $document, $compile, vnPopover, $window) { + constructor($element, $scope, $document, $compile, vnPopover, sessionStorage, $timeout) { this.element = $element[0]; this.$scope = $scope; this.$document = $document; this.$compile = $compile; this.vnPopover = vnPopover; - this.$window = $window; + this.sessionStorage = sessionStorage; + this.$timeout = $timeout; + } + clearFilter() { + this.index.filter = {}; + this.sessionStorage.remove('filter'); } onClick(event) { + this.search = null; + this.child = this.vnPopover.showComponent(this.popover, this.$scope, this.element); // XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente? @@ -37,10 +44,10 @@ export default class Controller { delete this.child; } $onDestroy() { - this.$window.sessionStorage.removeItem('filter'); + this.clearFilter(); } } -Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', '$window']; +Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', 'sessionStorage', '$timeout']; ngModule.component('vnSearchbar', { template: require('./searchbar.html'), From d5d8145feedc76d925ce9d5f9be0642d3e74bd59 Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 15 Nov 2017 13:05:11 +0100 Subject: [PATCH 5/6] bugs fixed --- client/client/src/billing-data/billing-data.js | 1 - client/client/src/search-panel/search-panel.spec.js | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index 46849c070..a6887039e 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -46,7 +46,6 @@ export default class Controller { this.$http.post(`/mailer/manuscript/payment-update/${this.client.id}`).then( () => { this.vnApp.showMessage(this.translate.instant('Notification sent!')); - this.checkEtChanges(); } ); } diff --git a/client/client/src/search-panel/search-panel.spec.js b/client/client/src/search-panel/search-panel.spec.js index 2c3137ff0..e4b7b5634 100644 --- a/client/client/src/search-panel/search-panel.spec.js +++ b/client/client/src/search-panel/search-panel.spec.js @@ -3,17 +3,17 @@ import './search-panel.js'; describe('Client', () => { describe('Component vnClientSearchPanel', () => { let $componentController; - let $window; + let sessionStorage; let controller; beforeEach(() => { angular.mock.module('client'); }); - beforeEach(angular.mock.inject((_$componentController_, _$window_) => { + beforeEach(angular.mock.inject((_$componentController_, _sessionStorage_) => { $componentController = _$componentController_; - $window = _$window_; - controller = $componentController('vnClientSearchPanel', {$window: $window}); + sessionStorage = _sessionStorage_; + controller = $componentController('vnClientSearchPanel', {sessionStorage: sessionStorage}); })); describe('onSearch()', () => { @@ -31,10 +31,10 @@ describe('Client', () => { describe('$onChanges()', () => { it('should set filter properties using the search values', () => { expect(controller.filter).not.toBeDefined(); - spyOn(JSON, 'parse').and.returnValue({data: 'data'}); + spyOn(sessionStorage, 'get').and.returnValue({data: 'data'}); controller.$onChanges(); - expect(controller.filter).toBe(JSON.parse({data: 'data'})); + expect(controller.filter).toBe(sessionStorage.get({data: 'data'})); }); }); }); From dd14ddb8bdc1806531f1d4f3f584c27aee34eb5f Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 15 Nov 2017 13:11:04 +0100 Subject: [PATCH 6/6] production only acl to developers --- client/production/routes.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/production/routes.json b/client/production/routes.json index f0348d7d7..1c3abd874 100644 --- a/client/production/routes.json +++ b/client/production/routes.json @@ -8,7 +8,7 @@ "url": "/production", "state": "production", "component": "vn-production-index", - "acl": ["employee"] + "acl": ["developer"] } ] } \ No newline at end of file