From 0d23a3894fe19edbd19f15db0aac4bfe37874473 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 2 Mar 2020 09:28:08 +0100 Subject: [PATCH 1/4] entry log --- modules/entry/back/models/entry.json | 3 +++ modules/entry/front/index.js | 1 + modules/entry/front/log/index.html | 1 + modules/entry/front/log/index.js | 15 +++++++++++++++ modules/entry/front/routes.json | 6 ++++++ 5 files changed, 26 insertions(+) create mode 100644 modules/entry/front/log/index.html create mode 100644 modules/entry/front/log/index.js diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index c2a7d7c42..6d38dbba1 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -1,6 +1,9 @@ { "name": "Entry", "base": "VnModel", + "log": { + "model":"EntryLog" + }, "options": { "mysql": { "table": "entry" diff --git a/modules/entry/front/index.js b/modules/entry/front/index.js index 25e054a71..0679b946b 100644 --- a/modules/entry/front/index.js +++ b/modules/entry/front/index.js @@ -6,3 +6,4 @@ import './search-panel'; import './descriptor'; import './card'; import './summary'; +import './log'; diff --git a/modules/entry/front/log/index.html b/modules/entry/front/log/index.html new file mode 100644 index 000000000..4932965d1 --- /dev/null +++ b/modules/entry/front/log/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/entry/front/log/index.js b/modules/entry/front/log/index.js new file mode 100644 index 000000000..a5fb6c668 --- /dev/null +++ b/modules/entry/front/log/index.js @@ -0,0 +1,15 @@ +import ngModule from '../module'; + +class Controller { + constructor($scope, $stateParams) { + this.$scope = $scope; + this.$stateParams = $stateParams; + } +} + +Controller.$inject = ['$scope', '$stateParams']; + +ngModule.component('vnEntryLog', { + template: require('./index.html'), + controller: Controller, +}); diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json index 612edc157..0d3e2cf14 100644 --- a/modules/entry/front/routes.json +++ b/modules/entry/front/routes.json @@ -9,6 +9,7 @@ {"state": "entry.index", "icon": "icon-entry"} ], "card": [ + {"state": "travel.card.log", "icon": "history"}, ] }, "routes": [ @@ -36,6 +37,11 @@ "params": { "entry": "$ctrl.entry" } + }, { + "url" : "/log", + "state": "entry.card.log", + "component": "vn-entry-log", + "description": "Log" } ] } \ No newline at end of file From 686382a0e6f7e878bcebce6c1120f4b3f38a04d9 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 2 Mar 2020 11:57:09 +0100 Subject: [PATCH 2/4] entryLog section --- db/changes/10161-postValentineDay/00-ACL.sql | 2 + modules/entry/back/model-config.json | 3 ++ modules/entry/back/models/entry-log.json | 43 ++++++++++++++++++++ modules/entry/front/routes.json | 2 +- modules/travel/back/model-config.json | 12 ++++-- 5 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 db/changes/10161-postValentineDay/00-ACL.sql create mode 100644 modules/entry/back/models/entry-log.json diff --git a/db/changes/10161-postValentineDay/00-ACL.sql b/db/changes/10161-postValentineDay/00-ACL.sql new file mode 100644 index 000000000..a7ac79486 --- /dev/null +++ b/db/changes/10161-postValentineDay/00-ACL.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES ('EntryLog', '*', 'READ', 'ALLOW', 'ROLE', 'buyer'); diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json index cd763c4ea..c8c8babad 100644 --- a/modules/entry/back/model-config.json +++ b/modules/entry/back/model-config.json @@ -1,5 +1,8 @@ { "Entry": { "dataSource": "vn" + }, + "EntryLog": { + "dataSource": "vn" } } diff --git a/modules/entry/back/models/entry-log.json b/modules/entry/back/models/entry-log.json new file mode 100644 index 000000000..4d1a74578 --- /dev/null +++ b/modules/entry/back/models/entry-log.json @@ -0,0 +1,43 @@ +{ + "name": "EntryLog", + "base": "VnModel", + "options": { + "mysql": { + "table": "entryLog" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "originFk": { + "type": "Number", + "required": true + }, + "userFk": { + "type": "Number" + }, + "action": { + "type": "String", + "required": true + }, + "creationDate": { + "type": "Date" + }, + "description": { + "type": "String" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + }, + "scope": { + "order": ["creationDate DESC", "id DESC"] + } +} diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json index 0d3e2cf14..92d893044 100644 --- a/modules/entry/front/routes.json +++ b/modules/entry/front/routes.json @@ -9,7 +9,7 @@ {"state": "entry.index", "icon": "icon-entry"} ], "card": [ - {"state": "travel.card.log", "icon": "history"}, + {"state": "entry.card.log", "icon": "history"} ] }, "routes": [ diff --git a/modules/travel/back/model-config.json b/modules/travel/back/model-config.json index 03307bd45..b06d00f06 100644 --- a/modules/travel/back/model-config.json +++ b/modules/travel/back/model-config.json @@ -1,13 +1,17 @@ { "Travel": { "dataSource": "vn" - },"TravelLog": { + }, + "TravelLog": { "dataSource": "vn" - },"Currency": { + }, + "Currency": { "dataSource": "vn" - },"Thermograph": { + }, + "Thermograph": { "dataSource": "vn" - },"TravelThermograph": { + }, + "TravelThermograph": { "dataSource": "vn" } } From ced8c6e96319f507ed04608554585674058dd4ad Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 4 Mar 2020 07:49:21 +0100 Subject: [PATCH 3/4] traductions --- modules/entry/front/log/locale/es.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/entry/front/log/locale/es.yml diff --git a/modules/entry/front/log/locale/es.yml b/modules/entry/front/log/locale/es.yml new file mode 100644 index 000000000..094615b47 --- /dev/null +++ b/modules/entry/front/log/locale/es.yml @@ -0,0 +1 @@ +Date: Fecha \ No newline at end of file From e40575cc1fae05f513ead06103649bc37efa962c Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 4 Mar 2020 08:58:57 +0100 Subject: [PATCH 4/4] fix model entry log --- modules/entry/back/models/entry-log.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/entry/back/models/entry-log.json b/modules/entry/back/models/entry-log.json index 4d1a74578..daeab1eac 100644 --- a/modules/entry/back/models/entry-log.json +++ b/modules/entry/back/models/entry-log.json @@ -9,8 +9,7 @@ "properties": { "id": { "id": true, - "type": "Number", - "forceId": false + "type": "Number" }, "originFk": { "type": "Number", @@ -35,9 +34,9 @@ "type": "belongsTo", "model": "Account", "foreignKey": "userFk" - } + } }, "scope": { "order": ["creationDate DESC", "id DESC"] } -} +} \ No newline at end of file