Its not pretty but expenses can be added with shares and payments, kinda

This commit is contained in:
2025-07-21 00:09:42 +01:00
parent 43f603d478
commit 4e50ad653f
8 changed files with 273 additions and 19 deletions
+22 -3
View File
@@ -91,7 +91,6 @@ func expensePage(c *gin.Context) {
return
}
categories, err := expenses.GetAllCategories()
if err != nil {
ServerErrorView(c, "failed to fetch categories")
@@ -110,8 +109,11 @@ func expensePage(c *gin.Context) {
return
}
log.Println(expense.Shares)
log.Println(expense.Payments)
users, err := expenses.GetAllUsers()
if err != nil {
ServerErrorView(c, "failed to fetch users")
return
}
summary, err := expense.GetSummary()
if err != nil {
@@ -119,6 +121,15 @@ func expensePage(c *gin.Context) {
return
}
log.Println("Users:")
log.Println(users)
log.Println("Payments:")
log.Println(expense.Payments)
log.Println("Shares:")
log.Println(expense.Shares)
content := templating.HtmlTemplate(
fp.Join(cfg.AssetsDir, "/htmx/expense.html"),
map[string]any{
@@ -128,6 +139,7 @@ func expensePage(c *gin.Context) {
"stores": stores,
"types": types,
"summary": summary,
"users": users,
},
)
@@ -164,6 +176,12 @@ func newExpensePage(c *gin.Context) {
return
}
users, err := expenses.GetAllUsers()
if err != nil {
ServerErrorView(c, "failed to fetch users")
return
}
content := templating.HtmlTemplate(
fp.Join(cfg.AssetsDir, "/htmx/expense.html"), map[string]any{
"method": "post",
@@ -171,6 +189,7 @@ func newExpensePage(c *gin.Context) {
"categories": categories,
"stores": stores,
"types": types,
"users": users,
},
)