Merge pull request '4563-Worker-Description-workerDisableExcluded-checkbox' (!1076) from 4563-Worker-Description-workerDisableExcluded-checkbox into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1076
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2022-11-02 06:34:49 +00:00
commit 33c92a0f24
6 changed files with 83 additions and 1 deletions

View File

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

View File

@ -64,6 +64,9 @@
}, },
"WorkerTimeControlMail": { "WorkerTimeControlMail": {
"dataSource": "vn" "dataSource": "vn"
},
"WorkerDisableExcluded": {
"dataSource": "vn"
} }
} }

View File

@ -0,0 +1,26 @@
{
"name": "WorkerDisableExcluded",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerDisableExcluded"
}
},
"properties": {
"workerFk": {
"id": true,
"type": "number"
},
"dated": {
"type": "date"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -14,6 +14,20 @@
</vn-float-button> </vn-float-button>
</div> </div>
</slot-before> </slot-before>
<slot-menu>
<vn-item
ng-click="$ctrl.handleExcluded()"
translate
ng-if="!$ctrl.excluded">
Click to exclude the user from getting disabled
</vn-item>
<vn-item
ng-click="$ctrl.handleExcluded()"
translate
ng-if="$ctrl.excluded">
Click to allow the user to be disabled
</vn-item>
</slot-menu>
<slot-body> <slot-body>
<div class="attributes"> <div class="attributes">
<vn-label-value <vn-label-value
@ -37,6 +51,13 @@
value="{{$ctrl.worker.sip.extension}}"> value="{{$ctrl.worker.sip.extension}}">
</vn-label-value> </vn-label-value>
</div> </div>
<div class="icons">
<vn-icon
vn-tooltip="This user can't be disabled"
icon="person"
ng-if="$ctrl.worker.excluded">
</vn-icon>
</div>
<div class="quicklinks"> <div class="quicklinks">
<div ng-transclude="btnOne"> <div ng-transclude="btnOne">
<vn-quick-link <vn-quick-link

View File

@ -13,6 +13,33 @@ class Controller extends Descriptor {
set worker(value) { set worker(value) {
this.entity = value; this.entity = value;
if (value)
this.getIsExcluded();
}
get excluded() {
return this.entity.excluded;
}
set excluded(value) {
this.entity.excluded = value;
}
getIsExcluded() {
this.$http.get(`workerDisableExcludeds/${this.entity.id}/exists`).then(data => {
this.excluded = data.data.exists;
});
}
handleExcluded() {
if (this.excluded) {
this.$http.delete(`workerDisableExcludeds/${this.entity.id}`);
this.excluded = false;
} else {
this.$http.post(`workerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date});
this.excluded = true;
}
} }
loadData() { loadData() {

View File

@ -20,4 +20,7 @@ View worker: Ver trabajador
Worker id: Id trabajador Worker id: Id trabajador
Workers: Trabajadores Workers: Trabajadores
worker: trabajador worker: trabajador
Go to the worker: Ir al trabajador Go to the worker: Ir al trabajador
Click to exclude the user from getting disabled: Marcar para no deshabilitar
Click to allow the user to be disabled: Marcar para deshabilitar
This user can't be disabled: Fijado para no deshabilitar