Refactor the invoice product form template

I was using the exact same form from edit and new pages of invoice,
which is not too bad considering it won’t change very often, but i now
want to be able to add new empty product lines with the add product
button, and i will need to have a template for that form, which would
mean a third copy.
This commit is contained in:
jordi fita mas 2023-04-20 15:37:22 +02:00
parent 90982b49ff
commit c2f6d299b4
3 changed files with 13 additions and 14 deletions

View File

@ -109,3 +109,14 @@
</label> </label>
</fieldset> </fieldset>
{{- end }} {{- end }}
{{ define "invoice-product-form" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.invoiceProductForm*/ -}}
{{ 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 }}
{{- end }}

View File

@ -32,13 +32,7 @@
{{- range $product := .Products }} {{- range $product := .Products }}
<fieldset class="new-invoice-product"> <fieldset class="new-invoice-product">
{{ template "hidden-field" .InvoiceProductId }} {{ template "hidden-field" .InvoiceProductId }}
{{ template "hidden-field" .ProductId }} {{ template "invoice-product-form" . }}
{{ 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> </fieldset>
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -31,13 +31,7 @@
{{- range $product := .Products }} {{- range $product := .Products }}
<fieldset class="new-invoice-product"> <fieldset class="new-invoice-product">
{{ template "hidden-field" .ProductId }} {{ template "invoice-product-form" . }}
{{ 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> </fieldset>
{{- end }} {{- end }}
{{- end }} {{- end }}