## -*- coding: utf-8; mode: python; -*-
# -*- coding: utf-8; -*-
"""
${name} Web Menus
"""


def simple_menus(request):
    url = request.route_url

    % if integrates_locsms:
    from tailbone_locsms.menus import make_locsms_menu
    locsms_menu = make_locsms_menu(request)
    % endif

    people_menu = {
        'title': "People",
        'type': 'menu',
        'items': [
            {
                'title': "Members",
                'url': url('members'),
                'perm': 'members.list',
            },
            {
                'title': "Customers",
                'url': url('customers'),
                'perm': 'customers.list',
            },
            {
                'title': "Customer Groups",
                'url': url('customergroups'),
                'perm': 'customergroups.list',
            },
            {
                'title': "Employees",
                'url': url('employees'),
                'perm': 'employees.list',
            },
            {
                'title': "All People",
                'url': url('people'),
                'perm': 'people.list',
            },
        ],
    }

    products_menu = {
        'title': "Products",
        'type': 'menu',
        'items': [
            {
                'title': "Products",
                'url': url('products'),
                'perm': 'products.list',
            },
            {
                'title': "Departments",
                'url': url('departments'),
                'perm': 'departments.list',
            },
            {
                'title': "Subdepartments",
                'url': url('subdepartments'),
                'perm': 'subdepartments.list',
            },
            {
                'title': "Brands",
                'url': url('brands'),
                'perm': 'brands.list',
            },
            {
                'title': "Families",
                'url': url('families'),
                'perm': 'families.list',
            },
            {
                'title': "Report Codes",
                'url': url('reportcodes'),
                'perm': 'reportcodes.list',
            },
        ],
    }

    vendors_menu = {
        'title': "Vendors",
        'type': 'menu',
        'items': [
            {
                'title': "Vendors",
                'url': url('vendors'),
                'perm': 'vendors.list',
            },
            {'type': 'sep'},
            {
                'title': "Ordering",
                'url': url('ordering'),
                'perm': 'ordering.list',
            },
            {
                'title': "Receiving",
                'url': url('receiving'),
                'perm': 'receiving.list',
            },
            {'type': 'sep'},
            {
                'title': "Purchases",
                'url': url('purchases'),
                'perm': 'purchases.list',
            },
            {
                'title': "Credits",
                'url': url('purchases.credits'),
                'perm': 'purchases.credits.list',
            },
            # {'type': 'sep'},
            # {
            #     'title': "Catalogs",
            #     'url': url('vendorcatalogs'),
            #     'perm': 'vendorcatalogs.list',
            # },
            # {
            #     'title': "Upload New Catalog",
            #     'url': url('vendorcatalogs.create'),
            #     'perm': 'vendorcatalogs.create',
            # },
            ],
    }

    % if integrates_catapult:
    catapult_menu = {
        'title': "Catapult",
        'type': 'menu',
        'items': [
            {
                'title': "Departments",
                'url': url('catapult.departments'),
                'perm': 'catapult.departments.list',
            },
            {
                'title': "Terminals",
                'url': url('catapult.terminals'),
                'perm': 'catapult.terminals.list',
            },
            {
                'title': "Transactions",
                'url': url('catapult.transactions'),
                'perm': 'catapult.transactions.list',
            },
            {
                'title': "Worksheets",
                'url': url('catapult.worksheets'),
                'perm': 'catapult.worksheets.list',
            },
            {'type': 'sep'},
            {
                'title': "Security Profiles",
                'url': url('catapult.security_profiles'),
                'perm': 'catapult.security_profiles.view',
            },
            {
                'title': "Master Functions",
                'url': url('catapult.master_functions'),
                'perm': 'catapult.master_functions.view',
            },
        ],
    }
    % endif

    batches_menu = {
        'title': "Batches",
        'type': 'menu',
        'items': [
            {
                'title': "Handheld",
                'url': url('batch.handheld'),
                'perm': 'batch.handheld.list',
            },
            # {
            #     'title': "Inventory",
            #     'url': url('batch.inventory'),
            #     'perm': 'batch.inventory.list',
            # },
            ],
    }

    admin_menu = {
        'title': "Admin",
        'type': 'menu',
        'items': [
            {
                'title': "Stores",
                'url': url('stores'),
                'perm': 'stores.list',
            },
            {
                'title': "Users",
                'url': url('users'),
                'perm': 'users.list',
            },
            {
                'title': "User Events",
                'url': url('userevents'),
                'perm': 'userevents.list',
            },
            {
                'title': "Roles",
                'url': url('roles'),
                'perm': 'roles.list',
            },
            {'type': 'sep'},
            {
                'title': "App Settings",
                'url': url('appsettings'),
                'perm': 'settings.list',
            },
            {
                'title': "Email Settings",
                'url': url('emailprofiles'),
                'perm': 'emailprofiles.list',
            },
            {
                'title': "Email Attempts",
                'url': url('email_attempts'),
                'perm': 'email_attempts.list',
            },
            {
                'title': "Raw Settings",
                'url': url('settings'),
                'perm': 'settings.list',
            },
            {'type': 'sep'},
            % if has_datasync:
            {
                'title': "DataSync Changes",
                'url': url('datasyncchanges'),
                'perm': 'datasync.list',
            },
            % endif
            {
                'title': "Tables",
                'url': url('tables'),
                'perm': 'tables.list',
            },
            {
                'title': "${name} Upgrades",
                'url': url('upgrades'),
                'perm': 'upgrades.list',
            },
        ],
    }

    menus = [
        people_menu,
        products_menu,
        vendors_menu,
        % if integrates_catapult:
        catapult_menu,
        % endif
        % if integrates_locsms:
        locsms_menu,
        % endif
        batches_menu,
        admin_menu,
    ]

    return menus
