mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 22:39:34 +00:00
[Task modal, subtask modal] BE
This commit is contained in:
1 parent
37331335ce
commit
1024f73ab5
12 files changed
+477
-489
No files matched your search
@@ -0,0 +1,58 @@
|
||||
export default {
|
||||
computed: {
|
||||
employeesOptions() {
|
||||
const selectedEmployees = [...this.masterTask.employees, ...this.masterTask.team?.employees]
|
||||
.map(employee => employee.id)
|
||||
|
||||
const employees = this.employees.filter(
|
||||
(employee) => !selectedEmployees.includes(employee.id)
|
||||
) || []
|
||||
|
||||
return employees.map((employee) => {
|
||||
return {
|
||||
key: employee.id,
|
||||
value: `${employee.name} ${employee.surname}`,
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onProjectSelected({ key }) {
|
||||
const project = this.projects.find(project => project.id == key)
|
||||
this.masterTask.project_code = project.code
|
||||
this.masterTask.project_id = project.id
|
||||
},
|
||||
|
||||
onEmployeeSelected({ key }) {
|
||||
const employee = this.employees.find(employee => employee.id == key)
|
||||
this.masterTask.employees.push(employee)
|
||||
this.showAddEmployeeInput = false
|
||||
},
|
||||
|
||||
onEmployeeDurationChanged() {
|
||||
let totalDuration = 0
|
||||
|
||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
||||
if (typeof employee.duration == 'string') {
|
||||
totalDuration += parseInt(employee.duration)
|
||||
employee.duration = parseInt(employee.duration)
|
||||
}
|
||||
else if (typeof employee.duration == 'number') {
|
||||
totalDuration += employee.duration
|
||||
}
|
||||
|
||||
return employee
|
||||
})
|
||||
|
||||
this.masterTask.duration = totalDuration
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'masterTask.team_id'(value) {
|
||||
if (!value) return
|
||||
this.masterTask.team = this.teams.find(team => team.id == value)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user