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
0d2a659049
27 files changed
+715
-533
No files matched your search
Generated
+7
-7
@@ -18,7 +18,7 @@
|
||||
"@vuelidate/core": "^2.0.0",
|
||||
"@vuelidate/validators": "^2.0.0",
|
||||
"@vuepic/vue-datepicker": "^3.6.0",
|
||||
"@vueup/vue-quill": "^1.0.1",
|
||||
"@vueup/vue-quill": "^1.0.0-beta.11",
|
||||
"axios": "^1.1.3",
|
||||
"axios-auth-refresh": "^3.3.4",
|
||||
"core-js": "^3.8.3",
|
||||
@@ -3481,9 +3481,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vueup/vue-quill": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.1.tgz",
|
||||
"integrity": "sha512-/VJHwUxH2BAms7gwIlNhHb0KfCqn/58onOK1H0ZZX9juEha4nrb32yZbv2xLsqLxf+JKsNbJgQ8Ne6VF8ACNGw==",
|
||||
"version": "1.0.0-beta.11",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.0-beta.11.tgz",
|
||||
"integrity": "sha512-TeCgXPyVbN5muBPKm3EZjmIg/s8R8O0YmTp0RRG4J48skJVe035scLjeWZTDVrt/TEagmzcRUcB+9nPIyvF9fQ==",
|
||||
"dependencies": {
|
||||
"quill": "^1.3.7",
|
||||
"quill-delta": "^4.2.2"
|
||||
@@ -16417,9 +16417,9 @@
|
||||
}
|
||||
},
|
||||
"@vueup/vue-quill": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.1.tgz",
|
||||
"integrity": "sha512-/VJHwUxH2BAms7gwIlNhHb0KfCqn/58onOK1H0ZZX9juEha4nrb32yZbv2xLsqLxf+JKsNbJgQ8Ne6VF8ACNGw==",
|
||||
"version": "1.0.0-beta.11",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.0-beta.11.tgz",
|
||||
"integrity": "sha512-TeCgXPyVbN5muBPKm3EZjmIg/s8R8O0YmTp0RRG4J48skJVe035scLjeWZTDVrt/TEagmzcRUcB+9nPIyvF9fQ==",
|
||||
"requires": {
|
||||
"quill": "^1.3.7",
|
||||
"quill-delta": "^4.2.2"
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
"@vuelidate/core": "^2.0.0",
|
||||
"@vuelidate/validators": "^2.0.0",
|
||||
"@vuepic/vue-datepicker": "^3.6.0",
|
||||
"@vueup/vue-quill": "^1.0.1",
|
||||
"@vueup/vue-quill": "^1.0.0-beta.11",
|
||||
"axios": "^1.1.3",
|
||||
"axios-auth-refresh": "^3.3.4",
|
||||
"core-js": "^3.8.3",
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
<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-delete-master-task-modal ref="z-delete-master-task-modal" @on-master-task-deleted="onMasterTaskDeleted" />
|
||||
<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" @master-task-edited="onMasterTaskEdited" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -59,8 +59,8 @@ export default {
|
||||
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)
|
||||
this.$events.on('show-task-modal', ({task, editMode, masterTask}) => {
|
||||
this.$refs['z-task-modal'].showModal(task, editMode, masterTask)
|
||||
})
|
||||
|
||||
this.$events.on('show-master-task-modal', ({masterTask, editMode}) => {
|
||||
@@ -78,7 +78,6 @@ export default {
|
||||
this.$events.on('show-task-add-time-modal', ({task}) => {
|
||||
this.$refs['z-task-add-time-modal'].showModal(task)
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -100,6 +99,10 @@ export default {
|
||||
|
||||
onMasterTaskDeleted(masterTask){
|
||||
this.$events.emit('on-master-task-deleted', masterTask)
|
||||
},
|
||||
|
||||
onMasterTaskEdited(masterTask){
|
||||
this.$events.emit('on-master-task-edited', 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,
|
||||
|
||||
@@ -113,4 +113,18 @@ const router = createRouter({
|
||||
routes
|
||||
})
|
||||
|
||||
// router.afterEach((to) => {
|
||||
// if (to.fullPath.includes('?master-task')) {
|
||||
// const searchParams = new URLSearchParams(to.fullPath.split('?')[1])
|
||||
// const id = searchParams.get('id')
|
||||
|
||||
// this.$events.emit('show-master-task-modal', { id })
|
||||
// } else if (to.fullPath.includes('?task')) {
|
||||
// const searchParams = new URLSearchParams(to.fullPath.split('?')[1])
|
||||
// const id = searchParams.get('id')
|
||||
|
||||
// this.$events.emit('show-task-modal', { id })
|
||||
// }
|
||||
// })
|
||||
|
||||
export default router
|
||||
@@ -41,6 +41,9 @@
|
||||
height: 24px
|
||||
width: 24px
|
||||
|
||||
.is-finished
|
||||
background: #06dece !important
|
||||
|
||||
.add-date
|
||||
color: white
|
||||
border-radius: 50%
|
||||
@@ -78,3 +81,7 @@ input[type="time"]::-webkit-calendar-picker-indicator
|
||||
.rich-text-editor
|
||||
.ql-tooltip
|
||||
left: 0 !important
|
||||
|
||||
.v-toast,
|
||||
.v-toast__item
|
||||
z-index: 10000 !important
|
||||
@@ -22,8 +22,8 @@
|
||||
.v-field
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0)
|
||||
|
||||
.error .v-field
|
||||
border-bottom: 1px solid red
|
||||
// .error .v-field
|
||||
// border-bottom: 1px solid red
|
||||
|
||||
@media screen and (max-width: 904px)
|
||||
.auth-card
|
||||
@@ -48,15 +48,6 @@
|
||||
box-shadow: none !important
|
||||
border: 1px solid rgba(0, 0, 0, .1) !important
|
||||
|
||||
.auth-card .error .v-field
|
||||
border: .5px solid red !important
|
||||
|
||||
.error .v-field
|
||||
border: .5px solid red !important
|
||||
|
||||
.error .dp__input
|
||||
border: .5px solid red !important
|
||||
|
||||
.v-input__append
|
||||
margin: 0 !important
|
||||
|
||||
@@ -78,5 +69,16 @@ input::-webkit-inner-spin-button
|
||||
.v-select .v-field--variant-solo
|
||||
border: none !important
|
||||
|
||||
.rich-text-editor
|
||||
border: 1px solid rgba(0, 0, 0, 0.1)
|
||||
|
||||
.error .dp__input,
|
||||
.v-input.error .v-input__control
|
||||
border: 1px solid red !important
|
||||
|
||||
.error .ql-toolbar.ql-snow,
|
||||
.error .ql-container.ql-snow
|
||||
border-color: red !important
|
||||
|
||||
.v-messages__message
|
||||
color: red !important
|
||||
@@ -6,7 +6,7 @@
|
||||
:class="{ error: v$.form.password.$errors.length }" :append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'" @click:append="showPassword = !showPassword" />
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<v-btn class="button" color="#7F39FB" @click="submit()">Log In</v-btn>
|
||||
<v-btn class="button primary block" color="#7F39FB" @click="submit()">Log In</v-btn>
|
||||
<p class="mt-5 text-center cursor-pointer" @click="$router.push({ name: 'Forgot password' })">Forgotten password ?</p>
|
||||
</div>
|
||||
</v-form>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<v-text-field
|
||||
label="Vyhľadať zamestnanca"
|
||||
:label="label"
|
||||
variant="solo"
|
||||
v-model="search"
|
||||
@keydown.enter="optionSelected()"
|
||||
@keydown.tab="optionSelected()"
|
||||
:class="{ error: validations?.$errors?.length }"
|
||||
:hint="
|
||||
validations?.$errors
|
||||
@@ -27,6 +28,11 @@ export default {
|
||||
emits: ['option-selected'],
|
||||
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
|
||||
options: {
|
||||
type: Array,
|
||||
required: true
|
||||
@@ -35,6 +41,16 @@ export default {
|
||||
validations: {
|
||||
type: Object || null,
|
||||
required: false
|
||||
},
|
||||
|
||||
clearOnSubmit: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
|
||||
value: {
|
||||
required: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -72,22 +88,39 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.value)
|
||||
this.search = this.value
|
||||
},
|
||||
|
||||
methods: {
|
||||
optionSelected() {
|
||||
if (!this.suggestion)
|
||||
return
|
||||
|
||||
this.$emit('option-selected', this.suggestion)
|
||||
this.search = ''
|
||||
|
||||
if (this.clearOnSubmit)
|
||||
this.search = ''
|
||||
else
|
||||
this.search = this.suggestion.value
|
||||
},
|
||||
|
||||
_normalize(value) {
|
||||
if (!value) return ''
|
||||
|
||||
return value
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.normalize("NFD")
|
||||
.replace(/[\u0300-\u036f]/g, "")
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
value(value) {
|
||||
this.search = value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
<v-icon class="mx-1" icon="mdi-cloud-upload-outline"></v-icon>NAHRAŤ
|
||||
</v-btn>
|
||||
|
||||
<div v-if="files.length" class="m-2 d-flex align-center flex-wrap">
|
||||
<div v-if="uploadedFiles" class="m-2 d-flex align-center flex-wrap">
|
||||
<div
|
||||
v-for="file in files"
|
||||
v-for="file in uploadedFiles"
|
||||
:key="file.name"
|
||||
class="mx-2"
|
||||
>
|
||||
<v-chip class="mt-2">
|
||||
{{ file.name }}
|
||||
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
|
||||
<v-icon size="small" icon="mdi-close" @click.stop="remove(files.indexOf(file))"></v-icon>
|
||||
<v-icon size="small" icon="mdi-close" @click.stop="remove(uploadedFiles.indexOf(file))"></v-icon>
|
||||
</v-chip>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,20 +28,32 @@
|
||||
export default {
|
||||
emit: ['files-uploaded'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
files: [],
|
||||
}
|
||||
},
|
||||
props: {
|
||||
files: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
uploadedFiles: []
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.uploadedFiles = this.files
|
||||
console.log(this.uploadedFiles)
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChange() {
|
||||
this.files = [...this.files, ...this.$refs.fileUpload.files]
|
||||
this.$emit('files-uploaded', this.files)
|
||||
this.uploadedFiles = [...this.uploadedFiles, ...this.$refs.fileUpload.files]
|
||||
this.$emit('files-uploaded', this.uploadedFiles)
|
||||
},
|
||||
|
||||
remove(index) {
|
||||
this.files.splice(index, 1)
|
||||
this.uploadedFiles.splice(index, 1)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export default {
|
||||
return moment(date).isBefore(moment(compareTo))
|
||||
},
|
||||
|
||||
isAfter(date, compareTo = null) {
|
||||
isAfter(date, compareTo = moment()) {
|
||||
return moment(date).isAfter(moment(compareTo))
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ export default {
|
||||
} else {
|
||||
event.completed = !event.completed
|
||||
try {
|
||||
await this.$axios.patch_auth(`v1/tasks/${event.id}`, event)
|
||||
await this.$axios.patch_auth(`v1/subtasks/${event.id}`, event)
|
||||
this.$emit('reopenTask', event)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
|
||||
@@ -86,7 +86,8 @@ export default {
|
||||
background: unset
|
||||
&:deep(.fc-day-today)
|
||||
background: white
|
||||
a
|
||||
|
||||
.fc-daygrid-day-top a
|
||||
background: #3700B3
|
||||
width: 28px
|
||||
color: white
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<v-row class="px-10 py-8 subheader">
|
||||
<v-select v-model="filter.selectedProject" class="subheader-input" :items="[null, projects]" label="Projekt" variant="outlined" :disabled="true" />
|
||||
<v-select v-model="filter.selectedProject" class="subheader-input" :items="[null, ...projects]" item-title="name" item-value="id" label="Projekt" variant="outlined" />
|
||||
|
||||
<v-select v-model="filter.selectedTeam" class="subheader-input" :items="[null, ...teams]" label="Tím" variant="outlined" item-title="name" item-value="id" />
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<script>
|
||||
import AProjectCalendar from './_components/a-project-calendar.vue'
|
||||
import AProjectFilter from './_components/a-project-filter.vue'
|
||||
import moment from 'moment'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -19,8 +18,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// Kravarik: Toto je preco hardcodenute?
|
||||
projects: ['Projekt1', 'Projekt2', 'Projekt3', 'Projekt4'],
|
||||
projects: null,
|
||||
masterTasks: null,
|
||||
teams: null,
|
||||
employees: null,
|
||||
@@ -43,6 +41,10 @@ export default {
|
||||
if (!this.filter.showFinishedTasks)
|
||||
events = events.filter(event => !event.is_finished)
|
||||
|
||||
// filter by project_id
|
||||
if(this.filter.selectedProject)
|
||||
events = events.filter(event => event.project_id == this.filter.selectedProject)
|
||||
|
||||
// filter by team_id
|
||||
if (this.filter.selectedTeam)
|
||||
events = events.filter(event => event.team_id == this.filter.selectedTeam)
|
||||
@@ -76,10 +78,22 @@ export default {
|
||||
this._getData()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$events.on('on-master-task-deleted', (masterTask) => {
|
||||
this.masterTasks = this.masterTasks.filter(mt => mt.id != masterTask.id)
|
||||
})
|
||||
|
||||
this.$events.on('on-master-task-edited', (masterTask) => {
|
||||
this.masterTasks = this.masterTasks.map(mTask => mTask.id == masterTask.id ? masterTask : mTask)
|
||||
this._getData()
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
async _getData() {
|
||||
try {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||
this.projects = await this.$axios.get_auth_data('v1/projects')
|
||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||
} catch (error) {
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
></v-icon>
|
||||
</div>
|
||||
<Z-autocomplete
|
||||
label="Vyhľadať zamestnanca"
|
||||
:options="employeesOptions"
|
||||
class="modal-input"
|
||||
:class="{ error: v$.blocker.employees.$errors.length }"
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-drag-vertical" size="large"></v-icon>
|
||||
<p class="mx-3">Status</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p v-if="masterTask.is_finished" class="status-badge px-4 py-2 rounded-pill">Ukončený</p>
|
||||
<p v-if="!masterTask.is_finished" class="status-badge px-4 py-2 rounded-pill">Neukončený</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-calendar-week" size="large"></v-icon>
|
||||
<p class="mx-3">Deadline</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p :class="`${tmUtils.isAfter(masterTask.deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDateTime(masterTask.deadline) }}</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2 pt-0">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-account-multiple-outline" size="large"></v-icon>
|
||||
<p class="mx-3">Tím</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<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>
|
||||
<p class="ml-2" v-html="`${masterTask.employees[index].name} ${masterTask.employees[index].surname}`" />
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-clock-time-three-outline" size="large"></v-icon>
|
||||
<p class="mx-3">Naplánovaný čas</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p>{{ masterTask?.duration?.toFixed(2) }} h</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-timer-outline" size="large"></v-icon>
|
||||
<p class="mx-3">Odpracovaný čas</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<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>
|
||||
<v-row no-gutters class="align-center border-bottom">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-clock-time-three-outline" size="large"></v-icon>
|
||||
<p class="mx-3">Zostávajúci čas</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<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>
|
||||
<div class="px-5 py-5 border-bottom">
|
||||
<p>Popis zadania</p>
|
||||
<section v-html="masterTask.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 v-for="(file, index) in masterTask.files" :key="file.id" class="d-flex align-center flex-wrap" :class="[index === 0 ? 'ml-0' : 'ml-2']">
|
||||
<v-chip class="mt-2">
|
||||
<p @click="downloadFile(index)" class="cursor-pointer">{{ file.name }}</p>
|
||||
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
|
||||
</v-chip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
import * as FileSaver from 'file-saver'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
masterTask: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
tmUtils
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async downloadFile(id) {
|
||||
try {
|
||||
const file = await this.$axios.get_auth_data(`v1/mastertasks/${this.masterTask.id}`, { responseType: 'arraybuffer' })
|
||||
FileSaver.saveAs(file.files[id].path, file.files[id].name)
|
||||
} catch(error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="sass" scoped>
|
||||
@media screen and (max-width: 522px)
|
||||
.files
|
||||
margin-top: 104px !important
|
||||
</style>
|
||||
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<v-table class="mt-7 mb-5">
|
||||
<tbody class="px-5 py-5">
|
||||
<tr v-for="task in enrichedtasks" :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">
|
||||
{{ task._employeeInitials }}
|
||||
</p>
|
||||
<p class="ml-2">{{ task._employeeFullName }}</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="text-light-green" v-if="task.is_finished">Ukončený</p>
|
||||
<p v-if="!task.is_finished">Neukončený</p>
|
||||
</td>
|
||||
<td class="task-action">
|
||||
<div class="d-flex justify-start">
|
||||
<img v-if="task.is_finished" class="pencil-icon is-finished" :src="require('@/plugins/tm@dashboard/_components/_img/checkmark.svg')" alt="checkmark-icon" @click.stop="clickCompleteTask(task)">
|
||||
<img v-if="!task.is_finished" class="pencil-icon" :src="require('@/plugins/tm@dashboard/_components/_img/checkmark.svg')" alt="checkmark-icon" @click.stop="clickCompleteTask(task)">
|
||||
<img class="pencil-icon ml-2" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="openEditTaskModal(task)">
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
tasks: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
|
||||
employees: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
enrichedtasks() {
|
||||
return this.tasks.map(task => {
|
||||
const employee = this.employees.find(employee => employee.id == task.employee_id)
|
||||
|
||||
return {
|
||||
...task,
|
||||
_employeeInitials: employee.name.charAt(0) + employee.surname.charAt(0),
|
||||
_employeeFullName: `${employee.name} ${employee.surname}`
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
openDeleteTaskModal(task) {
|
||||
this.$events.emit('show-delete-task-modal', { task })
|
||||
},
|
||||
|
||||
openEditTaskModal(task) {
|
||||
this.$events.emit('show-task-modal', { task, editMode: false })
|
||||
},
|
||||
|
||||
async clickCompleteTask(task) {
|
||||
if (!task.is_finished) {
|
||||
this.openCompleteTaskModal(task)
|
||||
} else {
|
||||
task.is_finished = !task.is_finished
|
||||
try {
|
||||
await this.$axios.patch_auth(`v1/subtasks/${task.id}`, task)
|
||||
this.$emit('reopenTask', task)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
openCompleteTaskModal(task) {
|
||||
this.$events.emit('show-complete-task-modal', { task })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="sass" scoped>
|
||||
v-table, tbody
|
||||
border-top: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
|
||||
border-bottom: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
|
||||
|
||||
td:not(:last-child)
|
||||
border-right: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
export default {
|
||||
computed: {
|
||||
employeesOptions() {
|
||||
const selectedEmployees = [...this.masterTask.employees, ...this.masterTask.team?.employees]
|
||||
.map(employee => employee.id)
|
||||
|
||||
const employees = this.employees.filter(
|
||||
(employee) => !selectedEmployees.includes(employee.id)
|
||||
) || []
|
||||
|
||||
return employees.map((employee) => {
|
||||
return {
|
||||
key: employee.id,
|
||||
value: `${employee.name} ${employee.surname}`,
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onProjectSelected({ key }) {
|
||||
const project = this.projects.find(project => project.id == key)
|
||||
this.masterTask.project_code = project.code
|
||||
this.masterTask.project_id = project.id
|
||||
},
|
||||
|
||||
onMasterTaskSelected({ key }) {
|
||||
const masterTask = this.masterTasks.find(masterTask => masterTask.id == key)
|
||||
this.task.master_task.name = masterTask.name
|
||||
this.task.master_task.id = masterTask.id
|
||||
this.task.project_code = masterTask.project_code
|
||||
},
|
||||
|
||||
onEmployeeSelected({ key }) {
|
||||
const employee = this.employees.find(employee => employee.id == key)
|
||||
this.masterTask.employees.push(employee)
|
||||
this.showAddEmployeeInput = false
|
||||
},
|
||||
|
||||
onEmployeeDurationChanged() {
|
||||
let totalDuration = 0
|
||||
|
||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
||||
if (typeof employee.duration == 'string') {
|
||||
totalDuration += parseInt(employee.duration)
|
||||
employee.duration = parseInt(employee.duration)
|
||||
}
|
||||
else if (typeof employee.duration == 'number') {
|
||||
totalDuration += employee.duration
|
||||
}
|
||||
|
||||
return employee
|
||||
})
|
||||
|
||||
this.masterTask.duration = totalDuration
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'masterTask.team_id'(value, oldValue) {
|
||||
if (!value || !oldValue) return
|
||||
|
||||
this.masterTask.team = this.teams.find(team => team.id == value)
|
||||
this.masterTask.employees = this.masterTask.team.employees
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,131 +4,50 @@
|
||||
<v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling">
|
||||
<div class="d-flex justify-space-between align-center modal-header">
|
||||
<h1>{{ masterTask?.id ? 'Upraviť master task' : 'Vytvoriť master task' }}</h1>
|
||||
<v-icon
|
||||
@click.stop="closeModal()"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large"></v-icon>
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="masterTask.project_code"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
label="Kód projektu"
|
||||
variant="solo"
|
||||
:class="{ error: v$.masterTask.project_code.$errors.length }"
|
||||
:hint="
|
||||
v$.masterTask.project_code.$errors
|
||||
? errorUtils.parseErrors(v$.masterTask.project_code.$errors)
|
||||
: null
|
||||
"
|
||||
></v-text-field>
|
||||
<Z-autocomplete label="Kód projektu" :options="projects.map((project) => ({ key: project.id, value: project.code }))" :validations="v$.masterTask.project_code" :clear-on-submit="false" :value="masterTask.project_code" :class="{ error: v$.masterTask.project_code.$errors.length }" class="modal-input" @option-selected="onProjectSelected" />
|
||||
|
||||
<v-text-field
|
||||
v-model="masterTask.name"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
label="Názov mastertasku"
|
||||
variant="solo"
|
||||
:class="{ error: v$.masterTask.name.$errors.length }"
|
||||
:hint="
|
||||
v$.masterTask.name.$errors
|
||||
? errorUtils.parseErrors(v$.masterTask.name.$errors)
|
||||
: null
|
||||
"
|
||||
></v-text-field>
|
||||
<v-text-field v-model="masterTask.name" @focus="onInputFocus" class="modal-input" label="Názov mastertasku" variant="solo" :class="{ error: v$.masterTask.name.$errors.length }" :hint="v$.masterTask.name.$errors ? errorUtils.parseErrors(v$.masterTask.name.$errors) : null"></v-text-field>
|
||||
|
||||
<Datepicker
|
||||
v-model="masterTask.deadline"
|
||||
@focus="onDateFocus"
|
||||
class="modal-input"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
:class="{ error: v$.masterTask.deadline.$errors.length }"
|
||||
select-text="Vybrať"
|
||||
cancel-text="Zrušiť"
|
||||
placeholder="Deadline"
|
||||
/>
|
||||
<Datepicker v-model="masterTask.deadline" @focus="onDateFocus" class="modal-input" format="dd.MM.yyyy, HH:mm" locale="sk" :class="{ error: v$.masterTask.deadline.$errors.length }" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Deadline" />
|
||||
|
||||
<v-text-field
|
||||
v-model="masterTask.duration"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input mt-5"
|
||||
variant="solo"
|
||||
type="number"
|
||||
:value="totalHours"
|
||||
disabled
|
||||
:label="totalHours + ' h'"
|
||||
></v-text-field>
|
||||
<v-text-field v-model="masterTask.duration" @focus="onInputFocus" class="modal-input mt-5" variant="solo" type="number" disabled :label="`${masterTask.duration} h`"></v-text-field>
|
||||
|
||||
<v-select
|
||||
v-model="teamSelect"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="Tím"
|
||||
variant="solo"
|
||||
:items="teams"
|
||||
item-value="id"
|
||||
item-title="name"
|
||||
></v-select>
|
||||
<v-select v-model="this.masterTask.team_id" @focus="onInputFocus" class="modal-input border-select" :class="{ error: v$.masterTask.team_id.$errors.length }" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
|
||||
|
||||
<v-text-field
|
||||
v-for="(employee, index) in masterTask.employees"
|
||||
:key="employee.id"
|
||||
@focus="onInputFocus"
|
||||
:class="{ error: masterTask.employees[index].hours < 0 }"
|
||||
class="modal-input"
|
||||
:label="`${employee.name} ${employee.surname}`"
|
||||
variant="solo"
|
||||
placeholder="h"
|
||||
v-model="masterTask.employees[index].hours"
|
||||
type="number"
|
||||
min="1"
|
||||
>
|
||||
<v-text-field v-for="(employee, index) in masterTask.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.employees[index].duration }" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="masterTask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||
</p>
|
||||
</v-text-field>
|
||||
|
||||
<Z-autocomplete
|
||||
v-if="showAddEmployeeInput"
|
||||
:options="employeesOptions"
|
||||
:validations="v$.masterTask.employees"
|
||||
:class="{ error: v$.masterTask.employees.$errors.length }"
|
||||
class="modal-input"
|
||||
@option-selected="employeeSelected"
|
||||
/>
|
||||
<!-- <v-text-field v-for="(employee, index) in masterTask.team?.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.team.employees[index].duration }" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="masterTask.team.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||
</p>
|
||||
</v-text-field> -->
|
||||
|
||||
<v-btn class="w-100 mb-5 button secondary" :disabled="!masterTask.team?.id" @click="showAddEmployeeInput = true">
|
||||
<v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca
|
||||
</v-btn>
|
||||
<Z-autocomplete label="Vyhľadať zamestnanca" v-if="showAddEmployeeInput" :options="employeesOptions" class="modal-input" @option-selected="onEmployeeSelected" />
|
||||
|
||||
<div class="w-100 modal-input">
|
||||
<QuillEditor
|
||||
v-model="masterTask.description"
|
||||
placeholder="Popis"
|
||||
theme="snow"
|
||||
class="rich-text-editor"
|
||||
/>
|
||||
<v-btn class="w-100 mb-5 button secondary" :disabled="!masterTask.team?.id" @click="showAddEmployeeInput = true"> <v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca </v-btn>
|
||||
|
||||
<div class="w-100 modal-input" :class="{ error: v$.masterTask.description.$errors.length }">
|
||||
<QuillEditor ref="description" v-model="masterTask.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="masterTask.description = $event.srcElement.innerHTML" />
|
||||
</div>
|
||||
|
||||
<Z-files-upload class="mt-15 files" @files-uploaded="filesUploaded"/>
|
||||
<Z-files-upload class="mt-15 files" :files="masterTask.files" @files-uploaded="filesUploaded" />
|
||||
</v-card-actions>
|
||||
|
||||
<v-btn class="button primary" @click="save()">VYTVORIŤ</v-btn>
|
||||
<v-btn class="button primary" @click="save()">{{ masterTask.id ? 'ULOŽIŤ' : 'VYTVORIŤ' }}</v-btn>
|
||||
</v-card>
|
||||
|
||||
<v-card v-else height="100%" class="d-flex flex-column scrolling">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<p>{{ masterTask.project_code }}</p>
|
||||
<v-icon
|
||||
@click.stop="closeModal()"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
class="pb-5"
|
||||
></v-icon>
|
||||
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large" class="pb-5"></v-icon>
|
||||
</div>
|
||||
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
|
||||
<h1>{{ masterTask.name }}</h1>
|
||||
@@ -140,159 +59,15 @@
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<div class="w-100">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-drag-vertical"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Status</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p v-if="masterTask.is_finished" class="status-badge px-4 py-2 rounded-pill">Ukončený</p>
|
||||
<p v-if="!masterTask.is_finished" class="status-badge px-4 py-2 rounded-pill">Neukončený</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-calendar-week"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Deadline</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p :class="`${tmUtils.isAfter(masterTask.deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDateTime(masterTask.deadline) }}</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2 pt-0">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-account-multiple-outline"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Tím</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<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>
|
||||
<p class="ml-2" v-html="`${masterTask.employees[index].name} ${masterTask.employees[index].surname}`" />
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-clock-time-three-outline"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Naplánovaný čas</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p>{{ masterTask?.duration?.toFixed(2) }} h</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-timer-outline"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Odpracovaný čas</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<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>
|
||||
<v-row no-gutters class="align-center border-bottom">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-clock-time-three-outline"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Zostávajúci čas</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<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>
|
||||
<div class="px-5 py-5 border-bottom">
|
||||
<p>Popis zadania</p>
|
||||
<section v-html="masterTask.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 v-for="(file, index) in masterTask.files" :key="file.id" class="d-flex align-center flex-wrap" :class="[index === 0 ? 'ml-0': 'ml-2']">
|
||||
<v-chip class="mt-2">
|
||||
<p @click="downloadFile" class="cursor-pointer">{{ file.name }}</p>
|
||||
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
|
||||
</v-chip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<A-task-description :master-task="masterTask" />
|
||||
<div class="d-flex justify-start align-center mt-8">
|
||||
<v-btn class="button primary" @click="save()">Ukončiť mastertask</v-btn>
|
||||
</div>
|
||||
<v-table class="mt-7 mb-5">
|
||||
<tbody class="px-5 py-5">
|
||||
<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">
|
||||
{{ getFullNameByEmployeeId(task.employee_id).initials }}
|
||||
</p>
|
||||
<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}">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
|
||||
<A-tasks-table :tasks="masterTask.subtasks" :employees="employees" />
|
||||
|
||||
<div class="d-flex align-center ">
|
||||
<v-btn class="subtask-btn w-100" @click="addTask()" ><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ť task</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-actions>
|
||||
@@ -302,26 +77,35 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Datepicker from '@vuepic/vue-datepicker'
|
||||
import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue'
|
||||
import useVuelidate from '@vuelidate/core'
|
||||
import { required } from '@vuelidate/validators'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
||||
import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
|
||||
import moment from 'moment'
|
||||
import { QuillEditor } from '@vueup/vue-quill'
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
import * as FileSaver from 'file-saver'
|
||||
import Datepicker from '@vuepic/vue-datepicker'
|
||||
import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue'
|
||||
import useVuelidate from '@vuelidate/core'
|
||||
import { required } from '@vuelidate/validators'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
||||
import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
|
||||
import moment from 'moment'
|
||||
import { QuillEditor } from '@vueup/vue-quill'
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
|
||||
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
||||
|
||||
const atLeastOne = (value) => value.length
|
||||
import SelectsMixin from './_mixins/selects.mixin'
|
||||
import ATasksTable from './_components/a-tasks-table.vue'
|
||||
import ATaskDescription from './_components/a-task-description.vue'
|
||||
|
||||
export default {
|
||||
emits: ['close'],
|
||||
mixins: [VuetifyFixFocusMixin],
|
||||
// MIXINS
|
||||
// computed: employeesOptions
|
||||
// methods: onProjectSelected, onEmployeeSelected, onEmployeeDurationChanged
|
||||
// watch: masterTask.team_id
|
||||
|
||||
emits: ['master-task-edited', 'close'],
|
||||
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||
|
||||
components: {
|
||||
ATaskDescription,
|
||||
ATasksTable,
|
||||
Datepicker,
|
||||
ZFilesUpload,
|
||||
ZAutocomplete,
|
||||
@@ -330,18 +114,16 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
tmUtils,
|
||||
editMode: false,
|
||||
visible: false,
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
teams: null,
|
||||
projects: null,
|
||||
employees: null,
|
||||
employeeSelect: null,
|
||||
teamSelect: '',
|
||||
masterTask: null,
|
||||
|
||||
showAddEmployeeInput: false
|
||||
showAddEmployeeInput: false,
|
||||
date: null,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -349,11 +131,11 @@ export default {
|
||||
return {
|
||||
masterTask: {
|
||||
project_code: { required },
|
||||
team_id: { required },
|
||||
name: { required },
|
||||
team: { required },
|
||||
deadline: { required },
|
||||
employees: { atLeastOne }
|
||||
},
|
||||
description: { required },
|
||||
deadline: { required }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -361,143 +143,116 @@ export default {
|
||||
this.$events.on('on-master-task-deleted', (masterTask) => {
|
||||
if (masterTask?.id == this.masterTask?.id) this.closeModal()
|
||||
})
|
||||
|
||||
this.$events.on('on-task-deleted', (task) => {
|
||||
this.masterTask.subtasks = this.masterTask.subtasks.filter((subtask) => subtask.id != task.id)
|
||||
})
|
||||
|
||||
this.$events.on('on-task-edited', (task) => {
|
||||
if (!this.masterTask.subtasks) return
|
||||
|
||||
if (this.masterTask.subtasks.find(subtask => subtask.id == task.id)) {
|
||||
this.masterTask.subtasks = this.masterTask.subtasks.map(t => t.id == task.id ? task : t)
|
||||
} else {
|
||||
this.masterTask.subtasks.push(task)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
this.$events.off('on-master-task-deleted')
|
||||
this.$events.off('on-task-deleted')
|
||||
this.$events.off('on-task-edited')
|
||||
},
|
||||
|
||||
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
|
||||
this.teamSelect = null
|
||||
this.employeeSelect = null
|
||||
this.v$.$reset()
|
||||
this.visible = true
|
||||
this.masterTask = null
|
||||
|
||||
try {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||
this.projects = await this.$axios.get_auth_data('v1/projects')
|
||||
const employees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.employees = tmUtils.enrichEmployeesByFullName(employees)
|
||||
this.employees = tmUtils.enrichEmployeesByFullName(employees)
|
||||
|
||||
if (masterTask?.id) {
|
||||
this.masterTask = await this.$axios.get_auth_data(`v1/mastertasks/${masterTask.id}`)
|
||||
this.teamSelect = this.masterTask.team.id
|
||||
|
||||
const project = this.projects.find((project) => project.code == this.masterTask?.project_code)
|
||||
|
||||
this.masterTask.team_id = this.masterTask.team.id
|
||||
this.masterTask.project_id = project.id
|
||||
this.masterTask.project_code = project.code
|
||||
|
||||
// TODO refactor
|
||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
||||
const subtask = this.masterTask?.subtasks.find(subtask => subtask.employee_id == employee.id)
|
||||
employee.duration = subtask.duration
|
||||
|
||||
return employee
|
||||
})
|
||||
|
||||
console.log(this.masterTask.employees)
|
||||
} else {
|
||||
this.masterTask = {team: {}, employees: []}
|
||||
this.masterTask = { employees: [], duration: 0 }
|
||||
}
|
||||
|
||||
this.editMode = (editMode || !this.masterTask.id)
|
||||
this.editMode = editMode || !this.masterTask.id
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (!(await this.v$.$validate()))
|
||||
return
|
||||
if (!(await this.v$.$validate())) return
|
||||
|
||||
this.masterTask.description = this.$refs['description'].getHTML()
|
||||
|
||||
// this.masterTask.subtasks = this.masterTask.subtasks.map(subtask => {
|
||||
// const employee = this.masterTask.employees.find(employee => employee.id == subtask.employee_id)
|
||||
// subtask.duration = employee.duration
|
||||
|
||||
// return subtask
|
||||
// })
|
||||
|
||||
// this.masterTask.project_code = null
|
||||
|
||||
try {
|
||||
if (this.masterTask.id)
|
||||
await this.$axios.put_auth(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
||||
this.masterTask.deadline = moment(this.masterTask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
||||
|
||||
else
|
||||
await this.$axios.post_auth('v1/mastertasks', this.masterTask)
|
||||
if (this.masterTask.id) await this.$axios.put_auth_data(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
||||
else await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
||||
|
||||
this.$emit('master-task-edited', this.masterTask)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast(error)
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
this.$emit('close', this.masterTask)
|
||||
},
|
||||
|
||||
openDeleteMasterTaskModal(masterTask) {
|
||||
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
||||
},
|
||||
|
||||
employeeSelected(selectedOption) {
|
||||
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
|
||||
this.masterTask.employees.push(employee)
|
||||
this.showAddEmployeeInput = false
|
||||
},
|
||||
|
||||
filesUploaded(files) {
|
||||
this.masterTask.files = files
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
},
|
||||
|
||||
openDeleteMasterTaskModal(masterTask) {
|
||||
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
||||
},
|
||||
|
||||
addTask() {
|
||||
this.$events.emit('show-task-modal', {})
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
totalHours() {
|
||||
let hours = 0
|
||||
|
||||
this.masterTask.employees.forEach(function(employee) {
|
||||
if(employee.hours > 0) hours += parseFloat(employee.hours)
|
||||
})
|
||||
|
||||
return hours ? hours : 0
|
||||
},
|
||||
|
||||
employeesOptions() {
|
||||
const selectedEmployeesIds = this.masterTask.employees.map(
|
||||
(employee) => employee.id
|
||||
)
|
||||
const employees = this.employees.filter(
|
||||
(employee) => !selectedEmployeesIds.includes(employee.id)
|
||||
) || []
|
||||
|
||||
return employees.map((employee) => {
|
||||
return {
|
||||
key: employee.id,
|
||||
value: `${employee.name} ${employee.surname}`,
|
||||
}
|
||||
})
|
||||
this.$events.emit('show-task-modal', { task: null, editMode: false, masterTask: this.masterTask })
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
teamSelect(value) {
|
||||
if (!value || !this.masterTask) return
|
||||
|
||||
this.masterTask.team = this.teams.find(team => team.id == value)
|
||||
this.masterTask.employees = this.masterTask.team.employees
|
||||
},
|
||||
|
||||
employeeSelect(value) {
|
||||
if (!value || !this.masterTask) return
|
||||
|
||||
const employee = this.employees.find(employee => employee.id == value)
|
||||
this.masterTask.employees.push(employee)
|
||||
|
||||
editMode() {
|
||||
this.$nextTick(() => {
|
||||
this.employeeSelect = null
|
||||
this.$el.activeElement.blur()
|
||||
// console.log(this.$refs['employee-select'])
|
||||
// this.$refs['employee-select'].focused = false
|
||||
// this.employeeSelect = ''
|
||||
this.$refs['description']?.setHTML(this.masterTask.description || '')
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -523,20 +278,10 @@ export default {
|
||||
.border-bottom
|
||||
border-bottom: 1px solid rgba(0,0,0,.1)
|
||||
|
||||
|
||||
.subtask-btn
|
||||
border: thin solid rgba(var(--v-border-color), var(--v-border-opacity)) !important
|
||||
color: #7f39fb !important
|
||||
height: 53px
|
||||
text-align: center
|
||||
|
||||
v-table, tbody
|
||||
border-top: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
|
||||
border-bottom: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
|
||||
|
||||
td:not(:last-child)
|
||||
border-right: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
|
||||
|
||||
@media screen and (max-width: 522px)
|
||||
.files
|
||||
margin-top: 104px !important
|
||||
</style>
|
||||
@@ -2,8 +2,7 @@
|
||||
<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>
|
||||
|
||||
<h1>Ste si istý, že chcete {{ this.task?.id ? 'ukončiť' : 'obnoviť' }} task, z masterTasku <b>{{ task.master_task }}</b>?</h1>
|
||||
<v-icon
|
||||
@click.stop="visible = false"
|
||||
icon="mdi-close"
|
||||
@@ -38,7 +37,7 @@ export default {
|
||||
async complete() {
|
||||
try {
|
||||
const task = {...this.task, is_finished: true}
|
||||
await this.$axios.patch_auth(`v1/tasks/${this.task.id}`, task)
|
||||
await this.$axios.patch_auth(`v1/subtasks/${this.task.id}`, task)
|
||||
this.visible = false
|
||||
this.$emit('task-completed', task)
|
||||
} catch (error) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<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()"
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
|
||||
async deleteTask() {
|
||||
try {
|
||||
await this.$axios.delete(`v1/tasks/${this.task.id}`)
|
||||
await this.$axios.delete(`v1/subtasks/${this.task.id}`)
|
||||
this.$emit('on-task-deleted', this.task)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
|
||||
@@ -10,49 +10,49 @@
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="task.project_code"
|
||||
label="Kód projektu"
|
||||
:value="task.project_code"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
label="Kód projektu"
|
||||
variant="solo"
|
||||
disabled
|
||||
></v-text-field>
|
||||
|
||||
<!-- Toto treba fixnut -->
|
||||
<v-select
|
||||
v-model="masterTaskIdSelect"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="MasterTask"
|
||||
variant="solo"
|
||||
:items="masterTasks"
|
||||
item-value="id"
|
||||
item-title="name"
|
||||
></v-select>
|
||||
<Z-autocomplete
|
||||
label="Master task"
|
||||
:options="masterTasks.map((masterTask) => ({ key: masterTask.id, value: masterTask.name }))"
|
||||
:validations="v$.task.master_task.id"
|
||||
:clear-on-submit="false"
|
||||
:value="task.master_task.masterTask_name"
|
||||
:class="{ error: v$.task.master_task.id.$errors.length }"
|
||||
class="modal-input"
|
||||
@option-selected="onMasterTaskSelected"
|
||||
/>
|
||||
|
||||
<v-select
|
||||
v-model="employeeIdSelect"
|
||||
v-model="task.employee_id"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="Priradený"
|
||||
:class="{ error: v$.task.employee_id.$errors.length }"
|
||||
variant="solo"
|
||||
:items="employees"
|
||||
:items="filteredEmployees"
|
||||
item-value="id"
|
||||
item-title="_fullName"
|
||||
></v-select>
|
||||
|
||||
<Datepicker
|
||||
<!-- <Datepicker
|
||||
class="modal-input mb-5"
|
||||
v-model="task.date"
|
||||
v-model="task.timeblocks"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
:class="{ error: v$.task.date.$errors.length }"
|
||||
:time-picker-position="'right'"
|
||||
@focus="onDateFocus"
|
||||
:validations="v$.task.date"
|
||||
select-text="Vybrať"
|
||||
cancel-text="Zrušiť"
|
||||
placeholder="Trvanie od - do"
|
||||
range
|
||||
/>
|
||||
/> -->
|
||||
|
||||
<v-text-field
|
||||
v-model="task.duration"
|
||||
@@ -70,16 +70,18 @@
|
||||
append-inner-icon="mdi-clock-outline"
|
||||
></v-text-field>
|
||||
|
||||
<div class="w-100 modal-input">
|
||||
<div class="w-100 modal-input" :class="{ error: v$.task.description.$errors.length }">
|
||||
<QuillEditor
|
||||
ref="description"
|
||||
v-model="task.description"
|
||||
placeholder="Popis"
|
||||
theme="snow"
|
||||
class="rich-text-editor"
|
||||
@input="task.description = $event.srcElement.innerHTML"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Z-files-upload class="mt-15 files" @files-uploaded="filesUploaded" />
|
||||
<Z-files-upload class="mt-15 files" :files="task.files" @files-uploaded="filesUploaded" />
|
||||
</v-card-actions>
|
||||
|
||||
<v-btn class="button primary" @click="save()">{{
|
||||
@@ -211,8 +213,6 @@
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||
<Datepicker
|
||||
v-model="selectedNewDate"
|
||||
:class="{ error: v$.selectedNewDate.$errors.length }"
|
||||
:validations="v$.selectedNewDate"
|
||||
class="modal-input"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
@@ -336,7 +336,7 @@
|
||||
:class="[index === 0 ? 'ml-0' : 'ml-2']"
|
||||
>
|
||||
<v-chip class="mt-2">
|
||||
<p @click="downloadFile" class="cursor-pointer">
|
||||
<p @click="downloadFile(index)" class="cursor-pointer">
|
||||
{{ file.name }}
|
||||
</p>
|
||||
<v-icon
|
||||
@@ -371,18 +371,21 @@ import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import moment from 'moment'
|
||||
import { QuillEditor } from '@vueup/vue-quill'
|
||||
import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
|
||||
import SelectsMixin from '../master-task/_mixins/selects.mixin'
|
||||
import * as FileSaver from 'file-saver'
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
||||
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
||||
|
||||
export default {
|
||||
emits: ['close', 'refresh'],
|
||||
mixins: [VuetifyFixFocusMixin],
|
||||
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||
|
||||
components: {
|
||||
Datepicker,
|
||||
ZFilesUpload,
|
||||
QuillEditor,
|
||||
ZAutocomplete
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -395,32 +398,35 @@ export default {
|
||||
v$: useVuelidate(),
|
||||
preventInputFocus: false,
|
||||
masterTasks: [],
|
||||
employees: null,
|
||||
masterTaskIdSelect: null,
|
||||
employeeIdSelect: null,
|
||||
showDatePicker: false,
|
||||
selectedNewDate: []
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
employees() {
|
||||
if (!this.task?.master_task?.employees)
|
||||
filteredEmployees() {
|
||||
if (!this.employees || !this.task?.master_task)
|
||||
return []
|
||||
|
||||
return tmUtils.enrichEmployeesByFullName(this.task.master_task.employees)
|
||||
const selectedEmployees = this.task.master_task.employees?.map(employee => employee.id) || []
|
||||
const filteredEmployees = this.employees.filter(employee => !selectedEmployees.includes(employee.id))
|
||||
|
||||
return tmUtils.enrichEmployeesByFullName(filteredEmployees)
|
||||
}
|
||||
},
|
||||
|
||||
validations() {
|
||||
return {
|
||||
task: {
|
||||
// project_code: { required },
|
||||
date: { required },
|
||||
// team: { required },
|
||||
description: { required },
|
||||
master_task: {
|
||||
id: { required }
|
||||
},
|
||||
duration: { required },
|
||||
employee: { required },
|
||||
},
|
||||
selectedNewDate: { required }
|
||||
employee_id: { required }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -431,21 +437,26 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal(task, editMode = false) {
|
||||
this.visible = true
|
||||
this.task = null
|
||||
async showModal(task, editMode = false, masterTask = {}) {
|
||||
this.v$.$reset()
|
||||
this.visible = true
|
||||
this.task = null
|
||||
this.masterTaskIdSelect = null
|
||||
|
||||
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}`)
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||
|
||||
this.employeeIdSelect = t.employee.id
|
||||
this.masterTaskIdSelect = t.master_task.id
|
||||
this.task = t
|
||||
this.task.spent_time = ((t.spent_time) / 3600000).toFixed(2)
|
||||
if (task?.id) {
|
||||
const t = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
||||
t.master_task = this.masterTasks.find(mt => mt.id == t.master_task_id)
|
||||
t.employee = this.employees.find(employee => employee.id == t.employee_id)
|
||||
|
||||
this.masterTaskIdSelect = t.master_task.id
|
||||
this.task = t
|
||||
} else {
|
||||
this.task = {master_task: {}}
|
||||
this.task = {master_task: masterTask}
|
||||
this.masterTaskIdSelect = masterTask.id
|
||||
}
|
||||
|
||||
this.editMode = (editMode || !this.task.id)
|
||||
@@ -459,16 +470,21 @@ export default {
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (!(await this.v$.$validate())) return
|
||||
console.log(this.task)
|
||||
if (!(await this.v$.$validate()))
|
||||
return console.log(this.v$);
|
||||
|
||||
this.task.description = this.$refs['description'].getHTML()
|
||||
|
||||
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)
|
||||
if (this.task?.id) {
|
||||
await this.$axios.put_auth_data(`v1/subtasks/${this.task.id}`, this.task)
|
||||
} else {
|
||||
await this.$axios.post_auth('v1/mastertasks', this.task)
|
||||
const { subtask } = await this.$axios.post_auth(`v1/mastertasks/${this.task.master_task.id}/subtasks`, this.task)
|
||||
this.task.id = subtask.id
|
||||
}
|
||||
|
||||
this.$events.emit('on-task-edited', this.task)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
@@ -486,6 +502,15 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async downloadFile(id) {
|
||||
try {
|
||||
const file = await this.$axios.get_auth_data(`v1/subtasks/${this.task.id}`, { responseType: 'arraybuffer' })
|
||||
FileSaver.saveAs(file.files[id].path, file.files[id].name)
|
||||
} catch(error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
removeDate(index) {
|
||||
this.task.timeblocks.splice(index, 1)
|
||||
},
|
||||
@@ -503,15 +528,21 @@ export default {
|
||||
masterTaskIdSelect(value) {
|
||||
if (!value || !this.task) return
|
||||
|
||||
this.task.master_task = this.masterTasks.find(masterTask => masterTask.id == value)
|
||||
this.task.master_task = this.masterTasks.find(masterTask => masterTask.id == value)
|
||||
this.task.project_code = this.task.master_task.project_code
|
||||
},
|
||||
|
||||
employeeIdSelect(value) {
|
||||
if (!value || !this.task) return
|
||||
|
||||
this.task.employee = this.task.master_task.employees.find(employee => employee.id == value)
|
||||
'task.employee_id'(value) {
|
||||
if (!value) return
|
||||
this.task.employee = this.employees.find(employee => employee.id == value)
|
||||
},
|
||||
},
|
||||
|
||||
editMode() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs['description']?.setHTML(this.task.description || '')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
</div>
|
||||
|
||||
<Z-autocomplete
|
||||
label="Vyhľadať zamestnanca"
|
||||
:options="employeesOptions"
|
||||
:validations="v$.team.employees"
|
||||
class="modal-input"
|
||||
|
||||
@@ -34,7 +34,7 @@ export default {
|
||||
|
||||
async post(url: string, params = null, config?: any) {
|
||||
|
||||
return axios.post(url, {data: params}, config)
|
||||
return axios.post(url, params, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
},
|
||||
@@ -42,14 +42,14 @@ export default {
|
||||
async post_auth(url: string, params = null, config?: any) {
|
||||
config = this._config(config)
|
||||
|
||||
return axios.post(url, {data: params}, config)
|
||||
return axios.post(url, params, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
},
|
||||
|
||||
async post_data(url: string, params = null, config?: any) {
|
||||
|
||||
return axios.post(url, {data: params}, config)
|
||||
return axios.post(url, params, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
},
|
||||
@@ -57,7 +57,7 @@ export default {
|
||||
async post_auth_data(url: string, params = null, config?: any) {
|
||||
config = this._config(config)
|
||||
|
||||
return axios.post(url, {data: params}, config)
|
||||
return axios.post(url, params, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
},
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
},
|
||||
|
||||
async patch(url: string, params = null, config?: any) {
|
||||
return axios.patch(url, {data: params}, config)
|
||||
return axios.patch(url, params, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
},
|
||||
@@ -99,13 +99,13 @@ export default {
|
||||
async patch_auth(url: string, params = null, config?: any) {
|
||||
config = this._config(config)
|
||||
|
||||
return axios.patch(url, {data: params}, config)
|
||||
return axios.patch(url, params, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
},
|
||||
|
||||
async patch_data(url: string, params = null, config?: any) {
|
||||
return axios.patch(url, {data: params}, config)
|
||||
return axios.patch(url, params, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
},
|
||||
@@ -113,13 +113,13 @@ export default {
|
||||
async patch_auth_data(url: string, params = null, config?: any) {
|
||||
config = this._config(config)
|
||||
|
||||
return axios.patch(url, {data: params}, config)
|
||||
return axios.patch(url, params, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
},
|
||||
|
||||
async put(url: string, params = null, config?: any) {
|
||||
return axios.put(url, {data: params}, config)
|
||||
return axios.put(url, params, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
},
|
||||
@@ -133,7 +133,7 @@ export default {
|
||||
},
|
||||
|
||||
async put_data(url: string, params = null, config?: any) {
|
||||
return axios.put(url, {data: params}, config)
|
||||
return axios.put(url, params, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
},
|
||||
@@ -141,7 +141,7 @@ export default {
|
||||
async put_auth_data(url: string, params = null, config?: any) {
|
||||
config = this._config(config)
|
||||
|
||||
return axios.put(url, {data: params}, config)
|
||||
return axios.put(url, params, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
},
|
||||
|
||||
@@ -1,34 +1,43 @@
|
||||
import { $t } from '@/plugins/app/_config/main'
|
||||
|
||||
export default {
|
||||
parseAndTranslate(data) {
|
||||
const errorsArray = this._parseToArrayOfStrings(data)
|
||||
|
||||
return errorsArray.map(error => this._translate(error))
|
||||
|
||||
// console.log(errorsArray.map(error => $t(error)))
|
||||
return errorsArray.join(', ')
|
||||
|
||||
// return errorsArray.map(error => $t(error))
|
||||
},
|
||||
|
||||
_parseToArrayOfStrings(data) {
|
||||
if (typeof data == 'string') {
|
||||
return [this._translate(data)]
|
||||
return [$t(data)]
|
||||
}
|
||||
|
||||
if (data?.response?.data)
|
||||
return Object.values(data?.response?.data)
|
||||
|
||||
if (data && data.error && typeof data.error == 'string') {
|
||||
return [this._translate(data.error)]
|
||||
return [$t(data.error)]
|
||||
}
|
||||
|
||||
if (data && data.error && typeof data.error == 'object') {
|
||||
return Object.values(this._translate(data.error))
|
||||
return Object.values($t(data.error))
|
||||
}
|
||||
|
||||
if (data.data && data.data.error && typeof data.data.error == 'string') {
|
||||
return [this._translate(data.data.error)]
|
||||
return [$t(data.data.error)]
|
||||
}
|
||||
|
||||
if (data && data.data && data.data.error && typeof data.data.error == 'object') {
|
||||
return Object.values(data.data.error).map(error => this._translate(error[0]) + ' ')
|
||||
return Object.values(data.data.error).map(error => $t(error[0]) + ' ')
|
||||
|
||||
}
|
||||
|
||||
if (data.statusText) {
|
||||
return [this._translate(data.statusText)]
|
||||
return [$t(data.statusText)]
|
||||
}
|
||||
|
||||
return [data]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import store from '@/store'
|
||||
import toastUtils from '@/plugins/w/toast/utils/toast.utils'
|
||||
|
||||
axios.defaults.baseURL = process.env.VUE_APP_WAXIOS_URL
|
||||
|
||||
@@ -7,7 +8,7 @@ export default {
|
||||
async get(url: string, config?: any) {
|
||||
return axios.get(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async get_auth(url: string, config?: any) {
|
||||
@@ -15,13 +16,13 @@ export default {
|
||||
|
||||
return axios.get(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async get_data(url: string, config?: any) {
|
||||
return axios.get(url, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async get_auth_data(url: string, config?: any) {
|
||||
@@ -29,14 +30,14 @@ export default {
|
||||
|
||||
return axios.get(url, config)
|
||||
.then(response => Promise.resolve(response.data.data))
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async post(url: string, params = null, config?: any) {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async post_auth(url: string, params = null, config?: any) {
|
||||
@@ -44,14 +45,14 @@ export default {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async post_data(url: string, params = null, config?: any) {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async post_auth_data(url: string, params = null, config?: any) {
|
||||
@@ -59,13 +60,13 @@ export default {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async delete(url: string, config?: any) {
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async delete_auth(url: string, config?: any) {
|
||||
@@ -73,13 +74,13 @@ export default {
|
||||
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async delete_data(url: string, config?: any) {
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async delete_auth_data(url: string, config?: any) {
|
||||
@@ -87,13 +88,13 @@ export default {
|
||||
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async patch(url: string, params = null, config?: any) {
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async patch_auth(url: string, params = null, config?: any) {
|
||||
@@ -101,13 +102,13 @@ export default {
|
||||
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async patch_data(url: string, params = null, config?: any) {
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async patch_auth_data(url: string, params = null, config?: any) {
|
||||
@@ -115,13 +116,13 @@ export default {
|
||||
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async put(url: string, params = null, config?: any) {
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async put_auth(url: string, params = null, config?: any) {
|
||||
@@ -129,21 +130,21 @@ export default {
|
||||
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async put_data(url: string, params = null, config?: any) {
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async put_auth_data(url: string, params = null, config?: any) {
|
||||
config = this._config(config)
|
||||
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
return axios.put(url, {data: params}, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
_config(config: any) {
|
||||
|
||||
Reference in new issue
Block a user