feat: update to lnbits 1.0.0 (#36)

This commit is contained in:
dni ⚡ 2024-10-11 13:52:39 +02:00 committed by GitHub
parent 9ca714d878
commit 6714dcddc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1769 additions and 1772 deletions

78
static/js/register.js Normal file
View file

@ -0,0 +1,78 @@
const mapEvents = function (obj) {
obj.date = Quasar.date.formatDate(
new Date(obj.time * 1000),
'YYYY-MM-DD HH:mm'
)
obj.fsat = new Intl.NumberFormat(LOCALE).format(obj.amount)
obj.displayUrl = ['/events/', obj.id].join('')
return obj
}
window.app = Vue.createApp({
el: '#vue',
mixins: [windowMixin],
data() {
return {
tickets: [],
ticketsTable: {
columns: [
{name: 'id', align: 'left', label: 'ID', field: 'id'},
{name: 'name', align: 'left', label: 'Name', field: 'name'},
{
name: 'registered',
align: 'left',
label: 'Registered',
field: 'registered'
}
],
pagination: {
rowsPerPage: 10
}
},
sendCamera: {
show: false,
camera: 'auto'
}
}
},
methods: {
hoverEmail(tmp) {
this.tickets.data.emailtemp = tmp
},
closeCamera() {
this.sendCamera.show = false
},
showCamera() {
this.sendCamera.show = true
},
decodeQR(res) {
this.sendCamera.show = false
const value = res[0].rawValue.split('//')[1]
LNbits.api
.request('GET', `/events/api/v1/register/ticket/${value}`)
.then(() => {
Quasar.Notify.create({
type: 'positive',
message: 'Registered!'
})
setTimeout(() => {
window.location.reload()
}, 2000)
})
.catch(LNbits.utils.notifyApiError)
},
getEventTickets() {
LNbits.api
.request('GET', `/events/api/v1/eventtickets/${event_id}`)
.then(response => {
this.tickets = response.data.map(obj => {
return mapEvents(obj)
})
})
.catch(LNbits.utils.notifyApiError)
}
},
created() {
this.getEventTickets()
}
})