from django.contrib import admin
from .models import Worker, Project, Team, WorkLog, UserProfile

@admin.register(UserProfile)
class UserProfileAdmin(admin.ModelAdmin):
    list_display = ('user', 'pin', 'is_admin')

@admin.register(Worker)
class WorkerAdmin(admin.ModelAdmin):
    list_display = ('name', 'id_no', 'phone_no', 'monthly_salary')
    search_fields = ('name', 'id_no')

@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
    list_display = ('name', 'created_at')
    filter_horizontal = ('supervisors',)

@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
    list_display = ('name', 'supervisor', 'created_at')
    filter_horizontal = ('workers',)

@admin.register(WorkLog)
class WorkLogAdmin(admin.ModelAdmin):
    list_display = ('date', 'project', 'supervisor')
    list_filter = ('date', 'project', 'supervisor')
    filter_horizontal = ('workers',)
