Merge branch 'feature/clear-team' of bitbucket.org:studiotem/jandl-taskmanager-app

This commit is contained in:
Matej Glasnák committed 2024-10-18 11:40:56 +02:00
commit 36f992c063
1 file changed
+11
@@ -432,6 +432,17 @@ export default {
} }
}, },
deep: true deep: true
},
'mastertask.team_id': {
handler(value, oldValue) {
if (this.editMode && (!value && oldValue)) {
// Removes only employees from the old team when team_id is removed
const oldTeamEmployeesIds = this.teams.find(team => team.id == oldValue)?.employees.map(employee => employee?.id) || []
const employeesNotInOldTeam = this.mastertask.employees.filter(employee => !oldTeamEmployeesIds.includes(employee?.id))
this.mastertask.employees = employeesNotInOldTeam
}
},
deep: true
} }
} }
} }