From 75d8d1700effe32272d1f0091242dac874e426cc Mon Sep 17 00:00:00 2001 From: H3ALY Date: Fri, 28 Mar 2025 14:52:50 +0000 Subject: [PATCH] updated so balls are coloured to their respective game. need to thing about set for life. --- helpers/template.go | 26 ++++++- static/css/site.css | 91 ++++++++++++++--------- templates/account/tickets/my_tickets.html | 61 +++++++-------- 3 files changed, 113 insertions(+), 65 deletions(-) diff --git a/helpers/template.go b/helpers/template.go index 262c743..fc52c86 100644 --- a/helpers/template.go +++ b/helpers/template.go @@ -3,6 +3,7 @@ package helpers import ( "html/template" "net/http" + "strings" "synlotto-website/models" "github.com/gorilla/csrf" @@ -31,7 +32,9 @@ func TemplateFuncs() template.FuncMap { } return *p }, - "inSlice": InSlice, + "inSlice": InSlice, + "lower": lower, + "rangeClass": rangeClass, } } @@ -72,3 +75,24 @@ func InSlice(n int, list []int) bool { return true } + +func lower(input string) string { + return strings.ToLower(input) +} + +func rangeClass(n int) string { + switch { + case n >= 1 && n <= 9: + return "01-09" + case n >= 10 && n <= 19: + return "10-19" + case n >= 20 && n <= 29: + return "20-29" + case n >= 30 && n <= 39: + return "30-39" + case n >= 40 && n <= 49: + return "40-49" + default: + return "50-plus" + } +} diff --git a/static/css/site.css b/static/css/site.css index eb5d446..5d5ddef 100644 --- a/static/css/site.css +++ b/static/css/site.css @@ -19,12 +19,6 @@ gap: 0.5rem; } - .matched { - background-color: #22c55e; - color: white; - font-weight: bold; - } - .bonus { border: 2px solid #facc15; } @@ -36,52 +30,79 @@ animation: pulse 1s infinite; } - .prize-badge { + /* .prize-badge { background-color: #9333ea; color: white; border-radius: 9999px; padding: 0.25rem 0.5rem; font-size: 0.75rem; box-shadow: 0 0 6px rgba(0,0,0,0.2); - } + } */ .ball.bonus { - background-color: #d8b4fe; + background-color: red; } .ball.matched { - background-color: #4ade80 !important; animation: pulse 1s ease-in-out infinite; - color: white !important; - border: 2px solid red !important; } - .ball.game-thunderball { - background-color: #1e3a8a; /* Dark blue */ - color: white; + .ball.game-lotto.lotto-range-01-09 { + background-color: white; + border: .1px solid #000000; + color: black; + } + .ball.game-lotto.lotto-range-10-19 { + background-color: #add8e6; + color: black; + } + .ball.game-lotto.lotto-range-20-29 { + background-color: #ffc0cb; + color: black; + } + .ball.game-lotto.lotto-range-30-39 { + background-color: #90ee90; + color: black; + } + + .ball.game-lotto.lotto-range-40-49 { + background-color: #ffff99; + color: black; + } + + .ball.game-lotto.lotto-range-50-plus { + background-color: #B40AE3; + color: black; + } + + .ball[class*="game-thunderball"]:not(.bonus) { + background-color: #6B65FC; + border: 2px solid white; + } + + .ball[class*="game-thunderball"] { + background-color: #d8b4fe ; + border: 2px solid white; + } + + .ball[class*="game-euromillions"]:not(.bonus) { + background-color: #BF1314; + border: 2px solid white; + } + + .ball[class*="game-euromillions"] { + background-color: #FFDE59 ; border: 2px solid white; - border-radius: 12px; /* Remove side rounding */ } - /* Lotto main balls – Orange */ - .ball.game-lotto { - background-color: #f97316; /* Bright orange */ - color: white; - border: none; - border-radius: 12px; - } - - /* Optional: Euromillions, Set For Life – define as needed */ - .ball.game-euromillions { - background-color: #2563eb; /* Royal blue */ - color: white; - border-radius: 50%; - } - - .ball.game-setforlife { - background-color: #6b7280; /* Slate gray */ - color: white; - border-radius: 50%; + /* .ball[class*="game-setforlife"]:not(.bonus) { + background-color: #6B65FC; + border: 2px solid white; + } */ + + .ball[class*="game-setforlife"] { + background-color: #98F5F9 ; + border: 2px solid white; } @keyframes pulse { 0% { transform: scale(1); } diff --git a/templates/account/tickets/my_tickets.html b/templates/account/tickets/my_tickets.html index 7a04acd..5b4c106 100644 --- a/templates/account/tickets/my_tickets.html +++ b/templates/account/tickets/my_tickets.html @@ -19,46 +19,49 @@ {{ range .Tickets }} + {{ $ticket := . }} - {{ .GameType }} - {{ .DrawDate }} + {{ $ticket.GameType }} + {{ $ticket.DrawDate }}
- {{ range $i, $ball := .Balls }} -
{{ $ball }}
- {{ end }} + {{ range $i, $ball := $ticket.Balls }} +
+ {{ $ball }} +
+ {{ end }}
- {{ if or (gt .MatchedMain 0) (gt .MatchedBonus 0) }} + {{ if or (gt $ticket.MatchedMain 0) (gt $ticket.MatchedBonus 0) }}
- {{ .MatchedMain }} match{{ if ne .MatchedMain 1 }}es{{ end }} - {{ if gt .MatchedBonus 0 }}, {{ .MatchedBonus }} bonus{{ end }} + {{ $ticket.MatchedMain }} match{{ if ne $ticket.MatchedMain 1 }}es{{ end }} + {{ if gt $ticket.MatchedBonus 0 }}, {{ $ticket.MatchedBonus }} bonus{{ end }}
{{ end }} - {{ if eq .GameType "Lotto" }} - - {{ else if gt (intVal .Bonus2) 0 }} -
- {{ if gt (intVal .Bonus1) 0 }} - {{ $b1 := intVal .Bonus1 }} -
- {{ $b1 }} -
- {{ end }} - {{ $b2 := intVal .Bonus2 }} -
- {{ $b2 }} + {{ if eq $ticket.GameType "Lotto" }} + + {{ else if gt (intVal $ticket.Bonus2) 0 }} +
+ {{ if gt (intVal $ticket.Bonus1) 0 }} + {{ $b1 := intVal $ticket.Bonus1 }} +
+ {{ $b1 }}
+ {{ end }} + {{ $b2 := intVal $ticket.Bonus2 }} +
+ {{ $b2 }}
- {{ else if gt (intVal .Bonus1) 0 }} - {{ $b := intVal .Bonus1 }} -
- {{ $b }} -
- {{ else }} - - {{ end }} +
+ {{ else if gt (intVal $ticket.Bonus1) 0 }} + {{ $b := intVal $ticket.Bonus1 }} +
+ {{ $b }} +
+ {{ else }} + + {{ end }} {{ .PurchaseDate }} {{ .PurchaseMethod }}