diff --git a/server/get.go b/server/get.go index dc81c89..4c438cc 100644 --- a/server/get.go +++ b/server/get.go @@ -74,7 +74,7 @@ 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.DateForm(firstStr, lastStr, today, tomorrow, specialFilter), templates.OrdersMain(counts, cakeCounts, orders, firstStr, lastStr, specialFilter)), http.StatusOK, nil + return templates.MainContent("Panel główny", templates.OrdersMain(counts, cakeCounts, orders, firstStr, lastStr, specialFilter, today, tomorrow)), http.StatusOK, nil } if r.Header.Get("HX-Request") == "true" { @@ -100,7 +100,7 @@ func (h *Server) cakes(r *http.Request) (templ.Component, int, error) { } if r.Header.Get("HX-Request") == "true" { - return templates.MainContent("Katalog", templ.NopComponent, templates.CakesMain(cakes, tags)), http.StatusOK, nil + return templates.MainContent("Katalog", templates.CakesMain(cakes, tags)), http.StatusOK, nil } return templates.CakesPage(cakes, tags), http.StatusOK, nil @@ -114,7 +114,7 @@ func (h *Server) cake(r *http.Request) (templ.Component, int, error) { return nil, http.StatusInternalServerError, err } if r.Header.Get("HX-Request") == "true" { - return templates.MainContent("Ciasto nowe", templ.NopComponent, templates.CakeForm(models.Cake{}, tags)), http.StatusOK, nil + return templates.MainContent("Ciasto nowe", templates.CakeForm(models.Cake{}, tags)), http.StatusOK, nil } return templates.CakePage(models.Cake{}, tags), http.StatusOK, nil } @@ -135,7 +135,7 @@ func (h *Server) cake(r *http.Request) (templ.Component, int, error) { } if r.Header.Get("HX-Request") == "true" { - return templates.MainContent(templates.CakeTitle(data), templ.NopComponent, templates.CakeForm(data, tags)), http.StatusOK, nil + return templates.MainContent(templates.CakeTitle(data), templates.CakeForm(data, tags)), http.StatusOK, nil } return templates.CakePage(data, tags), http.StatusOK, nil @@ -148,7 +148,7 @@ func (h *Server) blocked(r *http.Request) (templ.Component, int, error) { } if r.Header.Get("HX-Request") == "true" { - return templates.MainContent("Terminy zablokowane", templ.NopComponent, templates.BlockedMain(dates)), http.StatusOK, nil + return templates.MainContent("Terminy zablokowane", templates.BlockedMain(dates)), http.StatusOK, nil } return templates.BlockedPage(dates), http.StatusOK, nil @@ -171,7 +171,7 @@ func (h *Server) order(r *http.Request) (templ.Component, int, error) { url := strings.Split(r.URL.Path, "/") if len(url) < 3 || url[2] == "" { if r.Header.Get("HX-Request") == "true" { - return templates.MainContent("Nowe zamówienie", templ.NopComponent, templates.OrderForm(models.Order{Date: time.Now()}, catalogue, tags, blockedDates)), http.StatusOK, nil + return templates.MainContent("Nowe zamówienie", templates.OrderForm(models.Order{Date: time.Now()}, catalogue, tags, blockedDates)), http.StatusOK, nil } return templates.OrderPage(models.Order{Date: time.Now()}, catalogue, tags, blockedDates), http.StatusOK, nil } @@ -187,7 +187,7 @@ func (h *Server) order(r *http.Request) (templ.Component, int, error) { } if r.Header.Get("HX-Request") == "true" { - return templates.MainContent(templates.OrderTitle(order), templ.NopComponent, templates.OrderForm(order, catalogue, tags, blockedDates)), http.StatusOK, nil + return templates.MainContent(templates.OrderTitle(order), templates.OrderForm(order, catalogue, tags, blockedDates)), http.StatusOK, nil } return templates.OrderPage(order, catalogue, tags, blockedDates), http.StatusOK, nil diff --git a/server/static/components.css b/server/static/components.css index e513816..613f707 100644 --- a/server/static/components.css +++ b/server/static/components.css @@ -214,13 +214,7 @@ font-size: 0.875rem; } -.metrics-grid { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: var(--space-sm); -} - -.metrics-grid > div { +.metric { background: var(--surface-white); border: 1px solid var(--outline-dim); border-radius: var(--radius-md); @@ -230,7 +224,7 @@ gap: var(--space-xs); } -.metrics-grid .label { +.metric .label { font-size: 0.75rem; font-weight: 500; color: var(--on-surface-dim); @@ -240,17 +234,17 @@ gap: var(--space-xs); } -.metrics-grid .label .material-symbols-outlined { +.metric .label .material-symbols-outlined { font-size: 1rem; } -.metrics-grid .value { +.metric .value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; } -.metrics-grid .change { +.metric .change { font-size: 0.75rem; font-weight: 600; } @@ -657,10 +651,6 @@ textarea + label { flex-direction: column; } -.col-span-2 { - grid-column: span 2; -} - .horizontal-group { display: flex; gap: var(--space-sm); @@ -729,27 +719,6 @@ textarea + label { color: var(--success-text); } -.breakdown-list { - list-style: none; -} - -.breakdown-item { - display: flex; - justify-content: space-between; - padding: 0.375rem var(--space-md); - margin: 0 calc(-1 * var(--space-md)); - border-bottom: 1px solid var(--outline-dim); -} - -.breakdown-amount { - font-weight: 600; -} - -.breakdown-empty { - color: var(--on-surface-dim); - font-size: 0.875rem; -} - .icon { width: 2rem; height: 2rem; @@ -770,7 +739,6 @@ textarea + label { .text-muted { color: var(--on-surface-dim); font-weight: 400; } .font-bold { font-weight: 700; } .font-medium { font-weight: 500; } -.grow { flex: 1; } .empty-state { text-align: center; diff --git a/server/static/layout.css b/server/static/layout.css index b699ee5..6d245e4 100644 --- a/server/static/layout.css +++ b/server/static/layout.css @@ -108,11 +108,21 @@ main { .main-content { padding: var(--space-md); + display: grid; + grid-template-columns: 1fr 1fr; + gap: var(--space-md); + align-content: start; +} + +.main-content > .horizontal-group { + grid-column: 1 / -1; +} + +#orders-results { + grid-column: 1 / -1; display: flex; flex-direction: column; gap: var(--space-md); - min-height: 0; - flex: 1; } @media (max-width: 64em) { diff --git a/server/static/order.js b/server/static/order.js index 0d5a205..526d4a3 100644 --- a/server/static/order.js +++ b/server/static/order.js @@ -265,7 +265,7 @@ function toggleCakeTagFilter(btn) { activeCakeTags.push(tag); btn.classList.add('active'); } - var rows = document.querySelectorAll('#cakes-table tbody tr'); + var rows = document.querySelectorAll('#cakes-card tbody tr'); for (var i = 0; i < rows.length; i++) { if (activeCakeTags.length === 0) { rows[i].classList.remove('hide'); continue; } var rowTags = (rows[i].getAttribute('data-tags') || '').split(','); diff --git a/server/templates/blocked.templ b/server/templates/blocked.templ index 50849a3..1139db4 100644 --- a/server/templates/blocked.templ +++ b/server/templates/blocked.templ @@ -7,7 +7,7 @@ import ( ) templ BlockedPage(blocked []models.BlockedDate) { - @Layout("Terminy zablokowane", templ.NopComponent, BlockedMain(blocked)) + @Layout("Terminy zablokowane", BlockedMain(blocked)) } templ BlockedMain(blocked []models.BlockedDate) { diff --git a/server/templates/cake.templ b/server/templates/cake.templ index 3f8c5bd..04e229d 100644 --- a/server/templates/cake.templ +++ b/server/templates/cake.templ @@ -7,7 +7,7 @@ import ( ) templ CakePage(cake models.Cake, allTags []models.Tag) { - @Layout(CakeTitle(cake), templ.NopComponent, CakeForm(cake, allTags)) + @Layout(CakeTitle(cake), CakeForm(cake, allTags)) } templ CakeForm(cake models.Cake, allTags []models.Tag) { diff --git a/server/templates/cakes.templ b/server/templates/cakes.templ index a3b1baa..cc00ba2 100644 --- a/server/templates/cakes.templ +++ b/server/templates/cakes.templ @@ -7,11 +7,11 @@ import ( ) templ CakesPage(cakes []models.Cake, allTags []models.Tag) { - @Layout("Katalog", templ.NopComponent, CakesMain(cakes, allTags)) + @Layout("Katalog", CakesMain(cakes, allTags)) } templ CakesMain(cakes []models.Cake, allTags []models.Tag) { -
+

inventory_2 @@ -30,10 +30,9 @@ templ CakesMain(cakes []models.Cake, allTags []models.Tag) { } } - +
- @@ -44,11 +43,6 @@ templ CakesMain(cakes []models.Cake, allTags []models.Tag) { for _, c := range cakes { -
Nazwa SKU Tagi
-
- cake -
-
{ c.Name } #{ strconv.Itoa(c.ID) } diff --git a/server/templates/confirmation.templ b/server/templates/confirmation.templ index 38773e2..b486629 100644 --- a/server/templates/confirmation.templ +++ b/server/templates/confirmation.templ @@ -3,7 +3,7 @@ package templates import "strconv" templ Confirmation(title string, id int) { - @Layout(title, templ.NopComponent, ConfirmationBody(id)) + @Layout(title, ConfirmationBody(id)) } templ ConfirmationBody(id int) { diff --git a/server/templates/layout.templ b/server/templates/layout.templ index 6a521c4..3ff8b3a 100644 --- a/server/templates/layout.templ +++ b/server/templates/layout.templ @@ -1,6 +1,6 @@ package templates -templ Layout(title string, header, main templ.Component) { +templ Layout(title string, main templ.Component) { @@ -17,11 +17,10 @@ templ Layout(title string, header, main templ.Component) { +
+

{ title }

+
-
-

{ title }

- @header -
@main
@@ -30,13 +29,12 @@ templ Layout(title string, header, main templ.Component) { } -templ MainContent(title string, header, main templ.Component) { +templ MainContent(title string, main templ.Component) { +
+

{ title }

+
{ title } — Zamówienia ciast -
-

{ title }

- @header -
@main
diff --git a/server/templates/order.templ b/server/templates/order.templ index 7c1c0e7..250d458 100644 --- a/server/templates/order.templ +++ b/server/templates/order.templ @@ -8,7 +8,7 @@ import ( ) templ OrderPage(order models.Order, catalogue []models.Cake, allTags []models.Tag, blockedDates []models.BlockedDate) { - @Layout(OrderTitle(order), templ.NopComponent, OrderForm(order, catalogue, allTags, blockedDates)) + @Layout(OrderTitle(order), OrderForm(order, catalogue, allTags, blockedDates)) } templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Tag, blockedDates []models.BlockedDate) { diff --git a/server/templates/orders.templ b/server/templates/orders.templ index ad426f2..f2dfb2a 100644 --- a/server/templates/orders.templ +++ b/server/templates/orders.templ @@ -7,17 +7,17 @@ import ( ) templ OrdersPage(first, last, today, tomorrow, special string, counts models.OrderCounts, cakeCounts []models.CakeCount, orders []models.Order) { - @Layout("Panel główny", DateForm(first, last, today, tomorrow, special), OrdersMain(counts, cakeCounts, orders, first, last, special)) + @Layout("Panel główny", OrdersMain(counts, cakeCounts, orders, first, last, special, today, tomorrow)) } templ DateForm(first, last, today, tomorrow, special string) {
-
+ @@ -27,32 +27,31 @@ templ DateForm(first, last, today, tomorrow, special string) {
} -templ OrdersMain(counts models.OrderCounts, cakeCounts []models.CakeCount, orders []models.Order, first, last, special string) { -
-
- - receipt_long - Aktywne - - { strconv.Itoa(counts.Active) } - Wszystkie niezrealizowane -
-
- - today - Na dziś - - { strconv.Itoa(counts.DueToday) } - Do zrobienia -
+templ OrdersMain(counts models.OrderCounts, cakeCounts []models.CakeCount, orders []models.Order, first, last, special, today, tomorrow string) { + @DateForm(first, last, today, tomorrow, special) +
+ + receipt_long + Aktywne + + { strconv.Itoa(counts.Active) } + Wszystkie niezrealizowane
-
+
+ + today + Na dziś + + { strconv.Itoa(counts.DueToday) } + Do zrobienia +
+
@OrdersContent(orders, cakeCounts, first, last, special)
} templ OrdersContent(orders []models.Order, cakeCounts []models.CakeCount, first, last, special string) { -
+

list_alt @@ -60,9 +59,9 @@ templ OrdersContent(orders []models.Order, cakeCounts []models.CakeCount, first,