mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app
This commit is contained in:
commit
4429e3e566
32 files changed
+1229
-150
No files matched your search
@@ -5,16 +5,17 @@
|
||||
</v-main>
|
||||
</v-app>
|
||||
|
||||
<Z-team-modal ref="z-team-modal" @update="onTeamUpdate" />
|
||||
<Z-delete-team-modal ref="z-delete-team-modal" @update="onTeamUpdate" />
|
||||
<Z-team-modal ref="z-team-modal" @update="onTeamUpdate" />
|
||||
<Z-delete-team-modal ref="z-delete-team-modal" @update="onTeamUpdate" />
|
||||
|
||||
<Z-task-modal ref="z-task-modal" />
|
||||
<Z-delete-task-modal ref="z-delete-task-modal" @update="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-task-modal ref="z-task-modal" @on-task-edited="onTaskEdited" />
|
||||
<Z-delete-task-modal ref="z-delete-task-modal" @on-task-deleted="onTaskDeleted" />
|
||||
<Z-delete-master-task-modal ref="z-delete-master-task-modal" />
|
||||
<Z-complete-task-modal ref="z-complete-task-modal" @task-completed="onTaskCompleted" />
|
||||
<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" />
|
||||
<Z-master-task-modal ref="z-master-task-modal" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -25,7 +26,7 @@ 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 ZDeleteMasterTaskModal from '@/plugins/tm@modal/master-task/z-delete-master-task-modal.vue'
|
||||
import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue'
|
||||
|
||||
export default {
|
||||
@@ -37,7 +38,8 @@ export default {
|
||||
ZMasterTaskModal,
|
||||
ZCompleteTaskModal,
|
||||
ZTaskAddTimeModal,
|
||||
ZBlockerModal
|
||||
ZBlockerModal,
|
||||
ZDeleteMasterTaskModal
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@@ -53,6 +55,10 @@ export default {
|
||||
this.$refs['z-delete-task-modal'].showModal(task)
|
||||
})
|
||||
|
||||
this.$events.on('show-delete-master-task-modal', ({masterTask}) => {
|
||||
this.$refs['z-delete-master-task-modal'].showModal(masterTask)
|
||||
})
|
||||
|
||||
this.$events.on('show-task-modal', ({task, editMode}) => {
|
||||
this.$refs['z-task-modal'].showModal(task, editMode)
|
||||
})
|
||||
@@ -77,11 +83,23 @@ export default {
|
||||
|
||||
methods: {
|
||||
onTeamUpdate(team) {
|
||||
this.$events.emit('on-team-deleted', team)
|
||||
this.$events.emit('on-team-update', team)
|
||||
},
|
||||
|
||||
onTaskDeleted(task) {
|
||||
this.$events.emit('on-task-deleted', task)
|
||||
},
|
||||
|
||||
onTaskCompleted(task) {
|
||||
this.$events.emit('on-task-completed', task)
|
||||
},
|
||||
|
||||
onTaskEdited(task) {
|
||||
this.$events.emit('on-task-edited', task)
|
||||
},
|
||||
|
||||
onMasterTaskDeleted(masterTask){
|
||||
this.$events.emit('on-master-task-deleted', masterTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,17 +54,17 @@ const options: Options = {
|
||||
// 'GET v1/master-tasks/(id)': true,
|
||||
// 'GET v1/master-tasks': true,
|
||||
'POST v1/master-tasks/(id)': true,
|
||||
'DELETE v1/master-tasks/(id)': true,
|
||||
'POST v1/master-tasks': true,
|
||||
// 'DELETE v1/master-tasks/(id)': true,
|
||||
// 'POST v1/master-tasks': true,
|
||||
|
||||
'GET v1/overview/projects': true,
|
||||
// 'GET v1/overview/projects': true,
|
||||
'GET v1/overview/tasks': true,
|
||||
'GET v1/overview/teams': true,
|
||||
'GET v1/overview/ongoing-tasks': true,
|
||||
'GET v1/overview/unscheduled-tasks': true,
|
||||
|
||||
'GET v1/tasks/(id)': true,
|
||||
'POST v1/tasks/(id)': true,
|
||||
// 'POST v1/tasks/(id)': true,
|
||||
'DELETE v1/tasks/(id)': true,
|
||||
|
||||
// 'GET v1/teams/(id)': true,
|
||||
|
||||
@@ -49,29 +49,14 @@
|
||||
</v-menu>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <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" /> -->
|
||||
|
||||
</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'
|
||||
|
||||
export default {
|
||||
// components: {
|
||||
// ZTeamModal,
|
||||
// ZBlockerModal,
|
||||
// ZMasterTaskModal,
|
||||
// ZSubTaskModal
|
||||
// },
|
||||
|
||||
data() {
|
||||
return {
|
||||
search: ''
|
||||
|
||||
@@ -109,6 +109,7 @@ ion-item
|
||||
|
||||
@media (min-width: 992px)
|
||||
ion-menu
|
||||
width: 300px
|
||||
--width: 300px
|
||||
width: 257px
|
||||
min-width: 257px
|
||||
--width: 257px
|
||||
</style>
|
||||
@@ -44,6 +44,6 @@ export default {
|
||||
|
||||
@media (min-width: 992px)
|
||||
.split-pane-right-side
|
||||
width: calc(100vw - 300px) !important
|
||||
max-width: calc(100vw - 300px) !important
|
||||
width: calc(100vw - 257px) !important
|
||||
max-width: calc(100vw - 257px) !important
|
||||
</style>
|
||||
@@ -1,19 +1,16 @@
|
||||
.modal-header
|
||||
flex: 0 0 auto
|
||||
|
||||
.trash-icon
|
||||
padding: 10px
|
||||
background: rgba(0, 0, 0, 0.04)
|
||||
margin-left: 12px
|
||||
border-radius: 50%
|
||||
cursor: pointer
|
||||
|
||||
.pencil-icon
|
||||
.icon
|
||||
padding: 10px
|
||||
background: rgba(0, 0, 0, 0.04)
|
||||
border-radius: 50%
|
||||
cursor: pointer
|
||||
|
||||
&:hover
|
||||
cursor: pointer
|
||||
|
||||
&.trash
|
||||
margin-left: 12px
|
||||
|
||||
.modal-input
|
||||
width: 100% !important
|
||||
|
||||
@@ -34,6 +34,21 @@
|
||||
height: 24px
|
||||
width: 24px
|
||||
|
||||
.remove-date
|
||||
border: 1px solid rgba(0, 0, 0, 0.2)
|
||||
border-radius: 50%
|
||||
padding: 13px
|
||||
height: 24px
|
||||
width: 24px
|
||||
|
||||
.add-date
|
||||
color: white
|
||||
border-radius: 50%
|
||||
background: #6200EE
|
||||
padding: 13px
|
||||
height: 24px
|
||||
width: 24px
|
||||
|
||||
th
|
||||
font-size: 16px !important
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
|
||||
try {
|
||||
await this.$store.dispatch('auth/login', this.form)
|
||||
this.$router.push({ name: 'Overview - Ongoing tasks'})
|
||||
this.$router.push({ name: 'Dashboard - Tasks'})
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
:scroll-to-hour="calConfig.scrollHour"
|
||||
:split-days="splits"
|
||||
:sticky-split-labels="true"
|
||||
:min-split-width="300"
|
||||
:min-split-width="270"
|
||||
@ready="onReady()"
|
||||
@view-change="weekChanged"
|
||||
@event-drop="eventMoved"
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
|
||||
<div class="event-footer d-flex">
|
||||
<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" :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, 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>
|
||||
@@ -190,8 +190,18 @@ export default {
|
||||
// console.log(`Focused: ${event.task_id}`)
|
||||
},
|
||||
|
||||
clickCompleteTask(event) {
|
||||
if (event.completed) this.completeTask(event)
|
||||
async clickCompleteTask(event) {
|
||||
if (!event.completed) {
|
||||
this.completeTask(event)
|
||||
} else {
|
||||
event.completed = !event.completed
|
||||
try {
|
||||
await this.$axios.patch_auth(`v1/tasks/${event.id}`, event)
|
||||
this.$emit('reopenTask', event)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
completeTask(task) {
|
||||
|
||||
@@ -3,7 +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" />
|
||||
<Z-timeline :calData="timelineData" :calConfig="config" :splits="splitDays" @reopenTask="toggleCompleteTask" />
|
||||
</W-loadable>
|
||||
</div>
|
||||
</template>
|
||||
@@ -31,6 +31,20 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$events.on('on-task-deleted', (task) => {
|
||||
this.deleteTask(task)
|
||||
})
|
||||
|
||||
this.$events.on('on-task-completed', (task) => {
|
||||
this.toggleCompleteTask(task)
|
||||
})
|
||||
|
||||
this.$events.on('on-task-edited', (task) => {
|
||||
this.editTask(task)
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getTimelineData(data) {
|
||||
this.config.date = data.firstDay
|
||||
@@ -82,7 +96,7 @@ export default {
|
||||
event.split = diffInDays * (-1) + 1
|
||||
})
|
||||
|
||||
console.log(this.timelineData.tasks)
|
||||
// console.log(this.timelineData.tasks)
|
||||
|
||||
this.unscheduledTime = 0
|
||||
|
||||
@@ -147,13 +161,20 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// deleteTask(id) {
|
||||
// const task = this.timelineData.find(task => task.id == id)
|
||||
// this.$refs['z-delete-task-modal'].delete(task)
|
||||
deleteTask(task) {
|
||||
const id = task.id
|
||||
this.timelineData.tasks.splice(this.timelineData.tasks.findIndex(item => item.id === id), 1)
|
||||
},
|
||||
|
||||
// // TODO: Remove after BE integration
|
||||
// this.timelineData.tasks.splice(this.timelineData.tasks.findIndex(item => item.id === id), 1)
|
||||
// }
|
||||
toggleCompleteTask(task) {
|
||||
const taskInTasks = this.timelineData.tasks.find(e => e.id == task.id)
|
||||
taskInTasks.completed = !taskInTasks.completed
|
||||
},
|
||||
|
||||
editTask(task) {
|
||||
const taskIndex = this.timelineData.tasks.findIndex(item => item.id === task.id)
|
||||
this.timelineData.tasks[taskIndex] = task
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -167,9 +167,6 @@ export default {
|
||||
await this.$axios.post_auth('v1/blockers', this.blocker)
|
||||
|
||||
this.closeModal()
|
||||
|
||||
// Kravarik: Toto tu ma byt?
|
||||
this.$router.push({ name: 'Dashboard - Tasks' })
|
||||
} catch (error) {
|
||||
this.$toast(error)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<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 zmazať <b>{{ masterTask.name }}</b>?</h1>
|
||||
|
||||
<v-icon
|
||||
@click.stop="closeModal()"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
class="mb-15"
|
||||
></v-icon>
|
||||
</div>
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||
<v-btn class="button primary half" variant="flat" @click="deleteMasterTask()">ÁNO</v-btn>
|
||||
<v-btn class="button primary half outline" @click.stop="closeModal()">ZRUŠIŤ</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
emits: ['on-master-task-deleted'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
masterTask: null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal(masterTask) {
|
||||
this.masterTask = masterTask
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
},
|
||||
|
||||
async deleteMasterTask() {
|
||||
try {
|
||||
await this.$axios.delete(`v1/mastertasks/${this.masterTask.id}`)
|
||||
this.$emit('on-master-task-deleted', this.masterTask)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -12,19 +12,22 @@
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="masterTask.project_code"
|
||||
<v-select
|
||||
v-model="masterTask.project_id"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
class="modal-input border-select"
|
||||
label="Kód projektu"
|
||||
variant="solo"
|
||||
:class="{ error: v$.masterTask.project_code.$errors.length }"
|
||||
:items="projects"
|
||||
item-value="id"
|
||||
item-title="code"
|
||||
:class="{ error: v$.masterTask.project_id.$errors.length }"
|
||||
:hint="
|
||||
v$.masterTask.project_code.$errors
|
||||
? errorUtils.parseErrors(v$.masterTask.project_code.$errors)
|
||||
v$.masterTask.project_id.$errors
|
||||
? errorUtils.parseErrors(v$.masterTask.project_id.$errors)
|
||||
: null
|
||||
"
|
||||
></v-text-field>
|
||||
></v-select>
|
||||
|
||||
<v-text-field
|
||||
v-model="masterTask.name"
|
||||
@@ -133,8 +136,8 @@
|
||||
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
|
||||
<h1>{{ masterTask.name }}</h1>
|
||||
<div class="d-flex justify-start">
|
||||
<img class="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
|
||||
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="_delete()"/>
|
||||
<img class="icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
|
||||
<img class="icon trash" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteMasterTaskModal(masterTask)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -177,9 +180,9 @@
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-row no-gutters>
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<v-sheet class="pa-2 ma-2 pt-0">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-account-multiple-outline"
|
||||
@@ -190,9 +193,9 @@
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2 d-flex scroll-employees">
|
||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team }}</p>
|
||||
<div class="d-flex align-center flex-shrink-0 mx-3" v-for="(employee, index) in masterTask.employees" :key="employee.id">
|
||||
<v-sheet class="d-flex flex-wrap flex-column">
|
||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team.name }}</p>
|
||||
<div class="d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill" v-for="(employee, index) in masterTask.employees" :key="employee.id">
|
||||
<p class="employee-selected-avatar d-flex justify-center align-center">
|
||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||
</p>
|
||||
@@ -233,7 +236,7 @@
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p :class="masterTask.worked_time > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.worked_time)?.toFixed(2) }} h</p>
|
||||
<p :class="masterTask.time_worked > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.time_worked)?.toFixed(2) }} h</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -251,7 +254,7 @@
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p :class="masterTask.worked_time > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.duration - masterTask.worked_time)?.toFixed(2) }} h</p>
|
||||
<p :class="masterTask.time_worked > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.duration - masterTask.time_worked)?.toFixed(2) }} h</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -273,27 +276,26 @@
|
||||
</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>
|
||||
<tr v-for="task in masterTask.subtasks" :key="task.id">
|
||||
<td class="w-25">{{ task.project_code }}</td>
|
||||
<td class="d-flex align-center">
|
||||
<p class="employee-selected-avatar d-flex justify-center align-center">
|
||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||
{{ getFullNameByEmployeeId(task.employee_id).initials }}
|
||||
</p>
|
||||
<p class="ml-2" v-html="`${masterTask.employees[index].name} ${masterTask.employees[index].surname}`" />
|
||||
<p class="ml-2">{{ getFullNameByEmployeeId(task.employee_id).fullName }}</p>
|
||||
</td>
|
||||
<td class="task-action">
|
||||
<div class="d-flex justify-start">
|
||||
<img class="pencil-icon" :src="require('@/plugins/tm@dashboard/_components/_img/checkmark.svg')" alt="checkmark-icon" :style="{opacity: 0.3}">
|
||||
<img class="pencil-icon ml-2" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" :style="{opacity: 0.3}">
|
||||
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" :style="{opacity: 0.3}">
|
||||
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(task)">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
<div class="d-flex align-center ">
|
||||
<v-btn class="subtask-btn w-100"><v-icon class="mx-1" icon="mdi-plus" />Pridať Subtask</v-btn>
|
||||
<v-btn class="subtask-btn w-100" @click="addTask()" ><v-icon class="mx-1" icon="mdi-plus" />Pridať Subtask</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-actions>
|
||||
@@ -337,6 +339,7 @@ export default {
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
teams: null,
|
||||
projects: null,
|
||||
employees: null,
|
||||
employeeSelect: null,
|
||||
teamSelect: '',
|
||||
@@ -349,20 +352,41 @@ export default {
|
||||
validations() {
|
||||
return {
|
||||
masterTask: {
|
||||
project_code: { required },
|
||||
project_id: { required },
|
||||
name: { required },
|
||||
team: { required },
|
||||
// duration: { required },
|
||||
// description: { required },
|
||||
deadline: { required },
|
||||
employees: { atLeastOne }
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$events.on('on-master-task-deleted', (masterTask) => {
|
||||
if (masterTask?.id == this.masterTask?.id) this.closeModal()
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
itemSelected(x) {
|
||||
console.log(x)
|
||||
getFullNameByEmployeeId(employee_id) {
|
||||
let fullName = ''
|
||||
let initials = ''
|
||||
this.employees.forEach(employee => {
|
||||
if (employee.id === employee_id) {
|
||||
fullName = `${employee.name} ${employee.surname}`
|
||||
initials = employee.name.charAt(0) + employee.surname.charAt(0)
|
||||
}
|
||||
})
|
||||
return {
|
||||
fullName,
|
||||
initials
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
async showModal(masterTask, editMode = false) {
|
||||
this.visible = true
|
||||
this.masterTask = null
|
||||
@@ -372,6 +396,7 @@ export default {
|
||||
try {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||
const employees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.projects = await this.$axios.get_auth_data('v1/projects')
|
||||
this.employees = tmUtils.enrichEmployeesByFullName(employees)
|
||||
|
||||
if (masterTask?.id) {
|
||||
@@ -392,16 +417,23 @@ export default {
|
||||
return
|
||||
|
||||
try {
|
||||
this.masterTask.duration = 5
|
||||
this.masterTask.description = 'popis'
|
||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
||||
employee.duration = 5
|
||||
return employee
|
||||
})
|
||||
this.masterTask.deadline = moment(this.masterTask.deadline).format("YYYY-MM-DD HH:MM:SS")
|
||||
|
||||
if (this.masterTask.id)
|
||||
await this.$axios.put_auth(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
||||
|
||||
else
|
||||
await this.$axios.post_auth('v1/mastertasks', this.masterTask)
|
||||
await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
||||
|
||||
this.closeModal()
|
||||
// this.$router.push({ name: 'Dashboard - Tasks' })
|
||||
} catch (error) {
|
||||
this.$toast(error)
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -410,17 +442,14 @@ export default {
|
||||
this.$emit('close', this.masterTask)
|
||||
},
|
||||
|
||||
async _delete() {
|
||||
// Kravarik: Tu sa ma volat delete-master-task-modal, ak taka funkcionalita vlastne je
|
||||
|
||||
// try {
|
||||
// await this.$axios.delete(`v1/master-tasks/${this.masterTask.id}`)
|
||||
// this.closeModal()
|
||||
// } catch (error) {
|
||||
// this.$toast.error(error)
|
||||
// }
|
||||
openDeleteMasterTaskModal(masterTask) {
|
||||
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
||||
},
|
||||
|
||||
openDeleteTaskModal(task) {
|
||||
this.$events.emit('show-delete-task-modal', { task })
|
||||
},
|
||||
|
||||
employeeSelected(selectedOption) {
|
||||
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
|
||||
this.masterTask.employees.push(employee)
|
||||
@@ -429,7 +458,11 @@ export default {
|
||||
|
||||
filesUploaded(files) {
|
||||
this.masterTask.files = files
|
||||
}
|
||||
},
|
||||
|
||||
addTask() {
|
||||
this.$events.emit('show-task-modal', {})
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
@@ -502,9 +535,6 @@ export default {
|
||||
.scrolling
|
||||
overflow: hidden !important
|
||||
|
||||
.scroll-employees
|
||||
overflow-x: scroll
|
||||
|
||||
.border-bottom
|
||||
border-bottom: 1px solid rgba(0,0,0,.1)
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
<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 zmazať <b>{{ task.title }}</b>?</h1>
|
||||
<h1>Ste si istý, že chcete zmazať task z masterTasku <b>{{ task.project_code }}</b>?</h1>
|
||||
|
||||
<v-icon
|
||||
@click.stop="closeModal()"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
class="mb-15"
|
||||
></v-icon>
|
||||
</div>
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||
@@ -20,7 +21,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
emits: ['deleted'],
|
||||
emits: ['on-task-deleted'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
@@ -41,8 +42,8 @@ export default {
|
||||
|
||||
async deleteTask() {
|
||||
try {
|
||||
await this.$axios.delete(`v1/tasks/${this.task.id}`)
|
||||
this.$emit('deleted', this.task)
|
||||
await this.$axios.delete(`v1/subtasks/${this.task.id}`)
|
||||
this.$emit('on-task-deleted', this.task)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
|
||||
@@ -103,13 +103,13 @@
|
||||
<h1>{{ task.title }}</h1>
|
||||
<div class="d-flex justify-start">
|
||||
<img
|
||||
class="pencil-icon"
|
||||
class="icon"
|
||||
:src="require('@/plugins/tm@overview/_img/pencil-icon.svg')"
|
||||
alt="pencil-icon"
|
||||
@click.stop="editMode = !editMode"
|
||||
/>
|
||||
<img
|
||||
class="trash-icon"
|
||||
class="icon trash"
|
||||
:src="require('@/plugins/tm@overview/_img/trash-icon.svg')"
|
||||
alt="trash-icon"
|
||||
@click.stop="openDeleteTaskModal(task)"
|
||||
@@ -165,9 +165,9 @@
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-row no-gutters>
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<v-sheet class="pa-2 ma-2 pt-5">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-calendar-week"
|
||||
@@ -179,11 +179,50 @@
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p
|
||||
v-html="
|
||||
`${tmUtils.formatDateTime(task.starts_at)} - ${tmUtils.formatDateTime(task.ends_at)}`
|
||||
"
|
||||
<div v-for="(date, index) in task.timeblocks" :key="date.id">
|
||||
<div class="d-flex align-center m-5">
|
||||
<v-icon
|
||||
@click.stop="removeDate(index)"
|
||||
class="remove-date cursor-pointer mr-2" icon="mdi-minus" size="medium"
|
||||
/>
|
||||
<p
|
||||
class="task-badge px-4 py-2 rounded-pill mt-2"
|
||||
v-html="
|
||||
`${tmUtils.formatDateTime(date.start)} - ${tmUtils.formatDateTime(date.end)}`
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<v-icon
|
||||
@click="showDatePicker = true"
|
||||
class="add-date cursor-pointer mt-5" icon="mdi-plus" size="medium"
|
||||
/>
|
||||
<v-dialog max-width="650" v-model="showDatePicker">
|
||||
<v-card>
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<h1>Pridať dátum</h1>
|
||||
|
||||
<v-icon
|
||||
@click.stop="showDatePicker = false"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
></v-icon>
|
||||
</div>
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||
<Datepicker
|
||||
v-model="selectedNewDate"
|
||||
class="modal-input"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
select-text="Vybrať"
|
||||
cancel-text="Zrušiť"
|
||||
placeholder="Trvanie od - do"
|
||||
range
|
||||
/>
|
||||
</v-card-actions>
|
||||
<v-btn @click="addNewDate()" class="button primary mt-5">Potvrdiť</v-btn>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -232,7 +271,7 @@
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p>{{ task.duration / 3600 }} h</p>
|
||||
<p>{{ (task.duration / 3600000).toFixed(2) }} h</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -275,7 +314,7 @@
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p>
|
||||
{{ (task.duration - task.spent_time) / 3600 }} h
|
||||
{{ ((task.duration / 3600000) - (task.spent_time)).toFixed(2) }} h
|
||||
</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
@@ -355,7 +394,9 @@ export default {
|
||||
preventInputFocus: false,
|
||||
masterTasks: [],
|
||||
masterTaskIdSelect: null,
|
||||
employeeIdSelect: null
|
||||
employeeIdSelect: null,
|
||||
showDatePicker: false,
|
||||
selectedNewDate: []
|
||||
}
|
||||
},
|
||||
|
||||
@@ -371,12 +412,11 @@ export default {
|
||||
validations() {
|
||||
return {
|
||||
task: {
|
||||
// project_code: { required },
|
||||
date: { required },
|
||||
// team: { required },
|
||||
duration: { required },
|
||||
employee: { required },
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -394,11 +434,12 @@ export default {
|
||||
try {
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||
if (task?.id) {
|
||||
const t = await this.$axios.get_auth_data(`v1/tasks/${task.id}`)
|
||||
const t = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
||||
|
||||
this.employeeIdSelect = t.employee.id
|
||||
this.employeeIdSelect = t.employee.id
|
||||
this.masterTaskIdSelect = t.master_task.id
|
||||
this.task = t
|
||||
this.task.spent_time = ((t.spent_time) / 3600000).toFixed(2)
|
||||
} else {
|
||||
this.task = {master_task: {}}
|
||||
}
|
||||
@@ -414,24 +455,37 @@ export default {
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (!(await this.v$.$validate())) return
|
||||
if (!(await this.v$.$validate())) return console.log(this.v$)
|
||||
|
||||
try {
|
||||
if (this.task.id) {
|
||||
await this.$axios.put_auth(`v1/mastertasks/${this.task.id}`, this.task)
|
||||
this.$events.emit('on-task-edited', this.task)
|
||||
} else {
|
||||
await this.$axios.post_auth('v1/mastertasks', this.task)
|
||||
await this.$axios.post_auth('v1/subtasks', this.task)
|
||||
}
|
||||
|
||||
this.closeModal()
|
||||
|
||||
// Kravarik: Toto tu ma byt?
|
||||
this.$router.push({ name: 'Dashboard - Tasks' })
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
async addNewDate() {
|
||||
if (this.selectedNewDate) {
|
||||
this.task.timeblocks.push({
|
||||
start: this.selectedNewDate[0],
|
||||
end: this.selectedNewDate[1]
|
||||
})
|
||||
this.showDatePicker = false
|
||||
this.selectedNewDate = []
|
||||
}
|
||||
},
|
||||
|
||||
removeDate(index) {
|
||||
this.task.timeblocks.splice(index, 1)
|
||||
},
|
||||
|
||||
openDeleteTaskModal(task) {
|
||||
this.$events.emit('show-delete-task-modal', { task })
|
||||
},
|
||||
@@ -446,6 +500,10 @@ export default {
|
||||
if (!value || !this.task) return
|
||||
|
||||
this.task.master_task = this.masterTasks.find(masterTask => masterTask.id == value)
|
||||
const selectedMasterTask = this.masterTasks.find(masterTask => masterTask.id === value)
|
||||
if (selectedMasterTask) {
|
||||
this.task.project_code = selectedMasterTask.project_code
|
||||
}
|
||||
},
|
||||
|
||||
employeeIdSelect(value) {
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$events.on('on-team-deleted', () => this._loadData())
|
||||
this.$events.on('on-team-update', () => this._loadData())
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -26,13 +26,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
async mounted() {
|
||||
await this._startLoading()
|
||||
},
|
||||
|
||||
methods: {
|
||||
async _startLoading() {
|
||||
// Kravarik: toto hadze tie warny v konzole. Fixnut
|
||||
this.loader = await this.$loading.show()
|
||||
},
|
||||
|
||||
@@ -56,4 +55,4 @@ export default {
|
||||
<style lang="sass" scoped>
|
||||
div
|
||||
height: calc( 100vh - 329px )
|
||||
</style>
|
||||
</style>
|
||||
Reference in new issue
Block a user