from django.contrib import admin

from .models import BusinessProfile, Transaction


@admin.register(BusinessProfile)
class BusinessProfileAdmin(admin.ModelAdmin):
    list_display = ('business_name', 'user', 'opening_ecash', 'opening_physical_cash', 'current_ecash', 'current_physical_cash')
    search_fields = ('business_name', 'user__username', 'user__email')


@admin.register(Transaction)
class TransactionAdmin(admin.ModelAdmin):
    list_display = ('client_name', 'transaction_type', 'amount', 'service_charge', 'business', 'created_at')
    list_filter = ('transaction_type', 'created_at')
    search_fields = ('client_name', 'business__business_name', 'created_by__username')
    date_hierarchy = 'created_at'
