cake-order-tracker/server/templates/cake.templ
bronkuu 5a5372b831 templates, handlers, CSS, JS: special cakes UI, HTMX nav, dashboard overhaul
Special cakes UI: overlay drawer, basket integration, catalogue tag
filter, form parsing, JS save/edit/remove.
HTMX navigation: MainContent component, nav links with hx-get,
handlers return partial on HX-Request.
Dashboard: metrics grid, CakeBreakdown, OrderRow with status select,
CakeCounts/OrderCounts, torty filter, tort badge, results-pane.
Collapsible sidebar: toggle button, localStorage, CSS transitions.
Location field: dropdown replaced with pill toggle.
Inline style cleanup: moved to CSS classes (tag-grid, grow, icon.sm,
header-actions, toggle-group, success-icon, etc.).
Dead CSS removal: pagination, status-chip, badge-pill, login-page.
Helpers: exported CakeTitle/OrderTitle, added tagNames, tagIDsComma,
orderItemsDesc, specialCakeDetail, removed unused helpers.
2026-06-15 18:50:21 +02:00

61 lines
1.7 KiB
Text

package templates
import (
"strconv"
"git.bronku.xyz/bronku/cake-order-tracker/models"
)
templ CakePage(cake models.Cake, allTags []models.Tag) {
@Layout(CakeTitle(cake), templ.NopComponent, CakeForm(cake, allTags))
}
templ CakeForm(cake models.Cake, allTags []models.Tag) {
<div class="form-card">
<section class="card">
<header>
<h2>
<span class="material-symbols-outlined">cake</span>
if cake.ID != 0 {
Edytuj ciasto #{ strconv.Itoa(cake.ID) }
} else {
Nowe ciasto
}
</h2>
</header>
<form method="post">
<input type="hidden" name="id" value={ strconv.Itoa(cake.ID) }/>
<div class="form-group">
<label>Nazwa *</label>
<input class="form-input" type="text" name="name" value={ cake.Name } placeholder="Nazwa ciasta"/>
</div>
<div class="form-group">
<label>Cena</label>
<input class="form-input" type="number" name="price" min="0" value={ cake.Price.String() }/>
</div>
<div class="form-group">
<label>Tagi</label>
<div class="tag-grid">
for _, t := range allTags {
<label class="tag-chip">
<input type="checkbox" name="tag" value={ strconv.Itoa(t.ID) } style="display:none"
if cakeHasTag(cake.Tags, t.ID) { checked }/>
{ t.Name }
</label>
}
</div>
<div class="horizontal-group" style="margin-top:0.375rem">
<input class="form-input grow" type="text" name="new_tag" placeholder="Nowy tag..."/>
</div>
</div>
<div class="form-actions">
<a href="/cakes" class="btn outline">Anuluj</a>
<button type="submit" class="btn primary">
<span class="material-symbols-outlined">save</span>
Zapisz ciasto
</button>
</div>
</form>
</section>
</div>
}