from django.contrib import admin
from .models import *


# Register your models here.

class RequirementInline(admin.TabularInline):
    model = ProjectRequirement
    extra = 1  


class FileInline(admin.TabularInline):
    model = ProjectFile
    extra = 1  

class CredentialInline(admin.TabularInline):
    model = ProjectCredential
    extra = 1  

class ProjectAdmin(admin.ModelAdmin):
    inlines=[RequirementInline, FileInline, CredentialInline]



class PointAdmin(admin.ModelAdmin):
    list_display = ('text', 'status', 'task', 'task_assigned_to')  # Display these fields in the admin list view
    list_filter = ('status',)  # Enable filtering by status in the admin interface
    def task_assigned_to(self, obj):
        return obj.task.assigned_to if obj.task else ''


admin.site.register(Reference)
admin.site.register(Business)
admin.site.register(CustomerProfile)
admin.site.register(Department)
admin.site.register(StaffProfile)
admin.site.register(ProjectType)
admin.site.register(Project, ProjectAdmin)
admin.site.register(ProjectStatus)
admin.site.register(PinnedProject)
admin.site.register(Epic)
admin.site.register(Note)
admin.site.register(Task)
admin.site.register(Status)
admin.site.register(Tag)
admin.site.register(Point, PointAdmin)
admin.site.register(DailyReport)
admin.site.register(BusinessType)
admin.site.register(PointActivity)
admin.site.register(Connection)
admin.site.register(Reaction)
admin.site.register(JobPosition)
admin.site.register(StaffPosition)

