diff --git a/src/webapp/main/src/components/noseatplan.vue b/src/webapp/main/src/components/noseatplan.vue index 48cc965..b1a6aad 100644 --- a/src/webapp/main/src/components/noseatplan.vue +++ b/src/webapp/main/src/components/noseatplan.vue @@ -105,6 +105,9 @@ export default { } }, created () { + window.addEventListener( 'visibilitychange', ( e ) => { + this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; + }, 1 ); this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; // this.loadTickets(); } diff --git a/src/webapp/main/src/components/notifications/popups.vue b/src/webapp/main/src/components/notifications/popups.vue index eddc51b..330346c 100644 --- a/src/webapp/main/src/components/notifications/popups.vue +++ b/src/webapp/main/src/components/notifications/popups.vue @@ -6,7 +6,7 @@

{{ data.message }}

-
+
@@ -14,14 +14,14 @@

{{ data.message }}

-
+

{{ data.message }}

-
+
@@ -31,7 +31,7 @@ -
+
@@ -59,7 +59,7 @@ -
+
@@ -151,6 +151,15 @@ flex-direction: column; } + .button-wrapper { + width: 100%; + margin-top: 3%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: row; + } + .close-wrapper { width: 100%; height: 5%; diff --git a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue index 01b6dd0..b550f73 100644 --- a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue +++ b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue @@ -115,6 +115,13 @@ } }; + this.seatPlanInit(); + + window.addEventListener( 'visibilitychange', ( e ) => { + this.seatPlanInit(); + }, 1 ); + }, + seatPlanInit () { // Load cart this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; @@ -314,10 +321,16 @@ const d = this.draggables[ id ]; const evG = this.event.ageGroups; let count = {}; - for ( let ageGroup in evG ) { - if ( this.cart[ 'ticket' + id + '_' + ageGroup ] ) { - count[ ageGroup ] = this.cart[ 'ticket' + id + '_' + ageGroup ].count; - } else { + if ( this.cart[ this.event.name ] ) { + for ( let ageGroup in evG ) { + if ( this.cart[ this.event.name ][ 'tickets' ][ 'ticket' + id + '_' + ageGroup ] ) { + count[ ageGroup ] = this.cart[ this.event.name ][ 'tickets' ][ 'ticket' + id + '_' + ageGroup ].count; + } else { + count[ ageGroup ] = 0; + } + } + } else { + for ( let ageGroup in evG ) { count[ ageGroup ] = 0; } } @@ -332,7 +345,26 @@ }, 'tickets' ); }, standingTicketHandling ( data ) { - console.log( data ); + if ( !this.cart[ this.event.name ] ) { + this.cart[ this.event.name ] = { 'displayName': this.event.name, 'tickets': {} }; + } + + for ( let group in data.data ) { + if ( !this.cart[ this.event.name ][ 'tickets' ][ 'ticket' + data.component + '_' + group ] ) { + if ( data.data[ group ] > 0 ) { + this.cart[ this.event.name ][ 'tickets' ][ 'ticket' + data.component + '_' + group ] = { 'displayName': 'Ticket ' + data.component + ' (' + this.event.ageGroups[ group ].name + ')', 'price': this.event.categories[ this.draggables[ data.component ].category ].price[ group ], 'id': 'ticket' + data.component + '_' + group, 'count': data.data[ group ], 'comp': data.component }; + } else { + delete this.cart[ this.event.name ][ 'tickets' ][ 'ticket' + data.component + '_' + group ]; + } + } + } + + if ( Object.keys( this.cart[ this.event.name ][ 'tickets' ] ).length < 1 ) { + delete this.cart[ this.event.name ]; + } + + this.$refs.cart.calculateTotal(); + localStorage.setItem( 'cart', JSON.stringify( this.cart ) ); } }, created () { diff --git a/src/webapp/main/src/views/purchasing/CartView.vue b/src/webapp/main/src/views/purchasing/CartView.vue index 5d8a9cd..ddf3312 100644 --- a/src/webapp/main/src/views/purchasing/CartView.vue +++ b/src/webapp/main/src/views/purchasing/CartView.vue @@ -130,6 +130,10 @@ }, }, created () { + window.addEventListener( 'visibilitychange', ( e ) => { + this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; + this.calculateTotal(); + }, 1 ); this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; this.calculateTotal(); } diff --git a/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue b/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue index 784fd8e..7159464 100644 --- a/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue +++ b/src/webapp/main/src/views/purchasing/TicketsOrderingView.vue @@ -42,9 +42,9 @@ this.$router.push( '/tickets' ); } this.eventID = sessionStorage.getItem( 'selectedTicket' ); - // if ( this.eventID == 'test' ) { - // this.hasSeatplan = false; - // } + if ( this.eventID == 'test2' ) { + this.hasSeatplan = false; + } } }; diff --git a/src/webapp/main/src/views/user/LoginView.vue b/src/webapp/main/src/views/user/LoginView.vue index 72957cb..f8f1ec0 100644 --- a/src/webapp/main/src/views/user/LoginView.vue +++ b/src/webapp/main/src/views/user/LoginView.vue @@ -58,7 +58,7 @@ res.json().then( json => { if ( json.status === 'ok' ) { this.userStore.setUserAuth( true ); - this.$router.push( sessionStorage.getItem( 'redirect' ) ? sessionStorage.getItem( 'redirect' ) : '/account' ); + this.$router.push( sessionStorage.getItem( 'redirect' ) ?? '/account' ); sessionStorage.removeItem( 'redirect' ); } else if ( json.status === '2fa' ) { this.userStore.setUser2fa( true ); diff --git a/src/webapp/main/src/views/user/TwoFA.vue b/src/webapp/main/src/views/user/TwoFA.vue index e1a800a..51640aa 100644 --- a/src/webapp/main/src/views/user/TwoFA.vue +++ b/src/webapp/main/src/views/user/TwoFA.vue @@ -5,8 +5,8 @@

Open the link in the email and enter this code:

-
{{ code[1] }}
-
{{ code[2] }}
+
{{ code[ 1 ] }}
+
{{ code[ 2 ] }}
@@ -42,8 +42,7 @@ source.onmessage = ( e ) => { if ( e.data === 'authenticated' ) { self.userStore.setUserAuth( true ); - self.$router.push( '/account' ); - console.log( e.data ); + self.$router.push( sessionStorage.getItem( 'redirect' ) ?? '/account' ); } } @@ -52,11 +51,10 @@ self.$refs.notification.cancelNotification( startNotification ); }; - source.addEventListener( 'error', function(e) { - if (e.eventPhase == EventSource.CLOSED) source.close(); + source.addEventListener( 'error', function( e ) { + if ( e.eventPhase == EventSource.CLOSED ) source.close(); - if (e.target.readyState == EventSource.CLOSED) { - console.log( e ); + if ( e.target.readyState == EventSource.CLOSED ) { self.$refs.notification.cancelNotification( startNotification ); self.$refs.notification.createNotification( 'Could not connect to status service', 5, 'error', 'normal' ); }