feat: add expense from overview page
This commit is contained in:
parent
1c210bde67
commit
800a3298d9
4 changed files with 71 additions and 39 deletions
|
|
@ -114,7 +114,14 @@ func (h *SpaceHandler) DashboardPage(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
ui.Render(w, r, pages.SpaceOverviewPage(space, lists, tags))
|
||||
listsWithItems, err := h.listService.GetListsWithUncheckedItems(spaceID)
|
||||
if err != nil {
|
||||
slog.Error("failed to get lists with unchecked items", "error", err, "space_id", spaceID)
|
||||
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
ui.Render(w, r, pages.SpaceOverviewPage(space, lists, tags, listsWithItems))
|
||||
}
|
||||
|
||||
func (h *SpaceHandler) ListsPage(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -558,6 +565,18 @@ func (h *SpaceHandler) CreateExpense(w http.ResponseWriter, r *http.Request) {
|
|||
slog.Error("failed to get balance", "error", err, "space_id", spaceID)
|
||||
}
|
||||
|
||||
if r.URL.Query().Get("from") == "overview" {
|
||||
ui.Render(w, r, toast.Toast(toast.Props{
|
||||
Title: "Expense created",
|
||||
Description: "Your transaction has been recorded.",
|
||||
Variant: toast.VariantSuccess,
|
||||
Icon: true,
|
||||
Dismissible: true,
|
||||
Duration: 5000,
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
ui.Render(w, r, pages.ExpenseCreatedResponse(newExpense, balance))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue