#1306 Renombrar controladores, rutas y carpetas

This commit is contained in:
Carlos Jimenez Ruiz 2019-04-16 13:40:26 +02:00
parent 5770bed5af
commit 85851e7a33
12 changed files with 64 additions and 64 deletions

View File

@ -157,14 +157,14 @@ export default {
lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after' lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after'
}, },
clientRisk: { clientBalance: {
riskButton: `vn-left-menu a[ui-sref="client.card.risk.index"]`, balanceButton: `vn-left-menu a[ui-sref="client.card.balance.index"]`,
companyAutocomplete: 'vn-client-risk-index vn-autocomplete[field="$ctrl.companyFk"]', companyAutocomplete: 'vn-client-balance-index vn-autocomplete[field="$ctrl.companyFk"]',
newPaymentButton: `${components.vnFloatButton}`, newPaymentButton: `${components.vnFloatButton}`,
newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, newPaymentBankInut: `vn-client-balance-create vn-textfield[field="$ctrl.receipt.bankFk"] input`,
newPaymentAmountInput: `vn-client-risk-create vn-input-number[field="$ctrl.receipt.amountPaid"] input`, newPaymentAmountInput: `vn-client-balance-create vn-input-number[field="$ctrl.receipt.amountPaid"] input`,
saveButton: `vn-client-risk-create vn-button[label="Save"]`, saveButton: `vn-client-balance-create vn-button[label="Save"]`,
firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
}, },
webPayment: { webPayment: {

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare'; import createNightmare from '../../helpers/nightmare';
describe('Client risk path', () => { describe('Client balance path', () => {
const nightmare = createNightmare(); const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
@ -19,10 +19,10 @@ describe('Client risk path', () => {
expect(result).toEqual('Data saved!'); 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 let result = await nightmare
.accessToSection('client.card.risk.index') .accessToSection('client.card.balance.index')
.waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
expect(result).toEqual('CCs'); expect(result).toEqual('CCs');
}); });
@ -38,19 +38,19 @@ describe('Client risk path', () => {
it('should click the new payment button', async() => { it('should click the new payment button', async() => {
let url = await nightmare let url = await nightmare
.reloadSection('client.card.risk.index') .reloadSection('client.card.balance.index')
.waitToClick(selectors.clientRisk.newPaymentButton) .waitToClick(selectors.clientBalance.newPaymentButton)
.waitForURL('/risk') .waitForURL('/balance')
.parsedUrl(); .parsedUrl();
expect(url.hash).toContain('/risk'); expect(url.hash).toContain('/balance');
}); });
it('should create a new payment that clears the debt', async() => { it('should create a new payment that clears the debt', async() => {
let result = await nightmare let result = await nightmare
.clearInput(selectors.clientRisk.newPaymentBankInut) .clearInput(selectors.clientBalance.newPaymentBankInut)
.write(selectors.clientRisk.newPaymentBankInut, '2') .write(selectors.clientBalance.newPaymentBankInut, '2')
.waitToClick(selectors.clientRisk.saveButton) .waitToClick(selectors.clientBalance.saveButton)
.waitForLastSnackbar(); .waitForLastSnackbar();
expect(result).toContain('Data saved!'); 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() => { 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 let company = await nightmare
.waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
let firstRiskLineBalance = await nightmare let firstBalanceLine = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
expect(company).toEqual('VNL'); expect(company).toEqual('VNL');
expect(firstRiskLineBalance).toContain('0.00'); expect(firstBalanceLine).toContain('0.00');
}); });
it('should now click the new payment button', async() => { it('should now click the new payment button', async() => {
let url = await nightmare let url = await nightmare
.waitToClick(selectors.clientRisk.newPaymentButton) .waitToClick(selectors.clientBalance.newPaymentButton)
.waitForURL('/risk') .waitForURL('/balance')
.parsedUrl(); .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() => { it('should create a new payment that sets the balance to positive value', async() => {
let result = await nightmare let result = await nightmare
.clearInput(selectors.clientRisk.newPaymentAmountInput) .clearInput(selectors.clientBalance.newPaymentAmountInput)
.write(selectors.clientRisk.newPaymentAmountInput, '100') .write(selectors.clientBalance.newPaymentAmountInput, '100')
.waitToClick(selectors.clientRisk.saveButton) .waitToClick(selectors.clientBalance.saveButton)
.waitForLastSnackbar(); .waitForLastSnackbar();
expect(result).toContain('Data saved!'); expect(result).toContain('Data saved!');
@ -89,26 +89,26 @@ describe('Client risk path', () => {
it('should check balance is now 100', async() => { it('should check balance is now 100', async() => {
let result = await nightmare let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
expect(result).toContain('100.00'); expect(result).toContain('100.00');
}); });
it('should again click the new payment button', async() => { it('should again click the new payment button', async() => {
let url = await nightmare let url = await nightmare
.waitToClick(selectors.clientRisk.newPaymentButton) .waitToClick(selectors.clientBalance.newPaymentButton)
.waitForURL('/risk') .waitForURL('/balance')
.parsedUrl(); .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() => { it('should create a new payment that sets the balance back to the original negative value', async() => {
let result = await nightmare let result = await nightmare
.clearInput(selectors.clientRisk.newPaymentAmountInput) .clearInput(selectors.clientBalance.newPaymentAmountInput)
.write(selectors.clientRisk.newPaymentAmountInput, '-150') .write(selectors.clientBalance.newPaymentAmountInput, '-150')
.wait(1999) .wait(1999)
.waitToClick(selectors.clientRisk.saveButton) .waitToClick(selectors.clientBalance.saveButton)
.waitForLastSnackbar(); .waitForLastSnackbar();
expect(result).toContain('Data saved!'); expect(result).toContain('Data saved!');
@ -116,7 +116,7 @@ describe('Client risk path', () => {
it('should check balance is now -50', async() => { it('should check balance is now -50', async() => {
let result = await nightmare let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
expect(result).toContain('€50.00'); expect(result).toContain('€50.00');
}); });
@ -143,20 +143,20 @@ describe('Client risk path', () => {
expect(resultCount).toEqual(1); 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 let url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientRisk.riskButton) .waitToClick(selectors.clientBalance.balanceButton)
.waitForURL('/risk') .waitForURL('/balance')
.parsedUrl(); .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() => { it('should not be able to click the new payment button as it isnt present', async() => {
let result = await nightmare let result = await nightmare
.exists(selectors.clientRisk.newPaymentButton); .exists(selectors.clientBalance.newPaymentButton);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });

View File

@ -68,7 +68,7 @@ class Controller {
} }
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
ngModule.component('vnClientRiskCreate', { ngModule.component('vnClientBalanceCreate', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
bindings: { bindings: {

View File

@ -9,7 +9,7 @@
vn-id="riskModel" vn-id="riskModel"
url="/client/api/ClientRisks" url="/client/api/ClientRisks"
filter="$ctrl.filter" filter="$ctrl.filter"
data="$ctrl.riskTotal"> data="$ctrl.clientRisks">
</vn-crud-model> </vn-crud-model>
<vn-vertical> <vn-vertical>
<vn-card pad-large> <vn-card pad-large>
@ -28,9 +28,9 @@
</vn-autocomplete> </vn-autocomplete>
</vn-one> </vn-one>
<vn-one> <vn-one>
<div class="totalBox" ng-if="$ctrl.riskTotal.length"> <div class="totalBox" ng-if="$ctrl.clientRisks.length">
<h6 translate>Total by company</h6> <h6 translate>Total by company</h6>
<vn-auto ng-repeat="riskByCompany in $ctrl.riskTotal"> <vn-auto ng-repeat="riskByCompany in $ctrl.clientRisks">
<vn-label-value <vn-label-value
label="{{riskByCompany.company.code}}" label="{{riskByCompany.company.code}}"
value="{{riskByCompany.amount | currency: 'EUR':2}}"> value="{{riskByCompany.amount | currency: 'EUR':2}}">
@ -111,8 +111,8 @@
ng-click="$ctrl.openCreateDialog()"> ng-click="$ctrl.openCreateDialog()">
</vn-float-button> </vn-float-button>
<vn-client-risk-create vn-id="riskCreateDialog"> <vn-client-balance-create vn-id="balanceCreateDialog">
</vn-client-risk-create> </vn-client-balance-create>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor" vn-id="workerDescriptor"

View File

@ -46,7 +46,7 @@ class Controller {
const params = {filter: this.filter}; const params = {filter: this.filter};
this.$http.get(`/client/api/ClientRisks`, {params}).then(response => { this.$http.get(`/client/api/ClientRisks`, {params}).then(response => {
if (response.data) { if (response.data) {
this.riskTotal = response.data; this.clientRisks = response.data;
this.getBalances(); this.getBalances();
} }
@ -59,7 +59,7 @@ class Controller {
getCurrentBalance() { getCurrentBalance() {
const selectedCompany = this.$.company.selection; const selectedCompany = this.$.company.selection;
const currentBalance = this.riskTotal.find(balance => { const currentBalance = this.clientRisks.find(balance => {
return balance.companyFk === selectedCompany.id; return balance.companyFk === selectedCompany.id;
}); });
@ -80,11 +80,11 @@ class Controller {
openCreateDialog() { openCreateDialog() {
this.$.riskCreateDialog.companyFk = this.companyFk; this.$.balanceCreateDialog.companyFk = this.companyFk;
this.$.riskCreateDialog.onResponse = () => { this.$.balanceCreateDialog.onResponse = () => {
this.refresh(); this.refresh();
}; };
this.$.riskCreateDialog.show(); this.$.balanceCreateDialog.show();
} }
onDownload() { onDownload() {
@ -117,7 +117,7 @@ class Controller {
Controller.$inject = ['$stateParams', '$translate', '$scope', 'vnToken', '$http']; Controller.$inject = ['$stateParams', '$translate', '$scope', 'vnToken', '$http'];
ngModule.component('vnClientRiskIndex', { ngModule.component('vnClientBalanceIndex', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
}); });

View File

@ -1,7 +1,7 @@
import './index'; import './index';
describe('Client', () => { describe('Client', () => {
describe('Component vnClientRiskIndex', () => { describe('Component vnClientBalanceIndex', () => {
let $componentController; let $componentController;
let $scope; let $scope;
let $httpBackend; let $httpBackend;
@ -15,7 +15,7 @@ describe('Client', () => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_; $httpParamSerializer = _$httpParamSerializer_;
$scope = $rootScope.$new(); $scope = $rootScope.$new();
controller = $componentController('vnClientRiskIndex', {$scope}); controller = $componentController('vnClientBalanceIndex', {$scope});
})); }));
describe('balances() setter', () => { describe('balances() setter', () => {

View File

@ -19,8 +19,8 @@ import './credit/index';
import './credit/create'; import './credit/create';
import './greuge/index'; import './greuge/index';
import './greuge/create'; import './greuge/create';
import './risk/index'; import './balance/index';
import './risk/create'; import './balance/create';
import './mandate'; import './mandate';
import './summary'; import './summary';
import './recovery/index'; import './recovery/index';

View File

@ -12,7 +12,7 @@
{"state": "client.card.note.index", "icon": "insert_drive_file"}, {"state": "client.card.note.index", "icon": "insert_drive_file"},
{"state": "client.card.credit.index", "icon": "credit_card"}, {"state": "client.card.credit.index", "icon": "credit_card"},
{"state": "client.card.greuge.index", "icon": "work"}, {"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.recovery.index", "icon": "icon-recovery"},
{"state": "client.card.log", "icon": "history"}, {"state": "client.card.log", "icon": "history"},
{ {
@ -188,22 +188,22 @@
"component": "vn-client-mandate", "component": "vn-client-mandate",
"description": "Mandates" "description": "Mandates"
}, { }, {
"url": "/risk", "url": "/balance",
"abstract": true, "abstract": true,
"state": "client.card.risk", "state": "client.card.balance",
"component": "ui-view" "component": "ui-view"
}, { }, {
"url": "/index", "url": "/index",
"state": "client.card.risk.index", "state": "client.card.balance.index",
"component": "vn-client-risk-index", "component": "vn-client-balance-index",
"description": "Balance", "description": "Balance",
"params": { "params": {
"client": "$ctrl.client" "client": "$ctrl.client"
} }
}, { }, {
"url": "/create?payed&companyFk&bankFk&payedAmount", "url": "/create?payed&companyFk&bankFk&payedAmount",
"state": "client.card.risk.create", "state": "client.card.balance.create",
"component": "vn-client-risk-create", "component": "vn-client-balance-create",
"description": "New payment", "description": "New payment",
"params": { "params": {
"client": "$ctrl.client" "client": "$ctrl.client"