feat: add per-member payment frequencies

This commit is contained in:
Marcel Peterkau
2026-07-30 19:17:26 +02:00
parent 6d9c50b148
commit c3cdf71506
8 changed files with 168 additions and 6 deletions
+18 -3
View File
@@ -15,7 +15,7 @@ from ccma.domain.contributions import (
payment_allocated_total,
)
from ccma.domain.dates import age_label, date_input_hint, format_date_for_display
from ccma.domain.models import ASSET_STATUS_LABELS, Event
from ccma.domain.models import ASSET_STATUS_LABELS, PAYMENT_FREQUENCY_LABELS, Event
from ccma.domain.models import MEMBERSHIP_STATUS_LABELS as STATUS_LABELS
from ccma.storage.repository import MemberRepository, RepositoryError
from ccma.ui.dialogs import IntegrityWarningDialog
@@ -204,11 +204,22 @@ class MemberTab(ttk.Frame):
state="readonly",
width=39,
).grid(row=len(fields), column=1, sticky="ew", pady=5)
self._add_variable("payment_frequency", tk.StringVar(), "data")
ttk.Label(data_tab, text="Zahlweise").grid(
row=len(fields) + 1, column=0, sticky="w", pady=5, padx=(0, 12)
)
ttk.Combobox(
data_tab,
textvariable=self.variables["payment_frequency"],
values=list(PAYMENT_FREQUENCY_LABELS.values()),
state="readonly",
width=39,
).grid(row=len(fields) + 1, column=1, sticky="ew", pady=5)
ttk.Label(data_tab, text="Interne Notiz").grid(
row=len(fields) + 1, column=0, sticky="nw", pady=5, padx=(0, 12)
row=len(fields) + 2, column=0, sticky="nw", pady=5, padx=(0, 12)
)
self.notes_text = tk.Text(data_tab, width=42, height=6, wrap="word")
self.notes_text.grid(row=len(fields) + 1, column=1, sticky="ew", pady=5)
self.notes_text.grid(row=len(fields) + 2, column=1, sticky="ew", pady=5)
self.notes_text.bind("<<Modified>>", lambda _event: self._mark_dirty_from_text("data"), add="+")
data_tab.columnconfigure(1, weight=1)
@@ -474,6 +485,8 @@ class MemberTab(ttk.Frame):
value = getattr(self.member, key)
if key == "status":
variable.set(display_label(STATUS_LABELS, str(value)))
elif key == "payment_frequency":
variable.set(display_label(PAYMENT_FREQUENCY_LABELS, str(value)))
else:
variable.set(format_date_for_display(value) if key in date_fields else value)
if self.notes_text is not None:
@@ -688,6 +701,8 @@ class MemberTab(ttk.Frame):
value = raw_value.strip() if isinstance(raw_value, str) else raw_value
if key == "status":
value = storage_key(STATUS_LABELS, value)
elif key == "payment_frequency":
value = storage_key(PAYMENT_FREQUENCY_LABELS, value)
setattr(self.member, key, value)
if self.notes_text is not None:
self.member.notes = self.notes_text.get("1.0", "end-1c").strip()