Files
scrapeje/template.html

76 lines
2.4 KiB
HTML
Raw Normal View History

2023-12-04 00:39:18 +01:00
<html>
2023-12-11 22:35:16 +01:00
<head>
<!-- <link rel="stylesheet" type="text/css" href="main.css" /> -->
<style>
.container {
display: grid;
grid-template-columns: auto auto auto;
padding: 10px;
}
.grid-item {
/* background-color: rgba(255, 255, 255, 0.8); */
border: 1px solid #ff8d1a;
padding: 20px;
/* font-size: 30px; */
text-align: center;
/* grid-column-start: 1;
grid-column-end: 3; */
}
</style>
2023-12-04 00:39:18 +01:00
<body style="background-color: black; color: white">
2023-12-05 00:20:15 +01:00
<h1 style='text-align: center; color: #ff8d1a'>{{ nrist }} </h1>
<!-- <form id="usernameForm">
<input type="text" id="prodottiAggiunti" placeholder="Enter your username" />
2023-12-11 22:35:16 +01:00
<button type="button" onclick="addUser()">Add User</button>
</form> -->
</head>
2023-12-05 00:20:15 +01:00
<br><br>
2023-12-04 00:39:18 +01:00
2023-12-11 22:35:16 +01:00
<div class="container">
2023-12-04 00:39:18 +01:00
{% for index in range(nome|length) %}
2023-12-11 22:35:16 +01:00
<div class="grid-item">
2023-12-04 00:39:18 +01:00
<h2 style='text-align: center;'>{{ nome[index] }}</h2>
2023-12-11 22:35:16 +01:00
<div class="spazio">
<p style='text-align: center;'>{{ desc[index] }}</p>
</div>
2023-12-04 00:39:18 +01:00
<p style='text-align: center;'>Npezzi: {{ npezzi[index] }}</p>
<p style='text-align: center;'>{{ prezzoN[index] }}€</p>
<div style='text-align: center;'><button style='font-size: 1.2em;' onclick="aggiungiProdotto('{{ nome[index] }}', '{{ prezzoN[index] }}')">+1</button></div>
2023-12-11 22:35:16 +01:00
</div>
2023-12-04 00:39:18 +01:00
{% endfor %}
2023-12-11 22:35:16 +01:00
</div>
2023-12-04 00:39:18 +01:00
<br><hr><h2>Prodotti aggiunti</h2>
<div id="prodottiAggiunti"></div>
<div id="total">Total: €<span id="totalValue">0.00</span></div>
<script>
var totalValue = 0;
function aggiungiProdotto(nome, prezzoN) {
var prodotto = nome + ' (' + Number(prezzoN).toFixed(2) + '€)';
var box = document.getElementById('prodottiAggiunti');
box.innerHTML += '<p>' + prodotto + ' <button onclick="rimuoviProdotto(this, ' + prezzoN + ')">-1</button></p>';
totalValue += parseFloat(prezzoN);
updateTotal();
}
function updateTotal() {
document.getElementById('totalValue').innerText = totalValue.toFixed(2);
}
function rimuoviProdotto(element, prezzoN) {
totalValue -= parseFloat(prezzoN);
element.parentNode.remove();
updateTotal();
}
</script>
2023-12-05 00:20:15 +01:00
2023-12-04 00:39:18 +01:00
</body>
</html>