From 7eaa81ba14344a511521e0fd5159e3edd8660e2c Mon Sep 17 00:00:00 2001 From: janis Date: Tue, 19 Sep 2023 11:10:11 +0200 Subject: [PATCH] seat numbering algorithm progress --- .../seatplanComponents/seats/rectangular.vue | 15 +++++++++++---- .../components/seatplan/userApp/userWindow.vue | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/rectangular.vue b/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/rectangular.vue index 6e897bc..236c9ce 100644 --- a/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/rectangular.vue +++ b/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/rectangular.vue @@ -74,16 +74,23 @@ export default { calculateChairs () { // Size of seat at scale 1 is 32px // w & h are normalised - // TODO: numbering and numbering direction - // TODO: get component number and numbering direction as well - console.log( this.data ); + let offsets = {}; + if ( this.data.seatInfo ) { + for ( let element in this.data.seatInfo.data ) { + if ( this.data.seatInfo.data[ element ] > this.data.seatNumbering ) { + for ( let row in this.data.seatInfo.data[ element ] ) { + offsets[ row ] += this.data.seatInfo.data[ element ][ row ]; + } + } + } + } let w = Math.floor( this.w / this.scaleFactor ); let h = Math.floor( this.h / this.scaleFactor ); const size = 33; this.seats = {}; for ( let row = 0; row < Math.floor( h / size ); row++ ) { this.seats[ row ] = {}; - for ( let n = 0; n < Math.floor( w / size ); n++ ) { + for ( let n = ( offsets[ row ] ?? 0 ); n < ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ); n++ ) { this.seats[ row ][ n ] = { 'style': '', 'id': 'sec' + this.data.sector + 'r' + row + 's' + n, 'displayName': ( this.data.sectorCount > 1 ? 'Sector ' + this.data.sector + ', ' : '' ) + 'Row ' + ( row + 1 ) + ', Seat ' + ( n + 1 ), 'status': 'av', 'row': row, 'seat': n }; if ( this.origin === 1 ) { this.seats[ row ][ n ][ 'style' ] = `bottom: ${ row * size * this.scaleFactor }px; left: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;`; diff --git a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue index 2c30381..3781a5e 100644 --- a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue +++ b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue @@ -165,6 +165,8 @@ 'color': this.event.categories[ this.draggables[ element ][ 'category' ] ][ 'fg' ] }, 'seatInfo': seatInfo, + 'seatNumbering': this.draggables[ element ].seatNumberingPosition, + 'numberingDirection': this.draggables[ element ].numberingDirection, }; }