mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[bugy & CR]
This commit is contained in:
1 parent
4f7847bc1b
commit
88792943e6
20 files changed
+201
-107
No files matched your search
@@ -4,11 +4,11 @@
|
||||
<W-loadable :content="files" emptyMessage="Žiadne prílohy neboli nahraté">
|
||||
<div v-for="(file, index) in files" :key="file.id" class="d-flex align-center flex-wrap" :class="[index === 0 ? 'ml-0' : 'ml-2']">
|
||||
<v-chip class="mt-2">
|
||||
<p @click="handleDownload(index)" class="cursor-pointer">{{ file.name }}</p>
|
||||
<p @click="downloadFile(file)" class="cursor-pointer">{{ file.name }}</p>
|
||||
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
|
||||
<p>{{ (file.file_size / (1024 * 1024)).toFixed(2) }} MB</p>
|
||||
</v-chip>
|
||||
<div v-if="showDownload" class="d-flex align-center">
|
||||
<div v-if="file.isLoading" class="d-flex align-center">
|
||||
<img class="gif-loader" :src="require('@/plugins/app/_img/spinner.gif')" alt="Loading...">
|
||||
<p class="ml-2">Súbor sa sťahuje, počkajte prosím</p>
|
||||
</div>
|
||||
@@ -18,28 +18,36 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as FileSaver from "file-saver"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
files: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
|
||||
downloadFile: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
|
||||
showDownload: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleDownload(index) {
|
||||
this.downloadFile(index)
|
||||
data() {
|
||||
return {
|
||||
isLoading: false
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async downloadFile(file) {
|
||||
file.isLoading = true // Show loader
|
||||
|
||||
try {
|
||||
const response = await fetch(file.path)
|
||||
const blob = await response.blob()
|
||||
FileSaver.saveAs(blob, file.name)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
} finally {
|
||||
file.isLoading = false
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||
</p>
|
||||
<p class="ml-2" v-html="`${employee.name} ${employee.surname}`" />
|
||||
<!-- <v-tooltip text="Vymazať priradeného zamestnanca" location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon v-bind="props" class="ml-2 cursor-pointer" icon="mdi-close" />
|
||||
</template>
|
||||
</v-tooltip> -->
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -32,6 +27,19 @@ export default {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// methods: {
|
||||
// async deleteEmployee() {
|
||||
// try {
|
||||
// const tempSubtask = {...this.subtask, employee_id: null, deadline: moment(this.subtask.deadline).format('YYYY-MM-DD HH:mm:ss') }
|
||||
// const { subtask } = await this.$axios.put_auth(`v1/subtasks/${tempSubtask.id}`, tempSubtask)
|
||||
// // employee_id
|
||||
// this.$emit('on-subtask-edited', subtask)
|
||||
// } catch (error) {
|
||||
// this.$toast.error(error)
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col cols="5">
|
||||
<v-sheet class="py-3">
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-calendar-week" size="large"></v-icon>
|
||||
<p class="mx-3">Deadline</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="py-3">
|
||||
<p v-if="deadline" :class="`${tmUtils.isAfter(deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDate(deadline) }}</p>
|
||||
<p v-else>Tento task nema určený deadline</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
deadline: {
|
||||
type: [String, Object, null],
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
tmUtils
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -181,7 +181,6 @@ export default {
|
||||
this.closeModal()
|
||||
this.$events.emit('on-subtask-edited', subtask)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
this.$toast.error(error.message || error)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<A-mastertask-name :name="subtask._master_task.name" :id="subtask.master_task_id" :color="subtask._master_task.color" @close-modal="$emit('close-modal')" />
|
||||
<A-mastertask-status :status="subtask.is_finished" />
|
||||
<A-mastertask-status :isFinished="subtask.is_finished" />
|
||||
<A-task-deadline :deadline="subtask.deadline" />
|
||||
<A-task-timeblocks :timeblocks="subtask.timeblocks" :subtask="subtask" @update-subtask="$emit('update-subtask', $event)" />
|
||||
<Z-created-by :employee-id="subtask.created_by" />
|
||||
<A-task-assigned-employee :employee="subtask._employee" />
|
||||
@@ -8,12 +9,10 @@
|
||||
<A-task-remaining-time :hours="subtask.duration - subtask.spent_time" />
|
||||
<A-task-spent-time :hours="subtask.spent_time" :subtask="subtask" />
|
||||
<A-task-description :description="subtask.description" :mastertask-description="subtask.master_task_description" />
|
||||
<Z-files :files="subtask.files" :download-file="downloadFile" :showDownload="showDownload" />
|
||||
<Z-files :files="subtask.files" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as FileSaver from "file-saver"
|
||||
|
||||
import AMastertaskName from './_components/a-mastertask-name.vue'
|
||||
import AMastertaskStatus from './_components/a-mastertask-status.vue'
|
||||
import ATaskTimeblocks from './_components/a-task-timeblocks.vue'
|
||||
@@ -22,6 +21,7 @@ import ATaskAssignedEmployee from './_components/a-task-assigned-employee.vue
|
||||
import ATaskPlannedTime from './_components/a-task-planned-time.vue'
|
||||
import ATaskSpentTime from './_components/a-task-spent-time.vue'
|
||||
import ATaskRemainingTime from './_components/a-task-remaining-time.vue'
|
||||
import ATaskDeadline from './_components/a-task-deadline.vue'
|
||||
import ATaskDescription from './_components/a-task-description.vue'
|
||||
import ZFiles from '@/plugins/tm@modal/_components/read-only/z-files.vue'
|
||||
|
||||
@@ -38,7 +38,8 @@ export default {
|
||||
ATaskPlannedTime,
|
||||
ATaskSpentTime,
|
||||
ATaskRemainingTime,
|
||||
ATaskDescription
|
||||
ATaskDescription,
|
||||
ATaskDeadline
|
||||
},
|
||||
|
||||
props: {
|
||||
@@ -46,30 +47,6 @@ export default {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
showDownload: false
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async downloadFile(id) {
|
||||
this.showDownload = true // Show loader
|
||||
|
||||
// Iterate over each file in the task
|
||||
const file = this.subtask.files[id]
|
||||
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>
|
||||
@@ -268,7 +268,6 @@ export default {
|
||||
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
this.$toast.error(error)
|
||||
} finally {
|
||||
this.isSaving = true
|
||||
|
||||
Reference in new issue
Block a user