satmachineadmin/templates/myextension/myextension.html
2024-01-17 12:22:26 +00:00

109 lines
3 KiB
HTML

{% extends "public.html" %} {% block page %}
<div class="row q-col-gutter-md justify-center">
<div class="col-12 col-sm-6 col-md-5 col-lg-4">
<q-card class="q-pa-lg">
<q-card-section class="q-pa-none">
<div class="text-center">
<a class="text-secondary" href="lightning:{{ lnurl }}">
<q-responsive :ratio="1" class="q-mx-md">
<qrcode
value="lightning:{{ lnurl }}"
:options="{width: 800}"
class="rounded-borders"
></qrcode>
</q-responsive>
</a>
</div>
<div class="row q-mt-lg q-gutter-sm">
<q-btn outline color="grey" @click="copyText('{{ lnurl }}')"
>Copy LNURL</q-btn
>
<q-btn
outline
color="grey"
icon="nfc"
@click="writeNfcTag(' {{ lnurl }} ')"
:disable="nfcTagWriting"
></q-btn>
</div>
</q-card-section>
</q-card>
</div>
<div class="col-12 col-sm-6 col-md-5 col-lg-4 q-gutter-y-md">
<q-card>
<q-card-section>
<h6 class="text-subtitle1 q-mb-sm q-mt-none">LNbits LNURL-pay link</h6>
<p class="q-my-none">Use an LNURL compatible bitcoin wallet to pay.</p>
</q-card-section>
<q-card-section class="q-pa-none">
<q-separator></q-separator>
<q-list> </q-list>
</q-card-section>
</q-card>
</div>
</div>
{% endblock %} {% block scripts %}
<script>
Vue.component(VueQrcode.name, VueQrcode)
new Vue({
el: '#vue',
mixins: [windowMixin],
data: function () {
return {
lnurlpay: "{{ lnurlpay|tojson }}",
lnurlwithdraw: "{{ lnurlwithdraw|tojson }}",
}
},
created: function () {
if (this.g.user.wallets.length) {
this.getTemps()
}
},
methods: {
copyText: function (text) {
var self = this
navigator.clipboard.writeText(text).then(
function () {
self.$q.notify({
message: 'LNURL copied to clipboard',
color: 'positive',
icon: 'done',
})
},
function (err) {
self.$q.notify({
message: 'LNURL copy failed',
color: 'negative',
icon: 'error',
})
}
)
},
createInvoice(walletId) {
console.log(walletId)
const wallet = _.findWhere(this.g.user.wallets, {
id: walletId
})
console.log(wallet.inkey)
LNbits.api
.request(
'POST',
`/api/v1/payments`,
wallet.inkey,
{
out: false,
amount: this.invoiceAmount,
}
)
.then(response => {
this.qrValue = response.data.payment_request
})
.catch(error => {
LNbits.utils.notifyApiError(error)
})
},
},
})
</script>
{% endblock %}