mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[tm@store] Added store
This commit is contained in:
1 parent
a1a410c54d
commit
774ca7b607
44 files changed
+989
-720
No files matched your search
@@ -1,359 +1,51 @@
|
||||
<template>
|
||||
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
|
||||
<v-dialog v-model="visible" max-width="750" max-height="90%" height="700px">
|
||||
<W-loadable :content="task" class="h-100">
|
||||
<v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling">
|
||||
<div class="d-flex justify-space-between align-center modal-header">
|
||||
<h1>{{ task.id ? 'Upraviť task' : 'Vytvoriť task' }}</h1>
|
||||
<h1>{{ task.id ? "Upraviť task" : "Vytvoriť task" }}</h1>
|
||||
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large"></v-icon>
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="task.project_code"
|
||||
label="Kód projektu"
|
||||
:value="task.project_code"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
disabled
|
||||
></v-text-field>
|
||||
<v-text-field v-model="task.project_code" label="Kód projektu" :value="task.project_code" @focus="onInputFocus" class="modal-input" variant="solo" disabled></v-text-field>
|
||||
|
||||
<Z-autocomplete
|
||||
label="Master task"
|
||||
:options="masterTasks.map((masterTask) => ({ key: masterTask.id, value: masterTask.name }))"
|
||||
:validations="v$.task.master_task.id"
|
||||
:clear-on-submit="false"
|
||||
:value="task.master_task.masterTask_name"
|
||||
:class="{ error: v$.task.master_task.id.$errors.length }"
|
||||
class="modal-input"
|
||||
@option-selected="onMasterTaskSelected"
|
||||
/>
|
||||
<Z-autocomplete label="Master task" :options="mastertasks.map((masterTask) => ({ key: masterTask.id, value: masterTask.name }))" :validations="v$.task.master_task.id" :clear-on-submit="false" :value="task.master_task.name" :class="{ error: v$.task.master_task.id.$errors.length }" class="modal-input" @option-selected="onMasterTaskSelected" />
|
||||
|
||||
<v-select
|
||||
v-model="task.employee_id"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="Priradený"
|
||||
:class="{ error: v$.task.employee_id.$errors.length }"
|
||||
variant="solo"
|
||||
:items="filteredEmployees"
|
||||
item-value="id"
|
||||
item-title="_fullName"
|
||||
></v-select>
|
||||
<v-select v-model="task.employee_id" @focus="onInputFocus" class="modal-input border-select" label="Priradený" :class="{ error: v$.task.employee_id.$errors.length }" variant="solo" :items="filteredEmployees" item-value="id" item-title="_fullName"></v-select>
|
||||
|
||||
<!-- <Datepicker
|
||||
class="modal-input mb-5"
|
||||
v-model="task.timeblocks"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
:time-picker-position="'right'"
|
||||
@focus="onDateFocus"
|
||||
select-text="Vybrať"
|
||||
cancel-text="Zrušiť"
|
||||
placeholder="Trvanie od - do"
|
||||
range
|
||||
/> -->
|
||||
|
||||
<v-text-field
|
||||
v-model="task.duration"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
type="number"
|
||||
label="Časový odhad"
|
||||
:class="{ error: v$.task.duration.$errors.length }"
|
||||
:hint="
|
||||
v$.task.duration.$errors
|
||||
? errorUtils.parseErrors(v$.task.duration.$errors)
|
||||
: null
|
||||
"
|
||||
append-inner-icon="mdi-clock-outline"
|
||||
></v-text-field>
|
||||
<v-text-field v-model="task.duration" @focus="onInputFocus" class="modal-input" variant="solo" type="number" label="Časový odhad" :class="{ error: v$.task.duration.$errors.length }" :hint="v$.task.duration.$errors ? errorUtils.parseErrors(v$.task.duration.$errors) : null" append-inner-icon="mdi-clock-outline"></v-text-field>
|
||||
|
||||
<div class="w-100 modal-input" :class="{ error: v$.task.description.$errors.length }">
|
||||
<QuillEditor
|
||||
ref="description"
|
||||
v-model="task.description"
|
||||
placeholder="Popis"
|
||||
theme="snow"
|
||||
class="rich-text-editor"
|
||||
@input="task.description = $event.srcElement.innerHTML"
|
||||
/>
|
||||
<QuillEditor ref="description" v-model="task.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="task.description = $event.srcElement.innerHTML" />
|
||||
</div>
|
||||
|
||||
<Z-files-upload class="mt-15 files" :files="task.files" @files-uploaded="filesUploaded" />
|
||||
</v-card-actions>
|
||||
|
||||
<v-btn class="button primary" @click="save()">{{
|
||||
task.id ? 'UPRAVIŤ' : 'VYTVORIŤ'
|
||||
}}</v-btn>
|
||||
<v-btn class="button primary" @click="save()">{{ task.id ? "UPRAVIŤ" : "VYTVORIŤ" }}</v-btn>
|
||||
</v-card>
|
||||
|
||||
<v-card v-else height="100%" class="d-flex flex-column scrolling">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<p>{{ task.project_code }}</p>
|
||||
<v-icon
|
||||
@click.stop="closeModal()"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
class="pb-5"
|
||||
></v-icon>
|
||||
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large" class="pb-5"></v-icon>
|
||||
</div>
|
||||
<div
|
||||
class="d-flex justify-space-between align-center modal-header border-bottom pb-4"
|
||||
>
|
||||
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
|
||||
<h1>{{ task.title }}</h1>
|
||||
<div class="d-flex justify-start">
|
||||
<img
|
||||
class="icon"
|
||||
:src="require('@/plugins/tm@overview/_img/pencil-icon.svg')"
|
||||
alt="pencil-icon"
|
||||
@click.stop="editMode = !editMode"
|
||||
/>
|
||||
<img
|
||||
class="icon trash"
|
||||
:src="require('@/plugins/tm@overview/_img/trash-icon.svg')"
|
||||
alt="trash-icon"
|
||||
@click.stop="openDeleteTaskModal(task)"
|
||||
/>
|
||||
<img class="icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
|
||||
<img class="icon trash" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(task)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<div class="w-100">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-link" size="large"></v-icon>
|
||||
<p class="mx-3">Mastertask</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p class="task-badge px-4 py-2 rounded-pill">
|
||||
{{ task.master_task.name }}
|
||||
</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-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="task.is_finished"
|
||||
class="status-badge px-4 py-2 rounded-pill"
|
||||
>
|
||||
Ukončený
|
||||
</p>
|
||||
<p
|
||||
v-if="!task.is_finished"
|
||||
class="status-badge px-4 py-2 rounded-pill"
|
||||
>
|
||||
Neukončený
|
||||
</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col cols="5">
|
||||
<v-sheet class="pa-2 ma-2 pt-5">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon
|
||||
icon="mdi-calendar-week"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Trvanie</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<div v-for="(date, index) in task.timeblocks" :key="date.id">
|
||||
<div class="d-flex align-center m-5">
|
||||
<v-icon
|
||||
@click.stop="removeDate(index)"
|
||||
class="remove-date cursor-pointer mr-2" icon="mdi-minus" size="medium"
|
||||
/>
|
||||
<p
|
||||
class="task-badge px-4 py-2 rounded-pill mt-2"
|
||||
v-html="
|
||||
`${tmUtils.formatDateTime(date.start)} - ${tmUtils.formatDateTime(date.end)}`
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<v-icon
|
||||
@click="showDatePicker = true"
|
||||
class="add-date cursor-pointer mt-5" icon="mdi-plus" size="medium"
|
||||
/>
|
||||
<v-dialog max-width="650" v-model="showDatePicker">
|
||||
<v-card>
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<h1>Pridať dátum</h1>
|
||||
<Z-task-readonly-info :task="task" />
|
||||
|
||||
<v-icon
|
||||
@click.stop="showDatePicker = false"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
></v-icon>
|
||||
</div>
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||
<Datepicker
|
||||
v-model="selectedNewDate"
|
||||
class="modal-input"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
select-text="Vybrať"
|
||||
cancel-text="Zrušiť"
|
||||
placeholder="Trvanie od - do"
|
||||
range
|
||||
/>
|
||||
</v-card-actions>
|
||||
<v-btn @click="addNewDate()" class="button primary mt-5">Potvrdiť</v-btn>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<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-account-outline"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Priradený</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2 d-flex align-center">
|
||||
<p
|
||||
class="employee-selected-avatar d-flex justify-center align-center"
|
||||
>
|
||||
{{
|
||||
task.employee.name.charAt(0) +
|
||||
task.employee.surname.charAt(0)
|
||||
}}
|
||||
</p>
|
||||
<p
|
||||
class="ml-2"
|
||||
v-html="
|
||||
`${task.employee.name} ${task.employee.surname}`
|
||||
"
|
||||
/>
|
||||
</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>{{ (task.duration / 3600000).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">
|
||||
<v-text-field
|
||||
v-model="task.spent_time"
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
type="number"
|
||||
placeholder="h"
|
||||
></v-text-field>
|
||||
</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>
|
||||
{{ ((task.duration / 3600000) - (task.spent_time)).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="task.description"
|
||||
class="description-detail px-2 py-2 w-100 rounded mt-2"
|
||||
/>
|
||||
<p class="mt-5">Prílohy</p>
|
||||
<div class="w-100 d-flex align-center">
|
||||
<div
|
||||
v-for="(file, index) in task.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">
|
||||
<v-btn class="done-btn" @click.stop="task.is_finished = 1; save()"
|
||||
>Dokončené</v-btn
|
||||
>
|
||||
<v-btn class="button secondary" @click="save()"
|
||||
>Uložiť zmeny</v-btn
|
||||
>
|
||||
<v-btn class="done-btn" @click.stop="task.is_finished = 1; save()">Dokončené</v-btn>
|
||||
<v-btn class="button secondary" @click="save()">Uložiť zmeny</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-actions>
|
||||
@@ -363,26 +55,27 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Datepicker from '@vuepic/vue-datepicker'
|
||||
import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue'
|
||||
import useVuelidate from '@vuelidate/core'
|
||||
import { required } from '@vuelidate/validators'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import moment from 'moment'
|
||||
import { QuillEditor } from '@vueup/vue-quill'
|
||||
import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
|
||||
import SelectsMixin from '../master-task/_mixins/selects.mixin'
|
||||
import * as FileSaver from 'file-saver'
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
||||
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
||||
import ZFilesUpload from "@/plugins/tm@_components/z-files-upload.vue"
|
||||
import useVuelidate from "@vuelidate/core"
|
||||
import { required } from "@vuelidate/validators"
|
||||
import errorUtils from "@/plugins/lib@auth/_utils/error.utils"
|
||||
import { QuillEditor } from "@vueup/vue-quill"
|
||||
import VuetifyFixFocusMixin from "@/plugins/tm@modal/_mixins/vuetify-fix-focus"
|
||||
import SelectsMixin from "../master-task/_mixins/selects.mixin"
|
||||
import * as FileSaver from "file-saver"
|
||||
import tmUtils from "@/plugins/tm@_utils/tm.utils"
|
||||
import "@vueup/vue-quill/dist/vue-quill.snow.css"
|
||||
import ZAutocomplete from "@/plugins/tm@_components/z-autocomplete.vue"
|
||||
|
||||
import ZTaskReadonlyInfo from "./_components/z-task-readonly-info.vue"
|
||||
import { mapGetters } from "vuex"
|
||||
|
||||
export default {
|
||||
emits: ['close', 'refresh'],
|
||||
emits: ["close", "refresh"],
|
||||
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||
|
||||
components: {
|
||||
Datepicker,
|
||||
ZTaskReadonlyInfo,
|
||||
ZFilesUpload,
|
||||
QuillEditor,
|
||||
ZAutocomplete
|
||||
@@ -397,8 +90,6 @@ export default {
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
preventInputFocus: false,
|
||||
masterTasks: [],
|
||||
employees: null,
|
||||
masterTaskIdSelect: null,
|
||||
showDatePicker: false,
|
||||
selectedNewDate: []
|
||||
@@ -406,12 +97,16 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
filteredEmployees() {
|
||||
if (!this.employees || !this.task?.master_task)
|
||||
return []
|
||||
...mapGetters('tm', [
|
||||
'mastertasks',
|
||||
'employees'
|
||||
]),
|
||||
|
||||
const selectedEmployees = this.task.master_task.employees?.map(employee => employee.id) || []
|
||||
const filteredEmployees = this.employees.filter(employee => !selectedEmployees.includes(employee.id))
|
||||
filteredEmployees() {
|
||||
if (!this.employees || !this.task?.master_task) return []
|
||||
|
||||
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)
|
||||
}
|
||||
@@ -431,35 +126,35 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$events.on('on-task-deleted', (task) => {
|
||||
this.$events.on("on-task-edited", (task) => {
|
||||
if (task?.id == this.task?.id)
|
||||
this.task = this._enrichTask(task)
|
||||
|
||||
// TODO: Remove? riesil som neodstranovanie jedineho zanamu v trvani a odpracovanom case
|
||||
this.$forceUpdate()
|
||||
})
|
||||
|
||||
this.$events.on("on-task-deleted", (task) => {
|
||||
if (task?.id == this.task?.id) this.closeModal()
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal(task, editMode = false, masterTask = {}) {
|
||||
this.v$.$reset()
|
||||
this.visible = true
|
||||
this.task = null
|
||||
this.masterTaskIdSelect = null
|
||||
this.task = null
|
||||
this.visible = true
|
||||
|
||||
try {
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||
|
||||
if (task?.id) {
|
||||
const t = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
||||
t.master_task = this.masterTasks.find(mt => mt.id == t.master_task_id)
|
||||
t.employee = this.employees.find(employee => employee.id == t.employee_id)
|
||||
|
||||
this.masterTaskIdSelect = t.master_task.id
|
||||
this.task = t
|
||||
const fetchedTask = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
||||
this.task = this._enrichTask(fetchedTask)
|
||||
} else {
|
||||
this.task = {master_task: masterTask}
|
||||
this.task = { master_task: masterTask }
|
||||
this.masterTaskIdSelect = masterTask.id
|
||||
}
|
||||
|
||||
this.editMode = (editMode || !this.task.id)
|
||||
this.editMode = editMode || !this.task.id
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
@@ -467,14 +162,14 @@ export default {
|
||||
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
this.masterTaskIdSelect = null
|
||||
this.$nextTick(() => this.v$.$reset())
|
||||
},
|
||||
|
||||
async save() {
|
||||
console.log(this.task)
|
||||
if (!(await this.v$.$validate()))
|
||||
return console.log(this.v$);
|
||||
if (!(await this.v$.$validate())) return console.log(this.v$)
|
||||
|
||||
this.task.description = this.$refs['description'].getHTML()
|
||||
this.task.description = this.$refs["description"].getHTML()
|
||||
|
||||
try {
|
||||
if (this.task?.id) {
|
||||
@@ -484,7 +179,7 @@ export default {
|
||||
this.task.id = subtask.id
|
||||
}
|
||||
|
||||
this.$events.emit('on-task-edited', this.task)
|
||||
this.$events.emit("on-task-edited", this.task)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
@@ -504,9 +199,9 @@ export default {
|
||||
|
||||
async downloadFile(id) {
|
||||
try {
|
||||
const file = await this.$axios.get_auth_data(`v1/subtasks/${this.task.id}`, { responseType: 'arraybuffer' })
|
||||
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) {
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
@@ -516,30 +211,38 @@ export default {
|
||||
},
|
||||
|
||||
openDeleteTaskModal(task) {
|
||||
this.$events.emit('show-delete-task-modal', { task })
|
||||
this.$events.emit("show-delete-task-modal", { task })
|
||||
},
|
||||
|
||||
filesUploaded(files) {
|
||||
this.task.files = files
|
||||
},
|
||||
|
||||
_enrichTask(task) {
|
||||
task.master_task = this.mastertasks.find((masterTask) => masterTask.id == task.master_task_id)
|
||||
task.employee = this.employees.find((employee) => employee.id == task.employee_id)
|
||||
this.masterTaskIdSelect = task.master_task.id
|
||||
|
||||
return task
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
masterTaskIdSelect(value) {
|
||||
if (!value || !this.task) return
|
||||
|
||||
this.task.master_task = this.masterTasks.find(masterTask => masterTask.id == value)
|
||||
this.task.project_code = this.task.master_task.project_code
|
||||
this.task.master_task = this.mastertasks.find((masterTask) => masterTask.id == value)
|
||||
this.task.project_code = this.task.master_task.project_code
|
||||
},
|
||||
|
||||
'task.employee_id'(value) {
|
||||
"task.employee_id"(value) {
|
||||
if (!value) return
|
||||
this.task.employee = this.employees.find(employee => employee.id == value)
|
||||
this.task.employee = this.employees.find((employee) => employee.id == value)
|
||||
},
|
||||
|
||||
editMode() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs['description']?.setHTML(this.task.description || '')
|
||||
this.$refs["description"]?.setHTML(this.task.description || "")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user