Coverage for .tox/coverage/lib/python3.11/site-packages/sideshow/web/menus.py: 100%
17 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-13 13:09 -0600
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-13 13:09 -0600
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# Sideshow -- Case/Special Order Tracker
5# Copyright © 2024 Lance Edgar
6#
7# This file is part of Sideshow.
8#
9# Sideshow is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# Sideshow is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with Sideshow. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Sideshow Menu
25"""
27from wuttaweb import menus as base
30class SideshowMenuHandler(base.MenuHandler):
31 """
32 Sideshow menu handler
33 """
35 def make_menus(self, request, **kwargs):
36 """ """
37 return [
38 self.make_orders_menu(request),
39 self.make_customers_menu(request),
40 self.make_products_menu(request),
41 self.make_batch_menu(request),
42 self.make_other_menu(request),
43 self.make_admin_menu(request),
44 ]
46 def make_orders_menu(self, request, **kwargs):
47 """
48 Generate the Orders menu.
49 """
50 return {
51 'title': "Orders",
52 'type': 'menu',
53 'items': [
54 {
55 'title': "Create New Order",
56 'route': 'orders.create',
57 'perm': 'orders.create',
58 },
59 {'type': 'sep'},
60 {
61 'title': "All Order Items",
62 'route': 'order_items',
63 'perm': 'order_items.list',
64 },
65 {
66 'title': "All Orders",
67 'route': 'orders',
68 'perm': 'orders.list',
69 },
70 ],
71 }
73 def make_customers_menu(self, request, **kwargs):
74 """
75 Generate the Customers menu.
76 """
77 return {
78 'title': "Customers",
79 'type': 'menu',
80 'items': [
81 {
82 'title': "Local Customers",
83 'route': 'local_customers',
84 'perm': 'local_customers.list',
85 },
86 {
87 'title': "Pending Customers",
88 'route': 'pending_customers',
89 'perm': 'pending_customers.list',
90 },
91 ],
92 }
94 def make_products_menu(self, request, **kwargs):
95 """
96 Generate the Products menu.
97 """
98 return {
99 'title': "Products",
100 'type': 'menu',
101 'items': [
102 {
103 'title': "Local Products",
104 'route': 'local_products',
105 'perm': 'local_products.list',
106 },
107 {
108 'title': "Pending Products",
109 'route': 'pending_products',
110 'perm': 'pending_products.list',
111 },
112 ],
113 }
115 def make_batch_menu(self, request, **kwargs):
116 """
117 Generate the Batch menu.
118 """
119 return {
120 'title': "Batches",
121 'type': 'menu',
122 'items': [
123 {
124 'title': "New Orders",
125 'route': 'neworder_batches',
126 'perm': 'neworder_batches.list',
127 },
128 ],
129 }
131 def make_other_menu(self, request, **kwargs):
132 """
133 Generate the "Other" menu.
134 """
135 return {
136 'title': "Other",
137 'type': 'menu',
138 'items': [],
139 }
141 def make_admin_menu(self, request, **kwargs):
142 """ """
143 kwargs['include_people'] = True
144 return super().make_admin_menu(request, **kwargs)