Add the management app: club-facing UI + real fee-payment tracking
Gives clubs a self-service /manage/ area for members, families, teams, roles, and season memberships, alongside real fee-payment tracking (FeePayment, record_payment/mark_as_paid/remaining_balance) so a membership's paid status reflects actual money received instead of a single manually-set flag.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .models import Club, ClubMembership, ClubRole, Season
|
||||
from .models import Club, ClubMembership, ClubRole, FeePayment, Season
|
||||
|
||||
|
||||
@admin.register(Club)
|
||||
@@ -20,17 +20,33 @@ class SeasonAdmin(admin.ModelAdmin):
|
||||
ordering = ["club", "-start_date"]
|
||||
|
||||
|
||||
class FeePaymentInline(admin.TabularInline):
|
||||
model = FeePayment
|
||||
extra = 0
|
||||
readonly_fields = ["recorded_by"]
|
||||
|
||||
|
||||
@admin.register(ClubMembership)
|
||||
class ClubMembershipAdmin(admin.ModelAdmin):
|
||||
list_display = ["club__name", "member__last_name", "member__first_name", "season", "status", "fee_status", "license"]
|
||||
list_display = ["club__name", "member__last_name", "member__first_name", "season", "status", "fee_status", "fee_amount", "amount_paid", "license"]
|
||||
search_fields = ["club__name", "member__last_name", "member__first_name", "license"]
|
||||
list_filter = ["club", "season", "status", "fee_status"]
|
||||
raw_id_fields = ["member"]
|
||||
# Money is settled by club.services.fees, which re-derives fee_status from the payments.
|
||||
readonly_fields = ["amount_paid", "fee_status"]
|
||||
fieldsets = [
|
||||
[None, {"fields": ["club", "season", "member"]}],
|
||||
[_("Membership"), {"fields": ["license", "status", "fee_status"]}],
|
||||
[_("Membership"), {"fields": ["license", "status", "fee_status", "fee_amount", "amount_paid"]}],
|
||||
[_("Dates"), {"fields": ["signed_up_at", "activated_at"]}],
|
||||
]
|
||||
inlines = [FeePaymentInline]
|
||||
|
||||
|
||||
@admin.register(FeePayment)
|
||||
class FeePaymentAdmin(admin.ModelAdmin):
|
||||
list_display = ["membership", "amount", "method", "paid_at", "recorded_by"]
|
||||
list_filter = ["method"]
|
||||
search_fields = ["membership__club__name", "membership__member__last_name", "reference"]
|
||||
|
||||
|
||||
@admin.register(ClubRole)
|
||||
|
||||
Reference in New Issue
Block a user