camper/web/templates/admin/customer/form.gohtml

42 lines
1.3 KiB
Plaintext
Raw Normal View History

<!--
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/customer.ContactForm*/ -}}
{{ if .Slug }}
{{( pgettext "Edit Customer" "title" )}}
{{ else }}
{{( pgettext "New Customer" "title" )}}
{{ end }}
{{- end }}
{{ define "breadcrumb" -}}
<li><a href="./">{{( pgettext "Customer" "title" )}}</a></li>
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/customer.ContactForm*/ -}}
{{ if .Slug -}}
<a href="/admin/invoices/new?customer={{ .Slug }}">{{( pgettext "Invoice Customer" "action" )}}</a>
{{- end }}
<h2>{{ template "title" .}}</h2>
<form id="contact-form"
{{- if .URL }} data-hx-put="{{ .URL }}"
{{- else }} action="/admin/customers" method="post"
{{- end -}}
>
{{ CSRFInput }}
{{ template "contact.gohtml" . }}
<footer>
<button type="submit">
{{- if .Slug -}}
{{( pgettext "Update" "action" )}}
{{- else -}}
{{( pgettext "Add" "action" )}}
{{- end -}}
</button>
</footer>
</form>
{{- end }}