worker log
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-03-24 12:20:53 +01:00
parent 0793588ef3
commit 423f59dfb0
13 changed files with 105 additions and 7 deletions

View File

@ -0,0 +1 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WorkerLog', '*', 'READ', 'ALLOW', 'ROLE', 'hr');

View File

@ -0,0 +1,6 @@
ALTER TABLE `vn`.`workerLog`
ADD COLUMN `changedModel` VARCHAR(45) NULL DEFAULT NULL AFTER `description`,
ADD COLUMN `oldInstance` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ADD COLUMN `newInstance` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ADD COLUMN `changedModelId` int(11) DEFAULT NULL,
ADD COLUMN `changedModelValue` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL;

View File

@ -7,7 +7,7 @@
},
"options": {
"mysql": {
"table": "travel"
"table": "travel"
}
},
"properties": {

View File

@ -52,5 +52,11 @@
},
"Device": {
"dataSource": "vn"
},
"WorkerLog": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,58 @@
{
"name": "WorkerLog",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerLog"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"forceId": false
},
"originFk": {
"type": "Number",
"required": true
},
"userFk": {
"type": "Number"
},
"action": {
"type": "String",
"required": true
},
"changedModel": {
"type": "String"
},
"oldInstance": {
"type": "Object"
},
"newInstance": {
"type": "Object"
},
"creationDate": {
"type": "Date"
},
"changedModelId": {
"type": "String"
},
"changedModelValue": {
"type": "String"
},
"description": {
"type": "String"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
}
},
"scope": {
"order": ["creationDate DESC", "id DESC"]
}
}

View File

@ -1,7 +1,11 @@
{
"name": "Worker",
"description": "Company employees",
"base": "VnModel",
"base": "Loggable",
"log": {
"model":"WorkerLog",
"showField": "firstName"
},
"options": {
"mysql": {
"table": "worker"

View File

@ -1,10 +1,9 @@
<mg-ajax path="Workers/{{patch.params.id}}" options="vnPatch"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.worker"
form="form"
id-field="id"
url="Workers"
save="post">
save="patch">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">

View File

@ -6,7 +6,7 @@ class Controller {
}
onSubmit() {
this.$.watcher.submit()
return this.$.watcher.submit()
.then(() => this.card.reload());
}
}

View File

@ -13,6 +13,7 @@ import './department';
import './calendar';
import './time-control';
import './log';
import './worker-log';
import './dms/index';
import './dms/create';
import './dms/edit';

View File

@ -18,3 +18,4 @@ Calendar: Calendario
Search workers by id, firstName, lastName or user name: Buscar trabajadores por el identificador, nombre, apellidos o nombre de usuario
Time control: Control de horario
Data saved! User must access web: ¡Datos guardados! El usuario deberá acceder con su contraseña a la web para que los cambios surtan efecto.
Log: Historial

View File

@ -13,7 +13,8 @@
{"state": "worker.card.pbx", "icon": "icon-pbx"},
{"state": "worker.card.calendar", "icon": "icon-calendar"},
{"state": "worker.card.timeControl", "icon": "access_time"},
{"state": "worker.card.dms.index", "icon": "cloud_upload"}
{"state": "worker.card.dms.index", "icon": "cloud_upload"},
{"state": "worker.card.workerLog", "icon": "history"}
]
},
"routes": [
@ -51,6 +52,11 @@
"worker": "$ctrl.worker"
},
"acl": ["hr"]
}, {
"url" : "/log",
"state": "worker.card.workerLog",
"component": "vn-worker-log",
"description": "Log"
}, {
"url": "/pbx",
"state": "worker.card.pbx",

View File

@ -0,0 +1 @@
<vn-log url="WorkerLogs" origin-id="$ctrl.$stateParams.id"></vn-log>

View File

@ -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('vnWorkerLog', {
template: require('./index.html'),
controller: Controller,
});