Summary boss shown on descriptor

This commit is contained in:
jorgebl 2021-02-24 16:12:44 +01:00
parent 06dcb4b28c
commit 1f1db53d41
3 changed files with 26 additions and 15 deletions

View File

@ -42,6 +42,11 @@
"model": "Account", "model": "Account",
"foreignKey": "userFk" "foreignKey": "userFk"
}, },
"boss": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "bossFk"
},
"client": { "client": {
"type": "belongsTo", "type": "belongsTo",
"model": "Client", "model": "Client",
@ -61,11 +66,6 @@
"type": "hasMany", "type": "hasMany",
"model": "WorkerTeamCollegues", "model": "WorkerTeamCollegues",
"foreignKey": "workerFk" "foreignKey": "workerFk"
},
"boss": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "bossFk"
} }
} }
} }

View File

@ -31,8 +31,12 @@
value="{{worker.department.department.name}}"> value="{{worker.department.department.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Boss" label="Boss">
value="{{worker.boss.firstName}}"> <span
ng-click="workerDescriptor.show($event, worker.boss.id)"
class="link">
{{::worker.boss.nickname}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Phone" <vn-label-value label="Phone"
value="{{worker.phone}}"> value="{{worker.phone}}">
@ -54,4 +58,7 @@
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -11,8 +11,8 @@ class Controller extends Summary {
this.$.worker = null; this.$.worker = null;
if (!value) return; if (!value) return;
let query = `Workers/${value.id}`; const query = `Workers/${value.id}`;
let filter = { const filter = {
include: [ include: [
{ {
relation: 'user', relation: 'user',
@ -31,16 +31,20 @@ class Controller extends Summary {
} }
}] }]
} }
}, { },
{
relation: 'client', relation: 'client',
scope: {fields: ['fi']} scope: {fields: ['fi']}
}, { },
{
relation: 'boss', relation: 'boss',
scope: {fields: ['id', 'firstName']} scope: {fields: ['id', 'nickname']}
}, { },
{
relation: 'sip', relation: 'sip',
scope: {fields: ['extension']} scope: {fields: ['extension']}
}, { },
{
relation: 'department', relation: 'department',
scope: { scope: {
include: { include: {