diff --git a/app/src/plugins/tm@modal/task/z-task-modal.vue b/app/src/plugins/tm@modal/task/z-task-modal.vue index 7e41277..0dbef99 100644 --- a/app/src/plugins/tm@modal/task/z-task-modal.vue +++ b/app/src/plugins/tm@modal/task/z-task-modal.vue @@ -12,7 +12,15 @@ - + + + + + @@ -97,6 +105,7 @@ export default { v$: useVuelidate(), preventInputFocus: false, showDatePicker: false, + employeeError: false, selectedNewDate: [] } }, @@ -113,7 +122,7 @@ export default { subtask: { master_task_id: { required }, duration: { required }, - employee_id: { required } + name: { required } } } }, @@ -143,7 +152,7 @@ export default { const data = await this.$axios.get_auth_data(`v1/subtasks/${subtask.id}`) this.subtask = this._enrichTask(data) } else { - this.subtask = { master_task: mastertask, timeblocks: [{start: tmUtils.formatDateTimeForBackend(moment()), end: tmUtils.formatDateTimeForBackend(moment())}] } + this.subtask = { master_task: mastertask, employees: [], timeblocks: [] } } this.editMode = editMode || !this.subtask.id @@ -158,9 +167,15 @@ export default { }, async save() { + if (!this.subtask.employee_id && !this.subtask.employees.length) + this.employeeError = true + if (!(await this.v$.$validate())) return + if (!this.subtask.employee_id && !this.subtask.employees.length) + return + this.subtask.description = this.$refs['description'].getHTML() try { @@ -213,12 +228,17 @@ export default { watch: { 'subtask.employee_id'(value, oldValue) { + this.employeeError = false if (!value || !oldValue) return this.subtask.timeblocks = [] this.subtask._employee = this.enrichedEmployees.find((employee) => employee.id == this.subtask.employee_id) }, + 'subtask.employees'() { + this.employeeError = false + }, + 'subtask.master_task_id'(value) { if (!value) return this.subtask._master_task = this.mastertasks.find((mastertask) => mastertask.id == this.subtask.master_task_id)