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

View File

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