2023-02-11 21:16:48 +00:00
|
|
|
{{ define "title" -}}
|
|
|
|
{{( pgettext "New Invoice" "title" )}}
|
|
|
|
{{- end }}
|
|
|
|
|
2023-03-20 12:09:52 +00:00
|
|
|
{{ define "breadcrumbs" -}}
|
2023-03-13 14:00:35 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newInvoicePage*/ -}}
|
2023-04-02 14:10:13 +00:00
|
|
|
<nav data-hx-target="main" data-hx-boost="true">
|
2023-02-11 21:16:48 +00:00
|
|
|
<p>
|
|
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
|
|
<a href="{{ companyURI "/invoices"}}">{{( pgettext "Invoices" "title" )}}</a> /
|
|
|
|
<a>{{( pgettext "New Invoice" "title" )}}</a>
|
|
|
|
</p>
|
|
|
|
</nav>
|
2023-03-20 12:09:52 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{ define "content" }}
|
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newInvoicePage*/ -}}
|
2023-03-31 11:01:26 +00:00
|
|
|
<section class="dialog-content" id="invoice-dialog-content" data-hx-target="this">
|
2023-02-11 21:16:48 +00:00
|
|
|
<h2>{{(pgettext "New Invoice" "title")}}</h2>
|
2023-03-31 11:01:26 +00:00
|
|
|
<form method="POST" action="{{ companyURI "/invoices" }}" data-hx-boost="true" data-hx-select="#invoice-dialog-content">
|
2023-02-11 21:16:48 +00:00
|
|
|
{{ csrfToken }}
|
|
|
|
|
2023-02-23 14:31:57 +00:00
|
|
|
{{ with .Form -}}
|
Show the duplicate invoice form in a dialog
Had to add a new hidden field to the form to know whether, when the
request is HTMx-triggered, to refresh the page, as i do when duplicating
from the index, or redirect the client to the new invoice’s view page,
but only if i was duplicating from that same page, not the index.
Since i now have to target main when redirecting to the view page, so
i had to add a location structure with the required json fields and all
that, when “refreshing” i actually tell HTMx to open the index page
again, which seems faster, now that i am used to boosted links.
2023-04-04 12:39:55 +00:00
|
|
|
{{ template "hidden-field" .Location }}
|
2023-03-13 14:00:35 +00:00
|
|
|
{{ template "hidden-select-field" .InvoiceStatus }}
|
2023-02-23 14:31:57 +00:00
|
|
|
{{ template "select-field" .Customer }}
|
|
|
|
{{ template "input-field" .Date }}
|
2023-03-19 22:11:40 +00:00
|
|
|
{{ template "tags-field" .Tags }}
|
2023-03-04 21:15:52 +00:00
|
|
|
{{ template "select-field" .PaymentMethod }}
|
2023-03-10 13:02:55 +00:00
|
|
|
{{ template "input-field" .Notes }}
|
2023-02-11 21:16:48 +00:00
|
|
|
|
2023-02-23 14:31:57 +00:00
|
|
|
{{- range $product := .Products }}
|
|
|
|
<fieldset class="new-invoice-product">
|
|
|
|
{{ template "hidden-field" .ProductId }}
|
|
|
|
{{ template "input-field" .Name }}
|
|
|
|
{{ template "input-field" .Price }}
|
|
|
|
{{ template "input-field" .Quantity }}
|
|
|
|
{{ template "input-field" .Discount }}
|
|
|
|
{{ template "input-field" .Description }}
|
|
|
|
{{ template "select-field" .Tax }}
|
|
|
|
</fieldset>
|
|
|
|
{{- end }}
|
2023-02-11 21:16:48 +00:00
|
|
|
{{- end }}
|
|
|
|
|
2023-02-23 14:31:57 +00:00
|
|
|
<table>
|
|
|
|
<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>
|
|
|
|
|
2023-02-11 21:16:48 +00:00
|
|
|
<fieldset>
|
2023-02-27 12:13:28 +00:00
|
|
|
<button formnovalidate formaction="{{ companyURI "/invoices/new" }}"
|
|
|
|
name="action" value="select-products"
|
2023-02-14 11:55:19 +00:00
|
|
|
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
2023-02-27 12:13:28 +00:00
|
|
|
<button formnovalidate formaction="{{ companyURI "/invoices/new" }}"
|
|
|
|
name="action" value="update"
|
2023-02-14 11:55:19 +00:00
|
|
|
type="submit">{{( pgettext "Update" "action" )}}</button>
|
2023-02-12 20:06:48 +00:00
|
|
|
<button class="primary" name="action" value="add"
|
|
|
|
type="submit">{{( pgettext "New invoice" "action" )}}</button>
|
2023-02-11 21:16:48 +00:00
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
</form>
|
|
|
|
</section>
|
|
|
|
{{- end }}
|