fix: workCenter
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-07-14 11:51:15 +02:00
parent 5ffa8b8910
commit 4a7cfe9122
5 changed files with 201 additions and 191 deletions

View File

@ -1,9 +1,9 @@
<vn-crud-model
<div ng-if="$ctrl.card.hasWorkCenter">
<vn-crud-model
url="AbsenceTypes"
data="absenceTypes"
auto-load="true">
</vn-crud-model>
<div ng-if="$ctrl.worker.hasWorkCenter">
</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
@ -21,14 +21,7 @@
</vn-calendar>
</vn-card>
</div>
</div>
<div
ng-if="!$ctrl.worker.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>
<vn-side-menu side="right">
<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>
@ -104,10 +97,17 @@
</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.card.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>

View File

@ -31,6 +31,8 @@ class Controller extends Section {
}
set businessId(value) {
if (!this.card.hasWorkCenter) return;
this._businessId = value;
if (value) {
this.refresh()
@ -64,7 +66,7 @@ class Controller extends Section {
set worker(value) {
this._worker = value;
if (value && value.hasWorkCenter) {
if (value) {
this.getIsSubordinate();
this.getActiveContract();
}
@ -293,5 +295,8 @@ ngModule.vnComponent('vnWorkerCalendar', {
controller: Controller,
bindings: {
worker: '<'
},
require: {
card: '^vnWorkerCard'
}
});

View File

@ -3,7 +3,7 @@ import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
reload() {
let filter = {
const filter = {
include: [
{
relation: 'user',
@ -32,13 +32,12 @@ class Controller extends ModuleCard {
]
};
return Promise.all([
this.$http.get(`Workers/${this.$params.id}`, {filter})
.then(res => this.worker = res.data)
.then(() =>
.then(res => this.worker = res.data),
this.$http.get(`Workers/${this.$params.id}/activeContract`)
.then(res => {
if (res.data) this.worker.hasWorkCenter = res.data.workCenterFk;
}));
.then(res => this.hasWorkCenter = res.data.workCenterFk)
]);
}
}

View File

@ -4,7 +4,7 @@
filter="::$ctrl.filter"
data="$ctrl.hours">
</vn-crud-model>
<div ng-if="$ctrl.worker.hasWorkCenter">
<div ng-if="$ctrl.card.hasWorkCenter">
<vn-card class="vn-pa-lg vn-w-lg">
<vn-table model="model" auto-load="false">
<vn-thead>
@ -105,15 +105,9 @@
ng-show="::$ctrl.isHr">
</vn-button>
</vn-button-bar>
</div>
<div
ng-if="!$ctrl.worker.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>
<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>
@ -135,8 +129,9 @@
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">
@ -162,16 +157,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"
@ -186,9 +181,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>
@ -206,9 +201,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">
@ -219,4 +214,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.card.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>

View File

@ -141,6 +141,8 @@ class Controller extends Section {
]}
};
this.$.model.applyFilter(filter, params).then(() => {
if (!this.card.hasWorkCenter) return;
this.getWorkedHours(this.started, this.ended);
this.getAbsences();
});
@ -151,7 +153,6 @@ class Controller extends Section {
}
getAbsences() {
if (!this.worker.hasWorkerCenter) return;
const fullYear = this.started.getFullYear();
let params = {
workerFk: this.$params.id,
@ -486,5 +487,8 @@ ngModule.vnComponent('vnWorkerTimeControl', {
controller: Controller,
bindings: {
worker: '<'
},
require: {
card: '^vnWorkerCard'
}
});