72 lines
2.8 KiB
Plaintext
72 lines
2.8 KiB
Plaintext
{{ define "title" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editExpensePage*/ -}}
|
|
{{ printf ( pgettext "Edit Expense “%s”" "title" ) (or .Form.InvoiceNumber.Value .Slug) }}
|
|
{{- end }}
|
|
|
|
{{ define "breadcrumbs" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editExpensePage*/ -}}
|
|
<nav data-hx-target="main" data-hx-boost="true">
|
|
<p>
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
<a href="{{ companyURI "/expenses"}}">{{( pgettext "Expenses" "title" )}}</a> /
|
|
<a>{{ or .Form.InvoiceNumber.Value .Slug }}</a>
|
|
</p>
|
|
</nav>
|
|
{{- end }}
|
|
|
|
{{ define "content" }}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editExpensePage*/ -}}
|
|
<section id="new-expense-dialog-content" data-hx-target="main">
|
|
<h2>{{ template "title" . }}</h2>
|
|
<form enctype="multipart/form-data" method="POST" action="{{ companyURI "/expenses/" }}{{ .Slug }}"
|
|
data-hx-boost="true"
|
|
data-hx-swap="innerHTML show:false"
|
|
>
|
|
{{ csrfToken }}
|
|
|
|
{{ with .Form -}}
|
|
<div class="expenses-data">
|
|
{{ template "select-field" .Invoicer }}
|
|
{{ template "input-field" .InvoiceNumber }}
|
|
{{ template "input-field" .InvoiceDate }}
|
|
{{ template "input-field" .Amount }}
|
|
{{ template "select-field" .Tax }}
|
|
{{ template "tags-field" .Tags }}
|
|
{{ template "file-field" .File }}
|
|
</div>
|
|
{{- end }}
|
|
|
|
<table id="invoice-summary">
|
|
<tbody>
|
|
{{- range $tax := .Taxes }}
|
|
<tr>
|
|
<th scope="row">{{ index . 0 }}</th>
|
|
<td class="numeric">{{ index . 1 | formatPrice }}</td>
|
|
</tr>
|
|
{{- end }}
|
|
<tr>
|
|
<th scope="row">{{(pgettext "Total" "title")}}</th>
|
|
<td class="numeric">{{ .Total | formatPrice }}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<fieldset class="button-bar">
|
|
<button formnovalidate
|
|
id="recompute-button"
|
|
name="action" value="update"
|
|
type="submit">{{( pgettext "Update" "action" )}}</button>
|
|
<button class="primary"
|
|
name="_method" value="PUT"
|
|
type="submit">{{( pgettext "Save" "action" )}}</button>
|
|
</fieldset>
|
|
</form>
|
|
</section>
|
|
|
|
<script>
|
|
document.body.addEventListener('recompute', function () {
|
|
document.getElementById('recompute-button').click();
|
|
});
|
|
</script>
|
|
{{- end }}
|