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

@ -52,5 +52,11 @@
}, },
"Device": { "Device": {
"dataSource": "vn" "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", "name": "Worker",
"description": "Company employees", "description": "Company employees",
"base": "VnModel", "base": "Loggable",
"log": {
"model":"WorkerLog",
"showField": "firstName"
},
"options": { "options": {
"mysql": { "mysql": {
"table": "worker" "table": "worker"

View File

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

View File

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

View File

@ -13,6 +13,7 @@ import './department';
import './calendar'; import './calendar';
import './time-control'; import './time-control';
import './log'; import './log';
import './worker-log';
import './dms/index'; import './dms/index';
import './dms/create'; import './dms/create';
import './dms/edit'; 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 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 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. 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.pbx", "icon": "icon-pbx"},
{"state": "worker.card.calendar", "icon": "icon-calendar"}, {"state": "worker.card.calendar", "icon": "icon-calendar"},
{"state": "worker.card.timeControl", "icon": "access_time"}, {"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": [ "routes": [
@ -51,6 +52,11 @@
"worker": "$ctrl.worker" "worker": "$ctrl.worker"
}, },
"acl": ["hr"] "acl": ["hr"]
}, {
"url" : "/log",
"state": "worker.card.workerLog",
"component": "vn-worker-log",
"description": "Log"
}, { }, {
"url": "/pbx", "url": "/pbx",
"state": "worker.card.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,
});