blob: 3273752a9ac2411132f04c3321ddd80128d9843a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<script>
import { onMount } from 'svelte';
import { enhance } from '$app/forms';
import { selectedRate } from '$lib/store';
import { post } from '$lib/utils';
import { goto } from '$app/navigation';
export let data;
let amount = 22000;
let {
currency,
account: { balance },
username
} = data.user;
let { tickets } = data;
let ticket = tickets.length;
</script>
<div class="mx-auto h-screen flex items-center justify-center px-4">
<div class="font-normal text-gray-800 mx-auto mb-8 space-y-8">
<h1 class="mb-4 text-4xl font-bold leading-none tracking-tight text-gray-800 text-center">
Purchase Ticket
</h1>
<img
src={`/tickets/${(ticket + 1).toString().padStart(2, '0')}.png`}
class="w-full max-w-[800px]"
alt="Ticket"
/>
{#if balance >= amount}
<form action="?/internal" method="POST" use:enhance>
<input type="hidden" name="username" value={username} />
<div class="w-full flex">
<button
class="bg-black text-white border rounded-full px-8 py-4 font-bold hover:opacity-80 mx-auto text-2xl"
>
Count me in
</button>
</div>
</form>
{:else}
<h1 class="mb-4 text-xl font-bold leading-none tracking-tight text-gray-800 text-center">
Payment Options
</h1>
<div class="flex justify-center gap-4">
<form action="?/lightning" method="POST">
<input type="hidden" name="currency" value={currency} />
<input type="hidden" name="username" value={username} />
<button class="border rounded-full px-8 py-4 font-bold hover:opacity-80 mx-auto text-2xl">
Lightning
</button>
</form>
<a href={`purchase/card`}>
<button class="border rounded-full px-8 py-4 font-bold hover:opacity-80 mx-auto text-2xl">
Credit Card
</button>
</a>
</div>
{/if}
</div>
</div>
|