diff --git a/back/models/account.json b/back/models/account.json index ad0c8aa5d..7186621b4 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -51,7 +51,12 @@ "type": "hasOne", "model": "EmailUser", "foreignKey": "userFk" - } + }, + "worker": { + "type": "hasOne", + "model": "Worker", + "foreignKey": "userFk" + } }, "acls": [ { diff --git a/modules/client/front/log/index.html b/modules/client/front/log/index.html index cc571ec08..b491db602 100644 --- a/modules/client/front/log/index.html +++ b/modules/client/front/log/index.html @@ -1,9 +1 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/client/front/log/index.js b/modules/client/front/log/index.js index 4552588e4..2f01d229c 100644 --- a/modules/client/front/log/index.js +++ b/modules/client/front/log/index.js @@ -4,44 +4,6 @@ class Controller { constructor($scope, $stateParams) { this.$scope = $scope; this.$stateParams = $stateParams; - this.filter = { - include: [{ - relation: 'user', - scope: { - fields: ['name'], - }, - }], - }; - } - - get logs() { - return this._logs; - } - - set logs(value) { - this._logs = value; - - if (this.logs) { - this.logs.forEach(log => { - log.oldProperties = this.getInstance(log.oldInstance); - log.newProperties = this.getInstance(log.newInstance); - }); - } - } - - getInstance(instance) { - let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; - const properties = []; - if (typeof instance == 'object' && instance != null) { - Object.keys(instance).forEach(property => { - if (validDate.test(instance[property])) - instance[property] = new Date(instance[property]).toLocaleString('es-ES'); - - properties.push({key: property, value: instance[property]}); - }); - return properties; - } - return null; } } diff --git a/modules/item/front/log/index.html b/modules/item/front/log/index.html index 3734ba056..209cf9e56 100644 --- a/modules/item/front/log/index.html +++ b/modules/item/front/log/index.html @@ -1,9 +1 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/item/front/log/index.js b/modules/item/front/log/index.js index edb540760..9253147c7 100644 --- a/modules/item/front/log/index.js +++ b/modules/item/front/log/index.js @@ -4,44 +4,6 @@ class Controller { constructor($scope, $stateParams) { this.$scope = $scope; this.$stateParams = $stateParams; - this.filter = { - include: [{ - relation: 'user', - scope: { - fields: ['name'], - }, - }], - }; - } - - get logs() { - return this._logs; - } - - set logs(value) { - this._logs = value; - - if (this.logs) { - this.logs.forEach(log => { - log.oldProperties = this.getInstance(log.oldInstance); - log.newProperties = this.getInstance(log.newInstance); - }); - } - } - - getInstance(instance) { - let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; - const properties = []; - if (typeof instance == 'object' && instance != null) { - Object.keys(instance).forEach(property => { - if (validDate.test(instance[property])) - instance[property] = new Date(instance[property]).toLocaleString('es-ES'); - - properties.push({key: property, value: instance[property]}); - }); - return properties; - } - return null; } } diff --git a/modules/route/front/log/index.html b/modules/route/front/log/index.html index 925ea1d14..45a41fc0f 100644 --- a/modules/route/front/log/index.html +++ b/modules/route/front/log/index.html @@ -1,9 +1 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/route/front/log/index.js b/modules/route/front/log/index.js index 85358bd72..ff0a2a9d1 100644 --- a/modules/route/front/log/index.js +++ b/modules/route/front/log/index.js @@ -4,44 +4,6 @@ class Controller { constructor($scope, $stateParams) { this.$scope = $scope; this.$stateParams = $stateParams; - this.filter = { - include: [{ - relation: 'user', - scope: { - fields: ['name'], - }, - }], - }; - } - - get logs() { - return this._logs; - } - - set logs(value) { - this._logs = value; - - if (this.logs) { - this.logs.forEach(log => { - log.oldProperties = this.getInstance(log.oldInstance); - log.newProperties = this.getInstance(log.newInstance); - }); - } - } - - getInstance(instance) { - let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; - const properties = []; - if (typeof instance == 'object' && instance != null) { - Object.keys(instance).forEach(property => { - if (validDate.test(instance[property])) - instance[property] = new Date(instance[property]).toLocaleString('es-ES'); - - properties.push({key: property, value: instance[property]}); - }); - return properties; - } - return null; } } diff --git a/modules/ticket/front/log/index.html b/modules/ticket/front/log/index.html index facc14fa2..9e975cceb 100644 --- a/modules/ticket/front/log/index.html +++ b/modules/ticket/front/log/index.html @@ -1,9 +1 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/ticket/front/log/index.js b/modules/ticket/front/log/index.js index fb1177162..6a486d3d0 100644 --- a/modules/ticket/front/log/index.js +++ b/modules/ticket/front/log/index.js @@ -4,45 +4,6 @@ class Controller { constructor($scope, $stateParams) { this.$scope = $scope; this.$stateParams = $stateParams; - this.filter = { - include: [{ - relation: 'user', - scope: { - fields: ['name'], - }, - }], - }; - } - - get logs() { - return this._logs; - } - - set logs(value) { - this._logs = value; - - if (this.logs) { - this.logs.forEach(log => { - log.oldProperties = this.getInstance(log.oldInstance); - log.newProperties = this.getInstance(log.newInstance); - }); - } - } - - getInstance(instance) { - const properties = []; - let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; - - if (typeof instance == 'object' && instance != null) { - Object.keys(instance).forEach(property => { - if (validDate.test(instance[property])) - instance[property] = new Date(instance[property]).toLocaleString('es-ES'); - - properties.push({key: property, value: instance[property]}); - }); - return properties; - } - return null; } } diff --git a/modules/worker/front/log/index.html b/modules/worker/front/log/index.html index 1c3c76459..8ba6b285b 100644 --- a/modules/worker/front/log/index.html +++ b/modules/worker/front/log/index.html @@ -1,8 +1,17 @@ + + History - + Date @@ -15,7 +24,7 @@ - + {{::log.creationDate | dateTime:'dd/MM/yyyy HH:mm'}}
@@ -23,7 +32,7 @@ Changed by: {{::log.user.name | dashIfEmpty}} @@ -45,7 +54,7 @@ {{::log.user.name | dashIfEmpty}} @@ -89,7 +98,7 @@ - + { + log.oldProperties = this.getInstance(log.oldInstance); + log.newProperties = this.getInstance(log.newInstance); + }); + } } showWorkerDescriptor(event, workerFk) { @@ -22,6 +51,22 @@ export default class Controller { this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } + + getInstance(instance) { + const properties = []; + let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; + + if (typeof instance == 'object' && instance != null) { + Object.keys(instance).forEach(property => { + if (validDate.test(instance[property])) + instance[property] = new Date(instance[property]).toLocaleString('es-ES'); + + properties.push({key: property, value: instance[property]}); + }); + return properties; + } + return null; + } } Controller.$inject = ['$scope']; @@ -30,6 +75,8 @@ ngModule.component('vnLog', { controller: Controller, template: require('./index.html'), bindings: { - model: '<' + model: '<', + originId: '<', + url: '@' } });