2024-07-24 20:23:31 +00:00
|
|
|
{{template "admin" .}}
|
|
|
|
|
|
|
|
{{define "page-title"}}
|
|
|
|
Reservation
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "content"}}
|
|
|
|
{{$res := index .Data "reservation"}}
|
|
|
|
{{$src := index .StringMap "src"}}
|
|
|
|
<div class="col-md-12">
|
|
|
|
<p>
|
|
|
|
<strong>Arrival:</strong> {{humanDate $res.StartDate}} <br>
|
|
|
|
<strong>Departure:</strong> {{humanDate $res.EndDate}} <br>
|
|
|
|
<strong>Room:</strong> {{$res.Room.RoomName}} <br>
|
|
|
|
</p>
|
|
|
|
<form method="post" action="/admin/reservations/{{$src}}/{{$res.ID}}" class="" novalidate>
|
|
|
|
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
2024-07-28 13:23:12 +00:00
|
|
|
<input type="hidden" name="year" value="{{index .StringMap "year"}}">
|
|
|
|
<input type="hidden" name="month" value="{{index .StringMap "month"}}">
|
2024-07-24 20:23:31 +00:00
|
|
|
|
|
|
|
<div class="form-group mt-5">
|
|
|
|
<label for="first_name">First name:</label>
|
|
|
|
{{with .Form.Errors.Get "first_name"}}
|
|
|
|
<label class="text-danger">{{.}}</label>
|
|
|
|
{{end}}
|
|
|
|
<input type="text" name="first_name" id="first_name" class="form-control {{with .Form.Errors.Get "first_name"}} is-invalid {{end}}"
|
|
|
|
value="{{$res.FirstName}}" required autocomplete="off">
|
|
|
|
</div>
|
|
|
|
<div class="form-group mt-5">
|
|
|
|
<label for="last_name">Last name:</label>
|
|
|
|
{{with .Form.Errors.Get "last_name"}}
|
|
|
|
<label class="text-danger">{{.}}</label>
|
|
|
|
{{end}}
|
|
|
|
<input type="text" name="last_name" id="last_name" class="form-control {{with .Form.Errors.Get "last_name"}} is-invalid {{end}}"
|
|
|
|
value="{{$res.LastName}}" required autocomplete="off">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group mt-5">
|
|
|
|
<label for="email">Email:</label>
|
|
|
|
{{with .Form.Errors.Get "email"}}
|
|
|
|
<label class="text-danger">{{.}}</label>
|
|
|
|
{{end}}
|
|
|
|
<input type="email" name="email" id="email" class="form-control {{with .Form.Errors.Get "email"}} is-invalid {{end}}"
|
|
|
|
value="{{$res.Email}}" required autocomplete="off">
|
|
|
|
</div>
|
|
|
|
<div class="form-group mt-5">
|
|
|
|
<label for="phone">Phone number:</label>
|
|
|
|
<input type="text" name="phone" id="phone" class="form-control" value="{{$res.Phone}}" autocomplete="off">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
2024-07-25 12:09:42 +00:00
|
|
|
<div class="float-start">
|
|
|
|
<input type="submit" class="btn btn-primary" value="Save">
|
2024-07-28 11:59:54 +00:00
|
|
|
{{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}}
|
2024-07-28 13:23:12 +00:00
|
|
|
{{ if eq $res.Processed 0}}
|
2024-07-25 12:09:42 +00:00
|
|
|
<a href="#" class="btn btn-info" onclick="processRes({{$res.ID}})">Mark as Processed</a>
|
2024-07-28 13:23:12 +00:00
|
|
|
{{end}}
|
2024-07-25 12:09:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="float-end">
|
|
|
|
<a href="#" class="btn btn-danger" onclick="deleteRes({{$res.ID}})">Delete</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- clear the float -->
|
|
|
|
<div class="clearfix"></div>
|
2024-07-24 20:23:31 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2024-07-25 11:51:31 +00:00
|
|
|
{{define "js"}}
|
|
|
|
{{$src := index .StringMap "src"}}
|
|
|
|
<script>
|
|
|
|
function processRes(id) {
|
|
|
|
attention.custom({
|
|
|
|
icon: 'warning',
|
|
|
|
msg: 'Are you sure?',
|
|
|
|
callback: function(result) {
|
|
|
|
if (result != false) {
|
2024-07-28 13:23:12 +00:00
|
|
|
window.location.href = "/admin/process-reservation/{{$src}}/" + id + "/do?y={{index .StringMap "year"}}&m={{index .StringMap "month"}}";
|
2024-07-25 11:51:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2024-07-25 12:09:42 +00:00
|
|
|
function deleteRes(id) {
|
|
|
|
attention.custom({
|
|
|
|
icon: 'error',
|
|
|
|
msg: 'Are you sure?',
|
|
|
|
callback: function(result) {
|
|
|
|
if (result != false) {
|
2024-07-28 13:23:12 +00:00
|
|
|
window.location.href = "/admin/delete-reservation/{{$src}}/" + id + "/do?y={{index .StringMap "year"}}&m={{index .StringMap "month"}}";
|
2024-07-25 12:09:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2024-07-25 11:51:31 +00:00
|
|
|
</script>
|
|
|
|
{{end}}
|
|
|
|
|