Commit Graph

161 Commits

Author SHA1 Message Date
jordi fita mas 23e2fe956f Add a warning on the booking page when payment is using test environment
Apparently, the bank has to validate the fucking thing on the actual
domain, because of reasons, so we have to replace the current web in
production with this version in test mode, meaning that users **will**
believe they have paid, when in fact they have not.

The warning is for these few people that actually read such notices.
2024-02-26 16:00:29 +01:00
jordi fita mas 950bae16e1 Make address, postcode, and city require for booking
Customer changed their mind.
2024-02-24 20:03:11 +01:00
oriol carbonell pujolàs c848330751 Fix gap and margin for booking’s checkbox 2024-02-15 16:55:35 +01:00
jordi fita mas a159bc75f0 Show a disclaimer on top of book button that it is in fact a prebooking 2024-02-15 15:54:22 +01:00
jordi fita mas 3bc4175580 Add authorization holding for payments
This is the mode they want to work with, but i could not test it because
they do not have it enabled in Redsys.  For now, just add the status and
the code to handle the responses.

Now i store all responses, if they are for a valid payment, just in case
i fucked something up. I also needed it because an authorization hold
needs at least two responses: one to accept the hold, and another for
the settlement.
2024-02-15 15:17:21 +01:00
jordi fita mas f2143cd0e6 Add the admin page to see payments
Had to do a couple of changes to the database: add the currency_code to
the payment relation, to format the price according to the payment’s
currency instead of the company’s; and the reference SQL function, to
replace the equivalent golang function, so that i can use it to index
payments.

The rest is mostly the same as any other page, except that the
individual payment’s page is not a form, but a regular info dump.

I also moved the payment settings as a sub-route of payments, as i
believe this makes more sense than an additional user menu item.
2024-02-14 04:54:42 +01:00
jordi fita mas 15dde3f491 Add ready_payment function and use their slug as URL
Now that the payments have slug, i can use them in the URL to show the
actual data of a payment, and kickstart the payment process with Redsys.
2024-02-12 18:06:17 +01:00
jordi fita mas e5023a2a41 Handle the booking cart entirely with HTMx
Besides the dynamic final cart, that was already handled by HTMx, i had
to check the maximum number of guests, whether the accommodation allows
“overflow”, whether dogs are allowed, and that the booking dates were
within the campground’s opening and closing dates.

I could do all of this with AlpineJS, but then i would have to add the
same validation to the backend, prior to accept the payment.  Would not
make more sense to have them in a single place, namely the backend? With
HTMx i can do that.

However, i now have to create the form “piecemeal”, because i may not
have the whole information when the visitor arrives to the booking page,
and i still had the same problem as in commit d2858302efa—parsing the
whole form as is would leave guests and options field empty, rather than
at their minimum values.

One of the fieldsets in that booking form are the arrival and departure
dates, that are the sames we use in the campsite type’s page to
“preselect” these values.  Since now are in a separate struct, i can
reuse the same type and validation logic for both pages, making my
JavaScript code useless, but requiring HTMx.  I think this is a good
tradeoff, in fact.
2024-02-10 03:49:44 +01:00
oriol carbonell pujolàs d2560e8748 Reduce padding of footer’s highlighted section 2024-02-06 10:06:15 +01:00
oriol carbonell pujolàs 771f5077d4 Add bottom padding to campsite type’s title
This is to avoid having the carousel’s arrows overlap the title
2024-02-06 10:04:44 +01:00
oriol carbonell pujolàs 373a6e5b6d Increase font size of home’s links and all arrows 2024-02-06 10:04:12 +01:00
jordi fita mas 2c36e45663 Compute and show the “cart” for the booking form
I have to ask number and age ranges of hosts of guests for all campsite
types, not only those that have price options for adults, children, etc.
because i must compute the tourist tax for adults.  These numbers will
be used to generate de rows for guests when actually creating the
booking, which is not done already.

To satisfy the campsite types that do have a price per guest, not only
per night, i had to add the prices for each range in the
campsite_type_cost relation.  If a campsite type does not have price
per person, then that should be zero; the website then does not display
the price.

