[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
+489 -391

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": [
{
"id": 1,
"name": "Master task 1",
"title": "Master task 1",
"description": "Toto je master task cislo 1",
"duration": 130000,
"time_worked": 0,
@@ -38,7 +38,7 @@
},
{
"id": 2,
"name": "Master task cislo 2",
"title": "Master task cislo 2",
"description": "Toto je master task cislo 2",
"duration": 100000,
"time_worked": 0,
@@ -67,7 +67,7 @@
},
{
"id": 3,
"name": "Master task cislo 3",
"title": "Master task cislo 3",
"description": "Toto je master task cislo 3",
"duration": 9500000,
"time_worked": 0,
@@ -29,6 +29,46 @@
"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": [
{
"content_type": "application/png",
+19 -42
View File
@@ -1,64 +1,41 @@
{
"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": {
"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,
"name": "Team 1",
"name": "Master task 1",
"employees": [
{
"id": 1,
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 2,
"name": "Lenka",
"surname": "Nemeckova"
"id": 4,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 3,
"name": "Peter",
"surname": "Bucan"
"id": 5,
"name": "Pavel",
"surname": "Gajdos"
}
]
},
"employee_id": 1,
"assigned_employee": {
"id": 14,
"name": "Pavel",
"surname": "Gajdos"
"employee": {
"id": 1,
"duration": 1300000,
"name": "Viliam",
"surname": "Sedivy"
},
"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",
@@ -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 />
</v-main>
</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>
<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,
'GET v1/master-tasks/(id)': true,
'GET v1/master-tasks': true,
// 'GET v1/master-tasks': true,
'POST v1/master-tasks/(id)': true,
'DELETE v1/master-tasks/(id)': true,
'POST v1/master-tasks': true,
@@ -63,14 +63,14 @@ const options: Options = {
'POST v1/tasks/(id)': true,
'DELETE v1/tasks/(id)': true,
'GET v1/teams/(id)': false,
// 'GET v1/teams/(id)': true,
'POST v1/teams/(id)': true,
'DELETE v1/teams/(id)': true,
// 'GET v1/teams': true,
'GET v1/teamsx': true,
// 'GET v1/teamsx': true,
'POST v1/teams': true,
'GET v1/employees': false,
// 'GET v1/employees': true,
'GET v1/search': true,
'POST v1/tasks': true,
@@ -1,13 +1,13 @@
<template>
<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">
<h1>{{ $route.meta.title }}</h1>
<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" />
<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>
<template v-slot:activator="{ props }">
@@ -17,10 +17,10 @@
</template>
<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="createSubTaskModal()">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="createBlockerModal()">BLOCKER</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="createTask()">SUB TASK</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="createBlocker()">BLOCKER</v-list-item>
</v-list>
</v-menu>
@@ -50,27 +50,27 @@
</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-blocker-modal ref="z-blocker-modal" />
<Z-team-modal ref="z-team-modal" />
<Z-team-modal ref="z-team-modal" /> -->
</v-app-bar>
</template>
<script>
import { mapGetters } from 'vuex'
import ZTeamModal from '@/plugins/tm@modal/team/z-team-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 ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-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 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'
export default {
components: {
ZTeamModal,
ZBlockerModal,
ZMasterTaskModal,
ZSubTaskModal
},
// components: {
// ZTeamModal,
// ZBlockerModal,
// ZMasterTaskModal,
// ZSubTaskModal
// },
data() {
return {
@@ -93,20 +93,20 @@ export default {
}
},
createTeamModal() {
this.$refs['z-team-modal'].create()
createMasterTask() {
this.$events.emit('show-master-task-modal', {})
},
createMasterTaskModal() {
this.$refs['z-master-task-modal'].create()
createTask() {
this.$events.emit('show-task-modal', {})
},
createSubTaskModal() {
this.$refs['z-sub-task-modal'].create()
createTeam() {
this.$events.emit('show-team-modal', {})
},
createBlockerModal() {
this.$refs['z-blocker-modal'].create()
createBlocker() {
this.$events.emit('show-blocker-modal', {})
}
}
}
@@ -56,8 +56,8 @@ export default {
},
created() {
this.eventBus.on("close-menu", () => this.closeMenu())
this.eventBus.on("toggle-menu", () => this.toggleMenu())
this.$events.on("close-menu", () => this.closeMenu())
this.$events.on("toggle-menu", () => this.toggleMenu())
this.unscheduledTasks()
},
@@ -2,7 +2,7 @@
<ion-split-pane content-id="main-content">
<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 />
<div class="main-content">
+2 -2
View File
@@ -29,14 +29,14 @@ export default {
this.$toast.error(error)
}
this.eventBus.on('onSearch', (search) => {
this.$events.on('onSearch', (search) => {
this.search = search
})
},
methods: {
debounceSearch: debounce(function () {
this.search
this.search()
}, 300),
}
}
@@ -71,9 +71,9 @@
</div>
<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" @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="showDeleteModal = {task: event}"><img :src="require('./_img/bin.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, true)"><img :src="require('./_img/pencil.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>
@@ -85,30 +85,11 @@
</div>
</template>
</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>
</template>
<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 {
components: {
ZCompleteTaskModal,
ZDeleteTaskModal,
ZAddTimeTaskModal,
ZSubTaskModal
},
props: {
calData: {
type: Object,
@@ -145,8 +126,6 @@ export default {
}
},
focusedEventId: null,
showCompleteModal: null,
showDeleteModal: null,
timeCellHeight: 100,
}
},
@@ -212,37 +191,24 @@ export default {
},
clickCompleteTask(event) {
if (event.completed) this.completeTask(event.id)
else this.showCompleteModal = {task: event}
if (event.completed) this.completeTask(event)
},
completeTask(id) {
this.$emit('completeTask', id)
completeTask(task) {
this.$events.emit('show-complete-task-modal', {task})
},
editTask(subTask, editMode) {
this.$refs['z-sub-task-modal'].create(subTask, editMode)
editTask(task, editMode) {
this.$events.emit('show-task-modal', {task, editMode})
},
addTimeModal() {
this.$refs['z-add-time-task-modal'].showModal()
addTimeModal(task) {
this.$events.emit('show-task-add-time-modal', {task})
},
deleteTask(id) {
this.$emit('deleteTask', id)
},
// completeTask(id) {
// this.$emit('completeTask', id)
// },
// editTask(id) {
// this.$emit('edit-task', id)
// },
// deleteTask(id) {
// this.$emit('deleteTask', id)
// },
deleteTask(task) {
this.$events.emit('show-delete-task-modal', {task})
}
}
}
</script>
@@ -1,18 +1,18 @@
<template>
<div id="calendar" class="mb-12">
<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>
</template>
<script>
import VFullCalendar from '@fullcalendar/vue3'
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 {
components: {
VFullCalendar,
ZMasterTaskModal
// ZMasterTaskModal
},
props: {
@@ -54,8 +54,8 @@ export default {
methods: {
editTask(masterTask, editMode) {
this.$refs['z-master-task-modal'].create(masterTask, editMode)
}
this.$events.emit('show-master-task-modal', {masterTask, editMode})
},
},
watch: {
+2 -27
View File
@@ -3,12 +3,7 @@
<A-task-filter :unscheduledTime="unscheduledTime" @dataChanged="getTimelineData" />
<W-loadable :content="timelineData" class="w-loadable" empty-message="Nepodarilo sa nacitat data!">
<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" /> -->
<Z-timeline :calData="timelineData" :calConfig="config" :splits="splitDays" />
</W-loadable>
</div>
</template>
@@ -16,19 +11,12 @@
<script>
import ATaskFilter from './_components/a-tasks-filter.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'
export default {
components: {
ATaskFilter,
ZTimeline,
// ZDeleteTaskModal,
// ZCompleteTaskModal,
// ZSubTaskModal
ZTimeline
},
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) {
// const task = this.timelineData.find(task => task.id == id)
// this.$refs['z-delete-task-modal'].delete(task)
@@ -74,7 +74,7 @@ export default {
},
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]
},
@@ -127,22 +127,20 @@ 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: {
async create(blocker = null) {
async showModal(blocker = null) {
this.visible = true
this.blocker = null
if (blocker) {
await this._load()
try {
const allEmployees = await this.$axios.get_auth_data('v1/employees')
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
} catch (error) {
this.$toast.error(error)
}
if (blocker?.id) {
await this._load(blocker.id)
} else {
const blocker = {
name: '',
@@ -273,6 +273,7 @@
</div>
<v-table class="mt-7 mb-5">
<tbody class="px-5 py-5">
<!-- Kravarik: natiahnut toto z masterTask.tasks -->
<tr v-for="(employee, index) in masterTask.employees" :key="employee.id">
<td class="w-25">{{ masterTask.name }}</td>
<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: {
// async downloadFile() {
// try {
@@ -375,13 +365,20 @@ export default {
// }
// },
async create(masterTaskId = null, editMode = false) {
async showModal(masterTask, editMode = false) {
this.visible = true
this.masterTask = null
if (masterTaskId) {
await this._load(masterTaskId)
this.editMode = editMode || (!this.masterTask?.id)
try {
this.teams = await this.$axios.get_auth_data('v1/teams')
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 {
const masterTask = {
project_code: null,
@@ -396,7 +393,7 @@ export default {
setTimeout(() => {
this.masterTask = masterTask
this.editMode = editMode || (!this.masterTask.id)
this.editMode = editMode || !this.masterTask.id
})
}
},
@@ -434,7 +431,7 @@ export default {
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
await this.$axios.post_auth('v1/mastertasks')
} catch (error) {
this.$toast.error(error)
}
@@ -1,18 +1,18 @@
<template>
<v-dialog v-model="show" max-width="650">
<v-dialog v-model="visible" max-width="650">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete ukončiť <b>{{ task.title }}</b>?</h1>
<v-icon
@click.stop="show = false"
@click.stop="visible = false"
icon="mdi-close"
size="large"
></v-icon>
</div>
<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="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>
</v-dialog>
@@ -22,31 +22,19 @@
export default {
emits: ['close'],
props: {
visible: {
type: Boolean,
required: true
},
task: {
type: Object,
required: true
data() {
return {
visible: false,
task: null
}
},
computed: {
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
},
methods: {
async showModal(task) {
this.task = task
this.visible = true
},
async complete() {
try {
const task = {
@@ -55,7 +43,7 @@ export default {
}
await this.$axios.post(`v1/tasks/${task.id}`, task)
this.show = false
this.visible = false
this.$emit('completeTask', task.id)
} catch (error) {
this.$toast.error(error)
@@ -30,7 +30,7 @@ export default {
},
methods: {
async delete(task) {
async showModal(task) {
this.task = task
this.visible = true
},
@@ -49,6 +49,9 @@ export default {
methods: {
showModal() {
// Kravarik: Dorobit logiku
// 1. Save na be
// 2. this.$events.emit('task-time-updated', task)
this.visible = true
},
@@ -17,8 +17,9 @@
disabled
></v-text-field>
<!-- Toto treba fixnut -->
<v-select
v-model="selectedMasterTask"
v-model="selectedMasterTaskId"
@focus="onInputFocus"
class="modal-input border-select"
label="MasterTask"
@@ -29,12 +30,12 @@
></v-select>
<v-select
v-model="selectedEmployee"
v-model="selectedEmployeeId"
@focus="onInputFocus"
class="modal-input border-select"
label="Priradený"
variant="solo"
:items="task.team.employees"
:items="employees"
item-value="id"
item-title="_fullName"
></v-select>
@@ -99,7 +100,7 @@
<div
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">
<img
class="pencil-icon"
@@ -130,7 +131,7 @@
<v-col cols="7">
<v-sheet class="ma-2">
<p class="task-badge px-4 py-2 rounded-pill">
{{ task.master_task }}
{{ task.master_task.name }}
</p>
</v-sheet>
</v-col>
@@ -200,10 +201,20 @@
</v-col>
<v-col cols="7">
<v-sheet class="ma-2 d-flex align-center">
<p class="employee-selected-avatar d-flex justify-center align-center">
{{ task.assigned_employee.name.charAt(0) + task.assigned_employee.surname.charAt(0)}}
<p
class="employee-selected-avatar d-flex justify-center align-center"
>
{{
task.employee.name.charAt(0) +
task.employee.surname.charAt(0)
}}
</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-col>
</v-row>
@@ -221,7 +232,7 @@
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p>{{ task.duration }} h</p>
<p>{{ task.duration / 3600 }} h</p>
</v-sheet>
</v-col>
</v-row>
@@ -240,7 +251,7 @@
<v-col cols="7">
<v-sheet class="ma-2">
<v-text-field
v-model="task.worked_time"
v-model="task.spent_time"
class="modal-input"
variant="solo"
type="number"
@@ -263,13 +274,18 @@
</v-col>
<v-col cols="7">
<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-col>
</v-row>
<div class="px-5 py-5 border-bottom">
<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>
<div class="w-100 d-flex align-center">
<div
@@ -279,7 +295,9 @@
:class="[index === 0 ? 'ml-0' : 'ml-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
class="mx-1"
icon="mdi-paperclip"
@@ -289,14 +307,15 @@
</div>
</div>
<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()"
>Uložiť zmeny</v-btn
>
</div>
</div>
</v-card-actions>
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted" />
</v-card>
</W-loadable>
</v-dialog>
@@ -309,9 +328,8 @@ import useVuelidate from '@vuelidate/core'
import { required } from '@vuelidate/validators'
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
import moment from 'moment'
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
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'
export default {
@@ -321,7 +339,6 @@ export default {
Datepicker,
ZFilesUpload,
QuillEditor,
ZDeleteTaskModal
},
data() {
@@ -332,11 +349,9 @@ export default {
errorUtils,
v$: useVuelidate(),
preventInputFocus: false,
employees: null,
selectedMasterTask: '',
showAddEmployeeInput: false,
masterTasks: null,
selectedEmployee: null,
masterTasks: [],
selectedMasterTaskId: null,
selectedEmployeeId: null
}
},
@@ -352,13 +367,10 @@ export default {
}
},
async created() {
try {
this.masterTasks = await this.$axios.get_auth_data('v1/master-tasks')
this.employees = await this.$axios.get_auth_data('v1/employees')
} catch (error) {
this.$toast.error(error)
}
mounted() {
this.$events.on('on-task-deleted', (task) => {
if (task?.id == this.task?.id) this.close()
})
},
methods: {
@@ -373,12 +385,18 @@ export default {
// }
// },
async create(taskId = null, editMode = false) {
async showModal(task, editMode = false) {
this.visible = true
this.task = null
if (taskId) {
await this._load(taskId)
try {
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
} else {
const task = {
@@ -415,8 +433,7 @@ export default {
if (this.task.id) {
await this._update()
this.close()
}
else await this._create()
} else await this._create()
this.close()
this.$router.push({ name: 'Dashboard - Tasks' })
@@ -432,7 +449,17 @@ export default {
async _load(taskId) {
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) {
this.$toast.error(error)
}
@@ -440,7 +467,7 @@ export default {
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
await this.$axios.post_auth('v1/mastertasks')
} catch (error) {
this.$toast.error(error)
}
@@ -455,7 +482,7 @@ export default {
},
deleteTask(task) {
this.$refs['z-delete-task-modal'].delete(task)
this.$events.emit('show-delete-task-modal', { task })
},
onTaskDeleted() {
@@ -463,9 +490,8 @@ export default {
},
employeeSelected(selectedOption) {
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
this.task.employees.push(employee)
this.showAddEmployeeInput = false
const employee = this.task.master_task.employees.find(employee => employee.id == selectedOption.key)
this.task.employee = employee
},
// Vuetify input was automatically focus after date input was clicked. This will prevent this unwanted behavior
@@ -488,20 +514,13 @@ export default {
},
computed: {
employeesOptions() {
const selectedEmployeesIds = this.task.employees.map(
(employee) => employee.id
)
const employees =
this.employees.filter(
(employee) => !selectedEmployeesIds.includes(employee.id)
) || []
employees() {
if (!this.task?.master_task?.employees)
return []
return employees.map((employee) => {
return {
key: employee.id,
value: `${employee.name} ${employee.surname}`,
}
return this.task.master_task.employees.map(employee => {
employee._fullName = `${employee.name} ${employee.surname}`
return employee
})
},
@@ -519,25 +538,19 @@ export default {
},
watch: {
selectedMasterTask() {
this.task.team = this.masterTasks.find(
(masterTask) => masterTask.id == this.selectedMasterTask
selectedMasterTaskId() {
this.task.master_task = this.masterTasks.find(
(masterTask) => masterTask.id == this.selectedMasterTaskId
)
console.log(this.task.team.employees)
this.task.team.employees.forEach(
(employee) => {
employee._fullName = `${employee.name} ${employee.surname}`
})
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
// Kravarik: Tu bude treba vymsliet logiku resetovania, ale ked dam toto sa to trigeruje aj pri otvarani existujuceho tasku a hned to vymaze
// this.selectedEmployeeId = null
// this.task.employee = {}
},
selectedEmployee() {
this.task.employee = this.task.team.employees.find(
(employee) => employee.id == this.selectedEmployee
selectedEmployeeId() {
this.task.employee = this.task.master_task.employees.find(
(employee) => employee.id == this.selectedEmployeeId
)
},
},
@@ -28,7 +28,7 @@ export default {
},
methods: {
async delete(team) {
async showModal(team) {
this.team = team
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: {
async save() {
if (!(await this.v$.$validate()))
@@ -120,12 +111,19 @@ export default {
}
},
async create(id = null) {
async showModal(team = null) {
this.visible = true
this.team = null
if (id) {
await this._load()
try {
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 {
const team = {
name: '',
@@ -145,7 +143,7 @@ export default {
async _create() {
try {
await this.$axios.post_auth('v1/teams', this.team)
await this.$axios.post_auth(`v1/teams`, this.team)
} catch (error) {
this.$toast.error(error)
}
@@ -25,23 +25,12 @@
</tr>
</tbody>
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted" />
</v-table>
</template>
<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 {
emits: ['refresh'],
components: {
ZDeleteTaskModal,
ZSubTaskModal
},
props: {
tasks: {
type: Array,
@@ -50,16 +39,12 @@ export default {
},
methods: {
editTask(task, editMode = false) {
this.$events.emit('show-task-modal', {task, editMode})
},
deleteTask(task) {
this.$refs['z-delete-task-modal'].delete(task)
},
onTaskDeleted() {
this.$emit('refresh')
},
editTask(task, editMode) {
this.$refs['z-sub-task-modal'].create(task, editMode)
this.$events.emit('show-delete-task-modal', {task})
}
}
}
@@ -42,14 +42,23 @@ export default {
},
async created() {
try {
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
} catch (error) {
this.ongoingTasks = {error}
}
await this._loadData()
},
mounted() {
this.$events.on('on-task-deleted', () => this._loadData())
},
methods: {
async _loadData() {
this.ongoingTasks = null
try {
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
} catch (error) {
this.ongoingTasks = {error}
}
},
onSearch(searchQuery) {
this.searchQuery = searchQuery
},
@@ -22,24 +22,11 @@
</td>
</tr>
</tbody>
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted"/>
</v-table>
</template>
<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 {
emits: ['refresh'],
components: {
ZDeleteTaskModal,
ZSubTaskModal
},
props: {
tasks: {
type: Array,
@@ -48,16 +35,12 @@ export default {
},
methods: {
deleteTask(task) {
this.$refs['z-delete-task-modal'].delete(task)
},
onTaskDeleted() {
this.$emit('refresh')
},
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'">
<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>
</div>
@@ -19,7 +13,6 @@
<script>
import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue'
import AUnscheduledTable from './_components/a-unscheduled-table.vue'
export default {
components: {
ZTasksSearch,
@@ -48,14 +41,23 @@ export default {
},
async created() {
try {
this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks')
} catch (error) {
this.unscheduledTasks = {error}
}
await this._loadData()
},
mounted() {
this.$events.on('on-task-deleted', () => this._loadData())
},
methods: {
async _loadData() {
this.unscheduledTasks = null
try {
this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks')
} catch (error) {
this.unscheduledTasks = {error}
}
},
onSearch(searchQuery) {
this.searchQuery = searchQuery
},
@@ -20,24 +20,11 @@
</tr>
</tbody>
</v-table>
<Z-team-modal ref="z-team-modal" />
<Z-delete-team-modal ref="z-delete-team-modal" @deleted="onTeamDeleted" />
</div>
</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'
export default {
emits: ['refresh'],
components: {
ZDeleteTeamModal,
ZTeamModal
},
props: {
teams: {
type: Array,
@@ -47,15 +34,11 @@ export default {
methods: {
editTeam(team) {
this.$refs['z-team-modal'].create(team.id)
this.$events.emit('show-team-modal', {team})
},
deleteTeam(team) {
this.$refs['z-delete-team-modal'].delete(team)
},
onTeamDeleted() {
this.$emit('refresh')
this.$events.emit('show-delete-team-modal', {team})
}
}
}
+8 -4
View File
@@ -1,6 +1,6 @@
<template>
<W-loadable :content="teams">
<A-teams-table :teams="teams" @refresh="loadData" />
<A-teams-table :teams="teams" />
</W-loadable>
</template>
@@ -19,15 +19,19 @@ export default {
},
async created() {
await this.loadData()
await this._loadData()
},
mounted() {
this.$events.on('on-team-deleted', () => this._loadData())
},
methods: {
async loadData() {
async _loadData() {
this.teams = null
try {
this.teams = await this.$axios.get_auth_data('v1/teamsx')
this.teams = await this.$axios.get_auth_data('v1/teams')
} catch (error) {
this.teams = {error}
}
+4 -4
View File
@@ -14,22 +14,22 @@ const app = createApp(App)
# Examples
1. Listen for event
```javascript
this.eventBus.on('eventname', (optionalData) => ...do something)
this.$events.on('eventname', (optionalData) => ...do something)
```
2. Listen for all events
```javascript
this.eventBus.on('*', (optionalData) => ...do something)
this.$events.on('*', (optionalData) => ...do something)
```
3. Fire event
```javascript
this.eventBus.emit('eventname', optionalData)
this.$events.emit('eventname', optionalData)
```
4. Clear all event listeners
```javascript
this.eventBus.all.clear()
this.$events.all.clear()
```
5. More on https://www.npmjs.com/package/mitt
+2 -2
View File
@@ -5,7 +5,7 @@ export default {
install: (app, options: Options) => {
if (options && options.disabled === true) return
const eventBus = mitt()
app.config.globalProperties.eventBus = eventBus
const events = mitt()
app.config.globalProperties.$events = events
}
}
@@ -22,7 +22,7 @@ export default {
methods: {
languageSelected(language) {
this.$w18n.changeLanguage(language)
// this.eventBus.emit("language-changed", language)
// this.$events.emit("language-changed", language)
popoverController.dismiss()
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ export default {
if (!options || !options.languages || !options.defaultLanguage)
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)
}