Compare commits
3 Commits
98765a3d2d
...
377c928372
Author | SHA1 | Date | |
---|---|---|---|
377c928372 | |||
253b7ce60b | |||
089cdf067e |
|
@ -37,6 +37,8 @@ export interface Expense {
|
||||||
value: number;
|
value: number;
|
||||||
comment: string;
|
comment: string;
|
||||||
date: string;
|
date: string;
|
||||||
|
card: Card;
|
||||||
|
show_value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Income {
|
export interface Income {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await fetchCategories();
|
await fetchCategories();
|
||||||
await fetchCards();
|
await fetchCards(true);
|
||||||
await fetchTypes();
|
await fetchTypes();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,8 +33,12 @@
|
||||||
types = await result.json();
|
types = await result.json();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function fetchCards() {
|
async function fetchCards(preloadCurrencies = false) {
|
||||||
const result = await fetch("/api/card/all");
|
const queryParams = new URLSearchParams({
|
||||||
|
preload_currencies: preloadCurrencies.toString(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await fetch(`/api/card/all?${queryParams}`);
|
||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
const obj = await result.json();
|
const obj = await result.json();
|
||||||
error = obj.message;
|
error = obj.message;
|
||||||
|
@ -169,7 +173,7 @@
|
||||||
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md focus:ring focus:ring-indigo-200 focus:border-indigo-500"
|
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md focus:ring focus:ring-indigo-200 focus:border-indigo-500"
|
||||||
>
|
>
|
||||||
{#each cards as card}
|
{#each cards as card}
|
||||||
<option value={card.id}>{card.name}</option>
|
<option value={card.id}>{card.display_name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
@ -255,13 +259,10 @@
|
||||||
class="bg-white p-4 rounded-lg shadow-md flex justify-between items-center"
|
class="bg-white p-4 rounded-lg shadow-md flex justify-between items-center"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<strong class="block text-lg">{NumberToFPA(expense.value)}</strong>
|
<strong class="block text-lg">{expense.show_value}</strong>
|
||||||
<div class="text-sm text-gray-600">
|
<div class="text-sm text-gray-600">
|
||||||
<span class="font-bold">Card:</span>
|
<span class="font-bold">Card:</span>
|
||||||
{getCardName(expense.card_id)}
|
{expense.card.display_name}
|
||||||
<span class="text-sm"
|
|
||||||
>{`•${cards.find((card) => card.id == expense.card_id)?.last_digits}`}</span
|
|
||||||
>
|
|
||||||
<span class="font-bold">Type:</span>
|
<span class="font-bold">Type:</span>
|
||||||
<span style="color: {getTypeColor(expense.type_id)};"
|
<span style="color: {getTypeColor(expense.type_id)};"
|
||||||
>{getTypeName(expense.type_id)}</span
|
>{getTypeName(expense.type_id)}</span
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
>
|
>
|
||||||
{#each cards as card}
|
{#each cards as card}
|
||||||
{#if card.id != currentTransfer.to_card_id}
|
{#if card.id != currentTransfer.to_card_id}
|
||||||
<option value={card.id}>{card.name}</option>
|
<option value={card.id}>{card.display_name}</option>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
>
|
>
|
||||||
{#each cards as card}
|
{#each cards as card}
|
||||||
{#if card.id != currentTransfer.from_card_id}
|
{#if card.id != currentTransfer.from_card_id}
|
||||||
<option value={card.id}>{card.name}</option>
|
<option value={card.id}>{card.display_name}</option>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user