Worker calendar rework #645
|
@ -888,7 +888,7 @@ export default {
|
||||||
},
|
},
|
||||||
workerCalendar: {
|
workerCalendar: {
|
||||||
year: 'vn-worker-calendar vn-autocomplete[ng-model="$ctrl.year"]',
|
year: 'vn-worker-calendar vn-autocomplete[ng-model="$ctrl.year"]',
|
||||||
totalHolidaysUsed: 'vn-worker-calendar div.totalBox > div',
|
totalHolidaysUsed: 'vn-worker-calendar div.totalBox:first-child > div',
|
||||||
penultimateMondayOfJanuary: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(22) > div',
|
penultimateMondayOfJanuary: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(22) > div',
|
||||||
lastMondayOfMarch: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div',
|
lastMondayOfMarch: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div',
|
||||||
fistMondayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div',
|
fistMondayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div',
|
||||||
|
@ -896,11 +896,11 @@ export default {
|
||||||
secondTuesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div',
|
secondTuesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div',
|
||||||
secondWednesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div',
|
secondWednesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div',
|
||||||
secondThursdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div',
|
secondThursdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div',
|
||||||
holidays: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(1)',
|
holidays: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(1)',
|
||||||
absence: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(2)',
|
absence: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(2)',
|
||||||
halfHoliday: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(3)',
|
halfHoliday: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(3)',
|
||||||
furlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(4)',
|
furlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(4)',
|
||||||
halfFurlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(5)',
|
halfFurlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(5)',
|
||||||
},
|
},
|
||||||
invoiceOutIndex: {
|
invoiceOutIndex: {
|
||||||
topbarSearch: 'vn-searchbar',
|
topbarSearch: 'vn-searchbar',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
fdescribe('Worker calendar path', () => {
|
describe('Worker calendar path', () => {
|
||||||
let reasonableTimeBetweenClicks = 400;
|
let reasonableTimeBetweenClicks = 400;
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</tpl-item>
|
</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</div>
|
</div>
|
||||||
<div class="input vn-py-md" style="overflow: hidden;">
|
<div name="absenceTypes" class="input vn-py-md" style="overflow: hidden;">
|
||||||
<vn-chip ng-repeat="absenceType in absenceTypes" ng-class="::{'selectable': $ctrl.isSubordinate}"
|
<vn-chip ng-repeat="absenceType in absenceTypes" ng-class="::{'selectable': $ctrl.isSubordinate}"
|
||||||
ng-click="$ctrl.pick(absenceType)">
|
ng-click="$ctrl.pick(absenceType)">
|
||||||
<vn-avatar
|
<vn-avatar
|
||||||
|
|
|
@ -13,6 +13,19 @@ class Controller extends Section {
|
||||||
this.date = new Date();
|
this.date = new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get worker() {
|
||||||
|
return this._worker;
|
||||||
|
}
|
||||||
|
|
||||||
|
set worker(value) {
|
||||||
|
this._worker = value;
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
this.getActiveContract()
|
||||||
|
.then(() => this.getAbsences());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current selected date
|
* The current selected date
|
||||||
*/
|
*/
|
||||||
|
@ -70,6 +83,11 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getActiveContract() {
|
||||||
|
return this.$http.get(`Workers/${this.worker.id}/activeContract`)
|
||||||
|
.then(res => this.businessId = res.data.businessFk);
|
||||||
|
}
|
||||||
|
|
||||||
fetchHours() {
|
fetchHours() {
|
||||||
const params = {workerFk: this.$params.id};
|
const params = {workerFk: this.$params.id};
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -80,7 +98,6 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
this.$.model.applyFilter(filter, params).then(() => {
|
this.$.model.applyFilter(filter, params).then(() => {
|
||||||
this.getWorkedHours(this.started, this.ended);
|
this.getWorkedHours(this.started, this.ended);
|
||||||
this.getAbsences();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,10 +106,10 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbsences() {
|
getAbsences() {
|
||||||
|
const fullYear = this.started.getFullYear();
|
||||||
let params = {
|
let params = {
|
||||||
workerFk: this.$params.id,
|
businessFk: this.businessId,
|
||||||
started: this.started,
|
year: fullYear
|
||||||
ended: this.ended
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.$http.get(`Calendars/absences`, {params})
|
return this.$http.get(`Calendars/absences`, {params})
|
||||||
|
@ -257,5 +274,8 @@ Controller.$inject = ['$element', '$scope', 'vnWeekDays'];
|
||||||
|
|
||||||
ngModule.vnComponent('vnWorkerTimeControl', {
|
ngModule.vnComponent('vnWorkerTimeControl', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
worker: '<'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue