diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d01ae6622..751d17afc 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -157,14 +157,14 @@ export default { lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after' }, - clientRisk: { - riskButton: `vn-left-menu a[ui-sref="client.card.risk.index"]`, - companyAutocomplete: 'vn-client-risk-index vn-autocomplete[field="$ctrl.companyFk"]', + clientBalance: { + balanceButton: `vn-left-menu a[ui-sref="client.card.balance.index"]`, + companyAutocomplete: 'vn-client-balance-index vn-autocomplete[field="$ctrl.companyFk"]', newPaymentButton: `${components.vnFloatButton}`, - newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, - newPaymentAmountInput: `vn-client-risk-create vn-input-number[field="$ctrl.receipt.amountPaid"] input`, - saveButton: `vn-client-risk-create vn-button[label="Save"]`, - firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' + newPaymentBankInut: `vn-client-balance-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, + newPaymentAmountInput: `vn-client-balance-create vn-input-number[field="$ctrl.receipt.amountPaid"] input`, + saveButton: `vn-client-balance-create vn-button[label="Save"]`, + firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, webPayment: { diff --git a/e2e/paths/02-client-module/14_risk.spec.js b/e2e/paths/02-client-module/14_risk.spec.js index 58cfb5b6e..93f68d144 100644 --- a/e2e/paths/02-client-module/14_risk.spec.js +++ b/e2e/paths/02-client-module/14_risk.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Client risk path', () => { +describe('Client balance path', () => { const nightmare = createNightmare(); beforeAll(() => { @@ -19,10 +19,10 @@ describe('Client risk path', () => { expect(result).toEqual('Data saved!'); }); - it('should access to the risk section to check the data shown matches the local settings', async() => { + it('should access to the balance section to check the data shown matches the local settings', async() => { let result = await nightmare - .accessToSection('client.card.risk.index') - .waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); + .accessToSection('client.card.balance.index') + .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); expect(result).toEqual('CCs'); }); @@ -38,19 +38,19 @@ describe('Client risk path', () => { it('should click the new payment button', async() => { let url = await nightmare - .reloadSection('client.card.risk.index') - .waitToClick(selectors.clientRisk.newPaymentButton) - .waitForURL('/risk') + .reloadSection('client.card.balance.index') + .waitToClick(selectors.clientBalance.newPaymentButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should create a new payment that clears the debt', async() => { let result = await nightmare - .clearInput(selectors.clientRisk.newPaymentBankInut) - .write(selectors.clientRisk.newPaymentBankInut, '2') - .waitToClick(selectors.clientRisk.saveButton) + .clearInput(selectors.clientBalance.newPaymentBankInut) + .write(selectors.clientBalance.newPaymentBankInut, '2') + .waitToClick(selectors.clientBalance.saveButton) .waitForLastSnackbar(); expect(result).toContain('Data saved!'); @@ -58,30 +58,30 @@ describe('Client risk path', () => { it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => { let company = await nightmare - .waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); + .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); - let firstRiskLineBalance = await nightmare - .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); + let firstBalanceLine = await nightmare + .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(company).toEqual('VNL'); - expect(firstRiskLineBalance).toContain('0.00'); + expect(firstBalanceLine).toContain('0.00'); }); it('should now click the new payment button', async() => { let url = await nightmare - .waitToClick(selectors.clientRisk.newPaymentButton) - .waitForURL('/risk') + .waitToClick(selectors.clientBalance.newPaymentButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should create a new payment that sets the balance to positive value', async() => { let result = await nightmare - .clearInput(selectors.clientRisk.newPaymentAmountInput) - .write(selectors.clientRisk.newPaymentAmountInput, '100') - .waitToClick(selectors.clientRisk.saveButton) + .clearInput(selectors.clientBalance.newPaymentAmountInput) + .write(selectors.clientBalance.newPaymentAmountInput, '100') + .waitToClick(selectors.clientBalance.saveButton) .waitForLastSnackbar(); expect(result).toContain('Data saved!'); @@ -89,26 +89,26 @@ describe('Client risk path', () => { it('should check balance is now 100', async() => { let result = await nightmare - .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); + .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(result).toContain('100.00'); }); it('should again click the new payment button', async() => { let url = await nightmare - .waitToClick(selectors.clientRisk.newPaymentButton) - .waitForURL('/risk') + .waitToClick(selectors.clientBalance.newPaymentButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should create a new payment that sets the balance back to the original negative value', async() => { let result = await nightmare - .clearInput(selectors.clientRisk.newPaymentAmountInput) - .write(selectors.clientRisk.newPaymentAmountInput, '-150') + .clearInput(selectors.clientBalance.newPaymentAmountInput) + .write(selectors.clientBalance.newPaymentAmountInput, '-150') .wait(1999) - .waitToClick(selectors.clientRisk.saveButton) + .waitToClick(selectors.clientBalance.saveButton) .waitForLastSnackbar(); expect(result).toContain('Data saved!'); @@ -116,7 +116,7 @@ describe('Client risk path', () => { it('should check balance is now -50', async() => { let result = await nightmare - .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); + .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(result).toContain('€50.00'); }); @@ -143,20 +143,20 @@ describe('Client risk path', () => { expect(resultCount).toEqual(1); }); - it(`should click on the search result to access to the client's risk`, async() => { + it(`should click on the search result to access to the client's balance`, async() => { let url = await nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientRisk.riskButton) - .waitForURL('/risk') + .waitToClick(selectors.clientBalance.balanceButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should not be able to click the new payment button as it isnt present', async() => { let result = await nightmare - .exists(selectors.clientRisk.newPaymentButton); + .exists(selectors.clientBalance.newPaymentButton); expect(result).toBeFalsy(); }); diff --git a/modules/client/front/risk/create/index.html b/modules/client/front/balance/create/index.html similarity index 100% rename from modules/client/front/risk/create/index.html rename to modules/client/front/balance/create/index.html diff --git a/modules/client/front/risk/create/index.js b/modules/client/front/balance/create/index.js similarity index 97% rename from modules/client/front/risk/create/index.js rename to modules/client/front/balance/create/index.js index 11e701791..bdd62c4aa 100644 --- a/modules/client/front/risk/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -68,7 +68,7 @@ class Controller { } Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; -ngModule.component('vnClientRiskCreate', { +ngModule.component('vnClientBalanceCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/risk/create/style.scss b/modules/client/front/balance/create/style.scss similarity index 100% rename from modules/client/front/risk/create/style.scss rename to modules/client/front/balance/create/style.scss diff --git a/modules/client/front/risk/index/index.html b/modules/client/front/balance/index/index.html similarity index 93% rename from modules/client/front/risk/index/index.html rename to modules/client/front/balance/index/index.html index 4d40582dc..94bcc6a0e 100644 --- a/modules/client/front/risk/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -9,7 +9,7 @@ vn-id="riskModel" url="/client/api/ClientRisks" filter="$ctrl.filter" - data="$ctrl.riskTotal"> + data="$ctrl.clientRisks"> @@ -28,9 +28,9 @@ -
+
Total by company
- + @@ -111,8 +111,8 @@ ng-click="$ctrl.openCreateDialog()"> - - + + { if (response.data) { - this.riskTotal = response.data; + this.clientRisks = response.data; this.getBalances(); } @@ -59,7 +59,7 @@ class Controller { getCurrentBalance() { const selectedCompany = this.$.company.selection; - const currentBalance = this.riskTotal.find(balance => { + const currentBalance = this.clientRisks.find(balance => { return balance.companyFk === selectedCompany.id; }); @@ -80,11 +80,11 @@ class Controller { openCreateDialog() { - this.$.riskCreateDialog.companyFk = this.companyFk; - this.$.riskCreateDialog.onResponse = () => { + this.$.balanceCreateDialog.companyFk = this.companyFk; + this.$.balanceCreateDialog.onResponse = () => { this.refresh(); }; - this.$.riskCreateDialog.show(); + this.$.balanceCreateDialog.show(); } onDownload() { @@ -117,7 +117,7 @@ class Controller { Controller.$inject = ['$stateParams', '$translate', '$scope', 'vnToken', '$http']; -ngModule.component('vnClientRiskIndex', { +ngModule.component('vnClientBalanceIndex', { template: require('./index.html'), controller: Controller, }); diff --git a/modules/client/front/risk/index/index.spec.js b/modules/client/front/balance/index/index.spec.js similarity index 92% rename from modules/client/front/risk/index/index.spec.js rename to modules/client/front/balance/index/index.spec.js index 1db4a7a8b..8c88b5f1c 100644 --- a/modules/client/front/risk/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -1,7 +1,7 @@ import './index'; describe('Client', () => { - describe('Component vnClientRiskIndex', () => { + describe('Component vnClientBalanceIndex', () => { let $componentController; let $scope; let $httpBackend; @@ -15,7 +15,7 @@ describe('Client', () => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; $scope = $rootScope.$new(); - controller = $componentController('vnClientRiskIndex', {$scope}); + controller = $componentController('vnClientBalanceIndex', {$scope}); })); describe('balances() setter', () => { diff --git a/modules/client/front/risk/index/locale/es.yml b/modules/client/front/balance/index/locale/es.yml similarity index 100% rename from modules/client/front/risk/index/locale/es.yml rename to modules/client/front/balance/index/locale/es.yml diff --git a/modules/client/front/risk/index/style.scss b/modules/client/front/balance/index/style.scss similarity index 100% rename from modules/client/front/risk/index/style.scss rename to modules/client/front/balance/index/style.scss diff --git a/modules/client/front/index.js b/modules/client/front/index.js index b4166676b..d6a910c86 100644 --- a/modules/client/front/index.js +++ b/modules/client/front/index.js @@ -19,8 +19,8 @@ import './credit/index'; import './credit/create'; import './greuge/index'; import './greuge/create'; -import './risk/index'; -import './risk/create'; +import './balance/index'; +import './balance/create'; import './mandate'; import './summary'; import './recovery/index'; diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 58f075d11..a927d0aa7 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -12,7 +12,7 @@ {"state": "client.card.note.index", "icon": "insert_drive_file"}, {"state": "client.card.credit.index", "icon": "credit_card"}, {"state": "client.card.greuge.index", "icon": "work"}, - {"state": "client.card.risk.index", "icon": "icon-invoices"}, + {"state": "client.card.balance.index", "icon": "icon-invoices"}, {"state": "client.card.recovery.index", "icon": "icon-recovery"}, {"state": "client.card.log", "icon": "history"}, { @@ -188,22 +188,22 @@ "component": "vn-client-mandate", "description": "Mandates" }, { - "url": "/risk", + "url": "/balance", "abstract": true, - "state": "client.card.risk", + "state": "client.card.balance", "component": "ui-view" }, { "url": "/index", - "state": "client.card.risk.index", - "component": "vn-client-risk-index", + "state": "client.card.balance.index", + "component": "vn-client-balance-index", "description": "Balance", "params": { "client": "$ctrl.client" } }, { "url": "/create?payed&companyFk&bankFk&payedAmount", - "state": "client.card.risk.create", - "component": "vn-client-risk-create", + "state": "client.card.balance.create", + "component": "vn-client-balance-create", "description": "New payment", "params": { "client": "$ctrl.client"