tailbone-corepos/tailbone_corepos/menus.py

213 lines
7.6 KiB
Python
Raw Normal View History

2020-09-16 16:15:05 -05:00
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
2023-01-14 19:06:32 -06:00
# Copyright © 2010-2023 Lance Edgar
2020-09-16 16:15:05 -05:00
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
"""
Common menus for CORE-POS
"""
2020-09-20 18:14:28 -05:00
from rattail_corepos.config import core_office_url
2020-09-16 16:15:05 -05:00
def make_corepos_menu(request):
corepos_menu = {
'title': "CORE-POS",
'type': 'menu',
'items': [
{
'title': "People",
'type': 'menu',
'items': [
{
'title': "Customers (Legacy)",
2023-01-14 19:06:32 -06:00
'route': 'corepos.customers',
'perm': 'corepos.customers.list',
},
{
'title': "Members (Legacy)",
2023-01-14 19:06:32 -06:00
'route': 'corepos.members',
'perm': 'corepos.members.list',
},
{
'title': "Suspensions",
2023-01-14 19:06:32 -06:00
'route': 'corepos.suspensions',
'perm': 'corepos.suspensions.list',
},
{
'title': "Member Types",
2023-01-14 19:06:32 -06:00
'route': 'corepos.member_types',
'perm': 'corepos.member_types.list',
},
{
'title': "Employees",
2023-01-14 19:06:32 -06:00
'route': 'corepos.employees',
'perm': 'corepos.employees.list',
},
{
'title': "Users",
2023-01-14 19:06:32 -06:00
'route': 'corepos.users',
'perm': 'corepos.users.list',
},
2022-01-17 19:00:41 -06:00
{
'title': "User Groups",
2023-01-14 19:06:32 -06:00
'route': 'corepos.user_groups',
2022-01-17 19:00:41 -06:00
'perm': 'corepos.user_groups.list',
},
],
2020-09-16 16:15:05 -05:00
},
{
'title': "Products",
'type': 'menu',
'items': [
{
'title': "Products",
2023-01-14 19:06:32 -06:00
'route': 'corepos.products',
'perm': 'corepos.products.list',
},
{
'title': "Product Flags",
2023-01-14 19:06:32 -06:00
'route': 'corepos.product_flags',
'perm': 'corepos.product_flags.list',
},
2021-05-04 20:11:46 -05:00
{
'title': "Like Codes",
2023-01-14 19:06:32 -06:00
'route': 'corepos.like_codes',
2021-05-04 20:11:46 -05:00
'perm': 'corepos.like_codes.list',
},
{
'title': "Scale Items",
2023-01-14 19:06:32 -06:00
'route': 'corepos.scale_items',
'perm': 'corepos.scale_items.list',
},
2021-10-14 22:31:48 -05:00
{
'title': "Origins",
2023-01-14 19:06:32 -06:00
'route': 'corepos.origins',
2021-10-14 22:31:48 -05:00
'perm': 'corepos.origins.list',
},
{'type': 'sep'},
{
'title': "Super Departments",
2023-01-14 19:06:32 -06:00
'route': 'corepos.super_departments',
'perm': 'corepos.super_departments.list',
},
{
'title': "Departments",
2023-01-14 19:06:32 -06:00
'route': 'corepos.departments',
'perm': 'corepos.departments.list',
},
{
'title': "Subdepartments",
2023-01-14 19:06:32 -06:00
'route': 'corepos.subdepartments',
'perm': 'corepos.subdepartments.list',
},
{'type': 'sep'},
{
'title': "Batches",
2023-01-14 19:06:32 -06:00
'route': 'corepos.batches',
'perm': 'corepos.batches.list',
},
{
'title': "Batch Types",
2023-01-14 19:06:32 -06:00
'route': 'corepos.batch_types',
'perm': 'corepos.batch_types.list',
},
],
2020-09-16 16:15:05 -05:00
},
{
'title': "Vendors",
'type': 'menu',
'items': [
{
'title': "Vendors",
2023-01-14 19:06:32 -06:00
'route': 'corepos.vendors',
'perm': 'corepos.vendors.list',
},
2021-02-02 12:01:51 -06:00
{
'title': "Vendor Items",
2023-01-14 19:06:32 -06:00
'route': 'corepos.vendor_items',
2021-02-02 12:01:51 -06:00
'perm': 'corepos.vendor_items.list',
},
2021-02-01 15:36:09 -06:00
{
'title': "Purchase Orders",
2023-01-14 19:06:32 -06:00
'route': 'corepos.purchase_orders',
2021-02-01 15:36:09 -06:00
'perm': 'corepos.purchase_orders.list',
},
],
},
{
'title': "Transactions",
'type': 'menu',
'items': [
{
'title': "Tax Rates",
2023-01-14 19:06:32 -06:00
'route': 'corepos.taxrates',
'perm': 'corepos.taxrates.list',
},
{
'title': "House Coupons",
2023-01-14 19:06:32 -06:00
'route': 'corepos.house_coupons',
'perm': 'corepos.house_coupons.list',
},
{
'title': "Transaction Details",
2023-01-14 19:06:32 -06:00
'route': 'corepos.transaction_details',
'perm': 'corepos.transaction_details.list',
},
],
},
{
'title': "Misc.",
'type': 'menu',
'items': [
{
'title': "Stores",
2023-01-14 19:06:32 -06:00
'route': 'corepos.stores',
'perm': 'corepos.stores.list',
},
{
'title': "Parameters",
2023-01-14 19:06:32 -06:00
'route': 'corepos.parameters',
'perm': 'corepos.parameters.list',
},
2021-08-02 08:56:23 -05:00
{
'title': "Table Sync Rules",
2023-01-14 19:06:32 -06:00
'route': 'corepos.table_sync_rules',
2021-08-02 08:56:23 -05:00
'perm': 'corepos.table_sync_rules.list',
},
],
},
2020-09-16 16:15:05 -05:00
],
}
2020-09-20 18:14:28 -05:00
office_url = core_office_url(request.rattail_config)
if office_url:
corepos_menu['items'].insert(
0, {
2020-09-20 18:14:28 -05:00
'title': "Go to CORE Office",
'url': '{}/'.format(office_url),
'target': '_blank',
})
corepos_menu['items'].insert(
1, {'type': 'sep'})
2020-09-20 18:14:28 -05:00
2020-09-16 16:15:05 -05:00
return corepos_menu