141 lines
6.5 KiB
Plaintext
141 lines
6.5 KiB
Plaintext
{{ define "title" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentIndexPage*/ -}}
|
|
{{- if .Invoice -}}
|
|
{{( pgettext "Collections" "title" )}}
|
|
{{- else -}}
|
|
{{( pgettext "Payments" "title" )}}
|
|
{{- end -}}
|
|
{{- 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> /
|
|
{{ else if .Invoice }}
|
|
<a href="{{ companyURI "/invoices" }}">{{( pgettext "Invoices" "title" )}}</a> /
|
|
<a href="{{ companyURI "/invoices/" }}{{ .Invoice.Slug }}">{{ .Invoice.InvoiceNumber }}</a> /
|
|
{{ end }}
|
|
<a>{{ template "title" . }}</a>
|
|
</p>
|
|
|
|
<a class="primary button"
|
|
data-hx-boost="true"
|
|
href="{{ .BaseURI }}/new">
|
|
{{- if .Invoice -}}
|
|
{{( pgettext "New collection" "action" )}}
|
|
{{- else -}}
|
|
{{( pgettext "New payment" "action" )}}
|
|
{{- end -}}
|
|
</a>
|
|
</nav>
|
|
{{- end }}
|
|
|
|
{{ define "content" }}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentIndexPage*/ -}}
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
{{- if .Invoice -}}
|
|
{{( pgettext "Collection Date" "title" )}}
|
|
{{- else -}}
|
|
{{( pgettext "Payment Date" "title" )}}
|
|
{{- end -}}
|
|
</th>
|
|
<th>{{( pgettext "Description" "title" )}}</th>
|
|
{{ if not (or .Invoice .Expense)}}
|
|
<th>{{( pgettext "Document" "title" )}}</th>
|
|
{{ end }}
|
|
<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>
|
|
{{ $confirm := or (and .Invoice (gettext "Are you sure you wish to delete this collection?")) (gettext "Are you sure you wish to delete this payment?") }}
|
|
{{ with .Payments }}
|
|
{{- range $payment := . }}
|
|
<tr>
|
|
<td>{{ .PaymentDate|formatDate }}</td>
|
|
<td><a href="{{ $.BaseURI }}/{{ .Slug }}">{{ .Description }}</a></td>
|
|
{{ if not (or $.Invoice $.Expense)}}
|
|
<td>
|
|
{{- if .InvoiceNumber -}}
|
|
{{- if eq .Type "P" -}}
|
|
<a href="{{ companyURI "/expenses/"}}{{ .DocumentSlug }}">{{ .InvoiceNumber }}</a>
|
|
{{- else -}}
|
|
<a href="{{ companyURI "/invoices/"}}{{ .DocumentSlug }}">{{ .InvoiceNumber }}</a>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
</td>
|
|
{{ end }}
|
|
<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">{{- if eq .Type "P" -}}-{{ end }}{{ .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">
|
|
{{- if .Invoice -}}
|
|
{{( gettext "No collections added yet." )}}
|
|
{{- else -}}
|
|
{{( gettext "No payments added yet." )}}
|
|
{{- end -}}
|
|
</td>
|
|
</tr>
|
|
{{ end }}
|
|
</tbody>
|
|
</table>
|
|
{{- end }}
|