mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 22:39:34 +00:00
bugs + CR's
This commit is contained in:
1 parent
9974d8b9e4
commit
bb7b59cc0e
15 files changed
+258
-20
No files matched your search
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
|
||||
<v-card-actions class="mt-10 d-flex flex-column modal-content">
|
||||
<Datepicker v-model="form.date" format="dd.MM.yyyy" locale="sk" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Dátum" :enable-time-picker="false" class="mb-5 modal-input" :class="{error: v$.form.date.$errors.length}" />
|
||||
<Datepicker v-model="form.date" format="dd.MM.yyyy" locale="sk" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Dátum" :auto-apply="true" :enable-time-picker="false" class="mb-5 modal-input" :class="{error: v$.form.date.$errors.length}" />
|
||||
<v-text-field v-model="form.starts_at_time" type="time" variant="solo" bg-color="white" :hint="v$.form.starts_at_time.$errors ? errorUtils.parseErrors(v$.form.starts_at_time.$errors) : null" :class="{ error: v$.form.starts_at_time.$errors.length }" class="mb-1 modal-input" label="Začiatok" />
|
||||
<v-text-field v-model="form.ends_at_time" type="time" variant="solo" bg-color="white" :hint="v$.form.ends_at_time.$errors ? errorUtils.parseErrors(v$.form.ends_at_time.$errors) : null" :class="{ error: v$.form.ends_at_time.$errors.length }" class="modal-input" label="Koniec" />
|
||||
</v-card-actions>
|
||||
@@ -41,6 +41,24 @@
|
||||
<v-btn @click="submit()" class="button primary mt-5">Potvrdiť</v-btn>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<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 <br> <b class="text-black">z mastertasku {{ subtask?.project_code }} ?</b></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" @click.stop="confirmSubmit()">Á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>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -52,6 +70,8 @@ import { required } from '@vuelidate/validators'
|
||||
import Datepicker from '@vuepic/vue-datepicker'
|
||||
import moment from 'moment'
|
||||
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
|
||||
export default {
|
||||
mixins: [ modalMixin ],
|
||||
@@ -79,6 +99,7 @@ export default {
|
||||
errorUtils,
|
||||
tmUtils,
|
||||
showModal: false,
|
||||
visible: false,
|
||||
form: {
|
||||
date: null,
|
||||
starts_at_time: '09:00',
|
||||
@@ -97,6 +118,10 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters('tm', ['mastertasks'])
|
||||
},
|
||||
|
||||
methods: {
|
||||
async submit() {
|
||||
if (!await this.v$.$validate())
|
||||
@@ -121,12 +146,46 @@ export default {
|
||||
|
||||
if(subtask.deadline) subtask.deadline = tmUtils.formatDateTimeForBackend(subtask.deadline)
|
||||
|
||||
const isAfterDeadline = this.isAfterDeadline()
|
||||
|
||||
if (isAfterDeadline) {
|
||||
this.visible = true
|
||||
} else {
|
||||
if (!subtask.id) {
|
||||
this.$emit('update-unfinished-subtask', subtask)
|
||||
} else {
|
||||
this._update(subtask)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async confirmSubmit() {
|
||||
const subtask = JSON.parse(JSON.stringify(this.subtask))
|
||||
const splittedStartsAtTime = this.form.starts_at_time.split(':')
|
||||
const splittedEndsAtTime = this.form.ends_at_time.split(':')
|
||||
const start = moment(this.form.date).hours(parseInt(splittedStartsAtTime[0])).minutes(parseInt(splittedStartsAtTime[1])).toISOString()
|
||||
const end = moment(this.form.date).hours(parseInt(splittedEndsAtTime[0])).minutes(parseInt(splittedEndsAtTime[1])).toISOString()
|
||||
|
||||
if (!subtask?.timeblocks) { subtask.timeblocks = [] }
|
||||
if (!subtask?.timesheets) { subtask.timesheets = [] }
|
||||
if (!subtask?.is_finished) { subtask.is_finished = 0 }
|
||||
|
||||
subtask.timeblocks.push({
|
||||
end: tmUtils.formatDateTimeForBackend(end),
|
||||
id: null,
|
||||
is_finished: 0,
|
||||
start: tmUtils.formatDateTimeForBackend(start)
|
||||
})
|
||||
|
||||
if(subtask.deadline) subtask.deadline = tmUtils.formatDateTimeForBackend(subtask.deadline)
|
||||
|
||||
if (!subtask.id) {
|
||||
this.$emit('update-unfinished-subtask', subtask)
|
||||
this.closeModal()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.visible = false
|
||||
this._update(subtask)
|
||||
},
|
||||
|
||||
@@ -185,6 +244,21 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
isAfterDeadline() {
|
||||
const deadline = this.getDeadline(this.subtask)
|
||||
if (deadline) {
|
||||
return this.tmUtils.isAfter(this.form.date, moment(deadline, 'DD.MM.yyyy'))
|
||||
}
|
||||
return false
|
||||
},
|
||||
|
||||
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') : ''
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
this.form = {
|
||||
date: null,
|
||||
|
||||
Reference in new issue
Block a user