diff --git a/app/src/plugins/app/_theme/global.sass b/app/src/plugins/app/_theme/global.sass index 92e5121..50a3b0a 100644 --- a/app/src/plugins/app/_theme/global.sass +++ b/app/src/plugins/app/_theme/global.sass @@ -41,6 +41,9 @@ height: 24px width: 24px +.is-finished + background: #06dece !important + .add-date color: white border-radius: 50% diff --git a/app/src/plugins/tm@_components/z-autocomplete.vue b/app/src/plugins/tm@_components/z-autocomplete.vue index 86b5865..1667a3c 100644 --- a/app/src/plugins/tm@_components/z-autocomplete.vue +++ b/app/src/plugins/tm@_components/z-autocomplete.vue @@ -5,6 +5,7 @@ variant="solo" v-model="search" @keydown.enter="optionSelected()" + @keydown.tab="optionSelected()" :class="{ error: validations?.$errors?.length }" :hint=" validations?.$errors diff --git a/app/src/plugins/tm@dashboard/_components/z-timeline.vue b/app/src/plugins/tm@dashboard/_components/z-timeline.vue index a723dab..63bc559 100644 --- a/app/src/plugins/tm@dashboard/_components/z-timeline.vue +++ b/app/src/plugins/tm@dashboard/_components/z-timeline.vue @@ -196,7 +196,7 @@ export default { } else { event.completed = !event.completed try { - await this.$axios.patch_auth(`v1/tasks/${event.id}`, event) + await this.$axios.patch_auth(`v1/subtasks/${event.id}`, event) this.$emit('reopenTask', event) } catch (error) { this.$toast.error(error) diff --git a/app/src/plugins/tm@modal/master-task/_components/a-tasks-table.vue b/app/src/plugins/tm@modal/master-task/_components/a-tasks-table.vue index 827ca12..9bebed8 100644 --- a/app/src/plugins/tm@modal/master-task/_components/a-tasks-table.vue +++ b/app/src/plugins/tm@modal/master-task/_components/a-tasks-table.vue @@ -9,9 +9,14 @@

{{ task._employeeFullName }}

+ +

Ukončený

+

Neukončený

+
- checkmark-icon + checkmark-icon + checkmark-icon pencil-icon trash-icon
@@ -56,6 +61,24 @@ export default { openEditTaskModal(task) { this.$events.emit('show-task-modal', { task, editMode: false }) + }, + + async clickCompleteTask(task) { + if (!task.is_finished) { + this.openCompleteTaskModal(task) + } else { + task.is_finished = !task.is_finished + try { + await this.$axios.patch_auth(`v1/subtasks/${task.id}`, task) + this.$emit('reopenTask', task) + } catch (error) { + this.$toast.error(error) + } + } + }, + + openCompleteTaskModal(task) { + this.$events.emit('show-complete-task-modal', { task }) } } } diff --git a/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts b/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts index d6d003e..85d8ee9 100644 --- a/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts +++ b/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts @@ -24,6 +24,13 @@ export default { this.masterTask.project_id = project.id }, + onMasterTaskSelected({ key }) { + const masterTask = this.masterTasks.find(masterTask => masterTask.id == key) + this.masterTask.name = masterTask.name + console.log(masterTask.name) + this.masterTask.master_task.id = masterTask.id + }, + onEmployeeSelected({ key }) { const employee = this.employees.find(employee => employee.id == key) this.masterTask.employees.push(employee) @@ -50,9 +57,11 @@ export default { }, watch: { - 'masterTask.team_id'(value) { - if (!value) return + 'masterTask.team_id'(value, oldValue) { + if (!value || !oldValue) return + this.masterTask.team = this.teams.find(team => team.id == value) + this.masterTask.employees = this.masterTask.team.employees } } } \ No newline at end of file diff --git a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue index 2046ea1..1caecf3 100644 --- a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue +++ b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue @@ -24,11 +24,11 @@

- + @@ -184,6 +184,16 @@ export default { this.masterTask.team_id = this.masterTask.team.id this.masterTask.project_id = project.id this.masterTask.project_code = project.code + + // TODO refactor + this.masterTask.employees = this.masterTask.employees.map(employee => { + const subtask = this.masterTask?.subtasks.find(subtask => subtask.employee_id == employee.id) + employee.duration = subtask.duration + + return employee + }) + + console.log(this.masterTask.employees) } else { this.masterTask = { employees: [], duration: 0 } } @@ -198,9 +208,15 @@ export default { if (!(await this.v$.$validate())) return this.masterTask.description = this.$refs['description'].getHTML() - this.masterTask.employees = [...this.masterTask.employees, ...this.masterTask.team?.employees] - this.masterTask.project_code = null + // this.masterTask.subtasks = this.masterTask.subtasks.map(subtask => { + // const employee = this.masterTask.employees.find(employee => employee.id == subtask.employee_id) + // subtask.duration = employee.duration + + // return subtask + // }) + + // this.masterTask.project_code = null try { this.masterTask.deadline = moment(this.masterTask.deadline).format('YYYY-MM-DD HH:MM:SS') diff --git a/app/src/plugins/tm@modal/task/z-complete-task-modal.vue b/app/src/plugins/tm@modal/task/z-complete-task-modal.vue index b16f3ef..861ec5d 100644 --- a/app/src/plugins/tm@modal/task/z-complete-task-modal.vue +++ b/app/src/plugins/tm@modal/task/z-complete-task-modal.vue @@ -2,8 +2,7 @@
-

Ste si istý, že chcete ukončiť {{ task.title }}?

- +

Ste si istý, že chcete {{ this.task?.id ? 'ukončiť' : 'obnoviť' }} task, z masterTasku {{ task.master_task }}?

+ +