164 lines
7.5 KiB
Plaintext
164 lines
7.5 KiB
Plaintext
{{ define "title" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.expensesIndexPage*/ -}}
|
|
{{( pgettext "Expenses" "title" )}}
|
|
{{- end }}
|
|
|
|
{{ define "breadcrumbs" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.expensesIndexPage*/ -}}
|
|
<nav data-hx-target="main">
|
|
<p data-hx-boost="true">
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
<a>{{( pgettext "Expenses" "title" )}}</a>
|
|
</p>
|
|
|
|
<form id="batch-form" action="{{ companyURI "/expenses/batch" }}" method="post">
|
|
{{ csrfToken }}
|
|
{{ with .Filters }}
|
|
{{ template "hidden-select-field" .Contact }}
|
|
{{ template "hidden-select-field" .ExpenseStatus }}
|
|
{{ template "hidden-field" .FromDate }}
|
|
{{ template "hidden-field" .ToDate }}
|
|
{{ template "hidden-field" .InvoiceNumber }}
|
|
{{ template "hidden-field" .Tags }}
|
|
{{ template "hidden-field" .TagsCondition }}
|
|
{{ end }}
|
|
<p>
|
|
{{ template "filters-toggle" }}
|
|
<button type="submit"
|
|
name="action" value="export"
|
|
>{{( pgettext "Export list" "action" )}}</button>
|
|
<a class="primary button"
|
|
data-hx-boost="true"
|
|
href="{{ companyURI "/expenses/new" }}">{{( pgettext "New expense" "action" )}}</a>
|
|
</p>
|
|
</form>
|
|
</nav>
|
|
{{- end }}
|
|
|
|
{{ define "content" }}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.expensesIndexPage*/ -}}
|
|
<form class="filters" method="GET" action="{{ companyURI "/expenses"}}"
|
|
data-hx-target="main" data-hx-boost="true" data-hx-trigger="change,search,submit"
|
|
aria-labelledby="filters-toggle"
|
|
>
|
|
<fieldset>
|
|
{{ with .Filters }}
|
|
{{ template "select-field" .Contact }}
|
|
{{ template "select-field" .ExpenseStatus }}
|
|
{{ template "input-field" .FromDate }}
|
|
{{ template "input-field" .ToDate }}
|
|
{{ template "input-field" .InvoiceNumber }}
|
|
{{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }}
|
|
{{ template "toggle-field" .TagsCondition }}
|
|
{{ end }}
|
|
</fieldset>
|
|
<noscript>
|
|
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
|
|
</noscript>
|
|
{{ if .Filters.HasValue }}
|
|
<a href="{{ companyURI "/expenses" }}" class="button">{{( pgettext "Reset" "action" )}}</a>
|
|
{{ end }}
|
|
</form>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>{{( pgettext "Contact" "title" )}}</th>
|
|
<th>{{( pgettext "Invoice Date" "title" )}}</th>
|
|
<th>{{( pgettext "Invoice Number" "title" )}}</th>
|
|
<th>{{( pgettext "Status" "title" )}}</th>
|
|
<th>{{( pgettext "Tags" "title" )}}</th>
|
|
<th class="numeric">{{( pgettext "Amount" "title" )}}</th>
|
|
{{ range $class := .TaxClasses -}}
|
|
<th class="numeric">{{ . }}</th>
|
|
{{ end -}}
|
|
<th class="numeric">{{( pgettext "Total" "title" )}}</th>
|
|
<th>{{( pgettext "Payments" "title" )}}</th>
|
|
<th>{{( pgettext "Actions" "title" )}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{ with .Expenses }}
|
|
{{- range $expense := . }}
|
|
<tr>
|
|
<td>{{ .InvoicerName }}</td>
|
|
<td>{{ .InvoiceDate|formatDate }}</td>
|
|
<td>
|
|
{{- if .InvoiceNumber -}}
|
|
<a href="{{ companyURI "/expenses/"}}{{ .Slug }}">{{ .InvoiceNumber }}</a>
|
|
{{- end -}}
|
|
</td>
|
|
<td class="expense-status-{{ .Status }}">{{ .StatusLabel }}</td>
|
|
<td
|
|
data-hx-get="{{companyURI "/expenses/"}}{{ .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">{{ .Amount | formatPrice }}</td>
|
|
{{ range $class := $.TaxClasses -}}
|
|
{{ $tax := index $expense.Taxes $class }}
|
|
<td class="numeric">{{ if $tax }}{{ $tax | formatPrice }}{{ end }}</td>
|
|
{{- end }}
|
|
<td class="numeric">{{ .Total | formatPrice }}</td>
|
|
<td class="invoice-download">
|
|
<a role="menuitem" href="{{ companyURI "/expenses"}}/{{ .Slug }}/payments"
|
|
title="{{( gettext "Expense payments" )}}"
|
|
aria-label="{{( gettext "Expense payments" )}}"
|
|
>
|
|
<i class="ri-bank-card-2-line"></i>
|
|
</a>
|
|
</td>
|
|
<td class="actions">
|
|
<details class="menu">
|
|
{{- $label := .InvoiceNumber | printf (gettext "Actions for expense %s") -}}
|
|
<summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary>
|
|
<ul role="menu" class="action-menu"
|
|
data-hx-target="main" data-hx-boost="true"
|
|
>
|
|
<li role="presentation">
|
|
<a role="menuitem" href="{{ companyURI "/expenses"}}/{{ .Slug }}">
|
|
<i class="ri-edit-line"></i>
|
|
{{( pgettext "Edit" "action" )}}
|
|
</a>
|
|
</li>
|
|
{{ if .OriginalFileName }}
|
|
<li role="presentation">
|
|
<a role="menuitem"
|
|
href="{{ companyURI "/expenses/"}}{{ .Slug }}/download/{{.OriginalFileName}}"
|
|
><i class="ri-download-line"></i>
|
|
{{ ( pgettext "Download expense attachment" "action" ) }}
|
|
</a>
|
|
</li>
|
|
{{ end }}
|
|
</ul>
|
|
</details>
|
|
</td>
|
|
</tr>
|
|
{{- end }}
|
|
{{ else }}
|
|
<tr>
|
|
<td colspan="{{ add 9 (len .TaxClasses) }}">{{( gettext "No expenses added yet." )}}</td>
|
|
</tr>
|
|
{{ end }}
|
|
</tbody>
|
|
{{ if .Expenses }}
|
|
<tfoot>
|
|
<tr>
|
|
<th scope="row" colspan="5">{{( gettext "Total" )}}</th>
|
|
<td class="numeric">{{ .SumAmount | formatPrice }}</td>
|
|
{{ range $class := $.TaxClasses -}}
|
|
{{ $tax := index $.SumTaxes $class }}
|
|
<td class="numeric">{{ if $tax }}{{ $tax | formatPrice }}{{ else }}{{ "0.0" | formatPrice }}{{ end }}</td>
|
|
{{- end }}
|
|
<td class="numeric">{{ .SumTotal | formatPrice }}</td>
|
|
<td colspan="2"></td>
|
|
</tr>
|
|
</tfoot>
|
|
{{ end }}
|
|
</table>
|
|
{{- end }}
|