mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-26 20:06:17 +02:00
feat: add hold invoice dialog
This commit is contained in:
2
lnbits/static/bundle-components.min.js
vendored
2
lnbits/static/bundle-components.min.js
vendored
File diff suppressed because one or more lines are too long
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -176,10 +176,17 @@ window.localisation.en = {
|
||||
extension_required_lnbits_version: 'This release requires LNbits version',
|
||||
min_version: 'Minimum (included)',
|
||||
max_version: 'Maximum (excluded)',
|
||||
preimage: 'Preimage',
|
||||
preimage_hint: 'Preimage to settle the hold invoice',
|
||||
hold_invoice: 'Hold Invoice',
|
||||
hold_invoice_description:
|
||||
'This invoice is on hold and requires a preimage to settle.',
|
||||
payment_hash: 'Payment Hash',
|
||||
invoice_cancelled: 'Invoice Cancelled',
|
||||
invoice_settled: 'Invoice Settled',
|
||||
hold_invoice_payment_hash: 'Payment hash for hold invoice (optional)',
|
||||
settle_invoice: 'Settle Invoice',
|
||||
cancel_invoice: 'Cancel Invoice',
|
||||
fee: 'Fee',
|
||||
amount: 'Amount',
|
||||
amount_limits: 'Amount Limits',
|
||||
|
@@ -120,6 +120,11 @@ window.app.component('payment-list', {
|
||||
],
|
||||
preimage: null,
|
||||
loading: false
|
||||
},
|
||||
hodlInvoice: {
|
||||
show: false,
|
||||
payment: null,
|
||||
preimage: null
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -224,7 +229,12 @@ window.app.component('payment-list', {
|
||||
})
|
||||
.catch(LNbits.utils.notifyApiError)
|
||||
},
|
||||
cancelInvoice(payment_hash) {
|
||||
showHoldInvoiceDialog(payment) {
|
||||
this.hodlInvoice.show = true
|
||||
this.hodlInvoice.preimage = ''
|
||||
this.hodlInvoice.payment = payment
|
||||
},
|
||||
cancelHoldInvoice(payment_hash) {
|
||||
LNbits.api
|
||||
.cancelInvoice(this.g.wallet, payment_hash)
|
||||
.then(() => {
|
||||
@@ -236,7 +246,7 @@ window.app.component('payment-list', {
|
||||
})
|
||||
.catch(LNbits.utils.notifyApiError)
|
||||
},
|
||||
settleInvoice(preimage) {
|
||||
settleHoldInvoice(preimage) {
|
||||
LNbits.api
|
||||
.settleInvoice(this.g.wallet, preimage)
|
||||
.then(() => {
|
||||
|
@@ -880,6 +880,19 @@
|
||||
:props="props"
|
||||
style="white-space: normal; word-break: break-all"
|
||||
>
|
||||
<q-icon
|
||||
v-if="
|
||||
props.row.isIn &&
|
||||
props.row.isPending &&
|
||||
props.row.extra.hold_invoice
|
||||
"
|
||||
name="pause_presentation"
|
||||
color="grey"
|
||||
class="cursor-pointer q-mr-sm"
|
||||
@click="showHoldInvoiceDialog(props.row)"
|
||||
>
|
||||
<q-tooltip><span v-text="$t('hold_invoice')"></span></q-tooltip>
|
||||
</q-icon>
|
||||
<q-badge
|
||||
v-if="props.row.tag"
|
||||
color="yellow"
|
||||
@@ -941,7 +954,7 @@
|
||||
</q-td>
|
||||
<q-dialog v-model="props.expand" :props="props" position="top">
|
||||
<q-card class="q-pa-sm q-pt-xl lnbits__dialog-card">
|
||||
<q-card-section class="">
|
||||
<q-card-section>
|
||||
<q-list bordered separator>
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
@@ -1004,6 +1017,7 @@
|
||||
></lnbits-payment-details>
|
||||
</q-expansion-item>
|
||||
</q-list>
|
||||
|
||||
<div
|
||||
v-if="props.row.isIn && props.row.isPending && props.row.bolt11"
|
||||
class="text-center q-my-lg"
|
||||
@@ -1028,35 +1042,6 @@
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<div
|
||||
class="row q-gutter-x-sm q-mb-md"
|
||||
v-if="
|
||||
props.row.isIn &&
|
||||
props.row.isPending &&
|
||||
props.row.extra.hold_invoice
|
||||
"
|
||||
class="hold-buttons"
|
||||
>
|
||||
<q-btn outline color="grey" :label="$t('settle_invoice')">
|
||||
<q-popup-edit class="text-white" v-slot="scope">
|
||||
<q-input
|
||||
filled
|
||||
:label="$t('preimage')"
|
||||
v-model="scope.value"
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="settleInvoice(scope.value)"
|
||||
>
|
||||
</q-input>
|
||||
</q-popup-edit>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
outline
|
||||
color="danger"
|
||||
@click="cancelInvoice(props.row.payment_hash)"
|
||||
:label="$t('cancel_invoice')"
|
||||
></q-btn>
|
||||
</div>
|
||||
<div class="row q-gutter-x-sm">
|
||||
<q-btn
|
||||
v-if="
|
||||
@@ -1089,6 +1074,48 @@
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
<q-dialog v-model="hodlInvoice.show" position="top">
|
||||
<q-card class="q-pa-sm q-pt-xl lnbits__dialog-card">
|
||||
<q-card-section>
|
||||
<q-item-label class="text-h6">
|
||||
<span v-text="$t('hold_invoice')"></span>
|
||||
</q-item-label>
|
||||
<q-item-label class="text-subtitle2">
|
||||
<span v-text="$t('hold_invoice_description')"></span>
|
||||
</q-item-label>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<q-input
|
||||
filled
|
||||
:label="$t('preimage')"
|
||||
:hint="$t('preimage_hint')"
|
||||
v-model="hodlInvoice.preimage"
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="settleHoldInvoice(hodlInvoice.preimage)"
|
||||
>
|
||||
</q-input>
|
||||
</q-card-section>
|
||||
<q-card-section class="row q-gutter-x-sm">
|
||||
<q-btn
|
||||
@click="settleHoldInvoice(hodlInvoice.preimage)"
|
||||
outline
|
||||
v-close-popup
|
||||
color="grey"
|
||||
:label="$t('settle_invoice')"
|
||||
>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-close-popup
|
||||
flat
|
||||
color="grey"
|
||||
class="q-ml-auto"
|
||||
@click="cancelHoldInvoice(hodlInvoice.payment.payment_hash)"
|
||||
:label="$t('cancel_invoice')"
|
||||
></q-btn>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
|
Reference in New Issue
Block a user