This commit is contained in:
romankko2 committed 2023-08-07 17:47:20 +02:00
1 parent bed6793b8b
commit b02a8c734d
18 files changed
+95 -23

No files matched your search

+3 -4
View File
@@ -262,11 +262,10 @@ export default {
dateTo.setHours(dateFrom.getHours() + 1) dateTo.setHours(dateFrom.getHours() + 1)
const time = moment(dateFrom).format('HH:mm') const time = moment(dateFrom).format('HH:mm')
const date = moment(dateFrom).format('DD.MM.yyyy')
this.$events.emit('show-menu-modal', { this.$events.emit('show-menu-modal', {
time: time, time: time,
date: date date: tmUtils.formatDateTimeForBackend(dateFrom)
}) })
setTimeout(() => { setTimeout(() => {
@@ -0,0 +1,11 @@
export default {
mounted() {
window.addEventListener('keydown', this.handleKeyDown)
},
methods: {
handleKeyDown(event) {
if (event.keyCode === 27) this.closeModal()
}
},
}
@@ -44,9 +44,10 @@ import VuetifyFixFocusMixin from "@/plugins/tm@modal/_mixins/vuetify-fix-focus"
import { mapGetters } from "vuex" import { mapGetters } from "vuex"
import moment from "moment" import moment from "moment"
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin' import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [VuetifyFixFocusMixin, AutocompleteMixin], mixins: [VuetifyFixFocusMixin, AutocompleteMixin, modalMixin],
emits: ["close"], emits: ["close"],
@@ -136,6 +137,7 @@ export default {
} }
this.$events.emit("on-blocker-edited", this.blocker) this.$events.emit("on-blocker-edited", this.blocker)
this.$events.emit("blocker-created")
this.closeModal() this.closeModal()
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
@@ -20,7 +20,10 @@
</template> </template>
<script> <script>
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
emits: ['on-blocker-deleted'], emits: ['on-blocker-deleted'],
data() { data() {
@@ -20,7 +20,10 @@
</template> </template>
<script> <script>
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
emits: ['on-mastertask-deleted'], emits: ['on-mastertask-deleted'],
data() { data() {
@@ -28,8 +28,10 @@
<script> <script>
import tmUtils from '@/plugins/tm@_utils/tm.utils' import tmUtils from '@/plugins/tm@_utils/tm.utils'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
data() { data() {
return { return {
visible: false, visible: false,
@@ -96,6 +96,7 @@ import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
import moment from 'moment' import moment from 'moment'
import { QuillEditor } from '@vueup/vue-quill' import { QuillEditor } from '@vueup/vue-quill'
// import tmUtils from '@/plugins/tm@_utils/tm.utils' // import tmUtils from '@/plugins/tm@_utils/tm.utils'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
import '@vueup/vue-quill/dist/vue-quill.snow.css' import '@vueup/vue-quill/dist/vue-quill.snow.css'
@@ -112,7 +113,7 @@ export default {
// watch: mastertask.team_id // watch: mastertask.team_id
emits: ['master-task-edited', 'close'], emits: ['master-task-edited', 'close'],
mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin], mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin, modalMixin],
components: { components: {
AMastertaskDescription, AMastertaskDescription,
@@ -8,7 +8,7 @@
<v-card-actions class="mt-10 d-flex justify-start align-center mobile-view"> <v-card-actions class="mt-10 d-flex justify-start align-center mobile-view">
<v-btn class="button primary half outline" @click.stop="createTask()" <v-btn class="button primary half outline" @click.stop="createTask()"
>TASK</v-btn >SUB TASK</v-btn
> >
<v-btn class="button primary half outline" @click.stop="createBlocker()" <v-btn class="button primary half outline" @click.stop="createBlocker()"
>BLOCKER</v-btn >BLOCKER</v-btn
@@ -19,9 +19,12 @@
</template> </template>
<script> <script>
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
emits: ['update', 'data'], emits: ['update', 'data'],
props: ['data'], props: ['data'],
mixins: [ modalMixin ],
data() { data() {
return { return {
@@ -30,6 +33,16 @@ export default {
} }
}, },
mounted() {
this.$events.on('blocker-created', () => {
this.closeModal()
})
this.$events.on('task-created', () => {
this.closeModal()
})
},
methods: { methods: {
async showModal(data) { async showModal(data) {
this.localData = data this.localData = data
@@ -46,6 +59,9 @@ export default {
deadline: this.localData.date, deadline: this.localData.date,
_deadline_time: this.localData.time, _deadline_time: this.localData.time,
}, },
onTaskCreated: () => {
this.closeModal()
}
}) })
}, },
@@ -55,6 +71,9 @@ export default {
starts_at_time: this.localData.time, starts_at_time: this.localData.time,
datepicker: this.localData.date, datepicker: this.localData.date,
}, },
onBlockerCreated: () => {
this.closeModal()
}
}) })
}, },
}, },
@@ -11,7 +11,7 @@
<v-col cols="7"> <v-col cols="7">
<v-sheet class="py-3"> <v-sheet class="py-3">
<p>{{ hours }} h</p> <p>{{ (hours).toFixed(2) }} h</p>
</v-sheet> </v-sheet>
</v-col> </v-col>
</v-row> </v-row>
@@ -57,8 +57,10 @@ import useVuelidate from '@vuelidate/core'
import { required, numeric, minValue } from '@vuelidate/validators' import { required, numeric, minValue } from '@vuelidate/validators'
import tmUtils from '@/plugins/tm@_utils/tm.utils' import tmUtils from '@/plugins/tm@_utils/tm.utils'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
props: { props: {
hours: { hours: {
type: Number, type: Number,
@@ -49,10 +49,12 @@ import tmUtils from '@/plugins/tm@_utils/tm.utils'
import errorUtils from '@/plugins/lib@auth/_utils/error.utils' import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
import useVuelidate from '@vuelidate/core' import useVuelidate from '@vuelidate/core'
import { required } from '@vuelidate/validators' import { required } from '@vuelidate/validators'
import Datepicker from '@vuepic/vue-datepicker' import Datepicker from '@vuepic/vue-datepicker'
import moment from 'moment' import moment from 'moment'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
emits: ['update-subtask'], emits: ['update-subtask'],
components: { components: {
@@ -4,7 +4,7 @@
<div class="d-flex justify-space-between align-center"> <div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete {{ subtask.is_finished ? 'znovu otvoriť' : 'dokončiť' }} task, z mastertasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1> <h1>Ste si istý, že chcete {{ subtask.is_finished ? 'znovu otvoriť' : 'dokončiť' }} task, z mastertasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1>
<v-icon <v-icon
@click.stop="visible = false" @click.stop="closeModal()"
icon="mdi-close" icon="mdi-close"
size="large" size="large"
></v-icon> ></v-icon>
@@ -18,7 +18,10 @@
</template> </template>
<script> <script>
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
emits: ['close', 'on-subtask-edited'], emits: ['close', 'on-subtask-edited'],
data() { data() {
@@ -47,6 +50,10 @@ export default {
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
},
closeModal() {
this.visible = false
} }
} }
} }
@@ -20,7 +20,10 @@
</template> </template>
<script> <script>
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
emits: ['on-subtask-deleted'], emits: ['on-subtask-deleted'],
data() { data() {
@@ -18,8 +18,10 @@
import errorUtils from '@/plugins/lib@auth/_utils/error.utils' import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
import useVuelidate from '@vuelidate/core' import useVuelidate from '@vuelidate/core'
import { required, numeric, minValue } from '@vuelidate/validators' import { required, numeric, minValue } from '@vuelidate/validators'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
emits: ['close', 'on-subtask-edited'], emits: ['close', 'on-subtask-edited'],
data() { data() {
+16 -4
View File
@@ -66,7 +66,7 @@
<div class="d-flex justify-space-between align-center"> <div class="d-flex justify-space-between align-center">
<div> <div>
<p>{{ subtask._master_task.project_code }}</p> <p>{{ subtask._master_task.project_code }}</p>
<h1>{{ subtask._master_task.name }}</h1> <h1>{{ subtask._master_task.name }}</h1>
</div> </div>
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large" class="pb-5"></v-icon> <v-icon @click.stop="closeModal()" icon="mdi-close" size="large" class="pb-5"></v-icon>
@@ -120,10 +120,11 @@ import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
import ZTaskReadonlyInfo from "./_components/z-task-readonly-info.vue" import ZTaskReadonlyInfo from "./_components/z-task-readonly-info.vue"
import { mapGetters } from "vuex" import { mapGetters } from "vuex"
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
emits: ["close", "refresh"], emits: ["close", "refresh"],
mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin], mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin, modalMixin],
components: { components: {
ZTaskReadonlyInfo, ZTaskReadonlyInfo,
@@ -209,6 +210,11 @@ export default {
this.subtask = this._enrichTask(data) this.subtask = this._enrichTask(data)
} else { } else {
this.subtask = { master_task: mastertask, employees: [{}], _deadline_time: '17:00' } this.subtask = { master_task: mastertask, employees: [{}], _deadline_time: '17:00' }
if (subtask?.deadline && subtask._deadline_time) {
this.subtask.deadline = subtask.deadline
this.subtask._deadline_time = subtask._deadline_time
}
} }
this.editMode = editMode || !this.subtask.id this.editMode = editMode || !this.subtask.id
@@ -250,13 +256,14 @@ export default {
this.$store.commit('tm/update_subtask', subtask) this.$store.commit('tm/update_subtask', subtask)
this.$events.emit("on-subtask-edited", this.subtask) this.$events.emit("on-subtask-edited", this.subtask)
} else { } else {
const { subtasks } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, this.subtask) const { subtasks } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, this.subtask, this.subtask.project_code)
this.subtask.id = subtasks[0].id this.subtask.id = subtasks[0].id
subtasks.forEach(subtask => { subtasks.forEach(subtask => {
this.$store.commit('tm/update_subtask', subtask) this.$store.commit('tm/update_subtask', subtask)
this.$events.emit("on-subtask-edited", this.subtask) this.$events.emit("on-subtask-edited", this.subtask)
}) })
this.$events.emit("task-created")
} }
this.closeModal() this.closeModal()
@@ -365,9 +372,14 @@ export default {
deep: true deep: true
}, },
'subtask.master_task_id'(value) { 'subtask.master_task_id'(value, newValue) {
if (!value) return if (!value) return
this.subtask._master_task = this.mastertasks.find((mastertask) => mastertask.id == this.subtask.master_task_id) this.subtask._master_task = this.mastertasks.find((mastertask) => mastertask.id == this.subtask.master_task_id)
// let selectedMasterTask = null
// if (newValue) selectedMasterTask = this.mastertasks.find((mastertask) => mastertask.id === newValue)
// if (selectedMasterTask) this.subtask.project_code = selectedMasterTask.project_code
}, },
editMode() { editMode() {
@@ -17,7 +17,10 @@
</template> </template>
<script> <script>
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ],
emits: ['update'], emits: ['update'],
data() { data() {
@@ -37,17 +37,18 @@
</template> </template>
<script> <script>
import useVuelidate from '@vuelidate/core' import useVuelidate from '@vuelidate/core'
import { required } from '@vuelidate/validators' import { required } from '@vuelidate/validators'
import errorUtils from '@/plugins/lib@auth/_utils/error.utils' import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
import tmUtils from '@/plugins/tm@_utils/tm.utils' import tmUtils from '@/plugins/tm@_utils/tm.utils'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin' import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
const atLeastOne = (value) => value.length const atLeastOne = (value) => value.length
export default { export default {
mixins: [AutocompleteMixin], mixins: [AutocompleteMixin, modalMixin],
emits: ['close', 'update'], emits: ['close', 'update'],
data() { data() {
@@ -15,7 +15,7 @@
<td>{{ subtask.project_code }}</td> <td>{{ subtask.project_code }}</td>
<td>{{ subtask.title ?? subtask.master_task?.name ?? subtask.master_task }}</td> <td>{{ subtask.title ?? subtask.master_task?.name ?? subtask.master_task }}</td>
<td>{{ subtask.duration }} h</td> <td>{{ subtask.duration }} h</td>
<td>{{ subtask.duration - subtask.spent_time }} h</td> <td>{{ (subtask.duration - subtask.spent_time).toFixed(2) }} h</td>
<td class="task-action"> <td class="task-action">
<div class="d-flex justify-start"> <div class="d-flex justify-start">
<img class="pencil-icon" :src="require('@/plugins/app/_img/icons/eye.svg')" alt="pencil-icon" @click.stop="editTask(subtask, false)"> <img class="pencil-icon" :src="require('@/plugins/app/_img/icons/eye.svg')" alt="pencil-icon" @click.stop="editTask(subtask, false)">