[napajanie modalov na BE]

This commit is contained in:
romankko2 committed 2023-01-26 21:11:53 +01:00
1 parent 26792a85a6
commit 4c8ee66cd6
34 files changed
+476 -378

No files matched your search

+1 -1
View File
@@ -1 +1 @@
VUE_APP_WAXIOS_URL=https://taskmanager.internal.studiotem.com/be/api/ VUE_APP_WAXIOS_URL=https://taskmanager.internal.studiotem.com/api/
+3 -3
View File
@@ -2,7 +2,7 @@
"data": [ "data": [
{ {
"id": 1, "id": 1,
"name": "Master task 1", "title": "Master task 1",
"description": "Toto je master task cislo 1", "description": "Toto je master task cislo 1",
"duration": 130000, "duration": 130000,
"time_worked": 0, "time_worked": 0,
@@ -38,7 +38,7 @@
}, },
{ {
"id": 2, "id": 2,
"name": "Master task cislo 2", "title": "Master task cislo 2",
"description": "Toto je master task cislo 2", "description": "Toto je master task cislo 2",
"duration": 100000, "duration": 100000,
"time_worked": 0, "time_worked": 0,
@@ -67,7 +67,7 @@
}, },
{ {
"id": 3, "id": 3,
"name": "Master task cislo 3", "title": "Master task cislo 3",
"description": "Toto je master task cislo 3", "description": "Toto je master task cislo 3",
"duration": 9500000, "duration": 9500000,
"time_worked": 0, "time_worked": 0,
@@ -29,6 +29,46 @@
"surname": "Gajdos" "surname": "Gajdos"
} }
], ],
"tasks": [
{
"id": 1,
"project_code": "CO-2201",
"title": "Nazov tasku 1 (Ongoing)",
"description": "Urna vitae, suscipit suspendisse lectus arcu, imperdiet. Vulputate sit nec ut et. Urna ut a ac amet, donec orci non. Posuere elit magna consequat volutpat bibendum. Accumsan gravida elit condimentum sed. Congue non, dictum nec accumsan egestas vel. Sed molestie pretium odio morbi. Amet nunc, diam ridiculus dis condimentum arcu. Rhoncus, elementum, quis aenean neque. Faucibus leo laoreet lobortis vitae elementum. Condimentum ornare iaculis in fames in ut sit enim.",
"duration": 5400000,
"spent_time": 3000000,
"is_finished": false,
"dates": [],
"master_task": {
"id": 1,
"title": "Master task 1",
"employees": [
{
"id": 1,
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 4,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 5,
"name": "Pavel",
"surname": "Gajdos"
}
]
},
"employee": {
"id": 1,
"duration": 1300000,
"name": "Viliam",
"surname": "Sedivy"
}
}
],
"files": [ "files": [
{ {
"content_type": "application/png", "content_type": "application/png",
+18 -41
View File
@@ -1,64 +1,41 @@
{ {
"data": { "data": {
"id": 1, "id": 1,
"description": "Urna vitae, suscipit suspendisse lectus arcu, imperdiet. Vulputate sit nec ut et. Urna ut a ac amet, donec orci non. Posuere elit magna consequat volutpat bibendum. Accumsan gravida elit condimentum sed. Congue non, dictum nec accumsan egestas vel. Sed molestie pretium odio morbi. Amet nunc, diam ridiculus dis condimentum arcu. Rhoncus, elementum, quis aenean neque. Faucibus leo laoreet lobortis vitae elementum. Condimentum ornare iaculis in fames in ut sit enim.",
"project_code": "CO-2201", "project_code": "CO-2201",
"master_task_id": 1, "title": "Nazov tasku 1 (Ongoing)",
"master_task": "Master task 1", "description": "Urna vitae, suscipit suspendisse lectus arcu, imperdiet. Vulputate sit nec ut et. Urna ut a ac amet, donec orci non. Posuere elit magna consequat volutpat bibendum. Accumsan gravida elit condimentum sed. Congue non, dictum nec accumsan egestas vel. Sed molestie pretium odio morbi. Amet nunc, diam ridiculus dis condimentum arcu. Rhoncus, elementum, quis aenean neque. Faucibus leo laoreet lobortis vitae elementum. Condimentum ornare iaculis in fames in ut sit enim.",
"team_id": 1, "duration": 5400000,
"team": { "spent_time": 3000000,
"is_finished": false,
"dates": [],
"master_task": {
"id": 1, "id": 1,
"name": "Team 1", "name": "Master task 1",
"employees": [ "employees": [
{ {
"id": 1, "id": 1,
"name": "Rastislav", "name": "Rastislav",
"surname": "Kuttner" "surname": "Kuttner"
}, },
{ {
"id": 2, "id": 4,
"name": "Lenka",
"surname": "Nemeckova"
},
{
"id": 3,
"name": "Peter",
"surname": "Bucan"
}
]
},
"employee_id": 1,
"assigned_employee": {
"id": 14,
"name": "Pavel",
"surname": "Gajdos"
},
"duration": 128,
"worked_time": 133,
"is_finished": false,
"starts_at": "2022-11-10T11:00:00+00:00",
"ends_at": "2022-11-12T16:00:00+00:00",
"employees": [
{
"id": 1,
"name": "Viliam", "name": "Viliam",
"surname": "Sedivy" "surname": "Sedivy"
}, },
{ {
"id": 4, "id": 5,
"name": "Pavel", "name": "Pavel",
"surname": "Gajdos" "surname": "Gajdos"
},
{
"id": 5,
"name": "Francesca",
"surname": "Spinelli"
} }
], ]
},
"employee": {
"id": 1,
"duration": 1300000,
"name": "Viliam",
"surname": "Sedivy"
},
"files": [ "files": [
{ {
"content_type": "application/pdf", "content_type": "application/pdf",
@@ -0,0 +1,96 @@
{
"data": {
"id": 1,
"description": "Urna vitae, suscipit suspendisse lectus arcu, imperdiet. Vulputate sit nec ut et. Urna ut a ac amet, donec orci non. Posuere elit magna consequat volutpat bibendum. Accumsan gravida elit condimentum sed. Congue non, dictum nec accumsan egestas vel. Sed molestie pretium odio morbi. Amet nunc, diam ridiculus dis condimentum arcu. Rhoncus, elementum, quis aenean neque. Faucibus leo laoreet lobortis vitae elementum. Condimentum ornare iaculis in fames in ut sit enim.",
"project_code": "CO-2201",
"master_task_id": 1,
"master_task": "Master task 1",
"team_id": 1,
"team": {
"id": 1,
"name": "Team 1",
"employees": [
{
"id": 1,
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 2,
"name": "Lenka",
"surname": "Nemeckova"
},
{
"id": 3,
"name": "Peter",
"surname": "Bucan"
}
]
},
"employee_id": 1,
"assigned_employee": {
"id": 14,
"name": "Pavel",
"surname": "Gajdos"
},
"duration": 128,
"worked_time": 133,
"is_finished": false,
"starts_at": "2022-11-10T11:00:00+00:00",
"ends_at": "2022-11-12T16:00:00+00:00",
"employees": [
{
"id": 1,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 4,
"name": "Pavel",
"surname": "Gajdos"
},
{
"id": 5,
"name": "Francesca",
"surname": "Spinelli"
}
],
"files": [
{
"content_type": "application/pdf",
"created_at": "2022-09-23 07:02:55",
"description": null,
"disk_name": "632d5a1924093750079385.pdf",
"extension": "pdf",
"name": "File1.pdf",
"file_size": 132385,
"google_file_id": "1TgBRHhX-JVc5mkREUmoCRO4Sta3diqjo",
"id": 265,
"path": "",
"sort_order": 265,
"title": null,
"updated_at": "2022-09-23 07:02:55"
},
{
"id":274,
"disk_name":"632d5a3a48955848077357.rar",
"name":"File2.rar",
"file_size":58231,
"content_type":"application\/x-rar",
"title":null,
"description":null,
"sort_order":274,
"created_at":"2022-09-23 07:03:29",
"updated_at":"2022-09-23 07:03:29",
"google_file_id":"1CD6P9fAmCRoZTmjc3JWi1ysVDLDSReId",
"path":"",
"extension":"rar"
}
]
},
"status": 200
}
File renamed without changes.
+81
View File
@@ -4,4 +4,85 @@
<router-view /> <router-view />
</v-main> </v-main>
</v-app> </v-app>
<Z-team-modal ref="z-team-modal" />
<Z-delete-team-modal ref="z-delete-team-modal" @deleted="onTeamDeleted" />
<Z-task-modal ref="z-task-modal" />
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted" />
<Z-complete-task-modal ref="z-complete-task-modal" />
<Z-task-add-time-modal ref="z-task-add-time-modal" />
<Z-blocker-modal ref="z-blocker-modal" />
<Z-master-task-modal ref="z-master-task-modal" />
</template> </template>
<script>
import ZDeleteTeamModal from '@/plugins/tm@modal/team/z-delete-team-modal.vue'
import ZTeamModal from '@/plugins/tm@modal/team/z-team-modal.vue'
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
import ZTaskModal from '@/plugins/tm@modal/task/z-task-modal.vue'
import ZCompleteTaskModal from '@/plugins/tm@modal/task/z-complete-task-modal.vue'
import ZTaskAddTimeModal from '@/plugins/tm@modal/task/z-task-add-time-modal.vue'
import ZBlockerModal from '@/plugins/tm@modal/blocker/z-blocker-modal.vue'
// import ZDeleteMasterTaskModal from '@/plugins/tm@modal/master-task/z-delete-task-modal.vue'
import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue'
export default {
components: {
ZDeleteTeamModal,
ZTeamModal,
ZDeleteTaskModal,
ZTaskModal,
ZMasterTaskModal,
ZCompleteTaskModal,
ZTaskAddTimeModal,
ZBlockerModal
},
mounted() {
this.$events.on('show-delete-team-modal', ({team}) => {
this.$refs['z-delete-team-modal'].showModal(team)
})
this.$events.on('show-team-modal', ({team}) => {
this.$refs['z-team-modal'].showModal(team)
})
this.$events.on('show-delete-task-modal', ({task}) => {
this.$refs['z-delete-task-modal'].showModal(task)
})
this.$events.on('show-task-modal', ({task, editMode}) => {
this.$refs['z-task-modal'].showModal(task, editMode)
})
this.$events.on('show-master-task-modal', ({task, editMode}) => {
this.$refs['z-master-task-modal'].showModal(task, editMode)
})
this.$events.on('show-complete-task-modal', ({task}) => {
this.$refs['z-complete-task-modal'].showModal(task)
})
this.$events.on('show-blocker-modal', ({blocker}) => {
this.$refs['z-blocker-modal'].showModal(blocker)
})
this.$events.on('show-task-add-time-modal', ({task}) => {
this.$refs['z-task-add-time-modal'].showModal(task)
})
},
methods: {
onTeamDeleted(team) {
this.$events.emit('on-team-deleted', team)
},
onTaskDeleted(task) {
this.$events.emit('on-task-deleted', task)
}
}
}
</script>
+4 -4
View File
@@ -48,7 +48,7 @@ const options: Options = {
'POST v1/auth/post': true, 'POST v1/auth/post': true,
'GET v1/master-tasks/(id)': true, 'GET v1/master-tasks/(id)': true,
'GET v1/master-tasks': true, // 'GET v1/master-tasks': true,
'POST v1/master-tasks/(id)': true, 'POST v1/master-tasks/(id)': true,
'DELETE v1/master-tasks/(id)': true, 'DELETE v1/master-tasks/(id)': true,
'POST v1/master-tasks': true, 'POST v1/master-tasks': true,
@@ -63,14 +63,14 @@ const options: Options = {
'POST v1/tasks/(id)': true, 'POST v1/tasks/(id)': true,
'DELETE v1/tasks/(id)': true, 'DELETE v1/tasks/(id)': true,
'GET v1/teams/(id)': false, // 'GET v1/teams/(id)': true,
'POST v1/teams/(id)': true, 'POST v1/teams/(id)': true,
'DELETE v1/teams/(id)': true, 'DELETE v1/teams/(id)': true,
// 'GET v1/teams': true, // 'GET v1/teams': true,
'GET v1/teamsx': true, // 'GET v1/teamsx': true,
'POST v1/teams': true, 'POST v1/teams': true,
'GET v1/employees': false, // 'GET v1/employees': true,
'GET v1/search': true, 'GET v1/search': true,
'POST v1/tasks': true, 'POST v1/tasks': true,
@@ -1,13 +1,13 @@
<template> <template>
<v-app-bar class="header"> <v-app-bar class="header">
<v-app-bar-nav-icon @click="eventBus.emit('toggle-menu')" class="menu-icon"></v-app-bar-nav-icon> <v-app-bar-nav-icon @click="$events.emit('toggle-menu')" class="menu-icon"></v-app-bar-nav-icon>
<div class="d-flex justify-space-between align-center w-100"> <div class="d-flex justify-space-between align-center w-100">
<h1>{{ $route.meta.title }}</h1> <h1>{{ $route.meta.title }}</h1>
<div class="d-flex justify-end align-center w-100 header-sm"> <div class="d-flex justify-end align-center w-100 header-sm">
<img class="search-icon" :src="require('@/plugins/app/_layout/app/_img/search-icon.svg')" alt="search-icon" /> <img class="search-icon" :src="require('@/plugins/app/_layout/app/_img/search-icon.svg')" alt="search-icon" />
<input class="search-input mx-2" v-model="search" type="text" placeholder="Search" @click="$router.push({name: 'Search'})" @keyup="eventBus.emit('onSearch', search)" /> <input class="search-input mx-2" v-model="search" type="text" placeholder="Search" @click="$router.push({name: 'Search'})" @keyup="$events.emit('onSearch', search)" />
<v-menu> <v-menu>
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
@@ -17,10 +17,10 @@
</template> </template>
<v-list> <v-list>
<v-list-item class="cursor-pointer hover-background" @click="createMasterTaskModal()">MASTER TASK</v-list-item> <v-list-item class="cursor-pointer hover-background" @click="createMasterTask()">MASTER TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createSubTaskModal()">SUB TASK</v-list-item> <v-list-item class="cursor-pointer hover-background" @click="createTask()">SUB TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createTeamModal()">TÍM</v-list-item> <v-list-item class="cursor-pointer hover-background" @click="createTeam()">TÍM</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createBlockerModal()">BLOCKER</v-list-item> <v-list-item class="cursor-pointer hover-background" @click="createBlocker()">BLOCKER</v-list-item>
</v-list> </v-list>
</v-menu> </v-menu>
@@ -50,27 +50,27 @@
</div> </div>
</div> </div>
<Z-master-task-modal ref="z-master-task-modal" /> <!-- <Z-master-task-modal ref="z-master-task-modal" />
<Z-sub-task-modal ref="z-sub-task-modal" /> <Z-sub-task-modal ref="z-sub-task-modal" />
<Z-blocker-modal ref="z-blocker-modal" /> <Z-blocker-modal ref="z-blocker-modal" />
<Z-team-modal ref="z-team-modal" /> <Z-team-modal ref="z-team-modal" /> -->
</v-app-bar> </v-app-bar>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import ZTeamModal from '@/plugins/tm@modal/team/z-team-modal.vue' // import ZTeamModal from '@/plugins/tm@modal/team/z-team-modal.vue'
import ZBlockerModal from '@/plugins/tm@modal/blocker/z-blocker-modal.vue' // import ZBlockerModal from '@/plugins/tm@modal/blocker/z-blocker-modal.vue'
import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue' // import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue'
import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue' // import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
export default { export default {
components: { // components: {
ZTeamModal, // ZTeamModal,
ZBlockerModal, // ZBlockerModal,
ZMasterTaskModal, // ZMasterTaskModal,
ZSubTaskModal // ZSubTaskModal
}, // },
data() { data() {
return { return {
@@ -93,20 +93,20 @@ export default {
} }
}, },
createTeamModal() { createMasterTask() {
this.$refs['z-team-modal'].create() this.$events.emit('show-master-task-modal', {})
}, },
createMasterTaskModal() { createTask() {
this.$refs['z-master-task-modal'].create() this.$events.emit('show-task-modal', {})
}, },
createSubTaskModal() { createTeam() {
this.$refs['z-sub-task-modal'].create() this.$events.emit('show-team-modal', {})
}, },
createBlockerModal() { createBlocker() {
this.$refs['z-blocker-modal'].create() this.$events.emit('show-blocker-modal', {})
} }
} }
} }
@@ -56,8 +56,8 @@ export default {
}, },
created() { created() {
this.eventBus.on("close-menu", () => this.closeMenu()) this.$events.on("close-menu", () => this.closeMenu())
this.eventBus.on("toggle-menu", () => this.toggleMenu()) this.$events.on("toggle-menu", () => this.toggleMenu())
this.unscheduledTasks() this.unscheduledTasks()
}, },
@@ -2,7 +2,7 @@
<ion-split-pane content-id="main-content"> <ion-split-pane content-id="main-content">
<A-sidemenu ref="sidemenu" /> <A-sidemenu ref="sidemenu" />
<v-app @click="eventBus.emit('close-menu')" class="split-pane-right-side"> <v-app @click="$events.emit('close-menu')" class="split-pane-right-side">
<A-header /> <A-header />
<div class="main-content"> <div class="main-content">
+2 -2
View File
@@ -29,14 +29,14 @@ export default {
this.$toast.error(error) this.$toast.error(error)
} }
this.eventBus.on('onSearch', (search) => { this.$events.on('onSearch', (search) => {
this.search = search this.search = search
}) })
}, },
methods: { methods: {
debounceSearch: debounce(function () { debounceSearch: debounce(function () {
this.search this.search()
}, 300), }, 300),
} }
} }
@@ -71,9 +71,9 @@
</div> </div>
<div class="event-footer d-flex"> <div class="event-footer d-flex">
<v-btn rounded class="event-footer-button me-2" :class="{'completed': event.completed}" @click.stop="clickCompleteTask(event)"><img :src="require('./_img/checkmark.svg')" alt=""></v-btn> <v-btn rounded class="event-footer-button me-2" :class="{'completed': event.completed}" @click.stop="completeTask(event)"><img :src="require('./_img/checkmark.svg')" alt=""></v-btn>
<v-btn rounded class="event-footer-button me-2" @click.stop="editTask(event.id, true)"><img :src="require('./_img/pencil.svg')" alt=""></v-btn> <v-btn rounded class="event-footer-button me-2" @click.stop="editTask(event, true)"><img :src="require('./_img/pencil.svg')" alt=""></v-btn>
<v-btn rounded class="event-footer-button me-2" @click.stop="showDeleteModal = {task: event}"><img :src="require('./_img/bin.svg')" alt=""></v-btn> <v-btn rounded class="event-footer-button me-2" @click.stop="deleteTask(event)"><img :src="require('./_img/bin.svg')" alt=""></v-btn>
</div> </div>
</div> </div>
@@ -85,30 +85,11 @@
</div> </div>
</template> </template>
</Vue-cal> </Vue-cal>
<!-- Kravarik: Prerobit modaly na novy sposob -->
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-complete-task-modal v-if="showCompleteModal" :visible="showCompleteModal ? true : false" :task="showCompleteModal.task" @completeTask="completeTask" @close="showCompleteModal = null" />
<Z-delete-task-modal v-if="showDeleteModal" :visible="showDeleteModal ? true : false" :task="showDeleteModal.task" @deleteTask="deleteTask" @close="showDeleteModal = null" />
<Z-add-time-task-modal ref="z-add-time-task-modal" />
</div> </div>
</template> </template>
<script> <script>
import ZCompleteTaskModal from '@/plugins/tm@modal/task/z-complete-task-modal.vue'
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
import ZAddTimeTaskModal from '@/plugins/tm@modal/sub-task/z-add-time-task-modal.vue'
import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
export default { export default {
components: {
ZCompleteTaskModal,
ZDeleteTaskModal,
ZAddTimeTaskModal,
ZSubTaskModal
},
props: { props: {
calData: { calData: {
type: Object, type: Object,
@@ -145,8 +126,6 @@ export default {
} }
}, },
focusedEventId: null, focusedEventId: null,
showCompleteModal: null,
showDeleteModal: null,
timeCellHeight: 100, timeCellHeight: 100,
} }
}, },
@@ -212,37 +191,24 @@ export default {
}, },
clickCompleteTask(event) { clickCompleteTask(event) {
if (event.completed) this.completeTask(event.id) if (event.completed) this.completeTask(event)
else this.showCompleteModal = {task: event}
}, },
completeTask(id) { completeTask(task) {
this.$emit('completeTask', id) this.$events.emit('show-complete-task-modal', {task})
}, },
editTask(subTask, editMode) { editTask(task, editMode) {
this.$refs['z-sub-task-modal'].create(subTask, editMode) this.$events.emit('show-task-modal', {task, editMode})
}, },
addTimeModal() { addTimeModal(task) {
this.$refs['z-add-time-task-modal'].showModal() this.$events.emit('show-task-add-time-modal', {task})
}, },
deleteTask(id) { deleteTask(task) {
this.$emit('deleteTask', id) this.$events.emit('show-delete-task-modal', {task})
}, }
// completeTask(id) {
// this.$emit('completeTask', id)
// },
// editTask(id) {
// this.$emit('edit-task', id)
// },
// deleteTask(id) {
// this.$emit('deleteTask', id)
// },
} }
} }
</script> </script>
@@ -1,18 +1,18 @@
<template> <template>
<div id="calendar" class="mb-12"> <div id="calendar" class="mb-12">
<V-full-calendar ref="fullCalendar" :options="calendarOptions" /> <V-full-calendar ref="fullCalendar" :options="calendarOptions" />
<Z-master-task-modal ref="z-master-task-modal" /> <!-- <Z-master-task-modal ref="z-master-task-modal" /> -->
</div> </div>
</template> </template>
<script> <script>
import VFullCalendar from '@fullcalendar/vue3' import VFullCalendar from '@fullcalendar/vue3'
import dayGridPlugin from '@fullcalendar/daygrid' import dayGridPlugin from '@fullcalendar/daygrid'
import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue' // import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue'
export default { export default {
components: { components: {
VFullCalendar, VFullCalendar,
ZMasterTaskModal // ZMasterTaskModal
}, },
props: { props: {
@@ -54,8 +54,8 @@ export default {
methods: { methods: {
editTask(masterTask, editMode) { editTask(masterTask, editMode) {
this.$refs['z-master-task-modal'].create(masterTask, editMode) this.$events.emit('show-master-task-modal', {masterTask, editMode})
} },
}, },
watch: { watch: {
+2 -27
View File
@@ -3,12 +3,7 @@
<A-task-filter :unscheduledTime="unscheduledTime" @dataChanged="getTimelineData" /> <A-task-filter :unscheduledTime="unscheduledTime" @dataChanged="getTimelineData" />
<W-loadable :content="timelineData" class="w-loadable" empty-message="Nepodarilo sa nacitat data!"> <W-loadable :content="timelineData" class="w-loadable" empty-message="Nepodarilo sa nacitat data!">
<Z-timeline :calData="timelineData" :calConfig="config" :splits="splitDays" <Z-timeline :calData="timelineData" :calConfig="config" :splits="splitDays" />
@eventMoved="onEventMoved" @completeTask="completeTask" @deleteTask="deleteTask" />
<!-- <Z-complete-task-modal ref="z-complete-task-modal" />
<Z-delete-task-modal ref="z-delete-task-modal" />
<Z-sub-task-modal ref="z-sub-task-modal" /> -->
</W-loadable> </W-loadable>
</div> </div>
</template> </template>
@@ -16,19 +11,12 @@
<script> <script>
import ATaskFilter from './_components/a-tasks-filter.vue' import ATaskFilter from './_components/a-tasks-filter.vue'
import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue' import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue'
// import ZCompleteTaskModal from '@/plugins/tm@modal/task/z-complete-task-modal.vue'
// import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
// import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
import { addDays, setHours, setMinutes, setSeconds, differenceInCalendarDays } from 'date-fns' import { addDays, setHours, setMinutes, setSeconds, differenceInCalendarDays } from 'date-fns'
export default { export default {
components: { components: {
ATaskFilter, ATaskFilter,
ZTimeline, ZTimeline
// ZDeleteTaskModal,
// ZCompleteTaskModal,
// ZSubTaskModal
}, },
data() { data() {
@@ -157,19 +145,6 @@ export default {
} }
}, },
completeTask(id) {
const task = this.timelineData.tasks.find(task => task.id == id)
task.completed = !task.completed
},
deleteTask(id) {
this.timelineData.tasks.splice(this.timelineData.tasks.findIndex(item => item.id === id), 1)
}
// editTask(subTask, editMode) {
// this.$refs['z-sub-task-modal'].create(subTask, editMode)
// },
// deleteTask(id) { // deleteTask(id) {
// const task = this.timelineData.find(task => task.id == id) // const task = this.timelineData.find(task => task.id == id)
// this.$refs['z-delete-task-modal'].delete(task) // this.$refs['z-delete-task-modal'].delete(task)
@@ -74,7 +74,7 @@ export default {
}, },
async _getTeams() { async _getTeams() {
this.teams = await this.$axios.get_auth_data('v1/teamsx') this.teams = await this.$axios.get_auth_data('v1/teams')
this.selectedTeam = this.teams[0] this.selectedTeam = this.teams[0]
}, },
@@ -127,22 +127,20 @@ export default {
} }
}, },
async created() { methods: {
async showModal(blocker = null) {
this.visible = true
this.blocker = null
try { try {
const allEmployees = await this.$axios.get_auth_data('v1/employees') const allEmployees = await this.$axios.get_auth_data('v1/employees')
this.allEmployees = this._enrichEmployeesByFullName(allEmployees) this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
},
methods: { if (blocker?.id) {
async create(blocker = null) { await this._load(blocker.id)
this.visible = true
this.blocker = null
if (blocker) {
await this._load()
} else { } else {
const blocker = { const blocker = {
name: '', name: '',
@@ -273,6 +273,7 @@
</div> </div>
<v-table class="mt-7 mb-5"> <v-table class="mt-7 mb-5">
<tbody class="px-5 py-5"> <tbody class="px-5 py-5">
<!-- Kravarik: natiahnut toto z masterTask.tasks -->
<tr v-for="(employee, index) in masterTask.employees" :key="employee.id"> <tr v-for="(employee, index) in masterTask.employees" :key="employee.id">
<td class="w-25">{{ masterTask.name }}</td> <td class="w-25">{{ masterTask.name }}</td>
<td class="d-flex align-center"> <td class="d-flex align-center">
@@ -352,17 +353,6 @@ export default {
} }
}, },
async created() {
try {
this.teams = await this.$axios.get_auth_data('v1/teamsx')
this.employees = await this.$axios.get_auth_data('v1/employees')
// this.masterTask = await this.$axios.get_auth_data(`v1/master-task/${this.masterTaksId}`)
// this.selectedTeam = `${this.masterTask.team.name} - ${this.masterTask.team.id}`)
} catch (error) {
this.$toast.error(error)
}
},
methods: { methods: {
// async downloadFile() { // async downloadFile() {
// try { // try {
@@ -375,13 +365,20 @@ export default {
// } // }
// }, // },
async create(masterTaskId = null, editMode = false) { async showModal(masterTask, editMode = false) {
this.visible = true this.visible = true
this.masterTask = null this.masterTask = null
if (masterTaskId) { try {
await this._load(masterTaskId) this.teams = await this.$axios.get_auth_data('v1/teams')
this.editMode = editMode || (!this.masterTask?.id) this.employees = await this.$axios.get_auth_data('v1/employees')
} catch (error) {
this.$toast.error(error)
}
if (masterTask?.id) {
await this._load(masterTask.id)
this.editMode = editMode || !masterTask?.id
} else { } else {
const masterTask = { const masterTask = {
project_code: null, project_code: null,
@@ -396,7 +393,7 @@ export default {
setTimeout(() => { setTimeout(() => {
this.masterTask = masterTask this.masterTask = masterTask
this.editMode = editMode || (!this.masterTask.id) this.editMode = editMode || !this.masterTask.id
}) })
} }
}, },
@@ -434,7 +431,7 @@ export default {
async _create() { async _create() {
try { try {
await this.$axios.post_auth('v1/master-tasks') await this.$axios.post_auth('v1/mastertasks')
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
@@ -1,18 +1,18 @@
<template> <template>
<v-dialog v-model="show" max-width="650"> <v-dialog v-model="visible" max-width="650">
<v-card> <v-card>
<div class="d-flex justify-space-between align-center"> <div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete ukončiť <b>{{ task.title }}</b>?</h1> <h1>Ste si istý, že chcete ukončiť <b>{{ task.title }}</b>?</h1>
<v-icon <v-icon
@click.stop="show = false" @click.stop="visible = false"
icon="mdi-close" icon="mdi-close"
size="large" size="large"
></v-icon> ></v-icon>
</div> </div>
<v-card-actions class="mt-10 d-flex justify-start align-center"> <v-card-actions class="mt-10 d-flex justify-start align-center">
<v-btn class="z-btn" variant="flat" @click="complete()">ÁNO</v-btn> <v-btn class="z-btn" variant="flat" @click="complete()">ÁNO</v-btn>
<v-btn class="ml-7 cancel-btn" @click.stop="show = false">ZRUŠIŤ</v-btn> <v-btn class="ml-7 cancel-btn" @click.stop="visible = false">ZRUŠIŤ</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
@@ -22,31 +22,19 @@
export default { export default {
emits: ['close'], emits: ['close'],
props: { data() {
visible: { return {
type: Boolean, visible: false,
required: true task: null
},
task: {
type: Object,
required: true
} }
}, },
computed: {
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
},
methods: { methods: {
async showModal(task) {
this.task = task
this.visible = true
},
async complete() { async complete() {
try { try {
const task = { const task = {
@@ -55,7 +43,7 @@ export default {
} }
await this.$axios.post(`v1/tasks/${task.id}`, task) await this.$axios.post(`v1/tasks/${task.id}`, task)
this.show = false this.visible = false
this.$emit('completeTask', task.id) this.$emit('completeTask', task.id)
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
@@ -30,7 +30,7 @@ export default {
}, },
methods: { methods: {
async delete(task) { async showModal(task) {
this.task = task this.task = task
this.visible = true this.visible = true
}, },
@@ -49,6 +49,9 @@ export default {
methods: { methods: {
showModal() { showModal() {
// Kravarik: Dorobit logiku
// 1. Save na be
// 2. this.$events.emit('task-time-updated', task)
this.visible = true this.visible = true
}, },
@@ -17,8 +17,9 @@
disabled disabled
></v-text-field> ></v-text-field>
<!-- Toto treba fixnut -->
<v-select <v-select
v-model="selectedMasterTask" v-model="selectedMasterTaskId"
@focus="onInputFocus" @focus="onInputFocus"
class="modal-input border-select" class="modal-input border-select"
label="MasterTask" label="MasterTask"
@@ -29,12 +30,12 @@
></v-select> ></v-select>
<v-select <v-select
v-model="selectedEmployee" v-model="selectedEmployeeId"
@focus="onInputFocus" @focus="onInputFocus"
class="modal-input border-select" class="modal-input border-select"
label="Priradený" label="Priradený"
variant="solo" variant="solo"
:items="task.team.employees" :items="employees"
item-value="id" item-value="id"
item-title="_fullName" item-title="_fullName"
></v-select> ></v-select>
@@ -99,7 +100,7 @@
<div <div
class="d-flex justify-space-between align-center modal-header border-bottom pb-4" class="d-flex justify-space-between align-center modal-header border-bottom pb-4"
> >
<h1>{{ task.master_task }}</h1> <h1>{{ task.title }}</h1>
<div class="d-flex justify-start"> <div class="d-flex justify-start">
<img <img
class="pencil-icon" class="pencil-icon"
@@ -130,7 +131,7 @@
<v-col cols="7"> <v-col cols="7">
<v-sheet class="ma-2"> <v-sheet class="ma-2">
<p class="task-badge px-4 py-2 rounded-pill"> <p class="task-badge px-4 py-2 rounded-pill">
{{ task.master_task }} {{ task.master_task.name }}
</p> </p>
</v-sheet> </v-sheet>
</v-col> </v-col>
@@ -200,10 +201,20 @@
</v-col> </v-col>
<v-col cols="7"> <v-col cols="7">
<v-sheet class="ma-2 d-flex align-center"> <v-sheet class="ma-2 d-flex align-center">
<p class="employee-selected-avatar d-flex justify-center align-center"> <p
{{ task.assigned_employee.name.charAt(0) + task.assigned_employee.surname.charAt(0)}} class="employee-selected-avatar d-flex justify-center align-center"
>
{{
task.employee.name.charAt(0) +
task.employee.surname.charAt(0)
}}
</p> </p>
<p class="ml-2" v-html="`${task.assigned_employee.name} ${task.assigned_employee.surname}`" /> <p
class="ml-2"
v-html="
`${task.employee.name} ${task.employee.surname}`
"
/>
</v-sheet> </v-sheet>
</v-col> </v-col>
</v-row> </v-row>
@@ -221,7 +232,7 @@
</v-col> </v-col>
<v-col cols="7"> <v-col cols="7">
<v-sheet class="ma-2"> <v-sheet class="ma-2">
<p>{{ task.duration }} h</p> <p>{{ task.duration / 3600 }} h</p>
</v-sheet> </v-sheet>
</v-col> </v-col>
</v-row> </v-row>
@@ -240,7 +251,7 @@
<v-col cols="7"> <v-col cols="7">
<v-sheet class="ma-2"> <v-sheet class="ma-2">
<v-text-field <v-text-field
v-model="task.worked_time" v-model="task.spent_time"
class="modal-input" class="modal-input"
variant="solo" variant="solo"
type="number" type="number"
@@ -263,13 +274,18 @@
</v-col> </v-col>
<v-col cols="7"> <v-col cols="7">
<v-sheet class="ma-2"> <v-sheet class="ma-2">
<p>{{ task.duration - task.worked_time }} h</p> <p>
{{ (task.duration - task.spent_time) / 3600 }} h
</p>
</v-sheet> </v-sheet>
</v-col> </v-col>
</v-row> </v-row>
<div class="px-5 py-5 border-bottom"> <div class="px-5 py-5 border-bottom">
<p>Popis zadania</p> <p>Popis zadania</p>
<section v-html="task.description" class="description-detail px-2 py-2 w-100 rounded mt-2"/> <section
v-html="task.description"
class="description-detail px-2 py-2 w-100 rounded mt-2"
/>
<p class="mt-5">Prílohy</p> <p class="mt-5">Prílohy</p>
<div class="w-100 d-flex align-center"> <div class="w-100 d-flex align-center">
<div <div
@@ -279,7 +295,9 @@
:class="[index === 0 ? 'ml-0' : 'ml-2']" :class="[index === 0 ? 'ml-0' : 'ml-2']"
> >
<v-chip class="mt-2"> <v-chip class="mt-2">
<p @click="downloadFile" class="cursor-pointer" >{{ file.name }}</p> <p @click="downloadFile" class="cursor-pointer">
{{ file.name }}
</p>
<v-icon <v-icon
class="mx-1" class="mx-1"
icon="mdi-paperclip" icon="mdi-paperclip"
@@ -289,14 +307,15 @@
</div> </div>
</div> </div>
<div class="d-flex justify-start align-center mt-8"> <div class="d-flex justify-start align-center mt-8">
<v-btn class="done-btn" @click.stop="clickCompleteTask()">Dokončené</v-btn> <v-btn class="done-btn" @click.stop="clickCompleteTask()"
>Dokončené</v-btn
>
<v-btn class="add-employee-btn" @click="save()" <v-btn class="add-employee-btn" @click="save()"
>Uložiť zmeny</v-btn >Uložiť zmeny</v-btn
> >
</div> </div>
</div> </div>
</v-card-actions> </v-card-actions>
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted" />
</v-card> </v-card>
</W-loadable> </W-loadable>
</v-dialog> </v-dialog>
@@ -309,7 +328,6 @@ import useVuelidate from '@vuelidate/core'
import { required } from '@vuelidate/validators' import { required } from '@vuelidate/validators'
import errorUtils from '@/plugins/lib@auth/_utils/error.utils' import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
import moment from 'moment' import moment from 'moment'
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
import { QuillEditor } from '@vueup/vue-quill' import { QuillEditor } from '@vueup/vue-quill'
import * as FileSaver from 'file-saver' import * as FileSaver from 'file-saver'
import '@vueup/vue-quill/dist/vue-quill.snow.css' import '@vueup/vue-quill/dist/vue-quill.snow.css'
@@ -321,7 +339,6 @@ export default {
Datepicker, Datepicker,
ZFilesUpload, ZFilesUpload,
QuillEditor, QuillEditor,
ZDeleteTaskModal
}, },
data() { data() {
@@ -332,11 +349,9 @@ export default {
errorUtils, errorUtils,
v$: useVuelidate(), v$: useVuelidate(),
preventInputFocus: false, preventInputFocus: false,
employees: null, masterTasks: [],
selectedMasterTask: '', selectedMasterTaskId: null,
showAddEmployeeInput: false, selectedEmployeeId: null
masterTasks: null,
selectedEmployee: null,
} }
}, },
@@ -352,13 +367,10 @@ export default {
} }
}, },
async created() { mounted() {
try { this.$events.on('on-task-deleted', (task) => {
this.masterTasks = await this.$axios.get_auth_data('v1/master-tasks') if (task?.id == this.task?.id) this.close()
this.employees = await this.$axios.get_auth_data('v1/employees') })
} catch (error) {
this.$toast.error(error)
}
}, },
methods: { methods: {
@@ -373,12 +385,18 @@ export default {
// } // }
// }, // },
async create(taskId = null, editMode = false) { async showModal(task, editMode = false) {
this.visible = true this.visible = true
this.task = null this.task = null
if (taskId) { try {
await this._load(taskId) this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
} catch (error) {
this.$toast.error(error)
}
if (task?.id) {
await this._load(task.id)
this.editMode = editMode || !this.task?.id this.editMode = editMode || !this.task?.id
} else { } else {
const task = { const task = {
@@ -415,8 +433,7 @@ export default {
if (this.task.id) { if (this.task.id) {
await this._update() await this._update()
this.close() this.close()
} } else await this._create()
else await this._create()
this.close() this.close()
this.$router.push({ name: 'Dashboard - Tasks' }) this.$router.push({ name: 'Dashboard - Tasks' })
@@ -432,7 +449,17 @@ export default {
async _load(taskId) { async _load(taskId) {
try { try {
this.task = await this.$axios.get_auth_data(`v1/tasks/${taskId}`) const task = await this.$axios.get_auth_data(`v1/tasks/${taskId}`)
// const employees = task.master_task.employees.map(employee => {
// employee._fullName = `${employee.name} ${employee.surname}`
// return employee
// })
// this.employees = employees
this.task = task
this.selectedEmployeeId = this.task.employee.id
this.selectedMasterTaskId = this.task.master_task.id
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
@@ -440,7 +467,7 @@ export default {
async _create() { async _create() {
try { try {
await this.$axios.post_auth('v1/master-tasks') await this.$axios.post_auth('v1/mastertasks')
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
@@ -455,7 +482,7 @@ export default {
}, },
deleteTask(task) { deleteTask(task) {
this.$refs['z-delete-task-modal'].delete(task) this.$events.emit('show-delete-task-modal', { task })
}, },
onTaskDeleted() { onTaskDeleted() {
@@ -463,9 +490,8 @@ export default {
}, },
employeeSelected(selectedOption) { employeeSelected(selectedOption) {
const employee = this.employees.find((empl) => empl.id == selectedOption.key) const employee = this.task.master_task.employees.find(employee => employee.id == selectedOption.key)
this.task.employees.push(employee) this.task.employee = employee
this.showAddEmployeeInput = false
}, },
// Vuetify input was automatically focus after date input was clicked. This will prevent this unwanted behavior // Vuetify input was automatically focus after date input was clicked. This will prevent this unwanted behavior
@@ -488,20 +514,13 @@ export default {
}, },
computed: { computed: {
employeesOptions() { employees() {
const selectedEmployeesIds = this.task.employees.map( if (!this.task?.master_task?.employees)
(employee) => employee.id return []
)
const employees =
this.employees.filter(
(employee) => !selectedEmployeesIds.includes(employee.id)
) || []
return employees.map((employee) => { return this.task.master_task.employees.map(employee => {
return { employee._fullName = `${employee.name} ${employee.surname}`
key: employee.id, return employee
value: `${employee.name} ${employee.surname}`,
}
}) })
}, },
@@ -519,25 +538,19 @@ export default {
}, },
watch: { watch: {
selectedMasterTask() { selectedMasterTaskId() {
this.task.team = this.masterTasks.find( this.task.master_task = this.masterTasks.find(
(masterTask) => masterTask.id == this.selectedMasterTask (masterTask) => masterTask.id == this.selectedMasterTaskId
) )
console.log(this.task.team.employees)
this.task.team.employees.forEach( // Kravarik: Tu bude treba vymsliet logiku resetovania, ale ked dam toto sa to trigeruje aj pri otvarani existujuceho tasku a hned to vymaze
(employee) => { // this.selectedEmployeeId = null
employee._fullName = `${employee.name} ${employee.surname}` // this.task.employee = {}
})
console.log(this.task.team.employees)
this.task.employee = null
this.task.project_code = this.masterTasks.filter(
(x) => x.id == this.selectedMasterTask
)[0].project_code
}, },
selectedEmployee() { selectedEmployeeId() {
this.task.employee = this.task.team.employees.find( this.task.employee = this.task.master_task.employees.find(
(employee) => employee.id == this.selectedEmployee (employee) => employee.id == this.selectedEmployeeId
) )
}, },
}, },
@@ -28,7 +28,7 @@ export default {
}, },
methods: { methods: {
async delete(team) { async showModal(team) {
this.team = team this.team = team
this.visible = true this.visible = true
}, },
+11 -13
View File
@@ -94,15 +94,6 @@ export default {
} }
}, },
async created() {
try {
const allEmployees = await this.$axios.get_auth_data('v1/employees')
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
} catch (error) {
this.$toast.error(error)
}
},
methods: { methods: {
async save() { async save() {
if (!(await this.v$.$validate())) if (!(await this.v$.$validate()))
@@ -120,12 +111,19 @@ export default {
} }
}, },
async create(id = null) { async showModal(team = null) {
this.visible = true this.visible = true
this.team = null this.team = null
if (id) { try {
await this._load() const allEmployees = await this.$axios.get_auth_data('v1/employees')
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
} catch (error) {
this.$toast.error(error)
}
if (team?.id) {
await this._load(team.id)
} else { } else {
const team = { const team = {
name: '', name: '',
@@ -145,7 +143,7 @@ export default {
async _create() { async _create() {
try { try {
await this.$axios.post_auth('v1/teams', this.team) await this.$axios.post_auth(`v1/teams`, this.team)
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
@@ -25,23 +25,12 @@
</tr> </tr>
</tbody> </tbody>
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted" />
</v-table> </v-table>
</template> </template>
<script> <script>
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
export default { export default {
emits: ['refresh'],
components: {
ZDeleteTaskModal,
ZSubTaskModal
},
props: { props: {
tasks: { tasks: {
type: Array, type: Array,
@@ -50,16 +39,12 @@ export default {
}, },
methods: { methods: {
editTask(task, editMode = false) {
this.$events.emit('show-task-modal', {task, editMode})
},
deleteTask(task) { deleteTask(task) {
this.$refs['z-delete-task-modal'].delete(task) this.$events.emit('show-delete-task-modal', {task})
},
onTaskDeleted() {
this.$emit('refresh')
},
editTask(task, editMode) {
this.$refs['z-sub-task-modal'].create(task, editMode)
} }
} }
} }
@@ -42,6 +42,16 @@ export default {
}, },
async created() { async created() {
await this._loadData()
},
mounted() {
this.$events.on('on-task-deleted', () => this._loadData())
},
methods: {
async _loadData() {
this.ongoingTasks = null
try { try {
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks') this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
} catch (error) { } catch (error) {
@@ -49,7 +59,6 @@ export default {
} }
}, },
methods: {
onSearch(searchQuery) { onSearch(searchQuery) {
this.searchQuery = searchQuery this.searchQuery = searchQuery
}, },
@@ -22,24 +22,11 @@
</td> </td>
</tr> </tr>
</tbody> </tbody>
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted"/>
</v-table> </v-table>
</template> </template>
<script> <script>
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
export default { export default {
emits: ['refresh'],
components: {
ZDeleteTaskModal,
ZSubTaskModal
},
props: { props: {
tasks: { tasks: {
type: Array, type: Array,
@@ -48,16 +35,12 @@ export default {
}, },
methods: { methods: {
deleteTask(task) {
this.$refs['z-delete-task-modal'].delete(task)
},
onTaskDeleted() {
this.$emit('refresh')
},
editTask(task, editMode) { editTask(task, editMode) {
this.$refs['z-sub-task-modal'].create(task, editMode) this.$events.emit('show-task-modal', {task, editMode})
},
deleteTask(task) {
this.$events.emit('show-delete-task-modal', {task})
} }
} }
} }
@@ -5,12 +5,6 @@
<W-loadable :content="filteredUnscheduledTasks" :emptyMessage="searchQuery.length ? 'Neboli nájdené žiadne úlohy' : 'Nenašli sa žiadne záznamy'"> <W-loadable :content="filteredUnscheduledTasks" :emptyMessage="searchQuery.length ? 'Neboli nájdené žiadne úlohy' : 'Nenašli sa žiadne záznamy'">
<A-unscheduled-table :tasks="filteredUnscheduledTasks" /> <A-unscheduled-table :tasks="filteredUnscheduledTasks" />
<h6
v-if="filteredUnscheduledTasks && !filteredUnscheduledTasks.length"
class="px-4"
>
Aktuálnemu hľadaniu nevyhovujú žiadne nenaplánované úlohy
</h6>
</W-loadable> </W-loadable>
</div> </div>
@@ -19,7 +13,6 @@
<script> <script>
import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue' import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue'
import AUnscheduledTable from './_components/a-unscheduled-table.vue' import AUnscheduledTable from './_components/a-unscheduled-table.vue'
export default { export default {
components: { components: {
ZTasksSearch, ZTasksSearch,
@@ -48,6 +41,16 @@ export default {
}, },
async created() { async created() {
await this._loadData()
},
mounted() {
this.$events.on('on-task-deleted', () => this._loadData())
},
methods: {
async _loadData() {
this.unscheduledTasks = null
try { try {
this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks') this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks')
} catch (error) { } catch (error) {
@@ -55,7 +58,6 @@ export default {
} }
}, },
methods: {
onSearch(searchQuery) { onSearch(searchQuery) {
this.searchQuery = searchQuery this.searchQuery = searchQuery
}, },
@@ -20,24 +20,11 @@
</tr> </tr>
</tbody> </tbody>
</v-table> </v-table>
<Z-team-modal ref="z-team-modal" />
<Z-delete-team-modal ref="z-delete-team-modal" @deleted="onTeamDeleted" />
</div> </div>
</template> </template>
<script> <script>
import ZDeleteTeamModal from '@/plugins/tm@modal/team/z-delete-team-modal.vue'
import ZTeamModal from '@/plugins/tm@modal/team/z-team-modal.vue'
export default { export default {
emits: ['refresh'],
components: {
ZDeleteTeamModal,
ZTeamModal
},
props: { props: {
teams: { teams: {
type: Array, type: Array,
@@ -47,15 +34,11 @@ export default {
methods: { methods: {
editTeam(team) { editTeam(team) {
this.$refs['z-team-modal'].create(team.id) this.$events.emit('show-team-modal', {team})
}, },
deleteTeam(team) { deleteTeam(team) {
this.$refs['z-delete-team-modal'].delete(team) this.$events.emit('show-delete-team-modal', {team})
},
onTeamDeleted() {
this.$emit('refresh')
} }
} }
} }
+8 -4
View File
@@ -1,6 +1,6 @@
<template> <template>
<W-loadable :content="teams"> <W-loadable :content="teams">
<A-teams-table :teams="teams" @refresh="loadData" /> <A-teams-table :teams="teams" />
</W-loadable> </W-loadable>
</template> </template>
@@ -19,15 +19,19 @@ export default {
}, },
async created() { async created() {
await this.loadData() await this._loadData()
},
mounted() {
this.$events.on('on-team-deleted', () => this._loadData())
}, },
methods: { methods: {
async loadData() { async _loadData() {
this.teams = null this.teams = null
try { try {
this.teams = await this.$axios.get_auth_data('v1/teamsx') this.teams = await this.$axios.get_auth_data('v1/teams')
} catch (error) { } catch (error) {
this.teams = {error} this.teams = {error}
} }
+4 -4
View File
@@ -14,22 +14,22 @@ const app = createApp(App)
# Examples # Examples
1. Listen for event 1. Listen for event
```javascript ```javascript
this.eventBus.on('eventname', (optionalData) => ...do something) this.$events.on('eventname', (optionalData) => ...do something)
``` ```
2. Listen for all events 2. Listen for all events
```javascript ```javascript
this.eventBus.on('*', (optionalData) => ...do something) this.$events.on('*', (optionalData) => ...do something)
``` ```
3. Fire event 3. Fire event
```javascript ```javascript
this.eventBus.emit('eventname', optionalData) this.$events.emit('eventname', optionalData)
``` ```
4. Clear all event listeners 4. Clear all event listeners
```javascript ```javascript
this.eventBus.all.clear() this.$events.all.clear()
``` ```
5. More on https://www.npmjs.com/package/mitt 5. More on https://www.npmjs.com/package/mitt
+2 -2
View File
@@ -5,7 +5,7 @@ export default {
install: (app, options: Options) => { install: (app, options: Options) => {
if (options && options.disabled === true) return if (options && options.disabled === true) return
const eventBus = mitt() const events = mitt()
app.config.globalProperties.eventBus = eventBus app.config.globalProperties.$events = events
} }
} }
@@ -22,7 +22,7 @@ export default {
methods: { methods: {
languageSelected(language) { languageSelected(language) {
this.$w18n.changeLanguage(language) this.$w18n.changeLanguage(language)
// this.eventBus.emit("language-changed", language) // this.$events.emit("language-changed", language)
popoverController.dismiss() popoverController.dismiss()
} }
} }
+1 -1
View File
@@ -10,7 +10,7 @@ export default {
if (!options || !options.languages || !options.defaultLanguage) if (!options || !options.languages || !options.defaultLanguage)
return console.warn('[@wezeo/i18n] Could not initialize i18n. Missing configuration options.') return console.warn('[@wezeo/i18n] Could not initialize i18n. Missing configuration options.')
if (!app.config.globalProperties.eventBus) { if (!app.config.globalProperties.$events) {
app.use(events) app.use(events)
} }