[project overview calendar] added year filter

This commit is contained in:
JakubPapso committed 2024-03-08 13:32:40 +01:00
1 parent f13afeb72e
commit 328eb36dfe
4 files changed
+28 -8

No files matched your search

@@ -21,6 +21,10 @@ export default {
month: {
required: true
},
year: {
required: true
}
},
@@ -44,17 +48,19 @@ export default {
},
mounted() {
const currentYear = new Date().getFullYear()
const monthIndex = typeof this.month == 'string' ? parseInt(this.month) - 1 : this.month - 1
this.calendarOptions.events = this.events
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, monthIndex, 1))
this.$refs.fullCalendar?.getApi().gotoDate(new Date(this.year, monthIndex, 1))
},
watch: {
month(selectedMonth) {
const currentYear = new Date().getFullYear()
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, selectedMonth, 1))
}
this.$refs.fullCalendar?.getApi().gotoDate(new Date(this.year, selectedMonth, 1))
},
year(selectedYear) {
this.$refs.fullCalendar?.getApi().gotoDate(new Date(selectedYear, this.month, 1))
},
},
}
</script>
@@ -10,6 +10,8 @@
<v-select v-model="filter.month" class="subheader-input" :items="months" label="Mesiac" variant="outlined" />
<v-select v-model="filter.year" class="subheader-input" :items="years" label="Rok" variant="outlined" />
<div class="subheader-input switch">
<p class="switch-label">Zobraziť ukončené</p>
<v-switch v-model="filter.isFinished" color="#6200EE" hide-details></v-switch>
@@ -50,6 +52,7 @@ export default {
employeeId: null,
createdById: null,
month: null,
year: new Date().getFullYear(),
isFinished: false
}
}
@@ -87,6 +90,16 @@ export default {
return normalizedProjectCode.toLowerCase().includes(normalizedInput.toLowerCase())
})
return projects?.length ? projects.slice(0, 10) : this.projects.slice(0, 10)
},
years() {
const years = []
const currentYear = new Date().getFullYear()
for (let i = 0; i < 100; i++)
years.push({ title: currentYear - i, value: currentYear - i })
return years
}
},
@@ -3,7 +3,7 @@
<A-project-filter v-if="$store.getters['tm/isInitialized']" @filterChanged="onFilterChanged" />
<W-loadable class="non-projects" :content="filteredProjects" emptyMessage="Nenašli sa žiadne vyhovujúce projekty">
<A-project-calendar :events="filteredProjects" :month="filter.month" @open-detail="openMasterTaskModal" />
<A-project-calendar :events="filteredProjects" :month="filter.month" :year="filter.year" @open-detail="openMasterTaskModal" />
</W-loadable>
</div>
</template>
@@ -108,7 +108,8 @@ export default {
if (filter.teamId) urlQueryObject.team_id = filter.teamId
if (filter.createdById) urlQueryObject.created_by = filter.createdById
if (filter.isFinished) urlQueryObject.is_finished = filter.isFinished ? 1 : 0
if (filter.month) urlQueryObject.created_at = filter.month
if (filter.month) urlQueryObject.month = filter.month
if (filter.year) urlQueryObject.year = filter.year
const queryParameters = new URLSearchParams(urlQueryObject).toString()