numerus/web/template/payments/index.gohtml

104 lines
4.8 KiB
Plaintext
Raw Normal View History

{{ 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> /
<a>{{( pgettext "Payments" "title" )}}</a>
</p>
<a class="primary button"
data-hx-boost="true"
href="{{ companyURI "/payments/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>
2024-08-11 22:08:18 +00:00
<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="{{ companyURI "/payments/"}}{{ .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>
2024-08-11 22:08:18 +00:00
<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="{{ companyURI "/payments"}}/{{ .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="{{ companyURI "/payments"}}/{{ .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 }}