2023-05-03 10:46:25 +00:00
|
|
|
{{ define "title" -}}
|
2024-08-13 00:34:21 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newExpensePage*/ -}}
|
2023-05-03 10:46:25 +00:00
|
|
|
{{( pgettext "New Expense" "title" )}}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{ define "breadcrumbs" -}}
|
2024-08-13 00:34:21 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newExpensePage*/ -}}
|
2023-05-03 10:46:25 +00:00
|
|
|
<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>{{( pgettext "New Expense" "title" )}}</a>
|
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{ define "content" }}
|
2024-08-13 00:34:21 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newExpensePage*/ -}}
|
2023-05-23 21:13:21 +00:00
|
|
|
<section id="new-expense-dialog-content" data-hx-target="main">
|
2023-05-03 10:46:25 +00:00
|
|
|
<h2>{{(pgettext "New Expense" "title")}}</h2>
|
Compute the total amount, base plus taxes, of all expenses
This works mostly like invoices: i have to “update” the expense form
to compute its total based on the subtotal and the selected taxes,
although in this case i do no need to compute the subtotal because that
is given by the user.
Nevertheless, i added a new function to compute that total because it
was already hairy enough for the dashboard, that also needs to compute
the tota, not just the base, and i wanted to test that function.
There is no need for a custom input type for that function as it only
needs a couple of simple domains. I have created the output type,
though, because otherwise i would need to have records or “reuse” any
other “amount” output type, which would be confusing.\
Part of #68.
2023-07-13 18:50:26 +00:00
|
|
|
<form enctype="multipart/form-data" method="POST" action="{{ companyURI "/expenses" }}"
|
|
|
|
data-hx-swap="innerHTML show:false"
|
|
|
|
data-hx-boost="true">
|
2023-05-03 10:46:25 +00:00
|
|
|
{{ csrfToken }}
|
Compute the total amount, base plus taxes, of all expenses
This works mostly like invoices: i have to “update” the expense form
to compute its total based on the subtotal and the selected taxes,
although in this case i do no need to compute the subtotal because that
is given by the user.
Nevertheless, i added a new function to compute that total because it
was already hairy enough for the dashboard, that also needs to compute
the tota, not just the base, and i wanted to test that function.
There is no need for a custom input type for that function as it only
needs a couple of simple domains. I have created the output type,
though, because otherwise i would need to have records or “reuse” any
other “amount” output type, which would be confusing.\
Part of #68.
2023-07-13 18:50:26 +00:00
|
|
|
{{ 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>
|
2024-08-13 00:34:21 +00:00
|
|
|
|
Compute the total amount, base plus taxes, of all expenses
This works mostly like invoices: i have to “update” the expense form
to compute its total based on the subtotal and the selected taxes,
although in this case i do no need to compute the subtotal because that
is given by the user.
Nevertheless, i added a new function to compute that total because it
was already hairy enough for the dashboard, that also needs to compute
the tota, not just the base, and i wanted to test that function.
There is no need for a custom input type for that function as it only
needs a couple of simple domains. I have created the output type,
though, because otherwise i would need to have records or “reuse” any
other “amount” output type, which would be confusing.\
Part of #68.
2023-07-13 18:50:26 +00:00
|
|
|
<fieldset class="button-bar">
|
|
|
|
<button formnovalidate
|
|
|
|
id="recompute-button"
|
|
|
|
name="action" value="update"
|
|
|
|
type="submit">{{( pgettext "Update" "action" )}}</button>
|
|
|
|
<button class="primary"
|
|
|
|
name="action" value="add"
|
|
|
|
type="submit">{{( pgettext "Save" "action" )}}</button>
|
2023-05-03 10:46:25 +00:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</section>
|
Compute the total amount, base plus taxes, of all expenses
This works mostly like invoices: i have to “update” the expense form
to compute its total based on the subtotal and the selected taxes,
although in this case i do no need to compute the subtotal because that
is given by the user.
Nevertheless, i added a new function to compute that total because it
was already hairy enough for the dashboard, that also needs to compute
the tota, not just the base, and i wanted to test that function.
There is no need for a custom input type for that function as it only
needs a couple of simple domains. I have created the output type,
though, because otherwise i would need to have records or “reuse” any
other “amount” output type, which would be confusing.\
Part of #68.
2023-07-13 18:50:26 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
document.body.addEventListener('recompute', function () {
|
|
|
|
document.getElementById('recompute-button').click();
|
|
|
|
});
|
|
|
|
</script>
|
2023-05-03 10:46:25 +00:00
|
|
|
{{- end }}
|