fix colors
This commit is contained in:
parent
242d3bd915
commit
da5e765d49
13 changed files with 455 additions and 656 deletions
|
|
@ -1,170 +1,74 @@
|
|||
<!-- templates/index.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% extends "base.html" %}
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Print Cost Calculator</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 2em;
|
||||
background-color: #f9f9f9;
|
||||
color: #333;
|
||||
}
|
||||
{% block title %}Kostenrechner – Studio EinsZwoVier{% endblock %}
|
||||
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin: auto;
|
||||
background: #fff;
|
||||
padding: 2em;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 0.7em;
|
||||
background-color: #007bff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 1em;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.rate-info {
|
||||
text-align: center;
|
||||
color: #555;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.color {
|
||||
background-color: #ffdede;
|
||||
}
|
||||
|
||||
.black {
|
||||
background-color: #e0e0ff;
|
||||
}
|
||||
|
||||
.totals {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Print Cost Calculator</h1>
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h1>Kostenrechner für Drucke</h1>
|
||||
|
||||
{% if error %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% endif %}
|
||||
|
||||
<form action="/upload" method="post" enctype="multipart/form-data">
|
||||
<input type="file" name="file" accept="application/pdf" required />
|
||||
<button type="submit">Upload & Calculate</button>
|
||||
<input type="file" name="file" accept="application/pdf" required />
|
||||
<button type="submit">Hochladen & Berechnen</button>
|
||||
</form>
|
||||
|
||||
<p class="rate-info">
|
||||
Rates are fixed via environment variables:<br>
|
||||
B&W: {{ rate_black if rate_black else 'RATE_PER_M2_BLACK' }} € / m²,
|
||||
Color: {{ rate_color if rate_color else 'RATE_PER_M2_COLOR' }} € / m²
|
||||
Preise werden über Umgebungsvariablen festgelegt:<br>
|
||||
S/W: {{ rate_black if rate_black else 'RATE_PER_M2_BLACK' }} € / m²,
|
||||
Farbe: {{ rate_color if rate_color else 'RATE_PER_M2_COLOR' }} € / m²
|
||||
</p>
|
||||
|
||||
{% if result %}
|
||||
<h2>Results for {{ result.filename }}</h2>
|
||||
<h2>Ergebnisse für {{ result.filename }}</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Page</th>
|
||||
<th>Width (m)</th>
|
||||
<th>Height (m)</th>
|
||||
<th>Area (m²)</th>
|
||||
<th>Ink %</th>
|
||||
<th>Type</th>
|
||||
<th>Cost (€)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for page in result.pages %}
|
||||
<tr class="{{ 'color' if page.is_color else 'black' }}">
|
||||
<td>{{ page.page }}</td>
|
||||
<td>{{ "%.3f"|format(page.width_m) }}</td>
|
||||
<td>{{ "%.3f"|format(page.height_m) }}</td>
|
||||
<td>{{ "%.4f"|format(page.area_m2) }}</td>
|
||||
<td>{{ "%.1f"|format(page.ink_pct) if page.ink_pct is not none else '-' }}</td>
|
||||
<td>{{ 'Color' if page.is_color else 'B&W' }}</td>
|
||||
<td>{{ "%.2f"|format(page.cost) }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="totals">
|
||||
<td colspan="3">Total Black Pages</td>
|
||||
<td>{{ "%.4f"|format(result.total_area_black) }}</td>
|
||||
<td colspan="2"></td>
|
||||
<td>{{ "%.2f"|format(result.total_cost_black) }}</td>
|
||||
</tr>
|
||||
<tr class="totals">
|
||||
<td colspan="3">Total Color Pages</td>
|
||||
<td>{{ "%.4f"|format(result.total_area_color) }}</td>
|
||||
<td colspan="2"></td>
|
||||
<td>{{ "%.2f"|format(result.total_cost_color) }}</td>
|
||||
</tr>
|
||||
<tr class="totals">
|
||||
<td colspan="6">Grand Total</td>
|
||||
<td>{{ "%.2f"|format(result.grand_total) }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Seite</th>
|
||||
<th>Breite (m)</th>
|
||||
<th>Höhe (m)</th>
|
||||
<th>Fläche (m²)</th>
|
||||
<th>Tinten %</th>
|
||||
<th>Typ</th>
|
||||
<th>Kosten (€)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for page in result.pages %}
|
||||
<tr class="{{ 'color' if page.is_color else 'black' }}">
|
||||
<td>{{ page.page }}</td>
|
||||
<td>{{ "%.3f"|format(page.width_m) }}</td>
|
||||
<td>{{ "%.3f"|format(page.height_m) }}</td>
|
||||
<td>{{ "%.4f"|format(page.area_m2) }}</td>
|
||||
<td>{{ "%.1f"|format(page.ink_pct) if page.ink_pct is not none else '-' }}</td>
|
||||
<td>{{ 'Farbe' if page.is_color else 'S/W' }}</td>
|
||||
<td>{{ "%.2f"|format(page.cost) }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="totals">
|
||||
<td colspan="3">Summe S/W</td>
|
||||
<td>{{ "%.4f"|format(result.total_area_black) }}</td>
|
||||
<td colspan="2"></td>
|
||||
<td>{{ "%.2f"|format(result.total_cost_black) }}</td>
|
||||
</tr>
|
||||
<tr class="totals">
|
||||
<td colspan="3">Summe Farbe</td>
|
||||
<td>{{ "%.4f"|format(result.total_area_color) }}</td>
|
||||
<td colspan="2"></td>
|
||||
<td>{{ "%.2f"|format(result.total_cost_color) }}</td>
|
||||
</tr>
|
||||
<tr class="totals">
|
||||
<td colspan="6">Gesamtsumme</td>
|
||||
<td>{{ "%.2f"|format(result.grand_total) }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue