Refactored Schedule.vue contain more than one month. Started working on selecting cells.

This commit is contained in:
Sockenklaus
2021-10-11 00:00:44 +02:00
parent 0e64a815ea
commit 9d8b3c27a2
3 changed files with 184 additions and 101 deletions

View File

@@ -2,8 +2,7 @@
MonthPicker(:selectedMonth="selectedMonth" :selectedYear="selectedYear" @getMonth="selectedMonth = $event" @getYear="selectedYear = $event")
div(class="mt-5" v-for="(month, index) in months" :key="index")
Schedule( :startDate="months[index]" :initialOffset="iOffsets[index]")
Schedule( :startDate="new Date(selectedYear, selectedMonth)")
</template>
@@ -15,24 +14,4 @@ div(class="mt-5" v-for="(month, index) in months" :key="index")
const selectedMonth = ref(getMonth(new Date()))
const selectedYear = ref(getYear(new Date()))
const months = computed(() => {
return eachMonthOfInterval({
start: new Date(selectedYear.value, selectedMonth.value),
end : new Date(selectedYear.value, selectedMonth.value + 2)
})
})
const iOffsets = computed(() => {
let arr : number[] = []
arr.push(0)
months.value.forEach(month => {
if ( getDaysInMonth(month) + getISODay(month) - 1 + arr[arr.length - 1] > 34) {
arr.push(7)
}
else arr.push(0)
})
return arr
})
</script>