From 5ccdcec52074ea0529eb34822399df4bb56f872c Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Sat, 18 Sep 2021 14:50:21 +0200 Subject: [PATCH] Use events to open/close tickets --- src/App.vue | 39 ++++++++++++++++++++++------------- src/Ticket.vue | 24 ++++++++++++++++----- src/components/TicketList.vue | 7 ++++++- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/src/App.vue b/src/App.vue index e477ec0..777f94c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,10 +3,10 @@
- +
- +
@@ -29,7 +29,14 @@ export default { }, data() { return { - tickets: [ + /** + * Return the currently selected ticket object or null, if none is selected. + * + * @type {object|null|undefined} + */ + currentTicket: undefined, + + testTickets: [ { id: 1234, status: 'Offen', @@ -49,22 +56,26 @@ export default { } }, computed: { - /** - * Return the currently selected ticket object or null, if none is selected. - * - * @return {object|null} - */ - currentTicket() { - return null - }, - /** * Returns the list of ticket objects the current account has access to. * * @return {Array} */ - mytickets() { - return this.tickets + tickets() { + // TODO: ask API (dont forget permission check in API) + return this.testTickets + }, + }, + methods: { + saveTicket(ticketId, data) { + // TODO send to API (dont forget permission check in API) + console.debug('upschooling', 'saveTicket', ticketId, data) + }, + openTicket(ticketId) { + this.currentTicket = this.tickets.find((obj) => obj.id === ticketId) + }, + deselectTicket() { + this.currentTicket = null }, }, } diff --git a/src/Ticket.vue b/src/Ticket.vue index 9afe299..b8edc4b 100644 --- a/src/Ticket.vue +++ b/src/Ticket.vue @@ -1,15 +1,15 @@