numerus/web/template/payments/index.gohtml

89 lines
4.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> /
<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 "Status" "title" )}}</th>
<th>{{( pgettext "Tags" "title" )}}</th>
<th class="numeric">{{( pgettext "Total" "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 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="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="5">{{( gettext "No payments added yet." )}}</td>
</tr>
{{ end }}
</tbody>
</table>
{{- end }}