[bugy & CR]

This commit is contained in:
romankko2 committed 2023-08-17 17:43:23 +02:00
1 parent 4f7847bc1b
commit 88792943e6
20 files changed
+201 -107

No files matched your search

@@ -7,12 +7,10 @@
<Z-remaining-time :hours="mastertask.duration - mastertask.time_worked" />
<Z-spent-time :hours="mastertask.time_worked" :is-exceeded="mastertask.time_worked > mastertask.duration" />
<Z-description :description="mastertask.description" />
<Z-files :files="mastertask.files" :download-file="downloadFile" :showDownload="showDownload" />
<Z-files :files="mastertask.files" />
</template>
<script>
import * as FileSaver from "file-saver"
import ZCreatedBy from '../../_components/read-only/z-created-by.vue'
import ZDeadline from '../../_components/read-only/z-deadline.vue'
import ZDescription from '../../_components/read-only/z-description.vue'
@@ -41,31 +39,6 @@ export default {
type: Object,
required: true
}
},
data() {
return {
showDownload: false
}
},
methods: {
async downloadFile(id) {
this.showDownload = true // Show loader
const file = this.mastertask.files[id]
// Iterate over each file in the task
const fileName = file.name
fetch(file.path)
.then(response => response.blob())
.then(blob => {
FileSaver.saveAs(blob, fileName)
this.showDownload = false
})
.catch(error => this.$toast.error(error))
},
}
}
</script>
@@ -70,7 +70,7 @@
<A-mastertask-description :mastertask="mastertask" />
<div class="d-flex justify-start align-center mt-8">
<v-btn class="button primary" @click="toggleIsFinished()">{{ mastertask.is_finished === 1 ? 'Otvoriť mastertask' : 'Ukončiť mastertask' }}</v-btn>
<v-btn class="button primary" @click="toggleIsFinished()">{{ mastertask.is_finished ? 'Otvoriť mastertask' : 'Ukončiť mastertask' }}</v-btn>
</div>
<A-tasks-table :subtasks="mastertask.subtasks" />
@@ -264,9 +264,17 @@ export default {
}
},
toggleIsFinished() {
this.mastertask.is_finished = this.mastertask.is_finished === 0 ? 1 : 0
async toggleIsFinished() {
this.mastertask.is_finished = this.mastertask.is_finished == 0 ? 1 : 0
this.save()
// try {
// const toggleMastertask = { ...this.mastertask, is_finished: this.mastertask.is_finished ? 0 : 1, duration: this.mastertask.duration }
// const { mastertask } = await this.$axios.put_auth(`v1/mastertasks/${toggleMastertask.id}`, toggleMastertask)
// this.$emit('on-mastertask-edited', mastertask)
// } catch (error) {
// this.$toast.error(error)
// }
},
async save() {