350 lines
10 KiB
Python
350 lines
10 KiB
Python
# -*- coding: utf-8; -*-
|
|
"""
|
|
Web Menus
|
|
"""
|
|
|
|
from tailbone import menus as base
|
|
from tailbone_corepos.menus import make_corepos_menu
|
|
|
|
|
|
class DemoMenuHandler(base.MenuHandler):
|
|
"""
|
|
Demo menu handler
|
|
"""
|
|
|
|
def make_menus(self, request, **kwargs):
|
|
|
|
people_menu = {
|
|
'title': "People",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Members",
|
|
'route': 'members',
|
|
'perm': 'members.list',
|
|
},
|
|
{
|
|
'title': "Customers",
|
|
'route': 'customers',
|
|
'perm': 'customers.list',
|
|
},
|
|
{
|
|
'title': "Employees",
|
|
'route': 'employees',
|
|
'perm': 'employees.list',
|
|
},
|
|
{
|
|
'title': "All People",
|
|
'route': 'people',
|
|
'perm': 'people.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
products_menu = {
|
|
'title': "Products",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Products",
|
|
'route': 'products',
|
|
'perm': 'products.list',
|
|
},
|
|
{
|
|
'title': "Departments",
|
|
'route': 'departments',
|
|
'perm': 'departments.list',
|
|
},
|
|
{
|
|
'title': "Subdepartments",
|
|
'route': 'subdepartments',
|
|
'perm': 'subdepartments.list',
|
|
},
|
|
{
|
|
'title': "Brands",
|
|
'route': 'brands',
|
|
'perm': 'brands.list',
|
|
},
|
|
{
|
|
'title': "Families",
|
|
'route': 'families',
|
|
'perm': 'families.list',
|
|
},
|
|
{
|
|
'title': "Report Codes",
|
|
'route': 'reportcodes',
|
|
'perm': 'reportcodes.list',
|
|
},
|
|
{
|
|
'title': "Units of Measure",
|
|
'route': 'uoms',
|
|
'perm': 'uoms.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
vendors_menu = {
|
|
'title': "Vendors",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Vendors",
|
|
'route': 'vendors',
|
|
'perm': 'vendors.list',
|
|
},
|
|
{'type': 'sep'},
|
|
{
|
|
'title': "Ordering",
|
|
'route': 'ordering',
|
|
'perm': 'ordering.list',
|
|
},
|
|
{
|
|
'title': "Receiving",
|
|
'route': 'receiving',
|
|
'perm': 'receiving.list',
|
|
},
|
|
{'type': 'sep'},
|
|
{
|
|
'title': "Purchases",
|
|
'route': 'purchases',
|
|
'perm': 'purchases.list',
|
|
},
|
|
{
|
|
'title': "Credits",
|
|
'route': 'purchases.credits',
|
|
'perm': 'purchases.credits.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
corepos_menu = make_corepos_menu(request)
|
|
|
|
shopfoo_menu = {
|
|
'title': "Shopfoo",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Products",
|
|
'route': 'shopfoo.products',
|
|
'perm': 'shopfoo.products.list',
|
|
},
|
|
{
|
|
'title': "Product Exports",
|
|
'route': 'shopfoo.product_exports',
|
|
'perm': 'shopfoo.product_exports.list',
|
|
},
|
|
{'type': 'sep'},
|
|
{
|
|
'title': "WooCommerce Products",
|
|
'route': 'woocommerce.products',
|
|
'perm': 'woocommerce.products.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
reporting_menu = {
|
|
'title': "Reporting",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "New Report",
|
|
'route': 'report_output.create',
|
|
'perm': 'report_output.create',
|
|
},
|
|
{
|
|
'title': "Generated Reports",
|
|
'route': 'report_output',
|
|
'perm': 'report_output.list',
|
|
},
|
|
{
|
|
'title': "Problem Reports",
|
|
'route': 'problem_reports',
|
|
'perm': 'problem_reports.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
batch_menu = {
|
|
'title': "Batches",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Handheld",
|
|
'route': 'batch.handheld',
|
|
'perm': 'batch.handheld.list',
|
|
},
|
|
{
|
|
'title': "Inventory",
|
|
'route': 'batch.inventory',
|
|
'perm': 'batch.inventory.list',
|
|
},
|
|
{
|
|
'title': "Import / Export",
|
|
'route': 'batch.importer',
|
|
'perm': 'batch.importer.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
trainwreck_menu = {
|
|
'title': "Trainwreck",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Transactions",
|
|
'route': 'trainwreck.transactions',
|
|
'perm': 'trainwreck.transactions.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
tempmon_menu = {
|
|
'title': "TempMon",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Appliances",
|
|
'route': 'tempmon.appliances',
|
|
'perm': 'tempmon.appliances.list',
|
|
},
|
|
{
|
|
'title': "Clients",
|
|
'route': 'tempmon.clients',
|
|
'perm': 'tempmon.clients.list',
|
|
},
|
|
{
|
|
'title': "Probes",
|
|
'route': 'tempmon.probes',
|
|
'perm': 'tempmon.probes.list',
|
|
},
|
|
{
|
|
'title': "Readings",
|
|
'route': 'tempmon.readings',
|
|
'perm': 'tempmon.readings.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
other_menu = {
|
|
'title': "Other",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Documentation",
|
|
'url': 'https://rattailproject.org/moin/RattailDemo',
|
|
'target': '_blank',
|
|
},
|
|
{
|
|
'title': "Source Code",
|
|
'url': 'https://kallithea.rattailproject.org/rattail-project/rattail-demo',
|
|
'target': '_blank',
|
|
},
|
|
{
|
|
'title': "RattailProject.org",
|
|
'url': 'https://rattailproject.org',
|
|
'target': '_blank',
|
|
},
|
|
{'type': 'sep'},
|
|
{
|
|
'title': "Generate New Project",
|
|
'route': 'generate_project',
|
|
'perm': 'common.generate_project',
|
|
},
|
|
],
|
|
}
|
|
|
|
admin_menu = {
|
|
'title': "Admin",
|
|
'type': 'menu',
|
|
'items': [
|
|
{
|
|
'title': "Stores",
|
|
'route': 'stores',
|
|
'perm': 'stores.list',
|
|
},
|
|
{
|
|
'title': "Users",
|
|
'route': 'users',
|
|
'perm': 'users.list',
|
|
},
|
|
{
|
|
'title': "User Events",
|
|
'route': 'userevents',
|
|
'perm': 'userevents.list',
|
|
},
|
|
{
|
|
'title': "Roles",
|
|
'route': 'roles',
|
|
'perm': 'roles.list',
|
|
},
|
|
{'type': 'sep'},
|
|
{
|
|
'title': "App Settings",
|
|
'route': 'appsettings',
|
|
'perm': 'settings.list',
|
|
},
|
|
{
|
|
'title': "Email Settings",
|
|
'route': 'emailprofiles',
|
|
'perm': 'emailprofiles.list',
|
|
},
|
|
{
|
|
'title': "Email Attempts",
|
|
'route': 'email_attempts',
|
|
'perm': 'email_attempts.list',
|
|
},
|
|
{
|
|
'title': "Raw Settings",
|
|
'route': 'settings',
|
|
'perm': 'settings.list',
|
|
},
|
|
{'type': 'sep'},
|
|
{
|
|
'title': "DataSync Changes",
|
|
'route': 'datasyncchanges',
|
|
'perm': 'datasync_changes.list',
|
|
},
|
|
{
|
|
'title': "DataSync Status",
|
|
'route': 'datasync.status',
|
|
'perm': 'datasync.status',
|
|
},
|
|
{
|
|
'title': "Luigi Tasks",
|
|
'route': 'luigi',
|
|
'perm': 'luigi.list',
|
|
},
|
|
{
|
|
'title': "Tables",
|
|
'route': 'tables',
|
|
'perm': 'tables.list',
|
|
},
|
|
{
|
|
'title': "Upgrades",
|
|
'route': 'upgrades',
|
|
'perm': 'upgrades.list',
|
|
},
|
|
],
|
|
}
|
|
|
|
menus = [
|
|
people_menu,
|
|
products_menu,
|
|
vendors_menu,
|
|
corepos_menu,
|
|
shopfoo_menu,
|
|
reporting_menu,
|
|
batch_menu,
|
|
]
|
|
|
|
if self.config.trainwreck_engine:
|
|
menus.append(trainwreck_menu)
|
|
|
|
menus.extend([
|
|
tempmon_menu,
|
|
other_menu,
|
|
admin_menu,
|
|
])
|
|
|
|
return menus
|