rentease/internal/view/reports.templ
2024-08-05 20:19:33 +02:00

55 lines
1.2 KiB
Text

package view
import (
"github.com/rjNemo/rentease/internal/view/layout"
"strconv"
)
templ Reports(months []string, m int, year string) {
@layout.BaseLayout() {
<section>
<hgroup>
<h1>Reports</h1>
<h2>Generate monthly and yearly statements</h2>
</hgroup>
</section>
<section>
<form hx-get="/reports/do" hx-target="#report">
<fieldset>
<legend>Period</legend>
<label for="month">
<input type="radio" id="month" name="period" value="month" checked/>
Monthly
</label>
<label for="year">
<input type="radio" id="year" name="period" value="year"/>
Yearly
</label>
<label for="year">
Year
<input type="number" id="year" name="year" value={ year }/>
</label>
<label for="month">
Month
<select name="month" id="month" autofocus>
for i, month := range months {
<option
value={ strconv.Itoa(i + 1) }
if i+1 == m {
selected
}
>
{ month }
</option>
}
</select>
</label>
</fieldset>
<button>
Submit
</button>
</form>
</section>
<section id="report"></section>
}
}