1 // Copyright 2020 Blue Static <https://www.bluestatic.org>
2 // This program is free software licensed under the GNU General Public License,
3 // version 3.0. The full text of the license can be found in LICENSE.txt.
4 // SPDX-License-Identifier: GPL-3.0-only
6 import { createMemo } from 'solid-js';
7 import { For } from 'solid-js/dom';
8 import { TaxReturn, Form } from 'ustaxlib/core';
10 const S = require('./FormView.css');
17 export default function FormView(props: FormProps) {
18 const lineKeys = createMemo(() => Object.keys(props.form.lines));
22 <h2 class={S.formName}>Form {props.form.name}</h2>
24 <table class={S.table}>
25 <For each={lineKeys()}>
26 {key => <Line tr={props.tr} line={props.form.lines[key]} />}
33 function Line(props: { tr, line }) {
34 const { tr, line } = props;
35 const value = createMemo(() => {
37 return JSON.stringify(line.value(tr));
39 return <span class={S.error} title={e.stack}>{e.message}</span>;
44 <th class={S.id}>{line.id}</th>
45 <td class={S.description}>{line.description}</td>
46 <td class={S.value}>{value()}</td>