uprava modalov, [ongoing, unscheduled tasks] filter

This commit is contained in:
romankko2 committed 2022-12-26 13:04:54 +01:00
1 parent 278bdeabc7
commit 67afa56736
16 files changed
+647 -353

No files matched your search

@@ -0,0 +1,88 @@
<template>
<v-row class="px-10 py-8 subheader">
<v-select
v-model="selectedEmployee"
class="subheader-input"
variant="outlined"
:items="allEmployees"
label="Zamestanec"
></v-select>
<v-text-field
v-model="searchQuery"
class="subheader-input"
variant="outlined"
placeholder="Vyhľadávanie"
prepend-inner-icon="mdi-magnify"
@input="onInput"
type="text"
></v-text-field>
</v-row>
</template>
<script>
export default {
data() {
return {
selectedEmployee: '',
employees: [],
searchQuery: ''
}
},
async created() {
try {
this.employees = await this.$axios.get_auth_data('v1/employees')
} catch (error) {
console.log(error)
}
},
methods: {
onInput() {
this.$emit('queryChange', this.searchQuery)
}
},
computed: {
allEmployees() {
const employees = this.employees.map((employee) => {
return `${employee.name} ${employee.surname}`
})
return employees
}
}
}
</script>
<style lang="sass" scoped>
.subheader
max-width: 100%
margin: 0
border-bottom: 1px solid rgba(33, 33, 33, 0.08)
gap: 25px
flex-wrap: wrap
position: sticky
top: 0
z-index: 9999
background: white
.subheader-input
max-width: 250px !important
min-width: 250px
&:deep(.v-input__details)
display: none
&.disabled
pointer-events: none !important
@media (max-width: 600px)
.subheader
gap: 15px
padding: 20px !important
.subheader-input
max-width: 100% !important
min-width: 100%
</style>
@@ -1,29 +1,58 @@
<template>
<W-loadable :content="ongoingTasks">
<A-ongoing-table :tasks="ongoingTasks" />
</W-loadable>
<div>
<Z-tasks-search @queryChange="filterOngoingTasks" />
<W-loadable :content="ongoingTasks">
<A-ongoing-table :tasks="filteredOngoingTasks" />
<h6
v-if="filteredOngoingTasks && !filteredOngoingTasks.length"
class="px-4"
>
Aktuálnemu hľadaniu nevyhovujú žiadne prebiehajúce úlohy
</h6>
</W-loadable>
</div>
</template>
<script>
import AOngoingTable from './_components/a-ongoing-table.vue'
import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue'
import AOngoingTable from './_components/a-ongoing-table.vue'
export default {
components: {
ZTasksSearch,
AOngoingTable
},
data() {
return {
ongoingTasks: null
ongoingTasks: null,
filteredOngoingTasks: []
}
},
async created() {
try {
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
this.filterOngoingTasks()
} catch (error) {
this.ongoingTasks = {error: error.data.error}
this.$toast.error(error.data.error)
this.ongoingTasks = error
this.$toast.error(error)
}
},
methods: {
filterOngoingTasks(searchQuery) {
if(!searchQuery) return this.filteredOngoingTasks = this.ongoingTasks
this.filteredOngoingTasks = this.ongoingTasks.filter((task) => {
return this.filterParams(searchQuery, task.title) || this.filterParams(searchQuery, task.project_code)
})
},
filterParams(searchQuery, row) {
return row.toLowerCase().includes(searchQuery.toLowerCase())
}
}
}
@@ -13,7 +13,7 @@
<tr v-for="task in tasks" :key="task.id">
<td>{{ task.project_code }}</td>
<td>{{ task.title }}</td>
<td>{{ task.duration / 1000 / 60 / 60 }} h</td>
<td>{{ (task.duration / 1000 / 60 / 60).toFixed(2) }} h</td>
<td class="task-action">
<div class="d-flex justify-start">
<img class="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" :style="{opacity: 0.3}">
@@ -1,29 +1,59 @@
<template>
<W-loadable :content="unscheduledTasks">
<A-unscheduled-table :tasks="unscheduledTasks" />
</W-loadable>
<div>
<Z-tasks-search @queryChange="filterUnscheduledTasks" />
<W-loadable :content="unscheduledTasks">
<A-unscheduled-table :tasks="filteredUnscheduledTasks" />
<h6
v-if="filteredUnscheduledTasks && !filteredUnscheduledTasks.length"
class="px-4"
>
Aktuálnemu hľadaniu nevyhovujú žiadne nenaplánované úlohy
</h6>
</W-loadable>
</div>
</template>
<script>
import AUnscheduledTable from './_components/a-unscheduled-table.vue'
import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue'
import AUnscheduledTable from './_components/a-unscheduled-table.vue'
export default {
components: {
ZTasksSearch,
AUnscheduledTable
},
data() {
return {
unscheduledTasks: null
unscheduledTasks: null,
filteredUnscheduledTasks: []
}
},
async created() {
try {
this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks')
this.filterUnscheduledTasks()
console.log(this.unscheduledTasks)
} catch (error) {
this.unscheduledTasks = {error: error.data.error}
this.$toast.error(error.data.error)
this.unscheduledTasks = error
this.$toast.error(error)
}
},
methods: {
filterUnscheduledTasks(searchQuery) {
if(!searchQuery) return this.filteredUnscheduledTasks = this.unscheduledTasks
this.filteredUnscheduledTasks = this.unscheduledTasks.filter((task) => {
return this.filterParams(searchQuery, task.title) || this.filterParams(searchQuery, task.project_code)
})
},
filterParams(searchQuery, row) {
return row.toLowerCase().includes(searchQuery.toLowerCase())
}
}
}
@@ -45,7 +45,6 @@ export default {
data() {
return {
editModal: null,
deleteModal: null
}
},