{{- $acctID := .Identity.Account.AccountID }}
{{- $platform := .Platform }}
{{- $parsedPlatform := "" }}
{{- if not $platform }}
{{- $platform = .Request.URL.Query.Get "platform" }}
{{- if $platform }}
{{- $parsedPlatform = (parsePlatform $platform) }}
{{- end }}
{{- end }}
{{- $shopID := .ShopID }}
{{- if not $shopID }}
{{- $shopID = .Request.URL.Query.Get "shop-id" }}
{{- end }}
{{- $selectedShop := "" }}
{{- $listingID := .ListingID }}
{{- if not $listingID }}
{{- $listingID = .Request.URL.Query.Get "listing-id" }}
{{- end }}
{{- $selectedListing := "" }}
{{/* sse handler */}}
{{/* shop selector */}}
{{/* platform label */}}
Platform: {{ $platform }}
{{/* raw event table */}}
{{- $evts := "" }}
{{- if and $platform $shopID }}
{{- $evts = .Reports.GetRawShopEvents $acctID $parsedPlatform $shopID }}
{{- end }}
| Time |
{{/*EventID | */}}
Event |
{{- if $evts }}
{{- range $evt := $evts }}
| {{$evt.EventTimestamp}} |
{{/*{{$evt.EventID}} | */}}
{{prettyPrintJSON $evt.RawPayload}} |
{{- end }}
{{- end }}
{{/* TODO: implement listing chart */}}
{{- $displayListingReport := false }}
{{- if and $platform $shopID }}
{{- $displayListingReport = true }}
{{- end }}
{{/* listing selector */}}
{{- if $displayListingReport }}
{{- $report := "" }}
{{- if $displayListingReport | and $listingID }}
{{- $report = .Reports.GetListingCountsReport $acctID $parsedPlatform $shopID $listingID }}
{{- end }}
{{- if $report }}
{{- $minCount := $report.MinCount.Count }}
{{- $maxCount := $report.MaxCount.Count }}
{{- $countRange := subInt64 $maxCount $minCount }}
{{- $numCounts := len $report.Counts }}
{{/* will get replaced after loaded and upon resizing */}}
{{/*
{{- range $i, $count := $report.Counts }}
{{- $height := multFloat (divFloat (subFloat (int64ToFloat $count.Count) (int64ToFloat $minCount)) (int64ToFloat $countRange)) 100 }}
{{- $width := subFloat (divFloat 100 (intToFloat $numCounts)) 1 }}
{{- $left := divFloat (intToFloat (multInt $i 100)) (intToFloat $numCounts) }}
{{- $bottom := 0 }}
{{- end }}
*/}}
{{- end }}
| Time |
{{/*EventID | */}}
Count |
{{- if $report }}
{{- range $count := $report.Counts }}
| {{if $count.EventTimestamp}}{{$count.EventTimestamp}}{{end}} |
{{$count.Count}} |
{{- end }}
{{- end }}
{{- end }}