2024-07-22 12:05:20 +00:00
|
|
|
{{template "admin" .}}
|
|
|
|
|
|
|
|
{{define "page-title"}}
|
|
|
|
Reservations Calendar
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "content"}}
|
2024-07-26 11:40:56 +00:00
|
|
|
{{$now := index .Data "now"}}
|
|
|
|
{{$rooms := index .Data "rooms"}}
|
|
|
|
{{$dim := index .IntMap "days_in_month"}}
|
2024-07-27 20:39:23 +00:00
|
|
|
{{$curMonth := index .StringMap "this_month"}}
|
|
|
|
{{$curYear := index .StringMap "this_month_year"}}
|
2024-07-22 12:05:20 +00:00
|
|
|
<div class="col-md-12">
|
2024-07-26 08:18:27 +00:00
|
|
|
<div class="text-center">
|
2024-07-26 11:40:56 +00:00
|
|
|
<h3>{{formatDate $now "January"}} {{formatDate $now "2006"}}</h3>
|
2024-07-26 08:18:27 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="float-start">
|
|
|
|
<a class="btn btn-sm btn-outline-secondary"
|
|
|
|
href="/admin/reservations-calendar?y={{index .StringMap "last_month_year"}}&m={{index .StringMap "last_month"}}"><<</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="float-end">
|
|
|
|
<a class="btn btn-sm btn-outline-secondary"
|
|
|
|
href="/admin/reservations-calendar?y={{index .StringMap "next_month_year"}}&m={{index .StringMap "next_month"}}">>></a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="clearfix"></div>
|
2024-07-28 12:43:39 +00:00
|
|
|
<form method="post" action="/admin/reservations-calendar">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
|
|
|
<input type="hidden" name="m" value="{{index .StringMap "this_month"}}">
|
|
|
|
<input type="hidden" name="y" value="{{index .StringMap "this_month_year"}}">
|
|
|
|
|
|
|
|
{{range $rooms}}
|
|
|
|
{{$roomID := .ID}}
|
|
|
|
{{$blocks := index $.Data (printf "block_map_%d" .ID)}}
|
|
|
|
{{$reservations := index $.Data (printf "reservation_map_%d" .ID)}}
|
|
|
|
<h4 class="mt-4">{{.RoomName}}</h4>
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-bordered table-sm">
|
|
|
|
<tr class="table-dark">
|
|
|
|
{{range $index := iterate $dim}}
|
|
|
|
<td class="text-center">
|
|
|
|
{{add $index 1}}
|
|
|
|
</td>
|
|
|
|
{{end}}
|
|
|
|
</tr>
|
|
|
|
<tr class="table-light">
|
|
|
|
{{range $index := iterate $dim}}
|
|
|
|
<td class="text-center">
|
|
|
|
{{if gt (index $reservations (printf "%s-%s-%d" $curYear $curMonth (add $index 1))) 0}}
|
|
|
|
<a href="/admin/reservations/cal/{{index $reservations (printf "%s-%s-%d" $curYear $curMonth (add $index 1))}}">
|
|
|
|
<span class="text-danger">R</span>
|
|
|
|
</a>
|
2024-07-28 11:59:54 +00:00
|
|
|
{{else}}
|
2024-07-28 12:43:39 +00:00
|
|
|
<input
|
|
|
|
{{if gt (index $blocks (printf "%s-%s-%d" $curYear $curMonth (add $index 1))) 0}}
|
|
|
|
checked
|
|
|
|
name="remove_block_{{$roomID}}_{{printf "%s-%s-%d" $curYear $curMonth (add $index 1)}}"
|
|
|
|
value="{{index $blocks (printf "%s-%s-%d" $curYear $curMonth (add $index 1))}}"
|
|
|
|
{{else}}
|
|
|
|
name="add_block_{{$roomID}}_{{printf "%s-%s-%d" $curYear $curMonth (add $index 1)}}"
|
|
|
|
value="1"
|
|
|
|
{{end}}
|
|
|
|
type="checkbox">
|
2024-07-28 11:59:54 +00:00
|
|
|
{{end}}
|
2024-07-28 12:43:39 +00:00
|
|
|
</td>
|
|
|
|
{{end}}
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
<hr>
|
|
|
|
<input type="submit" class="btn btn-primary" value="Save Changes">
|
|
|
|
</form>
|
2024-07-22 12:05:20 +00:00
|
|
|
</div>
|
|
|
|
{{end}}
|