Merge branch 'test' into dev

This commit is contained in:
Joan 2018-11-23 08:46:00 +01:00
commit afdb75f203
4 changed files with 21 additions and 3 deletions

View File

@ -43,7 +43,8 @@
search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}"
value-field="id"
show-field="bic"
vn-acl="salesAssistant">
vn-acl="salesAssistant"
disabled="$ctrl.ibanCountry == 'ES'">
<tpl-item>
<vn-horizontal>
<vn-one>{{bic}}</vn-one>

View File

@ -76,14 +76,21 @@ export default class Controller {
return true;
}
get ibanCountry() {
if (!this.client || !this.client.iban) return false;
let countryCode = this.client.iban.substr(0, 2);
return countryCode;
}
autofillBic() {
if (!this.client.iban) return;
let countryCode = this.client.iban.substr(0, 2);
let bankEntityId = parseInt(this.client.iban.substr(4, 4));
let filter = {where: {id: bankEntityId}};
if (countryCode != 'ES') return;
if (this.ibanCountry != 'ES') return;
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`/client/api/BankEntities?filter=${json}`).then(response => {

View File

@ -136,5 +136,14 @@ describe('Client', () => {
expect(controller.client.bankEntityFk).toEqual(128);
});
});
describe('ibanCountry()', () => {
it('should return a country code from iban', () => {
controller.client.iban = 'ES123';
let countryCode = controller.ibanCountry;
expect(countryCode).toEqual('ES');
});
});
});
});

View File

@ -26,6 +26,7 @@
<vn-icon-button
icon="check"
vn-acl="administrative"
vn-acl-action="remove"
vn-tooltip="Confirm transaction"
ng-show="::!transaction.isConfirmed"
ng-click="$ctrl.confirm(transaction)">