mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[mastertask] edit fix
This commit is contained in:
1 parent
ea53a36612
commit
f3985b741b
3 files changed
+15
-5
No files matched your search
@@ -257,7 +257,7 @@ export default {
|
|||||||
|
|
||||||
onCellClick(DOMEvent, split) {
|
onCellClick(DOMEvent, split) {
|
||||||
if (DOMEvent.offsetY > 950 && DOMEvent.offsetY < 1700) {
|
if (DOMEvent.offsetY > 950 && DOMEvent.offsetY < 1700) {
|
||||||
const dateFrom = split.date
|
const dateFrom = split.date
|
||||||
dateFrom.setHours(Math.floor(DOMEvent.offsetY / 100), 0, 0, 0)
|
dateFrom.setHours(Math.floor(DOMEvent.offsetY / 100), 0, 0, 0)
|
||||||
const dateTo = new Date(dateFrom)
|
const dateTo = new Date(dateFrom)
|
||||||
dateTo.setHours(dateFrom.getHours() + 1)
|
dateTo.setHours(dateFrom.getHours() + 1)
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export default {
|
|||||||
id: index + 1,
|
id: index + 1,
|
||||||
name: employee.name,
|
name: employee.name,
|
||||||
employee_id: employee.id,
|
employee_id: employee.id,
|
||||||
|
// date: this.filter.start,
|
||||||
fullname: `${employee.name} ${employee.surname}`,
|
fullname: `${employee.name} ${employee.surname}`,
|
||||||
initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(),
|
initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(),
|
||||||
unscheduledTime: unscheduledTime > 0 ? (unscheduledTime / 60).toFixed(1) : 0,
|
unscheduledTime: unscheduledTime > 0 ? (unscheduledTime / 60).toFixed(1) : 0,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<v-text-field v-model="mastertask.duration" @focus="onInputFocus" class="modal-input" variant="solo" type="number" :label="`${mastertask.duration} h`" :disabled="true"></v-text-field>
|
<v-text-field v-model="mastertask.duration" @focus="onInputFocus" class="modal-input" variant="solo" type="number" :label="`${mastertask.duration} h`" :disabled="true"></v-text-field>
|
||||||
|
|
||||||
<v-select v-model="mastertask.team_id" @focus="onInputFocus" class="modal-input border-select" :class="{error: v$.mastertask.employees.$errors.length}" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
|
<v-select v-model="mastertask.team_id" @focus="onInputFocus" class="modal-input border-select" :class="{error: v$.mastertask.employees.$errors.length}" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name" :disabled="mastertask.id"></v-select>
|
||||||
|
|
||||||
<template v-if="!mastertask.id">
|
<template v-if="!mastertask.id">
|
||||||
<v-text-field v-for="(employee, index) in mastertask.employees" :key="employee.id" @focus="onInputFocus" class="modal-input" :class="{error: employee.invalid}" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
<v-text-field v-for="(employee, index) in mastertask.employees" :key="employee.id" @focus="onInputFocus" class="modal-input" :class="{error: employee.invalid}" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
||||||
@@ -297,8 +297,19 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
|
this.isSaving = true
|
||||||
|
|
||||||
|
if (this.mastertask.id) {
|
||||||
|
this.mastertask.employees = this.mastertask.employees.map(employee => {
|
||||||
|
const { duration } = this.mastertask.subtasks.find(({ employee_id }) => employee_id == employee.id)
|
||||||
|
employee.duration = duration
|
||||||
|
return employee
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const vuelidateValid = await this.v$.$validate()
|
const vuelidateValid = await this.v$.$validate()
|
||||||
const employeesValid = await this._validateEmployees()
|
const employeesValid = await this._validateEmployees()
|
||||||
|
|
||||||
if (!vuelidateValid || !employeesValid) return
|
if (!vuelidateValid || !employeesValid) return
|
||||||
|
|
||||||
if (this.$refs['description'])
|
if (this.$refs['description'])
|
||||||
@@ -307,9 +318,7 @@ export default {
|
|||||||
this._mergeDeadlineTimeDate()
|
this._mergeDeadlineTimeDate()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.isSaving = true
|
|
||||||
this.mastertask.deadline = moment(this.mastertask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
this.mastertask.deadline = moment(this.mastertask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
||||||
|
|
||||||
if (this.mastertask.id) await this.$axios.put_auth_data(`v1/mastertasks/${this.mastertask.id}`, this.mastertask)
|
if (this.mastertask.id) await this.$axios.put_auth_data(`v1/mastertasks/${this.mastertask.id}`, this.mastertask)
|
||||||
else await this.$axios.post_auth_data('v1/mastertasks', this.mastertask)
|
else await this.$axios.post_auth_data('v1/mastertasks', this.mastertask)
|
||||||
|
|
||||||
@@ -318,7 +327,7 @@ export default {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
this.isSaving = true
|
this.isSaving = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user