From b56287c535e55d6b94539142a05335ffb780bff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Kalu=C5=BEa?= Date: Mon, 9 Jan 2023 16:00:25 +0100 Subject: [PATCH 1/5] [timeline] dynamicke tyzdne, non-working hours --- app/public/mock/v1/overview/tasks.GET.json | 39 ++++----- app/src/plugins/app@vendor/vue-cal/event.vue | 3 +- app/src/plugins/app@vendor/vue-cal/index.vue | 7 +- .../tasks/_components/a-tasks-filter.vue | 4 +- .../tasks/_components/z-timeline.vue | 83 +++++++++++++------ app/src/plugins/tm@dashboard/tasks/tasks.vue | 75 +++++++++++++++-- app/src/plugins/tm@dashboard/teams/teams.vue | 6 ++ 7 files changed, 156 insertions(+), 61 deletions(-) diff --git a/app/public/mock/v1/overview/tasks.GET.json b/app/public/mock/v1/overview/tasks.GET.json index ed8f7a7..8d9873c 100644 --- a/app/public/mock/v1/overview/tasks.GET.json +++ b/app/public/mock/v1/overview/tasks.GET.json @@ -39,9 +39,9 @@ { "id": 1, "task_id": 1, - "starts_at": "2023-01-03T08:01:00+00:00", - "ends_at": "2023-01-03T09:00:00+00:00", - "title": "Task 1", + "starts_at": "2023-01-08T08:01:00+00:00", + "ends_at": "2023-01-08T09:00:00+00:00", + "title": "Task DNES", "project_code": "CO-2201", "master_task_color": "#E9FFE6" }, @@ -49,8 +49,8 @@ { "id": 2, "task_id": 2, - "starts_at": "2023-01-03T08:30:00+00:00", - "ends_at": "2023-01-03T09:00:00+00:00", + "starts_at": "2023-01-08T08:30:00+00:00", + "ends_at": "2023-01-08T09:00:00+00:00", "title": "Kratky 30min Lorem ipsum dolor sit amet, consectetur adipiscing e", "project_code": "CO-2201", "master_task_color": "#f27e57" @@ -59,8 +59,8 @@ { "id": 3, "task_id": 3, - "starts_at": "2023-01-03T10:30:00+00:00", - "ends_at": "2023-01-03T10:45:00+00:00", + "starts_at": "2023-01-08T10:30:00+00:00", + "ends_at": "2023-01-08T10:45:00+00:00", "title": "Kratky 15min", "project_code": "CO-2201", "master_task_color": "#57e0f2" @@ -69,8 +69,8 @@ { "id": 4, "task_id": 4, - "starts_at": "2023-01-03T08:00:00+00:00", - "ends_at": "2023-01-03T10:00:00+00:00", + "starts_at": "2023-01-08T08:00:00+00:00", + "ends_at": "2023-01-08T10:00:00+00:00", "title": "Task 2", "project_code": "CO-2201", "master_task_color": "#FDE1FF" @@ -79,8 +79,8 @@ { "id": 6, "task_id": 6, - "starts_at": "2023-01-04T09:00:00+00:00", - "ends_at": "2023-01-04T12:00:00+00:00", + "starts_at": "2023-01-09T09:00:00+00:00", + "ends_at": "2023-01-09T12:00:00+00:00", "title": "Task 6", "project_code": "CO-2201", "master_task_color": "#57e0f2" @@ -89,8 +89,8 @@ { "id": 7, "task_id": 7, - "starts_at": "2023-01-05T12:00:00+00:00", - "ends_at": "2023-01-05T16:00:00+00:00", + "starts_at": "2023-01-10T12:00:00+00:00", + "ends_at": "2023-01-10T16:00:00+00:00", "title": "Task 7", "project_code": "CO-2201", "master_task_color": "#E7DBF8" @@ -99,8 +99,8 @@ { "id": 8, "task_id": 8, - "starts_at": "2023-01-03T07:00:00+00:00", - "ends_at": "2023-01-03T09:00:00+00:00", + "starts_at": "2023-01-08T07:00:00+00:00", + "ends_at": "2023-01-08T09:00:00+00:00", "title": "Task 8", "project_code": "CO-2201", "master_task_color": "#57e0f2" @@ -109,8 +109,8 @@ { "id": 9, "task_id": 9, - "starts_at": "2023-01-04T09:00:00+00:00", - "ends_at": "2023-01-04T12:00:00+00:00", + "starts_at": "2023-01-09T09:00:00+00:00", + "ends_at": "2023-01-09T12:00:00+00:00", "title": "Task 9", "project_code": "CO-2201", "master_task_color": "#E9FFE6" @@ -119,12 +119,13 @@ { "id": 10, "task_id": 10, - "starts_at": "2023-01-03T12:00:00+00:00", - "ends_at": "2023-01-03T13:00:00+00:00", + "starts_at": "2023-01-08T12:00:00+00:00", + "ends_at": "2023-01-08T13:00:00+00:00", "title": "Task 10", "project_code": "CO-2201", "master_task_color": "#57e0f2" } + ] }, "status": 200 diff --git a/app/src/plugins/app@vendor/vue-cal/event.vue b/app/src/plugins/app@vendor/vue-cal/event.vue index ca6b7b9..f352468 100644 --- a/app/src/plugins/app@vendor/vue-cal/event.vue +++ b/app/src/plugins/app@vendor/vue-cal/event.vue @@ -157,9 +157,8 @@ export default { }, onDragStart(e) { - console.log(`ID from dragStart: ${this.event.id}`) + if (this.event.nonWorking) return this.event.draggingStatic = false - this.dnd && this.dnd.eventDragStart(e, this.event); }, diff --git a/app/src/plugins/app@vendor/vue-cal/index.vue b/app/src/plugins/app@vendor/vue-cal/index.vue index 7db0629..6d928bc 100644 --- a/app/src/plugins/app@vendor/vue-cal/index.vue +++ b/app/src/plugins/app@vendor/vue-cal/index.vue @@ -16,7 +16,7 @@ - -
+
{{ split.label }}
@@ -1307,7 +1307,8 @@ export default { } this.$refs['vuecal_scroll'].addEventListener('scroll', () => { - this.$refs['vuecal_weekday_heading'].onTimelineScroll(this.$refs['vuecal_scroll'].scrollTop) + // this.$refs['vuecal_splits_heading'].onTimelineScroll(this.$refs['vuecal_scroll'].scrollTop) + this.$refs['vuecal_splits_heading'].style.top = `${this.$refs['vuecal_scroll'].scrollTop}px` }) this.viewportTimelineOffset = this.$refs['vuecal_scroll'].getBoundingClientRect().top diff --git a/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue b/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue index b965b4c..c2335c1 100644 --- a/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue +++ b/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue @@ -47,8 +47,8 @@ export default { methods: { getWeek() { - this.firstDay = addDays(startOfWeek(this.date), 1) - this.lastDay = addDays(endOfWeek(this.date), 1) + this.firstDay = subDays(this.date, 1) + this.lastDay = addDays(this.date, 5) this.$emit('weekChange', {firstDay: this.firstDay, lastDay: this.lastDay}) this.selectedDate = String(this.firstDay.toLocaleDateString('sk-SK') + ' - ' + this.lastDay.toLocaleDateString('sk-SK')) diff --git a/app/src/plugins/tm@dashboard/tasks/_components/z-timeline.vue b/app/src/plugins/tm@dashboard/tasks/_components/z-timeline.vue index 5e475a2..d3c02fc 100644 --- a/app/src/plugins/tm@dashboard/tasks/_components/z-timeline.vue +++ b/app/src/plugins/tm@dashboard/tasks/_components/z-timeline.vue @@ -3,7 +3,8 @@ - @@ -146,10 +146,6 @@ export default { weekChanged() { const scrollContainer = document.getElementsByClassName('vuecal__scrollable-body')[0] scrollContainer.scrollLeft = 0 - - this.$nextTick(() => { - this.scrollToYesterday() - }) }, async eventMoved(e) { @@ -206,6 +202,14 @@ export default { this.focusedEventId = event.task_id // console.log(`Focused: ${event.task_id}`) }, + + completeTask(id) { + this.$emit('completeTask', id) + }, + + deleteTask(id) { + this.$emit('deleteTask', id) + } } } @@ -335,6 +339,9 @@ export default { min-height: 40px transition: min-height .4s, height .4s, box-shadow .4s, width .4s, left .4s + // &:has(.completed) + // filter: grayscale(.9) !important + &:has(.non-working-event) background: repeating-linear-gradient(135deg, rgba(215, 215, 215, 1), rgba(215, 215, 215, 1) 1px, rgba(224, 224, 224, 1) 1px, rgba(224, 224, 224, 1) 20px) border: 1px solid rgba(215, 215, 215, 1) @@ -441,6 +448,9 @@ export default { min-width: fit-content width: fit-content + &.completed + background: #00B3A6 + img width: 18px diff --git a/app/src/plugins/tm@dashboard/tasks/tasks.vue b/app/src/plugins/tm@dashboard/tasks/tasks.vue index ec8340e..5199dfa 100644 --- a/app/src/plugins/tm@dashboard/tasks/tasks.vue +++ b/app/src/plugins/tm@dashboard/tasks/tasks.vue @@ -3,7 +3,7 @@ - + { + if (task.id == id) { + task.completed = true + } + }) + }, + + deleteTask(id) { + this.timelineData.tasks.splice(this.timelineData.tasks.findIndex(item => item.id === id), 1) } } } diff --git a/app/src/plugins/tm@modal/task/z-complete-task-modal.vue b/app/src/plugins/tm@modal/task/z-complete-task-modal.vue index e78d170..f6438d1 100644 --- a/app/src/plugins/tm@modal/task/z-complete-task-modal.vue +++ b/app/src/plugins/tm@modal/task/z-complete-task-modal.vue @@ -44,6 +44,7 @@ export default { await this.$axios.post(`v1/tasks/${task.id}`, task) this.show = false + this.$emit('completeTask', task.id) } catch (error) { this.$toast.error(error) } diff --git a/app/src/plugins/tm@modal/task/z-delete-task-modal.vue b/app/src/plugins/tm@modal/task/z-delete-task-modal.vue index 116b1f3..5c4fea0 100644 --- a/app/src/plugins/tm@modal/task/z-delete-task-modal.vue +++ b/app/src/plugins/tm@modal/task/z-delete-task-modal.vue @@ -39,6 +39,7 @@ export default { try { await this.$axios.delete(`v1/tasks/${this.task.id}`) this.show = false + this.$emit('deleteTask', this.task.id) } catch (error) { this.$toast.error(error) }