| 1 |
<script lang="ts"> |
| 2 |
import type { EntryBaseAttributes } from "../entries"; |
| 3 |
import { urlForAccount, urlForSource } from "../helpers"; |
| 4 |
import { _ } from "../i18n"; |
| 5 |
|
| 6 |
type ContextBalance = Record<string, string[]>; |
| 7 |
interface Props { |
| 8 |
entry: EntryBaseAttributes; |
| 9 |
balances_before: ContextBalance | null; |
| 10 |
balances_after: ContextBalance | null; |
| 11 |
} |
| 12 |
|
| 13 |
let { entry, balances_before, balances_after }: Props = $props(); |
| 14 |
</script> |
| 15 |
|
| 16 |
<p> |
| 17 |
{_("Location")}: |
| 18 |
<code> |
| 19 |
<a href={$urlForSource(entry.meta.filename, entry.meta.lineno)}> |
| 20 |
{entry.meta.filename}:{entry.meta.lineno} |
| 21 |
</a> |
| 22 |
</code> |
| 23 |
</p> |
| 24 |
|
| 25 |
{#if balances_before && balances_after} |
| 26 |
<details> |
| 27 |
<summary> |
| 28 |
<span>{_("Context")}</span> |
| 29 |
</summary> |
| 30 |
<div> |
| 31 |
<table> |
| 32 |
<thead> |
| 33 |
<tr> |
| 34 |
<th colspan="2">{_("Balances before entry")}</th> |
| 35 |
</tr> |
| 36 |
</thead> |
| 37 |
<tbody> |
| 38 |
{#each Object.entries(balances_before) as [account, inventory]} |
| 39 |
<tr> |
| 40 |
<td><a href={$urlForAccount(account)}>{account}</a></td> |
| 41 |
<td> |
| 42 |
{#each inventory as amount} |
| 43 |
{amount} |
| 44 |
<br /> |
| 45 |
{/each} |
| 46 |
</td> |
| 47 |
</tr> |
| 48 |
{/each} |
| 49 |
</tbody> |
| 50 |
</table> |
| 51 |
<table> |
| 52 |
<thead> |
| 53 |
<tr> |
| 54 |
<th colspan="2">{_("Balances after entry")}</th> |
| 55 |
</tr> |
| 56 |
</thead> |
| 57 |
<tbody> |
| 58 |
{#each Object.entries(balances_after) as [account, inventory]} |
| 59 |
<tr> |
| 60 |
<td><a href={$urlForAccount(account)}>{account}</a></td> |
| 61 |
<td> |
| 62 |
{#each inventory as amount} |
| 63 |
{amount} |
| 64 |
<br /> |
| 65 |
{/each} |
| 66 |
</td> |
| 67 |
</tr> |
| 68 |
{/each} |
| 69 |
</tbody> |
| 70 |
</table> |
| 71 |
</div> |
| 72 |
</details> |
| 73 |
{/if} |