diff --git a/cmd/reports/template/reports_default_template.html b/cmd/reports/template/reports_default_template.html index 8152f3cc2..1785e0931 100644 --- a/cmd/reports/template/reports_default_template.html +++ b/cmd/reports/template/reports_default_template.html @@ -17,10 +17,6 @@ --text-primary: rgb(44, 62, 80); --text-secondary: rgb(127, 140, 141); --white: #ffffff; - - --header-height: 35mm; - --footer-height: 20mm; - --page-padding: 15mm; } * { @@ -37,40 +33,38 @@ } .page { - max-width: 210mm; - min-height: 297mm; - padding: var(--page-padding) 10mm; - margin: 5mm auto 0 auto; + width: 210mm; + height: 297mm; + padding: 15mm 10mm; + margin: 0 auto; background: var(--white); box-shadow: 0 0 10px rgba(0,0,0,0.1); position: relative; + page-break-after: always; display: flex; flex-direction: column; } + .page:last-child { + page-break-after: auto; + } + .header { - height: var(--header-height); - min-height: var(--header-height); - max-height: var(--header-height); - position: relative; flex-shrink: 0; - display: flex; - flex-direction: column; + margin-bottom: 8mm; } .header-top-bar { height: 8px; background-color: var(--primary-color); - margin: 5px 0 10px 0; - flex-shrink: 0; + margin: 0 0 8px 0; } .header-content { display: flex; justify-content: space-between; align-items: center; - margin-bottom: 10px; - flex-shrink: 0; + margin-bottom: 8px; } .header-title { @@ -92,9 +86,8 @@ .header-separator { height: 2px; background-color: var(--subtle-color); - margin: 5px 0 10px 0; + margin: 5px 0; position: relative; - flex-shrink: 0; } .header-separator::after { @@ -111,32 +104,35 @@ flex-grow: 1; display: flex; flex-direction: column; - min-height: 0; overflow: hidden; } .metrics-section { - margin-bottom: 15px; flex-shrink: 0; + margin-bottom: 10px; + } + + .metrics-section.continuation { + display: none; } .metrics-title { font-size: 16px; font-weight: bold; color: var(--secondary-color); - margin-bottom: 10px; + margin-bottom: 8px; } .metrics-info { background-color: var(--alternate-row); - padding: 12px; + padding: 10px; border-radius: 4px; - margin-bottom: 10px; + margin-bottom: 8px; } .metric-row { display: flex; - margin-bottom: 8px; + margin-bottom: 6px; } .metric-row:last-child { @@ -162,14 +158,13 @@ font-size: 10px; font-style: italic; color: var(--text-secondary); - margin-bottom: 10px; + margin-bottom: 8px; flex-shrink: 0; } .table-container { flex-grow: 1; - overflow: auto; - min-height: 0; + overflow: hidden; } .data-table { @@ -190,8 +185,6 @@ padding: 8px; text-align: center; border-bottom: 2px solid var(--subtle-color); - position: sticky; - top: 0; } .data-table td { @@ -237,23 +230,17 @@ } .footer { - height: var(--footer-height); - min-height: var(--footer-height); - max-height: var(--footer-height); - border-top: 2px solid var(--subtle-color); - padding-top: 8px; flex-shrink: 0; - display: flex; - flex-direction: column; - justify-content: flex-start; + border-top: 2px solid var(--subtle-color); + padding-top: 6px; + margin-top: 8mm; } .footer-separator { height: 1px; background-color: var(--subtle-color); - margin-bottom: 6px; + margin-bottom: 4px; position: relative; - flex-shrink: 0; } .footer-separator::after { @@ -270,25 +257,18 @@ display: flex; justify-content: space-between; align-items: center; - margin: 0; - padding: 0; - flex-shrink: 0; } .footer-generated { font-size: 8px; font-style: italic; color: var(--text-secondary); - margin: 0; - padding: 0; } .footer-page { font-size: 9px; font-weight: bold; color: var(--text-primary); - margin: 0; - padding: 0; } @media print { @@ -299,56 +279,59 @@ html, body { width: 210mm; - height: auto; - margin: 0 !important; - padding: 0 !important; + height: 297mm; + margin: 0; + padding: 0; } .page { - box-shadow: none; - max-width: none; - width: 210mm; - height: 297mm; - min-height: 297mm; margin: 0; - display: block; - page-break-after: always; - break-inside: avoid; + box-shadow: none; } - - .page:last-child { - page-break-after: auto; - } - - .header, .footer { - break-inside: avoid; - } - - .content-area { - overflow: hidden; - padding-bottom: calc(var(--footer-height) + 6mm); - } - - .footer { - position: absolute; - left: var(--page-padding); - right: var(--page-padding); - bottom: var(--page-padding); - } - - .table-container { overflow: hidden; } }
- {{$totalPages := len .Reports}} - {{if eq $totalPages 0}} - {{$totalPages = 1}} - {{end}} - {{$globalPage := 0}} {{if gt (len .Reports) 0}} - {{range $index, $report := .Reports}} + {{$firstPageRows := 24}} + {{$continuationPageRows := 32}} + {{$totalPages := 0}} + + {{/* Calculate total pages across all reports */}} + {{range $report := .Reports}} + {{$totalMessages := len .Messages}} + {{$reportPages := 1}} + {{if gt $totalMessages $firstPageRows}} + {{$remaining := sub $totalMessages $firstPageRows}} + {{$additionalPages := div $remaining $continuationPageRows}} + {{if gt (mod $remaining $continuationPageRows) 0}} + {{$additionalPages = add $additionalPages 1}} + {{end}} + {{$reportPages = add 1 $additionalPages}} + {{end}} + {{$totalPages = add $totalPages $reportPages}} + {{end}} + + {{$globalPage := 0}} + + {{range $reportIndex, $report := .Reports}} + {{$totalMessages := len .Messages}} + {{$pageCount := 1}} + {{if gt $totalMessages $firstPageRows}} + {{$remaining := sub $totalMessages $firstPageRows}} + {{$additionalPages := div $remaining $continuationPageRows}} + {{if gt (mod $remaining $continuationPageRows) 0}} + {{$additionalPages = add $additionalPages 1}} + {{end}} + {{$pageCount = add 1 $additionalPages}} + {{end}} + + {{range $pageNum := iterate $pageCount}} {{$globalPage = add $globalPage 1}} + {{$isFirstPage := eq $pageNum 0}} + {{$startRow := getStartRow $pageNum $firstPageRows $continuationPageRows}} + {{$endRow := getEndRow $pageNum $firstPageRows $continuationPageRows $totalMessages}} +