Remember checkout country on prepaid deposit

This commit is contained in:
2025-03-12 15:48:00 +01:00
parent 3a6748bc10
commit 335012bdb8
2 changed files with 23 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
<script>
import { onMount } from 'svelte';
import Euro from '../util/Euro.svelte';
import LoadingIndicator from '../util/LoadingIndicator.svelte';
@@ -42,6 +43,20 @@ let countries = [
let amounts = [10, 20, 50, 100, 200, 500, 1000, 2000, 5000]
const set_country = (c) => {
country = c
window.localStorage.setItem("checkout_country", c.name)
}
onMount(() => {
const country_name = window.localStorage.getItem("checkout_country")
for (let i = 0; i < countries.length; i++) {
if (countries[i].name === country_name) {
country = countries[i]
}
}
})
const checkout = async () => {
loading = true
@@ -72,7 +87,6 @@ const checkout = async () => {
loading = false
}
}
</script>
<div class="highlight_border">
@@ -85,7 +99,7 @@ const checkout = async () => {
</div>
<div class="countries">
{#each countries as c}
<button on:click={() => country = c}>
<button on:click={() => set_country(c)}>
<span class="icon_unicode">{c.flag}</span>
<span>{c.name}</span>
</button>
@@ -146,7 +160,7 @@ const checkout = async () => {
<div style="display: flex;">
<button on:click={() => country = null} style="flex: 0 0 auto;">
<i class="icon">chevron_left</i>
Back
Change country
</button>
<div style="flex: 1 1 auto;"></div>
<div style="flex: 0 0 auto; display: flex; gap: 0.25em; align-items: center;">

View File

@@ -95,8 +95,11 @@ onMount(() => {
</p>
<p>
The Prepaid plan is charged daily based on usage. When you reach
negative balance the subscription will automatically end. You will need
a positive balance to activate the subscription again.
negative balance the subscription will automatically end. Need at least
<Euro amount="1e6"/> account credit to activate prepaid. Your current
prepaid credit is <Euro amount={window.user.balance_micro_eur}/>. You
can deposit credit on the <a href="/user/prepaid/deposit">credit deposit
page</a>.
</p>
<h3>Available subscription plans</h3>
@@ -140,7 +143,7 @@ onMount(() => {
</div>
<div>
<div class="feat_label" class:feat_highlight={subscription === "prepaid"}>
Prepaid (credit <Euro amount={window.user.balance_micro_eur}/>)<br/>
Prepaid<br/>
{#if subscription === "prepaid"}
Currently active
{:else}