Update templates/index.html

This commit is contained in:
2026-01-20 09:30:42 +01:00
parent ae0294f774
commit 3b2fbba025

View File

@@ -6,18 +6,17 @@
<title>Software Cemento {{ rev }}</title>
<style>
:root { --mac-bg: #f2f2f7; --mac-blue: #007aff; --mac-red: #ff3b30; --mac-green: #34c759; }
body { font-family: -apple-system, sans-serif; background: var(--mac-bg); padding: 20px; color: #1c1c1e; }
body { font-family: -apple-system, system-ui, sans-serif; background: var(--mac-bg); padding: 20px; font-size: 14px; color: #1c1c1e; }
.container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; max-width: 1200px; margin: auto; }
.panel { background: rgba(255,255,255,0.8); backdrop-filter: blur(10px); border-radius: 12px; padding: 20px; flex: 1; min-width: 320px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; margin-bottom: 15px; background: white; border-radius: 8px; overflow: hidden; }
th { padding: 10px; font-size: 14px; color: white; text-transform: uppercase; }
td { padding: 8px; text-align: center; border: 1px solid #e5e5ea; }
td { padding: 8px; text-align: center; border: 1px solid #e5e5ea; font-size: 14px; }
.h-blue { background: var(--mac-blue); } .h-red { background: var(--mac-red); }
input, select { width: 90%; border: 1px solid #d1d1d6; border-radius: 5px; padding: 6px; text-align: center; }
.btn { width: 100%; padding: 12px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; font-size: 15px; color: white; text-transform: uppercase; margin-top: 10px; }
input { width: 100%; border: 1px solid #d1d1d6; border-radius: 5px; padding: 6px 5px; text-align: center; box-sizing: border-box; }
.btn { width: 100%; padding: 12px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; margin-top: 10px; color: white; text-transform: uppercase; }
.btn-calc { background: var(--mac-green); } .btn-exp { background: #5856d6; }
.res-box { background: white; padding: 15px; border-radius: 10px; border: 1px solid #d1d1d6; line-height: 1.6; }
.rev-tag { font-size: 11px; color: var(--mac-red); font-weight: bold; }
@media print { .no-print { display: none !important; } }
</style>
</head>
@@ -27,54 +26,38 @@
<form method="POST">
<table>
<tr class="h-blue"><th colspan="3">Dimensioni Totali</th></tr>
{% for n, k in [('Altezza','a'),('Larghezza','l'),('Profondità','p')] %}
<tr>
<td>{{n}}</td>
<td><input type="text" name="{{k}}" value="{{form.get(k,'0')}}"></td>
<td><select name="u{{k}}">{% for u in ['m','cm','mm'] %}<option value="{{u}}" {% if form.get('u'+k,'m')==u %}selected{% endif %}>{{u}}</option>{% endfor %}</select></td>
</tr>
{% endfor %}
<tr><td>Altezza</td><td><input type="text" name="a" value="{{form.get('a','0')}}"></td><td><select name="ua">{% for u in ['m','cm','mm'] %}<option value="{{u}}" {% if form.get('ua','m')==u %}selected{% endif %}>{{u}}</option>{% endfor %}</select></td></tr>
<tr><td>Larghezza</td><td><input type="text" name="l" value="{{form.get('l','0')}}"></td><td><select name="ul">{% for u in ['m','cm','mm'] %}<option value="{{u}}" {% if form.get('ul','m')==u %}selected{% endif %}>{{u}}</option>{% endfor %}</select></td></tr>
<tr><td>Profondità</td><td><input type="text" name="p" value="{{form.get('p','0')}}"></td><td><select name="up">{% for u in ['m','cm','mm'] %}<option value="{{u}}" {% if form.get('up','m')==u %}selected{% endif %}>{{u}}</option>{% endfor %}</select></td></tr>
</table>
<table>
<tr class="h-red"><th colspan="3">Miscela (Parti) / Pesi (Kg) / Costi (€)</th></tr>
<tr><td>CEM <input type="text" name="p_cem" value="{{form.get('p_cem','1')}}"></td><td>SAB <input type="text" name="p_sab" value="{{form.get('p_sab','3')}}"></td><td>GHI <input type="text" name="p_ghi" value="{{form.get('p_ghi','5')}}"></td></tr>
<tr><td>Kg/S <input type="text" name="w_cem" value="{{form.get('w_cem','25')}}"></td><td>Kg/S <input type="text" name="w_sab" value="{{form.get('w_sab','25')}}"></td><td>Kg/S <input type="text" name="w_ghi" value="{{form.get('w_ghi','25')}}"></td></tr>
<tr><td>/S <input type="text" name="c_cem" value="{{form.get('c_cem','0')}}"></td><td>/S <input type="text" name="c_sab" value="{{form.get('c_sab','0')}}"></td><td>/S <input type="text" name="c_ghi" value="{{form.get('c_ghi','0')}}"></td></tr>
<tr class="h-red"><th colspan="3">Miscela (Parti) / Peso e Costo</th></tr>
<tr><td>Cem: <input type="text" name="p_cem" value="{{form.get('p_cem','1')}}"></td><td>Sab: <input type="text" name="p_sab" value="{{form.get('p_sab','3')}}"></td><td>Ghi: <input type="text" name="p_ghi" value="{{form.get('p_ghi','5')}}"></td></tr>
<tr><td>Kg: <input type="text" name="w_cem" value="{{form.get('w_cem','25')}}"></td><td>Kg: <input type="text" name="w_sab" value="{{form.get('w_sab','25')}}"></td><td>Kg: <input type="text" name="w_ghi" value="{{form.get('w_ghi','25')}}"></td></tr>
<tr><td>: <input type="text" name="c_cem" value="{{form.get('c_cem','1')}}"></td><td>: <input type="text" name="c_sab" value="{{form.get('c_sab','1')}}"></td><td>: <input type="text" name="c_ghi" value="{{form.get('c_ghi','1')}}"></td></tr>
</table>
<p>Volume Betoniera (L): <input type="text" name="v_bet" value="{{form.get('v_bet','140')}}" style="width:60px;"></p>
<p>Betoniera (L): <input type="text" name="v_bet" value="{{form.get('v_bet','160')}}" style="width:60px;"></p>
<button type="submit" class="btn btn-calc">Esegui Calcolo</button>
</form>
</div>
<div class="panel">
<div style="display:flex; justify-content:space-between; align-items:baseline;">
<h3>Risultati</h3><span class="rev-tag">{{ rev }}</span>
</div>
<h3>Risultati</h3>
{% if res %}
<div class="res-box">
<b>Volume:</b> {{ res.vol }} m³ | <b>Peso:</b> {{ res.peso }} Kg<br>
<hr>
<b>Cemento:</b> {{ res.s_cem }} sacchi | <b>Sabbia:</b> {{ res.s_sab }} sacchi | <b>Ghiaia:</b> {{ res.s_ghi }} sacchi<br>
<b>Acqua:</b> {{ res.acqua }} L | <b style="color:var(--mac-blue);">Totale: {{ res.costo_tot }} €</b>
<hr>
<b>Ogni carico ({{ res.n_c }} cicli):</b><br>
• Cem: {{ res.bc_cem }} | Sab: {{ res.bc_sab }} | Ghi: {{ res.bc_ghi }} sacchi
<b>Vol:</b> {{ res.vol }} m³ | <b>Peso:</b> {{ res.peso }} Kg<br>
<b>Materiali:</b> Cem: {{res.s_cem}} | Sab: {{res.s_sab}} | Ghi: {{res.s_ghi}} sacchetti<br>
<b style="color:var(--mac-blue);">Totale: {{ res.costo_tot }} €</b>
</div>
<form action="/download" method="POST" class="no-print">
<input type="hidden" name="res_vol" value="{{res.vol}}"><input type="hidden" name="res_tot_s" value="{{res.tot_sacc}}">
<input type="hidden" name="res_peso" value="{{res.peso}}"><input type="hidden" name="res_aq" value="{{res.acqua}}">
<input type="hidden" name="res_costo_t" value="{{res.costo_tot}}"><input type="hidden" name="res_nc" value="{{res.n_c}}">
<input type="hidden" name="res_bc_cem" value="{{res.bc_cem}}"><input type="hidden" name="res_bc_sab" value="{{res.bc_sab}}"><input type="hidden" name="res_bc_ghi" value="{{res.bc_ghi}}"><input type="hidden" name="res_bc_aq" value="{{res.bc_aq}}">
<div style="display:flex; gap:10px;">
<button type="submit" class="btn btn-exp" style="flex:1;">TXT</button>
<button type="button" onclick="stampaCups()" class="btn" style="flex:1; background:#ff9500;">STAMPA PDF (CUPS)</button>
</div>
<input type="hidden" name="res_vol" value="{{res.vol}}"><input type="hidden" name="res_costo_t" value="{{res.costo_tot}}">
<button type="submit" class="btn btn-exp">Esporta Report TXT</button>
<button type="button" onclick="stampaCups()" class="btn" style="background:#ff9500;">Stampa PDF (CUPS)</button>
</form>
<div id="status" style="text-align:center; font-size:12px; margin-top:5px;"></div>
{% else %}
<p style="color:#8e8e93; text-align:center; margin-top:40px;">Premi <b>"Esegui Calcolo"</b>.</p>
<p style="text-align:center; color:#8e8e93;">Inserisci i dati e calcola.</p>
{% endif %}
</div>
</div>
@@ -82,11 +65,10 @@
<script>
function stampaCups() {
const s = document.getElementById('status');
s.innerText = "Inviando a Virtual_PDF..."; s.style.color = "blue";
s.innerText = "Invio...";
const fd = new FormData(document.querySelector('form[action="/download"]'));
fetch('/stampa_pdf', { method: 'POST', body: fd })
.then(r => r.text()).then(m => { s.innerText = m; s.style.color = m.includes("OK") ? "green" : "red"; })
.catch(() => { s.innerText = "Errore connessione"; s.style.color = "red"; });
.then(r => r.text()).then(m => { s.innerText = m; s.style.color = m.includes("OK") ? "green" : "red"; });
}
</script>
</body>