refactor(task-modal): fix validation for draft subtask creation

This commit is contained in:
Matej Glasnák committed 2025-12-08 12:18:49 +01:00
1 parent f69e55859b
commit 2689b92cf2
2 files changed
+7 -8

No files matched your search

@@ -808,10 +808,9 @@ export default {
return true;
} else {
const employeesValid = await this._validateEmployees();
if (!employeesValid) return;
this.v$.subtask.master_task_id.$touch();
return true;
return this.v$.subtask.master_task_id.$errors.length === 0;
}
},
@@ -858,16 +857,12 @@ export default {
const payload = { ...this.subtask, timesheets, timeblocks };
console.log('isConcept', concept);
if (concept) {
payload.is_draft = 1;
} else {
payload.is_draft = 0;
}
console.log('payload', payload);
const { subtask } = await this.$axios.patch_auth_form(
`v1/subtasks/${this.subtask.id}`,
payload,
@@ -913,6 +908,10 @@ export default {
};
if (concept) {
subtaskCopy.is_draft = true;
subtaskCopy.employees =
subtaskCopy.employees?.length > 0
? subtaskCopy.employees
: [{ id: this.$store.getters['auth/user']?.id, duration: 0 }];
}
delete subtaskCopy._master_task;
const { subtasks } = await this.$axios.post_auth(