[Projects] Added filters

This commit is contained in:
Matej Glasnák committed 2023-03-01 14:19:33 +01:00
1 parent 919b2eebbe
commit 302286bff8
29 files changed
+508 -350

No files matched your search

@@ -42,7 +42,7 @@ export default {
methods: {
openMastertask() {
this.$emit('close-modal')
this.$events.emit('show-master-task-modal', {masterTask: {id: this.id}, editMode: false})
this.$events.emit('show-master-task-modal', {mastertask: {id: this.id}, editMode: false})
}
}
}
@@ -4,9 +4,9 @@
<section v-html="description" class="description-detail px-2 py-2 w-100 rounded mt-2" />
</div>
<div class="px-5 py-5 border-bottom" v-if="masterTaskDescription">
<div class="px-5 py-5 border-bottom" v-if="mastertaskDescription">
<p>Popis mastertasku</p>
<section v-html="masterTaskDescription" class="description-detail px-2 py-2 w-100 rounded mt-2" />
<section v-html="mastertaskDescription" class="description-detail px-2 py-2 w-100 rounded mt-2" />
</div>
</template>
@@ -18,7 +18,7 @@ export default {
default: () => null
},
masterTaskDescription: {
mastertaskDescription: {
type: String || null,
default: () => null
}
@@ -7,7 +7,7 @@
<A-task-planned-time :hours="task.duration" />
<A-task-remaining-time :hours="task.duration - task.spent_time" />
<A-task-spent-time :hours="task.spent_time" :task="task" />
<A-task-description :description="task.description" :master-task-description="task.master_task_description" />
<A-task-description :description="task.description" :mastertask-description="task.master_task_description" />
<Z-files :files="task.files" />
</template>
@@ -21,7 +21,7 @@ import ATaskPlannedTime from './_components/a-task-planned-time.vue'
import ATaskSpentTime from './_components/a-task-spent-time.vue'
import ATaskRemainingTime from './_components/a-task-remaining-time.vue'
import ATaskDescription from './_components/a-task-description.vue'
import ZFiles from '@/plugins/tm@modal/_components/z-files.vue'
import ZFiles from '@/plugins/tm@modal/_components/read-only/z-files.vue'
export default {
emits: ['close-modal'],
@@ -2,7 +2,7 @@
<v-dialog v-model="visible" max-width="750">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete {{ subtask.is_finished ? 'znovu otvoriť' : 'dokončiť' }} task, z masterTasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1>
<h1>Ste si istý, že chcete {{ subtask.is_finished ? 'znovu otvoriť' : 'dokončiť' }} task, z mastertasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1>
<v-icon
@click.stop="visible = false"
icon="mdi-close"
@@ -2,7 +2,7 @@
<v-dialog v-model="visible" max-width="750">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete zmazať task z masterTasku <b>{{ task.project_code }}</b>?</h1>
<h1>Ste si istý, že chcete zmazať task z mastertasku <b>{{ task.project_code }}</b>?</h1>
<v-icon
@click.stop="closeModal()"
+14 -12
View File
@@ -10,13 +10,13 @@
<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>
<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" />
<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" ref="employee-select" @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-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 }">
<div class="w-100 modal-input">
<QuillEditor ref="description" v-model="task.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="task.description = $event.srcElement.innerHTML" />
</div>
@@ -92,7 +92,7 @@ export default {
errorUtils,
v$: useVuelidate(),
preventInputFocus: false,
masterTaskIdSelect: null,
mastertaskIdSelect: null,
showDatePicker: false,
selectedNewDate: []
}
@@ -115,7 +115,6 @@ export default {
validations() {
return {
task: {
description: { required },
master_task: {
id: { required }
},
@@ -140,7 +139,7 @@ export default {
},
methods: {
async showModal(task, editMode = false, masterTask = {}) {
async showModal(task, editMode = false, mastertask = {}) {
this.task = null
this.visible = true
this.$nextTick(() => this.v$.$reset())
@@ -150,8 +149,8 @@ export default {
const subtask = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
this.task = this._enrichTask(subtask)
} else {
this.task = { master_task: masterTask, timeblocks: [{start: tmUtils.formatDateTimeForBackend(moment()), end: tmUtils.formatDateTimeForBackend(moment())}] }
this.masterTaskIdSelect = masterTask.id
this.task = { master_task: mastertask, timeblocks: [{start: tmUtils.formatDateTimeForBackend(moment()), end: tmUtils.formatDateTimeForBackend(moment())}] }
this.mastertaskIdSelect = mastertask.id
}
this.editMode = editMode || !this.task.id
@@ -224,26 +223,29 @@ export default {
},
_enrichTask(task) {
task.master_task = this.mastertasks.find((masterTask) => masterTask.id == task.master_task_id)
task.master_task = this.mastertasks.find((mastertask) => mastertask.id == task.master_task_id)
task.employee = this.enrichedEmployees.find((employee) => employee.id == task.employee_id)
task._created_by = this.enrichedEmployees.find((employee) => employee.id == task.created_by)
this.masterTaskIdSelect = task.master_task?.id
this.mastertaskIdSelect = task.master_task?.id
return task
}
},
watch: {
masterTaskIdSelect(value) {
mastertaskIdSelect(value) {
if (!value || !this.task) return
this.task.master_task = this.mastertasks.find((masterTask) => masterTask.id == value)
this.task.master_task = this.mastertasks.find((mastertask) => mastertask.id == value)
this.task.project_code = this.task.master_task.project_code
},
"task.employee_id"(value) {
"task.employee_id"(value, oldValue) {
if (!value) return
if (value && oldValue)
this.task.timeblocks = []
this.task.employee = this.enrichedEmployees.find((employee) => employee.id == value)
},