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

87 lines
3.4 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Payments" "title" )}}
{{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/payment.paymentIndex*/ -}}
<a href="/admin/payments/settings">{{( pgettext "Payment Settings" "title" )}}</a>
{{ template "filters-toggle" }}
<form class="filters" method="GET" action="/admin/payments"
data-hx-target="main" data-hx-boost="true" data-hx-trigger="change,search,submit"
aria-labelledby="filters-toggle"
>
{{ with .Filters }}
<fieldset>
{{ with .PaymentStatus -}}
<label>
{{( pgettext "Payment status" "input" )}}<br>
<select name="{{ .Name }}"
{{ template "error-attrs" . }}
>
<option value="">{{( gettext "All statuses" )}}</option>
{{ template "list-options" . }}
</select><br>
{{ template "error-message" . }}
</label>
{{- end }}
{{ with .FromDate -}}
<label>
{{( pgettext "From date" "input" )}}<br>
<input type="date"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
{{ with .ToDate -}}
<label>
{{( pgettext "To date" "input" )}}<br>
<input type="date"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
{{ with .Reference -}}
<label>
{{( pgettext "Reference" "input" )}}<br>
<input type="search"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
</fieldset>
{{ end }}
{{ if .Filters.HasValue }}
<a href="/admin/payments" class="button">{{( pgettext "Reset" "action" )}}</a>
{{ end }}
</form>
<h2>{{ template "title" . }}</h2>
{{ if .Payments -}}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Date" "header" )}}</th>
<th scope="col">{{( pgettext "Reference" "header" )}}</th>
<th scope="col">{{( pgettext "Status" "header" )}}</th>
<th class="numeric" scope="col">{{( pgettext "Down payment" "header" )}}</th>
<th class="numeric" scope="col">{{( pgettext "Total" "header" )}}</th>
</tr>
</thead>
<tbody>
{{ template "results.gohtml" . }}
</tbody>
</table>
{{ else -}}
<p>{{( gettext "No payments found." )}}</p>
{{- end }}
{{- end }}