Keep campsite type and date when going to booking form from type page

This commit is contained in:
jordi fita mas 2023-12-13 23:42:18 +01:00
parent ded10ded08
commit 20d32d6a6d
2 changed files with 4 additions and 3 deletions

View File

@ -38,6 +38,7 @@ func (h *PublicHandler) Handler(user *auth.User, company *auth.Company, conn *da
switch r.Method { switch r.Method {
case http.MethodGet: case http.MethodGet:
page := newPublicPage(r.Context(), company, conn, user.Locale) page := newPublicPage(r.Context(), company, conn, user.Locale)
_ = page.Form.Parse(r) // Get query parameters, if any
page.MustRender(w, r, user, company, conn) page.MustRender(w, r, user, company, conn)
case http.MethodPost: case http.MethodPost:
makeReservation(w, r, user, company, conn) makeReservation(w, r, user, company, conn)

View File

@ -35,18 +35,18 @@
<div class="campsite_type_booking"> <div class="campsite_type_booking">
<form action="/{{ currentLocale }}/booking" method="get"> <form action="/{{ currentLocale }}/booking" method="get">
<input type="hidden" name="type" value="{{ .Slug }}"> <input type="hidden" name="campsite_type" value="{{ .Slug }}">
<fieldset> <fieldset>
<label> <label>
{{( pgettext "Check-in Date" "input")}} {{( pgettext "Check-in Date" "input")}}
<br> <br>
<input name="checkin_date" type="date" required> <input name="arrival_date" type="date" required>
<br> <br>
</label> </label>
<label> <label>
{{( pgettext "Check-out Date" "input")}} {{( pgettext "Check-out Date" "input")}}
<br> <br>
<input name="checkout_date" type="date" required> <input name="departure_date" type="date" required>
<br> <br>
</label> </label>
</fieldset> </fieldset>