mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
.
This commit is contained in:
1 parent
b6e54fec8e
commit
d6cc0a64d9
4 files changed
+15
-15
No files matched your search
@@ -24,10 +24,10 @@ export default {
|
||||
},
|
||||
|
||||
onMasterTaskSelected({ key }) {
|
||||
const masterTask = this.masterTasks.find(masterTask => masterTask.id == key)
|
||||
this.task.master_task.name = masterTask.name
|
||||
this.task.master_task.id = masterTask.id
|
||||
this.task.project_code = masterTask.project_code
|
||||
const mastertask = this.mastertasks.find(masterTask => masterTask.id == key)
|
||||
this.task.master_task.name = mastertask.name
|
||||
this.task.master_task.id = mastertask.id
|
||||
this.task.project_code = mastertask.project_code
|
||||
},
|
||||
|
||||
onEmployeeSelected({ key }) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field v-model="task.project_code" label="Kód projektu" :value="task.project_code" @focus="onInputFocus" class="modal-input" variant="solo" disabled></v-text-field>
|
||||
|
||||
<Z-autocomplete label="Master task" :options="mastertasks.map((masterTask) => ({ key: masterTask.id, value: masterTask.name }))" :validations="v$.task.master_task.id" :clear-on-submit="false" :value="task.master_task.name" :class="{ error: v$.task.master_task.id.$errors.length }" class="modal-input" @option-selected="onMasterTaskSelected" />
|
||||
<Z-autocomplete label="Master task" :options="mastertasks.map((masterTask) => ({ key: masterTask.id, value: masterTask.name }))" :validations="v$.task.master_task.id" :clear-on-submit="false" :value="task?.master_task?.name" :class="{ error: v$.task.master_task.id.$errors.length }" class="modal-input" @option-selected="onMasterTaskSelected" />
|
||||
|
||||
<v-select v-model="task.employee_id" @focus="onInputFocus" class="modal-input border-select" label="Priradený" :class="{ error: v$.task.employee_id.$errors.length }" variant="solo" :items="filteredEmployees" item-value="id" item-title="_fullName"></v-select>
|
||||
|
||||
@@ -99,16 +99,14 @@ export default {
|
||||
computed: {
|
||||
...mapGetters('tm', [
|
||||
'mastertasks',
|
||||
'employees'
|
||||
'enrichedEmployees'
|
||||
]),
|
||||
|
||||
filteredEmployees() {
|
||||
if (!this.employees || !this.task?.master_task) return []
|
||||
if (!this.enrichedEmployees || !this.task?.master_task) return []
|
||||
|
||||
const selectedEmployees = this.task.master_task.employees?.map((employee) => employee.id) || []
|
||||
const filteredEmployees = this.employees.filter((employee) => !selectedEmployees.includes(employee.id))
|
||||
|
||||
return tmUtils.enrichEmployeesByFullName(filteredEmployees)
|
||||
return this.enrichedEmployees.filter((employee) => !selectedEmployees.includes(employee.id))
|
||||
}
|
||||
},
|
||||
|
||||
@@ -143,6 +141,7 @@ export default {
|
||||
async showModal(task, editMode = false, masterTask = {}) {
|
||||
this.task = null
|
||||
this.visible = true
|
||||
this.$nextTick(() => this.v$.$reset())
|
||||
|
||||
try {
|
||||
|
||||
@@ -162,8 +161,6 @@ export default {
|
||||
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
this.masterTaskIdSelect = null
|
||||
this.$nextTick(() => this.v$.$reset())
|
||||
},
|
||||
|
||||
async save() {
|
||||
@@ -176,6 +173,7 @@ export default {
|
||||
await this.$axios.put_auth_data(`v1/subtasks/${this.task.id}`, this.task)
|
||||
} else {
|
||||
const { subtask } = await this.$axios.post_auth(`v1/mastertasks/${this.task.master_task.id}/subtasks`, this.task)
|
||||
console.log(subtask)
|
||||
this.task.id = subtask.id
|
||||
}
|
||||
|
||||
@@ -220,7 +218,7 @@ export default {
|
||||
|
||||
_enrichTask(task) {
|
||||
task.master_task = this.mastertasks.find((masterTask) => masterTask.id == task.master_task_id)
|
||||
task.employee = this.employees.find((employee) => employee.id == task.employee_id)
|
||||
task.employee = this.enrichedEmployees.find((employee) => employee.id == task.employee_id)
|
||||
this.masterTaskIdSelect = task.master_task.id
|
||||
|
||||
return task
|
||||
@@ -237,7 +235,8 @@ export default {
|
||||
|
||||
"task.employee_id"(value) {
|
||||
if (!value) return
|
||||
this.task.employee = this.employees.find((employee) => employee.id == value)
|
||||
|
||||
this.task.employee = this.enrichedEmployees.find((employee) => employee.id == value)
|
||||
},
|
||||
|
||||
editMode() {
|
||||
|
||||
Reference in new issue
Block a user