clean up settings of event and general ones

This commit is contained in:
2023-08-10 20:54:53 +02:00
parent 5c87a5a282
commit d2c0257b8f
8 changed files with 100 additions and 82 deletions

View File

@@ -17,7 +17,7 @@ class POSTHandler {
db.getJSONData( 'booked' ).then( dat => { db.getJSONData( 'booked' ).then( dat => {
this.allSelectedSeats = dat; this.allSelectedSeats = dat;
} ); } );
// this.allSelectedSeats = { 'test2': { 'secAr1s1': { 'id': 'secAr1s1', 'component': 1 } } }; // TODO: Load from event db
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

@@ -49,7 +49,7 @@ module.exports = ( app, settings ) => {
'product_data': { 'product_data': {
'name': data[ event ][ item ].name, 'name': data[ event ][ item ].name,
}, },
'currency': events[ event ].currency, 'currency': settings.currency,
'unit_amount': Math.round( parseFloat( events[ event ][ 'categories' ][ data[ event ][ item ].category ].price[ data[ event ][ item ][ 'ticketOption' ] ] ) * 100 ), 'unit_amount': Math.round( parseFloat( events[ event ][ 'categories' ][ data[ event ][ item ].category ].price[ data[ event ][ item ][ 'ticketOption' ] ] ) * 100 ),
}, },
'quantity': data[ event ][ item ].count ?? 1, 'quantity': data[ event ][ item ].count ?? 1,

View File

