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, "id": true,
"description": "Identifier" "description": "Identifier"
}, },
"supplierFk": {
"type": "Number"
},
"iban": { "iban": {
"type": "String" "type": "String"
}, },
"beneficiary": { "beneficiary": {
"type": "String" "type": "String"
},
"bankEntityFk": {
"type": "Number"
} }
}, },
"relations": { "relations": {
"supplier": { "supplier": {
"type": "belongsTo", "type": "belongsTo",
"model": "Supplier", "model": "Supplier",
"foreignKey": "supplierFk" "foreignKey": "supplierFk"
}, },
"bankEntity": { "bankEntity": {
"type": "belongsTo", "type": "belongsTo",

View File

@ -1,7 +1,7 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="SupplierAccounts" url="SupplierAccounts"
fields="['id', 'supplierFk', 'iban', 'bankEntityFk']" fields="['id', 'supplierFk', 'iban', 'bankEntityFk', 'beneficiary']"
link="{supplierFk: $ctrl.$params.id}" link="{supplierFk: $ctrl.$params.id}"
include="$ctrl.include" include="$ctrl.include"
data="$ctrl.supplierAccounts" data="$ctrl.supplierAccounts"
@ -12,7 +12,7 @@
data="$ctrl.supplierAccounts" data="$ctrl.supplierAccounts"
form="form"> form="form">
</vn-watcher> </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-card class="vn-pa-lg">
<vn-horizontal ng-repeat="supplierAccount in $ctrl.supplierAccounts"> <vn-horizontal ng-repeat="supplierAccount in $ctrl.supplierAccounts">
<vn-textfield vn-three <vn-textfield vn-three
@ -21,7 +21,7 @@
ng-model="supplierAccount.iban" ng-model="supplierAccount.iban"
rule> rule>
</vn-textfield> </vn-textfield>
<vn-autocomplete vn-two <vn-autocomplete vn-three
label="Bank entity" label="Bank entity"
ng-model="supplierAccount.bankEntityFk" ng-model="supplierAccount.bankEntityFk"
url="BankEntities" url="BankEntities"
@ -35,9 +35,10 @@
ng-click="$ctrl.showBankEntity($event, $index)"> ng-click="$ctrl.showBankEntity($event, $index)">
</vn-icon-button> </vn-icon-button>
</append> </append>
<vn-textfield <vn-textfield vn-three
label="Beneficiary" label="Beneficiary"
ng-model="supplierAccount.beneficiary"> ng-model="supplierAccount.beneficiary"
info="Beneficiary information">
</vn-textfield> </vn-textfield>
<vn-none> <vn-none>
<vn-icon-button <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 swift: Swift BIC
Add account: Añadir cuenta Add account: Añadir cuenta
Beneficiary: Beneficiario Beneficiary: Beneficiario
Beneficiary information: Nombre del titular de la cuenta bancaria en caso de ser diferente del proveedor