diff --git a/http/budget.go b/http/budget.go index fad105e..9b14e91 100644 --- a/http/budget.go +++ b/http/budget.go @@ -9,12 +9,13 @@ import ( "github.com/google/uuid" ) -type BudgetData struct { +type AllAccountsData struct { AlwaysNeededData + Account *postgres.Account Transactions []postgres.GetTransactionsForBudgetRow } -func (h *Handler) budget(c *gin.Context) { +func (h *Handler) allAccounts(c *gin.Context) { budgetID := c.Param("budgetid") budgetUUID, err := uuid.Parse(budgetID) if err != nil { @@ -28,12 +29,15 @@ func (h *Handler) budget(c *gin.Context) { return } - d := BudgetData{ + d := AllAccountsData{ c.MustGet("data").(AlwaysNeededData), + &postgres.Account{ + Name: "All accounts", + }, transactions, } - c.HTML(http.StatusOK, "budget.html", d) + c.HTML(http.StatusOK, "account.html", d) } func (h *Handler) newBudget(c *gin.Context) { diff --git a/http/http.go b/http/http.go index 72251be..b01232f 100644 --- a/http/http.go +++ b/http/http.go @@ -58,7 +58,7 @@ func (h *Handler) Serve() { withBudget.Use(h.getImportantData) withBudget.GET("/budget/:budgetid", h.budgeting) withBudget.GET("/budget/:budgetid/:year/:month", h.budgeting) - withBudget.GET("/budget/:budgetid/all-accounts", h.budget) + withBudget.GET("/budget/:budgetid/all-accounts", h.allAccounts) withBudget.GET("/budget/:budgetid/accounts", h.accounts) withBudget.GET("/budget/:budgetid/account/:accountid", h.account) withBudget.GET("/budget/:budgetid/clear", h.clearBudget) diff --git a/web/budget.html b/web/budget.html deleted file mode 100644 index 24e298e..0000000 --- a/web/budget.html +++ /dev/null @@ -1,31 +0,0 @@ -{{template "base" .}} - -{{define "title"}}Budget{{end}} - -{{define "new"}} - {{template "transaction-new"}} -{{end}} - -{{define "main"}} -
- New Transaction - -
- - {{range .Transactions}} - - - - - - {{template "amount-cell" .Amount}} - - {{end}} -
{{.Date.Format "02.01.2006"}} - {{.Account}} - - {{.Payee}} - - {{.Memo}} -
-{{end}} \ No newline at end of file