[Mastertask modal] Team selects WIP

This commit is contained in:
Matej Glasnák committed 2023-06-12 12:33:45 +02:00
1 parent 3b09f8b51a
commit be1deb9296
3 files changed
+18 -23

No files matched your search

@@ -25,16 +25,6 @@
<v-select v-model="mastertask.team_id" @focus="onInputFocus" class="modal-input border-select" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
<template v-if="mastertask.team && mastertask.team_id">
<v-text-field v-for="(employee, index) in mastertask.team.employees" :key="employee.id" @focus="onInputFocus" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.team.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
<p class="employee-select-avatar d-flex justify-center align-center">
{{ employee?.name.charAt(0) + employee?.surname.charAt(0) }}
</p>
<v-icon @click.stop="removeEmployeeFromTeam(employee)" class="remove-input" icon="mdi-close" size="small"></v-icon>
</v-text-field>
</template>
<template v-if="mastertask.employees">
<v-text-field v-for="(employee, index) in mastertask.employees" :key="employee.id" @focus="onInputFocus" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
<p class="employee-select-avatar d-flex justify-center align-center">
@@ -218,14 +208,14 @@ export default {
},
methods: {
removeEmployeeFromTeam({ id }) {
const employees = this.mastertask.team.employees.filter(employee => employee.id != id)
this.mastertask.employees = [...employees, ...this.mastertask.employees]
this.mastertask.team_id = null
this.mastertask.team = null
},
removeEmployee({ id }) {
const isEmployeeInTeam = this.mastertask.team.employees.find(employee => employee.id == id)
if (isEmployeeInTeam) {
this.mastertask.team_id = null
this.mastertask.team = null
}
this.mastertask.employees = this.mastertask.employees.filter(employee => employee.id != id)
},