[sub-task-modal]

This commit is contained in:
romankko2 committed 2022-12-19 21:42:52 +01:00
1 parent 9d70fe378d
commit fd5be39455
1 file changed
+23 -14
@@ -21,15 +21,15 @@
></v-text-field>
<v-select
v-model="selectedTeam"
v-model="selectedMasterTask"
@focus="onInputFocus"
class="modal-input border-select"
label="MasterTask"
variant="solo"
:items="teamsOptions"
:items="masterTaskOptions"
></v-select>
<p v-if="subTask.team.employees" class="d-flex justify-start align-center w-100 mb-3">Priradení zamestnanci</p>
<p v-if="subTask.team.employees" class="d-flex justify-start align-center w-100 mb-3 text-grey">Priradení zamestnanci</p>
<v-text-field
v-for="(employee, index) in subTask.employees"
@@ -81,14 +81,25 @@
variant="solo"
type="number"
label="Časový odhad"
:class="{ error: v$.subTask.duration.$errors.length }"
:hint="
v$.subTask.duration.$errors
? errorUtils.parseErrors(v$.subTask.duration.$errors)
: null
"
append-inner-icon="mdi-clock-outline"
></v-text-field>
<v-textarea
:class="{ error: v$.subTask.description.$errors.length }"
label="Popis"
class="modal-input"
variant="solo"
:class="{ error: v$.subTask.description.$errors.length }"
:hint="
v$.subTask.description.$errors
? errorUtils.parseErrors(v$.subTask.description.$errors)
: null
"
v-model="subTask.description"
></v-textarea>
@@ -134,20 +145,18 @@ export default {
return {
subTask: {
project_code: null,
duration: null,
date: null,
team: {},
description: null,
employees: [],
duration: null,
description: null,
files: []
},
errorUtils,
v$: useVuelidate(),
preventInputFocus: false,
teams: null,
employees: null,
selectedTeam: '',
selectedMasterTaskCode: '',
selectedMasterTask: '',
showAddEmployeeInput: false,
masterTasks: null
}
@@ -157,9 +166,9 @@ export default {
return {
subTask: {
project_code: { required },
duration: { required },
date: { required },
team: { required },
duration: { required },
description: { required },
employees: { atLeastOne }
},
@@ -234,7 +243,7 @@ export default {
},
computed: {
teamsOptions() {
masterTaskOptions() {
return this.masterTasks.map(masterTask => `${masterTask.name} - ${masterTask.id}`)
},
@@ -266,10 +275,10 @@ export default {
},
watch: {
selectedTeam() {
this.subTask.team = this.masterTasks.find(masterTask => `${masterTask.name} - ${masterTask.id}` == this.selectedTeam)
selectedMasterTask() {
this.subTask.team = this.masterTasks.find(masterTask => `${masterTask.name} - ${masterTask.id}` == this.selectedMasterTask)
this.subTask.employees = this.subTask.team.employees
this.subTask.project_code = this.masterTasks.filter(x => `${x.name} - ${x.id}` == this.selectedTeam)[0].project_code
this.subTask.project_code = this.masterTasks.filter(x => `${x.name} - ${x.id}` == this.selectedMasterTask)[0].project_code
}
}
}