[Mastertask] Added v-autocomplete

This commit is contained in:
Matej Glasnák committed 2023-04-11 14:22:56 +02:00
1 parent 5d6a2f9b66
commit 4a9dfc6520
4 files changed
+87 -86

No files matched your search

@@ -3,34 +3,28 @@ export default {
employeesOptions() {
const selectedEmployees = [...this.mastertask.employees].map(employee => employee.id)
const employees = this.enrichedEmployees.filter(
return this.enrichedEmployees.filter(
(employee) => !selectedEmployees.includes(employee.id)
) || []
},
return employees.map((employee) => {
return {
key: employee.id,
value: `${employee.name} ${employee.surname}`,
}
})
projectsOptions() {
// Added to "paginate" projects, because v-autocomplete was unable to handle so many projects at once
const projects = this.projects.filter(project => project.code.includes(this.projectCodeSearch))
return projects?.length ? projects.slice(0, 10) : this.projects.slice(0, 10)
}
},
methods: {
onProjectSelected({ key }) {
const project = this.projects.find(project => project.id == key)
this.mastertask.project_code = project.code
this.mastertask.project_id = project.id
},
// onProjectSelected(id) {
// const project = this.projects.find(project => project.id == id)
// this.mastertask.project_code = project.code
// this.mastertask.project_id = project.id
// },
onMasterTaskSelected({ key }) {
const mastertask = this.mastertasks.find(mastertask => mastertask.id == key)
this.subtask.master_task = mastertask
this.subtask.project_code = mastertask.project_code
},
onEmployeeSelected({ key }) {
const employee = this.enrichedEmployees.find(employee => employee.id == key)
onEmployeeSelected(id) {
const employee = this.enrichedEmployees.find(employee => employee.id == id)
this.mastertask.employees.push(employee)
this.showAddEmployeeInput = false
},
@@ -60,6 +54,6 @@ export default {
this.mastertask.team = this.teams.find(team => team.id == value)
this.mastertask.employees = this.mastertask.team.employees
}
},
}
}