From fc030bd56e28347ab378b028bba340f94dd83d72 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sat, 1 Jul 2023 15:11:58 +0200 Subject: [PATCH] lots of progress --- src/webapp/notes.md | 10 +- src/webapp/src/App.vue | 4 +- src/webapp/src/components/noseatplan.vue | 22 +- .../components/seatplan/editor/properties.vue | 4 +- .../src/components/seatplan/editor/window.vue | 21 +- .../src/components/seatplan/newSeatplan.vue | 17 -- .../seatplanComponents/seats/circular.vue | 9 +- .../seatplanComponents/seats/rectangular.vue | 6 + .../seatplanComponents/seats/trapezoid.vue | 7 + .../seatplan/userApp/userWindow.vue | 251 ++++++++++++++++++ src/webapp/src/stores/userStore.js | 2 +- src/webapp/src/views/admin/AdminView.vue | 14 +- src/webapp/src/views/admin/LocationsView.vue | 30 ++- src/webapp/src/views/admin/SettingsView.vue | 134 +++++++++- 14 files changed, 469 insertions(+), 62 deletions(-) delete mode 100644 src/webapp/src/components/seatplan/newSeatplan.vue create mode 100644 src/webapp/src/components/seatplan/userApp/userWindow.vue diff --git a/src/webapp/notes.md b/src/webapp/notes.md index d6826f7..c2ca3be 100644 --- a/src/webapp/notes.md +++ b/src/webapp/notes.md @@ -1,8 +1,14 @@ # Account view: -- Load: email, settings, change pw, change mail, see all tickets - - set page title based on settings - make pricing groups changeable in UI (event categories) +- Fix text field overflow (text too big for box) +- Other optimisation for seat plan editor + +- Implement Permission system + + + + - add webpack to project website to decrease file size \ No newline at end of file diff --git a/src/webapp/src/App.vue b/src/webapp/src/App.vue index 7dc01ea..c6f446a 100644 --- a/src/webapp/src/App.vue +++ b/src/webapp/src/App.vue @@ -12,7 +12,7 @@ Home | Tickets | Cart | - Account | + Account | @@ -31,7 +31,7 @@ --popup-color: rgb(224, 224, 224); --accent-color: #42b983; --hover-color: rgb(165, 165, 165); - --accent-background-hover: #4380a8; + --accent-background-hover: rgb(124, 140, 236); --overlay-color: rgba(0, 0, 0, 0.7); --inactive-color: rgb(100, 100, 100); --highlight-backdrop: rgb(143, 134, 192); diff --git a/src/webapp/src/components/noseatplan.vue b/src/webapp/src/components/noseatplan.vue index a1d939e..8b42d93 100644 --- a/src/webapp/src/components/noseatplan.vue +++ b/src/webapp/src/components/noseatplan.vue @@ -30,20 +30,6 @@ -
- -
@@ -86,10 +72,7 @@ export default { } if ( showError ) { - setTimeout( function () { - $( '#placeNotAvailable' ).show( 200 ); - console.log( 'showing error message' ); - }, 500 ); + // TODO: Show popup that no more tickets in a category are available } @@ -133,9 +116,6 @@ export default { sessionStorage.setItem( 'cart', JSON.stringify( cart ) ); } }, - closePlaceNotAvailablePopup () { - $( '#placeNotAvailable' ).hide( 300 ); - }, selectSeat( placeID, rowID ) { /* This function allows the user to select a seat and deselect it, if it has previously diff --git a/src/webapp/src/components/seatplan/editor/properties.vue b/src/webapp/src/components/seatplan/editor/properties.vue index d4b976d..f356885 100644 --- a/src/webapp/src/components/seatplan/editor/properties.vue +++ b/src/webapp/src/components/seatplan/editor/properties.vue @@ -209,7 +209,7 @@ export default { data () { return { internal: {}, - categories: {}, + categories: { '1':{} }, } }, methods: { @@ -219,7 +219,7 @@ export default { this.internal[ value ] = {}; for ( let info in this.draggables[ value ] ) { if ( info === 'w' || info === 'h' || info === 'x' || info === 'y' ) { - this.internal[ value ][ info ] = Math.round( this.draggables[ value ][ info ] / this.scaleFactor ); + this.internal[ value ][ info ] = Math.round( ( this.draggables[ value ][ info ] / this.scaleFactor ) * 1000 ) / 1000; } else { this.internal[ value ][ info ] = this.draggables[ value ][ info ]; } diff --git a/src/webapp/src/components/seatplan/editor/window.vue b/src/webapp/src/components/seatplan/editor/window.vue index 775bb41..99cf428 100644 --- a/src/webapp/src/components/seatplan/editor/window.vue +++ b/src/webapp/src/components/seatplan/editor/window.vue @@ -11,14 +11,14 @@
-
+
- - - + + + @@ -79,6 +79,7 @@ zoomFactor: 1, historyPos: 0, generalSettings: { 'namingScheme': 'numeric' }, + seatCountInfo: { 'data': {}, 'count': 0 }, } }, methods: { @@ -184,7 +185,7 @@ returnArray[ entry ] = {}; for ( let attributes in valueArray[ entry ] ) { if ( allowedAttributes.includes( attributes ) ) { - returnArray[ entry ][ attributes ] = Math.round( valueArray[ entry ][ attributes ] / this.scaleFactor ); + returnArray[ entry ][ attributes ] = Math.round( ( valueArray[ entry ][ attributes ] / this.scaleFactor ) * 1000 ) / 1000; } else { returnArray[ entry ][ attributes ] = valueArray[ entry ][ attributes ]; } @@ -199,7 +200,7 @@ returnArray[ entry ] = {}; for ( let attributes in valueArray[ entry ] ) { if ( allowedAttributes.includes( attributes ) ) { - returnArray[ entry ][ attributes ] = valueArray[ entry ][ attributes ] * this.scaleFactor; + returnArray[ entry ][ attributes ] = Math.round( ( valueArray[ entry ][ attributes ] * this.scaleFactor ) * 1000 ) / 1000; } else { returnArray[ entry ][ attributes ] = valueArray[ entry ][ attributes ]; } @@ -262,6 +263,7 @@ sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) ); }, saveDraft () { + // TODO: Save seat count and seat config to server as well let progressNotification = this.$refs.notification.createNotification( 'Saving as draft', 5, 'progress', 'normal' ); sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) ); this.$refs.notification.createNotification( 'Saved as draft', 5, 'ok', 'normal' ); @@ -275,6 +277,8 @@ addNewElement () { this.draggables[ Object.keys( this.draggables ).length + 1 ] = { 'x': 100, 'y':100, 'h': 100, 'w': 250, 'active': false, 'draggable': true, 'resizable': true, 'id': Object.keys( this.draggables ).length + 1, 'origin': 1, 'shape':'rectangular', 'type': 'seat', 'startingRow': 1, 'seatCountingStartingPoint': 0, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' }, 'ticketCount': 1 }; this.saveHistory(); + document.getElementById( 'parent' ).scrollTop = 0; + document.getElementById( 'parent' ).scrollLeft = 0; this.$refs.notification.createNotification( 'New component added successfully', 5, 'ok', 'normal' ); }, deleteSelected () { @@ -314,8 +318,11 @@ this.loadSeatplan(); } }, + handleSeatCountInfo ( info ) { + this.seatCountInfo[ 'data' ][ info.id ] = info.data; + }, getSeatCount () { - console.log( 'Seat count is: ' + document.getElementsByClassName( 'seats' ).length ); + this.seatCountInfo[ 'count' ] = document.getElementsByClassName( 'seats' ).length; }, }, created () { diff --git a/src/webapp/src/components/seatplan/newSeatplan.vue b/src/webapp/src/components/seatplan/newSeatplan.vue deleted file mode 100644 index 08f8181..0000000 --- a/src/webapp/src/components/seatplan/newSeatplan.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/webapp/src/components/seatplan/seatplanComponents/seats/circular.vue b/src/webapp/src/components/seatplan/seatplanComponents/seats/circular.vue index 4e3fd3d..4904f51 100644 --- a/src/webapp/src/components/seatplan/seatplanComponents/seats/circular.vue +++ b/src/webapp/src/components/seatplan/seatplanComponents/seats/circular.vue @@ -44,6 +44,10 @@ export default { startingRow: { type: Number, "default": 1, + }, + id: { + type: Number, + "default": 1 } }, data () { @@ -58,10 +62,12 @@ export default { let w = Math.round( this.w / this.scaleFactor ); let h = Math.round( this.h / this.scaleFactor ); const size = 33; - let count = Math.min( Math.floor( w / size ), Math.floor( h / size ) ); + let count = Math.min( Math.floor( w / size ), Math.floor( h / size ) ); this.seats = {}; + let details = { 'data': {}, 'id': this.id }; for ( let row = this.startingRow; row < count; row++ ) { let nn = row * ( Math.PI / 2 ); + details.data[ row ] = Math.floor( nn ); let r = row * size; this.seats[ row ] = {}; for ( let n = 0; n < nn; n++ ) { @@ -77,6 +83,7 @@ export default { } } } + this.$emit( 'seatingInfo', details ); }, setScaleFactor () { for ( let row in this.seats ) { diff --git a/src/webapp/src/components/seatplan/seatplanComponents/seats/rectangular.vue b/src/webapp/src/components/seatplan/seatplanComponents/seats/rectangular.vue index f3fb06a..f062b72 100644 --- a/src/webapp/src/components/seatplan/seatplanComponents/seats/rectangular.vue +++ b/src/webapp/src/components/seatplan/seatplanComponents/seats/rectangular.vue @@ -41,6 +41,10 @@ export default { type: Number, "default": 1, }, + id: { + type: Number, + "default": 1 + } }, data () { return { @@ -55,6 +59,7 @@ export default { let h = Math.floor( this.h / this.scaleFactor ); const size = 33; this.seats = {}; + let details = { 'data': { '0': Math.floor( w / size ) }, 'id': this.id }; for ( let row = 0; row < Math.floor( h / size ); row++ ) { this.seats[ row ] = {}; for ( let n = 0; n < Math.floor( w / size ); n++ ) { @@ -69,6 +74,7 @@ export default { } } } + this.$emit( 'seatingInfo', details ); }, setScaleFactor () { for ( let row in this.seats ) { diff --git a/src/webapp/src/components/seatplan/seatplanComponents/seats/trapezoid.vue b/src/webapp/src/components/seatplan/seatplanComponents/seats/trapezoid.vue index ce6a046..e28ebf0 100644 --- a/src/webapp/src/components/seatplan/seatplanComponents/seats/trapezoid.vue +++ b/src/webapp/src/components/seatplan/seatplanComponents/seats/trapezoid.vue @@ -44,6 +44,10 @@ export default { startingRow: { type: Number, "default": 1, + }, + id: { + type: Number, + "default": 1 } }, data () { @@ -64,9 +68,11 @@ export default { let count = Math.floor( heightTriangle / ( sideOffset * 2 ) ); const angle = Math.PI / 4; this.seats = {}; + let details = { 'data': {}, 'id': this.id }; for ( let row = this.startingRow; row < count; row++ ) { let nn = 2 + ( row - 1 ) * 2; this.seats[ row ] = {}; + details.data[ row ] = Math.floor( nn ); for ( let n = 0; n < nn; n++ ) { let side = n * sideOffset; if ( this.origin === 1 ) { @@ -80,6 +86,7 @@ export default { } } } + this.$emit( 'seatingInfo', details ); }, setScaleFactor () { for ( let row in this.seats ) { diff --git a/src/webapp/src/components/seatplan/userApp/userWindow.vue b/src/webapp/src/components/seatplan/userApp/userWindow.vue new file mode 100644 index 0000000..808f184 --- /dev/null +++ b/src/webapp/src/components/seatplan/userApp/userWindow.vue @@ -0,0 +1,251 @@ + + + + + + + diff --git a/src/webapp/src/stores/userStore.js b/src/webapp/src/stores/userStore.js index b08a571..793f669 100644 --- a/src/webapp/src/stores/userStore.js +++ b/src/webapp/src/stores/userStore.js @@ -10,7 +10,7 @@ import { defineStore } from "pinia"; export const useUserStore = defineStore ( 'user', { - state: () => ( { 'isUserAuth': true, 'isAdminAuth': true, 'userPermissions': {} } ), + state: () => ( { 'isUserAuth': true, 'isAdminAuth': true, 'userData': {} } ), getters: { getUserAuthenticated: ( state ) => state.isUserAuth, getAdminAuthenticated: ( state ) => state.isAdminAuth, diff --git a/src/webapp/src/views/admin/AdminView.vue b/src/webapp/src/views/admin/AdminView.vue index 1abb2f0..37b1a38 100644 --- a/src/webapp/src/views/admin/AdminView.vue +++ b/src/webapp/src/views/admin/AdminView.vue @@ -16,13 +16,13 @@
diff --git a/src/webapp/src/views/admin/LocationsView.vue b/src/webapp/src/views/admin/LocationsView.vue index feb9b10..be754fe 100644 --- a/src/webapp/src/views/admin/LocationsView.vue +++ b/src/webapp/src/views/admin/LocationsView.vue @@ -11,6 +11,7 @@

Locations

Here you can change everything regarding event locations. All locations can have a seating plan.

+
  • @@ -28,6 +29,7 @@ No locations configured, please add one
+
@@ -75,7 +77,33 @@ , 'settings' ); }, addLocation () { - + this.$refs.popup.openPopup( 'Add a new location', { + 'locationName': { + 'display': 'Location name', + 'id': 'locationName', + 'tooltip':'Give the location the event takes place a name. This name will also be shown to customers', + 'value': '', + 'type': 'text', + }, + 'usesSeatplan': { + 'display': 'Use seat plan?', + 'id': 'usesSeatplan', + 'tooltip':'With this toggle you may specify whether or not this location has a seat plan or not.', + 'value': true, + 'type': 'toggle', + }, + 'seatplanEditor': { + 'display': 'Seat plan editor', + 'id': 'seatplanEditor', + 'tooltip':'The seat plan editor allows you to create a seat plan that closely resembles the location you host the event in.', + 'type': 'link', + 'restrictions': { + 'to': '/admin/seatplan', + 'displayName': 'Edit seat plan' + } + }, + } + , 'settings' ); }, } }; diff --git a/src/webapp/src/views/admin/SettingsView.vue b/src/webapp/src/views/admin/SettingsView.vue index 1927eb8..d71f91a 100644 --- a/src/webapp/src/views/admin/SettingsView.vue +++ b/src/webapp/src/views/admin/SettingsView.vue @@ -11,19 +11,37 @@

Settings

+

Detailed explanation of payment gateways can be found here. You may install more payment gateway integrations in the plugins section.

+ +
+

Admin Accounts

+

Before setting or editing permissions here, please read the corresponding section of the documentation here. +
Usually, the permissions automatically set by the system on account creation should be appropriate.

+ +
+ +
+ + + \ No newline at end of file