rename reservation to availability
This commit is contained in:
parent
a8b56b50db
commit
97b9898dfc
@ -22,9 +22,9 @@ func routes(app *config.AppConfig) http.Handler {
|
|||||||
mux.Get("/contact", handlers.Repo.Contact)
|
mux.Get("/contact", handlers.Repo.Contact)
|
||||||
mux.Get("/generals-quarters", handlers.Repo.Generals)
|
mux.Get("/generals-quarters", handlers.Repo.Generals)
|
||||||
mux.Get("/majors-suite", handlers.Repo.Majors)
|
mux.Get("/majors-suite", handlers.Repo.Majors)
|
||||||
mux.Get("/reservation", handlers.Repo.Reservation)
|
mux.Get("/availability", handlers.Repo.Availability)
|
||||||
mux.Post("/reservation", handlers.Repo.PostReservation)
|
mux.Post("/availability", handlers.Repo.PostAvailability)
|
||||||
mux.Get("/reservation-json", handlers.Repo.ReservationJSON)
|
mux.Get("/availability-json", handlers.Repo.AvailabilityJSON)
|
||||||
mux.Get("/make-reservation", handlers.Repo.MakeReservation)
|
mux.Get("/make-reservation", handlers.Repo.MakeReservation)
|
||||||
|
|
||||||
fileServer := http.FileServer(http.Dir("./static/"))
|
fileServer := http.FileServer(http.Dir("./static/"))
|
||||||
|
@ -71,13 +71,13 @@ func (m *Repository) MakeReservation(w http.ResponseWriter, r *http.Request) {
|
|||||||
render.RenderTemplate(w, r, "make-reservation.page.tmpl", &models.TemplateData{})
|
render.RenderTemplate(w, r, "make-reservation.page.tmpl", &models.TemplateData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeReservation is the make reservation page handler
|
// Availability is the search for availability page handler
|
||||||
func (m *Repository) Reservation(w http.ResponseWriter, r *http.Request) {
|
func (m *Repository) Availability(w http.ResponseWriter, r *http.Request) {
|
||||||
render.RenderTemplate(w, r, "reservation.page.tmpl", &models.TemplateData{})
|
render.RenderTemplate(w, r, "availability.page.tmpl", &models.TemplateData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeReservation is the make reservation page handler
|
// PostAvailability is the search for availability page handler
|
||||||
func (m *Repository) PostReservation(w http.ResponseWriter, r *http.Request) {
|
func (m *Repository) PostAvailability(w http.ResponseWriter, r *http.Request) {
|
||||||
start := r.Form.Get("start")
|
start := r.Form.Get("start")
|
||||||
end := r.Form.Get("end")
|
end := r.Form.Get("end")
|
||||||
fmt.Fprintf(w, "Posted to search availability from %s to %s", start, end)
|
fmt.Fprintf(w, "Posted to search availability from %s to %s", start, end)
|
||||||
@ -88,8 +88,8 @@ type responseJSON struct {
|
|||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeReservation is the make reservation page handler
|
// AvailabilityJSON is the search for availability page handler
|
||||||
func (m *Repository) ReservationJSON(w http.ResponseWriter, r *http.Request) {
|
func (m *Repository) AvailabilityJSON(w http.ResponseWriter, r *http.Request) {
|
||||||
resp := responseJSON{
|
resp := responseJSON{
|
||||||
OK: "true",
|
OK: "true",
|
||||||
Message: "Available!",
|
Message: "Available!",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h1 class="text-center mt-5">Search for Availability</h1>
|
<h1 class="text-center mt-5">Search for Availability</h1>
|
||||||
|
|
||||||
<form action="/reservation" method="post" novalidate class="needs-validation">
|
<form action="/availability" method="post" novalidate class="needs-validation">
|
||||||
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
||||||
<div id="reservation-dates" class="row">
|
<div id="reservation-dates" class="row">
|
||||||
<div class="col mb-3">
|
<div class="col mb-3">
|
@ -45,7 +45,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/reservation">Book Now</a>
|
<a class="nav-link" href="/availability">Book Now</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/contact">Contact</a>
|
<a class="nav-link" href="/contact">Contact</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user