from sets.admin import *
from .models import *
from django.contrib import admin

class Admin_Subscribe(Admin_Trans_BaseModel):
    fieldsets = (
        (None, {
            'classes': ['wide'],
            'fields': ('name',
                       ('price'),
                       'options',
                       'period_name', 'period',
                       'order',
                       'bg_color', 'text_color'
                       )
        }),
    )

    list_display = [
        'id',
        'name', 'price',
        'period_name', 'period',
        'order', 'modifiedDT', 'createDT'
    ]

    list_display_links = ['id']

    list_filter = ['modifiedDT', 'createDT']
    search_fields = ['name', 'period_name']
    filter_horizontal = ['options']

admin.site.register(Subscribe,Admin_Subscribe)


class Admin_SubscribeOption(Admin_Trans_BaseModel):
    fieldsets = (
        (None, {
            'classes': ['wide'],
            'fields': ('name',
                       'order'
                       )
        }),
    )

    list_display = [
        'id',
        'name',
        'order', 'modifiedDT', 'createDT'
    ]

    list_display_links = ['id']

    list_filter = ['modifiedDT', 'createDT']
    search_fields = ['name']

admin.site.register(SubscribeOption,Admin_SubscribeOption)


class Admin_SubscribeForUser(Admin_Trans_BaseModel):
    fieldsets = (
        (None, {
            'classes': ['wide'],
            'fields': ('name',
                       'user', 'subscribe',
                       'last_paid_DT',
                       'paid_period_from_DT', 'paid_period_to_DT',
                       'auto_continue', 'receive_finish_subscribe_msg',
                       'order'
                       )
        }),
    )

    list_display = [
        'id',
        'name', 'user', 'subscribe',
        'last_paid_DT', 'paid_period_from_DT', 'paid_period_to_DT',
        'auto_continue', 'receive_finish_subscribe_msg',
        'order', 'modifiedDT', 'createDT'
    ]

    list_display_links = ['id']

    list_filter = [
        'subscribe', 'last_paid_DT', 'paid_period_from_DT', 'paid_period_to_DT',
        'auto_continue', 'receive_finish_subscribe_msg',
        'modifiedDT', 'createDT'
    ]
    search_fields = ['name']

admin.site.register(SubscribeForUser,Admin_SubscribeForUser)