numerus/web/template/company/taxes.gohtml

71 lines
2.7 KiB
Plaintext
Raw Permalink Normal View History

{{ define "title" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.TaxesPage*/ -}}
{{( pgettext "Taxes" "title" )}}
{{- end }}
{{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.TaxesPage*/ -}}
<nav data-hx-target="main" data-hx-boost="true">
<p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{ template "title" . }}</a>
</p>
</nav>
{{- end }}
{{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.TaxesPage*/ -}}
<section data-hx-target="main" data-hx-swap="innerHTML show:false">
<h2>{{ template "title" . }}</h2>
<table>
<thead>
<tr>
<th>{{( pgettext "Tax Name" "title" )}}</th>
<th class="numeric">{{( pgettext "Rate (%)" "title" )}}</th>
<th>{{( pgettext "Class" "title" )}}</th>
<th></th>
</tr>
</thead>
{{ $confirm := ( gettext "Are you sure?" )}}
<tbody data-hx-confirm="{{ $confirm }}" data-hx-target="closest tr" data-hx-swap="outerHTML swap:1s">
{{ with .Taxes }}
{{- range $tax := . }}
<tr>
<td>{{ .Name }}</td>
<td class="numeric">{{ .Rate }}</td>
<td>{{ .Class }}</td>
<td>
<form method="POST" action="{{ companyURI "/taxes"}}/{{ .Id }}" data-hx-boost="true">
{{ csrfToken }}
{{ deleteMethod }}
<button class="icon" aria-label="{{( gettext "Delete tax" )}}"
><i class="ri-delete-back-2-line"></i></button>
</form>
</td>
</tr>
{{- end }}
{{ else }}
<tr>
<td colspan="4">{{( gettext "No taxes added yet." )}}</td>
</tr>
{{ end }}
</tbody>
</table>
<form method="POST" action="{{ companyURI "/taxes" }}" data-hx-boost="true">
<h3>{{( pgettext "New Tax" "title")}}</h3>
<fieldset>
{{ csrfToken }}
{{ with .Form -}}
{{ template "input-field" .Name }}
{{ template "input-field" .Rate }}
{{ template "select-field" .Class }}
{{- end }}
</fieldset>
<footer>
<button>{{( pgettext "Add new tax" "action" )}}</button>
</footer>
</form>
</section>
{{- end }}