mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Task modal] Refactored task modal
This commit is contained in:
1 parent
3d7ceea9c6
commit
278bdeabc7
3 files changed
+49
-46
No files matched your search
@@ -19,7 +19,7 @@
|
|||||||
<v-list>
|
<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="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="createSubTaskDialog = true">SUB TASK</v-list-item>
|
||||||
<v-list-item class="cursor-pointer hover-background" @click="createTeamDialog = true">TÍM</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="createBlockerDialog = true">BLOCKER</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<Z-master-task-modal :visible="createMasterTaskDialog ? true : false" @close="createMasterTaskDialog = false"/>
|
<Z-master-task-modal :visible="createMasterTaskDialog ? true : false" @close="createMasterTaskDialog = false"/>
|
||||||
<Z-sub-task-modal :visible="createSubTaskDialog ? true : false" @close="createSubTaskDialog = false"/>
|
<Z-sub-task-modal :visible="createSubTaskDialog ? true : false" @close="createSubTaskDialog = false"/>
|
||||||
<Z-blocker-modal :visible="createBlockerDialog ? true : false" @close="createBlockerDialog = false" />
|
<Z-blocker-modal :visible="createBlockerDialog ? true : false" @close="createBlockerDialog = false" />
|
||||||
<Z-team-modal :visible="createTeamDialog ? true : false" @close="createTeamDialog = false" />
|
<Z-team-modal ref="z-team-modal" />
|
||||||
</v-app-bar>
|
</v-app-bar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -74,7 +74,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
user: null,
|
user: null,
|
||||||
createTeamDialog: false,
|
|
||||||
createBlockerDialog: false,
|
createBlockerDialog: false,
|
||||||
createMasterTaskDialog: false,
|
createMasterTaskDialog: false,
|
||||||
createSubTaskDialog: false
|
createSubTaskDialog: false
|
||||||
@@ -98,6 +97,10 @@ export default {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error.data.error)
|
this.$toast.error(error.data.error)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
createTeamModal() {
|
||||||
|
this.$refs['z-team-modal'].create()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<template>
|
<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="allEmployees" class="h-100">
|
<W-loadable :content="team && allEmployees" class="h-100">
|
||||||
<v-card height="100%" class="d-flex flex-column">
|
<v-card height="100%" class="d-flex flex-column">
|
||||||
<div class="d-flex justify-space-between align-center modal-header">
|
<div class="d-flex justify-space-between align-center modal-header">
|
||||||
<h1>{{ team.id ? 'Upraviť tím' : 'Vytvoriť tím' }}</h1>
|
<h1>{{ team.id ? 'Upraviť tím' : 'Vytvoriť tím' }}</h1>
|
||||||
<v-icon
|
<v-icon
|
||||||
@click.stop="show = false"
|
@click.stop="close()"
|
||||||
icon="mdi-close"
|
icon="mdi-close"
|
||||||
size="large"
|
size="large"
|
||||||
></v-icon>
|
></v-icon>
|
||||||
@@ -69,32 +69,19 @@ import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
|||||||
const atLeastOne = (value) => value.length
|
const atLeastOne = (value) => value.length
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
emits: ['close'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ZAutocomplete,
|
ZAutocomplete,
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
|
|
||||||
teamId: {
|
|
||||||
type: Number || null,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
visible: false,
|
||||||
allEmployees: null,
|
allEmployees: null,
|
||||||
v$: useVuelidate(),
|
v$: useVuelidate(),
|
||||||
errorUtils,
|
errorUtils,
|
||||||
team: {
|
team: null
|
||||||
name: '',
|
|
||||||
employees: []
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -108,9 +95,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
if (this.teamId)
|
|
||||||
await this._load()
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
||||||
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
|
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
|
||||||
@@ -120,8 +104,23 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
async create(team = null) {
|
||||||
|
if (team) {
|
||||||
|
this.team = team
|
||||||
|
await this._load()
|
||||||
|
} else {
|
||||||
|
this.team = {
|
||||||
|
name: '',
|
||||||
|
employees: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
if (!(await this.v$.$validate())) return console.log(this.v$)
|
if (!(await this.v$.$validate()))
|
||||||
|
return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.team.id)
|
if (this.team.id)
|
||||||
@@ -129,18 +128,23 @@ export default {
|
|||||||
else
|
else
|
||||||
await this._create()
|
await this._create()
|
||||||
|
|
||||||
this.$router.push({ name: 'Overview - Teams' })
|
this.close()
|
||||||
this.show = false
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('close', this.team)
|
||||||
|
this.team = null
|
||||||
|
},
|
||||||
|
|
||||||
async _create() {
|
async _create() {
|
||||||
try {
|
try {
|
||||||
await this.$axios.post_auth('v1/teams', this.team)
|
await this.$axios.post_auth('v1/teams', this.team)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error.response.data.error)
|
this.$toast.error(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -148,14 +152,14 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await this.$axios.post_auth(`v1/teams/${this.team.id}`, this.team)
|
await this.$axios.post_auth(`v1/teams/${this.team.id}`, this.team)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error.response.data.error)
|
this.$toast.error(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async _load() {
|
async _load() {
|
||||||
try {
|
try {
|
||||||
const team = await this.$axios.get_auth_data(`v1/teams/${this.teamId}`)
|
const team = await this.$axios.get_auth_data(`v1/teams/${this.team.id}`)
|
||||||
team.employees = this._enrichEmployeesByFullName(team.employees)
|
team.employees = this._enrichEmployeesByFullName(team.employees)
|
||||||
|
|
||||||
this.team = team
|
this.team = team
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -191,17 +195,7 @@ export default {
|
|||||||
value: `${employee.name} ${employee.surname}`,
|
value: `${employee.name} ${employee.surname}`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
|
|
||||||
show: {
|
|
||||||
get() {
|
|
||||||
return this.visible
|
|
||||||
},
|
|
||||||
|
|
||||||
set(value) {
|
|
||||||
if (!value) this.$emit('close')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<td>{{ team.name }}</td>
|
<td>{{ team.name }}</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/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editModal = { team }" />
|
<img class="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editTeam(team)" />
|
||||||
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="deleteModal = { team }" />
|
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="deleteModal = { team }" />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</v-table>
|
</v-table>
|
||||||
|
|
||||||
<Z-team-modal v-if="editModal" :visible="editModal ? true : false" :teamId="editModal.team.id" @close="(editModal = null)" />
|
<Z-team-modal ref="z-team-modal" />
|
||||||
<Z-delete-team-modal v-if="deleteModal" :visible="deleteModal ? true : false" :team="deleteModal.team" @close="(deleteModal = null)" />
|
<Z-delete-team-modal v-if="deleteModal" :visible="deleteModal ? true : false" :team="deleteModal.team" @close="(deleteModal = null)" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -48,6 +48,12 @@ export default {
|
|||||||
editModal: null,
|
editModal: null,
|
||||||
deleteModal: null
|
deleteModal: null
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
editTeam(team) {
|
||||||
|
this.$refs['z-team-modal'].create(team)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in new issue
Block a user