mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Task modal, subtask modal] BE
This commit is contained in:
1 parent
37331335ce
commit
1024f73ab5
12 files changed
+477
-489
No files matched your search
@@ -69,10 +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,
|
.error .dp__input,
|
||||||
.v-input.error .v-input__control,
|
.v-input.error .v-input__control
|
||||||
.rich-text-editor.error
|
|
||||||
border: 1px solid red !important
|
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
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<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()"
|
||||||
@@ -27,6 +27,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 +40,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 +87,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)
|
||||||
this.search = ''
|
|
||||||
|
if (this.clearOnSubmit)
|
||||||
|
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>
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('on-master-task-edited', (masterTask) => {
|
this.$events.on('on-master-task-edited', (masterTask) => {
|
||||||
|
this.masterTasks = this.masterTasks.map(mTask => mTask.id == masterTask.id ? masterTask : mTask)
|
||||||
this._getData()
|
this._getData()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -92,7 +93,7 @@ export default {
|
|||||||
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.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,71 @@
|
|||||||
|
<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 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" @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 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</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,58 @@
|
|||||||
|
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
|
||||||
|
},
|
||||||
|
|
||||||
|
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) {
|
||||||
|
if (!value) return
|
||||||
|
this.masterTask.team = this.teams.find(team => team.id == value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,138 +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-select
|
<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="projectCodeSelect"
|
|
||||||
@focus="onInputFocus"
|
|
||||||
class="modal-input border-select"
|
|
||||||
label="Kód projektu"
|
|
||||||
variant="solo"
|
|
||||||
:items="projects"
|
|
||||||
item-value="id"
|
|
||||||
item-title="code"
|
|
||||||
:class="{ error: v$.masterTask.project_id.$errors.length }"
|
|
||||||
:hint="
|
|
||||||
v$.masterTask.project_id.$errors
|
|
||||||
? errorUtils.parseErrors(v$.masterTask.project_id.$errors)
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
></v-select>
|
|
||||||
|
|
||||||
<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"
|
|
||||||
disabled
|
|
||||||
:label="`${masterTask.duration} 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"
|
|
||||||
:class="{ error: v$.masterTask.team.$errors.length }"
|
|
||||||
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].duration }"
|
|
||||||
class="modal-input"
|
|
||||||
:label="`${employee.name} ${employee.surname}`"
|
|
||||||
variant="solo"
|
|
||||||
placeholder="h"
|
|
||||||
v-model="masterTask.employees[index].duration"
|
|
||||||
type="number"
|
|
||||||
min="1"
|
|
||||||
@input="onEmployeeDurationChanged"
|
|
||||||
>
|
|
||||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
<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
|
|
||||||
ref="description"
|
<div class="w-100 modal-input" :class="{ error: v$.masterTask.description.$errors.length }">
|
||||||
v-model="masterTask.description"
|
<QuillEditor ref="description" v-model="masterTask.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="masterTask.description = $event.srcElement.innerHTML" />
|
||||||
placeholder="Popis"
|
|
||||||
theme="snow"
|
|
||||||
class="rich-text-editor"
|
|
||||||
:class="{ error: v$.masterTask.deadline.$errors.length }"
|
|
||||||
@input="masterTask.description = $event.srcElement.innerHTML"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Z-files-upload class="mt-15 files" @files-uploaded="filesUploaded"/>
|
<Z-files-upload class="mt-15 files" @files-uploaded="filesUploaded" />
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
|
|
||||||
<v-btn class="button primary" @click="save()">{{ masterTask.id ? 'ULOŽIŤ' : '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>
|
||||||
@@ -147,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(index)" 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" @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>
|
|
||||||
<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>
|
||||||
@@ -309,26 +77,35 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Datepicker from '@vuepic/vue-datepicker'
|
import Datepicker from '@vuepic/vue-datepicker'
|
||||||
import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue'
|
import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue'
|
||||||
import useVuelidate from '@vuelidate/core'
|
import useVuelidate from '@vuelidate/core'
|
||||||
import { required } from '@vuelidate/validators'
|
import { required } from '@vuelidate/validators'
|
||||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||||
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
||||||
import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
|
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 {
|
||||||
|
// MIXINS
|
||||||
|
// computed: employeesOptions
|
||||||
|
// methods: onProjectSelected, onEmployeeSelected, onEmployeeDurationChanged
|
||||||
|
// watch: masterTask.team_id
|
||||||
|
|
||||||
emits: ['master-task-edited', 'close'],
|
emits: ['master-task-edited', 'close'],
|
||||||
mixins: [VuetifyFixFocusMixin],
|
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
ATaskDescription,
|
||||||
|
ATasksTable,
|
||||||
Datepicker,
|
Datepicker,
|
||||||
ZFilesUpload,
|
ZFilesUpload,
|
||||||
ZAutocomplete,
|
ZAutocomplete,
|
||||||
@@ -337,7 +114,6 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tmUtils,
|
|
||||||
editMode: false,
|
editMode: false,
|
||||||
visible: false,
|
visible: false,
|
||||||
errorUtils,
|
errorUtils,
|
||||||
@@ -345,11 +121,7 @@ export default {
|
|||||||
teams: null,
|
teams: null,
|
||||||
projects: null,
|
projects: null,
|
||||||
employees: null,
|
employees: null,
|
||||||
employeeSelect: null,
|
|
||||||
projectCodeSelect: null,
|
|
||||||
teamSelect: '',
|
|
||||||
masterTask: null,
|
masterTask: null,
|
||||||
|
|
||||||
showAddEmployeeInput: false
|
showAddEmployeeInput: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -357,14 +129,12 @@ export default {
|
|||||||
validations() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
masterTask: {
|
masterTask: {
|
||||||
project_id: { required },
|
project_code: { required },
|
||||||
|
team_id: { required },
|
||||||
name: { required },
|
name: { required },
|
||||||
team: { required },
|
description: { required },
|
||||||
// duration: { required },
|
deadline: { required }
|
||||||
// description: { required },
|
}
|
||||||
deadline: { required },
|
|
||||||
employees: { atLeastOne }
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -374,80 +144,69 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('on-task-deleted', (task) => {
|
this.$events.on('on-task-deleted', (task) => {
|
||||||
this.masterTask.subtasks = this.masterTask.subtasks.filter(subtask => subtask.id != task.id)
|
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: {
|
||||||
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 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)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async showModal(masterTask, editMode = false) {
|
async showModal(masterTask, editMode = false) {
|
||||||
this.v$.$reset()
|
this.v$.$reset()
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.masterTask = null
|
this.masterTask = null
|
||||||
this.teamSelect = null
|
|
||||||
this.employeeSelect = null
|
|
||||||
this.projectCodeSelect = 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.projects = await this.$axios.get_auth_data('v1/projects')
|
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}`)
|
||||||
|
|
||||||
const project = this.projects.find(project => project.code == this.masterTask?.project_code)
|
const project = this.projects.find((project) => project.code == this.masterTask?.project_code)
|
||||||
this.teamSelect = this.masterTask.team.id
|
|
||||||
this.projectCodeSelect = project.id
|
this.masterTask.team_id = this.masterTask.team.id
|
||||||
this.masterTask.project_id = project.id
|
this.masterTask.project_id = project.id
|
||||||
|
this.masterTask.project_code = project.code
|
||||||
} else {
|
} else {
|
||||||
this.masterTask = {team: {}, employees: [], duration: 0}
|
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 console.log(this.v$)
|
|
||||||
|
this.masterTask.description = this.$refs['description'].getHTML()
|
||||||
|
this.masterTask.employees = [...this.masterTask.employees, ...this.masterTask.team?.employees]
|
||||||
|
|
||||||
|
this.masterTask.project_code = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.masterTask.deadline = moment(this.masterTask.deadline).format("YYYY-MM-DD HH:MM:SS")
|
this.masterTask.deadline = moment(this.masterTask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
||||||
|
|
||||||
if (this.masterTask.id)
|
if (this.masterTask.id) await this.$axios.put_auth_data(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
||||||
await this.$axios.put_auth(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
else await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
||||||
|
|
||||||
else
|
|
||||||
await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
|
||||||
|
|
||||||
this.$emit('master-task-edited', this.masterTask)
|
this.$emit('master-task-edited', this.masterTask)
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
@@ -456,111 +215,24 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filesUploaded(files) {
|
||||||
|
this.masterTask.files = files
|
||||||
|
},
|
||||||
|
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.visible = false
|
this.visible = false
|
||||||
this.$emit('close', this.masterTask)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
openDeleteMasterTaskModal(masterTask) {
|
openDeleteMasterTaskModal(masterTask) {
|
||||||
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
||||||
},
|
},
|
||||||
|
|
||||||
openDeleteTaskModal(task) {
|
|
||||||
this.$events.emit('show-delete-task-modal', { task })
|
|
||||||
},
|
|
||||||
|
|
||||||
openEditTaskModal(task) {
|
|
||||||
this.$events.emit('show-task-modal', { task, editMode: false })
|
|
||||||
},
|
|
||||||
|
|
||||||
employeeSelected(selectedOption) {
|
|
||||||
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
|
|
||||||
this.masterTask.employees.push(employee)
|
|
||||||
this.showAddEmployeeInput = false
|
|
||||||
},
|
|
||||||
|
|
||||||
filesUploaded(files) {
|
|
||||||
this.masterTask.files = files
|
|
||||||
},
|
|
||||||
|
|
||||||
addTask() {
|
addTask() {
|
||||||
this.$events.emit('show-task-modal', {task: null, editMode: false, masterTask: this.masterTask})
|
this.$events.emit('show-task-modal', { task: null, editMode: false, masterTask: this.masterTask })
|
||||||
},
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
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) {
|
|
||||||
if (!value || !this.masterTask) return
|
|
||||||
|
|
||||||
this.masterTask.team = this.teams.find(team => team.id == value)
|
|
||||||
this.masterTask.team_id = this.masterTask.team.id
|
|
||||||
this.masterTask.employees = this.masterTask.team.employees
|
|
||||||
this.$nextTick(() => this.v$.$reset())
|
|
||||||
},
|
|
||||||
|
|
||||||
employeeSelect(value) {
|
|
||||||
if (!value || !this.masterTask) return
|
|
||||||
|
|
||||||
const employee = this.employees.find(employee => employee.id == value)
|
|
||||||
this.masterTask.employees.push(employee)
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.employeeSelect = null
|
|
||||||
this.$el.activeElement.blur()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
projectCodeSelect(value) {
|
|
||||||
if (!value || !this.masterTask) return
|
|
||||||
this.masterTask.project_id = value
|
|
||||||
},
|
|
||||||
|
|
||||||
editMode() {
|
editMode() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['description']?.setHTML(this.masterTask.description || '')
|
this.$refs['description']?.setHTML(this.masterTask.description || '')
|
||||||
@@ -589,20 +261,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
|
||||||
|
</style>
|
||||||
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>
|
|
||||||
@@ -19,31 +19,32 @@
|
|||||||
|
|
||||||
<!-- Toto treba fixnut -->
|
<!-- Toto treba fixnut -->
|
||||||
<v-select
|
<v-select
|
||||||
v-model="masterTaskIdSelect"
|
v-model="task.master_task.id"
|
||||||
@focus="onInputFocus"
|
@focus="onInputFocus"
|
||||||
class="modal-input border-select"
|
class="modal-input border-select"
|
||||||
label="MasterTask"
|
label="Master task"
|
||||||
variant="solo"
|
variant="solo"
|
||||||
:items="masterTasks"
|
:items="masterTasks"
|
||||||
|
:class="{ error: v$.task.master_task.id.$errors.length }"
|
||||||
item-value="id"
|
item-value="id"
|
||||||
item-title="name"
|
item-title="name"
|
||||||
></v-select>
|
></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 }"
|
: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 }"
|
:class="{ error: v$.task.date.$errors.length }"
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
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"
|
||||||
@@ -71,12 +72,14 @@
|
|||||||
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>
|
||||||
|
|
||||||
@@ -394,29 +397,34 @@ 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: {
|
||||||
date: { required },
|
description: { required },
|
||||||
// team_id: { required },
|
master_task: {
|
||||||
|
id: { required }
|
||||||
|
},
|
||||||
duration: { required },
|
duration: { required },
|
||||||
employee_id: { required },
|
employee_id: { required }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -428,32 +436,28 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async showModal(task, editMode = false, masterTask = null) {
|
async showModal(task, editMode = false, masterTask = {}) {
|
||||||
this.v$.$reset()
|
this.v$.$reset()
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.task = null
|
this.task = null
|
||||||
this.employeeIdSelect = null
|
|
||||||
this.masterTaskIdSelect = 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/subtasks/${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.master_task = this.masterTasks.find(mt => mt.id == t.master_task_id)
|
||||||
t.employee = t.master_task.employees.find(e => t.employee_id == e.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: masterTask}
|
this.task = {master_task: masterTask}
|
||||||
this.masterTaskIdSelect = masterTask ? masterTask.id : null
|
this.masterTaskIdSelect = masterTask.id
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.task)
|
|
||||||
|
|
||||||
this.editMode = (editMode || !this.task.id)
|
this.editMode = (editMode || !this.task.id)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
@@ -468,14 +472,17 @@ export default {
|
|||||||
if (!(await this.v$.$validate()))
|
if (!(await this.v$.$validate()))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
this.task.description = this.$refs['description'].getHTML()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.task?.id) {
|
if (this.task?.id) {
|
||||||
await this.$axios.put_auth(`v1/mastertasks/subtasks/${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.master_task.id}/subtasks`, 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)
|
||||||
@@ -519,20 +526,21 @@ export default {
|
|||||||
masterTaskIdSelect(value) {
|
masterTaskIdSelect(value) {
|
||||||
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)
|
||||||
const selectedMasterTask = this.masterTasks.find(masterTask => masterTask.id === value)
|
this.task.project_code = this.task.master_task.project_code
|
||||||
if (selectedMasterTask) {
|
|
||||||
this.task.project_code = selectedMasterTask.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)
|
|
||||||
this.task.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))
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -142,7 +142,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, 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(toastUtils.parseAndTranslate(error.response || error)))
|
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user