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..d94324c92 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"> - - - - - - - - - - - - - - - - - Documentación - + @@ -55,6 +38,7 @@ + @@ -72,18 +56,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..a6887039e 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,40 +37,15 @@ 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( () => { this.vnApp.showMessage(this.translate.instant('Notification sent!')); - 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..f9c9c418b 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -5,31 +5,29 @@ form="form" save="patch"> -
+ Fiscal data - - - - - - - + + + - - + + - + + label="Province" + vn-acl="administrative" + > + label="Country" + vn-acl="administrative" + > + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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/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" } 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/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'})); }); }); }); 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']; 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 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'), diff --git a/services/client/common/models/address.js b/services/client/common/models/address.js index 6d74933a3..53c0bcbad 100644 --- a/services/client/common/models/address.js +++ b/services/client/common/models/address.js @@ -25,12 +25,19 @@ module.exports = function(Self) { Self.beforeRemote('findById', function(ctx, modelInstance, next) { ctx.args.filter = { - include: { + include: [{ relation: "province", scope: { fields: ["id", "name"] } + }, + { + relation: "defaultAgency", + scope: { + fields: ["id", "name"] + } } + ] }; next(); }); diff --git a/services/client/common/models/address.json b/services/client/common/models/address.json index 42ac6d696..937073d16 100644 --- a/services/client/common/models/address.json +++ b/services/client/common/models/address.json @@ -58,7 +58,7 @@ }, "defaultAgency": { "type": "belongsTo", - "model": "Agency", + "model": "AgencyMode", "foreignKey": "defaultAgencyFk" } }