commit 776ebceec3c273c2d567a524640d42f12d2e1c0a
parent 619b732df11d927fa6fae3e43d22f893365acb31
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 17 Mar 2026 00:39:30 +0100
-fix typst to deal with array of totals
Diffstat:
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/contrib/typst/orders/orders.typ b/contrib/typst/orders/orders.typ
@@ -58,19 +58,23 @@
)).flatten(),
// Footer row
table.footer(
- table.cell(colspan: 2, stroke: (bottom: none))[*Total (paid only)*],
- table.cell(stroke: (bottom: none))[
- *#format_amount(data.total_amount)*
- ],
- table.cell(colspan: 2, x: 0, stroke: (top: none))[*Total (refunds)*],
- table.cell(stroke: (top: none))[#{
- let r = data.total_refund_amount
- if r != none {
- text(fill: red)[$-$ *#format_amount(data.total_refund_amount)*]
- } else {
- ["-"]
- }
- }],
+ ..data.total_amounts.zip(data.total_refund_amounts).map(pair => {
+ let (total, refund) = pair
+ (
+ table.cell(colspan: 2, stroke: (bottom: none))[*Total (paid only)*],
+ table.cell(stroke: (bottom: none))[
+ *#format_amount(total)*
+ ],
+ table.cell(colspan: 2, x: 0, stroke: (top: none))[*Total (refunds)*],
+ table.cell(stroke: (top: none))[#{
+ if refund != none {
+ text(fill: red)[$-$ *#format_amount(refund)*]
+ } else {
+ ["-"]
+ }
+ }],
+ )
+ }).flatten(),
),
)
}