The minimal price for any campsite type is one adult for one night,
thus to compute the price i need at least the campsite type, the dates,
and the number of adults, that has a minimum of one.  I changed the
order of the form to ask for these values first, so i can compute the
initial price as soon as possible.  To help further, i show the
<fieldset>s progressively when visitors select options.
2024-02-04 06:37:25 +01:00
jordi fita mas ebcc2a017f Show zones in campground map by default if requested by query parameters
This is to be able to link from the booking form, with a link under the
area preferences, and show the zones layer, that is what customers most
certainly want to see at that point.
2024-02-04 03:43:00 +01:00
jordi fita mas 2a5b6df8cf Emit the input event when changing departure date
It is necessary to detect the change using AlpineJS, for instance.
2024-02-03 03:22:25 +01:00
jordi fita mas cabab93aa9 Remove redundant overflow-x from body 2024-02-03 01:51:36 +01:00
jordi fita mas 1491e975c2 Better control of scroll snap for calendar months on mobile
It is not a problem in desktop, because there is no scroll bar, but in
mobile you can scroll with touch, and i need the months to snap to the
start for the next and previous buttons to work.
2024-02-03 01:32:07 +01:00
jordi fita mas 244cbeddac Avoid horizontal scroll due to slick’s right margin
I can use overflow for that in most sizes, but on mobile the buttons
are outside the overflow and are not visible, thus have to revert it
and then remove the right margin to avoid the extra space.  Since on
mobile we only show a single slide at a time, the lack of margin is not
noticeable.
2024-02-03 01:11:21 +01:00
jordi fita mas daf6326652 Change the footer to a single column in table, rather than on mobile
Otherwise, the four columns are very difficult to read, and cause
horizontal overflow.
2024-02-03 01:03:08 +01:00
jordi fita mas 593004d0c9 Remove redundant right margin form slick list on mobile 2024-02-03 00:33:24 +01:00
jordi fita mas 63e33fa253 Fix booking field inside campsite’s page on mobile 2024-02-03 00:29:37 +01:00
jordi fita mas 4c4b9d8d02 Make submenus collapsible on mobile too
Had to change the link to the current language version of the page by a
button, to prevent following a link when trying to expand the submenu.

At first i did this with an `onclick="return false"` bullshit, but the
link was the wrong thing to do here, and it was there only to satisfy
Google et al. They will have to with the links in head.

Also made the link and buttons larger to make it easier to hit them with
finger.
2024-02-03 00:16:29 +01:00
jordi fita mas 64d94b5f35 Align text in surroundings on mobile 2024-02-02 21:40:41 +01:00
jordi fita mas 43505fecbd Reduce outside activities’ h3 bottom margin on mobile 2024-02-02 21:37:56 +01:00
jordi fita mas 97fb88cc02 Guard against departure date not having min and max night attributes 2024-02-02 02:55:09 +01:00
jordi fita mas 33a1f0f4e2 Use Date.getTime instead of relaying on implicit conversion
Otherwise, fucking IntelliJ does not shut up about imaginary problems.
2024-02-02 02:51:38 +01:00
jordi fita mas 28adeb38fc Half Leaflet’s zoom delta
With a map the size of ours, it always seemed like things were either
too zoomed out or too zoomed in.
2024-02-02 02:46:59 +01:00
jordi fita mas 70eb007ddd Revert Leaflet’s maxBounds and its viscosity
They were commented out by error: when changing the SVG handling code,
had to “look for” a stray polygon that was outside the image’s bounded
area.
2024-02-02 02:45:47 +01:00
oriol carbonell pujolàs fcbbc5c22a Fix sizes of the campground map and its legend 2024-02-02 02:39:55 +01:00
oriol carbonell pujolàs 5e053034a5 Move carousel arrows out of the way on mobile
Carrousels have a first slide that is mostly text without any background color,
and on mobile the arrows looked like where “erasing” the text.
2024-02-02 02:38:31 +01:00
oriol carbonell pujolàs 0b93a4c989 Remove order from slick-list
It was there from when the carousel was a flex; no longer used
2024-02-02 02:37:53 +01:00
oriol carbonell pujolàs 91339bec8b Leave direction for home slides on mobile and increase bottom padding
The change to column was from when the button and the text were both on the slide,
but now it only made the text stick to the top, which is the reverse of what we
wanted, but had to increase the space between the text and the booking button.
2024-02-02 02:30:54 +01:00
oriol carbonell pujolàs 61dbe5cf38 Set top-most address in a column with mobile screens 2024-02-02 02:28:45 +01:00
oriol carbonell pujolàs 18adbac5c3 Remove sticky position from header with mobile screens
Too much vertical space used just for that, otherwise.
2024-02-02 02:27:23 +01:00
jordi fita mas 4adad7fa7d Replace min_nights from campsite_type_costs to range in campsite_type
Customer told us that the minimum number of nights is per campsite type,
not per season.  And he wants this, along with the maximum number of
nights, in order to limit the range of departure dates that guests can
choose when booking.
2024-01-31 23:06:45 +01:00
jordi fita mas 4f04d973c2 Dynamically set min and max to arrival and departure date inputs
The departure must be at list one day after the arrival, but no longer
than seven, due to campground’s policy.
2024-01-31 20:00:38 +01:00
jordi fita mas a3040cb195 Use var(--accent) for zone color 2024-01-31 15:37:03 +01:00
jordi fita mas 516a9d9be8 Fix the font-size of #campground_map
Leaflet assumes that 1rem = 16px, and sets its wrapper’s font size to
.75rem to get 12px.  However, in our CSS 1rem = 10px.
2024-01-31 15:13:35 +01:00
jordi fita mas d198bad91b Add a controlled layer group for the zones on the map
It seems that we have to highlight the map zones too.  On the previous
website, they had a mouseover effect that displayed a tooltip, but here
we can not do that because we use the mouse to select accommodations.

