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

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

from integral.models import SaleclerkIntegralIncomeExpensesInfo, SaleclerkSubmitLogInfo


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


class SaleclerkSubmitLogInfoAdmin(AdvancedExportExcelModelAdmin, admin.ModelAdmin):
    list_display = ('clerk_id', 'clerk_name', 'model_name', 'model_uni_name', 'distributor_name', 'code', 'has_scan', 'remark', 'dupload', 'ymd', 'trackingNo', 'is_wxwork', 'is_staff_delete', 'status', 'created_at', 'updated_at')
    list_filter = ('brand_pk', 'dupload', 'test_user', 'test_sn', 'has_scan', 'is_wxwork', 'is_staff_delete', 'is_upload_qiniu', 'status', 'created_at', 'remark')
    excel_fields = ('created_at', 'distributor_name', 'clerk_name', 'model_uni_name', 'model_name', 'code', 'has_scan', 'remark')
    search_fields = ('code', 'trackingNo', 'distributor_name', 'clerk_name', 'model_name', 'model_uni_name')


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