<!--
 SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
 SPDX-FileCopyrightText: 2023 Oriol Carbonell <info@oriolcarbonell.cat>
 SPDX-License-Identifier: AGPL-3.0-only
-->
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/template.PublicPage*/ -}}
<!doctype html>
<html lang="{{ currentLocale }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{ template "title" . }} — {{( gettext "Campsite Montagut" )}}</title>
    <link rel="preload" href="/static/fonts/MabryPro-Regular.woff2" as="font" type="font/woff2" crossorigin>
    <link rel="preload" href="/static/fonts/MabryPro-Bold.woff2" as="font" type="font/woff2" crossorigin>
    <link rel="stylesheet" media="screen" href="/static/public.css">
    <link rel="stylesheet" media="screen" href="/static/icons.css">
    {{ range .LocalizedAlternates -}}
        <link rel="alternate" hreflang="{{ .Lang }}" href="{{ .HRef }}"/>
    {{ end }}
    <script src="/static/htmx@1.9.3.min.js"></script>
    {{- block "head" . }}{{ end }}
</head>
<body>
<a href="#content">{{( gettext "Skip to main content" )}}</a>
<header>
    {{ with .CompanyAddress -}}
        <address>
            <a href="tel:{{ replaceAll .Phone " " "" }}">{{ replaceAll .Phone "+" "00 " }}</a>
            <a href="mailto:{{ .Email }}">{{ .Email }}</a>
        </address>
    {{- end }}
    {{ if .LocalizedAlternates -}}
        <nav>
            <ul>
                <li class="has-submenu">{{ range .LocalizedAlternates -}}
                        {{ if eq .Lang currentLocale }}{{ template "alternateAnchor" . }}{{ end }}
                    {{- end }}
                    <ul>
                        {{ range .LocalizedAlternates }}{{ if ne .Lang currentLocale -}}
                            <li>{{ template "alternateAnchor" . }}</li>
                        {{ end }}{{ end }}
                    </ul>
                </li>
            </ul>
        </nav>
    {{- end }}
    <h1><a href="/{{ currentLocale }}/"><span class="logo">◭</span><span
                    class="name">{{( gettext "Campsite Montagut" )}}</span></a></h1>
    <input type="checkbox" id="menuShowHide">
    <label for="menuShowHide">{{( gettext "Menu" )}}</label>
    <nav>
        <ul>
            <li><a href="/{{ currentLocale }}/">{{( pgettext "Home" "title" )}}</a></li>
            <li><a href="/{{ currentLocale }}/campground">{{( pgettext "Campground" "title" )}}</a></li>
            {{ with .Menu -}}
                {{ if .CampsiteTypes -}}
                    <li class="has-submenu">
                        <button type="button">{{( pgettext "Campsites" "title" )}}</button>
                        <ul>
                            {{ range .CampsiteTypes -}}
                                <li><a href="{{ .HRef }}">{{ .Label }}</a></li>
                            {{ end }}
                        </ul>
                    </li>
                {{- end }}
            {{- end }}
            <li><a href="/{{ currentLocale }}/services">{{( pgettext "Services" "title" )}}</a></li>
            <li><a href="/{{ currentLocale }}/surroundings">{{( pgettext "Surroundings" "title" )}}</a></li>
            <li><a href="/{{ currentLocale }}/location">{{( pgettext "Location" "title" )}}</a></li>
            <li class="boto-reserva"><a href="/{{ currentLocale }}/booking">{{( pgettext "Booking" "title" )}}</a></li>
            {{ if .LocalizedAlternates -}}
                <li class="has-submenu">{{ range .LocalizedAlternates -}}
                        {{ if eq .Lang currentLocale }}{{ template "alternateAnchor" . }}{{ end }}
                    {{- end }}
                    <ul>
                        {{ range .LocalizedAlternates }}{{ if ne .Lang currentLocale -}}
                            <li>{{ template "alternateAnchor" . }}</li>
                        {{ end }}{{ end }}
                    </ul>
                </li>
            {{- end }}
        </ul>
    </nav>
