[Projects] Added filters

This commit is contained in:
Matej Glasnák committed 2023-03-01 14:19:33 +01:00
1 parent 919b2eebbe
commit 302286bff8
29 files changed
+508 -350

No files matched your search

@@ -1,7 +1,7 @@
export default {
computed: {
employeesOptions() {
const selectedEmployees = [...this.masterTask.employees].map(employee => employee.id)
const selectedEmployees = [...this.mastertask.employees].map(employee => employee.id)
const employees = this.employees.filter(
(employee) => !selectedEmployees.includes(employee.id)
@@ -19,26 +19,26 @@ export default {
methods: {
onProjectSelected({ key }) {
const project = this.projects.find(project => project.id == key)
this.masterTask.project_code = project.code
this.masterTask.project_id = project.id
this.mastertask.project_code = project.code
this.mastertask.project_id = project.id
},
onMasterTaskSelected({ key }) {
const mastertask = this.mastertasks.find(masterTask => masterTask.id == key)
const mastertask = this.mastertasks.find(mastertask => mastertask.id == key)
this.task.master_task = mastertask
this.task.project_code = mastertask.project_code
},
onEmployeeSelected({ key }) {
const employee = this.employees.find(employee => employee.id == key)
this.masterTask.employees.push(employee)
this.mastertask.employees.push(employee)
this.showAddEmployeeInput = false
},
onEmployeeDurationChanged() {
let totalDuration = 0
this.masterTask.employees = this.masterTask.employees.map(employee => {
this.mastertask.employees = this.mastertask.employees.map(employee => {
if (typeof employee.duration == 'string') {
totalDuration += parseInt(employee.duration)
employee.duration = parseInt(employee.duration)
@@ -50,16 +50,16 @@ export default {
return employee
})
this.masterTask.duration = totalDuration
this.mastertask.duration = totalDuration
}
},
watch: {
'masterTask.team_id'(value, oldValue) {
'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
this.mastertask.team = this.teams.find(team => team.id == value)
this.mastertask.employees = this.mastertask.team.employees
}
}
}