flatter html
This commit is contained in:
parent
cf2e217030
commit
a74c276cd3
11 changed files with 84 additions and 107 deletions
|
|
@ -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) {
|
||||
<div class="horizontal-group">
|
||||
<div class="preset-group">
|
||||
<a href={ templ.URL("/orders?from=" + today + "&to=" + today + "&special=" + special) } hx-get={ templ.URL("/orders?from=" + today + "&to=" + today + "&special=" + special) } hx-target="#results-pane" class="preset-btn">Dzisiaj</a>
|
||||
<a href={ templ.URL("/orders?from=" + tomorrow + "&to=" + tomorrow + "&special=" + special) } hx-get={ templ.URL("/orders?from=" + tomorrow + "&to=" + tomorrow + "&special=" + special) } hx-target="#results-pane" class="preset-btn">Jutro</a>
|
||||
<a href={ templ.URL("/orders?special=" + special) } hx-get={ templ.URL("/orders?special=" + special) } hx-target="#results-pane" class="preset-btn">W tym tygodniu</a>
|
||||
<a href={ templ.URL("/orders?from=" + today + "&to=" + today + "&special=" + special) } hx-get={ templ.URL("/orders?from=" + today + "&to=" + today + "&special=" + special) } hx-target="#orders-results" class="preset-btn">Dzisiaj</a>
|
||||
<a href={ templ.URL("/orders?from=" + tomorrow + "&to=" + tomorrow + "&special=" + special) } hx-get={ templ.URL("/orders?from=" + tomorrow + "&to=" + tomorrow + "&special=" + special) } hx-target="#orders-results" class="preset-btn">Jutro</a>
|
||||
<a href={ templ.URL("/orders?special=" + special) } hx-get={ templ.URL("/orders?special=" + special) } hx-target="#orders-results" class="preset-btn">W tym tygodniu</a>
|
||||
</div>
|
||||
<form method="GET" action="/orders" class="horizontal-group" hx-get="/orders" hx-target="#results-pane" hx-trigger="change, keyup delay:500ms">
|
||||
<form method="GET" action="/orders" class="horizontal-group" hx-get="/orders" hx-target="#orders-results" hx-trigger="change, keyup delay:500ms">
|
||||
<label>Od</label>
|
||||
<input type="date" name="from" value={ first }/>
|
||||
<label>Do</label>
|
||||
|
|
@ -27,32 +27,31 @@ templ DateForm(first, last, today, tomorrow, special string) {
|
|||
</div>
|
||||
}
|
||||
|
||||
templ OrdersMain(counts models.OrderCounts, cakeCounts []models.CakeCount, orders []models.Order, first, last, special string) {
|
||||
<div class="metrics-grid">
|
||||
<div>
|
||||
<span class="label">
|
||||
<span class="material-symbols-outlined">receipt_long</span>
|
||||
Aktywne
|
||||
</span>
|
||||
<span class="value">{ strconv.Itoa(counts.Active) }</span>
|
||||
<span class="change">Wszystkie niezrealizowane</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="label">
|
||||
<span class="material-symbols-outlined">today</span>
|
||||
Na dziś
|
||||
</span>
|
||||
<span class="value">{ strconv.Itoa(counts.DueToday) }</span>
|
||||
<span class="change">Do zrobienia</span>
|
||||
</div>
|
||||
templ OrdersMain(counts models.OrderCounts, cakeCounts []models.CakeCount, orders []models.Order, first, last, special, today, tomorrow string) {
|
||||
@DateForm(first, last, today, tomorrow, special)
|
||||
<div class="metric">
|
||||
<span class="label">
|
||||
<span class="material-symbols-outlined">receipt_long</span>
|
||||
Aktywne
|
||||
</span>
|
||||
<span class="value">{ strconv.Itoa(counts.Active) }</span>
|
||||
<span class="change">Wszystkie niezrealizowane</span>
|
||||
</div>
|
||||
<div id="results-pane">
|
||||
<div class="metric">
|
||||
<span class="label">
|
||||
<span class="material-symbols-outlined">today</span>
|
||||
Na dziś
|
||||
</span>
|
||||
<span class="value">{ strconv.Itoa(counts.DueToday) }</span>
|
||||
<span class="change">Do zrobienia</span>
|
||||
</div>
|
||||
<div id="orders-results">
|
||||
@OrdersContent(orders, cakeCounts, first, last, special)
|
||||
</div>
|
||||
}
|
||||
|
||||
templ OrdersContent(orders []models.Order, cakeCounts []models.CakeCount, first, last, special string) {
|
||||
<section class="card">
|
||||
<section class="card" id="orders-card">
|
||||
<header>
|
||||
<h2>
|
||||
<span class="material-symbols-outlined">list_alt</span>
|
||||
|
|
@ -60,9 +59,9 @@ templ OrdersContent(orders []models.Order, cakeCounts []models.CakeCount, first,
|
|||
</h2>
|
||||
<div class="header-actions">
|
||||
<div class="preset-group">
|
||||
<a href={ templ.URL("/orders?special=true&from=" + first + "&to=" + last) } hx-get={ templ.URL("/orders?special=true&from=" + first + "&to=" + last) } hx-target="#results-pane"
|
||||
<a href={ templ.URL("/orders?special=true&from=" + first + "&to=" + last) } hx-get={ templ.URL("/orders?special=true&from=" + first + "&to=" + last) } hx-target="#orders-results"
|
||||
class={ "preset-btn", templ.KV("active", special == "true") }>Torty</a>
|
||||
<a href={ templ.URL("/orders?from=" + first + "&to=" + last) } hx-get={ templ.URL("/orders?from=" + first + "&to=" + last) } hx-target="#results-pane"
|
||||
<a href={ templ.URL("/orders?from=" + first + "&to=" + last) } hx-get={ templ.URL("/orders?from=" + first + "&to=" + last) } hx-target="#orders-results"
|
||||
class={ "preset-btn", templ.KV("active", special != "true") }>Wszystkie</a>
|
||||
</div>
|
||||
<div class="search">
|
||||
|
|
@ -158,25 +157,33 @@ templ OrderRow(order models.Order) {
|
|||
}
|
||||
|
||||
templ CakeBreakdown(cakeCounts []models.CakeCount) {
|
||||
<section class="card">
|
||||
<section class="card" id="breakdown-card">
|
||||
<header>
|
||||
<h2>
|
||||
<span class="material-symbols-outlined">cake</span>
|
||||
Zapotrzebowanie
|
||||
</h2>
|
||||
</header>
|
||||
<div>
|
||||
<ul class="breakdown-list">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nazwa</th>
|
||||
<th class="text-right">Ilość</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
for _, cc := range cakeCounts {
|
||||
<li class="breakdown-item">
|
||||
<span>{ cc.Name }</span>
|
||||
<span class="breakdown-amount">{ strconv.Itoa(cc.Amount) }</span>
|
||||
</li>
|
||||
<tr>
|
||||
<td>{ cc.Name }</td>
|
||||
<td class="text-right font-bold">{ strconv.Itoa(cc.Amount) }</td>
|
||||
</tr>
|
||||
}
|
||||
if len(cakeCounts) == 0 {
|
||||
<li class="breakdown-empty">Brak ciast w tym okresie</li>
|
||||
<tr>
|
||||
<td colspan="2" class="empty-state">Brak ciast w tym okresie</td>
|
||||
</tr>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue