package templates import ( "strconv" "git.bronku.xyz/bronku/cake-order-tracker/models" ) templ OrdersPage(first, last, today, tomorrow string, orders []models.Order) { @Layout("Panel główny", DateForm(first, last, today, tomorrow), OrdersMain(orders)) } templ DateForm(first, last, today, tomorrow string) {
Dzisiaj Jutro W tym tygodniu
} templ OrdersMain(orders []models.Order) {
receipt_long Zamówienia dzisiaj { len(orders) } arrow_upward Wszystkie aktywne
cake Do realizacji { strconv.Itoa(countPending(orders)) } priority_high Oczekujące
check_circle Gotowe do odbioru { strconv.Itoa(countDone(orders)) } Zrealizowane
payments Przychód (szac.) { estimateRevenue(orders).String() } PLN trending_up W bieżącym miesiącu

list_alt Aktywne zamówienia

search
@OrdersTable(orders)
} templ OrdersTable(orders []models.Order) { for _, o := range orders { }
ID zamówienia Klient Data odbioru Pozycje Suma Status
#{ strconv.Itoa(o.ID) } { o.Surname } { o.Name }
{ o.Phone }
{ o.Date.Format("2006-01-02 15:04") } for i, c := range o.Cakes { if i > 0 { { ", " } } { c.Name } (x{ strconv.Itoa(c.Amount) }) } { o.Total().String() } PLN if o.Status == "accepted" { Przyjęte } else if o.Status == "done" { Gotowe } else { Oczekujące } edit
}