mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 21:34:24 +00:00
fix bug in seat plan loading
This commit is contained in:
@@ -145,6 +145,9 @@ export default {
|
||||
},
|
||||
startingRow() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
data () {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -137,6 +137,9 @@ export default {
|
||||
},
|
||||
origin() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
data () {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -148,6 +148,10 @@ export default {
|
||||
},
|
||||
startingRow() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
data () {
|
||||
console.log( 'data changed' );
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -116,16 +116,11 @@
|
||||
};
|
||||
|
||||
this.seatPlanInit();
|
||||
|
||||
window.addEventListener( 'visibilitychange', ( e ) => {
|
||||
this.seatPlanInit();
|
||||
}, 1 );
|
||||
},
|
||||
seatPlanInit () {
|
||||
// Load cart
|
||||
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};
|
||||
|
||||
|
||||
// Load seatplan from server
|
||||
let height = $( document ).height() * 0.8;
|
||||
this.scaleFactor = ( height / 900 ) * this.zoomFactor;
|
||||
@@ -133,15 +128,17 @@
|
||||
if ( res.status === 200 ) {
|
||||
res.json().then( data => {
|
||||
this.draggables = this.scaleUp( data.data );
|
||||
sessionStorage.setItem( 'seatplan', JSON.stringify( data.data ) );
|
||||
this.prepSeatplan();
|
||||
} );
|
||||
} else if ( res.status === 500 ) {
|
||||
if ( sessionStorage.getItem( 'seatplan' ) ) {
|
||||
this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) );
|
||||
this.prepSeatplan();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
},
|
||||
prepSeatplan () {
|
||||
// Mark all selected seats + all unavailable seats
|
||||
// { 'sector': 'A', 'sectorCount': 1, 'unavailableSeats': { 'secAr0s0': 'nav' }, 'categoryInfo': { 'pricing': { '1': { 'displayName': 'Adults - CHF 20.-', 'value': 'adult', 'price': 20 }, '2': { 'displayName': 'Child (0 - 15.99y) - CHF 15.-', 'value': 'child', 'price': 15 } } } }
|
||||
let categoryDetails = {};
|
||||
@@ -177,6 +174,10 @@
|
||||
|
||||
// TODO: Optimise for odd screen sizes and aspect ratios and fucking webkit
|
||||
sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) );
|
||||
|
||||
window.addEventListener( 'visibilitychange', ( e ) => {
|
||||
this.seatPlanInit();
|
||||
}, 1 );
|
||||
},
|
||||
eventHandler ( e ) {
|
||||
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
|
||||
@@ -248,6 +249,16 @@
|
||||
if ( sessionStorage.getItem( 'seatplan' ) ) {
|
||||
this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) );
|
||||
}
|
||||
|
||||
if ( this.cart[ this.event.name ] ) {
|
||||
let tickets = this.cart[ this.event.name ][ 'tickets' ];
|
||||
for ( let ticket in tickets ) {
|
||||
this.draggables[ tickets[ ticket ].comp ][ 'data' ][ 'unavailableSeats' ][ ticket ] = 'sel';
|
||||
}
|
||||
}
|
||||
|
||||
console.log( this.draggables );
|
||||
console.log( 'load' );
|
||||
},
|
||||
scaleUp ( valueArray ) {
|
||||
const allowedAttributes = [ 'w', 'h', 'x', 'y' ];
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<span class="material-symbols-outlined empty-cart">remove_shopping_cart</span>
|
||||
</div>
|
||||
</div>
|
||||
<popups ref="popups" size="normal" @data="data => { verifyTicketDelete( data.status ) }"></popups>
|
||||
<popups ref="popups" size="small" @data="data => { verifyTicketDelete( data.status ) }"></popups>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
this.$router.push( '/tickets' );
|
||||
}
|
||||
this.eventID = sessionStorage.getItem( 'selectedTicket' );
|
||||
if ( this.eventID == 'test2' ) {
|
||||
this.hasSeatplan = false;
|
||||
}
|
||||
// if ( this.eventID == 'test2' ) {
|
||||
// this.hasSeatplan = false;
|
||||
// }
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user