# -*- coding: utf-8 -*-

from django.contrib import admin

from product.models import ProductCodeSubmitLogInfo, ProductInfo, ProductModelInfo


class ProductModelInfoAdmin(admin.ModelAdmin):
    readonly_fields = ('model_id', )
    list_display = ('model_id', 'model_name', 'integral', 'has_mount', 'status', 'created_at', 'updated_at')
    search_fields = ('model_id', 'model_name')
    list_filter = ('has_mount', 'status')


class ProductInfoAdmin(admin.ModelAdmin):
    list_display = ('model_id', 'model_name', 'code', 'code_status', 'integral', 'integral_status', 'franchiser_id', 'clerk_id', 'consumer_name', 'consumer_sex', 'consumer_age', 'consumer_phone', 'status', 'created_at', 'updated_at')
    search_fields = ('model_id', 'model_name', 'code', 'consumer_name', 'consumer_phone')
    list_filter = ('code_status', 'integral_status', 'franchiser_id', 'consumer_sex', 'status')


class ProductCodeSubmitLogInfoAdmin(admin.ModelAdmin):
    list_display = ('model_id', 'model_name', 'mount', 'code', 'franchiser_id', 'clerk_id', 'consumer_name', 'consumer_sex', 'consumer_age', 'consumer_phone', 'status', 'created_at', 'updated_at')
    search_fields = ('model_id', 'model_name', 'code', 'consumer_name', 'consumer_phone')
    list_filter = ('step', 'mount', 'franchiser_id', 'consumer_sex', 'status')


admin.site.register(ProductModelInfo, ProductModelInfoAdmin)
admin.site.register(ProductInfo, ProductInfoAdmin)
admin.site.register(ProductCodeSubmitLogInfo, ProductCodeSubmitLogInfoAdmin)
