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, createState } from 'solid-js';
7 import { For } from 'solid-js/dom';
8 import { Form, TaxReturn } from 'ustaxlib/core';
10 import FormView from './FormView';
12 const S = require('./TaxReturnView.css');
18 export default function TaxReturnView(props: Props) {
19 const [ state, setState ] = createState({ form: props.tr.forms[0] });
21 const changeForm = e => {
22 setState({ form: props.tr.forms[e.target.value] });
25 const formIndexToName = createMemo(() => props.tr.forms.map((form, i) => [i, form.name]));
27 const formSelector = (
28 <select onchange={changeForm}>
29 <For each={formIndexToName()}>
30 {tuple => (<option value={tuple[0]}>{tuple[1]}</option>)}
37 <div class={S.header}>
38 <h1>ustaxlib Federal {props.tr.year}</h1>
42 <FormView tr={props.tr} form={state.form as Form<any>} />