From 887e9053431c8739c041e5d0ae3cd0f455a32e61 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 11 Aug 2023 16:50:55 +0200 Subject: [PATCH] Loading event data from ui possible now --- src/webapp/main/src/components/noseatplan.vue | 8 ++++-- .../seatplan/userApp/userWindow.vue | 25 ++++++++++++------- .../main/src/views/admin/LocationsView.vue | 2 +- .../main/src/views/purchasing/OrderView.vue | 2 ++ .../views/purchasing/TicketsOrderingView.vue | 1 + 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/webapp/main/src/components/noseatplan.vue b/src/webapp/main/src/components/noseatplan.vue index aa6f366..6ede931 100644 --- a/src/webapp/main/src/components/noseatplan.vue +++ b/src/webapp/main/src/components/noseatplan.vue @@ -162,7 +162,11 @@ export default { }, loadTickets () { fetch( '/getAPI/getEvent?event=' + sessionStorage.getItem( 'selectedTicket' ) ).then( res => { - + if ( res.status === 200 ) { + res.json().then( json => { + this.event = json ?? {}; + } ); + } } ); } }, @@ -171,7 +175,7 @@ export default { this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; }, 1 ); this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; - // this.loadTickets(); + this.loadTickets(); } } diff --git a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue index 9e563d5..e7b13f5 100644 --- a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue +++ b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue @@ -124,17 +124,24 @@ // Load seatplan from server let height = $( document ).height() * 0.8; this.scaleFactor = ( height / 900 ) * this.zoomFactor; - fetch( localStorage.getItem( 'url' ) + '/getAPI/getSeatplan?location=' + sessionStorage.getItem( 'selectedTicket' ) ).then( res => { + fetch( '/getAPI/getEvent?event=' + sessionStorage.getItem( 'selectedTicket' ) ).then( res => { if ( res.status === 200 ) { - res.json().then( data => { - this.draggables = this.scaleUp( data.data ); - this.prepSeatplan(); + res.json().then( json => { + this.event = json ?? {}; + fetch( localStorage.getItem( 'url' ) + '/getAPI/getSeatplan?location=' + this.event.location ).then( res => { + if ( res.status === 200 ) { + res.json().then( data => { + this.draggables = this.scaleUp( data.data ); + this.prepSeatplan(); + } ); + } else if ( res.status === 500 ) { + if ( sessionStorage.getItem( 'seatplan' ) ) { + this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) ); + this.prepSeatplan(); + } + } + } ); } ); - } else if ( res.status === 500 ) { - if ( sessionStorage.getItem( 'seatplan' ) ) { - this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) ); - this.prepSeatplan(); - } } } ); }, diff --git a/src/webapp/main/src/views/admin/LocationsView.vue b/src/webapp/main/src/views/admin/LocationsView.vue index 6fb35be..cded6c7 100644 --- a/src/webapp/main/src/views/admin/LocationsView.vue +++ b/src/webapp/main/src/views/admin/LocationsView.vue @@ -128,12 +128,12 @@ , 'settings' ); }, openRightClickMenu( id, event, hasSeatplan ) { + this.currentlyOpenMenu = id; if ( hasSeatplan ) { this.$refs.rclk.openRightClickMenu( event, { 'edit': { 'command': 'editLocation', 'symbol': 'edit', 'display': 'Edit location' }, 'editor': { 'command': 'openEditor', 'symbol': 'tune', 'display': 'Edit seatplan' }, 'delete': { 'command': 'deleteLocation', 'symbol': 'delete', 'display': 'Delete location' } } ) } else { this.$refs.rclk.openRightClickMenu( event, { 'edit': { 'command': 'editLocation', 'symbol': 'edit', 'display': 'Edit location' }, 'delete': { 'command': 'deleteLocation', 'symbol': 'delete', 'display': 'Delete location' } } ) } - this.currentlyOpenMenu = id; }, executeCommand( command ) { if ( command === 'editLocation' ) { diff --git a/src/webapp/main/src/views/purchasing/OrderView.vue b/src/webapp/main/src/views/purchasing/OrderView.vue index 0856a78..2e79e87 100644 --- a/src/webapp/main/src/views/purchasing/OrderView.vue +++ b/src/webapp/main/src/views/purchasing/OrderView.vue @@ -91,6 +91,8 @@ methods: { setActiveTicket ( id ) { sessionStorage.setItem( 'selectedTicket', id ); + sessionStorage.setItem( 'ticketData', { 'description': this.events[ id ][ 'description' ], 'name': this.events[ id ][ 'name' ], 'locationName': this.events[ id ][ 'locationName' ] } ); + sessionStorage.setItem( 'hasSeatplan', this.events[ id ][ 'hasSeatplan' ] ); }, loadEvents () { fetch( '/getAPI/getAllEvents' ).then( res => { diff --git a/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue b/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue index 7bd7eba..e2c5d00 100644 --- a/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue +++ b/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue @@ -59,6 +59,7 @@ this.$router.push( '/tickets' ); } this.eventID = sessionStorage.getItem( 'selectedTicket' ); + this.hasSeatplan = sessionStorage.getItem( 'hasSeatplan' ); } };