#1306 Renombrar controladores, rutas y carpetas
This commit is contained in:
parent
5770bed5af
commit
85851e7a33
|
@ -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: {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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: {
|
|
@ -9,7 +9,7 @@
|
|||
vn-id="riskModel"
|
||||
url="/client/api/ClientRisks"
|
||||
filter="$ctrl.filter"
|
||||
data="$ctrl.riskTotal">
|
||||
data="$ctrl.clientRisks">
|
||||
</vn-crud-model>
|
||||
<vn-vertical>
|
||||
<vn-card pad-large>
|
||||
|
@ -28,9 +28,9 @@
|
|||
</vn-autocomplete>
|
||||
</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>
|
||||
<vn-auto ng-repeat="riskByCompany in $ctrl.riskTotal">
|
||||
<vn-auto ng-repeat="riskByCompany in $ctrl.clientRisks">
|
||||
<vn-label-value
|
||||
label="{{riskByCompany.company.code}}"
|
||||
value="{{riskByCompany.amount | currency: 'EUR':2}}">
|
||||
|
@ -111,8 +111,8 @@
|
|||
ng-click="$ctrl.openCreateDialog()">
|
||||
</vn-float-button>
|
||||
|
||||
<vn-client-risk-create vn-id="riskCreateDialog">
|
||||
</vn-client-risk-create>
|
||||
<vn-client-balance-create vn-id="balanceCreateDialog">
|
||||
</vn-client-balance-create>
|
||||
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
|
@ -46,7 +46,7 @@ class Controller {
|
|||
const params = {filter: this.filter};
|
||||
this.$http.get(`/client/api/ClientRisks`, {params}).then(response => {
|
||||
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,
|
||||
});
|
|
@ -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', () => {
|
|
@ -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';
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue