5688-worker.calendar_workCenter #1580

Merged
vicent merged 11 commits from 5688-worker.calendar_workCenter into dev 2023-06-28 11:38:50 +00:00
6 changed files with 327 additions and 305 deletions
Showing only changes of commit b7b6f413ba - Show all commits

View File

@ -1,9 +1,10 @@
<vn-crud-model <div ng-if="$ctrl.worker.hasWorkCenter">
<vn-crud-model
url="AbsenceTypes" url="AbsenceTypes"
data="absenceTypes" data="absenceTypes"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<div class="vn-w-lg"> <div class="vn-w-lg">
<vn-card class="vn-pa-sm calendars"> <vn-card class="vn-pa-sm calendars">
<vn-icon ng-if="::$ctrl.isSubordinate" icon="info" color-marginal <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"> 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)"> on-selection="$ctrl.onSelection($event, $days)">
</vn-calendar> </vn-calendar>
</vn-card> </vn-card>
</div> </div>
<vn-side-menu side="right"> <vn-side-menu side="right">
<div class="vn-pa-md"> <div class="vn-pa-md">
<div class="totalBox vn-mb-sm" style="text-align: center;"> <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> <div>
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
@ -96,9 +97,16 @@
</vn-chip> </vn-chip>
</div> </div>
</div> </div>
</vn-side-menu> </vn-side-menu>
<vn-confirm <vn-confirm
vn-id="confirm" vn-id="confirm"
message="This item will be deleted" message="This item will be deleted"
question="Are you sure you want to continue?"> 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) { set worker(value) {
this._worker = value; this._worker = value;
if (value && value.hasWorkCenter) {
if (value) {
this.getIsSubordinate(); this.getIsSubordinate();
this.getActiveContract(); 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 You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual
Current day: Día actual Current day: Día actual
Paid holidays: Vacaciones pagadas 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}) this.$http.get(`Workers/${this.$params.id}`, {filter})
.then(res => this.worker = res.data); .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" filter="::$ctrl.filter"
data="$ctrl.hours"> data="$ctrl.hours">
</vn-crud-model> </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-table model="model" auto-load="false">
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
@ -76,9 +77,9 @@
</vn-tr> </vn-tr>
</vn-tfoot> </vn-tfoot>
</vn-table> </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 <vn-button
label="Satisfied" label="Satisfied"
disabled="$ctrl.state == 'CONFIRMED'" disabled="$ctrl.state == 'CONFIRMED'"
@ -103,9 +104,9 @@
vn-tooltip="Resend email of this week to the user" vn-tooltip="Resend email of this week to the user"
ng-show="::$ctrl.isHr"> ng-show="::$ctrl.isHr">
</vn-button> </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="vn-pa-md">
<div class="totalBox" style="text-align: center;"> <div class="totalBox" style="text-align: center;">
<h6 translate>Hours</h6> <h6 translate>Hours</h6>
@ -127,8 +128,8 @@
has-events="$ctrl.hasEvents($day)"> has-events="$ctrl.hasEvents($day)">
</vn-calendar> </vn-calendar>
</div> </div>
</vn-side-menu> </vn-side-menu>
<vn-dialog <vn-dialog
vn-id="addTimeDialog" vn-id="addTimeDialog"
on-accept="$ctrl.addTime()" on-accept="$ctrl.addTime()"
message="Add time"> message="Add time">
@ -154,16 +155,16 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/> <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button> <button response="accept" translate>Save</button>
</tpl-buttons> </tpl-buttons>
</vn-dialog> </vn-dialog>
<vn-confirm <vn-confirm
vn-id="delete-entry-dialog" vn-id="delete-entry-dialog"
on-accept="$ctrl.deleteTimeEntry()" on-accept="$ctrl.deleteTimeEntry()"
message="This time entry will be deleted" message="This time entry will be deleted"
question="Are you sure you want to delete this entry?"> question="Are you sure you want to delete this entry?">
</vn-confirm> </vn-confirm>
<!-- Edit entry Popover --> <!-- Edit entry Popover -->
<vn-popover vn-id="editEntry"> <vn-popover vn-id="editEntry">
<vn-horizontal class="vn-pa-sm edit-time-entry"> <vn-horizontal class="vn-pa-sm edit-time-entry">
<vn-autocomplete class="dense" <vn-autocomplete class="dense"
ng-model="$ctrl.selectedRow.direction" ng-model="$ctrl.selectedRow.direction"
@ -178,9 +179,9 @@
ng-click="$ctrl.save()"> ng-click="$ctrl.save()">
</vn-icon-button> </vn-icon-button>
</vn-horizontal> </vn-horizontal>
</vn-popover> </vn-popover>
<vn-dialog <vn-dialog
vn-id="reason" vn-id="reason"
on-accept="$ctrl.isUnsatisfied()"> on-accept="$ctrl.isUnsatisfied()">
<tpl-body> <tpl-body>
@ -198,9 +199,9 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/> <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button> <button response="accept" translate>Save</button>
</tpl-buttons> </tpl-buttons>
</vn-dialog> </vn-dialog>
<vn-dialog <vn-dialog
vn-id="sendEmailConfirmation" vn-id="sendEmailConfirmation"
on-accept="$ctrl.resendEmail()" on-accept="$ctrl.resendEmail()"
message="Send time control email"> message="Send time control email">
@ -211,4 +212,11 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/> <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Confirm</button> <button response="accept" translate>Confirm</button>
</tpl-buttons> </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() { getAbsences() {
if (!this.card.worker.hasWorkerCenter) return;
const fullYear = this.started.getFullYear(); const fullYear = this.started.getFullYear();
let params = { let params = {
workerFk: this.$params.id, workerFk: this.$params.id,
@ -485,5 +486,8 @@ ngModule.vnComponent('vnWorkerTimeControl', {
controller: Controller, controller: Controller,
bindings: { bindings: {
worker: '<' worker: '<'
},
require: {
card: '^vnWorkerCard'
} }
}); });