Update templates/index.html
This commit is contained in:
@@ -2,17 +2,18 @@
|
|||||||
<html lang="it">
|
<html lang="it">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Calcolo Calcestruzzo</title>
|
<title>Calcolo Calcestruzzo v2.1</title>
|
||||||
<style>
|
<style>
|
||||||
body { font-family: sans-serif; padding: 20px; background: #f0f0f0; }
|
body { font-family: sans-serif; background-color: #f4f7f6; padding: 20px; }
|
||||||
.container { display: flex; gap: 20px; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
|
.container { display: flex; max-width: 900px; margin: auto; background: white; padding: 20px; border: 1px solid #ccc; gap: 20px; }
|
||||||
.input-panel { flex: 1; border-right: 1px solid #ccc; padding-right: 20px; }
|
.input-panel { flex: 1; }
|
||||||
.output-panel { flex: 1; padding-left: 20px; min-height: 400px; white-space: pre-wrap; }
|
.output-panel { flex: 1; border: 1px solid #999; padding: 15px; min-height: 350px; background: #fff; white-space: pre-wrap; }
|
||||||
table { width: 100%; }
|
table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
|
||||||
td { padding: 5px; }
|
td { padding: 4px; vertical-align: middle; }
|
||||||
input, select { padding: 5px; width: 100%; box-sizing: border-box; }
|
input, select { padding: 4px; border: 1px solid #ccc; width: 100%; box-sizing: border-box; }
|
||||||
.btn-container { margin-top: 20px; display: flex; gap: 10px; }
|
.btn-calc { margin-top: 15px; padding: 10px; width: 100%; cursor: pointer; background: #eee; border: 1px solid #999; }
|
||||||
button { padding: 15px; cursor: pointer; flex: 1; }
|
.btn-action { padding: 8px; cursor: pointer; background: #f9f9f9; border: 1px solid #ccc; flex: 1; }
|
||||||
|
hr { border: 0; border-top: 1px solid #ccc; margin: 15px 0; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -21,52 +22,66 @@
|
|||||||
<form method="POST">
|
<form method="POST">
|
||||||
<table>
|
<table>
|
||||||
<tr><td>Larghezza</td><td><input type="text" name="l" value="{{form.get('l','1')}}"></td><td><select name="ul"><option value="m">m</option></select></td></tr>
|
<tr><td>Larghezza</td><td><input type="text" name="l" value="{{form.get('l','1')}}"></td><td><select name="ul"><option value="m">m</option></select></td></tr>
|
||||||
<tr><td>Profondità</td><td><input type="text" name="p" value="{{form.get('p','20')}}"></td><td><select name="up"><option value="cm">cm</option></select></td></tr>
|
<tr><td>Profondità</td><td><input type="text" name="p" value="{{form.get('p','1')}}"></td><td><select name="up"><option value="m">m</option></select></td></tr>
|
||||||
<tr><td>Altezza</td><td><input type="text" name="a" value="{{form.get('a','500')}}"></td><td><select name="ua"><option value="mm">mm</option></select></td></tr>
|
<tr><td>Altezza</td><td><input type="text" name="a" value="{{form.get('a','1')}}"></td><td><select name="ua"><option value="m">m</option></select></td></tr>
|
||||||
<tr><td colspan="3"><hr></td></tr>
|
|
||||||
<tr><td>Parte Cemento</td><td colspan="2"><input type="text" name="p_cem" value="{{form.get('p_cem','1')}}"></td></tr>
|
|
||||||
<tr><td>Parte Sabbia</td><td colspan="2"><input type="text" name="p_sab" value="{{form.get('p_sab','3')}}"></td></tr>
|
|
||||||
<tr><td>Parte Ghiaia</td><td colspan="2"><input type="text" name="p_ghi" value="{{form.get('p_ghi','5')}}"></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
<button type="submit" style="background:#e1f5fe;">Calcola</button>
|
<hr>
|
||||||
|
<table>
|
||||||
|
<tr><td>Parte Cemento</td><td><input type="text" name="p_cem" value="{{form.get('p_cem','1')}}"></td></tr>
|
||||||
|
<tr><td>Parte Sabbia</td><td><input type="text" name="p_sab" value="{{form.get('p_sab','3')}}"></td></tr>
|
||||||
|
<tr><td>Parte Ghiaia</td><td><input type="text" name="p_ghi" value="{{form.get('p_ghi','5')}}"></td></tr>
|
||||||
|
</table>
|
||||||
|
<hr>
|
||||||
|
<table>
|
||||||
|
<tr><td>Peso Cemento (kg)</td><td><input type="text" name="w_cem" value="{{form.get('w_cem','25')}}"></td></tr>
|
||||||
|
<tr><td>Peso Sabbia (kg)</td><td><input type="text" name="w_sab" value="{{form.get('w_sab','25')}}"></td></tr>
|
||||||
|
<tr><td>Peso Ghiaia (kg)</td><td><input type="text" name="w_ghi" value="{{form.get('w_ghi','25')}}"></td></tr>
|
||||||
|
</table>
|
||||||
|
<button type="submit" class="btn-calc">Calcola</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="output-panel">
|
<div class="output-panel">
|
||||||
<h3>Risultati del Calcolo:</h3>
|
<strong>Risultati del Calcolo:</strong>
|
||||||
{% if res %}
|
{% if res %}
|
||||||
--- Dettagli Gettata ---
|
--- Dettagli Gettata ---
|
||||||
Volume totale: {{ res.vol }} m3
|
Volume totale: {{ res.vol }} m3
|
||||||
Peso stimato: {{ res.peso }} kg
|
Peso stimato: {{ res.peso }} kg
|
||||||
|
|
||||||
--- Totale Materiali ---
|
--- Totale Materiali ---
|
||||||
Cemento: {{ res.s_cem }} sacchetti
|
Cemento: {{ res.s_cem }} sacchetti
|
||||||
Sabbia: {{ res.s_sab }} sacchetti
|
Sabbia: {{ res.s_sab }} sacchetti
|
||||||
Ghiaia: {{ res.s_ghi }} sacchetti
|
Ghiaia: {{ res.s_ghi }} sacchetti
|
||||||
|
<strong>TOTALE: {{ res.tot_sacc }} sacchetti</strong>
|
||||||
<div class="btn-container">
|
|
||||||
<form action="/download" method="POST" style="flex:1;">
|
<div style="display:flex; gap:10px; margin-top:20px;">
|
||||||
<input type="hidden" name="res_vol" value="{{res.vol}}">
|
<form action="/download" method="POST" style="flex:1; display:flex;">
|
||||||
<input type="hidden" name="res_tot_s" value="{{res.tot_sacc}}">
|
<input type="hidden" name="res_vol" value="{{res.vol}}">
|
||||||
<button type="submit">Stampa TXT</button>
|
<input type="hidden" name="res_tot_s" value="{{res.tot_sacc}}">
|
||||||
</form>
|
<button type="submit" class="btn-action">Stampa TXT</button>
|
||||||
<button type="button" onclick="stampaCups()" style="flex:1; background:#fff3e0;">Stampa PDF (CUPS)</button>
|
</form>
|
||||||
</div>
|
<button type="button" onclick="stampaCups()" class="btn-action" style="background:#fff3e0;">Stampa PDF (CUPS)</button>
|
||||||
<div id="status" style="margin-top:10px; font-weight:bold;"></div>
|
</div>
|
||||||
{% endif %}
|
<div id="status" style="margin-top:10px; font-size:12px; font-weight:bold; text-align:center;"></div>
|
||||||
|
{% else %}
|
||||||
|
<p style="color:#999; text-align:center; margin-top:50px;">Premi "Calcola" per i risultati.</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function stampaCups() {
|
function stampaCups() {
|
||||||
const s = document.getElementById('status');
|
const s = document.getElementById('status');
|
||||||
s.innerText = "Invio al NAS...";
|
s.innerText = "Invio alla stampante...";
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('res_vol', '{{res.vol if res else ""}}');
|
fd.append('res_vol', '{{res.vol if res else ""}}');
|
||||||
fd.append('res_tot_s', '{{res.tot_sacc if res else ""}}');
|
fd.append('res_tot_s', '{{res.tot_sacc if res else ""}}');
|
||||||
|
|
||||||
fetch('/stampa_pdf', { method: 'POST', body: fd })
|
fetch('/stampa_pdf', { method: 'POST', body: fd })
|
||||||
.then(r => r.text()).then(m => { s.innerText = m; });
|
.then(r => r.text()).then(m => {
|
||||||
|
s.innerText = m;
|
||||||
|
s.style.color = m.includes("OK") ? "green" : "red";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user