[review, add time modal]

This commit is contained in:
romankko2 committed 2023-01-13 15:41:57 +01:00
1 parent 90cd75349c
commit 17a044b118
19 files changed
+228 -158

No files matched your search

@@ -15,16 +15,16 @@ export default {
ZMasterTaskModal
},
// Kravarik: Prepisat propy na objektovy zapis
props: ['events', 'month'],
props: {
events: {
required: true
},
methods: {
editTask(masterTask, editMode) {
this.$refs['z-master-task-modal'].create(masterTask, editMode)
month: {
required: true
}
},
// Kravarik: Comuted ma byt za data hned
computed: {
calendarOptions() {
return {
@@ -36,31 +36,34 @@ export default {
firstDay: 1,
dayHeaderClassNames: ['w-day-header'],
events: this.events,
// Kravarik: Skus toto prepisat na arrow function ako je v eventClick
eventContent: function (eventInfo) {
eventContent: (eventInfo) => {
return { html: eventInfo.event.extendedProps.title_html }
},
eventClick: (info) => {
this.editTask(info.event._def.publicId, false)
return this.editTask(info.event._def.publicId, false)
}
}
}
},
// Kravarik: Toto nechat na konci
mounted() {
const currentYear = new Date().getFullYear()
this.calendarOptions.events = this.events
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, this.month, 1))
},
methods: {
editTask(masterTask, editMode) {
this.$refs['z-master-task-modal'].create(masterTask, editMode)
}
},
watch: {
month(selectedMonth) {
const currentYear = new Date().getFullYear()
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, selectedMonth, 1))
}
},
// Kravarik: Posunut nad methods
mounted() {
const currentYear = new Date().getFullYear()
this.calendarOptions.events = this.events
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, this.month, 1))
}
}
</script>
<style lang="sass" scoped>
@@ -93,12 +96,17 @@ export default {
&:deep(.fc-day-today)
background: white
a
background: #3700B3
width: 32px
height: 32px
color: white
text-align: center
border-radius: 50%
border: 5px solid white
line-height: 15px
background: #3700B3
width: 28px
color: white
text-align: center
border-radius: 50%
height: 28px
line-height: 27px
position: relative
padding: 0
margin: 0
border: none
top: 2px
right: 4px
</style>
@@ -17,6 +17,10 @@
<script>
export default {
emits: ['filterChanged'],
props: ['projects', 'teams', 'employees'],
data() {
return {
months: [
@@ -43,12 +47,6 @@ export default {
}
},
// Kravarik: Props hodit nad data
props: ['projects', 'teams', 'employees'],
// Kravarik: Emits ma byt uplne prve
emits: ['filterChanged'],
watch: {
filter: {
handler() {
@@ -1,8 +1,7 @@
<template>
<div>
<!-- Kravarik: Dat velke A -->
<a-project-filter :projects="projects" @filterChanged="onFilterChanged"></a-project-filter>
<a-project-calendar :events="filteredEvents" :month="filter.selectedMonth"></a-project-calendar>
<A-project-filter :projects="projects" @filterChanged="onFilterChanged" />
<A-project-calendar :events="filteredEvents" :month="filterSettings.selectedMonth" />
</div>
</template>
@@ -17,8 +16,7 @@ export default {
},
data() {
return {
// Kravarik: Toto premenuj na nejaky filterSettings alebo co to je
filter: {
filterSettings: {
selectedEmployee: null,
selectedMonth: new Date().getMonth(),
selectedProject: null,
@@ -33,22 +31,23 @@ export default {
}
},
async created() {
// Kravarik: Toto preco nieje v trycatch?
const events = await this.$axios.get_auth_data('v1/overview/projects')
// Kravarik: Nemusis nahodou z map returnovat? Ci ked {} obalis to () tak nemusis potom?
this.events = events.map((item) => ({
id: item.id,
title: `${item.project_code} - ${item.name}`,
title_html: `${item.project_code} - <b>${item.name}</b>`,
start: item.starts_at,
end: item.deadline,
is_finished: item.is_finished,
project_code: item.project_code,
backgroundColor: item.color,
borderColor: item.color
}))
try {
const events = await this.$axios.get_auth_data('v1/overview/projects')
this.events = events.map((item) => ({
id: item.id,
title: `${item.project_code} - ${item.name}`,
title_html: `${item.project_code} - <b>${item.name}</b>`,
start: item.starts_at,
end: item.deadline,
is_finished: item.is_finished,
project_code: item.project_code,
backgroundColor: item.color,
borderColor: item.color
}))
this.filteredEvents = this.events.filter((item) => !item.is_finished)
} catch (error) {
this.$toast.error(error)
}
},
methods: {
// Kravarik: TODO prepojit filtrovanie na BE