removed 'internal' directory
This commit is contained in:
parent
8c200a5a6c
commit
65709049d7
42 changed files with 35 additions and 44 deletions
36
server/templates/cake.gohtml
Normal file
36
server/templates/cake.gohtml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{{define "title"}}
|
||||
Cake {{.ID}}
|
||||
{{end}}
|
||||
{{define "main"}}
|
||||
<main>
|
||||
<form method="post">
|
||||
<div>
|
||||
<h2>Info</h2>
|
||||
<label>
|
||||
<input hidden="hidden" name="id" value="{{.ID}}">
|
||||
</label>
|
||||
<label>name</label>
|
||||
<label>
|
||||
<input type="text" name="name" value="{{.Name}}">
|
||||
</label>
|
||||
<label>price</label>
|
||||
<label>
|
||||
<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>
|
||||
</div>
|
||||
<button type="submit">submit</button>
|
||||
</form>
|
||||
</main>
|
||||
{{end}}
|
||||
25
server/templates/cakes.gohtml
Normal file
25
server/templates/cakes.gohtml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{{define "title"}}
|
||||
Cakes
|
||||
{{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>
|
||||
</main>
|
||||
{{end}}
|
||||
8
server/templates/confirmation.gohtml
Normal file
8
server/templates/confirmation.gohtml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{{define "title"}}
|
||||
Confirmed
|
||||
{{end}}
|
||||
{{define "main"}}
|
||||
<main>
|
||||
<h2>{{.ID}} confirmed</h2>
|
||||
</main>
|
||||
{{end}}
|
||||
28
server/templates/layout/layout.gohtml
Normal file
28
server/templates/layout/layout.gohtml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{{define "layout"}}
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{{template "title" .}}</title>
|
||||
<script src="/static/htmx2.04.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">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<aside>
|
||||
<nav>{{template "nav" .}}</nav>
|
||||
</aside>
|
||||
<div class="app-body">
|
||||
<header>
|
||||
<h1>{{template "title" .}}</h1>
|
||||
</header>
|
||||
{{template "main" .}}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
{{end}}
|
||||
7
server/templates/layout/nav.gohtml
Normal file
7
server/templates/layout/nav.gohtml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{{define "nav"}}
|
||||
<a href="/orders" data-title="Zamówienia"><i class="fa-solid fa-list-ul"></i></a>
|
||||
<a href="/order" data-title="Nowe zamówienie"><i class="fa-solid fa-plus-circle"></i></a>
|
||||
<a href="/cakes" data-title="Wszystkie ciasta"><i class="fa-solid fa-birthday-cake"></i></a>
|
||||
<a href="/cake" data-title="Nowe ciasto"><i class="fa-solid fa-plus"></i></a>
|
||||
<a href="/logout" data-title="Wyloguj"><i class="fa-solid fa-sign-out-alt"></i></a>
|
||||
{{end}}
|
||||
109
server/templates/order.gohtml
Normal file
109
server/templates/order.gohtml
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
{{define "title"}}
|
||||
{{if .Order.ID}}
|
||||
Edytuj zamówienie #{{.Order.ID}}
|
||||
{{else}}
|
||||
Nowe zamówienie
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{define "main"}}
|
||||
<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>
|
||||
</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>
|
||||
{{end}}
|
||||
</form>
|
||||
</main>
|
||||
<template id="basket_element_template">
|
||||
<tr>
|
||||
<th class="cake-name">Name</th>
|
||||
<th class="cake-price">Price</th>
|
||||
<th>
|
||||
<label>
|
||||
<input type="number" min="0">
|
||||
</label>
|
||||
</th>
|
||||
<th class="cake-total">Total</th>
|
||||
<th>
|
||||
<button type=button>
|
||||
<i class="fa-solid fa-minus"></i>
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
</template>
|
||||
<script>
|
||||
{{range .Order.Cakes}}
|
||||
addCake({{.ID}},{{.Name}}, {{.Price}}, {{.Amount}})
|
||||
{{end}}
|
||||
</script>
|
||||
{{end}}
|
||||
74
server/templates/orders.gohtml
Normal file
74
server/templates/orders.gohtml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{{define "title"}}
|
||||
Zamówienia
|
||||
{{end}}
|
||||
{{define "main"}}
|
||||
<main>
|
||||
<form class="search-container" hx-get="/orders/search" hx-target="#results-table"
|
||||
hx-trigger="keyup delay:500ms, change">
|
||||
<label class="search-box">
|
||||
<input type="search" name="q" placeholder="Wyszukaj po numerze zamówienia">
|
||||
</label>
|
||||
<label>Data początkowa
|
||||
<input type="date" value="{{.First}}" name="from">
|
||||
</label>
|
||||
<label>Data końcowa
|
||||
<input type="date" value="{{.Last}}" name="to">
|
||||
</label>
|
||||
</form>
|
||||
<div id="results-table" class="scrollable">
|
||||
{{template "orders-table" .Orders}}
|
||||
</div>
|
||||
</main>
|
||||
<style>
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #e6f2ff;
|
||||
}
|
||||
</style>
|
||||
{{end}}
|
||||
{{define "orders-table"}}
|
||||
<table id="orders_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Numer zamówienia</th>
|
||||
<th>Klient</th>
|
||||
<th>Lokalizacja</th>
|
||||
<th>Data zamówienia</th>
|
||||
<th>Pozostało do zapłaty</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .}}
|
||||
<tr class="clickable" onclick="toggleDetails(this)">
|
||||
<th><a href="/order/{{.ID}}">#{{.ID}}</a></th>
|
||||
<th>{{.Surname}} {{.Name}} {{.Phone}}</th>
|
||||
<th>{{.Location}}</th>
|
||||
<th>{{.Date.Format "2006-01-02"}}</th>
|
||||
<th>{{.Total}} PLN</th>
|
||||
<th>{{.Status}}</th>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td colspan="6" class="details-content">
|
||||
{{template "order_info" .}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
{{define "order_info"}}
|
||||
<table>
|
||||
{{range .Cakes}}
|
||||
<tr>
|
||||
<th>{{.Name}}<br><small>ID: {{.ID}}</small></th>
|
||||
<th><small>Cena:</small><br>{{.Price}} PLN</th>
|
||||
<th><small>Ilość:</small><br>{{.Amount}}</th>
|
||||
<th><small>Razem:</small><br>{{.Total}} PLN</th>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
{{end}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue