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

120 lines
5.1 KiB
Plaintext
Raw Normal View History

{{ define "title" -}}
{{( pgettext "Invoices" "title" )}}
{{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/invoice.invoiceIndex*/ -}}
<form id="batch-form" action="/admin/invoices/batch" method="post">
{{ CSRFInput }}
<fieldset>
{{ with .Filters }}
{{ with .Customer }}<input type="hidden" name="{{ .Name }}" value="{{ .String }}">{{ end }}
{{ with .InvoiceStatus }}<input type="hidden" name="{{ .Name }}" value="{{ .String }}">{{ end }}
{{ with .FromDate }}<input type="hidden" name="{{ .Name }}" value="{{ .Val }}">{{ end }}
{{ with .ToDate }}<input type="hidden" name="{{ .Name }}" value="{{ .Val }}">{{ end }}
{{ with .InvoiceStatus }}<input type="hidden" name="{{ .Name }}" value="{{ .String }}">{{ end }}
{{ end }}
</fieldset>
<footer>
{{ template "filters-toggle" }}
<button type="submit"
name="action" value="download"
>{{( pgettext "Download invoices" "action" )}}</button>
<button type="submit"
name="action" value="export"
>{{( pgettext "Export list" "action" )}}</button>
</footer>
</form>
<form class="filters" method="GET" action="/admin/invoices"
data-hx-target="main" data-hx-boost="true" data-hx-trigger="change,search,submit"
aria-labelledby="filters-toggle"
>
<fieldset>
{{ with .Filters }}
{{ with .Customer -}}
<label>
{{( pgettext "Customer" "input" )}}<br>
<select name="{{ .Name }}"
{{ template "error-attrs" . }}
>
<option value="">{{( gettext "All customers" )}}</option>
{{ template "list-options" . }}
</select><br>
{{ template "error-message" . }}
</label>
{{- end }}
{{ with .InvoiceStatus -}}
<label>
{{( pgettext "Invoice 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 .InvoiceNumber -}}
<label>
{{( pgettext "Invoice number" "input" )}}<br>
<input type="text"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
{{ end }}
</fieldset>
<noscript>
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
</noscript>
{{ if .Filters.HasValue }}
<a href="/admin/invoices" class="button">{{( pgettext "Reset" "action" )}}</a>
{{ end }}
</form>
<a href="/admin/invoices/new">{{( pgettext "Add invoice" "action" )}}</a>
<h2>{{ template "title" . }}</h2>
{{ if .Invoices }}
<table id="invoice-list">
<thead>
<tr>
<th>{{( pgettext "All" "invoice" )}}</th>
<th>{{( pgettext "Date" "title" )}}</th>
<th>{{( pgettext "Invoice Num." "title" )}}</th>
<th>{{( pgettext "Customer" "title" )}}</th>
<th>{{( pgettext "Status" "title" )}}</th>
<th>{{( pgettext "Download" "title" )}}</th>
<th class="numeric">{{( pgettext "Amount" "title" )}}</th>
</tr>
</thead>
<tbody>
{{ template "results.gohtml" . }}
</tbody>
</table>
{{- else -}}
<p>{{( gettext "No invoices found." )}}</p>
{{ end }}
{{- end }}