From 4c6213cd01b7ef4c318d03aa5e327c365d582ee0 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 13 Apr 2018 08:59:23 +0200 Subject: [PATCH] =?UTF-8?q?Tarea=20#240=20A=C3=B1adir=20comprador?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/item/src/descriptor/descriptor.html | 1 + client/item/src/list/product.html | 3 ++- client/item/src/locale/es.yml | 9 ++++++++- client/item/src/summary/summary.html | 1 + services/loopback/common/methods/item/filter.js | 6 +++++- services/loopback/common/models/item-type.json | 7 +++++++ 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/client/item/src/descriptor/descriptor.html b/client/item/src/descriptor/descriptor.html index 38002ed5a..eacaafce5 100644 --- a/client/item/src/descriptor/descriptor.html +++ b/client/item/src/descriptor/descriptor.html @@ -25,6 +25,7 @@
{{$ctrl.item.name}}
Id {{$ctrl.item.id}}
+
Buyer {{$ctrl.item.itemType.worker.firstName}}
{{$ctrl.tags[itemTag.tagFk].name}} {{itemTag.value}}
diff --git a/client/item/src/list/product.html b/client/item/src/list/product.html index 30663314c..8f2680333 100644 --- a/client/item/src/list/product.html +++ b/client/item/src/list/product.html @@ -15,8 +15,9 @@
Description {{::$ctrl.item.description}}
Size {{::$ctrl.item.size}}
Type {{::$ctrl.item.itemType.name}}
+
Buyer {{::$ctrl.item.itemType.worker.firstName}} {{::$ctrl.item.itemType.worker.name}}
- + Relevancy: {{$ctrl.item.relevancy}}

Origin: {{$ctrl.item.origin.name}}

Expence: {{$ctrl.item.expence.name}}

+

Buyer: {{$ctrl.item.itemType.worker.firstName}} {{$ctrl.item.itemType.worker.name}}

diff --git a/services/loopback/common/methods/item/filter.js b/services/loopback/common/methods/item/filter.js index a91b61585..cda4bda81 100644 --- a/services/loopback/common/methods/item/filter.js +++ b/services/loopback/common/methods/item/filter.js @@ -10,7 +10,11 @@ module.exports = Self => { include: { relation: 'itemType', scope: { - fields: ['id', 'name'] + fields: ['id', 'name', 'workerFk'], + include: { + relation: 'worker', + fields: ['firstName', 'name'] + } } } }; diff --git a/services/loopback/common/models/item-type.json b/services/loopback/common/models/item-type.json index 107bccc02..8619a35be 100644 --- a/services/loopback/common/models/item-type.json +++ b/services/loopback/common/models/item-type.json @@ -22,6 +22,13 @@ "type": "Number" } }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + } + }, "acls": [ { "accessType": "READ",