2 Commits
+32 -23
View File
@@ -76,11 +76,18 @@ with col1:
st.warning("Keine .xlsx-Dateien im input/-Ordner gefunden.") st.warning("Keine .xlsx-Dateien im input/-Ordner gefunden.")
selected_input = None selected_input = None
else: else:
selected_input = st.selectbox( # Bei nur einer Datei: automatisch selektieren (keine Leerauswahl)
"Input-Datei wählen:", if len(input_files) == 1:
options=[""] + input_files, selected_input = st.selectbox(
format_func=lambda x: "– Bitte wählen –" if x == "" else x, "Input-Datei wählen:",
) options=input_files,
)
else:
selected_input = st.selectbox(
"Input-Datei wählen:",
options=[""] + input_files,
format_func=lambda x: "– Bitte wählen –" if x == "" else x,
)
if selected_input: if selected_input:
input_path = Path(app_config.input_dir) / selected_input input_path = Path(app_config.input_dir) / selected_input
@@ -157,11 +164,18 @@ with col2:
real_templates = [t for t in template_files if not t.startswith("~")] real_templates = [t for t in template_files if not t.startswith("~")]
if not real_templates: if not real_templates:
real_templates = template_files real_templates = template_files
selected_template = st.selectbox( # Bei nur einem Template: automatisch selektieren (keine Leerauswahl)
"Template wählen:", if len(real_templates) == 1:
options=[""] + real_templates, selected_template = st.selectbox(
format_func=lambda x: "– Bitte wählen –" if x == "" else x, "Template wählen:",
) options=real_templates,
)
else:
selected_template = st.selectbox(
"Template wählen:",
options=[""] + real_templates,
format_func=lambda x: "– Bitte wählen –" if x == "" else x,
)
if selected_template: if selected_template:
# Nur validieren wenn sich das Template geändert hat # Nur validieren wenn sich das Template geändert hat
@@ -219,19 +233,14 @@ if st.session_state.input_validated and st.session_state.parsed_records:
st.session_state[f"sel_{emp}"] = False st.session_state[f"sel_{emp}"] = False
# Mitarbeiter-Liste mit Rahmen # Mitarbeiter-Liste mit Rahmen
st.markdown( with st.container(border=True):
'<div style="border:1px solid #d5d5d5; border-radius:6px; padding:8px 12px; ' selected_employees = []
'background:#fafafa; max-height:300px; overflow-y:auto">', for emp in employees:
unsafe_allow_html=True, key = f"sel_{emp}"
) if key not in st.session_state:
selected_employees = [] st.session_state[key] = True
for emp in employees: if st.checkbox(emp, value=st.session_state[key], key=key):
key = f"sel_{emp}" selected_employees.append(emp)
if key not in st.session_state:
st.session_state[key] = True
if st.checkbox(emp, value=st.session_state[key], key=key):
selected_employees.append(emp)
st.markdown("</div>", unsafe_allow_html=True)
st.caption(f"{len(selected_employees)} von {len(employees)} Mitarbeitern ausgewählt") st.caption(f"{len(selected_employees)} von {len(employees)} Mitarbeitern ausgewählt")
else: else: