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 () {
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();
}
}
</script>

View File

@@ -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();
}
}
} );
},

View File

@@ -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' ) {

View File

@@ -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 => {

View File

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