[subtask, masterTask] delete requests

This commit is contained in:
romankko2 committed 2023-02-08 18:41:07 +01:00
1 parent 17ed7616ee
commit 72d709cd13
4 files changed
+44 -29

No files matched your search

@@ -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) {