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}} {{'of' | translate}} {{$ctrl.calendar.totalHolidays}} {{'days' | translate}}
</div> </div>
</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;"> <div class="vn-pt-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)">

View File

@ -7,6 +7,18 @@ class Controller extends Section {
super($element, $); super($element, $);
this.date = new Date(); this.date = new Date();
this.events = {}; 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() { 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() { getIsSubordinate() {
this.$http.get(`Workers/${this.worker.id}/isSubordinate`).then(res => this.$http.get(`Workers/${this.worker.id}/isSubordinate`).then(res =>
this.isSubordinate = res.data this.isSubordinate = res.data

View File

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