</header>
<main id="content">
    {{- template "content" . }}
</main>
<footer>
    <div>
        <section>
            <h2>{{( pgettext "Sections" "title" )}}</h2>
            <ul>
                <li><a href="/{{ currentLocale }}/">{{( pgettext "Home" "title" )}}</a></li>
                <li><a href="/{{ currentLocale }}/campground">{{( pgettext "Campground" "title" )}}</a></li>
                <li><a href="/{{ currentLocale }}/services">{{( pgettext "Services" "title" )}}</a></li>
                <li><a href="/{{ currentLocale }}/surroundings">{{( pgettext "Surroundings" "title" )}}</a></li>
                <li><a href="/{{ currentLocale }}/location">{{( pgettext "Location" "title" )}}</a></li>
            </ul>
        </section>

        {{ with .Menu -}}
            {{ if .CampsiteTypes -}}
                <section>
                    <h2>{{( pgettext "Campsites" "title" )}}</h2>
                    <ul>
                        {{ range .CampsiteTypes -}}
                            <li><a href="{{ .HRef }}">{{ .Label }}</a></li>
                        {{ end }}
                    </ul>
                </section>
            {{- end }}
        {{- end }}

        <section>
            <h2>{{ (pgettext "Opening" "title" )}}</h2>
            {{ .OpeningDates }}
        </section>

        <section>
            <h2>{{ .CompanyAddress.TradeName }}</h2>
            {{ template "companyAddress" .CompanyAddress }}
            {{ printf ( gettext "<abbr title=\"Catalonia Tourism Registry\">RTC</abbr> <abbr title=\"Number\">#</abbr>%s") .CompanyAddress.RTCNumber | raw }}
            <div class="camping-association">
                <img src="/static/camping-association/Reconeixement.gif" alt="Alan Rogers">
                <img src="/static/camping-association/acsi.jpg" alt="ACSI">
                <img src="/static/camping-association/logofecc4.gif" alt="Federación Española de Clubes Capistas">
                <img src="/static/camping-association/anwb.png" alt="anwb">
            </div>
        </section>
    </div>
    <span>© {{( gettext "Campsite Montagut" )}} | 1994–2023</span>
</footer>
</body>
</html>

{{ define "alternateAnchor" -}}
    <a rel="alternate" href="{{ .HRef }}" hreflang="{{ .Lang }}" lang="{{ .Lang }}">{{ .Endonym }}</a>
{{- end }}

{{ define "companyAddress" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/template.address*/ -}}
    <address>
        {{ .Address }}<br>
        {{ .PostalCode}} · {{ .City }} · {{ .Province }}<br>
        {{ .Country }}<br>
        <abbr>T</abbr> <a href="tel:{{ replaceAll .Phone " " "" }}">{{ .Phone }}</a><br>
        <a href="mailto:{{ .Email }}">{{ .Email }}</a>
    </address>
{{- end }}

{{ define "carouselStyle" -}}
    <link rel="stylesheet" media="screen" href="/static/slick@1.8.1.css">
{{- end }}

{{ define "carouselInit" -}}
    <script src="/static/jquery@3.7.1.min.js"></script>
    <script src="/static/slick@1.8.1.min.js"></script>
    <script>
        jQuery(function () {
            jQuery('.carousel').slick({
                slidesToShow: {{ . }},
                slidesToScroll: 1,
                infinite: false,
                arrows: true,
                prevArrow: '<button type="button" class="slick-prev">←</button>',
                nextArrow: '<button type="button" class="slick-next">→</button>',
                responsive: [
                    {
                        breakpoint: 1024,
                        settings: {
                            slidesToShow: {{ . | dec }},
                        }
                    },
                    {
                        breakpoint: 768,
                        settings: {
                            slidesToShow: 1,
                        }
                    },
                ]
            });
        });
    </script>
{{- end }}
