diff --git a/css/swieta.css b/css/swieta.css index 6ddc167..947a259 100644 --- a/css/swieta.css +++ b/css/swieta.css @@ -178,7 +178,7 @@ background-color: transparent; border: none; text-align: center; - width: 2rem; + width: 3rem; appearance: textfield; -moz-appearance: textfield; &::-webkit-inner-spin-button, diff --git a/data/swieta.go b/data/swieta.go index 1a47165..d09cf84 100644 --- a/data/swieta.go +++ b/data/swieta.go @@ -3,14 +3,14 @@ package data import "piekarnikgosipl/types" var Swieta = []types.Product{ - {Name: "Malinowa Chmurka", Image: "", Price: "150", Description: "", Id: "001"}, - {Name: "Makosernik", Image: "", Price: "150", Description: "", Id: "002"}, - {Name: "Rolada Makowa", Image: "", Price: "100", Description: "", Id: "003"}, - {Name: "Wieniec Bezowy", Image: "", Price: "150", Description: "⌀ 25cm", Id: "004"}, - {Name: "Torcik Piernikowy z kremem Cynamonowym", Image: "", Price: "120", Description: "⌀ 18cm", Id: "005"}, - {Name: "Sernik Ulubiony", Image: "", Price: "75", Description: "⌀ 21cm", Id: "006"}, - {Name: "Sernik Lotus", Image: "", Price: "100", Description: "⌀ 22cm", Id: "007"}, - {Name: "Sernik Mango-Jogurt", Image: "", Price: "120", Description: "⌀ 22cm", Id: "008"}, + {Name: "Malinowa Chmurka", Image: "", Price: "150", Description: "", Id: "001", Halveable: true}, + {Name: "Makosernik", Image: "", Price: "150", Description: "", Id: "002", Halveable: true}, + {Name: "Rolada Makowa", Image: "", Price: "100", Description: "", Id: "003", Halveable: true}, + {Name: "Wieniec Bezowy", Image: "", Price: "150", Description: "⌀ 25cm", Id: "004", Halveable: true}, + {Name: "Torcik Piernikowy z kremem Cynamonowym", Image: "", Price: "120", Description: "⌀ 18cm", Id: "005", Halveable: true}, + {Name: "Sernik Ulubiony", Image: "", Price: "75", Description: "⌀ 21cm", Id: "006", Halveable: true}, + {Name: "Sernik Lotus", Image: "", Price: "100", Description: "⌀ 22cm", Id: "007", Halveable: true}, + {Name: "Sernik Mango-Jogurt", Image: "", Price: "120", Description: "⌀ 22cm", Id: "008", Halveable: true}, {Name: "Mini Pavlova", Image: "", Price: "12", Description: "", Id: "009"}, {Name: "Box Świąteczny", Image: "", Price: "150", Description: "¼ Sernik Cynamonowy\n¼ Sernik Nowojorski\n¼ Kostka Piernikowa z kremem Malaga i Powidłami\n¼ Kostka Świętego Mikołaja", Id: "010"}, } diff --git a/html/swieta.templ b/html/swieta.templ index e083f04..82ac8ea 100644 --- a/html/swieta.templ +++ b/html/swieta.templ @@ -2,11 +2,17 @@ package html import "piekarnikgosipl/types" +func step(in types.Product ) string { + if in.Halveable { + return "0.5" + } + return "1" +} templ product_form(product types.Product) {
{product.Name} · {product.Price} zł - +
} @@ -47,14 +53,14 @@ templ Swieta(products []types.Product) {

Złóż zamówienie

Odbiór wszystkich zamówień: 24 grudnia. Zamówienia przyjmujemy do 15 grudnia. Potwierdzimy zamówienie telefonicznie.

-
+
for _, product := range products { @product_form(product) }
- - + +
diff --git a/js/order.js b/js/order.js index 69a2aee..0d93940 100644 --- a/js/order.js +++ b/js/order.js @@ -6,9 +6,11 @@ function min(a, b) { } function increase(id) { input = document.getElementById(id) - input.value= min(parseInt(input.value)+1, 0) + step = parseFloat(input.step) + input.value= min(parseFloat(input.value)+step, 0) } function decrease(id) { input = document.getElementById(id) - input.value= min(parseInt(input.value)-1, 0) + step = parseFloat(input.step) + input.value= min(parseFloat(input.value)-step, 0) } diff --git a/types/product.go b/types/product.go index 4e7edf4..664eadd 100644 --- a/types/product.go +++ b/types/product.go @@ -6,4 +6,5 @@ type Product struct { Price string Description string Id string + Halveable bool }