{{if gt (len .Reports) 0}} {{$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}}
{{$.Title}}
{{$.GeneratedDate}}{{if $.Timezone}} ({{$.Timezone}}){{end}}
{{if $isFirstPage}}
Metrics
Name:
{{$report.Metric.Name}}
{{if $report.Metric.ClientID}}
Device ID:
{{$report.Metric.ClientID}}
{{end}}
Channel ID:
{{$report.Metric.ChannelID}}
Total Records: {{$totalMessages}}
{{else}}
Metrics (continued)
{{end}}
Time
Value
Unit
Protocol
Subtopic
{{range $msgIndex, $msg := $report.Messages}} {{if and (ge $msgIndex $startRow) (lt $msgIndex $endRow)}}
{{formatTime $msg.Time}}
{{formatValue $msg}}
{{$msg.Unit}}
{{$msg.Protocol}}
{{$msg.Subtopic}}
{{end}} {{end}}
{{end}} {{end}} {{else}}
{{.Title}}
{{.GeneratedDate}}{{if .Timezone}} ({{.Timezone}}){{end}}
Metrics
Name:
No Report
Channel ID:
N/A
Total Records: 0
Time
Value
Unit
Protocol
Subtopic
No data available
{{end}}