From 775a91351a365ea0a17bfab92fe0de0e2a97e2a9 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 7 Jul 2023 21:11:49 +0200 Subject: [PATCH] Optimise seat chooser --- src/webapp/package.json | 4 ++-- .../seatplan/userApp/userWindow.vue | 23 ++++++++----------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/webapp/package.json b/src/webapp/package.json index f52d8c8..8fa9fe3 100644 --- a/src/webapp/package.json +++ b/src/webapp/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "private": true, "scripts": { - "serve": "vite", - "preview": "vite preview", + "serve": "vite --host", + "preview": "vite preview --host", "build": "vite build" }, "dependencies": { diff --git a/src/webapp/src/components/seatplan/userApp/userWindow.vue b/src/webapp/src/components/seatplan/userApp/userWindow.vue index 662df12..74b203d 100644 --- a/src/webapp/src/components/seatplan/userApp/userWindow.vue +++ b/src/webapp/src/components/seatplan/userApp/userWindow.vue @@ -117,7 +117,7 @@ this.loadSeatplan(); sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) ); // 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 ) { if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) { @@ -191,20 +191,17 @@ this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) ); } - for ( let element in this.draggables ) { - if ( this.draggables[ element ].active ) { - this.draggables[ element ].active = false; - } - } - // Check if all seats are available - // TODO: delay call - let allSeatsAvailable = false; + // TODO: Check if all seats are available + let allSeatsAvailable = true; + // 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. + 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' ); - } - }, 500 ); + }, 500 ); + } }, scaleUp ( valueArray ) { const allowedAttributes = [ 'w', 'h', 'x', 'y' ];