implement first part of occupied seat counter

This commit is contained in:
2023-08-18 18:13:53 +02:00
parent 4208ad44a2
commit 6051b18796
8 changed files with 44 additions and 23 deletions

View File

@@ -76,6 +76,8 @@ class GETHandler {
resolve( this.settings.currency ); resolve( this.settings.currency );
} else if ( call === 'getAdminAccounts' ) { } else if ( call === 'getAdminAccounts' ) {
// TODO: Finish // TODO: Finish
} else if ( call === 'getPaymentGatewaySettings' ) {
// TODO: Finish
} else if ( call === 'getSettings' ) { } else if ( call === 'getSettings' ) {
resolve( this.settings ); resolve( this.settings );
} else { } else {

View File

@@ -119,7 +119,13 @@ class POSTHandler {
this.settings[ 'currency' ] = data.currency; this.settings[ 'currency' ] = data.currency;
this.settings[ 'payments' ] = data.payments; this.settings[ 'payments' ] = data.payments;
fs.writeFileSync( path.join( __dirname + '/../../config/settings.config.json' ), JSON.stringify( this.settings ) ); fs.writeFileSync( path.join( __dirname + '/../../config/settings.config.json' ), JSON.stringify( this.settings ) );
// TODO: Parse all events and update currency db.getJSONData( 'events' ).then( dat => {
let updated = dat;
for ( let event in updated ) {
updated[ event ][ 'currency' ] = data.currency;
}
db.writeJSONData( 'events', updated );
} );
resolve( 'ok' ); resolve( 'ok' );
} else { } else {
reject( { 'code': 404, 'error': 'Route not found' } ); reject( { 'code': 404, 'error': 'Route not found' } );

View File

@@ -16,10 +16,30 @@ class POSTHandler {
constructor () { constructor () {
db.getJSONData( 'booked' ).then( dat => { db.getJSONData( 'booked' ).then( dat => {
this.allSelectedSeats = dat; this.allSelectedSeats = dat;
} ); db.getJSONData( 'events' ).then( dat => {
db.getJSONData( 'seatplan' ).then( locations => {
this.events = dat;
// TODO: Load from event db subtract all occupied seats from the ordered db from it. // TODO: Load from event db subtract all occupied seats from the ordered db from it.
// TODO: When loading event data, also add currency to it from settings this.ticketTotals = {};
for ( let event in this.events ) {
if ( locations[ this.events[ event ][ 'location' ] ] ) {
this.ticketTotals[ event ] = locations[ this.events[ event ][ 'location' ] ][ 'save' ][ 'seatInfo' ][ 'count' ];
} else {
this.ticketTotals[ event ] = this.events[ event ][ 'maxTickets' ];
}
}
console.log( this.ticketTotals );
// for ( let order in this.allSelectedSeats ) {
// }
console.log( this.allSelectedSeats );
} );
} );
} );
this.ticketTotals = { 'test2': { 'ticket1': 5, 'ticket2': 5 } }; this.ticketTotals = { 'test2': { 'ticket1': 5, 'ticket2': 5 } };
this.settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/../../config/settings.config.json' ) ) ); this.settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/../../config/settings.config.json' ) ) );
} }

View File

@@ -0,0 +1 @@
{"test4":{"secAr4s7":{"id":"secAr4s7","component":1,"ticketOption":"1","eventID":"test4","category":"1","name":"Row 5, Seat 8"}}}

View File

