#1121 worker.descriptor

This commit is contained in:
Gerard 2019-02-18 12:54:33 +01:00
parent cb78a6da65
commit 3adc035cab
6 changed files with 42 additions and 9 deletions

View File

@ -8,23 +8,37 @@ export default class Controller {
this.hasInfo = Boolean($attrs.info);
this.info = $attrs.info || null;
}
set label(value) {
let label = this.element.querySelector('vn-label');
label.textContent = this._.instant(value);
this._label = value;
}
get label() {
return this._label;
}
set value(value) {
let span = this.element.querySelector('span');
span.title = value;
span.textContent = value ? value : '-';
this._value = value;
}
get value() {
return this._value;
}
get title() {
return this._title;
}
set title(value) {
let span = this.element.querySelector('span');
span.title = value;
this._title = value;
}
}
Controller.$inject = ['$element', '$translate', '$attrs'];
@ -32,6 +46,7 @@ ngModule.component('vnLabelValue', {
controller: Controller,
template: require('./label-value.html'),
bindings: {
title: '@?',
label: '@',
value: '@'
}

View File

@ -25,6 +25,13 @@ class Controller {
}, {
relation: 'sip',
scope: {fields: ['extension']}
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
}
]
};

View File

@ -10,12 +10,15 @@
</vn-horizontal>
<div class="body">
<div class="attributes">
<h5>{{$ctrl.worker.firstName}} {{$ctrl.worker.name}}</h5>
<h5 title="{{$ctrl.worker.firstName}} {{$ctrl.worker.name}}">
{{$ctrl.worker.firstName}} {{$ctrl.worker.name}}
</h5>
<vn-label-value label="Id"
value="{{$ctrl.worker.id}}">
</vn-label-value>
<vn-label-value label="User"
value="{{$ctrl.worker.user.name}}">
value="{{$ctrl.worker.user.name}}"
title="{{$ctrl.worker.firstName}} {{$ctrl.worker.name}}">
</vn-label-value>
<vn-label-value label="Email"
value="{{$ctrl.worker.user.email}}">
@ -24,13 +27,13 @@
value="{{$ctrl.worker.client.fi}}">
</vn-label-value>
<vn-label-value label="Department"
value="{{$ctrl.worker.department.department}}">
value="{{$ctrl.worker.department.department.name}}">
</vn-label-value>
<vn-label-value label="Phone"
value="{{$ctrl.worker.phone}}">
</vn-label-value>
<vn-label-value label="Extension"
value="{{$ctrl.worker.sip.phone}}">
value="{{$ctrl.worker.sip.extension}}">
</vn-label-value>
</div>
<div class="quicklinks">

View File

@ -1,8 +1,8 @@
Workers: Trabajadores
Last name: Apellidos
User data: Datos de usuario
Fiscal identifier: Identificador fiscal
Email: Correo electrónico
Fiscal identifier: NIF
Email: E-mail
Department: Departamento
User id: Id de usuario
Role: Rol

View File

@ -13,7 +13,7 @@
value="{{worker.user.email}}">
</vn-label-value>
<vn-label-value label="Department"
value="{{worker.department.department}}">
value="{{worker.department.department.name}}">
</vn-label-value>
<vn-label-value label="Phone"
value="{{worker.phone}}">
@ -25,13 +25,14 @@
value="{{worker.userFk}}">
</vn-label-value>
<vn-label-value label="User"
value="{{worker.user.name}}">
value="{{worker.user.name}}"
title="{{worker.firstName}} {{worker.name}}">
</vn-label-value>
<vn-label-value label="Role"
value="{{worker.user.role.name}}">
</vn-label-value>
<vn-label-value label="Extension"
value="{{worker.sip.phone}}">
value="{{worker.sip.extension}}">
</vn-label-value>
</vn-one>
</vn-horizontal>

View File

@ -35,6 +35,13 @@ class Controller {
}, {
relation: 'sip',
scope: {fields: ['extension']}
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
}
]
};