package templates import ( "encoding/json" "fmt" "veola/internal/models" ) type ItemResultsData struct { Page Item models.Item Badge BadgeData History []models.PricePoint Results []models.Result Page_ int TotalPages int Order string HistoryChartJSON string } type BadgeData struct { Label string Class string // v-badge-low / v-badge-avg / v-badge-target / "" } type GlobalResultsData struct { Page Items []models.Item Results []ItemResultRow ItemID int64 From string To string } type ItemResultRow struct { models.Result ItemName string } templ itemResultsBody(d ItemResultsData) {
| Title | Price | Store | Found | Alert | |
|---|---|---|---|---|---|
|
if r.ImageURL != "" {
|
if r.URL != "" {
{ r.Title }
} else {
{ r.Title }
}
if r.MatchedQuery != "" {
via "{ r.MatchedQuery }"
}
|
{ fmtPrice(r.Price, r.Currency) } | { r.Source } | { humanTime(r.FoundAt) } | if r.Alerted { sent } |
| Item | Title | Price | Store | Found | Alert |
|---|---|---|---|---|---|
| { r.ItemName } |
if r.URL != "" {
{ r.Title }
} else {
{ r.Title }
}
if r.MatchedQuery != "" {
via "{ r.MatchedQuery }"
}
|
{ fmtPrice(r.Price, r.Currency) } | { r.Source } | { humanTime(r.FoundAt) } | if r.Alerted { sent } |