diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 906f9baef..cad38ac3b 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -42,6 +42,11 @@ "model": "Account", "foreignKey": "userFk" }, + "boss": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "bossFk" + }, "client": { "type": "belongsTo", "model": "Client", @@ -61,11 +66,6 @@ "type": "hasMany", "model": "WorkerTeamCollegues", "foreignKey": "workerFk" - }, - "boss": { - "type": "belongsTo", - "model": "Worker", - "foreignKey": "bossFk" } } } \ No newline at end of file diff --git a/modules/worker/front/summary/index.html b/modules/worker/front/summary/index.html index cc7a0b03c..d2a7e750b 100644 --- a/modules/worker/front/summary/index.html +++ b/modules/worker/front/summary/index.html @@ -31,8 +31,12 @@ value="{{worker.department.department.name}}"> + label="Boss"> + + {{::worker.boss.nickname}} + @@ -54,4 +58,7 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/modules/worker/front/summary/index.js b/modules/worker/front/summary/index.js index 631b307a2..3cdb2c36f 100644 --- a/modules/worker/front/summary/index.js +++ b/modules/worker/front/summary/index.js @@ -11,8 +11,8 @@ class Controller extends Summary { this.$.worker = null; if (!value) return; - let query = `Workers/${value.id}`; - let filter = { + const query = `Workers/${value.id}`; + const filter = { include: [ { relation: 'user', @@ -31,16 +31,20 @@ class Controller extends Summary { } }] } - }, { + }, + { relation: 'client', scope: {fields: ['fi']} - }, { + }, + { relation: 'boss', - scope: {fields: ['id', 'firstName']} - }, { + scope: {fields: ['id', 'nickname']} + }, + { relation: 'sip', scope: {fields: ['extension']} - }, { + }, + { relation: 'department', scope: { include: {