diff options
| author | ivar <i@oiee.no> | 2025-12-26 22:19:09 +0100 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2025-12-26 22:19:09 +0100 |
| commit | abf37599c877a8cc83e5a24c775c3999a9879abf (patch) | |
| tree | 234fbafdadda08735c4cbf6d3092bebd1d725691 /app/src/routes/+page.svelte | |
| parent | fe0fe074ec8e8959bbdeff0ccc7f68d20b30e963 (diff) | |
| download | sparebank1-actualbudget-abf37599c877a8cc83e5a24c775c3999a9879abf.tar.xz sparebank1-actualbudget-abf37599c877a8cc83e5a24c775c3999a9879abf.zip | |
Remove delta from form, wip import method
Diffstat (limited to 'app/src/routes/+page.svelte')
| -rw-r--r-- | app/src/routes/+page.svelte | 23 |
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>→</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> |
