Make product description use the whole width in invoices and quotes

Using only the first column from the description means that most of the
time it is too narrow to be read comfortably.

This commit swaps the product name, usually shorter, and the
description, that now spans all columns.

Part of #106.
This commit is contained in:
jordi fita mas 2025-01-20 18:12:02 +01:00
parent 12b3b4ad12
commit d4dc8e00e5
3 changed files with 24 additions and 24 deletions

View File

@ -97,9 +97,11 @@
font-weight: bold; font-weight: bold;
} }
.invoice tbody td:first-child { .invoice tbody .description td:first-child {
max-width: 15em; padding: 0 1rem;
white-space: pre-wrap; white-space: pre-wrap;
text-align: justify;
hyphens: auto;
} }
.invoice .legal { .invoice .legal {

View File

@ -78,17 +78,11 @@
{{ $lastIndex := len .Products | sub 1 }} {{ $lastIndex := len .Products | sub 1 }}
{{ range $index, $product := .Products -}} {{ range $index, $product := .Products -}}
<tbody> <tbody>
{{- if .Description }} <tr {{ if .Description -}}
<tr class="name"> class="name"
<td colspan="{{ $columns }}">{{ .Name }}</td> {{- end -}}
</tr> >
{{ end -}} <td>{{ .Name }}</td>
<tr>
{{- if .Description }}
<td>{{ .Description }}</td>
{{- else }}
<td>{{ .Name }}</td>
{{- end -}}
<td class="numeric">{{ .Price | formatPrice }}</td> <td class="numeric">{{ .Price | formatPrice }}</td>
{{ if $.HasDiscounts -}} {{ if $.HasDiscounts -}}
<td class="numeric">{{ $product.Discount | formatPercent }}</td> <td class="numeric">{{ $product.Discount | formatPercent }}</td>
@ -100,6 +94,11 @@
{{ end -}} {{ end -}}
<td class="numeric">{{ .Total | formatPrice }}</td> <td class="numeric">{{ .Total | formatPrice }}</td>
</tr> </tr>
{{- if .Description }}
<tr class="description">
<td colspan="{{ $columns }}">{{ .Description }}</td>
</tr>
{{ end -}}
{{ if (eq $index $lastIndex) }} {{ if (eq $index $lastIndex) }}
<tr class="tfoot separator"> <tr class="tfoot separator">
<th scope="row" colspan="{{ $columns | sub 1 }}">{{( pgettext "Tax Base" "title" )}}</th> <th scope="row" colspan="{{ $columns | sub 1 }}">{{( pgettext "Tax Base" "title" )}}</th>

View File

@ -82,17 +82,11 @@
{{ $lastIndex := len .Products | sub 1 }} {{ $lastIndex := len .Products | sub 1 }}
{{ range $index, $product := .Products -}} {{ range $index, $product := .Products -}}
<tbody> <tbody>
{{- if .Description }} <tr {{ if .Description -}}
<tr class="name"> class="name"
<td colspan="{{ $columns }}">{{ .Name }}</td> {{- end -}}
</tr> >
{{ end -}} <td>{{ .Name }}</td>
<tr>
{{- if .Description }}
<td>{{ .Description }}</td>
{{- else }}
<td>{{ .Name }}</td>
{{- end -}}
<td class="numeric">{{ .Price | formatPrice }}</td> <td class="numeric">{{ .Price | formatPrice }}</td>
{{ if $.HasDiscounts -}} {{ if $.HasDiscounts -}}
<td class="numeric">{{ $product.Discount | formatPercent }}</td> <td class="numeric">{{ $product.Discount | formatPercent }}</td>
@ -104,6 +98,11 @@
{{ end -}} {{ end -}}
<td class="numeric">{{ .Total | formatPrice }}</td> <td class="numeric">{{ .Total | formatPrice }}</td>
</tr> </tr>
{{- if .Description }}
<tr class="description">
<td colspan="{{ $columns }}">{{ .Description }}</td>
</tr>
{{- end }}
{{ if (eq $index $lastIndex) }} {{ if (eq $index $lastIndex) }}
<tr class="tfoot separator"> <tr class="tfoot separator">
<th scope="row" colspan="{{ $columns | sub 1 }}">{{( pgettext "Tax Base" "title" )}}</th> <th scope="row" colspan="{{ $columns | sub 1 }}">{{( pgettext "Tax Base" "title" )}}</th>