fix: workCenter
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
5ffa8b8910
commit
4a7cfe9122
|
@ -1,9 +1,9 @@
|
|||
<vn-crud-model
|
||||
url="AbsenceTypes"
|
||||
data="absenceTypes"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<div ng-if="$ctrl.worker.hasWorkCenter">
|
||||
<div ng-if="$ctrl.card.hasWorkCenter">
|
||||
<vn-crud-model
|
||||
url="AbsenceTypes"
|
||||
data="absenceTypes"
|
||||
auto-load="true">
|
||||
</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,51 +21,44 @@
|
|||
</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;">
|
||||
<h6>{{'Contract' | translate}} #{{$ctrl.businessId}}</h6>
|
||||
<div>
|
||||
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
|
||||
<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>
|
||||
<div>
|
||||
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
|
||||
</div>
|
||||
<div>
|
||||
{{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}}
|
||||
</div>
|
||||
<div>
|
||||
{{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}}
|
||||
</div>
|
||||
<div>
|
||||
{{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="totalBox" style="text-align: center;">
|
||||
<h6>{{'Year' | translate}} {{$ctrl.year}}</h6>
|
||||
<div>
|
||||
{{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}}
|
||||
<div class="totalBox" style="text-align: center;">
|
||||
<h6>{{'Year' | translate}} {{$ctrl.year}}</h6>
|
||||
<div>
|
||||
{{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}}
|
||||
</div>
|
||||
<div>
|
||||
{{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}}
|
||||
{{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vn-pt-md">
|
||||
<vn-autocomplete label="Year"
|
||||
<div class="vn-pt-md">
|
||||
<vn-autocomplete label="Year"
|
||||
data="$ctrl.yearFilter"
|
||||
ng-model="$ctrl.year"
|
||||
show-field="year"
|
||||
value-field="year"
|
||||
order="DESC">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete label="Contract"
|
||||
show-field="year"
|
||||
value-field="year"
|
||||
order="DESC">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete label="Contract"
|
||||
url="Workers/{{$ctrl.$params.id}}/contracts"
|
||||
fields="['started', 'ended']"
|
||||
ng-model="$ctrl.businessId"
|
||||
|
@ -83,31 +76,38 @@
|
|||
</div>
|
||||
<div name="absenceTypes" class="input vn-py-md" style="overflow: hidden;">
|
||||
<vn-chip ng-repeat="absenceType in absenceTypes" ng-class="::{'selectable': $ctrl.isSubordinate}"
|
||||
ng-click="$ctrl.pick(absenceType)">
|
||||
<vn-avatar
|
||||
ng-style="{backgroundColor: absenceType.rgb}">
|
||||
<vn-icon icon="check" ng-if="absenceType.id == $ctrl.absenceType.id"></vn-icon>
|
||||
</vn-avatar>
|
||||
{{absenceType.name}}
|
||||
</vn-chip>
|
||||
</div>
|
||||
<div class="vn-py-md">
|
||||
<vn-chip>
|
||||
<vn-avatar class="festive">
|
||||
</vn-avatar>
|
||||
<span translate>Festive</span>
|
||||
</vn-chip>
|
||||
<vn-chip>
|
||||
<vn-avatar class="today">
|
||||
</vn-avatar>
|
||||
<span translate>Current day</span>
|
||||
</vn-chip>
|
||||
</div>
|
||||
ng-click="$ctrl.pick(absenceType)">
|
||||
<vn-avatar
|
||||
ng-style="{backgroundColor: absenceType.rgb}">
|
||||
<vn-icon icon="check" ng-if="absenceType.id == $ctrl.absenceType.id"></vn-icon>
|
||||
</vn-avatar>
|
||||
{{absenceType.name}}
|
||||
</vn-chip>
|
||||
</div>
|
||||
</vn-side-menu>
|
||||
<vn-confirm
|
||||
vn-id="confirm"
|
||||
message="This item will be deleted"
|
||||
question="Are you sure you want to continue?">
|
||||
</vn-confirm>
|
||||
<div class="vn-py-md">
|
||||
<vn-chip>
|
||||
<vn-avatar class="festive">
|
||||
</vn-avatar>
|
||||
<span translate>Festive</span>
|
||||
</vn-chip>
|
||||
<vn-chip>
|
||||
<vn-avatar class="today">
|
||||
</vn-avatar>
|
||||
<span translate>Current day</span>
|
||||
</vn-chip>
|
||||
</div>
|
||||
</div>
|
||||
</vn-side-menu>
|
||||
<vn-confirm
|
||||
vn-id="confirm"
|
||||
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>
|
||||
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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 {
|
|||
]
|
||||
};
|
||||
|
||||
this.$http.get(`Workers/${this.$params.id}`, {filter})
|
||||
.then(res => this.worker = res.data)
|
||||
.then(() =>
|
||||
this.$http.get(`Workers/${this.$params.id}/activeContract`)
|
||||
.then(res => {
|
||||
if (res.data) this.worker.hasWorkCenter = res.data.workCenterFk;
|
||||
}));
|
||||
return Promise.all([
|
||||
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.hasWorkCenter = res.data.workCenterFk)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,118 +105,120 @@
|
|||
ng-show="::$ctrl.isHr">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
|
||||
|
||||
<vn-side-menu side="right">
|
||||
<div class="vn-pa-md">
|
||||
<div class="totalBox" style="text-align: center;">
|
||||
<h6 translate>Hours</h6>
|
||||
<vn-label-value
|
||||
label="Week total"
|
||||
value="{{$ctrl.weekTotalHours}} h.">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Finish at"
|
||||
value="{{$ctrl.getFinishTime()}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
<vn-calendar
|
||||
vn-id="calendar"
|
||||
class="vn-pt-md"
|
||||
ng-model="$ctrl.date"
|
||||
format-week="$ctrl.formatWeek($element)"
|
||||
on-move="$ctrl.getMailStates($date)"
|
||||
has-events="$ctrl.hasEvents($day)">
|
||||
</vn-calendar>
|
||||
</div>
|
||||
</vn-side-menu>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="addTimeDialog"
|
||||
on-accept="$ctrl.addTime()"
|
||||
message="Add time">
|
||||
<tpl-body>
|
||||
<vn-input-time
|
||||
vn-one
|
||||
vn-focus
|
||||
ng-model="$ctrl.newTimeEntry.timed"
|
||||
label="Hour"
|
||||
required="true">
|
||||
</vn-input-time>
|
||||
<vn-autocomplete
|
||||
label="Type"
|
||||
ng-model="$ctrl.newTimeEntry.direction"
|
||||
data="$ctrl.entryDirections"
|
||||
select-fields="['code','description']"
|
||||
show-field="description"
|
||||
value-field="code"
|
||||
required="true">
|
||||
</vn-autocomplete>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Save</button>
|
||||
</tpl-buttons>
|
||||
</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>
|
||||
|
||||
<!-- 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"
|
||||
data="$ctrl.entryDirections"
|
||||
select-fields="['code','description']"
|
||||
show-field="description"
|
||||
value-field="code">
|
||||
</vn-autocomplete>
|
||||
<vn-icon-button vn-none
|
||||
icon="check"
|
||||
vn-tooltip="Save"
|
||||
ng-click="$ctrl.save()">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
</vn-popover>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="reason"
|
||||
on-accept="$ctrl.isUnsatisfied()">
|
||||
<tpl-body>
|
||||
<div class="reasonDialog">
|
||||
<vn-textarea
|
||||
label="Reason"
|
||||
ng-model="$ctrl.reason"
|
||||
disabled="!$ctrl.isHimSelf"
|
||||
rows="5"
|
||||
required="true">
|
||||
</vn-textarea>
|
||||
</div>
|
||||
</tpl-body>
|
||||
<tpl-buttons ng-if="$ctrl.isHimSelf">
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Save</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="sendEmailConfirmation"
|
||||
on-accept="$ctrl.resendEmail()"
|
||||
message="Send time control email">
|
||||
<tpl-body>
|
||||
<span translate>Are you sure you want to send it?</span>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Confirm</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
</div>
|
||||
<div
|
||||
ng-if="!$ctrl.worker.hasWorkCenter"
|
||||
ng-if="!$ctrl.card.hasWorkCenter"
|
||||
class="bg-title"
|
||||
translate>
|
||||
Autonomous worker
|
||||
</div>
|
||||
|
||||
<vn-side-menu side="right">
|
||||
<div class="vn-pa-md">
|
||||
<div class="totalBox" style="text-align: center;">
|
||||
<h6 translate>Hours</h6>
|
||||
<vn-label-value
|
||||
label="Week total"
|
||||
value="{{$ctrl.weekTotalHours}} h.">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Finish at"
|
||||
value="{{$ctrl.getFinishTime()}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
<vn-calendar
|
||||
vn-id="calendar"
|
||||
class="vn-pt-md"
|
||||
ng-model="$ctrl.date"
|
||||
format-week="$ctrl.formatWeek($element)"
|
||||
on-move="$ctrl.getMailStates($date)"
|
||||
has-events="$ctrl.hasEvents($day)">
|
||||
</vn-calendar>
|
||||
</div>
|
||||
</vn-side-menu>
|
||||
<vn-dialog
|
||||
vn-id="addTimeDialog"
|
||||
on-accept="$ctrl.addTime()"
|
||||
message="Add time">
|
||||
<tpl-body>
|
||||
<vn-input-time
|
||||
vn-one
|
||||
vn-focus
|
||||
ng-model="$ctrl.newTimeEntry.timed"
|
||||
label="Hour"
|
||||
required="true">
|
||||
</vn-input-time>
|
||||
<vn-autocomplete
|
||||
label="Type"
|
||||
ng-model="$ctrl.newTimeEntry.direction"
|
||||
data="$ctrl.entryDirections"
|
||||
select-fields="['code','description']"
|
||||
show-field="description"
|
||||
value-field="code"
|
||||
required="true">
|
||||
</vn-autocomplete>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Save</button>
|
||||
</tpl-buttons>
|
||||
</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>
|
||||
|
||||
<!-- 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"
|
||||
data="$ctrl.entryDirections"
|
||||
select-fields="['code','description']"
|
||||
show-field="description"
|
||||
value-field="code">
|
||||
</vn-autocomplete>
|
||||
<vn-icon-button vn-none
|
||||
icon="check"
|
||||
vn-tooltip="Save"
|
||||
ng-click="$ctrl.save()">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
</vn-popover>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="reason"
|
||||
on-accept="$ctrl.isUnsatisfied()">
|
||||
<tpl-body>
|
||||
<div class="reasonDialog">
|
||||
<vn-textarea
|
||||
label="Reason"
|
||||
ng-model="$ctrl.reason"
|
||||
disabled="!$ctrl.isHimSelf"
|
||||
rows="5"
|
||||
required="true">
|
||||
</vn-textarea>
|
||||
</div>
|
||||
</tpl-body>
|
||||
<tpl-buttons ng-if="$ctrl.isHimSelf">
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Save</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="sendEmailConfirmation"
|
||||
on-accept="$ctrl.resendEmail()"
|
||||
message="Send time control email">
|
||||
<tpl-body>
|
||||
<span translate>Are you sure you want to send it?</span>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Confirm</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue