from sideboard.lib import parse_config
from collections import defaultdict

from uber.config import c, Config
from uber.menu import MenuItem

config = parse_config(__file__)
c.include_plugin_config(config)

c.MENU.append_menu_item(
    MenuItem(name='Midwest FurFest', access=c.PEOPLE, submenu=[
        MenuItem(name='Comped Badges', href='../mff_reports/comped_badges'),
        MenuItem(name='Daily Attendance', href='../mff_reports/attendance_graph'),
        MenuItem(name='Print Adult Badges (Single Queue)',
                 href='../kiosk_printing/print_badges'),
        MenuItem(name='Print Adult Badges (Even Queue)',
                 href='../kiosk_printing/print_badges?evenOdd=e'),
        MenuItem(name='Print Adult Badges (Odd Queue)',
                 href='../kiosk_printing/print_badges?evenOdd=o'),
        MenuItem(name='Print Minor Badges',
                 href='../kiosk_printing/print_badges?minor=True'),
    ])
)


@Config.mixin
class ExtraConfig:
    @property
    def DEALER_BADGE_PRICE(self):
        return self.get_attendee_price()

    @property
    def TABLE_OPTS(self):
        return [(1, 'Single Table'),
                (2, 'Double Table'),
                (3, 'Triple Table'),
                (4, 'Quad Table'),
                (5, '10x10 Booth')]

    @property
    def ADMIN_TABLE_OPTS(self):
        return [(0, 'No Table')] + c.TABLE_OPTS

    @property
    def PREREG_TABLE_OPTS(self):
        return [(count, '{}: ${}'.format(desc, c.TABLE_PRICES[count]))
              for count, desc in c.TABLE_OPTS]

    @property
    def POWER_PRICES(self):
        return defaultdict(
            lambda: config['power_prices'],
            {int(k): v for k, v in config['power_prices'].items()})

    @property
    def DEALER_POWER_OPTS(self):
        return [(0, 'No power'), (1, 'Default power')]

@@ -1823,12 +1823,1860 @@
 lt power')%5D%0A
+%0A    @property%0A    @dynamic%0A    def AT_THE_DOOR_BADGE_OPTS(self):%0A        %22%22%22%0A        This provides the dropdown on the /registration/register page with its%0A        list of badges available at-door.  It includes a %22Full Weekend Badge%22%0A        if attendee badges are available.  If one-days are enabled, it includes%0A        either a generic %22Single Day Badge%22 or a list of specific day badges,%0A        based on the c.PRESELL_ONE_DAYS setting.%0A        %22%22%22%0A        opts = %5B%5D%0A        if self.ATTENDEE_BADGE_AVAILABLE:%0A            opts.append((self.ATTENDEE_BADGE, 'Full Weekend Badge ($%7B%7D)'.format(self.BADGE_PRICE)))%0A        if self.SHINY_BADGE_AVAILABLE and c.SHINY_BADGE not in opts:%0A            opts.append(%0A                (c.SHINY_BADGE, '%7B%7D ($%7B%7D)'.format(self.BADGES%5Bc.SHINY_BADGE%5D, self.BADGE_TYPE_PRICES%5Bc.SHINY_BADGE%5D)))%0A        if self.SPONSOR_BADGE_AVAILABLE and c.SPONSOR_BADGE not in opts:%0A            opts.append((c.SPONSOR_BADGE,%0A                         '%7B%7D ($%7B%7D)'.format(self.BADGES%5Bc.SPONSOR_BADGE%5D, self.BADGE_TYPE_PRICES%5Bc.SPONSOR_BADGE%5D)))%0A        if self.ONE_DAYS_ENABLED:%0A            if self.PRESELL_ONE_DAYS:%0A                day = max(uber.utils.localized_now(), self.EPOCH)%0A                while day.date() %3C= self.ESCHATON.date():%0A                    day_name = day.strftime('%25A')%0A                    price = self.BADGE_PRICES%5B'single_day'%5D.get(day_name) or self.DEFAULT_SINGLE_DAY%0A                    badge = getattr(self, day_name.upper())%0A                    if getattr(self, day_name.upper() + '_AVAILABLE', None):%0A                        opts.append((badge, day_name + ' Badge ($%7B%7D)'.format(price)))%0A                    day += timedelta(days=1)%0A            elif self.ONE_DAY_BADGE_AVAILABLE:%0A                opts.append((self.ONE_DAY_BADGE, 'Single Day Badge ($%7B%7D)'.format(self.ONEDAY_BADGE_PRICE)))%0A        return opts%0A

Move MFF badge stock checks to mff-rams-plugin Fixes https://github.com/MidwestFurryFandom/rams/issues/279