fix: worker.basic-data el boton guardar estava activo al hacer F5
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-07-14 12:18:41 +02:00
parent 4a7cfe9122
commit 4f183d1c6a
3 changed files with 27 additions and 39 deletions

View File

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

View File

@ -5,8 +5,8 @@
<slot-before>
<div class="photo" text-center>
<img vn-id="photo"
ng-src="{{$root.imagePath('user', '520x520', $ctrl.worker.id)}}"
zoom-image="{{$root.imagePath('user', '1600x1600', $ctrl.worker.id)}}"
ng-src="{{$root.imagePath('user', '520x520', $ctrl.worker.id)}}"
zoom-image="{{$root.imagePath('user', '1600x1600', $ctrl.worker.id)}}"
on-error-src/>
<vn-float-button ng-click="uploadPhoto.show('user', $ctrl.worker.id)"
icon="edit"
@ -15,39 +15,32 @@
</div>
</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>
<vn-item ng-click="$ctrl.handleExcluded()" translate>
{{$ctrl.workerExcluded
? 'Click to allow the user to be disabled'
: 'Click to exclude the user from getting disabled'}}
</vn-item>
</slot-menu>
<slot-body>
<div class="attributes">
<vn-label-value
label="User"
label="User"
value="{{$ctrl.worker.user.name}}">
</vn-label-value>
<vn-label-value
label="Email"
label="Email"
value="{{$ctrl.worker.user.emailUser.email}}">
</vn-label-value>
<vn-label-value
label="Department"
label="Department"
value="{{$ctrl.worker.department.department.name}}">
</vn-label-value>
<vn-label-value
label="Phone"
label="Phone"
value="{{$ctrl.worker.phone}}">
</vn-label-value>
<vn-label-value
label="Extension"
label="Extension"
value="{{$ctrl.worker.sip.extension}}">
</vn-label-value>
</div>
@ -84,7 +77,7 @@
</vn-popup>
<!-- Upload photo dialog -->
<vn-upload-photo
vn-id="uploadPhoto"
<vn-upload-photo
vn-id="uploadPhoto"
on-response="$ctrl.onUploadResponse()">
</vn-upload-photo>
</vn-upload-photo>

View File

@ -18,28 +18,19 @@ class Controller extends Descriptor {
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;
this.$http.get(`WorkerDisableExcludeds/${this.entity.id}/exists`).then(data => {
this.workerExcluded = 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;
}
if (this.workerExcluded)
this.$http.delete(`WorkerDisableExcludeds/${this.entity.id}`);
else
this.$http.post(`WorkerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date});
this.workerExcluded = !this.workerExcluded;
}
loadData() {