numerus/web/template/payments/index.gohtml

108 lines
5.0 KiB
Plaintext

{{ define "title" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentIndexPage*/ -}}
{{( pgettext "Payments" "title" )}}
{{- end }}
{{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentIndexPage*/ -}}
<nav data-hx-target="main">
<p data-hx-boost="true">
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
{{ if .Expense }}
<a href="{{ companyURI "/expenses" }}">{{( pgettext "Expenses" "title" )}}</a> /
<a href="{{ companyURI "/expenses/" }}{{ .Expense.Slug }}">{{ .Expense.InvoiceNumber }}</a> /
{{ end }}
<a>{{( pgettext "Payments" "title" )}}</a>
</p>
<a class="primary button"
data-hx-boost="true"
href="{{ .BaseURI }}/new">{{( pgettext "New payment" "action" )}}</a>
</nav>
{{- end }}
{{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentIndexPage*/ -}}
<table>
<thead>
<tr>
<th>{{( pgettext "Payment Date" "title" )}}</th>
<th>{{( pgettext "Description" "title" )}}</th>
<th>{{( pgettext "Document" "title" )}}</th>
<th>{{( pgettext "Status" "title" )}}</th>
<th>{{( pgettext "Tags" "title" )}}</th>
<th class="numeric">{{( pgettext "Total" "title" )}}</th>
<th>{{( pgettext "Download" "title" )}}</th>
<th>{{( pgettext "Actions" "title" )}}</th>
</tr>
</thead>
<tbody>
{{ with .Payments }}
{{ $confirm := (gettext "Are you sure you wish to delete this payment?")}}
{{- range $payment := . }}
<tr>
<td>{{ .PaymentDate|formatDate }}</td>
<td><a href="{{ $.BaseURI }}/{{ .Slug }}">{{ .Description }}</a></td>
<td>
{{- if .InvoiceNumber -}}
<a href="{{ companyURI "/expenses/"}}{{ .ExpenseSlug }}">{{ .InvoiceNumber }}</a>
{{- end -}}
</td>
<td class="payment-status-{{ .Status }}">{{ .StatusLabel }}</td>
<td
data-hx-get="{{ companyURI "/payments/" }}{{ .Slug }}/tags/edit"
data-hx-target="this"
data-hx-swap="outerHTML"
>
{{- range $index, $tag := .Tags }}
{{- if gt $index 0 }}, {{ end -}}
{{ . }}
{{- end }}
</td>
<td class="numeric">{{ .Total | formatPrice }}</td>
<td class="invoice-download">
{{ if .OriginalFileName }}
<a href="{{ companyURI "/payments/"}}{{ .Slug }}/download/{{.OriginalFileName}}"
title="{{( pgettext "Download payment attachment" "action" )}}"
aria-label="{{( pgettext "Download payment attachment" "action" )}}"><i
class="ri-download-line"></i></a>
{{ end }}
</td>
<td class="actions">
<details class="menu">
{{- $label := .Description | printf (gettext "Actions for payment %s") -}}
<summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary>
<ul role="menu" class="action-menu">
<li role="presentation">
<a role="menuitem" href="{{ $.BaseURI }}/{{ .Slug }}"
data-hx-target="main" data-hx-boost="true"
>
<i class="ri-edit-line"></i>
{{( pgettext "Edit" "action" )}}
</a>
</li>
<li role="presentation">
<button role="menuitem"
data-hx-delete="{{ $.BaseURI }}/{{ .Slug }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ csrfHeader }} }'
data-hx-target="main"
>
<i class="ri-delete-back-2-line"></i>
{{( pgettext "Remove" "action" )}}
</button>
</li>
</ul>
</details>
</td>
</tr>
{{- end }}
{{ else }}
<tr>
<td colspan="8">{{( gettext "No payments added yet." )}}</td>
</tr>
{{ end }}
</tbody>
</table>
{{- end }}