iso7010print/templates/index.html

68 lines
1.9 KiB
HTML
Raw Normal View History

2023-08-16 18:30:07 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
body {
margin: 0 auto;
}
#things {
display: flex;
flex-flow: row wrap;
gap: 5px;
}
.thing {
width: 250px;
border: solid 2px;
}
</style>
</head>
<body>
2023-08-18 19:04:14 +01:00
<div>
<h1>ISO7010 Warning Stickers On Demand</h1>
<p>Brought to you by @samw@hacksrus.xyz. Label tape donations received with...</p>
<img src="/static/manythanks.png" height="100px">
</div>
2023-08-17 14:53:55 +01:00
{% for section, ws in ws.items() %}
<h2>{{ section }}</h2>
2023-08-16 18:30:07 +01:00
<div id="things">
{% for w in ws %}
2023-08-18 19:04:14 +01:00
<div class="thing" onclick="printme('{{w.name}}')">
2023-08-16 18:30:07 +01:00
<img src="{{ w.url }}" width="100%">
2023-08-18 19:04:14 +01:00
<div style="text-align: center; font-size: 20px;"> {{ w.name }} </div>
<button style="height: 30px; width: 100%">PRINT IT</button>
2023-08-16 18:30:07 +01:00
</div>
{% endfor %}
</div>
2023-08-17 14:53:55 +01:00
{% endfor %}
2023-08-18 19:04:14 +01:00
<script>
printing = false;
function printme(it) {
if (printing) {
return;
}
printing = true;
let formData = new FormData();
formData.append("w", it);
formData.append("count", 1);
for (e of document.getElementsByTagName("button")) {
e.disabled = true;
e.innerText = "printing....";
}
fetch("/", {
method: "POST",
body: new URLSearchParams(formData),
}).finally(() => {
for (e of document.getElementsByTagName("button")) {
e.disabled = false;
e.innerText = "PRINT IT";
}
printing = false;
})
}
</script>
2023-08-16 18:30:07 +01:00
</body>
</html>