Split app into subpages, persist ingame time, and add 14-month dashboard calendar
This commit is contained in:
117
cmd/server/types.go
Normal file
117
cmd/server/types.go
Normal file
@@ -0,0 +1,117 @@
|
||||
package main
|
||||
|
||||
import "database/sql"
|
||||
|
||||
type Settings struct {
|
||||
DaysPerMonth int
|
||||
CurrentMonth int
|
||||
CurrentDay int
|
||||
}
|
||||
|
||||
type Field struct {
|
||||
ID int64
|
||||
Number int
|
||||
Name string
|
||||
Owned bool
|
||||
GroupKey string
|
||||
GroupName string
|
||||
}
|
||||
|
||||
type FieldGroup struct {
|
||||
Key string
|
||||
Name string
|
||||
Numbers string
|
||||
}
|
||||
|
||||
type Crop struct {
|
||||
ID int64
|
||||
Name string
|
||||
SowStartMonth int
|
||||
SowEndMonth int
|
||||
GrowMonths int
|
||||
}
|
||||
|
||||
type Plan struct {
|
||||
ID int64
|
||||
FieldID sql.NullInt64
|
||||
TargetRef string
|
||||
TargetName string
|
||||
CropID int64
|
||||
CropName string
|
||||
StartMonth int
|
||||
StartDay int
|
||||
HarvestMonth int
|
||||
HarvestDay int
|
||||
Notes string
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
Type string
|
||||
Field string
|
||||
Message string
|
||||
SortOrder int
|
||||
}
|
||||
|
||||
type PlanningTarget struct {
|
||||
Ref string
|
||||
Label string
|
||||
}
|
||||
|
||||
type MonthOption struct {
|
||||
Value int
|
||||
Label string
|
||||
}
|
||||
|
||||
type CalendarDay struct {
|
||||
Day int
|
||||
Tasks []Task
|
||||
}
|
||||
|
||||
type CalendarMonth struct {
|
||||
Offset int
|
||||
Month int
|
||||
Label string
|
||||
YearOffset int
|
||||
Days []CalendarDay
|
||||
}
|
||||
|
||||
type BasePage struct {
|
||||
ActivePath string
|
||||
Error string
|
||||
Info string
|
||||
}
|
||||
|
||||
type DashboardPage struct {
|
||||
BasePage
|
||||
Settings Settings
|
||||
CurrentMonth string
|
||||
TodayTasks []Task
|
||||
Calendar []CalendarMonth
|
||||
PlanningCount int
|
||||
}
|
||||
|
||||
type FieldsPage struct {
|
||||
BasePage
|
||||
Fields []Field
|
||||
Groups []FieldGroup
|
||||
}
|
||||
|
||||
type CropsPage struct {
|
||||
BasePage
|
||||
Crops []Crop
|
||||
}
|
||||
|
||||
type PlanningPage struct {
|
||||
BasePage
|
||||
Settings Settings
|
||||
Months []MonthOption
|
||||
Crops []Crop
|
||||
Plans []Plan
|
||||
PlanningTargets []PlanningTarget
|
||||
}
|
||||
|
||||
type GeneralPage struct {
|
||||
BasePage
|
||||
Settings Settings
|
||||
Months []MonthOption
|
||||
}
|
||||
Reference in New Issue
Block a user