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 @@
<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">
<div class="vn-w-lg">
<vn-card class="vn-pa-sm calendars">
<vn-icon ng-if="::$ctrl.isSubordinate" icon="info" color-marginal
@ -21,13 +21,6 @@
</vn-calendar>
</vn-card>
</div>
</div>
<div
ng-if="!$ctrl.worker.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>
<vn-side-menu side="right">
<div class="vn-pa-md">
<div class="totalBox vn-mb-sm" style="text-align: center;">
@ -110,4 +103,11 @@
message="This item will be deleted"
question="Are you sure you want to continue?">
</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,13 +105,7 @@
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">
<div class="vn-pa-md">
@ -136,6 +130,7 @@
</vn-calendar>
</div>
</vn-side-menu>
<vn-dialog
vn-id="addTimeDialog"
on-accept="$ctrl.addTime()"
@ -220,3 +215,10 @@
<button response="accept" translate>Confirm</button>
</tpl-buttons>
</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'
}
});