mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
[Task modal] Fixed worked time
This commit is contained in:
1 parent
6b3402235c
commit
e77e5b1ab7
6 files changed
+45
-16
No files matched your search
@@ -166,7 +166,11 @@ export default {
|
|||||||
is_finished: 0,
|
is_finished: 0,
|
||||||
start: tmUtils.formatDateTimeForBackend(start),
|
start: tmUtils.formatDateTimeForBackend(start),
|
||||||
end: tmUtils.formatDateTimeForBackend(end)
|
end: tmUtils.formatDateTimeForBackend(end)
|
||||||
}]
|
}],
|
||||||
|
timesheets: event.subtask.timesheets.map((timesheet) => {
|
||||||
|
delete timesheet.employee_name
|
||||||
|
return timesheet
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ export default {
|
|||||||
|
|
||||||
async _update(data) {
|
async _update(data) {
|
||||||
try {
|
try {
|
||||||
|
data.timesheets = data.timesheets.map((timesheet) => {
|
||||||
|
delete timesheet.employee_name
|
||||||
|
return timesheet
|
||||||
|
})
|
||||||
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${data.id}`, data)
|
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${data.id}`, data)
|
||||||
|
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
|
|||||||
@@ -166,7 +166,11 @@ export default {
|
|||||||
|
|
||||||
async _update(data) {
|
async _update(data) {
|
||||||
try {
|
try {
|
||||||
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${data.id}`, data)
|
const timesheets = data.timesheets.map((timesheet) => {
|
||||||
|
delete timesheet.employee_name
|
||||||
|
return timesheet
|
||||||
|
})
|
||||||
|
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${data.id}`, {...data, timesheets})
|
||||||
|
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
this.$events.emit('on-subtask-edited', subtask)
|
this.$events.emit('on-subtask-edited', subtask)
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ export default {
|
|||||||
|
|
||||||
async complete() {
|
async complete() {
|
||||||
try {
|
try {
|
||||||
const tempSubtask = {...this.subtask, is_finished: this.subtask.is_finished ? 0 : 1}
|
const tempSubtask = {...this.subtask, is_finished: this.subtask.is_finished ? 0 : 1, timesheets: this.subtask.timesheets.map((timesheet) => {
|
||||||
|
delete timesheet.employee_name
|
||||||
|
return timesheet
|
||||||
|
})}
|
||||||
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${tempSubtask.id}`, tempSubtask)
|
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${tempSubtask.id}`, tempSubtask)
|
||||||
|
|
||||||
this.visible = false
|
this.visible = false
|
||||||
|
|||||||
@@ -60,8 +60,16 @@ export default {
|
|||||||
time: typeof this.form.hours == 'string' ? parseFloat(this.form.hours) : this.form.hours
|
time: typeof this.form.hours == 'string' ? parseFloat(this.form.hours) : this.form.hours
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
...this.subtask,
|
||||||
|
timesheets: this.subtask.timesheets.map((timesheet) => {
|
||||||
|
delete timesheet.employee_name
|
||||||
|
return timesheet
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`, this.subtask)
|
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`, payload)
|
||||||
|
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
this.$events.emit('on-subtask-edited', subtask)
|
this.$events.emit('on-subtask-edited', subtask)
|
||||||
|
|||||||
@@ -195,15 +195,16 @@ export default {
|
|||||||
try {
|
try {
|
||||||
if (subtask?.id) {
|
if (subtask?.id) {
|
||||||
const data = await this.$axios.get_auth_data(`v1/subtasks/${subtask.id}`)
|
const data = await this.$axios.get_auth_data(`v1/subtasks/${subtask.id}`)
|
||||||
|
|
||||||
|
const splittedDeadline = data.deadline.split(' ')
|
||||||
|
data.deadline = moment(splittedDeadline[0])
|
||||||
|
data._deadline_time = splittedDeadline[1]
|
||||||
|
|
||||||
this.subtask = this._enrichTask(data)
|
this.subtask = this._enrichTask(data)
|
||||||
} else {
|
} else {
|
||||||
this.subtask = { master_task: mastertask, employees: [{}], _deadline_time: '17:00' }
|
this.subtask = { master_task: mastertask, employees: [{}], _deadline_time: '17:00' }
|
||||||
|
|
||||||
// if (subtask.deadline && subtask._deadline_time) {
|
|
||||||
// this.subtask.deadline = subtask.deadline
|
|
||||||
// this.subtask._deadline_time = subtask._deadline_time
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editMode = editMode || !this.subtask.id
|
this.editMode = editMode || !this.subtask.id
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
@@ -229,15 +230,19 @@ export default {
|
|||||||
this._mergeDeadlineTimeDate()
|
this._mergeDeadlineTimeDate()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.subtask.deadline = moment(this.subtask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
this.subtask.deadline = moment(this.subtask.deadline).format('YYYY-MM-DD HH:mm:SS')
|
||||||
|
const timesheets = this.subtask.timesheets.map((timesheet) => {
|
||||||
|
delete timesheet.employee_name
|
||||||
|
return timesheet
|
||||||
|
})
|
||||||
|
|
||||||
if (this.subtask?.id) {
|
if (this.subtask?.id) {
|
||||||
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`, this.subtask)
|
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`, {...this.subtask, timesheets})
|
||||||
|
|
||||||
this.$store.commit('tm/update_subtask', subtask)
|
this.$store.commit('tm/update_subtask', subtask)
|
||||||
this.$events.emit("on-subtask-edited", this.subtask)
|
this.$events.emit("on-subtask-edited", this.subtask)
|
||||||
} else {
|
} else {
|
||||||
const { subtasks } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, this.subtask)
|
const { subtasks } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, {...this.subtask, timesheets})
|
||||||
this.subtask.id = subtasks[0].id
|
this.subtask.id = subtasks[0].id
|
||||||
|
|
||||||
subtasks.forEach(subtask => {
|
subtasks.forEach(subtask => {
|
||||||
@@ -280,10 +285,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_mergeDeadlineTimeDate() {
|
_mergeDeadlineTimeDate() {
|
||||||
const date = new Date(this.subtask.deadline);
|
const date = new Date(this.subtask.deadline)
|
||||||
const timeParts = this.subtask._deadline_time.split(':');
|
const timeParts = this.subtask._deadline_time.split(':')
|
||||||
date.setHours(parseInt(timeParts[0]));
|
|
||||||
date.setMinutes(parseInt(timeParts[1]));
|
date.setHours(parseInt(timeParts[0]))
|
||||||
|
date.setMinutes(parseInt(timeParts[1]))
|
||||||
|
|
||||||
this.subtask.deadline = date
|
this.subtask.deadline = date
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user