From b81c097da2ecd19468c5227a0ef267f395da4370 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Mon, 18 Nov 2024 19:24:39 +0200 Subject: [PATCH] Reformat values, balance, credit_line and other elements that should be FPA --- src/routes/card/+page.svelte | 63 +++++++++++++++++++++++++------- src/routes/transfer/+page.svelte | 5 ++- 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/src/routes/card/+page.svelte b/src/routes/card/+page.svelte index 759b79d..20e4c3a 100644 --- a/src/routes/card/+page.svelte +++ b/src/routes/card/+page.svelte @@ -1,6 +1,7 @@ {#if error} @@ -100,22 +127,13 @@ - {#if currentCard.have_credit_line} - - {/if} + {#if currentCard.have_credit_line} + + {/if}
diff --git a/src/routes/transfer/+page.svelte b/src/routes/transfer/+page.svelte index e12c258..83a2ef3 100644 --- a/src/routes/transfer/+page.svelte +++ b/src/routes/transfer/+page.svelte @@ -2,6 +2,7 @@ import { onMount } from "svelte"; import { type Card, type Transfer } from "$lib/entities"; import { selectedDate } from "$lib/stores/dateStore"; + import { NumberToFPA } from "$lib/util/fpa"; let mutateDate = $state($selectedDate); let selectedTime = $state("00:00:00"); @@ -111,7 +112,7 @@ const target = event.target as HTMLInputElement; const rawValue = target.value.replace(/[^0-9]/g, ""); currentTransfer.value = parseInt(rawValue || "0"); - target.value = (currentTransfer.value / 100).toFixed(2); + target.value = NumberToFPA(currentTransfer.value); } const constructedTime = $derived(`${mutateDate}T${selectedTime}Z`); @@ -217,7 +218,7 @@ class="bg-white p-4 rounded-lg shadow-md flex justify-between items-center" >
- {transfer.value} + {NumberToFPA(transfer.value)}
From: {getCardName(transfer.from_card_id)}