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
+689
-507
No files matched your search
Generated
+7
-7
@@ -18,7 +18,7 @@
|
|||||||
"@vuelidate/core": "^2.0.0",
|
"@vuelidate/core": "^2.0.0",
|
||||||
"@vuelidate/validators": "^2.0.0",
|
"@vuelidate/validators": "^2.0.0",
|
||||||
"@vuepic/vue-datepicker": "^3.6.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": "^1.1.3",
|
||||||
"axios-auth-refresh": "^3.3.4",
|
"axios-auth-refresh": "^3.3.4",
|
||||||
"core-js": "^3.8.3",
|
"core-js": "^3.8.3",
|
||||||
@@ -3481,9 +3481,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vueup/vue-quill": {
|
"node_modules/@vueup/vue-quill": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.0-beta.11",
|
||||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.0-beta.11.tgz",
|
||||||
"integrity": "sha512-/VJHwUxH2BAms7gwIlNhHb0KfCqn/58onOK1H0ZZX9juEha4nrb32yZbv2xLsqLxf+JKsNbJgQ8Ne6VF8ACNGw==",
|
"integrity": "sha512-TeCgXPyVbN5muBPKm3EZjmIg/s8R8O0YmTp0RRG4J48skJVe035scLjeWZTDVrt/TEagmzcRUcB+9nPIyvF9fQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"quill": "^1.3.7",
|
"quill": "^1.3.7",
|
||||||
"quill-delta": "^4.2.2"
|
"quill-delta": "^4.2.2"
|
||||||
@@ -16417,9 +16417,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@vueup/vue-quill": {
|
"@vueup/vue-quill": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.0-beta.11",
|
||||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.0-beta.11.tgz",
|
||||||
"integrity": "sha512-/VJHwUxH2BAms7gwIlNhHb0KfCqn/58onOK1H0ZZX9juEha4nrb32yZbv2xLsqLxf+JKsNbJgQ8Ne6VF8ACNGw==",
|
"integrity": "sha512-TeCgXPyVbN5muBPKm3EZjmIg/s8R8O0YmTp0RRG4J48skJVe035scLjeWZTDVrt/TEagmzcRUcB+9nPIyvF9fQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"quill": "^1.3.7",
|
"quill": "^1.3.7",
|
||||||
"quill-delta": "^4.2.2"
|
"quill-delta": "^4.2.2"
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
"@vuelidate/core": "^2.0.0",
|
"@vuelidate/core": "^2.0.0",
|
||||||
"@vuelidate/validators": "^2.0.0",
|
"@vuelidate/validators": "^2.0.0",
|
||||||
"@vuepic/vue-datepicker": "^3.6.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": "^1.1.3",
|
||||||
"axios-auth-refresh": "^3.3.4",
|
"axios-auth-refresh": "^3.3.4",
|
||||||
"core-js": "^3.8.3",
|
"core-js": "^3.8.3",
|
||||||
|
|||||||
@@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
<Z-task-modal ref="z-task-modal" @on-task-edited="onTaskEdited" />
|
<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-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-complete-task-modal ref="z-complete-task-modal" @task-completed="onTaskCompleted" />
|
||||||
<Z-task-add-time-modal ref="z-task-add-time-modal" />
|
<Z-task-add-time-modal ref="z-task-add-time-modal" />
|
||||||
<Z-blocker-modal ref="z-blocker-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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -59,8 +59,8 @@ export default {
|
|||||||
this.$refs['z-delete-master-task-modal'].showModal(masterTask)
|
this.$refs['z-delete-master-task-modal'].showModal(masterTask)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('show-task-modal', ({task, editMode}) => {
|
this.$events.on('show-task-modal', ({task, editMode, masterTask}) => {
|
||||||
this.$refs['z-task-modal'].showModal(task, editMode)
|
this.$refs['z-task-modal'].showModal(task, editMode, masterTask)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('show-master-task-modal', ({masterTask, editMode}) => {
|
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.$events.on('show-task-add-time-modal', ({task}) => {
|
||||||
this.$refs['z-task-add-time-modal'].showModal(task)
|
this.$refs['z-task-add-time-modal'].showModal(task)
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -100,6 +99,10 @@ export default {
|
|||||||
|
|
||||||
onMasterTaskDeleted(masterTask){
|
onMasterTaskDeleted(masterTask){
|
||||||
this.$events.emit('on-master-task-deleted', 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/(id)': true,
|
||||||
// 'GET v1/master-tasks': true,
|
// 'GET v1/master-tasks': true,
|
||||||
'POST v1/master-tasks/(id)': true,
|
'POST v1/master-tasks/(id)': true,
|
||||||
'DELETE v1/master-tasks/(id)': true,
|
// 'DELETE v1/master-tasks/(id)': true,
|
||||||
'POST v1/master-tasks': true,
|
// 'POST v1/master-tasks': true,
|
||||||
|
|
||||||
'GET v1/overview/projects': true,
|
// 'GET v1/overview/projects': true,
|
||||||
'GET v1/overview/tasks': true,
|
'GET v1/overview/tasks': true,
|
||||||
'GET v1/overview/teams': true,
|
'GET v1/overview/teams': true,
|
||||||
'GET v1/overview/ongoing-tasks': true,
|
'GET v1/overview/ongoing-tasks': true,
|
||||||
'GET v1/overview/unscheduled-tasks': true,
|
'GET v1/overview/unscheduled-tasks': true,
|
||||||
|
|
||||||
'GET v1/tasks/(id)': true,
|
'GET v1/tasks/(id)': true,
|
||||||
'POST v1/tasks/(id)': true,
|
// 'POST v1/tasks/(id)': true,
|
||||||
'DELETE v1/tasks/(id)': true,
|
'DELETE v1/tasks/(id)': true,
|
||||||
|
|
||||||
// 'GET v1/teams/(id)': true,
|
// 'GET v1/teams/(id)': true,
|
||||||
|
|||||||
@@ -113,4 +113,18 @@ const router = createRouter({
|
|||||||
routes
|
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
|
export default router
|
||||||
@@ -41,6 +41,9 @@
|
|||||||
height: 24px
|
height: 24px
|
||||||
width: 24px
|
width: 24px
|
||||||
|
|
||||||
|
.is-finished
|
||||||
|
background: #06dece !important
|
||||||
|
|
||||||
.add-date
|
.add-date
|
||||||
color: white
|
color: white
|
||||||
border-radius: 50%
|
border-radius: 50%
|
||||||
@@ -78,3 +81,7 @@ input[type="time"]::-webkit-calendar-picker-indicator
|
|||||||
.rich-text-editor
|
.rich-text-editor
|
||||||
.ql-tooltip
|
.ql-tooltip
|
||||||
left: 0 !important
|
left: 0 !important
|
||||||
|
|
||||||
|
.v-toast,
|
||||||
|
.v-toast__item
|
||||||
|
z-index: 10000 !important
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
.v-field
|
.v-field
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0)
|
border-bottom: 1px solid rgba(0, 0, 0, 0)
|
||||||
|
|
||||||
.error .v-field
|
// .error .v-field
|
||||||
border-bottom: 1px solid red
|
// border-bottom: 1px solid red
|
||||||
|
|
||||||
@media screen and (max-width: 904px)
|
@media screen and (max-width: 904px)
|
||||||
.auth-card
|
.auth-card
|
||||||
@@ -48,15 +48,6 @@
|
|||||||
box-shadow: none !important
|
box-shadow: none !important
|
||||||
border: 1px solid rgba(0, 0, 0, .1) !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
|
.v-input__append
|
||||||
margin: 0 !important
|
margin: 0 !important
|
||||||
|
|
||||||
@@ -78,5 +69,16 @@ input::-webkit-inner-spin-button
|
|||||||
.v-select .v-field--variant-solo
|
.v-select .v-field--variant-solo
|
||||||
border: none !important
|
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
|
.v-messages__message
|
||||||
color: red !important
|
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" />
|
: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">
|
<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>
|
<p class="mt-5 text-center cursor-pointer" @click="$router.push({ name: 'Forgot password' })">Forgotten password ?</p>
|
||||||
</div>
|
</div>
|
||||||
</v-form>
|
</v-form>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
label="Vyhľadať zamestnanca"
|
:label="label"
|
||||||
variant="solo"
|
variant="solo"
|
||||||
v-model="search"
|
v-model="search"
|
||||||
@keydown.enter="optionSelected()"
|
@keydown.enter="optionSelected()"
|
||||||
|
@keydown.tab="optionSelected()"
|
||||||
:class="{ error: validations?.$errors?.length }"
|
:class="{ error: validations?.$errors?.length }"
|
||||||
:hint="
|
:hint="
|
||||||
validations?.$errors
|
validations?.$errors
|
||||||
@@ -27,6 +28,11 @@ export default {
|
|||||||
emits: ['option-selected'],
|
emits: ['option-selected'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
@@ -35,6 +41,16 @@ export default {
|
|||||||
validations: {
|
validations: {
|
||||||
type: Object || null,
|
type: Object || null,
|
||||||
required: false
|
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: {
|
methods: {
|
||||||
optionSelected() {
|
optionSelected() {
|
||||||
if (!this.suggestion)
|
if (!this.suggestion)
|
||||||
return
|
return
|
||||||
|
|
||||||
this.$emit('option-selected', this.suggestion)
|
this.$emit('option-selected', this.suggestion)
|
||||||
|
|
||||||
|
if (this.clearOnSubmit)
|
||||||
this.search = ''
|
this.search = ''
|
||||||
|
else
|
||||||
|
this.search = this.suggestion.value
|
||||||
},
|
},
|
||||||
|
|
||||||
_normalize(value) {
|
_normalize(value) {
|
||||||
|
if (!value) return ''
|
||||||
|
|
||||||
return value
|
return value
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.normalize("NFD")
|
.normalize("NFD")
|
||||||
.replace(/[\u0300-\u036f]/g, "")
|
.replace(/[\u0300-\u036f]/g, "")
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
value(value) {
|
||||||
|
this.search = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -8,16 +8,16 @@
|
|||||||
<v-icon class="mx-1" icon="mdi-cloud-upload-outline"></v-icon>NAHRAŤ
|
<v-icon class="mx-1" icon="mdi-cloud-upload-outline"></v-icon>NAHRAŤ
|
||||||
</v-btn>
|
</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
|
<div
|
||||||
v-for="file in files"
|
v-for="file in uploadedFiles"
|
||||||
:key="file.name"
|
:key="file.name"
|
||||||
class="mx-2"
|
class="mx-2"
|
||||||
>
|
>
|
||||||
<v-chip class="mt-2">
|
<v-chip class="mt-2">
|
||||||
{{ file.name }}
|
{{ file.name }}
|
||||||
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
|
<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>
|
</v-chip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,20 +28,32 @@
|
|||||||
export default {
|
export default {
|
||||||
emit: ['files-uploaded'],
|
emit: ['files-uploaded'],
|
||||||
|
|
||||||
|
props: {
|
||||||
|
files: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
files: [],
|
uploadedFiles: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.uploadedFiles = this.files
|
||||||
|
console.log(this.uploadedFiles)
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onChange() {
|
onChange() {
|
||||||
this.files = [...this.files, ...this.$refs.fileUpload.files]
|
this.uploadedFiles = [...this.uploadedFiles, ...this.$refs.fileUpload.files]
|
||||||
this.$emit('files-uploaded', this.files)
|
this.$emit('files-uploaded', this.uploadedFiles)
|
||||||
},
|
},
|
||||||
|
|
||||||
remove(index) {
|
remove(index) {
|
||||||
this.files.splice(index, 1)
|
this.uploadedFiles.splice(index, 1)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default {
|
|||||||
return moment(date).isBefore(moment(compareTo))
|
return moment(date).isBefore(moment(compareTo))
|
||||||
},
|
},
|
||||||
|
|
||||||
isAfter(date, compareTo = null) {
|
isAfter(date, compareTo = moment()) {
|
||||||
return moment(date).isAfter(moment(compareTo))
|
return moment(date).isAfter(moment(compareTo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
event.completed = !event.completed
|
event.completed = !event.completed
|
||||||
try {
|
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)
|
this.$emit('reopenTask', event)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ export default {
|
|||||||
background: unset
|
background: unset
|
||||||
&:deep(.fc-day-today)
|
&:deep(.fc-day-today)
|
||||||
background: white
|
background: white
|
||||||
a
|
|
||||||
|
.fc-daygrid-day-top a
|
||||||
background: #3700B3
|
background: #3700B3
|
||||||
width: 28px
|
width: 28px
|
||||||
color: white
|
color: white
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row class="px-10 py-8 subheader">
|
<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" />
|
<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>
|
<script>
|
||||||
import AProjectCalendar from './_components/a-project-calendar.vue'
|
import AProjectCalendar from './_components/a-project-calendar.vue'
|
||||||
import AProjectFilter from './_components/a-project-filter.vue'
|
import AProjectFilter from './_components/a-project-filter.vue'
|
||||||
import moment from 'moment'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -19,8 +18,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// Kravarik: Toto je preco hardcodenute?
|
projects: null,
|
||||||
projects: ['Projekt1', 'Projekt2', 'Projekt3', 'Projekt4'],
|
|
||||||
masterTasks: null,
|
masterTasks: null,
|
||||||
teams: null,
|
teams: null,
|
||||||
employees: null,
|
employees: null,
|
||||||
@@ -43,6 +41,10 @@ export default {
|
|||||||
if (!this.filter.showFinishedTasks)
|
if (!this.filter.showFinishedTasks)
|
||||||
events = events.filter(event => !event.is_finished)
|
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
|
// filter by team_id
|
||||||
if (this.filter.selectedTeam)
|
if (this.filter.selectedTeam)
|
||||||
events = events.filter(event => event.team_id == this.filter.selectedTeam)
|
events = events.filter(event => event.team_id == this.filter.selectedTeam)
|
||||||
@@ -76,10 +78,22 @@ export default {
|
|||||||
this._getData()
|
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: {
|
methods: {
|
||||||
async _getData() {
|
async _getData() {
|
||||||
try {
|
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')
|
||||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
></v-icon>
|
></v-icon>
|
||||||
</div>
|
</div>
|
||||||
<Z-autocomplete
|
<Z-autocomplete
|
||||||
|
label="Vyhľadať zamestnanca"
|
||||||
:options="employeesOptions"
|
:options="employeesOptions"
|
||||||
class="modal-input"
|
class="modal-input"
|
||||||
:class="{ error: v$.blocker.employees.$errors.length }"
|
: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">
|
<v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling">
|
||||||
<div class="d-flex justify-space-between align-center modal-header">
|
<div class="d-flex justify-space-between align-center modal-header">
|
||||||
<h1>{{ masterTask?.id ? 'Upraviť master task' : 'Vytvoriť master task' }}</h1>
|
<h1>{{ masterTask?.id ? 'Upraviť master task' : 'Vytvoriť master task' }}</h1>
|
||||||
<v-icon
|
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large"></v-icon>
|
||||||
@click.stop="closeModal()"
|
|
||||||
icon="mdi-close"
|
|
||||||
size="large"
|
|
||||||
></v-icon>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<v-card-actions class="d-flex flex-column modal-content">
|
<v-card-actions class="d-flex flex-column modal-content">
|
||||||
<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-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>
|
|
||||||
|
|
||||||
<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>
|
||||||
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
|
<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-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-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-model="masterTask.duration"
|
|
||||||
@focus="onInputFocus"
|
|
||||||
class="modal-input mt-5"
|
|
||||||
variant="solo"
|
|
||||||
type="number"
|
|
||||||
:value="totalHours"
|
|
||||||
disabled
|
|
||||||
:label="totalHours + ' h'"
|
|
||||||
></v-text-field>
|
|
||||||
|
|
||||||
<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-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-text-field
|
<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">
|
||||||
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"
|
|
||||||
>
|
|
||||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||||
</p>
|
</p>
|
||||||
</v-text-field>
|
</v-text-field>
|
||||||
|
|
||||||
<Z-autocomplete
|
<!-- <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">
|
||||||
v-if="showAddEmployeeInput"
|
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||||
:options="employeesOptions"
|
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||||
:validations="v$.masterTask.employees"
|
</p>
|
||||||
:class="{ error: v$.masterTask.employees.$errors.length }"
|
</v-text-field> -->
|
||||||
class="modal-input"
|
|
||||||
@option-selected="employeeSelected"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-btn class="w-100 mb-5 button secondary" :disabled="!masterTask.team?.id" @click="showAddEmployeeInput = true">
|
<Z-autocomplete label="Vyhľadať zamestnanca" v-if="showAddEmployeeInput" :options="employeesOptions" class="modal-input" @option-selected="onEmployeeSelected" />
|
||||||
<v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca
|
|
||||||
</v-btn>
|
|
||||||
|
|
||||||
<div class="w-100 modal-input">
|
<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>
|
||||||
<QuillEditor
|
|
||||||
v-model="masterTask.description"
|
<div class="w-100 modal-input" :class="{ error: v$.masterTask.description.$errors.length }">
|
||||||
placeholder="Popis"
|
<QuillEditor ref="description" v-model="masterTask.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="masterTask.description = $event.srcElement.innerHTML" />
|
||||||
theme="snow"
|
|
||||||
class="rich-text-editor"
|
|
||||||
/>
|
|
||||||
</div>
|
</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-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-card v-else height="100%" class="d-flex flex-column scrolling">
|
<v-card v-else height="100%" class="d-flex flex-column scrolling">
|
||||||
<div class="d-flex justify-space-between align-center">
|
<div class="d-flex justify-space-between align-center">
|
||||||
<p>{{ masterTask.project_code }}</p>
|
<p>{{ masterTask.project_code }}</p>
|
||||||
<v-icon
|
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large" class="pb-5"></v-icon>
|
||||||
@click.stop="closeModal()"
|
|
||||||
icon="mdi-close"
|
|
||||||
size="large"
|
|
||||||
class="pb-5"
|
|
||||||
></v-icon>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
|
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
|
||||||
<h1>{{ masterTask.name }}</h1>
|
<h1>{{ masterTask.name }}</h1>
|
||||||
@@ -140,159 +59,15 @@
|
|||||||
|
|
||||||
<v-card-actions class="d-flex flex-column modal-content">
|
<v-card-actions class="d-flex flex-column modal-content">
|
||||||
<div class="w-100">
|
<div class="w-100">
|
||||||
<v-row no-gutters class="align-center">
|
<A-task-description :master-task="masterTask" />
|
||||||
<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>
|
|
||||||
<div class="d-flex justify-start align-center mt-8">
|
<div class="d-flex justify-start align-center mt-8">
|
||||||
<v-btn class="button primary" @click="save()">Ukončiť mastertask</v-btn>
|
<v-btn class="button primary" @click="save()">Ukončiť mastertask</v-btn>
|
||||||
</div>
|
</div>
|
||||||
<v-table class="mt-7 mb-5">
|
|
||||||
<tbody class="px-5 py-5">
|
<A-tasks-table :tasks="masterTask.subtasks" :employees="employees" />
|
||||||
<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>
|
|
||||||
<div class="d-flex align-center ">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
@@ -312,16 +87,25 @@ import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
|
|||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { QuillEditor } from '@vueup/vue-quill'
|
import { QuillEditor } from '@vueup/vue-quill'
|
||||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||||
import * as FileSaver from 'file-saver'
|
|
||||||
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
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 {
|
export default {
|
||||||
emits: ['close'],
|
// MIXINS
|
||||||
mixins: [VuetifyFixFocusMixin],
|
// computed: employeesOptions
|
||||||
|
// methods: onProjectSelected, onEmployeeSelected, onEmployeeDurationChanged
|
||||||
|
// watch: masterTask.team_id
|
||||||
|
|
||||||
|
emits: ['master-task-edited', 'close'],
|
||||||
|
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
ATaskDescription,
|
||||||
|
ATasksTable,
|
||||||
Datepicker,
|
Datepicker,
|
||||||
ZFilesUpload,
|
ZFilesUpload,
|
||||||
ZAutocomplete,
|
ZAutocomplete,
|
||||||
@@ -330,18 +114,16 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tmUtils,
|
|
||||||
editMode: false,
|
editMode: false,
|
||||||
visible: false,
|
visible: false,
|
||||||
errorUtils,
|
errorUtils,
|
||||||
v$: useVuelidate(),
|
v$: useVuelidate(),
|
||||||
teams: null,
|
teams: null,
|
||||||
|
projects: null,
|
||||||
employees: null,
|
employees: null,
|
||||||
employeeSelect: null,
|
|
||||||
teamSelect: '',
|
|
||||||
masterTask: null,
|
masterTask: null,
|
||||||
|
showAddEmployeeInput: false,
|
||||||
showAddEmployeeInput: false
|
date: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -349,11 +131,11 @@ export default {
|
|||||||
return {
|
return {
|
||||||
masterTask: {
|
masterTask: {
|
||||||
project_code: { required },
|
project_code: { required },
|
||||||
|
team_id: { required },
|
||||||
name: { required },
|
name: { required },
|
||||||
team: { required },
|
description: { required },
|
||||||
deadline: { required },
|
deadline: { required }
|
||||||
employees: { atLeastOne }
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -361,143 +143,116 @@ export default {
|
|||||||
this.$events.on('on-master-task-deleted', (masterTask) => {
|
this.$events.on('on-master-task-deleted', (masterTask) => {
|
||||||
if (masterTask?.id == this.masterTask?.id) this.closeModal()
|
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: {
|
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) {
|
async showModal(masterTask, editMode = false) {
|
||||||
|
this.v$.$reset()
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.masterTask = null
|
this.masterTask = null
|
||||||
this.teamSelect = null
|
|
||||||
this.employeeSelect = null
|
|
||||||
|
|
||||||
try {
|
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')
|
const employees = await this.$axios.get_auth_data('v1/employees')
|
||||||
this.employees = tmUtils.enrichEmployeesByFullName(employees)
|
this.employees = tmUtils.enrichEmployeesByFullName(employees)
|
||||||
|
|
||||||
if (masterTask?.id) {
|
if (masterTask?.id) {
|
||||||
this.masterTask = await this.$axios.get_auth_data(`v1/mastertasks/${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 {
|
} else {
|
||||||
this.masterTask = {team: {}, employees: []}
|
this.masterTask = { employees: [], duration: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editMode = (editMode || !this.masterTask.id)
|
this.editMode = editMode || !this.masterTask.id
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
if (!(await this.v$.$validate()))
|
if (!(await this.v$.$validate())) return
|
||||||
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 {
|
try {
|
||||||
if (this.masterTask.id)
|
this.masterTask.deadline = moment(this.masterTask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
||||||
await this.$axios.put_auth(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
|
||||||
|
|
||||||
else
|
if (this.masterTask.id) await this.$axios.put_auth_data(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
||||||
await this.$axios.post_auth('v1/mastertasks', this.masterTask)
|
else await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
||||||
|
|
||||||
|
this.$emit('master-task-edited', this.masterTask)
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
} catch (error) {
|
} 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) {
|
filesUploaded(files) {
|
||||||
this.masterTask.files = files
|
this.masterTask.files = files
|
||||||
},
|
},
|
||||||
|
|
||||||
|
closeModal() {
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
|
||||||
|
openDeleteMasterTaskModal(masterTask) {
|
||||||
|
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
||||||
|
},
|
||||||
|
|
||||||
addTask() {
|
addTask() {
|
||||||
this.$events.emit('show-task-modal', {})
|
this.$events.emit('show-task-modal', { task: null, editMode: false, masterTask: this.masterTask })
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
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}`,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
teamSelect(value) {
|
editMode() {
|
||||||
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)
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.employeeSelect = null
|
this.$refs['description']?.setHTML(this.masterTask.description || '')
|
||||||
this.$el.activeElement.blur()
|
|
||||||
// console.log(this.$refs['employee-select'])
|
|
||||||
// this.$refs['employee-select'].focused = false
|
|
||||||
// this.employeeSelect = ''
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,20 +278,10 @@ export default {
|
|||||||
.border-bottom
|
.border-bottom
|
||||||
border-bottom: 1px solid rgba(0,0,0,.1)
|
border-bottom: 1px solid rgba(0,0,0,.1)
|
||||||
|
|
||||||
|
|
||||||
.subtask-btn
|
.subtask-btn
|
||||||
border: thin solid rgba(var(--v-border-color), var(--v-border-opacity)) !important
|
border: thin solid rgba(var(--v-border-color), var(--v-border-opacity)) !important
|
||||||
color: #7f39fb !important
|
color: #7f39fb !important
|
||||||
height: 53px
|
height: 53px
|
||||||
text-align: center
|
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>
|
</style>
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
<v-dialog v-model="visible" max-width="650">
|
<v-dialog v-model="visible" max-width="650">
|
||||||
<v-card>
|
<v-card>
|
||||||
<div class="d-flex justify-space-between align-center">
|
<div class="d-flex justify-space-between align-center">
|
||||||
<h1>Ste si istý, že chcete ukončiť <b>{{ task.title }}</b>?</h1>
|
<h1>Ste si istý, že chcete {{ this.task?.id ? 'ukončiť' : 'obnoviť' }} task, z masterTasku <b>{{ task.master_task }}</b>?</h1>
|
||||||
|
|
||||||
<v-icon
|
<v-icon
|
||||||
@click.stop="visible = false"
|
@click.stop="visible = false"
|
||||||
icon="mdi-close"
|
icon="mdi-close"
|
||||||
@@ -38,7 +37,7 @@ export default {
|
|||||||
async complete() {
|
async complete() {
|
||||||
try {
|
try {
|
||||||
const task = {...this.task, is_finished: true}
|
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.visible = false
|
||||||
this.$emit('task-completed', task)
|
this.$emit('task-completed', task)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<v-dialog v-model="visible" max-width="650">
|
<v-dialog v-model="visible" max-width="650">
|
||||||
<v-card>
|
<v-card>
|
||||||
<div class="d-flex justify-space-between align-center">
|
<div class="d-flex justify-space-between align-center">
|
||||||
<h1>Ste si istý, že chcete zmazať <b>{{ task.title }}</b>?</h1>
|
<h1>Ste si istý, že chcete zmazať task z masterTasku <b>{{ task.project_code }}</b>?</h1>
|
||||||
|
|
||||||
<v-icon
|
<v-icon
|
||||||
@click.stop="closeModal()"
|
@click.stop="closeModal()"
|
||||||
@@ -42,7 +42,7 @@ export default {
|
|||||||
|
|
||||||
async deleteTask() {
|
async deleteTask() {
|
||||||
try {
|
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.$emit('on-task-deleted', this.task)
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -10,49 +10,49 @@
|
|||||||
<v-card-actions class="d-flex flex-column modal-content">
|
<v-card-actions class="d-flex flex-column modal-content">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="task.project_code"
|
v-model="task.project_code"
|
||||||
|
label="Kód projektu"
|
||||||
|
:value="task.project_code"
|
||||||
@focus="onInputFocus"
|
@focus="onInputFocus"
|
||||||
class="modal-input"
|
class="modal-input"
|
||||||
label="Kód projektu"
|
|
||||||
variant="solo"
|
variant="solo"
|
||||||
disabled
|
disabled
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
|
|
||||||
<!-- Toto treba fixnut -->
|
<Z-autocomplete
|
||||||
<v-select
|
label="Master task"
|
||||||
v-model="masterTaskIdSelect"
|
:options="masterTasks.map((masterTask) => ({ key: masterTask.id, value: masterTask.name }))"
|
||||||
@focus="onInputFocus"
|
:validations="v$.task.master_task.id"
|
||||||
class="modal-input border-select"
|
:clear-on-submit="false"
|
||||||
label="MasterTask"
|
:value="task.master_task.masterTask_name"
|
||||||
variant="solo"
|
:class="{ error: v$.task.master_task.id.$errors.length }"
|
||||||
:items="masterTasks"
|
class="modal-input"
|
||||||
item-value="id"
|
@option-selected="onMasterTaskSelected"
|
||||||
item-title="name"
|
/>
|
||||||
></v-select>
|
|
||||||
|
|
||||||
<v-select
|
<v-select
|
||||||
v-model="employeeIdSelect"
|
v-model="task.employee_id"
|
||||||
@focus="onInputFocus"
|
@focus="onInputFocus"
|
||||||
class="modal-input border-select"
|
class="modal-input border-select"
|
||||||
label="Priradený"
|
label="Priradený"
|
||||||
|
:class="{ error: v$.task.employee_id.$errors.length }"
|
||||||
variant="solo"
|
variant="solo"
|
||||||
:items="employees"
|
:items="filteredEmployees"
|
||||||
item-value="id"
|
item-value="id"
|
||||||
item-title="_fullName"
|
item-title="_fullName"
|
||||||
></v-select>
|
></v-select>
|
||||||
|
|
||||||
<Datepicker
|
<!-- <Datepicker
|
||||||
class="modal-input mb-5"
|
class="modal-input mb-5"
|
||||||
v-model="task.date"
|
v-model="task.timeblocks"
|
||||||
format="dd.MM.yyyy, HH:mm"
|
format="dd.MM.yyyy, HH:mm"
|
||||||
locale="sk"
|
locale="sk"
|
||||||
:class="{ error: v$.task.date.$errors.length }"
|
:time-picker-position="'right'"
|
||||||
@focus="onDateFocus"
|
@focus="onDateFocus"
|
||||||
:validations="v$.task.date"
|
|
||||||
select-text="Vybrať"
|
select-text="Vybrať"
|
||||||
cancel-text="Zrušiť"
|
cancel-text="Zrušiť"
|
||||||
placeholder="Trvanie od - do"
|
placeholder="Trvanie od - do"
|
||||||
range
|
range
|
||||||
/>
|
/> -->
|
||||||
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="task.duration"
|
v-model="task.duration"
|
||||||
@@ -70,16 +70,18 @@
|
|||||||
append-inner-icon="mdi-clock-outline"
|
append-inner-icon="mdi-clock-outline"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
|
|
||||||
<div class="w-100 modal-input">
|
<div class="w-100 modal-input" :class="{ error: v$.task.description.$errors.length }">
|
||||||
<QuillEditor
|
<QuillEditor
|
||||||
|
ref="description"
|
||||||
v-model="task.description"
|
v-model="task.description"
|
||||||
placeholder="Popis"
|
placeholder="Popis"
|
||||||
theme="snow"
|
theme="snow"
|
||||||
class="rich-text-editor"
|
class="rich-text-editor"
|
||||||
|
@input="task.description = $event.srcElement.innerHTML"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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-card-actions>
|
||||||
|
|
||||||
<v-btn class="button primary" @click="save()">{{
|
<v-btn class="button primary" @click="save()">{{
|
||||||
@@ -211,8 +213,6 @@
|
|||||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||||
<Datepicker
|
<Datepicker
|
||||||
v-model="selectedNewDate"
|
v-model="selectedNewDate"
|
||||||
:class="{ error: v$.selectedNewDate.$errors.length }"
|
|
||||||
:validations="v$.selectedNewDate"
|
|
||||||
class="modal-input"
|
class="modal-input"
|
||||||
format="dd.MM.yyyy, HH:mm"
|
format="dd.MM.yyyy, HH:mm"
|
||||||
locale="sk"
|
locale="sk"
|
||||||
@@ -336,7 +336,7 @@
|
|||||||
:class="[index === 0 ? 'ml-0' : 'ml-2']"
|
:class="[index === 0 ? 'ml-0' : 'ml-2']"
|
||||||
>
|
>
|
||||||
<v-chip class="mt-2">
|
<v-chip class="mt-2">
|
||||||
<p @click="downloadFile" class="cursor-pointer">
|
<p @click="downloadFile(index)" class="cursor-pointer">
|
||||||
{{ file.name }}
|
{{ file.name }}
|
||||||
</p>
|
</p>
|
||||||
<v-icon
|
<v-icon
|
||||||
@@ -371,18 +371,21 @@ import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
|||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { QuillEditor } from '@vueup/vue-quill'
|
import { QuillEditor } from '@vueup/vue-quill'
|
||||||
import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
|
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 * as FileSaver from 'file-saver'
|
||||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||||
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
||||||
|
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
emits: ['close', 'refresh'],
|
emits: ['close', 'refresh'],
|
||||||
mixins: [VuetifyFixFocusMixin],
|
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Datepicker,
|
Datepicker,
|
||||||
ZFilesUpload,
|
ZFilesUpload,
|
||||||
QuillEditor,
|
QuillEditor,
|
||||||
|
ZAutocomplete
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@@ -395,32 +398,35 @@ export default {
|
|||||||
v$: useVuelidate(),
|
v$: useVuelidate(),
|
||||||
preventInputFocus: false,
|
preventInputFocus: false,
|
||||||
masterTasks: [],
|
masterTasks: [],
|
||||||
|
employees: null,
|
||||||
masterTaskIdSelect: null,
|
masterTaskIdSelect: null,
|
||||||
employeeIdSelect: null,
|
|
||||||
showDatePicker: false,
|
showDatePicker: false,
|
||||||
selectedNewDate: []
|
selectedNewDate: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
employees() {
|
filteredEmployees() {
|
||||||
if (!this.task?.master_task?.employees)
|
if (!this.employees || !this.task?.master_task)
|
||||||
return []
|
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() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
task: {
|
task: {
|
||||||
// project_code: { required },
|
description: { required },
|
||||||
date: { required },
|
master_task: {
|
||||||
// team: { required },
|
id: { required }
|
||||||
duration: { required },
|
|
||||||
employee: { required },
|
|
||||||
},
|
},
|
||||||
selectedNewDate: { required }
|
duration: { required },
|
||||||
|
employee_id: { required }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -431,21 +437,26 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async showModal(task, editMode = false) {
|
async showModal(task, editMode = false, masterTask = {}) {
|
||||||
|
this.v$.$reset()
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.task = null
|
this.task = null
|
||||||
|
this.masterTaskIdSelect = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||||
|
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||||
|
|
||||||
if (task?.id) {
|
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}`)
|
||||||
|
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.employeeIdSelect = t.employee.id
|
|
||||||
this.masterTaskIdSelect = t.master_task.id
|
this.masterTaskIdSelect = t.master_task.id
|
||||||
this.task = t
|
this.task = t
|
||||||
this.task.spent_time = ((t.spent_time) / 3600000).toFixed(2)
|
|
||||||
} else {
|
} else {
|
||||||
this.task = {master_task: {}}
|
this.task = {master_task: masterTask}
|
||||||
|
this.masterTaskIdSelect = masterTask.id
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editMode = (editMode || !this.task.id)
|
this.editMode = (editMode || !this.task.id)
|
||||||
@@ -459,16 +470,21 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async save() {
|
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 {
|
try {
|
||||||
if (this.task.id) {
|
if (this.task?.id) {
|
||||||
await this.$axios.put_auth(`v1/mastertasks/${this.task.id}`, this.task)
|
await this.$axios.put_auth_data(`v1/subtasks/${this.task.id}`, this.task)
|
||||||
this.$events.emit('on-task-edited', this.task)
|
|
||||||
} else {
|
} 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()
|
this.closeModal()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(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) {
|
removeDate(index) {
|
||||||
this.task.timeblocks.splice(index, 1)
|
this.task.timeblocks.splice(index, 1)
|
||||||
},
|
},
|
||||||
@@ -504,14 +529,20 @@ export default {
|
|||||||
if (!value || !this.task) return
|
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) {
|
'task.employee_id'(value) {
|
||||||
if (!value || !this.task) return
|
if (!value) return
|
||||||
|
this.task.employee = this.employees.find(employee => employee.id == value)
|
||||||
|
},
|
||||||
|
|
||||||
this.task.employee = this.task.master_task.employees.find(employee => employee.id == value)
|
editMode() {
|
||||||
},
|
this.$nextTick(() => {
|
||||||
},
|
this.$refs['description']?.setHTML(this.task.description || '')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Z-autocomplete
|
<Z-autocomplete
|
||||||
|
label="Vyhľadať zamestnanca"
|
||||||
:options="employeesOptions"
|
:options="employeesOptions"
|
||||||
:validations="v$.team.employees"
|
:validations="v$.team.employees"
|
||||||
class="modal-input"
|
class="modal-input"
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default {
|
|||||||
|
|
||||||
async post(url: string, params = null, config?: any) {
|
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)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(error))
|
||||||
},
|
},
|
||||||
@@ -42,14 +42,14 @@ export default {
|
|||||||
async post_auth(url: string, params = null, config?: any) {
|
async post_auth(url: string, params = null, config?: any) {
|
||||||
config = this._config(config)
|
config = this._config(config)
|
||||||
|
|
||||||
return axios.post(url, {data: params}, config)
|
return axios.post(url, params, config)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(error))
|
||||||
},
|
},
|
||||||
|
|
||||||
async post_data(url: string, params = null, config?: any) {
|
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)
|
.then(response => response.data.data)
|
||||||
.catch(error => Promise.reject(error.response || error))
|
.catch(error => Promise.reject(error.response || error))
|
||||||
},
|
},
|
||||||
@@ -57,7 +57,7 @@ export default {
|
|||||||
async post_auth_data(url: string, params = null, config?: any) {
|
async post_auth_data(url: string, params = null, config?: any) {
|
||||||
config = this._config(config)
|
config = this._config(config)
|
||||||
|
|
||||||
return axios.post(url, {data: params}, config)
|
return axios.post(url, params, config)
|
||||||
.then(response => response.data.data)
|
.then(response => response.data.data)
|
||||||
.catch(error => Promise.reject(error.response || error))
|
.catch(error => Promise.reject(error.response || error))
|
||||||
},
|
},
|
||||||
@@ -91,7 +91,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async patch(url: string, params = null, config?: any) {
|
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)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(error))
|
||||||
},
|
},
|
||||||
@@ -99,13 +99,13 @@ export default {
|
|||||||
async patch_auth(url: string, params = null, config?: any) {
|
async patch_auth(url: string, params = null, config?: any) {
|
||||||
config = this._config(config)
|
config = this._config(config)
|
||||||
|
|
||||||
return axios.patch(url, {data: params}, config)
|
return axios.patch(url, params, config)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(error))
|
||||||
},
|
},
|
||||||
|
|
||||||
async patch_data(url: string, params = null, config?: any) {
|
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)
|
.then(response => response.data.data)
|
||||||
.catch(error => Promise.reject(error.response || error))
|
.catch(error => Promise.reject(error.response || error))
|
||||||
},
|
},
|
||||||
@@ -113,13 +113,13 @@ export default {
|
|||||||
async patch_auth_data(url: string, params = null, config?: any) {
|
async patch_auth_data(url: string, params = null, config?: any) {
|
||||||
config = this._config(config)
|
config = this._config(config)
|
||||||
|
|
||||||
return axios.patch(url, {data: params}, config)
|
return axios.patch(url, params, config)
|
||||||
.then(response => response.data.data)
|
.then(response => response.data.data)
|
||||||
.catch(error => Promise.reject(error.response || error))
|
.catch(error => Promise.reject(error.response || error))
|
||||||
},
|
},
|
||||||
|
|
||||||
async put(url: string, params = null, config?: any) {
|
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)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(error))
|
||||||
},
|
},
|
||||||
@@ -133,7 +133,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async put_data(url: string, params = null, config?: any) {
|
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)
|
.then(response => response.data.data)
|
||||||
.catch(error => Promise.reject(error.response || error))
|
.catch(error => Promise.reject(error.response || error))
|
||||||
},
|
},
|
||||||
@@ -141,7 +141,7 @@ export default {
|
|||||||
async put_auth_data(url: string, params = null, config?: any) {
|
async put_auth_data(url: string, params = null, config?: any) {
|
||||||
config = this._config(config)
|
config = this._config(config)
|
||||||
|
|
||||||
return axios.put(url, {data: params}, config)
|
return axios.put(url, params, config)
|
||||||
.then(response => response.data.data)
|
.then(response => response.data.data)
|
||||||
.catch(error => Promise.reject(error.response || error))
|
.catch(error => Promise.reject(error.response || error))
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,34 +1,43 @@
|
|||||||
|
import { $t } from '@/plugins/app/_config/main'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
parseAndTranslate(data) {
|
parseAndTranslate(data) {
|
||||||
const errorsArray = this._parseToArrayOfStrings(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) {
|
_parseToArrayOfStrings(data) {
|
||||||
if (typeof data == 'string') {
|
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') {
|
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') {
|
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') {
|
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') {
|
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) {
|
if (data.statusText) {
|
||||||
return [this._translate(data.statusText)]
|
return [$t(data.statusText)]
|
||||||
}
|
}
|
||||||
|
|
||||||
return [data]
|
return [data]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
import toastUtils from '@/plugins/w/toast/utils/toast.utils'
|
||||||
|
|
||||||
axios.defaults.baseURL = process.env.VUE_APP_WAXIOS_URL
|
axios.defaults.baseURL = process.env.VUE_APP_WAXIOS_URL
|
||||||
|
|
||||||
@@ -7,7 +8,7 @@ export default {
|
|||||||
async get(url: string, config?: any) {
|
async get(url: string, config?: any) {
|
||||||
return axios.get(url, config)
|
return axios.get(url, config)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||||
},
|
},
|
||||||
|
|
||||||
async get_auth(url: string, config?: any) {
|
async get_auth(url: string, config?: any) {
|
||||||
@@ -15,13 +16,13 @@ export default {
|
|||||||
|
|
||||||
return axios.get(url, config)
|
return axios.get(url, config)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||||
},
|
},
|
||||||
|
|
||||||
async get_data(url: string, config?: any) {
|
async get_data(url: string, config?: any) {
|
||||||
return axios.get(url, config)
|
return axios.get(url, config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async get_auth_data(url: string, config?: any) {
|
||||||
@@ -29,14 +30,14 @@ export default {
|
|||||||
|
|
||||||
return axios.get(url, config)
|
return axios.get(url, config)
|
||||||
.then(response => Promise.resolve(response.data.data))
|
.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) {
|
async post(url: string, params = null, config?: any) {
|
||||||
|
|
||||||
return axios.post(url, this._objectToFormData(params), config)
|
return axios.post(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data)
|
.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) {
|
async post_auth(url: string, params = null, config?: any) {
|
||||||
@@ -44,14 +45,14 @@ export default {
|
|||||||
|
|
||||||
return axios.post(url, this._objectToFormData(params), config)
|
return axios.post(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data)
|
.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) {
|
async post_data(url: string, params = null, config?: any) {
|
||||||
|
|
||||||
return axios.post(url, this._objectToFormData(params), config)
|
return axios.post(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async post_auth_data(url: string, params = null, config?: any) {
|
||||||
@@ -59,13 +60,13 @@ export default {
|
|||||||
|
|
||||||
return axios.post(url, this._objectToFormData(params), config)
|
return axios.post(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async delete(url: string, config?: any) {
|
||||||
return axios.delete(url, config)
|
return axios.delete(url, config)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||||
},
|
},
|
||||||
|
|
||||||
async delete_auth(url: string, config?: any) {
|
async delete_auth(url: string, config?: any) {
|
||||||
@@ -73,13 +74,13 @@ export default {
|
|||||||
|
|
||||||
return axios.delete(url, config)
|
return axios.delete(url, config)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
.catch(error => Promise.reject(error))
|
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||||
},
|
},
|
||||||
|
|
||||||
async delete_data(url: string, config?: any) {
|
async delete_data(url: string, config?: any) {
|
||||||
return axios.delete(url, config)
|
return axios.delete(url, config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async delete_auth_data(url: string, config?: any) {
|
||||||
@@ -87,13 +88,13 @@ export default {
|
|||||||
|
|
||||||
return axios.delete(url, config)
|
return axios.delete(url, config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async patch(url: string, params = null, config?: any) {
|
||||||
return axios.patch(url, this._objectToFormData(params), config)
|
return axios.patch(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data)
|
.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) {
|
async patch_auth(url: string, params = null, config?: any) {
|
||||||
@@ -101,13 +102,13 @@ export default {
|
|||||||
|
|
||||||
return axios.patch(url, this._objectToFormData(params), config)
|
return axios.patch(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data)
|
.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) {
|
async patch_data(url: string, params = null, config?: any) {
|
||||||
return axios.patch(url, this._objectToFormData(params), config)
|
return axios.patch(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async patch_auth_data(url: string, params = null, config?: any) {
|
||||||
@@ -115,13 +116,13 @@ export default {
|
|||||||
|
|
||||||
return axios.patch(url, this._objectToFormData(params), config)
|
return axios.patch(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async put(url: string, params = null, config?: any) {
|
||||||
return axios.put(url, this._objectToFormData(params), config)
|
return axios.put(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data)
|
.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) {
|
async put_auth(url: string, params = null, config?: any) {
|
||||||
@@ -129,21 +130,21 @@ export default {
|
|||||||
|
|
||||||
return axios.put(url, this._objectToFormData(params), config)
|
return axios.put(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data)
|
.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) {
|
async put_data(url: string, params = null, config?: any) {
|
||||||
return axios.put(url, this._objectToFormData(params), config)
|
return axios.put(url, this._objectToFormData(params), config)
|
||||||
.then(response => response.data.data)
|
.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) {
|
async put_auth_data(url: string, params = null, config?: any) {
|
||||||
config = this._config(config)
|
config = this._config(config)
|
||||||
|
|
||||||
return axios.put(url, this._objectToFormData(params), config)
|
return axios.put(url, {data: params}, config)
|
||||||
.then(response => response.data.data)
|
.then(response => response.data.data)
|
||||||
.catch(error => Promise.reject(error.response || error))
|
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||||
},
|
},
|
||||||
|
|
||||||
_config(config: any) {
|
_config(config: any) {
|
||||||
|
|||||||
Reference in new issue
Block a user