Optimise seat chooser

This commit is contained in:
2023-07-07 21:11:49 +02:00
parent 2e0c9c49b5
commit 775a91351a
2 changed files with 12 additions and 15 deletions

View File

@@ -3,8 +3,8 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vite", "serve": "vite --host",
"preview": "vite preview", "preview": "vite preview --host",
"build": "vite build" "build": "vite build"
}, },
"dependencies": { "dependencies": {

View File

@@ -117,7 +117,7 @@
this.loadSeatplan(); this.loadSeatplan();
sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) ); sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) );
// TODO: remove scaleDown function again once backend is up // TODO: remove scaleDown function again once backend is up
// TODO: Optimise for odd screen sizes and aspect ratios // TODO: Optimise for odd screen sizes and aspect ratios and fucking webkit
}, },
eventHandler ( e ) { eventHandler ( e ) {
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) { if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
@@ -191,20 +191,17 @@
this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) ); this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) );
} }
for ( let element in this.draggables ) { // TODO: Check if all seats are available
if ( this.draggables[ element ].active ) { let allSeatsAvailable = true;
this.draggables[ element ].active = false; // Method: Server sends all user selected seats + all selected seats. If seat is in both
} // then selected, if just in all selected, taken, else available.
}
// Check if all seats are available
// TODO: delay call
let allSeatsAvailable = false;
let self = this; let self = this;
setTimeout( () => {
if ( !allSeatsAvailable ) { if ( !allSeatsAvailable ) {
setTimeout( () => {
self.$refs.popups.openPopup( 'We are sorry to tell you that since the last time the seat plan was refreshed, one or more of the seats you have selected has/have been taken.', {}, 'string' ); self.$refs.popups.openPopup( 'We are sorry to tell you that since the last time the seat plan was refreshed, one or more of the seats you have selected has/have been taken.', {}, 'string' );
}
}, 500 ); }, 500 );
}
}, },
scaleUp ( valueArray ) { scaleUp ( valueArray ) {
const allowedAttributes = [ 'w', 'h', 'x', 'y' ]; const allowedAttributes = [ 'w', 'h', 'x', 'y' ];