package seasonsview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/view/datepicker" import "git.haelnorr.com/h/oslstats/internal/view/component/links" import "fmt" templ FinalsSetupForm( season *db.Season, league *db.League, leaderboard []*db.LeaderboardEntry, unplayedFixtures []*db.Fixture, ) { {{ // Determine the recommended format value for the default Alpine state defaultFormat := "" if len(leaderboard) >= 10 && len(leaderboard) <= 15 { defaultFormat = string(db.PlayoffFormat10to15) } else if len(leaderboard) >= 7 && len(leaderboard) <= 9 { defaultFormat = string(db.PlayoffFormat7to9) } else if len(leaderboard) >= 5 && len(leaderboard) <= 6 { defaultFormat = string(db.PlayoffFormat5to6) } }}

Begin Finals Setup

Configure playoff format and dates for { league.Name }

@datepicker.DatePicker( "regular_season_end_date", "regular_season_end_date", "Regular Season End Date", "DD/MM/YYYY", true, "", )

Games after this date will be forfeited

@datepicker.DatePicker( "finals_start_date", "finals_start_date", "Finals Start Date", "DD/MM/YYYY", true, "", )

First playoff matches begin on this date

@formatOption( string(db.PlayoffFormat5to6), "5-6 Teams", "Top 5 qualify. 1st earns a bye, 2nd vs 3rd (upper), 4th vs 5th (lower). Double-chance for top seeds.", len(leaderboard) >= 5 && len(leaderboard) <= 6, len(leaderboard), ) @formatOption( string(db.PlayoffFormat7to9), "7-9 Teams", "Top 6 qualify. 1st & 2nd placed into semis. 3rd vs 6th and 4th vs 5th in quarter finals.", len(leaderboard) >= 7 && len(leaderboard) <= 9, len(leaderboard), ) @formatOption( string(db.PlayoffFormat10to15), "10-15 Teams", "Top 8 qualify. Top 4 get a second chance in qualifying finals.", len(leaderboard) >= 10 && len(leaderboard) <= 15, len(leaderboard), )
if len(unplayedFixtures) > 0 {

{ fmt.Sprintf("%d unplayed fixture(s) found", len(unplayedFixtures)) }

These fixtures will be recorded as a mutual forfeit when you begin finals. This action cannot be undone.

for _, fixture := range unplayedFixtures {
GW{ fmt.Sprint(*fixture.GameWeek) } { fixture.HomeTeam.Name } vs { fixture.AwayTeam.Name }
}
} if len(leaderboard) > 0 {
for _, entry := range leaderboard { @standingsPreviewRow(entry, season, league) }
# Team GP PTS
}
} templ formatOption(value, label, description string, recommended bool, teamCount int) { } templ boRoundDropdown(name, label, description string) {
{ label }

{ description }

} templ standingsPreviewRow(entry *db.LeaderboardEntry, season *db.Season, league *db.League) { { fmt.Sprint(entry.Position) } @links.TeamLinkInSeason(entry.Team, season, league) { fmt.Sprint(entry.Record.Played) } { fmt.Sprint(entry.Record.Points) } }