This commit is contained in:
romankko2 committed 2023-02-10 17:33:51 +01:00
1 parent 1024f73ab5
commit 4e8fa39e34
8 files changed
+79 -13

No files matched your search

@@ -24,11 +24,11 @@
</p>
</v-text-field>
<v-text-field v-for="(employee, index) in masterTask.team?.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.team.employees[index].duration }" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="masterTask.team.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
<!-- <v-text-field v-for="(employee, index) in masterTask.team?.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.team.employees[index].duration }" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="masterTask.team.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
<p class="employee-select-avatar d-flex justify-center align-center">
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
</p>
</v-text-field>
</v-text-field> -->
<Z-autocomplete label="Vyhľadať zamestnanca" v-if="showAddEmployeeInput" :options="employeesOptions" class="modal-input" @option-selected="onEmployeeSelected" />
@@ -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')