# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib import admin
from djangolettings.models import BookingEnquiry, Room
import image_cropping


class RoomAdmin(image_cropping.ImageCroppingMixin, admin.ModelAdmin):
    list_display = (
        'name',
        'seats',
        'daily_rate',
        'hourly_rate',
        'evening_hourly_rate',
    )
    list_editable = (
        'seats',
        'daily_rate',
        'hourly_rate',
        'evening_hourly_rate',
    )
    search_fields = ('name', 'details', )
    prepopulated_fields = {'slug': ('name', )}


class BookingEnquiryAdmin(admin.ModelAdmin):
    list_display = (
        '__str__',
        'date_of_event',
        'number_of_attendees',
        'whole_building',
    )
    search_fields = (
        'name',
        'address',
        'email_address',
        'invoicing_address',
        'contact_name',
        'event_title',
        'purpose_of_event',
        'message',
    )
    date_hierarchy = 'date_of_event'
    list_filter = (
        'rooms',
    )


admin.site.register(Room, RoomAdmin)
admin.site.register(BookingEnquiry, BookingEnquiryAdmin)
