udemy-go-web-1/templates/admin-all-reservations.page.tmpl

54 lines
1.4 KiB
Cheetah
Raw Permalink Normal View History

{{template "admin" .}}
2024-07-22 20:14:48 +00:00
{{define "css"}}
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" type="text/css">
{{end}}
{{define "page-title"}}
All Reservations
{{end}}
{{define "content"}}
<div class="col-md-12">
2024-07-22 20:14:48 +00:00
{{$res := index .Data "reservations"}}
<table class="table table-striped table-hover" id="all-res">
<thead>
<tr>
<th>ID</th>
<th>Last Name</th>
<th>Room</th>
<th>Arrival</th>
<th>Departure</th>
</tr>
</thead>
<tbody>
{{range $res}}
<tr>
<td>{{ .ID}}</td>
<td>
2024-07-28 13:23:12 +00:00
<a href="/admin/reservations/all/{{.ID}}/show">
2024-07-22 20:14:48 +00:00
{{ .LastName}}
</a>
</td>
<td>{{ .Room.RoomName}}</td>
<td>{{humanDate .StartDate}}</td>
<td>{{humanDate .EndDate}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
2024-07-22 20:14:48 +00:00
{{define "js"}}
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" type="text/javascript"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
const dataTable = new simpleDatatables.DataTable("#all-res", {
select: 3, sort: "desc",
});
})
</script>
{{end}}