Update templates/index.html
Implementata stampa tramite CUPS
This commit is contained in:
@@ -3,134 +3,22 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Software Cemento {{ rev if rev else 'Rev.11.0' }}</title>
|
<title>Software Cemento {{ rev }}</title>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root { --mac-bg: #f2f2f7; --mac-blue: #007aff; --mac-red: #ff3b30; --mac-green: #34c759; }
|
||||||
--mac-bg: #f2f2f7;
|
body { font-family: -apple-system, sans-serif; background: var(--mac-bg); padding: 20px; color: #1c1c1e; }
|
||||||
--mac-blue: #007aff;
|
.container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; max-width: 1200px; margin: auto; }
|
||||||
--mac-red: #ff3b30;
|
.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); }
|
||||||
--mac-green: #34c759;
|
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; }
|
||||||
body {
|
td { padding: 8px; text-align: center; border: 1px solid #e5e5ea; }
|
||||||
font-family: -apple-system, system-ui, sans-serif;
|
.h-blue { background: var(--mac-blue); } .h-red { background: var(--mac-red); }
|
||||||
background: var(--mac-bg);
|
input, select { width: 90%; border: 1px solid #d1d1d6; border-radius: 5px; padding: 6px; text-align: center; }
|
||||||
padding: 20px;
|
.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; }
|
||||||
font-size: 14px;
|
.btn-calc { background: var(--mac-green); } .btn-exp { background: #5856d6; }
|
||||||
color: #1c1c1e;
|
.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; }
|
||||||
.container {
|
@media print { .no-print { display: none !important; } }
|
||||||
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;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.h-blue { background: var(--mac-blue); }
|
|
||||||
.h-red { background: var(--mac-red); }
|
|
||||||
|
|
||||||
.input-group {
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
input {
|
|
||||||
width: 100%;
|
|
||||||
border: 1px solid #d1d1d6;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 6px 5px;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 14px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.unit-label {
|
|
||||||
position: absolute;
|
|
||||||
right: 8px;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
color: #8e8e93;
|
|
||||||
pointer-events: none;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
select {
|
|
||||||
border: 1px solid #d1d1d6;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 5px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
width: 100%;
|
|
||||||
padding: 12px;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: none;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 15px;
|
|
||||||
color: white;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
.btn-calc { background: var(--mac-green); }
|
|
||||||
.btn-exp { background: #5856d6; margin-top: 20px; }
|
|
||||||
|
|
||||||
.res-section { margin-bottom: 15px; }
|
|
||||||
.res-section h4 {
|
|
||||||
margin: 0 0 5px 0;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #8e8e93;
|
|
||||||
}
|
|
||||||
.res-box {
|
|
||||||
background: white;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 10px;
|
|
||||||
border: 1px solid #d1d1d6;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
/* CLASSE AGGIORNATA IN ROSSO */
|
|
||||||
.rev-tag {
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--mac-red);
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
hr { border: 0; border-top: 1px solid #d1d1d6; margin: 15px 0; }
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
.no-print { display: none !important; }
|
|
||||||
.res-box { border: none; }
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -139,138 +27,67 @@
|
|||||||
<form method="POST">
|
<form method="POST">
|
||||||
<table>
|
<table>
|
||||||
<tr class="h-blue"><th colspan="3">Dimensioni Totali</th></tr>
|
<tr class="h-blue"><th colspan="3">Dimensioni Totali</th></tr>
|
||||||
|
{% for n, k in [('Altezza','a'),('Larghezza','l'),('Profondità','p')] %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Altezza</td>
|
<td>{{n}}</td>
|
||||||
<td><input type="text" name="a" value="{{form.get('a','0')}}"></td>
|
<td><input type="text" name="{{k}}" value="{{form.get(k,'0')}}"></td>
|
||||||
<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>
|
||||||
<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>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr class="h-red"><th colspan="3">Miscela (Parti)</th></tr>
|
<tr class="h-red"><th colspan="3">Miscela (Parti) / Pesi (Kg) / Costi (€)</th></tr>
|
||||||
<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>
|
||||||
<td>Cemento:<br><input type="text" name="p_cem" value="{{form.get('p_cem','1')}}"></td>
|
<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>
|
||||||
<td>Sabbia:<br><input type="text" name="p_sab" value="{{form.get('p_sab','3')}}"></td>
|
<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>
|
||||||
<td>Ghiaia:<br><input type="text" name="p_ghi" value="{{form.get('p_ghi','5')}}"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
<p>Volume Betoniera (L): <input type="text" name="v_bet" value="{{form.get('v_bet','140')}}" style="width:60px;"></p>
|
||||||
<table>
|
|
||||||
<tr class="h-red"><th colspan="3">Peso sacchetti (Kg)</th></tr>
|
|
||||||
<tr>
|
|
||||||
<td>Cemento:<br><div class="input-group"><input type="text" name="w_cem" value="{{form.get('w_cem','25')}}"><span class="unit-label">Kg</span></div></td>
|
|
||||||
<td>Sabbia:<br><div class="input-group"><input type="text" name="w_sab" value="{{form.get('w_sab','25')}}"><span class="unit-label">Kg</span></div></td>
|
|
||||||
<td>Ghiaia:<br><div class="input-group"><input type="text" name="w_ghi" value="{{form.get('w_ghi','25')}}"><span class="unit-label">Kg</span></div></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr class="h-red"><th colspan="3">Costo sacchetti (€)</th></tr>
|
|
||||||
<tr>
|
|
||||||
<td>Cemento:<br><div class="input-group"><input type="text" name="c_cem" value="{{form.get('c_cem','1')}}"><span class="unit-label">€</span></div></td>
|
|
||||||
<td>Sabbia:<br><div class="input-group"><input type="text" name="c_sab" value="{{form.get('c_sab','1')}}"><span class="unit-label">€</span></div></td>
|
|
||||||
<td>Ghiaia:<br><div class="input-group"><input type="text" name="c_ghi" value="{{form.get('c_ghi','1')}}"><span class="unit-label">€</span></div></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr class="h-red"><th>Attrezzatura</th></tr>
|
|
||||||
<tr>
|
|
||||||
<td>Volume utile Betoniera: <div class="input-group" style="width:80px;"><input type="text" name="v_bet" value="{{form.get('v_bet','160')}}"><span class="unit-label">L</span></div></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-calc">Esegui Calcolo</button>
|
<button type="submit" class="btn btn-calc">Esegui Calcolo</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div style="display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px;">
|
<div style="display:flex; justify-content:space-between; align-items:baseline;">
|
||||||
<h3 style="margin: 0;">Risultati</h3>
|
<h3>Risultati</h3><span class="rev-tag">{{ rev }}</span>
|
||||||
<span class="rev-tag">{{ rev if rev else 'Rev.1.0' }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if res %}
|
{% if res %}
|
||||||
<div class="res-box">
|
<div class="res-box">
|
||||||
<div class="res-section">
|
<b>Volume:</b> {{ res.vol }} m³ | <b>Peso:</b> {{ res.peso }} Kg<br>
|
||||||
<b>Volume Totale:</b> {{ res.vol }} m³ | <b>Peso Stimato:</b> {{ res.peso }} Kg
|
|
||||||
</div>
|
|
||||||
<hr>
|
<hr>
|
||||||
<div class="res-section">
|
<b>Cemento:</b> {{ res.s_cem }} sacchi | <b>Sabbia:</b> {{ res.s_sab }} sacchi | <b>Ghiaia:</b> {{ res.s_ghi }} sacchi<br>
|
||||||
<h4>Acquisti Necessari</h4>
|
<b>Acqua:</b> {{ res.acqua }} L | <b style="color:var(--mac-blue);">Totale: {{ res.costo_tot }} €</b>
|
||||||
Cemento: {{ res.s_cem }} sacchetti<br>
|
|
||||||
Sabbia: {{ res.s_sab }} sacchetti<br>
|
|
||||||
Ghiaia: {{ res.s_ghi }} sacchetti<br>
|
|
||||||
Acqua: {{ res.acqua }} L<br>
|
|
||||||
<b>Totale materiale:</b> {{ res.tot_sacc }} sacchetti
|
|
||||||
</div>
|
|
||||||
<div class="res-section">
|
|
||||||
<h4>Costo stimato</h4>
|
|
||||||
<b style="font-size: 16px; color: var(--mac-blue);">Costo totale: {{ res.costo_tot }} €</b>
|
|
||||||
</div>
|
|
||||||
<hr>
|
<hr>
|
||||||
<div class="res-section">
|
<b>Ogni carico ({{ res.n_c }} cicli):</b><br>
|
||||||
<h4>Dosaggio per ogni carico ({{ res.n_c }} carichi):</h4>
|
• Cem: {{ res.bc_cem }} | Sab: {{ res.bc_sab }} | Ghi: {{ res.bc_ghi }} sacchi
|
||||||
<div style="background: #f9f9f9; padding: 10px; border-radius: 5px; margin-top: 5px;">
|
|
||||||
• Cemento: <b>{{ res.bc_cem }}</b> sacchetti<br>
|
|
||||||
• Sabbia: <b>{{ res.bc_sab }}</b> sacchetti<br>
|
|
||||||
• Ghiaia: <b>{{ res.bc_ghi }}</b> sacchetti<br>
|
|
||||||
• Acqua: <b>{{ res.bc_aq }}</b> L
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="/download" method="POST" class="no-print">
|
<form action="/download" method="POST" class="no-print">
|
||||||
<input type="hidden" name="res_vol" value="{{res.vol}}"><input type="hidden" name="res_peso" value="{{res.peso}}">
|
<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_aq" value="{{res.acqua}}"><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_s_cem" value="{{res.s_cem}}">
|
<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_c_cem" value="{{res.cost_cem}}"><input type="hidden" name="res_s_sab" value="{{res.s_sab}}">
|
<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}}">
|
||||||
<input type="hidden" name="res_c_sab" value="{{res.cost_sab}}"><input type="hidden" name="res_s_ghi" value="{{res.s_ghi}}">
|
|
||||||
<input type="hidden" name="res_c_ghi" value="{{res.cost_ghi}}"><input type="hidden" name="res_nc" value="{{res.n_c}}">
|
<div style="display:flex; gap:10px;">
|
||||||
<input type="hidden" name="res_bc_cem" value="{{res.bc_cem}}"><input type="hidden" name="res_bc_sab" value="{{res.bc_sab}}">
|
<button type="submit" class="btn btn-exp" style="flex:1;">TXT</button>
|
||||||
<input type="hidden" name="res_bc_ghi" value="{{res.bc_ghi}}"><input type="hidden" name="res_bc_aq" value="{{res.bc_aq}}">
|
<button type="button" onclick="stampaCups()" class="btn" style="flex:1; background:#ff9500;">STAMPA PDF (CUPS)</button>
|
||||||
<input type="hidden" name="a" value="{{form.get('a')}}"><input type="hidden" name="ua" value="{{form.get('ua')}}">
|
</div>
|
||||||
<input type="hidden" name="l" value="{{form.get('l')}}"><input type="hidden" name="ul" value="{{form.get('ul')}}">
|
|
||||||
<input type="hidden" name="p" value="{{form.get('p')}}"><input type="hidden" name="up" value="{{form.get('up')}}">
|
|
||||||
<input type="hidden" name="p_cem" value="{{form.get('p_cem')}}"><input type="hidden" name="p_sab" value="{{form.get('p_sab')}}"><input type="hidden" name="p_ghi" value="{{form.get('p_ghi')}}">
|
|
||||||
<input type="hidden" name="w_cem" value="{{form.get('w_cem')}}"><input type="hidden" name="w_sab" value="{{form.get('w_sab')}}"><input type="hidden" name="w_ghi" value="{{form.get('w_ghi')}}">
|
|
||||||
<input type="hidden" name="c_cem" value="{{form.get('c_cem')}}"><input type="hidden" name="c_sab" value="{{form.get('c_sab')}}"><input type="hidden" name="c_ghi" value="{{form.get('c_ghi')}}">
|
|
||||||
<input type="hidden" name="v_bet" value="{{form.get('v_bet')}}">
|
|
||||||
<button type="submit" class="btn btn-exp">Esporta Report TXT</button>
|
|
||||||
</form>
|
</form>
|
||||||
<button onclick="window.print()" class="btn no-print" style="background:#d1d1d6; color:#1c1c1e;">Stampa Risultati</button>
|
<div id="status" style="text-align:center; font-size:12px; margin-top:5px;"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p style="color:#8e8e93; text-align:center; margin-top: 40px;">Inserisci i dati dimensionali e i costi, poi premi <b>"Esegui Calcolo"</b>.</p>
|
<p style="color:#8e8e93; text-align:center; margin-top:40px;">Premi <b>"Esegui Calcolo"</b>.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function stampaCups() {
|
||||||
|
const s = document.getElementById('status');
|
||||||
|
s.innerText = "Inviando a Virtual_PDF..."; s.style.color = "blue";
|
||||||
|
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"; });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user