refs #5688 feat: no mostrar datos si no tiene workerCenterFk
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-06-15 14:15:22 +02:00
parent 192f4c7864
commit b7b6f413ba
6 changed files with 327 additions and 305 deletions

View File

@ -1,3 +1,4 @@
<div ng-if="$ctrl.worker.hasWorkCenter">
<vn-crud-model
url="AbsenceTypes"
data="absenceTypes"
@ -23,7 +24,7 @@
<vn-side-menu side="right">
<div class="vn-pa-md">
<div class="totalBox vn-mb-sm" style="text-align: center;">
<h6>{{'Contract' | translate}} #{{$ctrl.businessId}}</h6>
<h6>{{'Contract' | translate}} #{{$ctrl.card.worker.hasWorkCenter}}</h6>
<div>
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
@ -102,3 +103,10 @@
message="This item will be deleted"
question="Are you sure you want to continue?">
</vn-confirm>
</div>
<div
ng-if="!$ctrl.worker.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>

View File

@ -64,8 +64,7 @@ class Controller extends Section {
set worker(value) {
this._worker = value;
if (value) {
if (value && value.hasWorkCenter) {
this.getIsSubordinate();
this.getActiveContract();
}

View File

@ -12,3 +12,4 @@ To start adding absences, click an absence type from the right menu and then on
You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual
Current day: Día actual
Paid holidays: Vacaciones pagadas
Autonomous worker: Trabajador autónomo

View File

@ -34,6 +34,8 @@ class Controller extends ModuleCard {
this.$http.get(`Workers/${this.$params.id}`, {filter})
.then(res => this.worker = res.data);
this.$http.get(`Workers/${this.$params.id}/activeContract`)
.then(res => this.worker.hasWorkCenter = res.data.workCenterFk);
}
}

View File

@ -4,6 +4,7 @@
filter="::$ctrl.filter"
data="$ctrl.hours">
</vn-crud-model>
<div ng-if="$ctrl.card.worker.hasWorkCenter">
<vn-card class="vn-pa-lg vn-w-lg">
<vn-table model="model" auto-load="false">
<vn-thead>
@ -212,3 +213,10 @@
<button response="accept" translate>Confirm</button>
</tpl-buttons>
</vn-dialog>
</div>
<div
ng-if="!$ctrl.worker.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>

View File

@ -151,6 +151,7 @@ class Controller extends Section {
}
getAbsences() {
if (!this.card.worker.hasWorkerCenter) return;
const fullYear = this.started.getFullYear();
let params = {
workerFk: this.$params.id,
@ -485,5 +486,8 @@ ngModule.vnComponent('vnWorkerTimeControl', {
controller: Controller,
bindings: {
worker: '<'
},
require: {
card: '^vnWorkerCard'
}
});