optional bank entity code #1416
gitea/salix/dev There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2019-06-17 08:14:48 +02:00
parent 5203c33483
commit 471da18a6c
10 changed files with 35 additions and 11 deletions

View File

@ -14,7 +14,10 @@
translate-attr="{title: 'Clear'}"> translate-attr="{title: 'Clear'}">
</vn-icon> </vn-icon>
</div> </div>
<label class="mdl-textfield__label" translate>{{::$ctrl.label}}</label> <label class="mdl-textfield__label">
<span translate>{{::$ctrl.label}}</span>
<span translate ng-show="::$ctrl.required">(*)</span>
</label>
</div> </div>
</div> </div>
<vn-drop-down <vn-drop-down

View File

@ -294,6 +294,7 @@ ngModule.component('vnAutocomplete', {
label: '@', label: '@',
field: '=?', field: '=?',
disabled: '<?', disabled: '<?',
required: '@?',
showField: '@?', showField: '@?',
valueField: '@?', valueField: '@?',
initialData: '<?', initialData: '<?',

View File

@ -37,6 +37,10 @@ vn-autocomplete {
display: block; display: block;
} }
} }
label span:nth-child(2) {
color: $color-alert
}
} }
ul.vn-autocomplete { ul.vn-autocomplete {

View File

@ -149,6 +149,10 @@ vn-textfield {
.infix.invalid + .underline { .infix.invalid + .underline {
background-color: #d50000; background-color: #d50000;
} }
label span:nth-child(2) {
color: $color-alert
}
} }
vn-table { vn-table {

View File

@ -14,7 +14,10 @@
ng-focus="$ctrl.hasFocus = true" ng-focus="$ctrl.hasFocus = true"
ng-blur="$ctrl.hasFocus = false" ng-blur="$ctrl.hasFocus = false"
tabindex="{{$ctrl.input.tabindex}}"/> tabindex="{{$ctrl.input.tabindex}}"/>
<label class="label" translate>{{::$ctrl.label}}</label> <label class="label">
<span translate>{{::$ctrl.label}}</span>
<span translate ng-show="::$ctrl.required">(*)</span>
</label>
</div> </div>
<div class="underline"></div> <div class="underline"></div>
<div class="selected underline"></div> <div class="selected underline"></div>

View File

@ -84,6 +84,7 @@ ngModule.component('vnTextfield', {
label: '@?', label: '@?',
name: '@?', name: '@?',
disabled: '<?', disabled: '<?',
required: '@?',
readonly: '<?', readonly: '<?',
rule: '@?', rule: '@?',
type: '@?', type: '@?',

View File

@ -0,0 +1,5 @@
module.exports = Self => {
Self.validatesPresenceOf('name', {
message: 'Name cannot be blank'
});
};

View File

@ -98,28 +98,33 @@
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one <vn-textfield vn-one
label="Name" label="Name"
model="$ctrl.newBankEntity.name"> model="$ctrl.newBankEntity.name"
required="true">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-id="country" vn-one
label="Country" label="Country"
field="$ctrl.newBankEntity.countryFk" field="$ctrl.newBankEntity.countryFk"
fields="['id', 'country', 'code']"
url="/client/api/Countries" url="/client/api/Countries"
value-field="id" value-field="id"
show-field="country"> show-field="country"
required="true">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one <vn-textfield vn-one
label="Code" label="Entity Code"
model="$ctrl.newBankEntity.id"> model="$ctrl.newBankEntity.id"
ng-show="country.selection.code === 'ES'">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one <vn-textfield vn-one
label="Swift / BIC" label="Swift / BIC"
model="$ctrl.newBankEntity.bic"> model="$ctrl.newBankEntity.bic"
required="true">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
</tpl-body> </tpl-body>

View File

@ -59,8 +59,6 @@ export default class Controller {
try { try {
if (!this.newBankEntity.name) if (!this.newBankEntity.name)
throw new Error(`Name can't be empty`); throw new Error(`Name can't be empty`);
if (!this.newBankEntity.id)
throw new Error(`Code can't be empty`);
if (!this.newBankEntity.bic) if (!this.newBankEntity.bic)
throw new Error(`Swift / BIC can't be empty`); throw new Error(`Swift / BIC can't be empty`);

View File

@ -16,4 +16,4 @@ Save: Guardar
New bank entity: Nueva entidad bancaria New bank entity: Nueva entidad bancaria
Name can't be empty: El nombre no puede quedar vacío Name can't be empty: El nombre no puede quedar vacío
Swift / BIC can't be empty: El Swift / BIC no puede quedar vacío Swift / BIC can't be empty: El Swift / BIC no puede quedar vacío
Code: Código Entity Code: Código