rattail-demo/rattail_demo/web/menus.py

350 lines
10 KiB
Python
Raw Normal View History

# -*- coding: utf-8; -*-
"""
Web Menus
"""
2023-01-14 16:13:58 -06:00
from tailbone import menus as base
2020-09-16 16:15:53 -05:00
from tailbone_corepos.menus import make_corepos_menu
2023-01-14 16:13:58 -06:00
class DemoMenuHandler(base.MenuHandler):
"""
Demo menu handler
"""
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
def make_menus(self, request, **kwargs):
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
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',
},
],
}
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
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',
},
],
}
2023-01-14 16:13:58 -06:00
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',
},
],
}
2020-09-16 16:15:53 -05:00
2023-01-14 16:13:58 -06:00
corepos_menu = make_corepos_menu(request)
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
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',
},
],
}
2023-01-14 16:13:58 -06:00
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',
},
],
}
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
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',
},
],
}
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
trainwreck_menu = {
'title': "Trainwreck",
'type': 'menu',
'items': [
{
'title': "Transactions",
'route': 'trainwreck.transactions',
'perm': 'trainwreck.transactions.list',
},
],
}
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
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',
},
],
}
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
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',
},
],
}
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
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',
},
],
}
2023-01-14 16:13:58 -06:00
menus = [
people_menu,
products_menu,
vendors_menu,
corepos_menu,
shopfoo_menu,
reporting_menu,
batch_menu,
]
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
if self.config.trainwreck_engine:
menus.append(trainwreck_menu)
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
menus.extend([
tempmon_menu,
other_menu,
admin_menu,
])
return menus