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

View File

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

View File

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

View File

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

View File

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

View File

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