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

from django.contrib import admin
from django_admin import ReadOnlyModelAdmin, AdvancedExportExcelModelAdmin

from integral.models import SaleclerkIntegralIncomeExpensesInfo, SaleclerkSubmitLogInfo


class SaleclerkIntegralIncomeExpensesInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('brand_id', 'clerk_id', 'type', 'code', 'integral', 'left_integral', 'remark', 'test_user', 'status', 'created_at', 'updated_at')
    list_filter = ('brand_id', 'test_user', 'type', 'status')
    readonly_fields = ('clerk_id', 'type', 'code', 'integral', 'left_integral')
    search_fields = ('clerk_id', 'code', 'remark')


class SaleclerkSubmitLogInfoAdmin(AdvancedExportExcelModelAdmin, ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('brand_pk', 'brand_name', 'model_pk', 'model_name', 'distributor_pk', 'distributor_name', 'clerk_id', 'clerk_name', 'code', 'remark', 'dupload', 'test_user', 'test_sn', 'ym', 'ymd', 'status', 'created_at', 'updated_at')
    list_filter = ('brand_pk', 'dupload', 'test_user', 'test_sn', 'status')
    search_fields = ('code', 'remark')


admin.site.register(SaleclerkIntegralIncomeExpensesInfo, SaleclerkIntegralIncomeExpensesInfoAdmin)
admin.site.register(SaleclerkSubmitLogInfo, SaleclerkSubmitLogInfoAdmin)
