numerus/web/template/invoices/index.gohtml

75 lines
3.3 KiB
Plaintext

{{ define "title" -}}
{{( pgettext "Invoices" "title" )}}
{{- end }}
{{ define "content" }}
<nav>
<p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "Invoices" "title" )}}</a>
</p>
<p>
<a class="primary button"
href="{{ companyURI "/invoices/new" }}">{{( pgettext "New invoice" "action" )}}</a>
</p>
</nav>
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.InvoicesIndexPage*/ -}}
<table class="no-padding">
<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 "Label" "title" )}}</th>
<th>{{( pgettext "Amount" "title" )}}</th>
<th>{{( pgettext "Download" "title" )}}</th>
</tr>
</thead>
<tbody>
{{ with .Invoices }}
{{- range $invoice := . }}
<tr>
<td></td>
<td>{{ .Date|formatDate }}</td>
<td><a href="{{ companyURI "/invoices/"}}{{ .Slug }}">{{ .Number }}</a></td>
<td><a href="{{ companyURI "/contacts/"}}{{ .CustomerSlug }}">{{ .CustomerName }}</a></td>
<td>
<details class="invoice-status menu">
<summary class="invoice-status-{{ .Status }}">{{ .StatusLabel }}</summary>
<form action="{{companyURI "/invoices/"}}{{ .Slug }}" method="POST">
{{ csrfToken }}
{{ putMethod }}
<ul role="menu">
{{- range $status, $name := $.InvoiceStatuses }}
{{- if ne $status $invoice.Status }}
<li>
<button type="submit" name="status" class="invoice-status-{{ $status }}"
value="{{ $status }}">{{ $name }}</button>
</li>
{{- end }}
{{- end }}
</ul>
</form>
</details>
</td>
<td></td>
<td class="numeric">{{ .Total|formatPrice }}</td>
<td class="invoice-download"><a href="{{ companyURI "/invoices/"}}{{ .Slug }}.pdf"
download="{{ .Number}}.pdf"
title="{{( pgettext "Download invoice" "action" )}}"
aria-label="{{( pgettext "Download invoice %s" "action" )}}"><i
class="ri-download-line"></i></a></td>
</tr>
{{- end }}
{{ else }}
<tr>
<td colspan="7">{{( gettext "No invoices added yet." )}}</td>
</tr>
{{ end }}
</tbody>
</table>
{{- end }}