Reservation calendar 4
This commit is contained in:
parent
7894a05daf
commit
14828fb901
@ -686,7 +686,9 @@ func (m *Repository) AdminReservationsCalendar(w http.ResponseWriter, r *http.Re
|
||||
}
|
||||
} else {
|
||||
// it's a block
|
||||
blockMap[y.StartDate.Format("2006-01-2")] = y.ReservationID
|
||||
for d := y.StartDate; !d.After(y.EndDate); d = d.AddDate(0, 0, 1) {
|
||||
blockMap[d.Format("2006-01-2")] = y.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
data[fmt.Sprintf("reservation_map_%d", x.ID)] = reservationMap
|
||||
|
@ -27,7 +27,9 @@ Reservations Calendar
|
||||
|
||||
<div class="clearfix"></div>
|
||||
{{range $rooms}}
|
||||
{{$roomId := .ID}}
|
||||
{{$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">
|
||||
@ -41,7 +43,21 @@ Reservations Calendar
|
||||
<tr class="table-light">
|
||||
{{range $index := iterate $dim}}
|
||||
<td class="text-center">
|
||||
<input type="checkbox" name="checked" value="">
|
||||
{{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>
|
||||
{{else}}
|
||||
<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)}}"
|
||||
{{end}}
|
||||
type="checkbox">
|
||||
{{end}}
|
||||
</td>
|
||||
{{end}}
|
||||
</tr>
|
||||
|
@ -50,7 +50,11 @@ Reservation
|
||||
|
||||
<div class="float-start">
|
||||
<input type="submit" class="btn btn-primary" value="Save">
|
||||
{{if eq $src "cal"}}
|
||||
<a href="#" onclick="window.history.go(-1)" class="btn btn-warning">Cancel</a>
|
||||
{{else}}
|
||||
<a href="/admin/reservations-{{$src}}" class="btn btn-warning">Cancel</a>
|
||||
{{end}}
|
||||
<a href="#" class="btn btn-info" onclick="processRes({{$res.ID}})">Mark as Processed</a>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user