moved to gorm
This commit is contained in:
parent
66884c64bb
commit
a074f264df
30 changed files with 247 additions and 1040 deletions
|
|
@ -17,18 +17,6 @@ Cake {{.ID}}
|
|||
<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>
|
||||
|
|
|
|||
|
|
@ -8,16 +8,12 @@ Cakes
|
|||
<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>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,11 @@
|
|||
</select>
|
||||
</label>
|
||||
<label>Data dostawy
|
||||
<input type="date" name="date" value="{{.Date.Format "2006-01-02"}}">
|
||||
{{if .ID}}
|
||||
<input type="date" name="date" value="{{.Date.Format "2006-01-02"}}" required>
|
||||
{{else}}
|
||||
<input type="date" name="date" required>
|
||||
{{end}}
|
||||
</label>
|
||||
<label>Status
|
||||
<select name="status">
|
||||
|
|
@ -40,7 +44,7 @@
|
|||
</select>
|
||||
</label>
|
||||
<label>Zaliczka
|
||||
<input type="number" name="paid" min="0" value="{{.Paid}}">
|
||||
<input type="number" name="paid" min="0" value="{{.Prepaid}}">
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -52,7 +56,7 @@
|
|||
<ul id="basket" class="scrollable">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<label>
|
||||
<small>Total:</small><br>
|
||||
|
|
@ -69,7 +73,7 @@
|
|||
<table>
|
||||
{{range .}}
|
||||
<tr>
|
||||
<th>{{.Name}}<br><small>{{.Category}} (#{{.ID}})</small></th>
|
||||
<th>{{.Name}}<br><small>#{{.ID}}</small></th>
|
||||
<th>{{.Price}}PLN</th>
|
||||
<th>
|
||||
<button type=button onClick="addCake({{.ID}},{{.Name}}, {{.Price}}, 1)">
|
||||
|
|
@ -102,8 +106,8 @@
|
|||
</tr>
|
||||
</template>
|
||||
<script>
|
||||
{{range .Order.Cakes}}
|
||||
addCake({{.ID}},{{.Name}}, {{.Price}}, {{.Amount}})
|
||||
{{range .Order.OrderItems}}
|
||||
addCake({{.ProductID}},{{.Product.Name}}, {{.Product.Price}}, {{.Amount}})
|
||||
{{end}}
|
||||
</script>
|
||||
{{end}}
|
||||
|
|
|
|||
|
|
@ -59,10 +59,10 @@ Zamówienia
|
|||
{{end}}
|
||||
{{define "order_info"}}
|
||||
<table>
|
||||
{{range .Cakes}}
|
||||
{{range .OrderItems}}
|
||||
<tr>
|
||||
<th>{{.Name}}<br><small>ID: {{.ID}}</small></th>
|
||||
<th><small>Cena:</small><br>{{.Price}} PLN</th>
|
||||
<th>{{.Product.Name}}<br><small>ID: {{.ProductID}}</small></th>
|
||||
<th><small>Cena:</small><br>{{.Product.Price}} PLN</th>
|
||||
<th><small>Ilość:</small><br>{{.Amount}}</th>
|
||||
<th><small>Razem:</small><br>{{.Total}} PLN</th>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue