mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
[subtask, masterTask] delete requests
This commit is contained in:
1 parent
17ed7616ee
commit
72d709cd13
4 files changed
+44
-29
No files matched your search
@@ -54,17 +54,17 @@ const options: Options = {
|
||||
// 'GET v1/master-tasks/(id)': true,
|
||||
// 'GET v1/master-tasks': true,
|
||||
'POST v1/master-tasks/(id)': true,
|
||||
'DELETE v1/master-tasks/(id)': true,
|
||||
'POST v1/master-tasks': true,
|
||||
// 'DELETE v1/master-tasks/(id)': true,
|
||||
// 'POST v1/master-tasks': true,
|
||||
|
||||
'GET v1/overview/projects': true,
|
||||
// 'GET v1/overview/projects': true,
|
||||
'GET v1/overview/tasks': true,
|
||||
'GET v1/overview/teams': true,
|
||||
'GET v1/overview/ongoing-tasks': true,
|
||||
'GET v1/overview/unscheduled-tasks': true,
|
||||
|
||||
'GET v1/tasks/(id)': true,
|
||||
'POST v1/tasks/(id)': true,
|
||||
// 'POST v1/tasks/(id)': true,
|
||||
'DELETE v1/tasks/(id)': true,
|
||||
|
||||
// 'GET v1/teams/(id)': true,
|
||||
|
||||
@@ -12,19 +12,22 @@
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="masterTask.project_code"
|
||||
<v-select
|
||||
v-model="masterTask.project_id"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
class="modal-input border-select"
|
||||
label="Kód projektu"
|
||||
variant="solo"
|
||||
:class="{ error: v$.masterTask.project_code.$errors.length }"
|
||||
:items="projects"
|
||||
item-value="id"
|
||||
item-title="code"
|
||||
:class="{ error: v$.masterTask.project_id.$errors.length }"
|
||||
:hint="
|
||||
v$.masterTask.project_code.$errors
|
||||
? errorUtils.parseErrors(v$.masterTask.project_code.$errors)
|
||||
v$.masterTask.project_id.$errors
|
||||
? errorUtils.parseErrors(v$.masterTask.project_id.$errors)
|
||||
: null
|
||||
"
|
||||
></v-text-field>
|
||||
></v-select>
|
||||
|
||||
<v-text-field
|
||||
v-model="masterTask.name"
|
||||
@@ -285,7 +288,7 @@
|
||||
<div class="d-flex justify-start">
|
||||
<img class="pencil-icon" :src="require('@/plugins/tm@dashboard/_components/_img/checkmark.svg')" alt="checkmark-icon" :style="{opacity: 0.3}">
|
||||
<img class="pencil-icon ml-2" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" :style="{opacity: 0.3}">
|
||||
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" :style="{opacity: 0.3}">
|
||||
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(task)">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -336,6 +339,7 @@ export default {
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
teams: null,
|
||||
projects: null,
|
||||
employees: null,
|
||||
employeeSelect: null,
|
||||
teamSelect: '',
|
||||
@@ -348,9 +352,11 @@ export default {
|
||||
validations() {
|
||||
return {
|
||||
masterTask: {
|
||||
project_code: { required },
|
||||
project_id: { required },
|
||||
name: { required },
|
||||
team: { required },
|
||||
// duration: { required },
|
||||
// description: { required },
|
||||
deadline: { required },
|
||||
employees: { atLeastOne }
|
||||
},
|
||||
@@ -364,10 +370,6 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
itemSelected(x) {
|
||||
console.log(x)
|
||||
},
|
||||
|
||||
getFullNameByEmployeeId(employee_id) {
|
||||
let fullName = ''
|
||||
let initials = ''
|
||||
@@ -394,6 +396,7 @@ export default {
|
||||
try {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||
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)
|
||||
|
||||
if (masterTask?.id) {
|
||||
@@ -414,15 +417,23 @@ export default {
|
||||
return
|
||||
|
||||
try {
|
||||
this.masterTask.duration = 5
|
||||
this.masterTask.description = 'popis'
|
||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
||||
employee.duration = 5
|
||||
return employee
|
||||
})
|
||||
this.masterTask.deadline = moment(this.masterTask.deadline).format("YYYY-MM-DD HH:MM:SS")
|
||||
|
||||
if (this.masterTask.id)
|
||||
await this.$axios.put_auth(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
||||
|
||||
else
|
||||
await this.$axios.post_auth('v1/mastertasks', this.masterTask)
|
||||
await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
||||
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast(error)
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -435,6 +446,10 @@ export default {
|
||||
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
||||
},
|
||||
|
||||
openDeleteTaskModal(task) {
|
||||
this.$events.emit('show-delete-task-modal', { task })
|
||||
},
|
||||
|
||||
employeeSelected(selectedOption) {
|
||||
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
|
||||
this.masterTask.employees.push(employee)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<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 zmazať <b>{{ task.title }}</b>?</h1>
|
||||
<h1>Ste si istý, že chcete zmazať task z masterTasku <b>{{ task.project_code }}</b>?</h1>
|
||||
|
||||
<v-icon
|
||||
@click.stop="closeModal()"
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
|
||||
async deleteTask() {
|
||||
try {
|
||||
await this.$axios.delete(`v1/tasks/${this.task.id}`)
|
||||
await this.$axios.delete(`v1/subtasks/${this.task.id}`)
|
||||
this.$emit('on-task-deleted', this.task)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
|
||||
@@ -211,8 +211,6 @@
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||
<Datepicker
|
||||
v-model="selectedNewDate"
|
||||
:class="{ error: v$.selectedNewDate.$errors.length }"
|
||||
:validations="v$.selectedNewDate"
|
||||
class="modal-input"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
@@ -414,13 +412,11 @@ export default {
|
||||
validations() {
|
||||
return {
|
||||
task: {
|
||||
// project_code: { required },
|
||||
date: { required },
|
||||
// team: { required },
|
||||
duration: { required },
|
||||
employee: { required },
|
||||
},
|
||||
selectedNewDate: { required }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -438,7 +434,7 @@ export default {
|
||||
try {
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||
if (task?.id) {
|
||||
const t = await this.$axios.get_auth_data(`v1/tasks/${task.id}`)
|
||||
const t = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
||||
|
||||
this.employeeIdSelect = t.employee.id
|
||||
this.masterTaskIdSelect = t.master_task.id
|
||||
@@ -459,14 +455,14 @@ export default {
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (!(await this.v$.$validate())) return
|
||||
if (!(await this.v$.$validate())) return console.log(this.v$)
|
||||
|
||||
try {
|
||||
if (this.task.id) {
|
||||
await this.$axios.put_auth(`v1/mastertasks/${this.task.id}`, this.task)
|
||||
this.$events.emit('on-task-edited', this.task)
|
||||
} else {
|
||||
await this.$axios.post_auth('v1/mastertasks', this.task)
|
||||
await this.$axios.post_auth('v1/subtasks', this.task)
|
||||
}
|
||||
|
||||
this.closeModal()
|
||||
@@ -504,6 +500,10 @@ export default {
|
||||
if (!value || !this.task) return
|
||||
|
||||
this.task.master_task = this.masterTasks.find(masterTask => masterTask.id == value)
|
||||
const selectedMasterTask = this.masterTasks.find(masterTask => masterTask.id === value)
|
||||
if (selectedMasterTask) {
|
||||
this.task.project_code = selectedMasterTask.project_code
|
||||
}
|
||||
},
|
||||
|
||||
employeeIdSelect(value) {
|
||||
|
||||
Reference in new issue
Block a user