diff --git a/src/server/admin/adminAPIRoutes.js b/src/server/admin/adminAPIRoutes.js
index ba4154c..31809e6 100644
--- a/src/server/admin/adminAPIRoutes.js
+++ b/src/server/admin/adminAPIRoutes.js
@@ -22,7 +22,7 @@ module.exports = ( app ) => {
getHandler.handleCall( req.params.call, req.query ).then( data => {
res.send( data );
} ).catch( error => {
- res.status( 500 ).send( error );
+ res.status( error.code ).send( error.error );
} );
} else {
res.status( 403 ).sendFile( path.join( __dirname + '/../ui/' + ( req.query.lang ?? 'en' ) + '/errors/403.html' ) );
@@ -34,7 +34,7 @@ module.exports = ( app ) => {
postHandler.handleCall( req.params.call, req.body, req.query.lang ).then( data => {
res.send( data );
} ).catch( error => {
- res.status( 500 ).send( error );
+ res.status( error.code ).send( error.error );
} );
} else {
res.status( 403 ).sendFile( path.join( __dirname + '/../ui/' + ( req.query.lang ?? 'en' ) + '/errors/403.html' ) );
diff --git a/src/server/admin/api/getHandler.js b/src/server/admin/api/getHandler.js
index 33f6b0c..9e8c648 100644
--- a/src/server/admin/api/getHandler.js
+++ b/src/server/admin/api/getHandler.js
@@ -21,10 +21,10 @@ class GETHandler {
if ( Object.keys( data ).length > 0 ) {
resolve( data[ 'save' ] );
} else {
- reject( 'No data found for this location' );
+ reject( { 'code': 400, 'error': 'No data found for this location' } );
}
} ).catch( error => {
- reject( error );
+ reject( { 'code': 500, 'error': error } );
} );
} else if ( call === 'getSeatplanDraft' ) {
db.getJSONDataSimple( 'seatplan', query.location ).then( data => {
@@ -35,11 +35,19 @@ class GETHandler {
resolve( data[ 'save' ] );
}
} else {
- reject( 'No data found for this location' );
+ reject( { 'code': 400, 'error': 'No data found for this location' } );
}
} ).catch( error => {
reject( error );
} );
+ } else if ( call === 'getLocations' ) {
+ db.getJSONData( 'locations' ).then( data => {
+ resolve( data );
+ } ).catch( error => {
+ reject( { 'code': 500, 'error': error } );
+ } );
+ } else {
+ reject( { 'code': 404, 'error': 'Route not found' } );
}
} );
}
diff --git a/src/server/admin/api/postHandler.js b/src/server/admin/api/postHandler.js
index 94da952..a1012a2 100644
--- a/src/server/admin/api/postHandler.js
+++ b/src/server/admin/api/postHandler.js
@@ -24,15 +24,38 @@ class POSTHandler {
db.writeJSONDataSimple( 'seatplan', data.location, dat ).then( resp => {
resolve( resp );
} ).catch( error => {
- reject( error );
+ reject( { 'code': 500, 'error': error } );
} );
} );
} else if ( call === 'saveSeatplan' ) {
db.writeJSONDataSimple( 'seatplan', data.location, { 'draft': {}, 'save': data.data } ).then( resp => {
resolve( resp );
} ).catch( error => {
- reject( error );
+ reject( { 'code': 500, 'error': error } );
} );
+ } else if ( call === 'saveLocations' ) {
+ db.getJSONData( 'seatplan' ).then( res => {
+ let dat = res;
+ for ( let loc in data.updated ) {
+ if ( res[ loc ] ) {
+ dat[ data.updated[ loc ] ] = res[ loc ];
+ delete dat[ loc ];
+ }
+ }
+ db.writeJSONData( 'seatplan', dat ).catch( error => {
+ reject( { 'code': 500, 'error': error } );
+ } );
+ } ).catch( error => {
+ reject( { 'code': 500, 'error': error } );
+ } );
+
+ db.writeJSONData( 'locations', data.data ).then( resp => {
+ resolve( resp );
+ } ).catch( error => {
+ reject( { 'code': 500, 'error': error } );
+ } );
+ } else {
+ reject( { 'code': 404, 'error': 'Route not found' } );
}
} );
}
diff --git a/src/server/backend/db/data/locations.json b/src/server/backend/db/data/locations.json
new file mode 100644
index 0000000..055c4f0
--- /dev/null
+++ b/src/server/backend/db/data/locations.json
@@ -0,0 +1 @@
+{"test2":{"locationID":"test2","name":"TestLocation2","seatplan-enabled":true},"test":{"locationID":"test","name":"TestLocation","seatplan-enabled":true}}
\ No newline at end of file
diff --git a/src/webapp/main/src/components/notifications/popups.vue b/src/webapp/main/src/components/notifications/popups.vue
index 330346c..b516e2f 100644
--- a/src/webapp/main/src/components/notifications/popups.vue
+++ b/src/webapp/main/src/components/notifications/popups.vue
@@ -15,7 +15,7 @@
{{ data.message }}
-
+
@@ -121,6 +121,17 @@
this.data[ 'selected' ] = data;
this.closePopup( message );
},
+ submitSettings () {
+ $( '#popup-backdrop' ).fadeOut( 300 );
+ const dat = this.data.options;
+ let ret = {};
+ for ( let setting in dat ) {
+ if ( dat[ setting ][ 'type' ] !== 'link' ) {
+ ret[ setting ] = dat[ setting ][ 'value' ];
+ }
+ }
+ this.$emit( 'data', { 'data': ret, 'status': 'settings' } );
+ },
openPopup ( message, options, dataType, selected ) {
this.data = { 'message': message ?? 'No message defined on method call!!', 'options': options ?? { '1': { 'value': 'undefined', 'displayName': 'No options specified in call' } }, 'selected': selected ?? '' };
this.contentType = dataType ?? 'string';
diff --git a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue
index 4327637..ac080a8 100644
--- a/src/webapp/main/src/components/seatplan/userApp/userWindow.vue
+++ b/src/webapp/main/src/components/seatplan/userApp/userWindow.vue
@@ -79,7 +79,7 @@
data() {
return {
draggables: { 1: { 'x': 100, 'y':100, 'h': 100, 'w': 250, 'active': false, 'draggable': true, 'resizable': true, 'id': 1, 'origin': 1, 'shape':'rectangular', 'type': 'seat', 'startingRow': 1, 'seatCountingStartingPoint': 1, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' }, 'ticketCount': 1, 'category': 1 } },
- event: { 'name': 'TestEvent2', 'location': 'TestLocation2', 'date': '2023-07-15', 'RoomName': 'TestRoom2', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white', 'name': 'Category 2' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99' }, '2':{ 'id': 2, 'name': 'Adult' } }, 'maxTickets': 2 },
+ event: { 'name': 'TestEvent2', 'location': 'TestLocation2', 'date': '2023-07-15', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white', 'name': 'Category 2' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99' }, '2':{ 'id': 2, 'name': 'Adult' } }, 'maxTickets': 2 },
available: { 'redo': false, 'undo': false },
scaleFactor: 1,
sizePoll: null,
diff --git a/src/webapp/main/src/views/admin/LocationsView.vue b/src/webapp/main/src/views/admin/LocationsView.vue
index be754fe..7958f2d 100644
--- a/src/webapp/main/src/views/admin/LocationsView.vue
+++ b/src/webapp/main/src/views/admin/LocationsView.vue
@@ -15,9 +15,9 @@
-
-
+
{ e.preventDefault(); openRightClickMenu( location.locationID, e ); }">
-
{{ location.name }}
+
{{ location.locationID }} ({{ location.name }})
This location has a seatplan.
This location has NO seatplan.
@@ -28,39 +28,54 @@
No locations configured, please add one
-
-
+
{
+ handleData( data );
+ }">
+
{ executeCommand( command ) }">
@@ -149,4 +227,8 @@
margin-right: auto;
max-width: 35%;
}
+
+ .no-location-hint {
+ margin-top: 5%;
+ }
diff --git a/src/webapp/main/src/views/admin/events/EventsDetailsView.vue b/src/webapp/main/src/views/admin/events/EventsDetailsView.vue
index dbe1307..3332b1f 100644
--- a/src/webapp/main/src/views/admin/events/EventsDetailsView.vue
+++ b/src/webapp/main/src/views/admin/events/EventsDetailsView.vue
@@ -16,11 +16,12 @@
| Event location |
-
+ |
|
+ No locations configured yet. Configure one here |
| Event date |
@@ -38,12 +39,12 @@
{{ category.name }}
-
+
|
- {{ price.name }}:
+ {{ ageGroup.name }} ({{ ageGroup.age }}) :
|
-
+
|
@@ -118,10 +119,18 @@
this.$router.push( '/admin/events' );
}
this.eventID = sessionStorage.getItem( 'selectedTicket' );
+ fetch( localStorage.getItem( 'url' ) + '/admin/getAPI/getLocations' ).then( res => {
+ res.json().then( data => {
+ this.locations = data;
+ } ).catch( error => {
+ console.error( error );
+ } );
+ } );
},
data() {
return {
- event: { 'name': 'TestEvent', 'description': 'This is a description for the TestEvent to test multiline support and proper positioning of the Fields', 'freeSeats': 2, 'maxSeats': 2, 'date':'TestDate', 'startingPrice':15, 'location': 'TestLocation', 'eventID': 'test', 'currency': 'CHF', 'logo': 'logo.png', 'categories': { '1': { 'price': { '1': { 'price':25, 'name':'Child (0-15.99 years)'}, '2': { 'price':35, 'name':'Adult'} }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1': { 'price':25, 'name':'Child (0-15.99 years)' }, '2': { 'price':35, 'name':'Adult'} }, 'bg': 'green', 'fg': 'white', 'name': 'Category 2' } } },
+ locations: {},
+ event: { 'name': 'TestEvent', 'description': 'This is a description for the TestEvent to test multiline support and proper positioning of the Fields', 'location': 'test', 'date': '2023-07-15', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white', 'name': 'Category 2' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99' }, '2':{ 'id': 2, 'name': 'Adult' } }, 'maxTickets': 2 },
specialSettings: {
'currency': {
'display': 'Currency',
diff --git a/src/webapp/main/src/views/admin/locations/LocationEditView.vue b/src/webapp/main/src/views/admin/locations/LocationEditView.vue
deleted file mode 100644
index 05066f1..0000000
--- a/src/webapp/main/src/views/admin/locations/LocationEditView.vue
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-
{{ event.name }}
-
-
-
{ popupReturnHandling( event ) }">
-
-
-
-
-
-
-
-