style rewrite
This commit is contained in:
parent
8c7067d5d9
commit
7c756e87c1
8 changed files with 737 additions and 376 deletions
|
|
@ -1,36 +1,34 @@
|
|||
{{define "title"}}
|
||||
Cake {{.ID}}
|
||||
Ciasto {{if .ID}}#{{.ID}}{{else}}nowe{{end}}
|
||||
{{end}}
|
||||
{{define "main"}}
|
||||
<main>
|
||||
<form method="post">
|
||||
<form method="post" class="order">
|
||||
<div>
|
||||
<h2>Info</h2>
|
||||
<label>
|
||||
<input hidden="hidden" name="id" value="{{.ID}}">
|
||||
</label>
|
||||
<label>name</label>
|
||||
<label>
|
||||
<h2>Informacje o cieście</h2>
|
||||
<input hidden="hidden" name="id" value="{{.ID}}">
|
||||
<label>Nazwa
|
||||
<input type="text" name="name" value="{{.Name}}">
|
||||
</label>
|
||||
<label>price</label>
|
||||
<label>
|
||||
<label>Cena (gr)
|
||||
<input type="number" name="price" min="0" value="{{.Price}}">
|
||||
</label>
|
||||
<label>category</label>
|
||||
<label for="category"></label><select name="category" id="category" >
|
||||
<option {{ if eq .Category "common" }}selected{{ end }} value="common">common</option>
|
||||
<option {{ if eq .Category "christmas" }}selected{{ end }} value="christmas">christmas</option>
|
||||
<option {{ if eq .Category "easter" }}selected{{ end }} value="easter">easter</option>
|
||||
<option {{ if eq .Category "donuts" }}selected{{ end }} value="donuts">donuts</option>
|
||||
</select>
|
||||
<label>availability</label>
|
||||
<label for="availability"></label><select name="availability" id="availability" >
|
||||
<option {{ if eq .Availability "available" }}selected{{ end }} value="available">available</option>
|
||||
<option {{ if eq .Availability "unavailable" }}selected{{ end }} value="unavailable">unavailable</option>
|
||||
</select>
|
||||
<label>Kategoria
|
||||
<select name="category" id="category">
|
||||
<option {{ if eq .Category "common" }}selected{{ end }} value="common">common</option>
|
||||
<option {{ if eq .Category "christmas" }}selected{{ end }} value="christmas">christmas</option>
|
||||
<option {{ if eq .Category "easter" }}selected{{ end }} value="easter">easter</option>
|
||||
<option {{ if eq .Category "donuts" }}selected{{ end }} value="donuts">donuts</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Dostępność
|
||||
<select name="availability" id="availability">
|
||||
<option {{ if eq .Availability "available" }}selected{{ end }} value="available">dostępne</option>
|
||||
<option {{ if eq .Availability "unavailable" }}selected{{ end }} value="unavailable">niedostępne</option>
|
||||
</select>
|
||||
</label>
|
||||
<button type="submit">Zapisz ciasto</button>
|
||||
</div>
|
||||
<button type="submit">submit</button>
|
||||
</form>
|
||||
</main>
|
||||
{{end}}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,37 @@
|
|||
{{define "title"}}
|
||||
Cakes
|
||||
Ciasta
|
||||
{{end}}
|
||||
{{define "main"}}
|
||||
<main>
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Price</th>
|
||||
<th>Category</th>
|
||||
<th>Availability</th>
|
||||
</tr>
|
||||
{{range .}}
|
||||
<tr>
|
||||
<th><a href="/cake/{{.ID}}">edit</a></th>
|
||||
<th>{{.Name}}</th>
|
||||
<th>{{.Price}}</th>
|
||||
<th>{{.Category}}</th>
|
||||
<th>{{.Availability}}</th>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
<div class="toolbar">
|
||||
<a href="/cake" class="btn-primary">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
Nowe ciasto
|
||||
</a>
|
||||
</div>
|
||||
<div id="results-table" class="scrollable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Nazwa</th>
|
||||
<th>Cena</th>
|
||||
<th>Kategoria</th>
|
||||
<th>Dostępność</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .}}
|
||||
<tr>
|
||||
<th><a href="/cake/{{.ID}}">Edytuj</a></th>
|
||||
<th>{{.Name}}</th>
|
||||
<th>{{.Price}} PLN</th>
|
||||
<th>{{.Category}}</th>
|
||||
<th>{{.Availability}}</th>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</main>
|
||||
{{end}}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{{template "title" .}}</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<script src="/static/htmx2.04.js" defer></script>
|
||||
<script src="/static/order.js" ></script>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
|
|
|
|||
|
|
@ -9,78 +9,74 @@
|
|||
<main>
|
||||
<form method="post" class="order">
|
||||
{{with .Order}}
|
||||
<div class="order-contents">
|
||||
<div>
|
||||
<h2>Dane zamówienia</h2>
|
||||
<label>
|
||||
<input hidden="hidden" name="id" value="{{.ID}}">
|
||||
</label>
|
||||
<label>Imię
|
||||
<input type="text" name="name" value="{{.Name}}">
|
||||
</label>
|
||||
<label>Nazwisko
|
||||
<input type="text" name="surname" value="{{.Surname}}">
|
||||
</label>
|
||||
<label>Numer telefonu
|
||||
<input type="tel" name="phone" value="{{.Phone}}">
|
||||
</label>
|
||||
<label>Lokalizacja
|
||||
<select name="location">
|
||||
<option {{ if eq .Location "Kartuzy" }}selected{{ end }} value="Kartuzy">Kartuzy</option>
|
||||
<option {{ if eq .Location "Somonino" }}selected{{ end }} value="Somonino">Somonino</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Data dostawy
|
||||
<input type="date" name="date" value="{{.Date.Format "2006-01-02"}}">
|
||||
</label>
|
||||
<label>Status
|
||||
<select name="status">
|
||||
<option {{ if eq .Status "accepted" }}selected{{ end }} value="accepted">accepted</option>
|
||||
<option {{ if eq .Status "done" }}selected{{ end }} value="done">done</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Zaliczka
|
||||
<input type="number" name="paid" min="0" value="{{.Paid}}">
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Dodane Ciasta</h2>
|
||||
<div class="scrollable">
|
||||
<table id="basket_table" >
|
||||
</table>
|
||||
</div>
|
||||
<ul id="basket" class="scrollable">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>
|
||||
<small>Total:</small><br>
|
||||
<p id="total-price">100PLN</p>
|
||||
</label>
|
||||
<button type="submit">Zapisz</button>
|
||||
<div>
|
||||
<h2>Dane zamówienia</h2>
|
||||
<input hidden="hidden" name="id" value="{{.ID}}">
|
||||
<label>Imię
|
||||
<input type="text" name="name" value="{{.Name}}">
|
||||
</label>
|
||||
<label>Nazwisko
|
||||
<input type="text" name="surname" value="{{.Surname}}">
|
||||
</label>
|
||||
<label>Numer telefonu
|
||||
<input type="tel" name="phone" value="{{.Phone}}">
|
||||
</label>
|
||||
<label>Lokalizacja
|
||||
<select name="location">
|
||||
<option {{ if eq .Location "Kartuzy" }}selected{{ end }} value="Kartuzy">Kartuzy</option>
|
||||
<option {{ if eq .Location "Somonino" }}selected{{ end }} value="Somonino">Somonino</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Data dostawy
|
||||
<input type="date" name="date" value="{{.Date.Format "2006-01-02"}}">
|
||||
</label>
|
||||
<label>Status
|
||||
<select name="status">
|
||||
<option {{ if eq .Status "accepted" }}selected{{ end }} value="accepted">accepted</option>
|
||||
<option {{ if eq .Status "done" }}selected{{ end }} value="done">done</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Zaliczka
|
||||
<input type="number" name="paid" min="0" value="{{.Paid}}">
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Dodane ciasta</h2>
|
||||
<div class="scrollable" style="flex:1">
|
||||
<table id="basket_table">
|
||||
</table>
|
||||
</div>
|
||||
<ul id="basket" class="scrollable">
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Podsumowanie</h2>
|
||||
<label>
|
||||
<small>Do zapłaty:</small>
|
||||
<span id="total-price">100 PLN</span>
|
||||
</label>
|
||||
<button type="submit">Zapisz</button>
|
||||
</div>
|
||||
{{end}}
|
||||
{{with .Catalogue}}
|
||||
<div>
|
||||
<h2>Katalog</h2>
|
||||
<div class="scrollable">
|
||||
<table>
|
||||
{{range .}}
|
||||
<tr>
|
||||
<th>{{.Name}}<br><small>{{.Category}} (#{{.ID}})</small></th>
|
||||
<th>{{.Price}}PLN</th>
|
||||
<th>
|
||||
<button type=button onClick="addCake({{.ID}},{{.Name}}, {{.Price}}, 1)">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
</div>
|
||||
<div class="catalog-section">
|
||||
<h2>Katalog</h2>
|
||||
<div class="scrollable">
|
||||
<table>
|
||||
{{range .}}
|
||||
<tr>
|
||||
<th>{{.Name}}<br><small>{{.Category}} (#{{.ID}})</small></th>
|
||||
<th>{{.Price}} PLN</th>
|
||||
<th>
|
||||
<button type=button onClick="addCake({{.ID}},{{.Name}}, {{.Price}}, 1)">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</form>
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@ Zamówienia
|
|||
{{end}}
|
||||
{{define "main"}}
|
||||
<main>
|
||||
<div class="toolbar">
|
||||
<a href="/order" class="btn-primary">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
Nowe zamówienie
|
||||
</a>
|
||||
</div>
|
||||
<form class="search-container" hx-get="/orders/search" hx-target="#results-table"
|
||||
hx-trigger="keyup delay:500ms, change">
|
||||
<label>Data początkowa
|
||||
|
|
@ -16,15 +22,6 @@ Zamówienia
|
|||
{{template "orders-table" .Orders}}
|
||||
</div>
|
||||
</main>
|
||||
<style>
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #e6f2ff;
|
||||
}
|
||||
</style>
|
||||
{{end}}
|
||||
{{define "orders-table"}}
|
||||
<table id="orders_table">
|
||||
|
|
@ -46,9 +43,9 @@ Zamówienia
|
|||
<th>{{.Location}}</th>
|
||||
<th>{{.Date.Format "2006-01-02"}}</th>
|
||||
<th>{{.Total}} PLN</th>
|
||||
<th>{{.Status}}</th>
|
||||
<th><span class="status-badge status-{{.Status}}">{{.Status}}</span></th>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<tr class="hidden details-row">
|
||||
<td colspan="6" class="details-content">
|
||||
{{template "order_info" .}}
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue