diff --git a/client/client/src/credit-create/credit-create.html b/client/client/src/credit-create/credit-create.html
index 2df41cf61..c02ff7167 100644
--- a/client/client/src/credit-create/credit-create.html
+++ b/client/client/src/credit-create/credit-create.html
@@ -12,7 +12,7 @@
-
+
diff --git a/client/client/src/credit-list/credit-list.html b/client/client/src/credit-list/credit-list.html
index 9ad0d1101..408c5ee33 100644
--- a/client/client/src/credit-list/credit-list.html
+++ b/client/client/src/credit-list/credit-list.html
@@ -11,19 +11,18 @@
-
+
{{::credit.amount | number:2}} €
{{::credit.created | date:'dd/MM/yyyy HH:mm' }}
-
+ {{::credit.employee.name}}
+ No results
-
-
-
+
diff --git a/client/client/src/credit-list/locale/es.json b/client/client/src/credit-list/locale/es.json
index 30f76c45f..2c99e8b73 100644
--- a/client/client/src/credit-list/locale/es.json
+++ b/client/client/src/credit-list/locale/es.json
@@ -1,3 +1,5 @@
{
- "Since" : "Desde"
+ "Since" : "Desde",
+ "Employee" : "Empleado",
+ "No results": "Sin resultados"
}
\ No newline at end of file
diff --git a/client/core/src/grid-header/style.scss b/client/core/src/grid-header/style.scss
index cc983dcf1..324e488d1 100644
--- a/client/core/src/grid-header/style.scss
+++ b/client/core/src/grid-header/style.scss
@@ -2,7 +2,6 @@ vn-grid-header {
border-bottom: 3px solid #9D9D9D;
font-weight: bold;
.orderly{
- cursor: pointer;
text-align: center;
white-space: nowrap;
justify-content: center;
diff --git a/services/client/common/models/client-credit.js b/services/client/common/models/client-credit.js
index 11a27e6af..7205be03e 100644
--- a/services/client/common/models/client-credit.js
+++ b/services/client/common/models/client-credit.js
@@ -1,14 +1,31 @@
module.exports = function(Self) {
- Self.installMethod('filter', filterCredits);
+ Self.installMethod('filter', filterParams, filterResults);
- function filterCredits(params) {
+ function filterParams(params) {
return {
where: {
clientFk: params.clientFk
},
skip: (params.page - 1) * params.size,
limit: params.size,
- order: params.order || 'created DESC'
+ order: params.order || 'created DESC',
+ include: {
+ relation: "employee",
+ scope: {
+ fields: ["id", "name", "surname"]
+ }
+ }
};
}
+
+ function filterResults(instances) {
+ let result = JSON.parse(JSON.stringify(instances));
+ if (result && result.instances && result.instances.length) {
+ result.instances.forEach((element, i) => {
+ result.instances[i].employee.name = `${element.employee.name} ${element.employee.surname}`;
+ delete result.instances[i].employee.surname;
+ });
+ }
+ return result;
+ }
};
diff --git a/services/loopback/common/models/vn-model.js b/services/loopback/common/models/vn-model.js
index 3305cb67d..30f358204 100644
--- a/services/loopback/common/models/vn-model.js
+++ b/services/loopback/common/models/vn-model.js
@@ -130,7 +130,7 @@ module.exports = function(Self) {
};
};
- Self.installMethod = function(methodName, filterCb) {
+ Self.installMethod = function(methodName, filterCb, filterResult) {
this.remoteMethod(methodName, {
description: 'List items using a filter',
accessType: 'READ',
@@ -161,8 +161,12 @@ module.exports = function(Self) {
var response = {};
function returnValues() {
- if (response.instances !== undefined && response.count !== undefined)
- cb(null, response);
+ if (response.instances !== undefined && response.count !== undefined) {
+ if (filterResult)
+ cb(null, filterResult(response));
+ else
+ cb(null, response);
+ }
}
function error() {