From 032449b2a4adcabe5f4bc00bb0281d55a8d84c45 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 24 Oct 2023 23:14:24 -0700 Subject: print button --- src/locales/en.json | 3 +- src/routes/(app)/payment/[id]/+page.svelte | 47 +++++++++---- .../(app)/payment/[id]/plain/+page.server.js | 6 ++ src/routes/(app)/payment/[id]/plain/+page.svelte | 77 ++++++++++++++++++++++ 4 files changed, 120 insertions(+), 13 deletions(-) create mode 100644 src/routes/(app)/payment/[id]/plain/+page.server.js create mode 100644 src/routes/(app)/payment/[id]/plain/+page.svelte (limited to 'src') diff --git a/src/locales/en.json b/src/locales/en.json index 7dd7c258..1ec8cced 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -312,6 +312,7 @@ "redeemed": "Redeemed", "redeemedBy": "Redeemed by", "sendMessage": "Write a message...", - "fundsClaimed": "Funds claimed!" + "fundsClaimed": "Funds claimed!", + "print": "Print" } } diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 12bb1c2d..38b91658 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -18,11 +18,16 @@ }; fee = fee || 0; + + let direction = amount > 0 ? $t('payments.from') : $t('payments.to') + direction = direction[0].toUpperCase() + direction.substr(1, direction.length); - + + +

@@ -31,7 +36,7 @@ {#if p.with}
- {amount > 0 ? 'From' : 'To'} + {direction}
@@ -44,7 +49,7 @@ {/if} {#if p.type === types.pot}
- {amount > 0 ? 'From' : 'To'} + {direction}
@@ -56,7 +61,7 @@
{/if}
- Amount + {$t('payments.amount')}
{f(fiat(a, rate), currency)} @@ -67,7 +72,7 @@ {#if tip} diff --git a/src/routes/(app)/payment/[id]/plain/+page.server.js b/src/routes/(app)/payment/[id]/plain/+page.server.js new file mode 100644 index 00000000..1c90ab69 --- /dev/null +++ b/src/routes/(app)/payment/[id]/plain/+page.server.js @@ -0,0 +1,6 @@ +import { auth, get } from '$lib/utils'; + +export async function load({ cookies, params }) { + let payment = await get(`/payments/${params.id}`, auth(cookies)); + return { payment }; +} diff --git a/src/routes/(app)/payment/[id]/plain/+page.svelte b/src/routes/(app)/payment/[id]/plain/+page.svelte new file mode 100644 index 00000000..5ffd1656 --- /dev/null +++ b/src/routes/(app)/payment/[id]/plain/+page.svelte @@ -0,0 +1,77 @@ + + +
+
+ Amount +
+ {f(fiat(a, rate), currency)} +
+
+ + {#if tip} +
+ Tip +
+ {f(fiat(tip, rate), currency)} + ({Math.round((tip * 100) / Math.abs(a))}%) +
+
+ +
+ Total +
+ {f(fiat(a + (tip || 0), rate), currency)} +
+
+ {/if} + +
+ Date +
+ {format(new Date(created), 'MMMM d')}, + {format(new Date(created), 'h:mm aaa')} +
+
+ + {#if type === 'bitcoin'} +
+ Txid +
+
+ {id} +
+
+
+ {/if} +
+ + +
+ -- cgit v1.2.3