mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 13:24:24 +00:00
implement first part of occupied seat counter
This commit is contained in:
@@ -76,6 +76,8 @@ class GETHandler {
|
||||
resolve( this.settings.currency );
|
||||
} else if ( call === 'getAdminAccounts' ) {
|
||||
// TODO: Finish
|
||||
} else if ( call === 'getPaymentGatewaySettings' ) {
|
||||
// TODO: Finish
|
||||
} else if ( call === 'getSettings' ) {
|
||||
resolve( this.settings );
|
||||
} else {
|
||||
|
||||
@@ -119,7 +119,13 @@ class POSTHandler {
|
||||
this.settings[ 'currency' ] = data.currency;
|
||||
this.settings[ 'payments' ] = data.payments;
|
||||
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' );
|
||||
} else {
|
||||
reject( { 'code': 404, 'error': 'Route not found' } );
|
||||
|
||||
@@ -16,10 +16,30 @@ class POSTHandler {
|
||||
constructor () {
|
||||
db.getJSONData( 'booked' ).then( 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.
|
||||
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 );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
// 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 = { 'test2': { 'ticket1': 5, 'ticket2': 5 } };
|
||||
|
||||
this.settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/../../config/settings.config.json' ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"test4":{"secAr4s7":{"id":"secAr4s7","component":1,"ticketOption":"1","eventID":"test4","category":"1","name":"Row 5, Seat 8"}}}
|
||||
@@ -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}}
|
||||
@@ -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"}
|
||||
Reference in New Issue
Block a user