diff --git a/src/server/data/eventDrafts.json b/src/server/data/eventDrafts.json index ce755dd..bd719e5 100644 --- a/src/server/data/eventDrafts.json +++ b/src/server/data/eventDrafts.json @@ -1 +1 @@ -{"test4":{"name":"Test4Event","description":"Let's see what happens if I update the description, how fast it is reflected in the UI","location":"test2","date":"2023-10-30T10:00:00.000Z","categories":{"1":{"price":{"1":20,"2":30},"bg":"#ff0000","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test4","time":"10:00:00.000","startingPrice":20,"currency":"CHF","isDraft":true,"locationName":"TestLocation2","hasSeatplan":true,"totalSeats":353},"test3":{"name":"TestEvent3","description":"This is another test event, this time without seat plan","location":"test","date":"2023-11-25T19:00:00.000Z","categories":{"1":{"price":{"1":20,"2":25},"bg":"#FFFFFF","fg":"#000000","name":"Category 1","id":1,"ticketCount":50},"2":{"price":{"1":30,"2":35},"bg":"#FFFFFF","fg":"#000000","name":"Category 2","id":2,"ticketCount":50}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test3","time":"19:00:00.000","startingPrice":20,"currency":"CHF","locationName":"TestLocation","hasSeatplan":false,"totalSeats":100},"testStanding":{"name":"Standing Test event","description":"Teststsatahadsf","location":"testLocationNoSeatplan","date":"2023-11-25T10:00:00.000Z","categories":{"1":{"price":{"1":10,"2":15},"bg":"#FFFFFF","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"testStanding","time":"10:00:00.000","startingPrice":10,"currency":"CHF","locationName":"TestLocationWithoutSeatplan","hasSeatplan":true,"totalSeats":51}} \ No newline at end of file +{"test4":{"name":"Test4Event","description":"Let's see what happens if I update the description, how fast it is reflected in the UI","location":"test2","date":"2023-10-30T10:00:00.000Z","categories":{"1":{"price":{"1":20,"2":30},"bg":"#ff0000","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test4","time":"10:00:00.000","startingPrice":20,"currency":"CHF","isDraft":true,"locationName":"TestLocation2","hasSeatplan":true,"totalSeats":353},"test3":{"name":"TestEvent3","description":"This is another test event, this time without seat plan","location":"test","date":"2023-11-25T19:00:00.000Z","categories":{"1":{"price":{"1":20,"2":25},"bg":"#FFFFFF","fg":"#000000","name":"Category 1","id":1,"ticketCount":50},"2":{"price":{"1":30,"2":35},"bg":"#FFFFFF","fg":"#000000","name":"Category 2","id":2,"ticketCount":50}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test3","time":"19:00:00.000","startingPrice":20,"currency":"CHF","locationName":"TestLocation","hasSeatplan":false,"totalSeats":100},"testStanding":{"name":"Standing Test event","description":"Teststsatahadsf","location":"testLocationNoSeatplan","date":"2023-11-25T10:00:00.000Z","categories":{"1":{"price":{"1":10,"2":15},"bg":"#FFFFFF","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"testStanding","time":"10:00:00.000","startingPrice":10,"currency":"CHF","locationName":"TestLocationWithoutSeatplan","hasSeatplan":true,"totalSeats":51},"complexLocationTest":{"name":"Complex Location Testing","description":"asfoigup agsöjkhdf gasjklgadfslkj","location":"complexSeatplan","date":"2024-01-17T10:00:00.000Z","categories":{"1":{"price":{"1":10,"2":20},"bg":"#FFFFFF","fg":"#0040ff","name":"Category 1","id":"1","ticketCount":1},"2":{"price":{"1":20,"2":30},"bg":"#FFFFFF","fg":"#ff0000","name":"Category 2","id":2,"ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"complexLocationTest","time":"10:00:00.000","startingPrice":10,"currency":"CHF","locationName":"Complex Seat Plan","hasSeatplan":true,"totalSeats":246}} \ No newline at end of file diff --git a/src/server/data/events.json b/src/server/data/events.json index ce755dd..bd719e5 100644 --- a/src/server/data/events.json +++ b/src/server/data/events.json @@ -1 +1 @@ -{"test4":{"name":"Test4Event","description":"Let's see what happens if I update the description, how fast it is reflected in the UI","location":"test2","date":"2023-10-30T10:00:00.000Z","categories":{"1":{"price":{"1":20,"2":30},"bg":"#ff0000","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test4","time":"10:00:00.000","startingPrice":20,"currency":"CHF","isDraft":true,"locationName":"TestLocation2","hasSeatplan":true,"totalSeats":353},"test3":{"name":"TestEvent3","description":"This is another test event, this time without seat plan","location":"test","date":"2023-11-25T19:00:00.000Z","categories":{"1":{"price":{"1":20,"2":25},"bg":"#FFFFFF","fg":"#000000","name":"Category 1","id":1,"ticketCount":50},"2":{"price":{"1":30,"2":35},"bg":"#FFFFFF","fg":"#000000","name":"Category 2","id":2,"ticketCount":50}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test3","time":"19:00:00.000","startingPrice":20,"currency":"CHF","locationName":"TestLocation","hasSeatplan":false,"totalSeats":100},"testStanding":{"name":"Standing Test event","description":"Teststsatahadsf","location":"testLocationNoSeatplan","date":"2023-11-25T10:00:00.000Z","categories":{"1":{"price":{"1":10,"2":15},"bg":"#FFFFFF","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"testStanding","time":"10:00:00.000","startingPrice":10,"currency":"CHF","locationName":"TestLocationWithoutSeatplan","hasSeatplan":true,"totalSeats":51}} \ No newline at end of file +{"test4":{"name":"Test4Event","description":"Let's see what happens if I update the description, how fast it is reflected in the UI","location":"test2","date":"2023-10-30T10:00:00.000Z","categories":{"1":{"price":{"1":20,"2":30},"bg":"#ff0000","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test4","time":"10:00:00.000","startingPrice":20,"currency":"CHF","isDraft":true,"locationName":"TestLocation2","hasSeatplan":true,"totalSeats":353},"test3":{"name":"TestEvent3","description":"This is another test event, this time without seat plan","location":"test","date":"2023-11-25T19:00:00.000Z","categories":{"1":{"price":{"1":20,"2":25},"bg":"#FFFFFF","fg":"#000000","name":"Category 1","id":1,"ticketCount":50},"2":{"price":{"1":30,"2":35},"bg":"#FFFFFF","fg":"#000000","name":"Category 2","id":2,"ticketCount":50}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"test3","time":"19:00:00.000","startingPrice":20,"currency":"CHF","locationName":"TestLocation","hasSeatplan":false,"totalSeats":100},"testStanding":{"name":"Standing Test event","description":"Teststsatahadsf","location":"testLocationNoSeatplan","date":"2023-11-25T10:00:00.000Z","categories":{"1":{"price":{"1":10,"2":15},"bg":"#FFFFFF","fg":"#ff0000","name":"Category 1","id":"1","ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"testStanding","time":"10:00:00.000","startingPrice":10,"currency":"CHF","locationName":"TestLocationWithoutSeatplan","hasSeatplan":true,"totalSeats":51},"complexLocationTest":{"name":"Complex Location Testing","description":"asfoigup agsöjkhdf gasjklgadfslkj","location":"complexSeatplan","date":"2024-01-17T10:00:00.000Z","categories":{"1":{"price":{"1":10,"2":20},"bg":"#FFFFFF","fg":"#0040ff","name":"Category 1","id":"1","ticketCount":1},"2":{"price":{"1":20,"2":30},"bg":"#FFFFFF","fg":"#ff0000","name":"Category 2","id":2,"ticketCount":1}},"ageGroups":{"1":{"id":1,"name":"Child","age":"0 - 15.99"},"2":{"id":2,"name":"Adult"}},"maxTickets":0,"eventID":"complexLocationTest","time":"10:00:00.000","startingPrice":10,"currency":"CHF","locationName":"Complex Seat Plan","hasSeatplan":true,"totalSeats":246}} \ No newline at end of file diff --git a/src/server/data/locations.json b/src/server/data/locations.json index 57a0d73..b13cb14 100644 --- a/src/server/data/locations.json +++ b/src/server/data/locations.json @@ -1 +1 @@ -{"test2":{"locationID":"test2","name":"TestLocation2","seatplan-enabled":true,"totalSeats":352},"test":{"locationID":"test","name":"TestLocation","seatplan-enabled":false},"testLocationNoSeatplan":{"locationID":"testLocationNoSeatplan","name":"TestLocationWithoutSeatplan","seatplan-enabled":true,"totalSeats":50}} \ No newline at end of file +{"test2":{"locationID":"test2","name":"TestLocation2","seatplan-enabled":true,"totalSeats":352},"test":{"locationID":"test","name":"TestLocation","seatplan-enabled":false},"testLocationNoSeatplan":{"locationID":"testLocationNoSeatplan","name":"TestLocationWithoutSeatplan","seatplan-enabled":true,"totalSeats":50},"complexSeatplan":{"locationID":"complexSeatplan","name":"Complex Seat Plan","seatplan-enabled":true,"totalSeats":244}} \ No newline at end of file diff --git a/src/server/data/seatplan.json b/src/server/data/seatplan.json index 2865414..f42b98d 100644 --- a/src/server/data/seatplan.json +++ b/src/server/data/seatplan.json @@ -1 +1 @@ -{"test2":{"draft":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":352},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.007,"y":660.033,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.721,"y":669.847,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}},"save":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":0},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.375,"y":660.049,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.828,"y":670.99,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}}},"test":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":22}},"count":0},"data":{"1":{"x":427.696,"y":160.539,"h":371.324,"w":734.069,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}},"testLocationNoSeatplan":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":13,"1":13,"2":13,"3":13,"4":13,"startingRow":1}},"count":50},"data":{"1":{"x":370.138,"y":164.1,"h":288.088,"w":745.746,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}}} \ No newline at end of file +{"test2":{"draft":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":352},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.007,"y":660.033,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.721,"y":669.847,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}},"save":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":0},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.375,"y":660.049,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.828,"y":670.99,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}}},"test":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":22}},"count":0},"data":{"1":{"x":427.696,"y":160.539,"h":371.324,"w":734.069,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}},"testLocationNoSeatplan":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":13,"1":13,"2":13,"3":13,"4":13,"startingRow":1}},"count":50},"data":{"1":{"x":370.138,"y":164.1,"h":288.088,"w":745.746,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}},"complexSeatplan":{"draft":{},"save":{"seatInfo":{"details":{"1":{"0":14,"1":14,"2":14,"3":14,"4":14,"5":14,"6":14,"7":14,"startingRow":1},"2":{"1":1,"2":3,"3":4,"4":6,"5":7,"6":9,"7":10,"8":12,"startingRow":1},"3":{"1":2,"2":4,"3":6,"4":8,"5":10,"6":12,"startingRow":1},"4":{"0":9,"1":9,"2":9,"startingRow":1}},"count":244,"data":{"A":{"1":{"1":2,"2":4,"3":6,"4":8,"5":10,"6":12,"startingRow":1},"2":{"0":14,"1":14,"2":14,"3":14,"4":14,"5":14,"6":14,"7":14,"startingRow":1},"3":{"1":1,"2":3,"3":4,"4":6,"5":7,"6":9,"7":10,"8":12,"startingRow":1},"4":{"0":9,"1":9,"2":9,"startingRow":1}}}},"data":{"1":{"x":576.031,"y":148.84,"h":284.149,"w":477.448,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":1038.015,"y":162.371,"h":299.613,"w":591.495,"active":false,"draggable":true,"resizable":true,"id":2,"origin":1,"shape":"circular","type":"seat","startingRow":1,"seatNumberingPosition":3,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":262.887,"y":137.242,"h":324.742,"w":318.943,"active":false,"draggable":true,"resizable":true,"id":3,"origin":2,"shape":"trapezoid","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"4":{"x":715.206,"y":606.959,"h":121.778,"w":305.412,"active":false,"draggable":true,"resizable":true,"id":4,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":4,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"2"}}}}} \ No newline at end of file diff --git a/src/webapp/main/src/components/seatplan/editor/window.vue b/src/webapp/main/src/components/seatplan/editor/window.vue index 80d187a..6096469 100644 --- a/src/webapp/main/src/components/seatplan/editor/window.vue +++ b/src/webapp/main/src/components/seatplan/editor/window.vue @@ -82,7 +82,7 @@ zoomFactor: 1, historyPos: 0, generalSettings: { 'namingScheme': 'numeric' }, - seatCountInfo: { 'data': {}, 'count': 0 }, + seatCountInfo: { 'details': {}, 'count': 0 }, autoSave: null, } }, @@ -317,7 +317,10 @@ sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) ); }, saveDraft () { - this.getSeatCount(); + if ( !this.getSeatCount() ) { + this.$refs.notification.createNotification( 'Collision of seat count!', 10, 'error', 'normal' ); + return; + } let progressNotification = this.$refs.notification.createNotification( 'Saving as draft', 5, 'progress', 'normal' ); sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) ); const options = { @@ -342,7 +345,10 @@ // TODO: add warning if no component has a seat start point if any component is a seat component }, deploy () { - this.getSeatCount(); + if ( !this.getSeatCount() ) { + this.$refs.notification.createNotification( 'Collision of seat count!', 10, 'error', 'normal' ); + return; + } let deployNotification = this.$refs.notification.createNotification( 'Deploying...', 5, 'progress', 'normal' ); const options = { method: 'post', @@ -412,8 +418,8 @@ } }, handleSeatCountInfo ( info ) { - this.seatCountInfo[ 'data' ][ info.id ] = info.data; - this.seatCountInfo[ 'data' ][ info.id ][ 'startingRow' ] = this.draggables[ info.id ].startingRow; + this.seatCountInfo[ 'details' ][ info.id ] = info.data; + this.seatCountInfo[ 'details' ][ info.id ][ 'startingRow' ] = this.draggables[ info.id ].startingRow; }, getSeatCount () { this.seatCountInfo[ 'count' ] = document.getElementsByClassName( 'seats' ).length; @@ -422,6 +428,16 @@ this.seatCountInfo[ 'count' ] += this.draggables[ draggable ][ 'ticketCount' ]; } } + // Remap seat count info + this.seatCountInfo[ 'data' ] = {}; + for ( let element in this.seatCountInfo[ 'details' ] ) { + if ( !this.seatCountInfo[ 'data' ][ this.draggables[ 1 ].sector ] ) { + this.seatCountInfo[ 'data' ][ this.draggables[ 1 ].sector ] = {}; + } + if ( this.seatCountInfo[ 'data' ][ this.draggables[ 1 ].sector ][ this.draggables[ element ].seatNumberingPosition ] ) return false; + this.seatCountInfo[ 'data' ][ this.draggables[ 1 ].sector ][ this.draggables[ element ].seatNumberingPosition ] = this.seatCountInfo[ 'details' ][ element ]; + } + return true; }, }, created () { diff --git a/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/circular.vue b/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/circular.vue index 51d1ffd..fa44b0a 100644 --- a/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/circular.vue +++ b/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/circular.vue @@ -70,6 +70,17 @@ export default { calculateChairs () { // Size of seat at scale 1 is 32px // w & h are normalised + console.log( this.data.seatInfo ); + 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.round( this.w / this.scaleFactor ); let h = Math.round( this.h / this.scaleFactor ); const size = 33; @@ -79,17 +90,25 @@ export default { let nn = row * ( Math.PI / 2 ); let r = row * size; this.seats[ row ] = {}; - for ( let n = 0; n < nn; 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 + ', Seat ' + ( n + 1 ), 'status': 'av', 'row': row, 'seat': n }; + for ( let n = ( offsets[ row ] ?? 0 ); n < ( nn + ( offsets[ row ] ?? 0 ) ); n++ ) { + const seatNumber = this.data.numberingDirection === 'right' ? ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ) - n: n; + this.seats[ row ][ n ] = { + 'style': '', + 'id': 'comp' + this.id + 'sec' + this.data.sector + 'r' + row + 's' + seatNumber, + 'displayName': ( this.data.sectorCount > 1 ? 'Sector ' + this.data.sector + ', ' : '' ) + 'Row ' + row + ', Seat ' + ( seatNumber + 1 ), + 'status': 'av', + 'row': row, + 'seat': n + }; let phi = n * size / ( row * size ); if ( this.origin === 1 ) { - this.seats[ row ][ n ][ 'style' ] = `bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi }rad`; + this.seats[ row ][ n ][ 'style' ] = `bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi }rad;`; } else if ( this.origin === 2 ) { - this.seats[ row ][ n ][ 'style' ] = `bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - phi }rad`; + this.seats[ row ][ n ][ 'style' ] = `bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - phi }rad;`; } else if ( this.origin === 3 ) { - this.seats[ row ][ n ][ 'style' ] = `top: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi + Math.PI }rad`; + this.seats[ row ][ n ][ 'style' ] = `top: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi + Math.PI }rad;`; } else if ( this.origin === 4 ) { - this.seats[ row ][ n ][ 'style' ] = `top: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI - phi }rad`; + this.seats[ row ][ n ][ 'style' ] = `top: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI - phi }rad;`; } this.seats[ row ][ n ][ 'scaling' ] = `font-size: ${this.scaleFactor * 200}%; `; if ( this.data.categoryInfo.color ) { 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 755d1bf..81cf026 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,7 +74,6 @@ export default { calculateChairs () { // Size of seat at scale 1 is 32px // w & h are normalised - // TODO: Numbering direction let offsets = {}; if ( this.data.seatInfo ) { for ( let element in this.data.seatInfo.data ) { @@ -92,7 +91,15 @@ export default { for ( let row = 0; row < Math.floor( h / size ); row++ ) { this.seats[ row ] = {}; 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 }; + const seatNumber = this.data.numberingDirection === 'right' ? ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ) - n: n; + this.seats[ row ][ n ] = { + 'style': '', + 'id': 'comp' + this.id + 'sec' + this.data.sector + 'r' + row + 's' + seatNumber, + 'displayName': ( this.data.sectorCount > 1 ? 'Sector ' + this.data.sector + ', ' : '' ) + 'Row ' + ( row + 1 ) + ', Seat ' + ( seatNumber + 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;`; } else if ( this.origin === 2 ) { diff --git a/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/trapezoid.vue b/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/trapezoid.vue index 968998f..2e5c18d 100644 --- a/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/trapezoid.vue +++ b/src/webapp/main/src/components/seatplan/userApp/seatplanComponents/seats/trapezoid.vue @@ -70,6 +70,17 @@ export default { calculateChairs () { // Size of seat at scale 1 is 32px // w & h are normalised + // TODO: update to new algorithm + 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.round( this.w / this.scaleFactor ); let h = Math.round( this.h / this.scaleFactor ); const size = 33; @@ -82,17 +93,25 @@ export default { for ( let row = this.startingRow; row < count; row++ ) { let nn = 2 + ( row - 1 ) * 2; this.seats[ row ] = {}; - for ( let n = 0; n < nn; 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 + ', Seat ' + ( n + 1 ), 'status': 'av', 'row': row, 'seat': n }; + for ( let n = ( offsets[ row ] ?? 0 ); n < ( nn + ( offsets[ row ] ?? 0 ) ); n++ ) { + const seatNumber = this.data.numberingDirection === 'right' ? ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ) - n: n; + this.seats[ row ][ n ] = { + 'style': '', + 'id': 'comp' + this.id + 'sec' + this.data.sector + 'r' + row + 's' + seatNumber, + 'displayName': ( this.data.sectorCount > 1 ? 'Sector ' + this.data.sector + ', ' : '' ) + 'Row ' + row + ', Seat ' + ( seatNumber + 1 ), + 'status': 'av', + 'row': row, + 'seat': n + }; let side = n * sideOffset; if ( this.origin === 1 ) { - this.seats[ row ][ n ][ 'style' ] = `bottom: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle }rad`; + this.seats[ row ][ n ][ 'style' ] = `bottom: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle }rad;`; } else if ( this.origin === 2 ) { - this.seats[ row ][ n ][ 'style' ] = `bottom: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - angle }rad`; + this.seats[ row ][ n ][ 'style' ] = `bottom: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - angle }rad;`; } else if ( this.origin === 3 ) { - this.seats[ row ][ n ][ 'style' ] = `top: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle + Math.PI }rad`; + this.seats[ row ][ n ][ 'style' ] = `top: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle + Math.PI }rad;`; } else if ( this.origin === 4 ) { - this.seats[ row ][ n ][ 'style' ] = `top: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI - angle }rad`; + this.seats[ row ][ n ][ 'style' ] = `top: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI - angle }rad;`; } this.seats[ row ][ n ][ 'scaling' ] = `font-size: ${this.scaleFactor * 200}%; `; diff --git a/src/webapp/main/src/views/admin/LocationsView.vue b/src/webapp/main/src/views/admin/LocationsView.vue index cded6c7..098c686 100644 --- a/src/webapp/main/src/views/admin/LocationsView.vue +++ b/src/webapp/main/src/views/admin/LocationsView.vue @@ -10,7 +10,7 @@