feat(ui): group validation fields into tabs (Basis/Parteien/Positionen/PDF-Text)

Reduces scrolling - Summen und Export bleiben unterhalb der Tabs immer sichtbar.
Reine UI-Umgruppierung, keine Aenderung an Feldern oder Berechnungslogik.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
dfuhrmann3 2026-07-07 16:14:17 +02:00
parent efdee4cfd6
commit c07eb860fa
1 changed files with 174 additions and 166 deletions

42
main.py
View File

@ -109,7 +109,6 @@ with col1:
st.success("PDF eingelesen!")
uploaded_file.seek(0)
st.pdf(uploaded_file)
with st.expander("Gefundener Text"): st.text(pdf_text)
with col2:
st.subheader("2. Strukturierte Daten validieren")
@ -202,6 +201,13 @@ with col2:
if data.get("hardware_serials"):
st.caption(f"🔧 Erkannte Seriennummern: {', '.join(data['hardware_serials'])}")
# Reiter-Navigation: gruppiert die Eingabefelder, damit man nicht die ganze Seite
# runterscrollen muss. Summen & Export stehen bewusst UNTERHALB der Tabs (immer sichtbar).
tab_basis, tab_parteien, tab_positionen, tab_pdftext = st.tabs(
["Basis", "Parteien", "Positionen", "PDF-Text"]
)
with tab_basis:
# --- BT-3 RECHNUNGSTYP DROPDOWN-MENÜ ---
inv_type_ui = st.selectbox(
"Rechnungstyp (BT-3)",
@ -247,10 +253,18 @@ with col2:
value=str(data.get("payment_term_days", "") or "")
)
i_note = st.text_area("Globale Rechnungserläuterung / Freitext (BT-22)", value=data.get("invoice_note", ""), height=150)
st.markdown("---")
payment_means_codes_list = list(PAYMENT_MEANS_CODES.keys())
payment_means_labels = [f"{code} - {PAYMENT_MEANS_CODES[code]}" for code in payment_means_codes_list]
selected_payment_means_label = st.selectbox(
"Zahlungsmittel (BT-81)",
options=payment_means_labels,
index=payment_means_codes_list.index("58"),
)
selected_payment_means_code = selected_payment_means_label.split(" - ")[0]
# Adressdaten
i_note = st.text_area("Globale Rechnungserläuterung / Freitext (BT-22)", value=data.get("invoice_note", ""), height=150)
with tab_parteien:
c_s, c_r = st.columns(2)
with c_s:
st.markdown("**Absender (Verkäufer):**")
@ -271,19 +285,7 @@ with col2:
r_zip = st.text_input("PLZ (BT-53)", value=data.get("recipient_zip", ""))
r_city = st.text_input("Stadt (BT-52) :red[*]", value=data.get("recipient_city", ""))
st.markdown("---")
payment_means_codes_list = list(PAYMENT_MEANS_CODES.keys())
payment_means_labels = [f"{code} - {PAYMENT_MEANS_CODES[code]}" for code in payment_means_codes_list]
selected_payment_means_label = st.selectbox(
"Zahlungsmittel (BT-81)",
options=payment_means_labels,
index=payment_means_codes_list.index("58"),
)
selected_payment_means_code = selected_payment_means_label.split(" - ")[0]
st.markdown("### 3. Positionen")
with tab_positionen:
if st.button("➕ Neue Position hinzufügen"):
data["items"].append({
"name": "Neue Dienstleistung", "description": "", "quantity": 1.0, "unit": "Stk.",
@ -357,6 +359,12 @@ with col2:
with c_disc4:
skonto_days = st.text_input("Skonto-Frist (Tage)", value="")
with tab_pdftext:
st.text(pdf_text if pdf_text.strip() else "(Kein PDF-Text verfügbar)")
# --- SUMMEN & EXPORT: bewusst AUSSERHALB der Tabs, damit sie unabhängig vom aktiven
# Reiter immer sichtbar und ohne Scrollen erreichbar sind. ---
st.markdown("---")
totals = compute_invoice_totals(edited_items, discount_percent=discount_percent)
computed_net_amount = totals["tax_basis_total"]
computed_vat_amount = totals["total_vat_amount"]