<!--
 SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
 SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
    {{( pgettext "Bookings" "title" )}}
{{- end }}

{{ define "breadcrumb" -}}
{{- end }}

{{ define "content" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/booking.bookingIndex*/ -}}
    <a href="/admin/bookings/new">{{( pgettext "Add Booking" "action" )}}</a>
    <a href="/admin/bookings?format=ods">{{( pgettext "Export Bookings" "action" )}}</a>
    <h2>{{( pgettext "Bookings" "title" )}}</h2>
    {{ if . -}}
        <table>
            <thead>
            <tr>
                <th scope="col">{{( pgettext "Reference" "header" )}}</th>
                <th scope="col">{{( pgettext "Arrival Date" "header" )}}</th>
                <th scope="col">{{( pgettext "Departure Date" "header" )}}</th>
                <th scope="col">{{( pgettext "Holder Name" "header" )}}</th>
                <th scope="col">{{( pgettext "Status" "header" )}}</th>
            </tr>
            </thead>
            <tbody>
            {{ range . -}}
                <tr class="booking-{{ .Status }}">
                    <td><a href="{{ .URL }}">{{ .Reference }}</a></td>
                    <td>{{ .ArrivalDate | formatDate }}</td>
                    <td>{{ .DepartureDate | formatDate }}</td>
                    <td>{{ .HolderName }}</td>
                    <td class="booking-status">{{ .StatusLabel }}</td>
                </tr>
            {{- end }}
            </tbody>
        </table>
    {{ else -}}
        <p>{{( gettext "No booking found." )}}</p>
    {{- end }}
{{- end }}
