From d4dc8e00e50e8480bc77a88445b164cf585d6914 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Mon, 20 Jan 2025 18:12:02 +0100 Subject: [PATCH] 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. --- web/static/invoice.css | 6 ++++-- web/template/invoices/view.gohtml | 21 ++++++++++----------- web/template/quotes/view.gohtml | 21 ++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/web/static/invoice.css b/web/static/invoice.css index 85cb1f1..d923c91 100644 --- a/web/static/invoice.css +++ b/web/static/invoice.css @@ -97,9 +97,11 @@ font-weight: bold; } -.invoice tbody td:first-child { - max-width: 15em; +.invoice tbody .description td:first-child { + padding: 0 1rem; white-space: pre-wrap; + text-align: justify; + hyphens: auto; } .invoice .legal { diff --git a/web/template/invoices/view.gohtml b/web/template/invoices/view.gohtml index 01b54cf..e6e78d3 100644 --- a/web/template/invoices/view.gohtml +++ b/web/template/invoices/view.gohtml @@ -78,17 +78,11 @@ {{ $lastIndex := len .Products | sub 1 }} {{ range $index, $product := .Products -}} - {{- if .Description }} - - {{ .Name }} - - {{ end -}} - - {{- if .Description }} - {{ .Description }} - {{- else }} - {{ .Name }} - {{- end -}} + + {{ .Name }} {{ .Price | formatPrice }} {{ if $.HasDiscounts -}} {{ $product.Discount | formatPercent }} @@ -100,6 +94,11 @@ {{ end -}} {{ .Total | formatPrice }} + {{- if .Description }} + + {{ .Description }} + + {{ end -}} {{ if (eq $index $lastIndex) }} {{( pgettext "Tax Base" "title" )}} diff --git a/web/template/quotes/view.gohtml b/web/template/quotes/view.gohtml index d85382f..c0d94b2 100644 --- a/web/template/quotes/view.gohtml +++ b/web/template/quotes/view.gohtml @@ -82,17 +82,11 @@ {{ $lastIndex := len .Products | sub 1 }} {{ range $index, $product := .Products -}} - {{- if .Description }} - - {{ .Name }} - - {{ end -}} - - {{- if .Description }} - {{ .Description }} - {{- else }} - {{ .Name }} - {{- end -}} + + {{ .Name }} {{ .Price | formatPrice }} {{ if $.HasDiscounts -}} {{ $product.Discount | formatPercent }} @@ -104,6 +98,11 @@ {{ end -}} {{ .Total | formatPrice }} + {{- if .Description }} + + {{ .Description }} + + {{- end }} {{ if (eq $index $lastIndex) }} {{( pgettext "Tax Base" "title" )}}