1361 - Añadir filtro por año #348

Merged
joan merged 16 commits from 1361-calendar_date_filter into dev 2020-08-18 12:18:41 +00:00
3 changed files with 33 additions and 0 deletions
Showing only changes of commit 7833b87475 - Show all commits

View File

@ -29,6 +29,15 @@
{{'of' | translate}} {{$ctrl.calendar.totalHolidays}} {{'days' | translate}}
</div>
</div>
<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>
</div>
<div class="vn-pt-md" style="overflow: hidden;">
<vn-chip ng-repeat="absenceType in absenceTypes" ng-class="::{'selectable': $ctrl.isSubordinate}"
ng-click="$ctrl.pick(absenceType)">

View File

@ -7,6 +7,18 @@ class Controller extends Section {
super($element, $);
this.date = new Date();
this.events = {};
this.buildYearFilter();
}
get year() {
return this.date.getFullYear();
}
set year(value) {
const newYear = new Date();
newYear.setFullYear(value);
this.date = newYear;
}
get date() {
@ -50,6 +62,17 @@ class Controller extends Section {
}
}
buildYearFilter() {
const currentYear = new Date().getFullYear();
const minRange = currentYear - 5;
const years = [];
for (let i = currentYear; i > minRange; i--)
years.push({year: i});
this.yearFilter = years;
}
getIsSubordinate() {
this.$http.get(`Workers/${this.worker.id}/isSubordinate`).then(res =>
this.isSubordinate = res.data

View File

@ -1,6 +1,7 @@
Calendar: Calendario
Holidays: Vacaciones
Used: Utilizados
Year: Año
of: de
days: días
Choose an absence type from the right menu: Elige un tipo de ausencia desde el menú de la derecha