holiday-api/templates/index.gohtml

102 lines
4.3 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Holiday-api</title>
</head>
<body>
<h1>Holiday-api</h1>
<p>Welcome to admin interface for holiday api</p>
<div>
<a href="/admin/holiday">Add a holiday</a>
</div>
<div>
<form id="filter-holidays" action="/admin" method="get">
<label for="country">Country</label>
<select id="country" name="country">
<option value="HR" {{if eq .search.Country "HR"}}selected{{end}}>Croatia</option>
<option value="GB" {{if eq .search.Country "GB"}}selected{{end}}>Great Britain</option>
<option value="US" {{if eq .search.Country "US"}}selected{{end}}>USA</option>
<option value="FR" {{if eq .search.Country "FR"}}selected{{end}}>France</option>
</select>
<label for="year">Year</label>
<select id="year" name="year">
<option value="2020" {{if eq (deferint .search.Year) 2020}}selected{{end}}>2020</option>
<option value="2021" {{if eq (deferint .search.Year) 2021}}selected{{end}}>2021</option>
<option value="2022" {{if eq (deferint .search.Year) 2022}}selected{{end}}>2022</option>
<option value="2023" {{if eq (deferint .search.Year) 2023}}selected{{end}}>2023</option>
<option value="2024" {{if eq (deferint .search.Year) 2024}}selected{{end}}>2024</option>
<option value="2025" {{if eq (deferint .search.Year) 2025}}selected{{end}}>2025</option>
<option value="2026" {{if eq (deferint .search.Year) 2026}}selected{{end}}>2026</option>
<option value="2027" {{if eq (deferint .search.Year) 2027}}selected{{end}}>2027</option>
</select>
<div>
<label>State holiday</label>
<label for="state-holiday-true">True</label>
<input type="radio" value="true" {{if boolcmp .search.StateHoliday "true"}}checked{{end}} id="state-holiday-true" name="stateHoliday">
<label for="state-holiday-false">False</label>
<input type="radio" value="false" {{if boolcmp .search.StateHoliday "false"}}checked{{end}} id="state-holiday-false" name="stateHoliday">
<label for="state-holiday-any">Any</label>
<input type="radio" value="" {{if boolcmp .search.StateHoliday "nil"}}checked{{end}} id="state-holiday-any" name="stateHoliday">
</div>
<div>
<label>Religious holiday</label>
<label for="religious-holiday-true">True</label>
<input type="radio" value="true" {{if boolcmp .search.ReligiousHoliday "true"}}checked{{end}} id="religious-holiday-true" name="religiousHoliday">
<label for="religious-holiday-false">False</label>
<input type="radio" value="false" {{if boolcmp .search.ReligiousHoliday "false"}}checked{{end}} id="religious-holiday-false" name="religiousHoliday">
<label for="religious-holiday-any">Any</label>
<input type="radio" value="" {{if boolcmp .search.ReligiousHoliday "nil"}}checked{{end}} id="religious-holiday-any" name="religiousHoliday">
</div>
<button type="submit">Search</button>
</form>
</div>
<div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Date</th>
<th>State holiday</th>
<th>Religious holiday</th>
<th></th>
</tr>
</thead>
<tbody>
{{range $entry := .holidays.Holidays}}
<tr>
<td>{{$entry.Name}}</td>
<td>{{$entry.Description}}</td>
<td>{{$entry.Date.Format "2006-01-02"}}</td>
<td>{{$entry.IsStateHoliday}}</td>
<td>{{$entry.IsReligiousHoliday}}</td>
<td>
<a href="/admin/holiday?id={{$entry.Id}}">Edit</a>
<form action="/admin/holiday/delete" method="post">
<input id="id" type="hidden" name="id" value="{{$entry.Id}}">
<button type="submit">Delete</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</body>
</html>