This is just a test to see whether Oriol likes how it is shown, thus the
red is likely to change to something else more pleasant to look at.
2024-01-31 15:12:11 +01:00
jordi fita mas 8c9308f1d3 Do not bring layer to front when highlighting a map accommodation
This does nothing but bring useless work to the browser, that has to
move the SVG group to the top for nothing, as the accommodations do not
overlap anything else.
2024-01-31 15:02:20 +01:00
jordi fita mas 6f78ad944f Do not set campground_map’s height via JavaScript
It already has a height set via CSS; no need to overwrite it.
2024-01-31 15:01:13 +01:00
oriol carbonell pujolàs 33100a6149 Adjust accomodation on home to show seven in a grid 2024-01-29 19:43:07 +01:00
jordi fita mas 1de4042d91 Handle path and rects in map
There are many installations on the map that are drawn with rect
instead of path.  I could transform them with Inkscape, but i finally
found out about DOMMatrix, that helps me a lot to convert points, as
it can parse the values of the `transform` attribute.

I also saw that SVGGraphicElements has getCTM() and getScreenCTM(), but
neither of them worked for me: the resulting transformation was “shrunk”
on the map (i.e., like it was scaled down).
2024-01-29 17:57:14 +01:00
jordi fita mas e320636ce1 Replace <div>s in legend with more semantically meaningful elements 2024-01-29 14:02:31 +01:00
oriol carbonell pujolàs 72f9e25140 Add map legend 2024-01-29 13:42:24 +01:00
jordi fita mas eeaa3b415e Add amenities section and public page
This is more or less the same as the campsites, as public information
goes, but for buildings and other amenities that the camping provides
that are not campsites.
2024-01-27 22:51:41 +01:00
jordi fita mas e6ab3f2d09 Change campsite info row to columns on small screens 2024-01-26 22:57:22 +01:00
jordi fita mas c284230436 Add public pages for each individual accommodation
A small page with a brief description, carousel, and feature list of
each individual accommodation.

Most of the relations and functions for carousel and features are like
the ones for campsite types, but i had to use the accommodation’s label
to find them, because they do not have slugs; i did not even though
these would be public, and they already have a label, although not
unique for all companies, like UUID slugs are.
2024-01-26 22:27:54 +01:00
jordi fita mas 8d49857dae Add a polygon around each accommodation on the public map
I can not use <a> in that map because Leaflet handles the mouse over
before the anchors sees it, thus it is impossible to click on them; i
have to use a Leaflet layer.

Fortunately, i can just use the <path>’s coordinates as
the polygon points, because with CRS.Simple the coordinates map to
pixel, except for the reversed Y/latitude coordinate. Unfortunately,
<path> coordinates are not straightforward to get: I have to follow the
drawing coordinates, taking into account the current transformation
(CTM), and keeping the last point around for relative coordinates.
Bézier curves are simplified to a straight line from start to end.

There is one single accommodation that started with a relative move
command (m), which apparently have to be treated as an absolute
move (M), but subsequent pairs are treated as relative coordinates[0].

It was easier for me to convert that relative move to absolute and add
a relative lineto command (l) to the next pair.

For now, all i do is highlight the accommodation and zoom it on click,
because i do not know how i should the accommodation’s information.

[0]: https://www.w3.org/TR/SVG11/paths.html#PathDataMovetoCommands
2024-01-25 04:28:51 +01:00
jordi fita mas 623f0af2ab Fill the immediate path inside map’s anchors, and remove one extra group
In the map i added in e3503187d, paths around each accommodation
inherited the fill and stroke from the group, thus i could just override
that fill at the anchor level, but the current map sets the fill to each
accommodation’s path, party because the text is not a path too, partly
because Affinity is a visual tool only and does not give a shit about
mark up.

If we keep the text in a group, however, we can set the fill of the area
using CSS too, although it is not nice due to `!important`, but still.
There was a plot, however, #93, that had the area in a group too, and
i had to remove that group manually.
2024-01-25 01:26:02 +01:00
jordi fita mas 267ff54c60 Use same background color for selected icon than for selected language 2024-01-24 19:35:38 +01:00