diff --git a/client/client/src/address/index/index.html b/client/client/src/address/index/index.html index c175f42ff..448d72c11 100644 --- a/client/client/src/address/index/index.html +++ b/client/client/src/address/index/index.html @@ -1,8 +1,15 @@ - + + + Addresses - + @@ -56,7 +63,6 @@ - this.$scope.index.accept() + () => this.$scope.model.refresh() ); } } } -Controller.$inject = ['$http', '$scope']; +Controller.$inject = ['$http', '$scope', '$stateParams']; ngModule.component('vnClientAddressIndex', { template: require('./index.html'), diff --git a/client/client/src/contact/contact.spec.js b/client/client/src/contact/contact.spec.js index d79754a15..a4d20ea7f 100644 --- a/client/client/src/contact/contact.spec.js +++ b/client/client/src/contact/contact.spec.js @@ -19,7 +19,7 @@ describe('Client', () => { $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $scope = $rootScope.$new(); $scope.form = {$invalid: false}; - $scope.index = {accept: () => {}}; + $scope.model = {refresh: () => {}}; controller = $componentController('vnClientContactIndex', {$scope: $scope}, {$state: $state}); controller.client = { id: 101 @@ -70,11 +70,11 @@ describe('Client', () => { describe('submit()', () => { it("should perfom a query to delete contacts", () => { - controller._oldContacts = []; - controller._oldContacts[1] = {id: 1, clientFk: 101, name: 'My contact 1', phone: '123456789'}; - controller._oldContacts[2] = {id: 2, clientFk: 101, name: 'My contact 2', phone: '123456789'}; + controller.oldContacts = []; + controller.oldContacts[1] = {id: 1, clientFk: 101, name: 'My contact 1', phone: '123456789'}; + controller.oldContacts[2] = {id: 2, clientFk: 101, name: 'My contact 2', phone: '123456789'}; - controller._contacts = [ + controller.contacts = [ {id: 2, name: 'My contact 2', phone: '123456789'} ]; controller.removedContacts = [1]; @@ -93,11 +93,11 @@ describe('Client', () => { }); it("should perfom a query to update contacts", () => { - controller._oldContacts = []; - controller._oldContacts[1] = {id: 1, clientFk: 101, name: 'My contact 1', phone: '123456789'}; - controller._oldContacts[2] = {id: 2, clientFk: 101, name: 'My contact 2', phone: '123456789'}; + controller.oldContacts = []; + controller.oldContacts[1] = {id: 1, clientFk: 101, name: 'My contact 1', phone: '123456789'}; + controller.oldContacts[2] = {id: 2, clientFk: 101, name: 'My contact 2', phone: '123456789'}; - controller._contacts = [ + controller.contacts = [ {id: 1, clientFk: 101, name: 'My contact 1', phone: '123456789'}, {id: 2, clientFk: 101, name: 'My contact 2', phone: '111111111'} ]; @@ -119,11 +119,11 @@ describe('Client', () => { }); it("should perfom a query to create new contact", () => { - controller._oldContacts = []; - controller._oldContacts[1] = {id: 1, name: 'My contact 1', phone: '123456789'}; - controller._oldContacts[2] = {id: 2, name: 'My contact 2', phone: '123456789'}; + controller.oldContacts = []; + controller.oldContacts[1] = {id: 1, name: 'My contact 1', phone: '123456789'}; + controller.oldContacts[2] = {id: 2, name: 'My contact 2', phone: '123456789'}; - controller._contacts = [ + controller.contacts = [ {id: 1, name: 'My contact 1', phone: '123456789'}, {id: 2, name: 'My contact 2', phone: '123456789'}, {name: 'My contact 3', phone: '123456789'} diff --git a/client/client/src/contact/index.html b/client/client/src/contact/index.html index 1acf29ed7..dd97d850e 100644 --- a/client/client/src/contact/index.html +++ b/client/client/src/contact/index.html @@ -1,12 +1,14 @@ - - + + + Contacts - + { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); - this.$scope.index.accept(); + this.$scope.model.refresh(); }); } @@ -85,7 +78,7 @@ class Controller { add() { let data = { clientFk: this.client.id, - name: 'Teléfono', + name: this.$translate.instant('Phone'), phone: null }; this.contacts.push(data); @@ -115,7 +108,7 @@ class Controller { } } -Controller.$inject = ['$http', '$scope', '$translate', 'vnApp']; +Controller.$inject = ['$http', '$scope', '$stateParams', '$translate', 'vnApp']; ngModule.component('vnClientContactIndex', { template: require('./index.html'), diff --git a/client/client/src/credit-insurance/insurance/index/credit-insurance-list.spec.js b/client/client/src/credit-insurance/insurance/index/credit-insurance-list.spec.js index f994829a8..38c43fce7 100644 --- a/client/client/src/credit-insurance/insurance/index/credit-insurance-list.spec.js +++ b/client/client/src/credit-insurance/insurance/index/credit-insurance-list.spec.js @@ -12,10 +12,10 @@ describe('Client', () => { beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_) => { $componentController = _$componentController_; - let $state = {params: {classificationId: 1}}; + let $stateParams = {classificationId: 1}; $httpBackend = _$httpBackend_; $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); - controller = $componentController('vnClientCreditInsuranceInsuranceIndex', {$state: $state}); + controller = $componentController('vnClientCreditInsuranceInsuranceIndex', {$stateParams: $stateParams}); })); it('should perform a query to GET credit the credit classification', () => { diff --git a/client/client/src/credit-insurance/insurance/index/index.html b/client/client/src/credit-insurance/insurance/index/index.html index 0190e9eec..7d277ebeb 100644 --- a/client/client/src/credit-insurance/insurance/index/index.html +++ b/client/client/src/credit-insurance/insurance/index/index.html @@ -1,28 +1,39 @@ - + + + Requested credits - - - - Credit - Grade - Created - - - - - {{::insurance.credit | currency: '€': 2}} - {{::insurance.grade}} - {{::insurance.created | date: 'dd/MM/yyyy'}} - - - No results - - - + + + + Credit + Grade + Created + + + + + {{::insurance.credit | currency: ' €': 2}} + {{::insurance.grade}} + {{::insurance.created | date: 'dd/MM/yyyy'}} + + + + No results + + + + Back - - \ No newline at end of file diff --git a/client/client/src/credit-insurance/insurance/index/index.js b/client/client/src/credit-insurance/insurance/index/index.js index 5f8c14afd..cfb8a807c 100644 --- a/client/client/src/credit-insurance/insurance/index/index.js +++ b/client/client/src/credit-insurance/insurance/index/index.js @@ -1,19 +1,21 @@ import ngModule from '../../../module'; -import FilterList from 'core/src/lib/filter-list'; -class Controller extends FilterList { - constructor($scope, $timeout, $state, $http) { - super($scope, $timeout, $state); - this.modelName = 'creditClassificationFk'; - this.modelId = $state.params.classificationId; - this.isClosed = true; +class Controller { + constructor($stateParams, $http) { + this.$stateParams = $stateParams; this.$http = $http; + this.isClosed = true; + this.filter = { + include: [ + {relation: 'classification'} + ] + }; } $onInit() { let filter = { fields: ['finished'], - where: {id: this.modelId} + where: {id: this.$stateParams.classificationId} }; filter = encodeURIComponent(JSON.stringify(filter)); @@ -25,7 +27,7 @@ class Controller extends FilterList { } } -Controller.$inject = ['$scope', '$timeout', '$state', '$http']; +Controller.$inject = ['$stateParams', '$http']; ngModule.component('vnClientCreditInsuranceInsuranceIndex', { template: require('./index.html'), diff --git a/client/client/src/credit/index/index.html b/client/client/src/credit/index/index.html index 06e87036e..0a108ac78 100644 --- a/client/client/src/credit/index/index.html +++ b/client/client/src/credit/index/index.html @@ -1,28 +1,41 @@ - + + + Credit - - - - - - - - {{::credit.amount | number:2}} € - {{::credit.created | date:'dd/MM/yyyy HH:mm'}} - {{::credit.worker.firstName}} {{::credit.worker.name}} - - - No results - + + + + Credit + Since + Employee + + + + + {{::credit.amount | number:2}} € + {{::credit.created | date:'dd/MM/yyyy HH:mm'}} + {{::credit.worker.firstName}} {{::credit.worker.name}} + + + + No results + + + + - diff --git a/client/client/src/credit/index/index.js b/client/client/src/credit/index/index.js index ee9fc3f3c..a12dfc5fe 100644 --- a/client/client/src/credit/index/index.js +++ b/client/client/src/credit/index/index.js @@ -1,7 +1,24 @@ import ngModule from '../../module'; -import FilterClientList from '../../filter-client-list'; + +class Controller { + constructor($stateParams) { + this.$stateParams = $stateParams; + this.filter = { + include: [ + { + relation: 'worker', + scope: { + fields: ['firstName', 'name'] + } + } + ] + }; + } +} + +Controller.$inject = ['$stateParams']; ngModule.component('vnClientCreditIndex', { template: require('./index.html'), - controller: FilterClientList + controller: Controller }); diff --git a/client/client/src/greuge/index/index.html b/client/client/src/greuge/index/index.html index 7a9f7dc2e..f6c3385ea 100644 --- a/client/client/src/greuge/index/index.html +++ b/client/client/src/greuge/index/index.html @@ -1,36 +1,58 @@ - - + + + + + + Greuge - - - - - - - - - {{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }} - {{::greuge.description}} - {{::greuge.amount | number:2}} € - {{::greuge.greugeType.name}} - - - No results - - - - {{edit.model.sumAmount | number:2}} € - - + + + + Date + Comment + Amount + Type + + + + + {{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }} + {{::greuge.description}} + {{::greuge.amount | currency: ' €': 2}} + {{::greuge.greugeType.name}} + + + + No results + + + + + + + {{edit.model.sumAmount | currency: ' €': 2}} + + + + + + + - diff --git a/client/client/src/greuge/index/index.js b/client/client/src/greuge/index/index.js index 06ef11513..3dd5c9eaf 100644 --- a/client/client/src/greuge/index/index.js +++ b/client/client/src/greuge/index/index.js @@ -1,7 +1,24 @@ import ngModule from '../../module'; -import FilterClientList from '../../filter-client-list'; + +class Controller { + constructor($stateParams) { + this.$stateParams = $stateParams; + this.filter = { + include: [ + { + relation: "greugeType", + scope: { + fields: ["id", "name"] + } + } + ] + }; + } +} + +Controller.$inject = ['$stateParams']; ngModule.component('vnClientGreugeIndex', { template: require('./index.html'), - controller: FilterClientList + controller: Controller }); diff --git a/client/client/src/invoice/index.html b/client/client/src/invoice/index.html index 5930e6ce8..64e6f2d84 100644 --- a/client/client/src/invoice/index.html +++ b/client/client/src/invoice/index.html @@ -1,34 +1,42 @@ - + + + Invoices - - - - - - - - - - - {{::invoice.ref}} - {{::invoice.issued | date:'dd/MM/yyyy' }} - {{::invoice.dued | date:'dd/MM/yyyy' }} - {{::invoice.amount | currency:'€':2}} - - - No results - - - + + + + Reference + Issue date + Due date + Amount + + + + + + {{::invoice.ref}} + {{::invoice.issued | date:'dd/MM/yyyy' }} + {{::invoice.dued | date:'dd/MM/yyyy' }} + {{::invoice.amount | currency:' €': 2}} + + + + No results + + + + - \ No newline at end of file diff --git a/client/client/src/invoice/index.js b/client/client/src/invoice/index.js index 6dcfdb258..fd973ceb9 100644 --- a/client/client/src/invoice/index.js +++ b/client/client/src/invoice/index.js @@ -1,13 +1,12 @@ import ngModule from '../module'; -import FilterClientList from '../filter-client-list'; -class Controller extends FilterClientList { - constructor($scope, $timeout, $state, $stateParams) { - super($scope, $timeout, $state); - $scope.$stateParams = $stateParams; +class Controller { + constructor($stateParams) { + this.$stateParams = $stateParams; } } -Controller.$inject = ['$scope', '$timeout', '$state', '$stateParams']; + +Controller.$inject = ['$stateParams']; ngModule.component('vnClientInvoice', { template: require('./index.html'), diff --git a/client/client/src/mandate/index.html b/client/client/src/mandate/index.html index 2feadb886..34a6edf5a 100644 --- a/client/client/src/mandate/index.html +++ b/client/client/src/mandate/index.html @@ -1,30 +1,43 @@ - + + + Mandate - - - - - - - - - - {{::mandate.id}} - {{::mandate.company.code}} - {{::mandate.mandateType.name}} - {{::mandate.created | date:'dd/MM/yyyy HH:mm' }} - {{::mandate.finished | date:'dd/MM/yyyy HH:mm' || '-'}} - - - No results - + + + + Id + Company + Type + Register date + End date + + + + + {{::mandate.id}} + {{::mandate.company.code}} + {{::mandate.mandateType.name}} + {{::mandate.created | date:'dd/MM/yyyy HH:mm' }} + {{::mandate.finished | date:'dd/MM/yyyy HH:mm' || '-'}} + + + + No results + + + + - \ No newline at end of file diff --git a/client/client/src/mandate/index.js b/client/client/src/mandate/index.js index d290db569..a406fcab3 100644 --- a/client/client/src/mandate/index.js +++ b/client/client/src/mandate/index.js @@ -1,7 +1,30 @@ import ngModule from '../module'; -import FilterClientList from '../filter-client-list'; + +class Controller { + constructor($stateParams) { + this.$stateParams = $stateParams; + this.filter = { + include: [ + { + relation: "mandateType", + scope: { + fields: ["id", "name"] + } + }, + { + relation: "company", + scope: { + fields: ["id", "code"] + } + } + ] + }; + } +} + +Controller.$inject = ['$stateParams']; ngModule.component('vnClientMandate', { template: require('./index.html'), - controller: FilterClientList + controller: Controller }); diff --git a/client/client/src/note/index/index.html b/client/client/src/note/index/index.html index 9405b5bed..0e2581997 100644 --- a/client/client/src/note/index/index.html +++ b/client/client/src/note/index/index.html @@ -1,25 +1,31 @@ + + + - + Notes - {{::n.worker.firstName}} {{::n.worker.name}} - {{::n.created | date:'dd/MM/yyyy HH:mm'}} + {{::note.worker.firstName}} {{::note.worker.name}} + {{::note.created | date:'dd/MM/yyyy HH:mm'}} - {{::n.text}} + {{::note.text}} - - \ No newline at end of file + + + + diff --git a/client/client/src/note/index/index.js b/client/client/src/note/index/index.js index 12a5e3338..2415aa482 100644 --- a/client/client/src/note/index/index.js +++ b/client/client/src/note/index/index.js @@ -1,31 +1,12 @@ import ngModule from '../../module'; export default class Controller { - constructor($http, $state) { - this.$http = $http; - this.$state = $state; - } - - $onChanges() { - if (this.client) { - this.getObservation(this.client.id); - } - } - - getObservation(clientId) { - let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'created DESC'}); - this.$http.get(`/client/api/clientObservations?filter=${json}`).then( - json => { - this.observations = json.data; - } - ); - } - - newObservation() { - this.$state.go("client.card.note.create", {id: this.client.id}); + constructor($stateParams) { + this.$stateParams = $stateParams; } } -Controller.$inject = ['$http', '$state']; + +Controller.$inject = ['$stateParams']; ngModule.component('vnClientNote', { template: require('./index.html'), diff --git a/client/client/src/note/index/notes.spec.js b/client/client/src/note/index/notes.spec.js deleted file mode 100644 index 017d9aea0..000000000 --- a/client/client/src/note/index/notes.spec.js +++ /dev/null @@ -1,58 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientNote', () => { - let $componentController; - let $state; - let $httpBackend; - let controller; - - beforeEach(() => { - angular.mock.module('client'); - }); - - beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => { - $componentController = _$componentController_; - $state = _$state_; - $httpBackend = _$httpBackend_; - $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); - controller = $componentController('vnClientNote', {$state: $state}); - })); - - describe('$onChanges()', () => { - it(`should call getObservation() with the client id`, () => { - controller.client = { - id: 1234 - }; - spyOn(controller, 'getObservation').and.returnValue(); - controller.$onChanges(); - - expect(controller.getObservation).toHaveBeenCalledWith(1234); - }); - }); - - describe('$getObservation()', () => { - it(`should request to GET the client notes`, () => { - controller.client = {id: '1234'}; - let jsonString = JSON.stringify({where: {clientFk: '1234'}, order: 'created DESC'}); - let json = {data: 'some data'}; - $httpBackend.when('GET', `/client/api/clientObservations?filter=${jsonString}`).respond(json); - $httpBackend.expectGET(`/client/api/clientObservations?filter=${jsonString}`, {Accept: 'application/json, text/plain, */*'}); - controller.getObservation(); - $httpBackend.flush(); - - expect(controller.observations).toEqual(json); - }); - }); - - describe('$newObservation()', () => { - it(`should redirect the user to the newObservation view`, () => { - controller.client = {id: '1234'}; - spyOn(controller.$state, 'go'); - controller.newObservation(); - - expect(controller.$state.go).toHaveBeenCalledWith('client.card.note.create', Object({id: '1234'})); - }); - }); - }); -}); diff --git a/client/client/src/recovery/index/index.html b/client/client/src/recovery/index/index.html index cabbf4ce9..c10e16628 100644 --- a/client/client/src/recovery/index/index.html +++ b/client/client/src/recovery/index/index.html @@ -1,36 +1,53 @@ - + + + Recovery - - - - - - - - - - lock - - {{::recovery.started | date:'dd/MM/yyyy' }} - {{recovery.finished | date:'dd/MM/yyyy' }} - {{::recovery.amount | currency:'€':0}} - {{::recovery.period}} - - - No results - + + + + + Since + To + Amount + Period + + + + + + + + + {{::recovery.started | date:'dd/MM/yyyy' }} + {{recovery.finished | date:'dd/MM/yyyy' }} + {{::recovery.amount | currency:' €': 0}} + {{::recovery.period}} + + + + No results + + + + - diff --git a/client/client/src/recovery/index/index.js b/client/client/src/recovery/index/index.js index 733d67abf..a52166fc8 100644 --- a/client/client/src/recovery/index/index.js +++ b/client/client/src/recovery/index/index.js @@ -1,22 +1,23 @@ import ngModule from '../../module'; -import FilterClientList from '../../filter-client-list'; -class Controller extends FilterClientList { - constructor($scope, $timeout, $state, $http) { - super($scope, $timeout, $state); +class Controller { + constructor($stateParams, $scope, $http) { + this.$stateParams = $stateParams; + this.$scope = $scope; this.$http = $http; } + setFinished(recovery) { if (!recovery.finished) { let params = {finished: Date.now()}; this.$http.patch(`/client/api/Recoveries/${recovery.id}`, params).then( - () => this.$.index.accept() + () => this.$scope.model.refresh() ); } } } -Controller.$inject = ['$scope', '$timeout', '$state', '$http']; +Controller.$inject = ['$stateParams', '$scope', '$http']; ngModule.component('vnClientRecoveryIndex', { template: require('./index.html'), diff --git a/client/core/src/components/table/index.js b/client/core/src/components/table/index.js index 9f78a3e96..f031b174d 100644 --- a/client/core/src/components/table/index.js +++ b/client/core/src/components/table/index.js @@ -18,15 +18,17 @@ export default class Table { this.order = order; } - applyFilter(field = this.field, order = this.order) { - this.model.filter.order = `${field} ${order}`; + applyOrder(field = this.field, order = this.order) { + if (!field) return; + + this.model.order = `${field} ${order}`; this.model.refresh(); this.setActiveArrow(); } $onChanges() { if (this.model && this.model.filter) - this.applyFilter(); + this.applyOrder(); } setActiveArrow() { diff --git a/client/core/src/components/table/style.scss b/client/core/src/components/table/style.scss index 5a7be62c0..b573b0c2d 100644 --- a/client/core/src/components/table/style.scss +++ b/client/core/src/components/table/style.scss @@ -78,6 +78,7 @@ vn-table { } vn-td, vn-th { + vertical-align: middle; display: table-cell; text-align: left; padding: 10px; diff --git a/client/core/src/components/th/index.js b/client/core/src/components/th/index.js index 86a58993a..4b3716080 100644 --- a/client/core/src/components/th/index.js +++ b/client/core/src/components/th/index.js @@ -57,7 +57,7 @@ export default class Th { this.updateArrow(); - this.table.applyFilter(this.field, this.order); + this.table.applyOrder(this.field, this.order); } /** diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 247f8b71a..1d9f6ffeb 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -132,7 +132,7 @@ export default { addCreditFloatButton: `${components.vnFloatButton}`, creditInput: `${components.vnTextfield}[name="credit"]`, saveButton: `${components.vnSubmit}`, - firstCreditText: 'vn-client-credit-index .list-element' + firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr' }, clientGreuge: { greugeButton: `vn-menu-item a[ui-sref="client.card.greuge.index"]`, @@ -142,15 +142,15 @@ export default { typeInput: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] input`, typeSecondOption: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] vn-drop-down ul > li`, saveButton: `${components.vnSubmit}`, - firstGreugeText: 'vn-client-greuge-index .list-element' + firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr' }, clientMandate: { mandateButton: `vn-menu-item a[ui-sref="client.card.mandate"]`, - firstMandateText: 'vn-client-mandate .list-element' + firstMandateText: 'vn-client-mandate vn-card > div vn-table vn-tbody > vn-tr' }, clientInvoices: { invoicesButton: `vn-menu-item a[ui-sref="client.card.invoice"]`, - firstInvoiceText: 'vn-client-invoice .list-element' + firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr' }, itemsIndex: { createItemButton: `${components.vnFloatButton}`, diff --git a/services/mailer/application/template/payment-update/locale/fr.json b/services/mailer/application/template/payment-update/locale/fr.json index 7cfa4e75f..a3b76a73f 100644 --- a/services/mailer/application/template/payment-update/locale/fr.json +++ b/services/mailer/application/template/payment-update/locale/fr.json @@ -3,7 +3,7 @@ "title": "Changement des C.G.V", "dear": "Chèr client,", "bodyDescription": "Nous vous informons que les conditions de paiement ont changé. Voici les nouvelles conditions:", - "paymentMethod": "Méthod de paiement:", + "paymentMethod": "Méthode de paiement:", "paymentDay": "Date paiement:", "everyMonth": "de chaque mois", "cardPaymentAdvice": "Su modo de pago actual implica que deberá abonar el importe de los pedidos realizados en el mismo día para que se puedan enviar.",