Add more views, menus to default set

This commit is contained in:
Lance Edgar 2023-01-18 16:55:30 -06:00
parent e4c2336659
commit 23dea7bced
2 changed files with 231 additions and 87 deletions

View file

@ -259,6 +259,7 @@ class MenuHandler(GenericHandler):
is expected for most apps to override it. is expected for most apps to override it.
""" """
menus = [ menus = [
self.make_custorders_menu(request),
self.make_people_menu(request), self.make_people_menu(request),
self.make_products_menu(request), self.make_products_menu(request),
self.make_vendors_menu(request), self.make_vendors_menu(request),
@ -269,9 +270,9 @@ class MenuHandler(GenericHandler):
menus.extend(integration_menus) menus.extend(integration_menus)
menus.extend([ menus.extend([
# TODO: add reporting menu self.make_reports_menu(request, include_trainwreck=True),
self.make_batches_menu(request), self.make_batches_menu(request),
self.make_admin_menu(request), self.make_admin_menu(request, include_stores=True),
]) ])
return menus return menus
@ -288,6 +289,38 @@ class MenuHandler(GenericHandler):
menus.sort(key=lambda menu: menu['title'].lower()) menus.sort(key=lambda menu: menu['title'].lower())
return menus return menus
def make_custorders_menu(self, request, **kwargs):
"""
Generate a typical Customer Orders menu
"""
return {
'title': "Orders",
'type': 'menu',
'items': [
{
'title': "New Customer Order",
'route': 'custorders.create',
'perm': 'custorders.create',
},
{
'title': "All New Orders",
'route': 'new_custorders',
'perm': 'new_custorders.list',
},
{'type': 'sep'},
{
'title': "All Customer Orders",
'route': 'custorders',
'perm': 'custorders.list',
},
{
'title': "All Order Items",
'route': 'custorders.items',
'perm': 'custorders.items.list',
},
],
}
def make_people_menu(self, request, **kwargs): def make_people_menu(self, request, **kwargs):
""" """
Generate a typical People menu Generate a typical People menu
@ -321,6 +354,12 @@ class MenuHandler(GenericHandler):
'route': 'people', 'route': 'people',
'perm': 'people.list', 'perm': 'people.list',
}, },
{'type': 'sep'},
{
'title': "Pending Customers",
'route': 'pending_customers',
'perm': 'pending_customers.list',
},
], ],
} }
@ -362,6 +401,17 @@ class MenuHandler(GenericHandler):
'route': 'reportcodes', 'route': 'reportcodes',
'perm': 'reportcodes.list', 'perm': 'reportcodes.list',
}, },
{
'title': "Units of Measure",
'route': 'uoms',
'perm': 'uoms.list',
},
{'type': 'sep'},
{
'title': "Pending Products",
'route': 'pending_products',
'perm': 'pending_products.list',
},
], ],
} }
@ -400,12 +450,12 @@ class MenuHandler(GenericHandler):
'route': 'purchases.credits', 'route': 'purchases.credits',
'perm': 'purchases.credits.list', 'perm': 'purchases.credits.list',
}, },
# {'type': 'sep'}, {'type': 'sep'},
# { {
# 'title': "Catalogs", 'title': "Catalog Batches",
# 'route': 'vendorcatalogs', 'route': 'vendorcatalogs',
# 'perm': 'vendorcatalogs.list', 'perm': 'vendorcatalogs.list',
# }, },
], ],
} }
@ -422,11 +472,95 @@ class MenuHandler(GenericHandler):
'route': 'batch.handheld', 'route': 'batch.handheld',
'perm': 'batch.handheld.list', 'perm': 'batch.handheld.list',
}, },
# { {
# 'title': "Inventory", 'title': "Inventory",
# 'route': 'batch.inventory', 'route': 'batch.inventory',
# 'perm': 'batch.inventory.list', 'perm': 'batch.inventory.list',
# }, },
{
'title': "Import / Export",
'route': 'batch.importer',
'perm': 'batch.importer.list',
},
],
}
def make_reports_menu(self, request, **kwargs):
"""
Generate a typical Reports 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',
},
]
if kwargs.get('include_poser', False):
items.extend([
{'type': 'sep'},
{
'title': "Poser Reports",
'route': 'poser_reports',
'perm': 'poser_reports.list',
},
])
if kwargs.get('include_trainwreck', False):
items.extend([
{'type': 'sep'},
{
'title': "Trainwreck",
'route': 'trainwreck.transactions',
'perm': 'trainwreck.transactions.list',
},
])
return {
'title': "Reports",
'type': 'menu',
'items': items,
}
def make_tempmon_menu(self, request, **kwargs):
"""
Generate a typical TempMon menu
"""
return {
'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',
},
], ],
} }
@ -434,36 +568,35 @@ class MenuHandler(GenericHandler):
""" """
Generate a typical Admin menu Generate a typical Admin menu
""" """
return { items = []
'title': "Admin",
'type': 'menu', if kwargs.get('include_stores', True):
'items': [ items.extend([
{ {
'title': "Stores", 'title': "Stores",
'route': 'stores', 'route': 'stores',
'perm': 'stores.list', 'perm': 'stores.list',
}, },
{'type': 'sep'},
])
items.extend([
{ {
'title': "Users", 'title': "Users",
'route': 'users', 'route': 'users',
'perm': 'users.list', 'perm': 'users.list',
}, },
{
'title': "User Events",
'route': 'userevents',
'perm': 'userevents.list',
},
{ {
'title': "Roles", 'title': "Roles",
'route': 'roles', 'route': 'roles',
'perm': 'roles.list', 'perm': 'roles.list',
}, },
{'type': 'sep'},
{ {
'title': "App Settings", 'title': "Raw Permissions",
'route': 'appsettings', 'route': 'permissions',
'perm': 'settings.list', 'perm': 'permissions.list',
}, },
{'type': 'sep'},
{ {
'title': "Email Settings", 'title': "Email Settings",
'route': 'emailprofiles', 'route': 'emailprofiles',
@ -474,22 +607,17 @@ class MenuHandler(GenericHandler):
'route': 'email_attempts', 'route': 'email_attempts',
'perm': 'email_attempts.list', 'perm': 'email_attempts.list',
}, },
{
'title': "Raw Settings",
'route': 'settings',
'perm': 'settings.list',
},
{'type': 'sep'}, {'type': 'sep'},
{
'title': "DataSync Changes",
'route': 'datasyncchanges',
'perm': 'datasync_changes.list',
},
{ {
'title': "DataSync Status", 'title': "DataSync Status",
'route': 'datasync.status', 'route': 'datasync.status',
'perm': 'datasync.status', 'perm': 'datasync.status',
}, },
{
'title': "DataSync Changes",
'route': 'datasyncchanges',
'perm': 'datasync_changes.list',
},
{ {
'title': "Importing / Exporting", 'title': "Importing / Exporting",
'route': 'importing', 'route': 'importing',
@ -500,17 +628,28 @@ class MenuHandler(GenericHandler):
'route': 'luigi', 'route': 'luigi',
'perm': 'luigi.list', 'perm': 'luigi.list',
}, },
{'type': 'sep'},
{ {
'title': "App Details", 'title': "App Details",
'route': 'appinfo', 'route': 'appinfo',
'perm': 'appinfo.list', 'perm': 'appinfo.list',
}, },
{
'title': "Raw Settings",
'route': 'settings',
'perm': 'settings.list',
},
{ {
'title': "Upgrades", 'title': "Upgrades",
'route': 'upgrades', 'route': 'upgrades',
'perm': 'upgrades.list', 'perm': 'upgrades.list',
}, },
], ])
return {
'title': "Admin",
'type': 'menu',
'items': items,
} }

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar # Copyright © 2010-2023 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -30,12 +30,17 @@ from __future__ import unicode_literals, absolute_import
def includeme(config): def includeme(config):
config.include('tailbone.views.auth') config.include('tailbone.views.auth')
config.include('tailbone.views.common') config.include('tailbone.views.common')
config.include('tailbone.views.datasync')
config.include('tailbone.views.email') config.include('tailbone.views.email')
config.include('tailbone.views.importing')
config.include('tailbone.views.luigi')
config.include('tailbone.views.menus') config.include('tailbone.views.menus')
config.include('tailbone.views.people') config.include('tailbone.views.people')
config.include('tailbone.views.progress') config.include('tailbone.views.progress')
config.include('tailbone.views.reports')
config.include('tailbone.views.roles') config.include('tailbone.views.roles')
config.include('tailbone.views.settings') config.include('tailbone.views.settings')
config.include('tailbone.views.tables') config.include('tailbone.views.tables')
config.include('tailbone.views.upgrades') config.include('tailbone.views.upgrades')
config.include('tailbone.views.users') config.include('tailbone.views.users')
config.include('tailbone.views.views')