mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Timeblocks] Added option to close timeblock
This commit is contained in:
1 parent
892777791f
commit
2aec357f76
7 files changed
+57
-7
No files matched your search
@@ -22,7 +22,7 @@
|
||||
|
||||
<template v-if="subtask.timesheets.length">
|
||||
<div v-for="timesheet in subtask.timesheets" :key="timesheet.id" class="d-flex align-center mb-3">
|
||||
<v-icon @click.stop="deleteTimesheet(timesheet)" class="remove-date cursor-pointer mr-2" icon="mdi-minus" size="medium" />
|
||||
<v-icon @click.stop="deleteTimesheet(timesheet)" class="circle-border cursor-pointer mr-2" icon="mdi-minus" size="medium" />
|
||||
|
||||
<div class="d-flex align-center flex-start width-100">
|
||||
<p class="task-badge rounded-pill">{{ timesheet.time }}</p>
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
</div>
|
||||
|
||||
<div v-for="timeblock in timeblocks" :key="timeblock.id" class="d-flex align-center mb-3">
|
||||
<v-icon @click.stop="deleteTimeblock(timeblock)" class="remove-date cursor-pointer mr-2" icon="mdi-minus" size="medium" />
|
||||
<p class="task-badge rounded-pill">{{ tmUtils.formatDateTime(timeblock.start) }} - {{ tmUtils.formatDateTime(timeblock.end) }}</p>
|
||||
<v-icon @click.stop="deleteTimeblock(timeblock)" class="circle-border cursor-pointer mr-2" icon="mdi-minus" size="medium" />
|
||||
<p class="task-badge rounded-pill" :class="{'strike-through': timeblock.is_finished}">{{ tmUtils.formatDateTime(timeblock.start) }} - {{ tmUtils.formatDateTime(timeblock.end) }}</p>
|
||||
<v-icon @click.stop="toggleTimeblockIsFinished(timeblock)" class="circle-border cursor-pointer ml-2" :class="{'completed': timeblock.is_finished}" icon="mdi-check" size="medium" />
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
@@ -113,6 +114,26 @@ export default {
|
||||
this._update(subtask)
|
||||
},
|
||||
|
||||
async toggleTimeblockIsFinished(originalTimeblock) {
|
||||
// TODO: Pridat odpracovany cas modal?
|
||||
const subtask = JSON.parse(JSON.stringify(this.subtask))
|
||||
const timeblock = JSON.parse(JSON.stringify(originalTimeblock))
|
||||
|
||||
console.log(subtask)
|
||||
console.log(timeblock)
|
||||
if (!timeblock.is_finished)
|
||||
this.$events.emit('show-task-add-time-modal', { subtask })
|
||||
|
||||
timeblock.is_finished = !timeblock.is_finished
|
||||
|
||||
try {
|
||||
await this.$axios.put_auth(`v1/timeblocks/${timeblock.id}`, timeblock)
|
||||
// TODO: Co mi to vrati? A updatenut
|
||||
} catch (error) {
|
||||
this.$toast.error(error.message || error)
|
||||
}
|
||||
},
|
||||
|
||||
async deleteTimeblock({ id }) {
|
||||
const subtask = JSON.parse(JSON.stringify(this.subtask))
|
||||
subtask.timeblocks = subtask.timeblocks.filter(timeblock => timeblock.id != id)
|
||||
@@ -143,4 +164,9 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.completed
|
||||
background: #06dece
|
||||
</style>
|
||||
Reference in new issue
Block a user