80 lines
3.4 KiB
Plaintext
80 lines
3.4 KiB
Plaintext
{{ define "title" -}}
|
|
{{( pgettext "New Invoice" "title" )}}
|
|
{{- end }}
|
|
|
|
{{ define "breadcrumbs" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newInvoicePage*/ -}}
|
|
<nav data-hx-target="main" data-hx-boost="true">
|
|
<p>
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
<a href="{{ companyURI "/invoices"}}">{{( pgettext "Invoices" "title" )}}</a> /
|
|
<a>{{( pgettext "New Invoice" "title" )}}</a>
|
|
</p>
|
|
</nav>
|
|
{{- end }}
|
|
|
|
{{ define "content" }}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newInvoicePage*/ -}}
|
|
<section class="dialog-content" id="invoice-dialog-content" data-hx-target="this">
|
|
<h2>{{(pgettext "New Invoice" "title")}}</h2>
|
|
<form method="POST" action="{{ companyURI "/invoices" }}" data-hx-boost="true" data-hx-select="#invoice-dialog-content">
|
|
{{ csrfToken }}
|
|
|
|
{{ with .Form -}}
|
|
{{ template "hidden-field" .Location }}
|
|
{{ template "hidden-select-field" .InvoiceStatus }}
|
|
{{ template "select-field" .Customer }}
|
|
{{ template "input-field" .Date }}
|
|
{{ template "tags-field" .Tags }}
|
|
{{ template "select-field" .PaymentMethod }}
|
|
{{ template "input-field" .Notes }}
|
|
|
|
{{- range $product := .Products }}
|
|
{{ template "invoice-product-form" . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
<table id="invoice-summary">
|
|
<tbody>
|
|
<tr>
|
|
<th scope="row">{{(pgettext "Subtotal" "title")}}</th>
|
|
<td class="numeric">{{ .Subtotal | formatPrice }}</td>
|
|
</tr>
|
|
{{- 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>
|
|
<button formnovalidate formaction="{{ companyURI "/invoices/new" }}"
|
|
name="action" value="select-products"
|
|
data-hx-get="{{ companyURI "/invoices/product-form" }}"
|
|
data-hx-target="#invoice-summary" data-hx-swap="beforebegin"
|
|
data-hx-select="unset"
|
|
data-hx-vals="js:{index: document.querySelectorAll('.new-invoice-product').length}"
|
|
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
|
<button formnovalidate formaction="{{ companyURI "/invoices/new" }}"
|
|
id="recompute-button"
|
|
name="action" value="update"
|
|
type="submit">{{( pgettext "Update" "action" )}}</button>
|
|
<button class="primary" name="action" value="add"
|
|
type="submit">{{( pgettext "New invoice" "action" )}}</button>
|
|
</fieldset>
|
|
</form>
|
|
</section>
|
|
|
|
<script>
|
|
document.body.addEventListener('recompute', function () {
|
|
document.getElementById('recompute-button').click();
|
|
});
|
|
</script>
|
|
{{- end }}
|