mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[napajanie modalov na BE]
This commit is contained in:
1 parent
26792a85a6
commit
4c8ee66cd6
34 files changed
+494
-396
No files matched your search
@@ -127,22 +127,20 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
try {
|
||||
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async create(blocker = null) {
|
||||
async showModal(blocker = null) {
|
||||
this.visible = true
|
||||
this.blocker = null
|
||||
|
||||
if (blocker) {
|
||||
await this._load()
|
||||
try {
|
||||
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
if (blocker?.id) {
|
||||
await this._load(blocker.id)
|
||||
} else {
|
||||
const blocker = {
|
||||
name: '',
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
</div>
|
||||
<v-table class="mt-7 mb-5">
|
||||
<tbody class="px-5 py-5">
|
||||
<!-- Kravarik: natiahnut toto z masterTask.tasks -->
|
||||
<tr v-for="(employee, index) in masterTask.employees" :key="employee.id">
|
||||
<td class="w-25">{{ masterTask.name }}</td>
|
||||
<td class="d-flex align-center">
|
||||
@@ -352,17 +353,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
try {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teamsx')
|
||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||
// this.masterTask = await this.$axios.get_auth_data(`v1/master-task/${this.masterTaksId}`)
|
||||
// this.selectedTeam = `${this.masterTask.team.name} - ${this.masterTask.team.id}`)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// async downloadFile() {
|
||||
// try {
|
||||
@@ -375,13 +365,20 @@ export default {
|
||||
// }
|
||||
// },
|
||||
|
||||
async create(masterTaskId = null, editMode = false) {
|
||||
async showModal(masterTask, editMode = false) {
|
||||
this.visible = true
|
||||
this.masterTask = null
|
||||
|
||||
if (masterTaskId) {
|
||||
await this._load(masterTaskId)
|
||||
this.editMode = editMode || (!this.masterTask?.id)
|
||||
try {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
if (masterTask?.id) {
|
||||
await this._load(masterTask.id)
|
||||
this.editMode = editMode || !masterTask?.id
|
||||
} else {
|
||||
const masterTask = {
|
||||
project_code: null,
|
||||
@@ -396,7 +393,7 @@ export default {
|
||||
|
||||
setTimeout(() => {
|
||||
this.masterTask = masterTask
|
||||
this.editMode = editMode || (!this.masterTask.id)
|
||||
this.editMode = editMode || !this.masterTask.id
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -434,7 +431,7 @@ export default {
|
||||
|
||||
async _create() {
|
||||
try {
|
||||
await this.$axios.post_auth('v1/master-tasks')
|
||||
await this.$axios.post_auth('v1/mastertasks')
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<v-dialog v-model="show" max-width="650">
|
||||
<v-dialog v-model="visible" max-width="650">
|
||||
<v-card>
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<h1>Ste si istý, že chcete ukončiť <b>{{ task.title }}</b>?</h1>
|
||||
|
||||
<v-icon
|
||||
@click.stop="show = false"
|
||||
@click.stop="visible = false"
|
||||
icon="mdi-close"
|
||||
size="large"
|
||||
></v-icon>
|
||||
</div>
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||
<v-btn class="z-btn" variant="flat" @click="complete()">ÁNO</v-btn>
|
||||
<v-btn class="ml-7 cancel-btn" @click.stop="show = false">ZRUŠIŤ</v-btn>
|
||||
<v-btn class="ml-7 cancel-btn" @click.stop="visible = false">ZRUŠIŤ</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
@@ -22,31 +22,19 @@
|
||||
export default {
|
||||
emits: ['close'],
|
||||
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
|
||||
task: {
|
||||
type: Object,
|
||||
required: true
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
task: null
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
show: {
|
||||
get() {
|
||||
return this.visible
|
||||
},
|
||||
|
||||
set(value) {
|
||||
if (!value) this.$emit('close')
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal(task) {
|
||||
this.task = task
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
async complete() {
|
||||
try {
|
||||
const task = {
|
||||
@@ -55,7 +43,7 @@ export default {
|
||||
}
|
||||
|
||||
await this.$axios.post(`v1/tasks/${task.id}`, task)
|
||||
this.show = false
|
||||
this.visible = false
|
||||
this.$emit('completeTask', task.id)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
|
||||
@@ -30,7 +30,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async delete(task) {
|
||||
async showModal(task) {
|
||||
this.task = task
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
+3
@@ -49,6 +49,9 @@ export default {
|
||||
|
||||
methods: {
|
||||
showModal() {
|
||||
// Kravarik: Dorobit logiku
|
||||
// 1. Save na be
|
||||
// 2. this.$events.emit('task-time-updated', task)
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
+86
-73
@@ -17,8 +17,9 @@
|
||||
disabled
|
||||
></v-text-field>
|
||||
|
||||
<!-- Toto treba fixnut -->
|
||||
<v-select
|
||||
v-model="selectedMasterTask"
|
||||
v-model="selectedMasterTaskId"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="MasterTask"
|
||||
@@ -29,12 +30,12 @@
|
||||
></v-select>
|
||||
|
||||
<v-select
|
||||
v-model="selectedEmployee"
|
||||
v-model="selectedEmployeeId"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="Priradený"
|
||||
variant="solo"
|
||||
:items="task.team.employees"
|
||||
:items="employees"
|
||||
item-value="id"
|
||||
item-title="_fullName"
|
||||
></v-select>
|
||||
@@ -70,9 +71,9 @@
|
||||
></v-text-field>
|
||||
|
||||
<div class="w-100 modal-input">
|
||||
<QuillEditor
|
||||
<QuillEditor
|
||||
v-model="task.description"
|
||||
placeholder="Popis"
|
||||
placeholder="Popis"
|
||||
theme="snow"
|
||||
class="rich-text-editor"
|
||||
/>
|
||||
@@ -99,7 +100,7 @@
|
||||
<div
|
||||
class="d-flex justify-space-between align-center modal-header border-bottom pb-4"
|
||||
>
|
||||
<h1>{{ task.master_task }}</h1>
|
||||
<h1>{{ task.title }}</h1>
|
||||
<div class="d-flex justify-start">
|
||||
<img
|
||||
class="pencil-icon"
|
||||
@@ -130,7 +131,7 @@
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p class="task-badge px-4 py-2 rounded-pill">
|
||||
{{ task.master_task }}
|
||||
{{ task.master_task.name }}
|
||||
</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
@@ -200,10 +201,20 @@
|
||||
</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.assigned_employee.name.charAt(0) + task.assigned_employee.surname.charAt(0)}}
|
||||
<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.assigned_employee.name} ${task.assigned_employee.surname}`" />
|
||||
<p
|
||||
class="ml-2"
|
||||
v-html="
|
||||
`${task.employee.name} ${task.employee.surname}`
|
||||
"
|
||||
/>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -221,7 +232,7 @@
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p>{{ task.duration }} h</p>
|
||||
<p>{{ task.duration / 3600 }} h</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -240,7 +251,7 @@
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<v-text-field
|
||||
v-model="task.worked_time"
|
||||
v-model="task.spent_time"
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
type="number"
|
||||
@@ -263,13 +274,18 @@
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p>{{ task.duration - task.worked_time }} h</p>
|
||||
<p>
|
||||
{{ (task.duration - task.spent_time) / 3600 }} 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"/>
|
||||
<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
|
||||
@@ -279,7 +295,9 @@
|
||||
:class="[index === 0 ? 'ml-0' : 'ml-2']"
|
||||
>
|
||||
<v-chip class="mt-2">
|
||||
<p @click="downloadFile" class="cursor-pointer" >{{ file.name }}</p>
|
||||
<p @click="downloadFile" class="cursor-pointer">
|
||||
{{ file.name }}
|
||||
</p>
|
||||
<v-icon
|
||||
class="mx-1"
|
||||
icon="mdi-paperclip"
|
||||
@@ -289,14 +307,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-start align-center mt-8">
|
||||
<v-btn class="done-btn" @click.stop="clickCompleteTask()">Dokončené</v-btn>
|
||||
<v-btn class="done-btn" @click.stop="clickCompleteTask()"
|
||||
>Dokončené</v-btn
|
||||
>
|
||||
<v-btn class="add-employee-btn" @click="save()"
|
||||
>Uložiť zmeny</v-btn
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-actions>
|
||||
<Z-delete-task-modal ref="z-delete-task-modal" @deleted="onTaskDeleted" />
|
||||
</v-card>
|
||||
</W-loadable>
|
||||
</v-dialog>
|
||||
@@ -309,9 +328,8 @@ import useVuelidate from '@vuelidate/core'
|
||||
import { required } from '@vuelidate/validators'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import moment from 'moment'
|
||||
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
|
||||
import { QuillEditor } from '@vueup/vue-quill'
|
||||
import * as FileSaver from 'file-saver'
|
||||
import * as FileSaver from 'file-saver'
|
||||
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
||||
|
||||
export default {
|
||||
@@ -321,7 +339,6 @@ export default {
|
||||
Datepicker,
|
||||
ZFilesUpload,
|
||||
QuillEditor,
|
||||
ZDeleteTaskModal
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -332,11 +349,9 @@ export default {
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
preventInputFocus: false,
|
||||
employees: null,
|
||||
selectedMasterTask: '',
|
||||
showAddEmployeeInput: false,
|
||||
masterTasks: null,
|
||||
selectedEmployee: null,
|
||||
masterTasks: [],
|
||||
selectedMasterTaskId: null,
|
||||
selectedEmployeeId: null
|
||||
}
|
||||
},
|
||||
|
||||
@@ -352,13 +367,10 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
try {
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/master-tasks')
|
||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
mounted() {
|
||||
this.$events.on('on-task-deleted', (task) => {
|
||||
if (task?.id == this.task?.id) this.close()
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -373,12 +385,18 @@ export default {
|
||||
// }
|
||||
// },
|
||||
|
||||
async create(taskId = null, editMode = false) {
|
||||
async showModal(task, editMode = false) {
|
||||
this.visible = true
|
||||
this.task = null
|
||||
|
||||
if (taskId) {
|
||||
await this._load(taskId)
|
||||
try {
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
if (task?.id) {
|
||||
await this._load(task.id)
|
||||
this.editMode = editMode || !this.task?.id
|
||||
} else {
|
||||
const task = {
|
||||
@@ -415,9 +433,8 @@ export default {
|
||||
if (this.task.id) {
|
||||
await this._update()
|
||||
this.close()
|
||||
}
|
||||
else await this._create()
|
||||
|
||||
} else await this._create()
|
||||
|
||||
this.close()
|
||||
this.$router.push({ name: 'Dashboard - Tasks' })
|
||||
} catch (error) {
|
||||
@@ -432,7 +449,17 @@ export default {
|
||||
|
||||
async _load(taskId) {
|
||||
try {
|
||||
this.task = await this.$axios.get_auth_data(`v1/tasks/${taskId}`)
|
||||
const task = await this.$axios.get_auth_data(`v1/tasks/${taskId}`)
|
||||
|
||||
// const employees = task.master_task.employees.map(employee => {
|
||||
// employee._fullName = `${employee.name} ${employee.surname}`
|
||||
// return employee
|
||||
// })
|
||||
|
||||
// this.employees = employees
|
||||
this.task = task
|
||||
this.selectedEmployeeId = this.task.employee.id
|
||||
this.selectedMasterTaskId = this.task.master_task.id
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
@@ -440,7 +467,7 @@ export default {
|
||||
|
||||
async _create() {
|
||||
try {
|
||||
await this.$axios.post_auth('v1/master-tasks')
|
||||
await this.$axios.post_auth('v1/mastertasks')
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
@@ -455,7 +482,7 @@ export default {
|
||||
},
|
||||
|
||||
deleteTask(task) {
|
||||
this.$refs['z-delete-task-modal'].delete(task)
|
||||
this.$events.emit('show-delete-task-modal', { task })
|
||||
},
|
||||
|
||||
onTaskDeleted() {
|
||||
@@ -463,9 +490,8 @@ export default {
|
||||
},
|
||||
|
||||
employeeSelected(selectedOption) {
|
||||
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
|
||||
this.task.employees.push(employee)
|
||||
this.showAddEmployeeInput = false
|
||||
const employee = this.task.master_task.employees.find(employee => employee.id == selectedOption.key)
|
||||
this.task.employee = employee
|
||||
},
|
||||
|
||||
// Vuetify input was automatically focus after date input was clicked. This will prevent this unwanted behavior
|
||||
@@ -488,20 +514,13 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
employeesOptions() {
|
||||
const selectedEmployeesIds = this.task.employees.map(
|
||||
(employee) => employee.id
|
||||
)
|
||||
const employees =
|
||||
this.employees.filter(
|
||||
(employee) => !selectedEmployeesIds.includes(employee.id)
|
||||
) || []
|
||||
employees() {
|
||||
if (!this.task?.master_task?.employees)
|
||||
return []
|
||||
|
||||
return employees.map((employee) => {
|
||||
return {
|
||||
key: employee.id,
|
||||
value: `${employee.name} ${employee.surname}`,
|
||||
}
|
||||
return this.task.master_task.employees.map(employee => {
|
||||
employee._fullName = `${employee.name} ${employee.surname}`
|
||||
return employee
|
||||
})
|
||||
},
|
||||
|
||||
@@ -519,25 +538,19 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
selectedMasterTask() {
|
||||
this.task.team = this.masterTasks.find(
|
||||
(masterTask) => masterTask.id == this.selectedMasterTask
|
||||
selectedMasterTaskId() {
|
||||
this.task.master_task = this.masterTasks.find(
|
||||
(masterTask) => masterTask.id == this.selectedMasterTaskId
|
||||
)
|
||||
console.log(this.task.team.employees)
|
||||
this.task.team.employees.forEach(
|
||||
(employee) => {
|
||||
employee._fullName = `${employee.name} ${employee.surname}`
|
||||
})
|
||||
console.log(this.task.team.employees)
|
||||
this.task.employee = null
|
||||
this.task.project_code = this.masterTasks.filter(
|
||||
(x) => x.id == this.selectedMasterTask
|
||||
)[0].project_code
|
||||
|
||||
// Kravarik: Tu bude treba vymsliet logiku resetovania, ale ked dam toto sa to trigeruje aj pri otvarani existujuceho tasku a hned to vymaze
|
||||
// this.selectedEmployeeId = null
|
||||
// this.task.employee = {}
|
||||
},
|
||||
|
||||
selectedEmployee() {
|
||||
this.task.employee = this.task.team.employees.find(
|
||||
(employee) => employee.id == this.selectedEmployee
|
||||
selectedEmployeeId() {
|
||||
this.task.employee = this.task.master_task.employees.find(
|
||||
(employee) => employee.id == this.selectedEmployeeId
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -28,7 +28,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async delete(team) {
|
||||
async showModal(team) {
|
||||
this.team = team
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
@@ -94,15 +94,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
try {
|
||||
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async save() {
|
||||
if (!(await this.v$.$validate()))
|
||||
@@ -120,12 +111,19 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async create(id = null) {
|
||||
async showModal(team = null) {
|
||||
this.visible = true
|
||||
this.team = null
|
||||
|
||||
if (id) {
|
||||
await this._load()
|
||||
try {
|
||||
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
if (team?.id) {
|
||||
await this._load(team.id)
|
||||
} else {
|
||||
const team = {
|
||||
name: '',
|
||||
@@ -145,7 +143,7 @@ export default {
|
||||
|
||||
async _create() {
|
||||
try {
|
||||
await this.$axios.post_auth('v1/teams', this.team)
|
||||
await this.$axios.post_auth(`v1/teams`, this.team)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user