rentease/internal/views/reports.templ
2024-02-17 13:56:51 +01:00

51 lines
1.1 KiB
Text

package views
import (
"strconv"
)
templ Reports(months []string, m int, year string) {
@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 {
if i+1 == m {
<option value={ strconv.Itoa(i + 1) } selected>{ month } </option>
} else {
<option value={ strconv.Itoa(i + 1) }>{ month } </option>
}
}
</select>
</label>
</fieldset>
<button>
Submit
</button>
</form>
</section>
<section id="report"></section>
}
}