added fixture scheduling
This commit is contained in:
@@ -5,13 +5,13 @@ import "git.haelnorr.com/h/oslstats/internal/permissions"
|
||||
import "git.haelnorr.com/h/oslstats/internal/contexts"
|
||||
import "fmt"
|
||||
|
||||
templ SeasonLeagueFixturesPage(season *db.Season, league *db.League, fixtures []*db.Fixture) {
|
||||
templ SeasonLeagueFixturesPage(season *db.Season, league *db.League, fixtures []*db.Fixture, scheduleMap map[int]*db.FixtureSchedule) {
|
||||
@SeasonLeagueLayout("fixtures", season, league) {
|
||||
@SeasonLeagueFixtures(season, league, fixtures)
|
||||
@SeasonLeagueFixtures(season, league, fixtures, scheduleMap)
|
||||
}
|
||||
}
|
||||
|
||||
templ SeasonLeagueFixtures(season *db.Season, league *db.League, fixtures []*db.Fixture) {
|
||||
templ SeasonLeagueFixtures(season *db.Season, league *db.League, fixtures []*db.Fixture, scheduleMap map[int]*db.FixtureSchedule) {
|
||||
{{
|
||||
permCache := contexts.Permissions(ctx)
|
||||
canManage := permCache.HasPermission(permissions.FixturesManage)
|
||||
@@ -61,7 +61,14 @@ templ SeasonLeagueFixtures(season *db.Season, league *db.League, fixtures []*db.
|
||||
</div>
|
||||
<div class="divide-y divide-surface1">
|
||||
for _, fixture := range group.Fixtures {
|
||||
<div class="px-4 py-3 flex items-center justify-between">
|
||||
{{
|
||||
sched, hasSchedule := scheduleMap[fixture.ID]
|
||||
_ = sched
|
||||
}}
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/fixtures/%d", fixture.ID)) }
|
||||
class="px-4 py-3 flex items-center justify-between hover:bg-surface1 transition hover:cursor-pointer block"
|
||||
>
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="text-xs font-mono text-subtext0 bg-mantle px-2 py-0.5 rounded">
|
||||
R{ fmt.Sprint(fixture.Round) }
|
||||
@@ -74,7 +81,16 @@ templ SeasonLeagueFixtures(season *db.Season, league *db.League, fixtures []*db.
|
||||
{ fixture.AwayTeam.Name }
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
if hasSchedule && sched.ScheduledTime != nil {
|
||||
<span class="text-xs text-green font-medium">
|
||||
{ sched.ScheduledTime.Format("Mon 2 Jan 3:04 PM") }
|
||||
</span>
|
||||
} else {
|
||||
<span class="text-xs text-subtext1">
|
||||
TBD
|
||||
</span>
|
||||
}
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user