[CR] vodiace linky, [app] bugs

This commit is contained in:
romankko2 committed 2023-11-30 17:27:00 +01:00
1 parent f40065ffd1
commit 0a4c2ef44a
8 files changed
+76 -80

No files matched your search

+5 -10
View File
@@ -179,9 +179,7 @@ $splits-headers-height: 1.5em;
color: #999; color: #999;
text-align: right; text-align: right;
font-size: 0.9em; font-size: 0.9em;
// background: white; background: white;
// remove -v
padding-right: 2px;
} }
.vuecal__time-cell-line:before { .vuecal__time-cell-line:before {
@@ -189,15 +187,12 @@ $splits-headers-height: 1.5em;
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
// remove -v border-top: 1px solid #F5F5F5;
border-top: 1px solid rgba(196, 196, 196, 0.3);
// border-top: 1px solid #F5F5F5;
z-index: -1; z-index: -1;
} }
//add -v .vuecal__time-cell-line.hour:before {
// .vuecal__time-cell-line.hour:before { border-top: 1px solid #e0e0e0;
// border-top: 1px solid #e0e0e0; }
// }
} }
// Calendar cells. // Calendar cells.
@@ -72,7 +72,7 @@ export default {
remove(index) { remove(index) {
this.uploadedFiles.splice(index, 1) this.uploadedFiles.splice(index, 1)
}, }
}, },
} }
</script> </script>
@@ -51,11 +51,7 @@
</template> </template>
<template v-slot:time-cell="{ hours, minutes }"> <template v-slot:time-cell="{ hours, minutes }">
<span class="d-flex align-center justify-center"> <span class="d-flex justify-center">
<p>{{hours}}:{{String(minutes).padStart(2, '0')}}</p>
<div class="time-column-line"></div>
</span>
<!-- <span class="d-flex justify-center">
<span class="d-flex justify-center"> <span class="d-flex justify-center">
<p style="margin-top: -9px">{{hours}}:{{String(minutes).padStart(2, '0')}}</p> <p style="margin-top: -9px">{{hours}}:{{String(minutes).padStart(2, '0')}}</p>
<div class="time-column-line"></div> <div class="time-column-line"></div>
@@ -65,7 +61,7 @@
<span class="vuecal__time-cell-line" style="margin-top: 25px"></span> <span class="vuecal__time-cell-line" style="margin-top: 25px"></span>
<span class="vuecal__time-cell-line" style="margin-top: 50px"></span> <span class="vuecal__time-cell-line" style="margin-top: 50px"></span>
<span class="vuecal__time-cell-line" style="margin-top: 75px"></span> <span class="vuecal__time-cell-line" style="margin-top: 75px"></span>
</span> --> </span>
</template> </template>
<template v-slot:event="{ event }"> <template v-slot:event="{ event }">
@@ -121,24 +117,6 @@
</div> </div>
</template> </template>
</Vue-cal> </Vue-cal>
<!-- <v-dialog v-model="visible" max-width="750" persistent>
<v-card>
<div class="d-flex justify-space-between align-center">
<h1 class="text-red">Ste si istý, že chcete pridať timeblock po deadline ?</h1>
<v-icon
@click.stop="visible = false"
icon="mdi-close"
size="large"
class="mb-15"
></v-icon>
</div>
<v-card-actions class="mt-10 d-flex justify-start align-center mobile-view">
<v-btn class="button primary half" variant="flat">ÁNO</v-btn>
<v-btn class="button primary half outline" @click.stop="visible = false">ZRUŠIŤ</v-btn>
</v-card-actions>
</v-card>
</v-dialog> -->
</div> </div>
</template> </template>
@@ -196,19 +174,32 @@ export default {
}, },
methods: { methods: {
getDeadline(subtask) {
if(subtask.deadline) return moment(subtask.deadline).format('DD.MM.yyyy')
else if(!this.mastertasks) return ''
const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id)
return moment(masterTask).format('DD.MM.yyyy') ? moment(masterTask.deadline).format('DD.MM.yyyy') : ''
},
isAfterDeadline(event) { isAfterDeadline(event) {
const deadline = this.getDeadline(event.subtask) const deadline = this.getDeadline(event.subtask)
if (deadline) {
return this.tmUtils.isAfter(event.date, moment(deadline, 'DD.MM.yyyy')) if (!deadline)
} return
return false
const mDate = moment(event.date)
const mDeadline = moment(deadline)
const hours = event.end.getHours()
const minutes = event.end.getMinutes()
mDate.hours(hours)
mDate.minutes(minutes)
return mDate.isAfter(mDeadline)
},
getDeadline(subtask) {
if (subtask?.deadline)
return subtask.deadline
if (!this.mastertasks)
return null
const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id)
return masterTask.deadline
}, },
weekChanged() { weekChanged() {
@@ -220,7 +211,6 @@ export default {
const date = addDays(this.calConfig.date, newSplit - 1) const date = addDays(this.calConfig.date, newSplit - 1)
const start = date.setHours(Math.round(event.startTimeMinutes / 60), Math.round(event.startTimeMinutes % 60), 0) const start = date.setHours(Math.round(event.startTimeMinutes / 60), Math.round(event.startTimeMinutes % 60), 0)
const end = date.setHours(Math.round(event.endTimeMinutes / 60), Math.round(event.endTimeMinutes % 60), 0) const end = date.setHours(Math.round(event.endTimeMinutes / 60), Math.round(event.endTimeMinutes % 60), 0)
const split = this.splits.find(split => split.id == newSplit ) const split = this.splits.find(split => split.id == newSplit )
if(this.$route.name == 'Dashboard - Tasks') { if(this.$route.name == 'Dashboard - Tasks') {
@@ -251,20 +241,6 @@ export default {
const isAfterDeadline = this.isAfterDeadline(event) const isAfterDeadline = this.isAfterDeadline(event)
if(isAfterDeadline) this.$toast.error('Timeblock, ktorý ste presunuli je po deadline !') if(isAfterDeadline) this.$toast.error('Timeblock, ktorý ste presunuli je po deadline !')
// if (isAfterDeadline) {
// this.visible = true
// } else {
// try {
// const { subtask } = await this.$axios.put_auth(`v1/subtasks/${editedSubtask.id}`, editedSubtask)
// this.$events.emit('on-subtask-edited', subtask)
// if (subtask.employee_id == this.$store.getters['auth/user'].id)
// this.$events.emit('show-task-add-time-modal', { subtask })
// } catch (error) {
// this.$toast.error(error.message || error)
// }
// }
} else if(this.$route.name == 'Dashboard - Teams') { } else if(this.$route.name == 'Dashboard - Teams') {
const editedSubtask = { const editedSubtask = {
...event.subtask, ...event.subtask,
@@ -47,15 +47,7 @@ export default {
} finally { } finally {
file.isLoading = false file.isLoading = false
} }
}, }
// async downloadAllFiles() {
// for (const file of this.files) {
// if (!file.isLoading) {
// await this.downloadFile(file)
// }
// }
// }
} }
} }
</script> </script>
@@ -10,7 +10,7 @@
</v-col> </v-col>
<v-col cols="7"> <v-col cols="7">
<v-sheet class="py-3"> <v-sheet class="py-3">
<p v-if="subtask.deadline" :class="`${tmUtils.isAfter(subtask.deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDate(subtask.deadline) }}</p> <p v-if="subtask.deadline" :class="`${tmUtils.isAfter(subtask.deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDate(subtask.deadline) }} {{ deadlineTime }}</p>
<v-tooltip v-else text="Deadline z Mastertasku" location="end"> <v-tooltip v-else text="Deadline z Mastertasku" location="end">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<span class="cursor-pointer" v-bind="props">{{ getMasterTaskDeadline(subtask) }}*</span> <span class="cursor-pointer" v-bind="props">{{ getMasterTaskDeadline(subtask) }}*</span>
@@ -35,7 +35,14 @@ export default {
}, },
computed: { computed: {
...mapGetters('tm', ['mastertasks']) ...mapGetters('tm', ['mastertasks']),
deadlineTime() {
const time = this.subtask?._deadline_time
if (time)
return moment(time, 'HH:mm:ss').format('HH:mm')
return ''
}
}, },
data() { data() {
@@ -48,7 +55,7 @@ export default {
getMasterTaskDeadline(subtask) { getMasterTaskDeadline(subtask) {
if(!this.mastertasks) return '' if(!this.mastertasks) return ''
const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id) const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id)
return moment(masterTask).format('DD.MM.yyyy') ? moment(masterTask.deadline).format('DD.MM.yyyy') : '' return tmUtils.formatDateTime(masterTask) ? tmUtils.formatDateTime(masterTask.deadline) : ''
} }
} }
} }
@@ -246,17 +246,30 @@ export default {
isAfterDeadline() { isAfterDeadline() {
const deadline = this.getDeadline(this.subtask) const deadline = this.getDeadline(this.subtask)
if (deadline) {
return this.tmUtils.isAfter(this.form.date, moment(deadline, 'DD.MM.yyyy')) if (!deadline)
} return
return false
const mDate = moment(this.form.date)
const mDeadline = moment(deadline)
const [hours, minutes] = this.form.ends_at_time.split(':').map(Number)
mDate.hours(hours)
mDate.minutes(minutes)
return mDate.isAfter(mDeadline)
}, },
getDeadline(subtask) { getDeadline(subtask) {
if(subtask.deadline) return moment(subtask.deadline).format('DD.MM.yyyy') if (subtask?.deadline)
else if(!this.mastertasks) return '' return subtask.deadline
if (!this.mastertasks)
return null
const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id) const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id)
return moment(masterTask).format('DD.MM.yyyy') ? moment(masterTask.deadline).format('DD.MM.yyyy') : '' return masterTask.deadline
}, },
closeModal() { closeModal() {
@@ -270,6 +270,7 @@ export default {
return timesheet return timesheet
}) })
// const { subtask } = await this.$axios.patch_auth_form(`v1/subtasks/${this.subtask.id}`, { ...this.subtask, timesheets })
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`, { ...this.subtask, timesheets }) 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)
@@ -104,6 +104,18 @@ export default {
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error))) .catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
}, },
async patch_auth_form(url: string, params = null, config?: any) {
config = this._config(config)
config.headers['Content-Type'] = 'multipart/form-data'
const formData = this._objectToFormData(params)
formData.append('_method', 'put')
config.transformRequest = formData => formData
return axios.post(url, formData, config)
.then(response => response.data)
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
},
async patch_data(url: string, params = null, config?: any) { async patch_data(url: string, params = null, config?: any) {
return axios.patch(url, this._objectToFormData(params), config) return axios.patch(url, this._objectToFormData(params), config)
.then(response => response.data.data) .then(response => response.data.data)