Loading event data from ui possible now

This commit is contained in:
2023-08-11 16:50:55 +02:00
parent dbfe89998e
commit 887e905343
5 changed files with 26 additions and 12 deletions

View File

@@ -162,7 +162,11 @@ export default {
}, },
loadTickets () { loadTickets () {
fetch( '/getAPI/getEvent?event=' + sessionStorage.getItem( 'selectedTicket' ) ).then( res => { 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' ) ): {}; this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};
}, 1 ); }, 1 );
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};
// this.loadTickets(); this.loadTickets();
} }
} }
</script> </script>

View File

@@ -124,7 +124,11 @@
// Load seatplan from server // Load seatplan from server
let height = $( document ).height() * 0.8; let height = $( document ).height() * 0.8;
this.scaleFactor = ( height / 900 ) * this.zoomFactor; 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( json => {
this.event = json ?? {};
fetch( localStorage.getItem( 'url' ) + '/getAPI/getSeatplan?location=' + this.event.location ).then( res => {
if ( res.status === 200 ) { if ( res.status === 200 ) {
res.json().then( data => { res.json().then( data => {
this.draggables = this.scaleUp( data.data ); this.draggables = this.scaleUp( data.data );
@@ -137,6 +141,9 @@
} }
} }
} ); } );
} );
}
} );
}, },
prepSeatplan () { prepSeatplan () {
// Mark all selected seats + all unavailable seats // Mark all selected seats + all unavailable seats

View File

@@ -128,12 +128,12 @@
, 'settings' ); , 'settings' );
}, },
openRightClickMenu( id, event, hasSeatplan ) { openRightClickMenu( id, event, hasSeatplan ) {
this.currentlyOpenMenu = id;
if ( hasSeatplan ) { 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' } } ) 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 { } else {
this.$refs.rclk.openRightClickMenu( event, { 'edit': { 'command': 'editLocation', 'symbol': 'edit', 'display': 'Edit location' }, 'delete': { 'command': 'deleteLocation', 'symbol': 'delete', 'display': 'Delete location' } } ) 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 ) { executeCommand( command ) {
if ( command === 'editLocation' ) { if ( command === 'editLocation' ) {

View File

@@ -91,6 +91,8 @@
methods: { methods: {
setActiveTicket ( id ) { setActiveTicket ( id ) {
sessionStorage.setItem( 'selectedTicket', 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 () { loadEvents () {
fetch( '/getAPI/getAllEvents' ).then( res => { fetch( '/getAPI/getAllEvents' ).then( res => {

View File

@@ -59,6 +59,7 @@
this.$router.push( '/tickets' ); this.$router.push( '/tickets' );
} }
this.eventID = sessionStorage.getItem( 'selectedTicket' ); this.eventID = sessionStorage.getItem( 'selectedTicket' );
this.hasSeatplan = sessionStorage.getItem( 'hasSeatplan' );
} }
}; };
</script> </script>