<!--
 SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
 SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/booking.adminBookingForm*/ -}}
    {{ if .ID }}
        {{( pgettext "Edit Booking" "title" )}}
    {{ else }}
        {{( pgettext "New Booking" "title" )}}
    {{ end }}
{{- end }}

{{ define "breadcrumb" -}}
    <li><a href="./">{{( pgettext "Bookings" "title" )}}</a></li>
{{- end }}

{{ define "content" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/booking.adminBookingForm*/ -}}
    <h2>{{ template "title" .}}</h2>
    {{ if .Error -}}
        <p class="error">{{ .Error }}</p>
    {{- end }}
    <form id="booking-form"
          data-hx-ext="morph"
          data-hx-swap="morph:innerHTML"
          data-hx-include="this"
          data-hx-target="this"
          data-hx-replace-url="true"
            {{- if .ID }} data-hx-put="/admin/bookings/{{ .CurrentLabel }}"
            {{- else }} action="/admin/bookings" method="post"
            {{- end -}}
    >
        {{ template "fields.gohtml" . }}
    </form>
{{- end }}
