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
+438 -144

No files matched your search

@@ -9,21 +9,25 @@
"deadline": "2022-11-10T00:00:00+00:00",
"is_finished": false,
"project_code": "CO-2201",
"team": "Tim 1",
"team_id": 1,
"employees": [
{
"id": 1,
"duration": 1300000
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 4,
"duration": 1000000
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 5,
"duration": 3100000
"name": "Pavel",
"surname": "Gajdos"
}
],
"files": []
@@ -5,7 +5,29 @@
"project_code": "CO-2201",
"title": "Nazov tasku 1 (Ongoing)",
"duration": 5400000,
"remaining_time": 2400000
"remaining_time": 2400000,
"employees": [
{
"id": 1,
"duration": 1300000,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 4,
"duration": 1000000,
"name": "Pavel",
"surname": "Gajdos"
},
{
"id": 5,
"duration": 3100000,
"name": "Francesca",
"surname": "Spinelli"
}
]
},
{
@@ -13,7 +35,22 @@
"project_code": "CO-2202",
"title": "Nazov tasku 2 (Ongoing)",
"duration": 5400000,
"remaining_time": 1300000
"remaining_time": 1300000,
"employees": [
{
"id": 2,
"duration": 1300000,
"name": "Simona",
"surname": "Tremkova"
},
{
"id": 3,
"duration": 1000000,
"name": "Matej",
"surname": "Macho"
}
]
},
{
@@ -21,7 +58,35 @@
"project_code": "CO-2203",
"title": "Nazov tasku 3 (Ongoing)",
"duration": 5400000,
"remaining_time": 4500000
"remaining_time": 4500000,
"employees": [
{
"id": 1,
"duration": 1300000,
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 6,
"duration": 1000000,
"name": "Lenka",
"surname": "Nemeckova"
},
{
"id": 7,
"duration": 3100000,
"name": "Peter",
"surname": "Bucan"
},
{
"id": 9,
"duration": 3200000,
"name": "Viliam",
"surname": "Sedivy"
}
]
}
],
"status": 200
@@ -4,21 +4,77 @@
"id": 1,
"project_code": "CO-2201",
"title": "Nazov tasku 1 (Unscheduled)",
"duration": 5400000
"duration": 54000000,
"employees": [
{
"id": 1,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 4,
"name": "Pavel",
"surname": "Gajdos"
},
{
"id": 5,
"name": "Francesca",
"surname": "Spinelli"
}
]
},
{
"id": 2,
"project_code": "CO-2202",
"title": "Nazov tasku 2 (Unscheduled)",
"duration": 5400000
"duration": 1400000,
"employees": [
{
"id": 1,
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 1,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 7,
"name": "Peter",
"surname": "Bucan"
},
{
"id": 9,
"name": "Viliam",
"surname": "Sedivy"
}
]
},
{
"id": 3,
"project_code": "CO-2203",
"title": "Nazov tasku 3 (Unscheduled)",
"duration": 5400000
"duration": 2900000,
"employees": [
{
"id": 2,
"name": "Simona",
"surname": "Tremkova"
},
{
"id": 3,
"name": "Matej",
"surname": "Macho"
}
]
}
],
"status": 200
+1 -1
View File
@@ -5,7 +5,7 @@
"project_code": "CO-2201",
"master_task_id": 1,
"team_id": 1,
"employe_id": 1,
"employee_id": 1,
"duration": 1000000,
"starts_at": "2022-11-10T11:00:00+00:00",
"ends_at": "2022-11-12T16:00:00+00:00",
+21 -1
View File
@@ -4,12 +4,32 @@
"description": "Nejaky popis tasku",
"project_code": "CO-2201",
"master_task_id": 1,
"master_task": "Master task 1",
"team_id": 1,
"employe_id": 1,
"employee_id": 1,
"duration": 1000000,
"is_finished": false,
"starts_at": "2022-11-10T11:00:00+00:00",
"ends_at": "2022-11-12T16:00:00+00:00",
"employees": [
{
"id": 1,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 4,
"name": "Pavel",
"surname": "Gajdos"
},
{
"id": 5,
"name": "Francesca",
"surname": "Spinelli"
}
],
"files": []
},
@@ -17,10 +17,10 @@
</template>
<v-list>
<v-list-item class="cursor-pointer hover-background" @click="createMasterTaskDialog = true">MASTER TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createSubTaskDialog = true">SUB TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createMasterTaskModal()">MASTER TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createSubTaskModal()">SUB TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createTeamModal()">TÍM</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createBlockerDialog = true">BLOCKER</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createBlockerModal()">BLOCKER</v-list-item>
</v-list>
</v-menu>
@@ -50,9 +50,9 @@
</div>
</div>
<Z-master-task-modal :visible="createMasterTaskDialog ? true : false" @close="createMasterTaskDialog = false"/>
<Z-sub-task-modal :visible="createSubTaskDialog ? true : false" @close="createSubTaskDialog = false"/>
<Z-blocker-modal :visible="createBlockerDialog ? true : false" @close="createBlockerDialog = false" />
<Z-master-task-modal ref="z-master-task-modal" />
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-blocker-modal ref="z-blocker-modal" />
<Z-team-modal ref="z-team-modal" />
</v-app-bar>
</template>
@@ -73,10 +73,7 @@ export default {
data() {
return {
user: null,
createBlockerDialog: false,
createMasterTaskDialog: false,
createSubTaskDialog: false
user: null
}
},
@@ -101,6 +98,18 @@ export default {
createTeamModal() {
this.$refs['z-team-modal'].create()
},
createMasterTaskModal() {
this.$refs['z-master-task-modal'].create()
},
createSubTaskModal() {
this.$refs['z-sub-task-modal'].create()
},
createBlockerModal() {
this.$refs['z-blocker-modal'].create()
}
}
}
@@ -80,7 +80,7 @@ export default {
},
refreshPage() {
window.location = '/app/dashboard/tasks'
window.location = '/#/app/dashboard/tasks'
}
},
}
@@ -1,11 +1,11 @@
<template>
<v-dialog v-model="show" max-width="650" max-height="90%" height="700px">
<W-loadable :content="allEmployees" class="h-100">
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<W-loadable :content="blocker && allEmployees" class="h-100">
<v-card height="100%" class="d-flex flex-column">
<div class="d-flex justify-space-between align-center modal-header">
<h1>{{ blocker.id ? 'Upraviť' : 'Vytvoriť'}} blocker</h1>
<v-icon
@click.stop="show = false"
@click.stop="close()"
icon="mdi-close"
size="large"
></v-icon>
@@ -83,34 +83,20 @@ import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
const atLeastOne = (value) => value.length
export default {
emits: ['close'],
components: {
ZAutocomplete,
Datepicker,
},
props: {
visible: {
type: Boolean,
required: true
},
blockerId: {
type: Number || null,
required: false,
default: null
}
},
data() {
return {
visible: false,
allEmployees: null,
v$: useVuelidate(),
errorUtils,
blocker: {
name: '',
date: null,
employees: []
}
blocker: null
}
},
@@ -125,9 +111,6 @@ export default {
},
async created() {
if (this.blockerId)
await this._load()
try {
const allEmployees = await this.$axios.get_auth_data('v1/employees')
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
@@ -137,13 +120,29 @@ export default {
},
methods: {
async create(blocker = null) {
if (blocker) {
this.blocker = blocker
await this._load()
} else {
this.blocker = {
name: '',
date: null,
employees: []
}
}
this.visible = true
},
employeeSelected(selectedOption) {
const employee = this.allEmployees.find((empl) => empl.id == selectedOption.key)
this.blocker.employees.push(employee)
},
async save() {
if (!(await this.v$.$validate())) return console.log(this.v$)
if (!(await this.v$.$validate()))
return
try {
if (this.blocker.id)
@@ -151,13 +150,19 @@ export default {
else
await this._create()
this.close()
this.$router.push({ name: 'Dashboard - Tasks' })
this.show = false
} catch (error) {
console.log(error)
}
},
close() {
this.visible = false
this.$emit('close', this.blocker)
this.blocker = null
},
async _create() {
try {
await this.$axios.post_auth('v1/blockers', this.blocker)
@@ -176,7 +181,7 @@ export default {
async _load() {
try {
const blocker = await this.$axios.get_auth_data(`v1/blockers/${this.blockerId}`)
const blocker = await this.$axios.get_auth_data(`v1/blockers/${this.blocker.id}`)
blocker.employees = this._enrichEmployeesByFullName(blocker.employees)
this.blocker = blocker
@@ -222,17 +227,7 @@ export default {
value: `${employee.name} ${employee.surname}`,
}
})
},
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
}
}
</script>
@@ -1,10 +1,11 @@
<template>
<v-dialog v-model="show" max-width="650" max-height="90%" height="700px">
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<W-loadable :content="masterTask" class="h-100">
<v-card height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
<h1>Vytvoriť master task</h1>
<v-icon
@click.stop="show = false"
@click.stop="close()"
icon="mdi-close"
size="large"
></v-icon>
@@ -115,6 +116,7 @@
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
</W-loadable>
</v-dialog>
</template>
@@ -129,44 +131,25 @@ import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
const atLeastOne = (value) => value.length
export default {
emits: ['close'],
components: {
Datepicker,
ZFilesUpload,
ZAutocomplete
},
props: {
visible: {
type: Boolean,
required: true
},
masterTaskId: {
type: Number || null,
required: false,
default: null
}
},
data() {
return {
masterTask: {
project_code: null,
name: null,
deadline: null,
duration: null,
team: {},
description: null,
employees: [],
files: []
},
visible: false,
errorUtils,
v$: useVuelidate(),
preventInputFocus: false,
teams: null,
employees: null,
selectedTeam: '',
showAddEmployeeInput: false
showAddEmployeeInput: false,
masterTask: null
}
},
@@ -187,7 +170,6 @@ export default {
try {
this.teams = await this.$axios.get_auth_data('v1/teams')
this.employees = await this.$axios.get_auth_data('v1/employees')
// this.masterTask = await this.$axios.get_auth_data(`v1/master-task/${this.masterTaksId}`)
// this.selectedTeam = `${this.masterTask.team.name} - ${this.masterTask.team.id}`)
} catch (error) {
@@ -196,8 +178,29 @@ export default {
},
methods: {
async create(masterTask = null) {
if (masterTask) {
this.masterTask = masterTask
await this._load()
} else {
this.masterTask = {
project_code: null,
name: null,
deadline: null,
duration: null,
team: {},
description: null,
employees: [],
files: []
}
}
this.visible = true
},
async save() {
if (!(await this.v$.$validate())) return console.log(this.v$)
if (!(await this.v$.$validate()))
return
try {
if (this.masterTask.id)
@@ -205,13 +208,19 @@ export default {
else
await this._create()
this.close()
this.$router.push({ name: 'Dashboard - Tasks' })
this.show = false
} catch (error) {
console.log(error)
}
},
close() {
this.visible = false
this.$emit('close', this.masterTask)
this.masterTask = null
},
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
@@ -283,18 +292,8 @@ export default {
value: `${employee.name} ${employee.surname}`,
}
})
},
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
},
watch: {
selectedTeam() {
Whitespace-only changes.
@@ -1,10 +1,11 @@
<template>
<v-dialog v-model="show" max-width="650" max-height="90%" height="700px">
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<W-loadable :content="subTask" class="h-100">
<v-card height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
<h1>Vytvoriť subtask</h1>
<v-icon
@click.stop="show = false"
@click.stop="close()"
icon="mdi-close"
size="large"
></v-icon>
@@ -108,6 +109,7 @@
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
</W-loadable>
</v-dialog>
</template>
@@ -122,36 +124,18 @@ import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
const atLeastOne = (value) => value.length
export default {
emits: ['close'],
components: {
Datepicker,
ZFilesUpload,
ZAutocomplete
},
props: {
visible: {
type: Boolean,
required: true
},
subTaskId: {
type: Number || null,
required: false,
default: null
}
},
data() {
return {
subTask: {
project_code: null,
date: null,
team: {},
employees: [],
duration: null,
description: null,
files: []
},
visible: false,
subTask: null,
errorUtils,
v$: useVuelidate(),
preventInputFocus: false,
@@ -185,8 +169,28 @@ export default {
},
methods: {
async create(subTask = null) {
if (subTask) {
this.subTask = subTask
await this._load()
} else {
this.subTask = {
project_code: null,
date: null,
team: {},
employees: [],
duration: null,
description: null,
files: []
}
}
this.visible = true
},
async save() {
if (!(await this.v$.$validate())) return console.log(this.v$)
if (!(await this.v$.$validate()))
return
try {
if (this.subTask.id)
@@ -194,13 +198,19 @@ export default {
else
await this._create()
this.close()
this.$router.push({ name: 'Dashboard - Tasks' })
this.show = false
} catch (error) {
console.log(error)
}
},
close() {
this.visible = false
this.$emit('close', this.subTask)
this.subTask = null
},
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
@@ -261,18 +271,8 @@ export default {
value: `${employee.name} ${employee.surname}`,
}
})
},
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
},
watch: {
selectedMasterTask() {
@@ -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>
<div>
<Z-tasks-search @queryChange="filterOngoingTasks" />
<W-loadable :content="ongoingTasks">
<A-ongoing-table :tasks="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 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>
<div>
<Z-tasks-search @queryChange="filterUnscheduledTasks" />
<W-loadable :content="unscheduledTasks">
<A-unscheduled-table :tasks="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 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
}
},