more simpler + torty sectino
This commit is contained in:
parent
a74c276cd3
commit
3b184c7c6f
10 changed files with 375 additions and 152 deletions
|
|
@ -65,6 +65,10 @@ func (h *Server) orders(r *http.Request) (templ.Component, int, error) {
|
|||
if err != nil {
|
||||
return nil, http.StatusInternalServerError, err
|
||||
}
|
||||
specialCakes, err := h.s.GetSpecialCakesInRange(first, last)
|
||||
if err != nil {
|
||||
return nil, http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
firstStr := first.Format(config.DateFormat)
|
||||
lastStr := last.Format(config.DateFormat)
|
||||
|
|
@ -74,11 +78,11 @@ func (h *Server) orders(r *http.Request) (templ.Component, int, error) {
|
|||
if err != nil {
|
||||
return nil, http.StatusInternalServerError, err
|
||||
}
|
||||
return templates.MainContent("Panel główny", templates.OrdersMain(counts, cakeCounts, orders, firstStr, lastStr, specialFilter, today, tomorrow)), http.StatusOK, nil
|
||||
return templates.MainContent("Panel główny", templates.OrdersMain(counts, cakeCounts, orders, specialCakes, firstStr, lastStr, specialFilter, today, tomorrow)), http.StatusOK, nil
|
||||
}
|
||||
|
||||
if r.Header.Get("HX-Request") == "true" {
|
||||
return templates.OrdersContent(orders, cakeCounts, firstStr, lastStr, specialFilter), http.StatusOK, nil
|
||||
return templates.OrdersContent(orders, cakeCounts, specialCakes, firstStr, lastStr, specialFilter), http.StatusOK, nil
|
||||
}
|
||||
|
||||
counts, err := h.s.GetOrderCounts()
|
||||
|
|
@ -86,7 +90,7 @@ func (h *Server) orders(r *http.Request) (templ.Component, int, error) {
|
|||
return nil, http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
return templates.OrdersPage(firstStr, lastStr, today, tomorrow, specialFilter, counts, cakeCounts, orders), http.StatusOK, nil
|
||||
return templates.OrdersPage(firstStr, lastStr, today, tomorrow, specialFilter, counts, cakeCounts, specialCakes, orders), http.StatusOK, nil
|
||||
}
|
||||
|
||||
func (h *Server) cakes(r *http.Request) (templ.Component, int, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue