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

64 lines
2.2 KiB
Plaintext
Raw Normal View History

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Customers" "title" )}}
{{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/customer.customerIndex*/ -}}
<a href="/admin/customers/new">{{( pgettext "Add Customer" "action" )}}</a>
{{ template "filters-toggle" }}
<form class="filters" method="GET" action="/admin/customers"
data-hx-target="main" data-hx-boost="true" data-hx-trigger="change,search,submit"
aria-labelledby="filters-toggle"
>
{{ with .Filters }}
<fieldset>
{{ with .Name -}}
<label>
{{( pgettext "Name" "input" )}}<br>
<input type="text"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
{{ with .Email -}}
<label>
{{( pgettext "Email" "input" )}}<br>
<input type="text"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
</fieldset>
{{ end }}
{{ if .Filters.HasValue }}
<a href="/admin/customers" class="button">{{( pgettext "Reset" "action" )}}</a>
{{ end }}
</form>
<h2>{{ template "title" . }}</h2>
{{ if .Customers -}}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Name" "header" )}}</th>
<th scope="col">{{( pgettext "Email" "header" )}}</th>
<th scope="col">{{( pgettext "Phone" "header" )}}</th>
</tr>
</thead>
<tbody>
{{ template "results.gohtml" . }}
</tbody>
</table>
{{- else }}
<p>{{( gettext "No customer found." )}}</p>
{{- end }}
{{- end }}