implementation of the upload

This commit is contained in:
2026-08-28 14:13:36 +02:00
parent 46478d5d1f
commit 9d600bc33a
3 changed files with 124 additions and 27 deletions
+15 -2
View File
@@ -44,11 +44,23 @@
<p><strong>Unterlagen:</strong> {{ item.paperwork_status or 'Offen' }}{% if item.consent_accepted %} | Einwilligung bestätigt{% endif %}</p>
<p><strong>Kontaktdaten:</strong> {{ item.booking_data.get('contact_person', '-') }} | {{ item.booking_data.get('contact_email', '-') }} | {{ item.booking_data.get('billing_city', '-') }}</p>
{% endif %}
<div style="margin: 0.5rem 0; padding: 0.5rem; background: #f4f8fa; border-radius: 8px;">
{% if item.pdf_path %}
<p><strong>PDF:</strong> <a href="{{ url_for('static', filename=item.pdf_path) }}" target="_blank" rel="noopener">Ansehen</a>
<button class="print-btn" type="button" onclick="printPdf('{{ url_for('static', filename=item.pdf_path) }}')">PDF drucken</button>
<p style="margin:0.2rem 0;"><strong>Rechnungs-PDF:</strong>
<a href="{{ url_for('static', filename=item.pdf_path) }}" target="_blank" rel="noopener">Ansehen</a>
</p>
{% endif %}
{% if item.hauptvertrag_data is defined or item.get('hauptvertrag_filename') %}
<p style="margin:0.2rem 0;"><strong>Hauptvertrag (aus MongoDB):</strong>
<a href="{{ url_for('view_hauptvertrag', invoice_id=item.id) }}" target="_blank" rel="noopener">
{{ item.hauptvertrag_filename or 'Hauptvertrag öffnen' }}
</a>
</p>
{% else %}
<p style="margin:0.2rem 0; color: #777;"><strong>Hauptvertrag:</strong> Noch nicht in MongoDB hochgeladen</p>
{% endif %}
</div>
<form method="post" class="inline-form" enctype="multipart/form-data">
<input type="hidden" name="action" value="update">
<input type="hidden" name="invoice_id" value="{{ item.id }}">
@@ -82,6 +94,7 @@
<form method="post" style="display:inline-block; margin-right:0.6rem;">
<input type="hidden" name="action" value="create_from_provision">
<input type="hidden" name="prov_id" value="{{ prov.id }}">
<input type="file" name="contract_file" accept=".pdf,.png,.jpg,.jpeg,.webp">
<input type="text" name="period" placeholder="Zeitraum (optional)">
<input type="text" name="due_date" placeholder="Fälligkeit (YYYY-MM-DD)">
<button type="submit">Rechnung erzeugen</button>
+17 -13
View File
@@ -6,7 +6,7 @@
<section class="panel" style="display:flex; align-items:center; justify-content:space-between; gap:1rem;">
<div>
<h1>Rechnungseinsicht</h1>
<p style="margin:0">Alle Rechnungen im Überblick. Der Admin prüft neue Rechnungen zuerst; der Status zeigt dir, ob die Rechnung noch geprüft wird oder bereits bearbeitet wurde.</p>
<p style="margin:0">Alle Rechnungen im Überblick.</p>
</div>
<div class="no-print">
<button class="print-btn" type="button" onclick="printDocument()">Seite drucken</button>
@@ -22,7 +22,8 @@
<th>Betrag</th>
<th>Fälligkeit</th>
<th>Status</th>
<th>PDF</th>
<th>Rechnung PDF</th>
<th>Hauptvertrag</th>
</tr>
</thead>
<tbody>
@@ -36,26 +37,29 @@
<td>
{% if invoice.pdf_path %}
<a href="{{ url_for('static', filename=invoice.pdf_path) }}" target="_blank" rel="noopener">PDF ansehen</a>
<button class="print-btn" type="button" onclick="printPdf('{{ url_for('static', filename=invoice.pdf_path) }}')">PDF drucken</button>
{% else %}
-
{% endif %}
</td>
<td>
{% if invoice.has_hauptvertrag %}
<a href="{{ url_for('view_hauptvertrag', invoice_id=invoice.id) }}" target="_blank" rel="noopener">Hauptvertrag ansehen</a>
{% else %}
<form method="post" enctype="multipart/form-data" style="display:flex; gap:0.3rem; align-items:center;">
<input type="hidden" name="action" value="upload_hauptvertrag">
<input type="hidden" name="invoice_id" value="{{ invoice.id }}">
<input type="file" name="hauptvertrag_file" accept="image/*,application/pdf" required style="font-size:0.8rem;">
<button type="submit" style="padding: 0.2rem 0.6rem; font-size:0.8rem;">Hochladen</button>
</form>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="6">Noch keine Rechnungen vorhanden.</td>
<td colspan="7">Noch keine Rechnungen vorhanden.</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
<style>
.panel { margin-bottom: 1rem; }
.table-wrap { background: #fff; border: 1px solid #d8e1e8; border-radius: 14px; padding: 1rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem; border-bottom: 1px solid #e8eef2; }
a { color: #0a4c74; font-weight: 700; }
</style>
{% endblock %}
{% endblock %}