mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[tm@store] Added store
This commit is contained in:
1 parent
a1a410c54d
commit
774ca7b607
44 files changed
+989
-720
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<Z-tasks-search @queryChange="onSearch" />
|
||||
<Z-tasks-search @seach="onSearch" @employee-selected="onEmployeeSelected" />
|
||||
|
||||
<W-loadable :content="filteredOngoingTasks" :emptyMessage="searchQuery.length ? 'Neboli nájdené žiadne úlohy' : 'Nenašli sa žiadne záznamy'">
|
||||
<A-ongoing-table :tasks="filteredOngoingTasks" />
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
<script>
|
||||
import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue'
|
||||
import { mapGetters } from 'vuex'
|
||||
import AOngoingTable from './_components/a-ongoing-table.vue'
|
||||
|
||||
export default {
|
||||
@@ -22,47 +23,36 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
searchQuery: '',
|
||||
ongoingTasks: null
|
||||
searchQuery: ''
|
||||
}
|
||||
},
|
||||
|
||||
ionViewWillEnter() {
|
||||
this.$store.dispatch('tm/loadOngoingSubtasks')
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters('tm', ['ongoingSubtasks']),
|
||||
|
||||
filteredOngoingTasks() {
|
||||
if (!this.ongoingTasks)
|
||||
if (!this.ongoingSubtasks)
|
||||
return null
|
||||
|
||||
if (!this.searchQuery)
|
||||
return this.ongoingTasks
|
||||
|
||||
return this.ongoingTasks.filter((task) => {
|
||||
return this.filterParams(this.searchQuery, task.title) || this.filterParams(this.searchQuery, task.project_code)
|
||||
return this.ongoingSubtasks.filter(subtask => {
|
||||
return this.filterParams(this.searchQuery, subtask.master_task) || this.filterParams(this.searchQuery, subtask.project_code)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
await this._loadData()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$events.on('on-task-deleted', () => this._loadData())
|
||||
},
|
||||
|
||||
methods: {
|
||||
async _loadData() {
|
||||
this.ongoingTasks = null
|
||||
try {
|
||||
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
|
||||
} catch (error) {
|
||||
this.ongoingTasks = {error}
|
||||
}
|
||||
},
|
||||
|
||||
onSearch(searchQuery) {
|
||||
this.searchQuery = searchQuery
|
||||
},
|
||||
|
||||
onEmployeeSelected(id) {
|
||||
this.$store.dispatch('tm/loadOngoingSubtasks', id)
|
||||
},
|
||||
|
||||
filterParams(searchQuery, row) {
|
||||
return row.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user