disable bic field for spanish iban
This commit is contained in:
parent
4e1d7e2822
commit
8e65d437ee
|
@ -43,7 +43,8 @@
|
||||||
search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}"
|
search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
show-field="bic"
|
show-field="bic"
|
||||||
vn-acl="salesAssistant">
|
vn-acl="salesAssistant"
|
||||||
|
disabled="$ctrl.ibanCountry == 'ES'">
|
||||||
<tpl-item>
|
<tpl-item>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-one>{{bic}}</vn-one>
|
<vn-one>{{bic}}</vn-one>
|
||||||
|
|
|
@ -76,14 +76,21 @@ export default class Controller {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get ibanCountry() {
|
||||||
|
if (!this.client || !this.client.iban) return false;
|
||||||
|
|
||||||
|
let countryCode = this.client.iban.substr(0, 2);
|
||||||
|
|
||||||
|
return countryCode;
|
||||||
|
}
|
||||||
|
|
||||||
autofillBic() {
|
autofillBic() {
|
||||||
if (!this.client.iban) return;
|
if (!this.client.iban) return;
|
||||||
|
|
||||||
let countryCode = this.client.iban.substr(0, 2);
|
|
||||||
let bankEntityId = parseInt(this.client.iban.substr(4, 4));
|
let bankEntityId = parseInt(this.client.iban.substr(4, 4));
|
||||||
let filter = {where: {id: bankEntityId}};
|
let filter = {where: {id: bankEntityId}};
|
||||||
|
|
||||||
if (countryCode != 'ES') return;
|
if (this.ibanCountry != 'ES') return;
|
||||||
|
|
||||||
let json = encodeURIComponent(JSON.stringify(filter));
|
let json = encodeURIComponent(JSON.stringify(filter));
|
||||||
this.$http.get(`/client/api/BankEntities?filter=${json}`).then(response => {
|
this.$http.get(`/client/api/BankEntities?filter=${json}`).then(response => {
|
||||||
|
|
|
@ -136,5 +136,14 @@ describe('Client', () => {
|
||||||
expect(controller.client.bankEntityFk).toEqual(128);
|
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');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="check"
|
icon="check"
|
||||||
vn-acl="administrative"
|
vn-acl="administrative"
|
||||||
|
vn-acl-action="remove"
|
||||||
vn-tooltip="Confirm transaction"
|
vn-tooltip="Confirm transaction"
|
||||||
ng-show="::!transaction.isConfirmed"
|
ng-show="::!transaction.isConfirmed"
|
||||||
ng-click="$ctrl.confirm(transaction)">
|
ng-click="$ctrl.confirm(transaction)">
|
||||||
|
|
Loading…
Reference in New Issue