@@ -56,7 +56,7 @@ class TicketGenerator {
} }
} }
// TODO: Maybe move to subprocesses // TODO: FUTURE: move to subprocesses
queueHandler () { queueHandler () {
if ( !this.isRunning ) { if ( !this.isRunning ) {
this.isRunning = true; this.isRunning = true;

View File

@@ -8,5 +8,6 @@
"name": "libreevent", "name": "libreevent",
"yourDomain": "http://localhost:8080", "yourDomain": "http://localhost:8080",
"mailSender": "libreevent <info@libreevent.janishutz.com>", "mailSender": "libreevent <info@libreevent.janishutz.com>",
"maxTickets": 10 "maxTickets": 10,
"currency": "USD"
} }

View File

@@ -10,6 +10,7 @@
<template> <template>
<div> <div>
<h2>Settings</h2> <h2>Settings</h2>
<p>Currency codes used must be valid ISO 4217 codes. Read more on <a href="https://libreevent.janishutz.com/docs/admin-panel/settings#currency" target="_blank">this page</a> of the documentation <!-- https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes"--></p>
<settings v-model:settings="settings"></settings> <settings v-model:settings="settings"></settings>
<table class="gateway-settings"> <table class="gateway-settings">
<tr> <tr>
@@ -99,6 +100,13 @@
'value': false, 'value': false,
'type': 'toggle', 'type': 'toggle',
}, },
'currency': {
'display': 'Currency',
'id': 'currency',
'tooltip':'Specify a currency in which the prices are displayed to the customer. Defaults to USD. Please use valid currency codes.',
'value': 'USD',
'type': 'text',
},
'paymentGateway': { 'paymentGateway': {
'display': 'Select the payment gateway to use', 'display': 'Select the payment gateway to use',
'id': 'paymentGateway', 'id': 'paymentGateway',

View File

@@ -25,8 +25,8 @@
<td v-else>No locations configured yet. Configure one <router-link to="/admin/locations">here</router-link></td> <td v-else>No locations configured yet. Configure one <router-link to="/admin/locations">here</router-link></td>
</tr> </tr>
<tr> <tr>
<td>Event date</td> <td>Event date and time</td>
<td><input v-model="event.date" class="small-text" type="date"></td> <td><input v-model="event.date" class="small-text" type="date"><input v-model="event.time" class="small-text" type="time"></td>
</tr> </tr>
<tr> <tr>
<td>Ticket editor</td> <td>Ticket editor</td>
@@ -35,6 +35,12 @@
</table> </table>
</div> </div>
<div class="ticket-settings"> <div class="ticket-settings">
<!-- TODO: Finish -->
<h3>Age Groups</h3>
<p>With these settings you can manage and create different age categories which have to be set for every ticket.</p>
</div>
<div class="ticket-settings">
<!-- TODO: Load automatically -->
<h3>Ticket Settings</h3> <h3>Ticket Settings</h3>
<p>The foreground and background colours of the seats are used to show the customer to which category the seats belong.</p> <p>The foreground and background colours of the seats are used to show the customer to which category the seats belong.</p>
<div class="category-wrapper"> <div class="category-wrapper">
@@ -98,12 +104,16 @@
</div> </div>
<div class="special-settings"> <div class="special-settings">
<h3>General Settings</h3> <h3>General Settings</h3>
<p>Currency codes used must be valid ISO 4217 codes. Read more on <a href="https://libreevent.janishutz.com/docs/admin-panel/events#currency" target="_blank">this page</a> of the documentation <!-- https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes"--></p>
<settings v-model:settings="specialSettings"></settings> <settings v-model:settings="specialSettings"></settings>
</div> </div>
<div> <div>
<p>Please read the documentation of this section if you want to use the requirements. It requires specific syntax to work. See <a href="https://libreevent.janishutz.com/docs/admin-panel/events#special-requirements" target="_blank">here</a> for more information</p> <h3>Danger Zone</h3>
<button>Go Live</button><button>Delete</button><br><br><br>
<!-- TODO: Add functions -->
</div> </div>
<!-- <div>
<p>Please read the documentation of this section if you want to use the requirements. It requires specific syntax to work. See <a href="https://libreevent.janishutz.com/docs/admin-panel/events#special-requirements" target="_blank">here</a> for more information</p>
</div> -->
<notifications ref="notification" location="topright"></notifications> <notifications ref="notification" location="topright"></notifications>
</div> </div>
</template> </template>
@@ -143,6 +153,8 @@
// TODO: When loading data form server, also load categories of this seat plan // TODO: When loading data form server, also load categories of this seat plan
// and from it construct the array, if not set already. // and from it construct the array, if not set already.
// TODO: Save info if draft or live
export default { export default {
name: 'TicketsDetailsView', name: 'TicketsDetailsView',
components: { components: {
@@ -150,6 +162,71 @@
notifications, notifications,
PictureInput, PictureInput,
}, },
data() {
return {
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: {
// 'guest-purchase': {
// 'display': 'Enable guest purchase',
// 'id': 'guest-purchase',
// 'tooltip':'Allowing guest purchase means that a user does not have to create an account in order for them to be able to make a purchase. Default: On',
// 'value': true,
// 'type': 'toggle'
// },
// 'overbooking': {
// 'display': 'Enable overbooking of event',
// 'id': 'overbooking',
// 'tooltip':'Allow more ticket reservations than you have tickets available. Currently only available for events without seatplans. Default: Off',
// 'value': false,
// 'type': 'toggle'
// },
'maxTickets': {
'display': 'Maximum ticket count per account',
'id': 'maxTickets',
'tooltip':'With this setting you can control how many tickets a person can buy. Defaults to 0, which means do not limit.',
'value': 0,
'type': 'number',
'restrictions': {
'min': 0,
'max': 100,
}
},
// 'requiredParameter': {
// 'display': 'Special requirements',
// 'id': 'requiredParameter',
// 'tooltip':'Set this parameter to require the user to provide a certain email domain, a special number or special string of characters. Defaults to None',
// 'value': 'none',
// 'type': 'select',
// 'restrictions': {
// 'none': {
// 'displayName':'None',
// 'value': 'none'
// },
// 'email': {
// 'displayName':'Email domain',
// 'value': 'email'
// },
// 'numbers': {
// 'displayName':'Number sequence',
// 'value': 'numbers'
// },
// 'string': {
// 'displayName':'Text sequence',
// 'value': 'string'
// },
// }
// },
// 'requiredParameterValue': {
// 'display': 'Special requirements values ',
// 'id': 'requiredParameterValue',
// 'tooltip':'Put a filter here, corresponding to your selection above. Please read the documentation on our website. See link below!',
// 'value': '',
// 'type': 'text',
// },
}
}
},
created () { created () {
if ( !sessionStorage.getItem( 'selectedTicket' ) ) { if ( !sessionStorage.getItem( 'selectedTicket' ) ) {
this.$router.push( '/admin/events' ); this.$router.push( '/admin/events' );
@@ -162,78 +239,8 @@
console.error( error ); console.error( error );
} ); } );
} ); } );
},
data() { // TODO: Load data from server
return {
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',
'id': 'currency',
'tooltip':'Specify a currency in which the prices are displayed to the customer. Defaults to USD. Please use valid currency codes.',
'value': 'USD',
'type': 'text',
},
'guest-purchase': {
'display': 'Enable guest purchase',
'id': 'guest-purchase',
'tooltip':'Allowing guest purchase means that a user does not have to create an account in order for them to be able to make a purchase. Default: On',
'value': true,
'type': 'toggle'
},
'overbooking': {
'display': 'Enable overbooking of event',
'id': 'overbooking',
'tooltip':'Allow more ticket reservations than you have tickets available. Currently only available for events without seatplans. Default: Off',
'value': false,
'type': 'toggle'
},
'maxTickets': {
'display': 'Maximum ticket count per account',
'id': 'maxTickets',
'tooltip':'With this setting you can control how many tickets a person can buy. Defaults to 0, which means do not limit.',
'value': 0,
'type': 'number',
'restrictions': {
'min': 0,
'max': 100,
}
},
'requiredParameter': {
'display': 'Special requirements',
'id': 'requiredParameter',
'tooltip':'Set this parameter to require the user to provide a certain email domain, a special number or special string of characters. Defaults to None',
'value': 'none',
'type': 'select',
'restrictions': {
'none': {
'displayName':'None',
'value': 'none'
},
'email': {
'displayName':'Email domain',
'value': 'email'
},
'numbers': {
'displayName':'Number sequence',
'value': 'numbers'
},
'string': {
'displayName':'Text sequence',
'value': 'string'
},
}
},
'requiredParameterValue': {
'display': 'Special requirements values ',
'id': 'requiredParameterValue',
'tooltip':'Put a filter here, corresponding to your selection above. Please read the documentation on our website. See link below!',
'value': '',
'type': 'text',
},
}
}
}, },
methods: { methods: {
saveImages() { saveImages() {
@@ -255,6 +262,9 @@
} else { } else {
this.$refs.notification.createNotification( 'No image selected!', 5, 'error', 'normal' ); this.$refs.notification.createNotification( 'No image selected!', 5, 'error', 'normal' );
} }
},
loadLocationData() {
}, },
save () { save () {

View File

@@ -39,7 +39,7 @@
</table> </table>
<div v-if="settings.requiresSpecialToken"> <div v-if="settings.requiresSpecialToken">
<!-- TODO: Implement --> <!-- TODO: FUTURE: Implement -->
</div> </div>
<button id="buy-button" @click="preparePayment();">Buy now</button> <button id="buy-button" @click="preparePayment();">Buy now</button>
</div> </div>

View File

@@ -52,7 +52,6 @@
</td> </td>
</tr> </tr>
</table> </table>
<!-- TODO: Ask for permission to send emails (Make question sound really optional) -->
</form> </form>
<notifications ref="notification" location="topright" size="bigger"></notifications> <notifications ref="notification" location="topright" size="bigger"></notifications>
<button @click="signup();" class="button">Sign up</button> <button @click="signup();" class="button">Sign up</button>