changed basket to a table

This commit is contained in:
bronku 2025-04-06 22:37:02 +02:00
parent 8ec446ea28
commit 923b575bc1
4 changed files with 34 additions and 45 deletions

View file

@ -6,7 +6,7 @@
<meta charset="UTF-8" />
<title>{{template "title" .}}</title>
<script src="/static/htmx2.04.js" defer></script>
<script src="/static/order.js" defer></script>
<script src="/static/order.js" ></script>
<link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="/static/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="/static/fontawesome/css/solid.css">

View file

@ -62,10 +62,10 @@
<table>
{{range .}}
<tr>
<th>{{.Name}}<br><small>{{.Category}}</small></th>
<th>{{.Name}}<br><small>{{.Category}} (#{{.ID}})</small></th>
<th>{{.Price}}PLN</th>
<th>
<button type=button onClick="addCake({{.ID}},'{{.Name}} ({{.Price}}PLN)', 1)">
<button type=button onClick="addCake({{.ID}},{{.Name}}, {{.Price}}, 1)">
<i class="fa-solid fa-plus"></i>
</button>
</th>
@ -79,14 +79,16 @@
</main>
<template id="basket_element_template">
<tr>
<th>Name</th>
<th class="cake-name">Name</th>
<th class="cake-price">Price</th>
<th>
<label>
<input type="text">
<input type="number" min="0">
</label>
</th>
<th class="cake-total">Total</th>
<th>
<button type=button onClick="">
<button type=button>
<i class="fa-solid fa-minus"></i>
</button>
</th>
@ -94,7 +96,7 @@
</template>
<script>
{{range .Order.Cakes}}
addCake({{.ID}},'{{.Name}} ({{.Price}}PLN)', {{.Amount}})
addCake({{.ID}},{{.Name}}, {{.Price}}, {{.Amount}})
{{end}}
</script>
{{end}}

View file

@ -28,16 +28,6 @@ Zamówienia
background-color: #e6f2ff;
}
</style>
<script>
function toggleDetails(row) {
const detailsRow=row.nextElementSibling;
if(detailsRow.classList.contains('hidden')) {
detailsRow.classList.remove('hidden');
return;
}
detailsRow.classList.add('hidden');
}
</script>
{{end}}
{{define "orders-table"}}
<table id="orders_table">