reviso test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2021-04-01 17:36:27 +02:00
parent 67f822ebdc
commit eec901684a
5 changed files with 32 additions and 13 deletions

View File

@ -0,0 +1,22 @@
const validateIban = require('vn-loopback/util/validateIban');
module.exports = Self => {
Self.validateAsync('iban', ibanNeedsValidation, {
message: 'The IBAN does not have the correct format'
});
async function ibanNeedsValidation(err, done) {
let filter = {
fields: ['code'],
where: {id: this.countryFk}
};
let country = await Self.app.models.Country.findOne(filter);
let code = country ? country.code.toLowerCase() : null;
if (code != 'es')
return done();
if (!validateIban(this.iban))
err();
done();
}
};

View File

@ -16,24 +16,18 @@
"id": true,
"description": "Identifier"
},
"supplierFk": {
"type": "Number"
},
"iban": {
"type": "String"
},
"beneficiary": {
"type": "String"
},
"bankEntityFk": {
"type": "Number"
}
},
"relations": {
"supplier": {
"type": "belongsTo",
"model": "Supplier",
"foreignKey": "supplierFk"
"foreignKey": "supplierFk"
},
"bankEntity": {
"type": "belongsTo",

View File

@ -1,7 +1,7 @@
<vn-crud-model
vn-id="model"
url="SupplierAccounts"
fields="['id', 'supplierFk', 'iban', 'bankEntityFk']"
fields="['id', 'supplierFk', 'iban', 'bankEntityFk', 'beneficiary']"
link="{supplierFk: $ctrl.$params.id}"
include="$ctrl.include"
data="$ctrl.supplierAccounts"
@ -12,7 +12,7 @@
data="$ctrl.supplierAccounts"
form="form">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-lg">
<vn-card class="vn-pa-lg">
<vn-horizontal ng-repeat="supplierAccount in $ctrl.supplierAccounts">
<vn-textfield vn-three
@ -21,7 +21,7 @@
ng-model="supplierAccount.iban"
rule>
</vn-textfield>
<vn-autocomplete vn-two
<vn-autocomplete vn-three
label="Bank entity"
ng-model="supplierAccount.bankEntityFk"
url="BankEntities"
@ -35,9 +35,10 @@
ng-click="$ctrl.showBankEntity($event, $index)">
</vn-icon-button>
</append>
<vn-textfield
<vn-textfield vn-three
label="Beneficiary"
ng-model="supplierAccount.beneficiary">
ng-model="supplierAccount.beneficiary"
info="Beneficiary information">
</vn-textfield>
<vn-none>
<vn-icon-button

View File

@ -0,0 +1 @@
Beneficiary information: Name of the bank account holder if different from the provider

View File

@ -2,3 +2,4 @@ Bank entity: Entidad bancaria
swift: Swift BIC
Add account: Añadir cuenta
Beneficiary: Beneficiario
Beneficiary information: Nombre del titular de la cuenta bancaria en caso de ser diferente del proveedor