Enhance Destinataer functionality: inline editing and improved list view

- Add inline edit mode to destinataer detail view with AJAX save/cancel
- Fix form validation by aligning select choices with model definitions
- Update Destinataer model to make familienzweig and berufsgruppe optional
- Fix StiftungsKonto integration in forms and views
- Redesign destinataer list view with new column layout:
  * Vorname, Nachname, E-Mail, Vierteljährlicher Betrag
  * Letzter Studiennachweis, Unterstützung bestätigt, Aktionen
- Improve form styling and user experience
- Add proper field validation and error handling
- Enhance UI with better badges, icons, and formatting
This commit is contained in:
Stiftung Development
2025-09-19 23:52:26 +02:00
parent 584e2b8554
commit 69128196ef
6 changed files with 91 additions and 43 deletions

View File

@@ -369,14 +369,13 @@ class DestinataerForm(forms.ModelForm):
"haushaltsgroesse": forms.NumberInput(
attrs={"class": "form-control", "min": 1}
),
# renamed in UI: use vierteljaehrlicher_betrag field
"vermoegen": forms.NumberInput(
attrs={"class": "form-control", "step": "0.01"}
),
"unterstuetzung_bestaetigt": forms.CheckboxInput(
attrs={"class": "form-check-input"}
),
"standard_konto": forms.Select(attrs={"class": "form-select"}),
"standard_konto": forms.Select(attrs={"class": "form-select"}, choices=[(None, "---")] + [(c.pk, str(c)) for c in getattr(Destinataer, 'konten_queryset', lambda: [])()]),
"vierteljaehrlicher_betrag": forms.NumberInput(
attrs={"class": "form-control", "step": "0.01"}
),
@@ -386,8 +385,27 @@ class DestinataerForm(forms.ModelForm):
"letzter_studiennachweis": forms.DateInput(
attrs={"class": "form-control", "type": "date"}
),
"familienzweig": forms.Select(attrs={"class": "form-select"}),
"berufsgruppe": forms.Select(attrs={"class": "form-select"}),
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field_name, field in self.fields.items():
if field_name not in ["vorname", "nachname"]:
field.required = False
# Set choices for familienzweig and berufsgruppe to match model
self.fields["familienzweig"].choices = [("", "Bitte wählen...")] + list(Destinataer.FAMILIENZWIG_CHOICES)
self.fields["berufsgruppe"].choices = [("", "Bitte wählen...")] + list(Destinataer.BERUFSGRUPPE_CHOICES)
# Set choices for standard_konto to allow blank
self.fields["standard_konto"].empty_label = "---"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field_name, field in self.fields.items():
if field_name not in ["vorname", "nachname"]:
field.required = False
class LandForm(forms.ModelForm):
"""Form für das Erstellen und Bearbeiten von Ländern"""