aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/routes/+page.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/routes/+page.svelte')
-rw-r--r--app/src/routes/+page.svelte23
1 files changed, 11 insertions, 12 deletions
diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte
index 7b0a495..6f257f6 100644
--- a/app/src/routes/+page.svelte
+++ b/app/src/routes/+page.svelte
@@ -1,18 +1,19 @@
<script lang="ts">
import Button from "$lib/ui/button.svelte";
- import { clear_auth_session, init_auth_session } from "./sb1.remote";
+ import { clear_auth_session, init_auth_session } from "./methods.remote";
import type { PageProps } from "./$types";
import { Temporal } from "temporal-polyfill";
import { instantAsHtmlInputValueString } from "$lib/helpers";
+ import type { ImportForm } from "$lib/shared";
let { data }: PageProps = $props();
let navigating = $state(false);
- let form = $state({
+ let form = $state<ImportForm>({
budgetId: "",
- mappings: [] as Array<{ sb1: string; actual: string }>,
- delta: instantAsHtmlInputValueString(Temporal.Now.instant().subtract("PT24H")),
- dry: true,
+ mappings: [],
+ dryRun: true,
});
+
async function run() {}
async function authorize() {
@@ -27,10 +28,10 @@
location.reload();
}
- function mappingChanged(sb1: string, actual: string) {
+ function onMappingChanged(sb1Id: string, actualId: string) {
let mappings = form.mappings;
- if (mappings.find((c) => c.sb1 === sb1)) mappings = mappings.filter((c) => c.sb1 !== sb1);
- mappings.push({ sb1, actual });
+ if (mappings.find((c) => c.sb1Id === sb1Id)) mappings = mappings.filter((c) => c.sb1Id !== sb1Id);
+ mappings.push({ sb1Id, actualId });
form.mappings = mappings;
}
@@ -55,7 +56,7 @@
<code>{account.name}</code>
<span>&#8594;</span>
<label for={actualId}>Actual</label>
- <select name={actualId} id={actualId} onchange={(e) => mappingChanged(account.key, e.currentTarget.value)}>
+ <select name={actualId} id={actualId} onchange={(e) => onMappingChanged(account.key, e.currentTarget.value)}>
<option value="-" selected>-</option>
{#each data.actual.accounts as actual}
<option value={actual.id}>
@@ -66,9 +67,7 @@
</div>
{/each}
<h4>Ellers</h4>
- <label for="delta">Importer transaksjoner siden</label>
- <input type="date" id="delta" bind:value={form.delta} /><br />
- <input type="checkbox" id="dry" bind:checked={form.dry} /><label for="dry">Tørrkjøring</label><br /><br />
+ <input type="checkbox" id="dry" bind:checked={form.dryRun} /><label for="dry">Tørrkjøring</label><br /><br />
<input type="submit" />
</fieldset>
</form>