Use same template for account and all-accounts

This commit is contained in:
2021-12-10 16:38:10 +00:00
parent 4cd81592e4
commit e0eeaadc60
3 changed files with 9 additions and 36 deletions

View File

@ -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) {