diff --git a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue index b44d7c9..a704351 100644 --- a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue +++ b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue @@ -432,6 +432,17 @@ export default { } }, 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 } } }