@@ -1 +1 @@
{"test4":{"name":"Test4Event","description":"Let's see...","location":"test2","date":"2023-09-18T10:00:00.000Z","categories":{"1":{"price":{"1":20,"2":30},"bg":"#FFFFFF","fg":"#000000","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":"USD","isDraft":true,"locationName":"TestLocation2","hasSeatplan":true}} {"test4":{"name":"Test4Event","description":"Let's see...","location":"test2","date":"2023-09-18T10:00:00.000Z","categories":{"1":{"price":{"1":20,"2":30},"bg":"#FFFFFF","fg":"#000000","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}}

View File

@@ -1,13 +1 @@
{ {"init":true,"twoFA":"enforce","setupKey":"hello world","twoFAMode":"enhanced","db":"mysql","payments":"stripe","name":"libreevent","yourDomain":"http://localhost:8080","mailSender":"libreevent <info@libreevent.janishutz.com>","maxTickets":10,"currency":"CHF"}
"init":true,
"twoFA":"enforce",
"setupKey":"hello world",
"twoFAMode":"enhanced",
"db":"mysql",
"payments":"stripe",
"name":"libreevent",
"yourDomain":"http://localhost:8080",
"mailSender":"libreevent <info@libreevent.janishutz.com>",
"maxTickets":10,
"currency":"CHF"
}

View File

@@ -33,7 +33,7 @@
<h2>Admin Accounts</h2> <h2>Admin Accounts</h2>
<button @click="createAccount()">Create new account</button> <button @click="createAccount()">Create new account</button>
<p>Before setting or editing permissions here, please read the corresponding section of the documentation <a href="https://libreevent.janishutz.com/docs/admin-panel/settings/admin-accounts#permissions" target="_blank">here</a>. <p>Before setting or editing permissions here, please read the corresponding section of the documentation <a href="https://libreevent.janishutz.com/docs/admin-panel/settings/admin-accounts#permissions" target="_blank">here</a>.
<br>Usually, the permissions automatically set by the system on account creation should be appropriate.</p> <br>Usually, the permissions automatically set by the system on account creation should be appropriate. (TIP: Right click for more options)</p>
<div v-for="account in adminAccounts" class="account" @click="showAccountSettings( account.username );" title="Edit permissions of this account (right click for more options)" @contextmenu="( e ) => { e.preventDefault(); openRightClickMenu( account.username, e ); }"> <div v-for="account in adminAccounts" class="account" @click="showAccountSettings( account.username );" title="Edit permissions of this account (right click for more options)" @contextmenu="( e ) => { e.preventDefault(); openRightClickMenu( account.username, e ); }">
<div class="location-name"> <div class="location-name">
<h3>{{ account.username }}</h3> <h3>{{ account.username }}</h3>
@@ -175,9 +175,9 @@
}, },
createAccount() { createAccount() {
this.$refs.popup.openPopup( 'Create new admin user', { this.$refs.popup.openPopup( 'Create new admin user', {
'pagesSettings': { 'role': {
'display': 'Modify pages', 'display': 'User role',
'id': 'pagesSettings', 'id': 'role',
'tooltip':'With this setting you can choose one of the preset permissions for users. Account management is only allowed for the root user.', 'tooltip':'With this setting you can choose one of the preset permissions for users. Account management is only allowed for the root user.',
'value': 'eventManager', 'value': 'eventManager',
'type': 'select', 'type': 'select',
@@ -233,7 +233,7 @@
} }
}, },
openRightClickMenu( id, event ) { openRightClickMenu( id, event ) {
this.$refs.rclk.openRightClickMenu( event, { 'edit': { 'command': 'openPermissions', 'symbol': 'edit', 'display': 'Edit permissions' }, 'delete': { 'command': 'deleteUser', 'symbol': 'delete', 'display': 'Delete User' } } ) this.$refs.rclk.openRightClickMenu( event, { 'permissions': { 'command': 'openPermissions', 'symbol': 'edit', 'display': 'Edit permissions' }, 'password': { 'command': 'updatePassword', 'symbol': 'password', 'display': 'Edit password' }, 'delete': { 'command': 'deleteUser', 'symbol': 'delete', 'display': 'Delete User' } } )
this.currentlyOpenMenu = id; this.currentlyOpenMenu = id;
}, },
loadData() { loadData() {

View File

@@ -14,6 +14,7 @@
<p>The system is currently processing your order and you will be able to download your tickets within a moment's notice.</p> <p>The system is currently processing your order and you will be able to download your tickets within a moment's notice.</p>
<p>You will receive an email with your tickets within the next few minutes</p> <p>You will receive an email with your tickets within the next few minutes</p>
<p class="small">If the email does not arrive withing the next 10 minutes, please click <a href="/payments/resendTickets" target="_blank">here</a></p> <p class="small">If the email does not arrive withing the next 10 minutes, please click <a href="/payments/resendTickets" target="_blank">here</a></p>
<a href="/tickets/tickets.pdf" class="submit" style="display: none;" id="manual-download">Download manually</a>
<button onclick="if ( confirm( 'Do you really want to leave this page? If you want to download the tickets directly, you will need to head to your account page and download the ticket from there or stay on this page and wait for the order to finish processing.' ) ) { <button onclick="if ( confirm( 'Do you really want to leave this page? If you want to download the tickets directly, you will need to head to your account page and download the ticket from there or stay on this page and wait for the order to finish processing.' ) ) {
location.href = '/' }" class="submit">Back to the home page</button> location.href = '/' }" class="submit">Back to the home page</button>
</div> </div>
@@ -53,6 +54,9 @@
open( '/tickets/tickets.pdf' ); open( '/tickets/tickets.pdf' );
source.close(); source.close();
}, 500 ); }, 500 );
setTimeout( () => {
$( 'manual-download' ).slideDown( 500 );
}, 2000 );
} else if ( e.data === 'paymentOk' ) { } else if ( e.data === 'paymentOk' ) {
self.$refs.notification.createNotification( 'Your payment has been marked as completed!', 5, 'ok', 'normal' ); self.$refs.notification.createNotification( 'Your payment has been marked as completed!', 5, 'ok', 'normal' );
} }
@@ -68,7 +72,7 @@
if ( e.target.readyState == EventSource.CLOSED ) { if ( e.target.readyState == EventSource.CLOSED ) {
self.$refs.notification.cancelNotification( startNotification ); self.$refs.notification.cancelNotification( startNotification );
self.$refs.notification.createNotification( 'Could not connect to status service', 5, 'error', 'normal' ); self.$refs.notification.createNotification( 'Disconnected from status service', 20, 'info', 'normal' );
} }
}, false ); }, false );
}, 300 ); }, 300 );