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,9 +1,10 @@
<vn-crud-model
<div ng-if="$ctrl.worker.hasWorkCenter">
<vn-crud-model
url="AbsenceTypes"
data="absenceTypes"
auto-load="true">
</vn-crud-model>
<div class="vn-w-lg">
</vn-crud-model>
<div class="vn-w-lg">
<vn-card class="vn-pa-sm calendars">
<vn-icon ng-if="::$ctrl.isSubordinate" icon="info" color-marginal
vn-tooltip="To start adding absences, click an absence type from the right menu and then on the day you want to add an absence">
@ -19,11 +20,11 @@
on-selection="$ctrl.onSelection($event, $days)">
</vn-calendar>
</vn-card>
</div>
<vn-side-menu side="right">
</div>
<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}}
@ -96,9 +97,16 @@
</vn-chip>
</div>
</div>
</vn-side-menu>
<vn-confirm
</vn-side-menu>
<vn-confirm
vn-id="confirm"
message="This item will be deleted"
question="Are you sure you want to continue?">
</vn-confirm>
</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,7 +4,8 @@
filter="::$ctrl.filter"
data="$ctrl.hours">
</vn-crud-model>
<vn-card class="vn-pa-lg vn-w-lg">
<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>
<vn-tr>
@ -76,9 +77,9 @@
</vn-tr>
</vn-tfoot>
</vn-table>
</vn-card>
</vn-card>
<vn-button-bar ng-show="$ctrl.state" class="vn-w-lg">
<vn-button-bar ng-show="$ctrl.state" class="vn-w-lg">
<vn-button
label="Satisfied"
disabled="$ctrl.state == 'CONFIRMED'"
@ -103,9 +104,9 @@
vn-tooltip="Resend email of this week to the user"
ng-show="::$ctrl.isHr">
</vn-button>
</vn-button-bar>
</vn-button-bar>
<vn-side-menu side="right">
<vn-side-menu side="right">
<div class="vn-pa-md">
<div class="totalBox" style="text-align: center;">
<h6 translate>Hours</h6>
@ -127,8 +128,8 @@
has-events="$ctrl.hasEvents($day)">
</vn-calendar>
</div>
</vn-side-menu>
<vn-dialog
</vn-side-menu>
<vn-dialog
vn-id="addTimeDialog"
on-accept="$ctrl.addTime()"
message="Add time">
@ -154,16 +155,16 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button>
</tpl-buttons>
</vn-dialog>
<vn-confirm
</vn-dialog>
<vn-confirm
vn-id="delete-entry-dialog"
on-accept="$ctrl.deleteTimeEntry()"
message="This time entry will be deleted"
question="Are you sure you want to delete this entry?">
</vn-confirm>
</vn-confirm>
<!-- Edit entry Popover -->
<vn-popover vn-id="editEntry">
<!-- Edit entry Popover -->
<vn-popover vn-id="editEntry">
<vn-horizontal class="vn-pa-sm edit-time-entry">
<vn-autocomplete class="dense"
ng-model="$ctrl.selectedRow.direction"
@ -178,9 +179,9 @@
ng-click="$ctrl.save()">
</vn-icon-button>
</vn-horizontal>
</vn-popover>
</vn-popover>
<vn-dialog
<vn-dialog
vn-id="reason"
on-accept="$ctrl.isUnsatisfied()">
<tpl-body>
@ -198,9 +199,9 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button>
</tpl-buttons>
</vn-dialog>
</vn-dialog>
<vn-dialog
<vn-dialog
vn-id="sendEmailConfirmation"
on-accept="$ctrl.resendEmail()"
message="Send time control email">
@ -211,4 +212,11 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Confirm</button>
</tpl-buttons>
</vn-dialog>
</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'
}
});