124-webapp/templates/cost-calculator.html
2025-09-17 20:26:44 +02:00

74 lines
2.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- templates/index.html -->
{% extends "base.html" %}
{% block title %}Kostenrechner Studio EinsZwoVier{% endblock %}
{% 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">Hochladen & Berechnen</button>
</form>
<p class="rate-info">
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>Ergebnisse für {{ result.filename }}</h2>
<table>
<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>
{% endblock %}