add a dialog with payment details for each payment.

for outgoing payments this needs a preimage to be good,
but we don't have it yet because we don't get it from
backends.
This commit is contained in:
fiatjaf 2020-09-02 19:19:18 -03:00
parent 197af922d0
commit ce28db76c9
5 changed files with 172 additions and 105 deletions

View File

@ -67,20 +67,14 @@ function generateChart(canvas, payments) {
type: 'bar', type: 'bar',
label: 'in', label: 'in',
barPercentage: 0.75, barPercentage: 0.75,
backgroundColor: window backgroundColor: window.Color('rgb(76,175,80)').alpha(0.5).rgbString() // green
.Color('rgb(76,175,80)')
.alpha(0.5)
.rgbString() // green
}, },
{ {
data: data.outcome, data: data.outcome,
type: 'bar', type: 'bar',
label: 'out', label: 'out',
barPercentage: 0.75, barPercentage: 0.75,
backgroundColor: window backgroundColor: window.Color('rgb(233,30,99)').alpha(0.5).rgbString() // pink
.Color('rgb(233,30,99)')
.alpha(0.5)
.rgbString() // pink
} }
] ]
}, },

View File

@ -103,16 +103,25 @@
<q-icon <q-icon
v-if="props.row.isPaid" v-if="props.row.isPaid"
size="14px" size="14px"
:name="(props.row.sat < 0) ? 'call_made' : 'call_received'" :name="props.row.isOut ? 'call_made' : 'call_received'"
:color="(props.row.sat < 0) ? 'pink' : 'green'" :color="props.row.isOut ? 'pink' : 'green'"
@click="props.expand = !props.expand"
></q-icon> ></q-icon>
<q-icon v-else name="settings_ethernet" color="grey"> <q-icon
v-else
name="settings_ethernet"
color="grey"
@click="props.expand = !props.expand"
>
<q-tooltip>Pending</q-tooltip> <q-tooltip>Pending</q-tooltip>
</q-icon> </q-icon>
</q-td> </q-td>
<q-td key="memo" :props="props"> <q-td key="memo" :props="props">
<q-badge v-if="props.row.tag" color="yellow" text-color="black"> <q-badge v-if="props.row.tag" color="yellow" text-color="black">
<a class="inherit" :href="['/', props.row.tag, '?usr=', user.id].join('')"> <a
class="inherit"
:href="['/', props.row.tag, '?usr=', user.id].join('')"
>
#{{ props.row.tag }} #{{ props.row.tag }}
</a> </a>
</q-badge> </q-badge>
@ -125,6 +134,64 @@
{{ props.row.fsat }} {{ props.row.fsat }}
</q-td> </q-td>
</q-tr> </q-tr>
<q-dialog v-model="props.expand" :props="props">
<q-card
v-if="props.row.amount > 0 && props.row.pending"
class="q-pa-lg q-pt-xl lnbits__dialog-card"
>
<div class="text-center q-mb-lg">
<a :href="'lightning:' + receive.paymentReq">
<q-responsive :ratio="1" class="q-mx-xl">
<qrcode
:value="receive.paymentReq"
:options="{width: 340}"
class="rounded-borders"
></qrcode>
</q-responsive>
</a>
</div>
<div class="row q-mt-lg">
<q-btn
outline
color="grey"
@click="copyText(receive.paymentReq)"
>Copy invoice</q-btn
>
<q-btn v-close-popup flat color="grey" class="q-ml-auto"
>Close</q-btn
>
</div>
</q-card>
<q-card v-else class="q-pa-lg q-pt-xl lnbits__dialog-card">
<div class="text-center q-mb-lg">
<div v-if="props.row.isPaid && props.row.isIn">
<q-icon
size="18px"
:name="'call_received'"
:color="'green'"
></q-icon>
Payment Received
</div>
<div v-else-if="props.row.isPaid && props.row.isOut">
<q-icon
size="18px"
:name="'call_made'"
:color="'pink'"
></q-icon>
Payment Sent
</div>
<div v-else>
<q-icon name="settings_ethernet" color="grey"></q-icon>
Outgoing payment pending
</div>
<q-tooltip>Payment Hash</q-tooltip>
<div class="text-wrap mono q-pa-md">
{{ props.row.payment_hash }}
</div>
</div>
</q-card>
</q-dialog>
</template> </template>
{% endraw %} {% endraw %}
</q-table> </q-table>

View File

@ -137,15 +137,12 @@
Invoice: function () { Invoice: function () {
var self = this var self = this
axios axios
.post( .post('/lnticket/api/v1/tickets/{{ form_id }}', {
'/lnticket/api/v1/tickets/{{ form_id }}',
{
form: '{{ form_id }}', form: '{{ form_id }}',
name: self.formDialog.data.name, name: self.formDialog.data.name,
email: self.formDialog.data.email, email: self.formDialog.data.email,
ltext: self.formDialog.data.text, ltext: self.formDialog.data.text
} })
)
.then(function (response) { .then(function (response) {
self.paymentReq = response.data.payment_request self.paymentReq = response.data.payment_request
self.paymentCheck = response.data.payment_hash self.paymentCheck = response.data.payment_hash

View File

@ -66,3 +66,12 @@ a.inherit {
direction: ltr; direction: ltr;
-moz-font-feature-settings: 'liga'; -moz-font-feature-settings: 'liga';
-moz-osx-font-smoothing: grayscale; } -moz-osx-font-smoothing: grayscale; }
.text-wrap {
word-wrap: break-word;
word-break: break-all;
}
.mono {
font-family: monospace;
}