package seasonsview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/view/baseview" import "encoding/json" import "fmt" type FixtureJSON struct { ID int `json:"id"` HomeTeam string `json:"homeTeam"` AwayTeam string `json:"awayTeam"` Round int `json:"round"` GameWeek *int `json:"gameWeek"` } func fixtureToJSON(f *db.Fixture) FixtureJSON { return FixtureJSON{ ID: f.ID, HomeTeam: f.HomeTeam.Name, AwayTeam: f.AwayTeam.Name, Round: f.Round, GameWeek: f.GameWeek, } } func fixturesToJSON(fixtures []*db.Fixture) string { data := make([]FixtureJSON, len(fixtures)) for i, f := range fixtures { data[i] = fixtureToJSON(f) } b, _ := json.Marshal(data) return string(b) } templ SeasonLeagueManageFixturesPage(season *db.Season, league *db.League, fixtures []*db.Fixture) { @baseview.Layout(fmt.Sprintf("%s - %s - Manage Fixtures", season.Name, league.Name)) {
← Back to Fixtures

Manage Fixtures - { season.Name } - { league.Name }

@SeasonLeagueManageFixtures(season, league, fixtures)
} } templ SeasonLeagueManageFixtures(season *db.Season, league *db.League, fixtures []*db.Fixture) {
All game weeks must have at least 1 fixture

Game Weeks

No game weeks yet. Add one to start allocating fixtures.

( )
Drop fixtures here

Unallocated ()

No fixtures generated yet. All fixtures allocated!
}