From cfd2d3692dbca8a7041ec30d6c839b83eeda8cc3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 30 Jan 2021 13:25:14 -0600 Subject: [PATCH] Add reporting views/menu; link to mobile app also give mobile About page some proper content --- mobile/src/App.vue | 2 +- mobile/src/views/About.vue | 41 ++++++++++++++++++++++++++++++- theo/appsettings/theo.py | 20 +++++++++++++++ theo/web/menus.py | 26 +++++++++++++++++++- theo/web/templates/base_meta.mako | 5 ++++ theo/web/views/__init__.py | 1 + 6 files changed, 92 insertions(+), 3 deletions(-) diff --git a/mobile/src/App.vue b/mobile/src/App.vue index e0ab0a1..75b594d 100644 --- a/mobile/src/App.vue +++ b/mobile/src/App.vue @@ -6,7 +6,7 @@ {{ appsettings.appTitle}} {{ appsettings.version }}

- View Desktop Site + View Desktop App
diff --git a/mobile/src/views/About.vue b/mobile/src/views/About.vue index 3fa2807..fcddd08 100644 --- a/mobile/src/views/About.vue +++ b/mobile/src/views/About.vue @@ -1,5 +1,44 @@ + + + + diff --git a/theo/appsettings/theo.py b/theo/appsettings/theo.py index 00a3869..bd1ddb6 100644 --- a/theo/appsettings/theo.py +++ b/theo/appsettings/theo.py @@ -26,9 +26,11 @@ Theo app settings # bring in some common settings from rattail from rattail.settings import ( + Setting, # (General) rattail_app_title, + rattail_single_store, tailbone_background_color, # # DataSync @@ -50,6 +52,24 @@ from rattail.settings import ( rattail_batch_purchase_mobile_quick_receive, rattail_batch_purchase_mobile_quick_receive_all, + # Reporting + tailbone_reporting_choosing_uses_form, + # Vendors rattail_vendor_use_autocomplete, ) + + +############################## +# (General) +############################## + +class theo_link_to_mobile(Setting): + """ + If set, displays a link to Theo Mobile app, within main (desktop) app page + footer. + """ + group = "(General)" + namespace = 'theo' + name = 'link_to_mobile' + data_type = bool diff --git a/theo/web/menus.py b/theo/web/menus.py index 47c07b1..36e2734 100644 --- a/theo/web/menus.py +++ b/theo/web/menus.py @@ -178,6 +178,27 @@ def simple_menus(request): from tailbone_locsms.menus import make_locsms_menu locsms_menu = make_locsms_menu(request) + ############################## + # Reporting + ############################## + + reporting_menu = { + 'title': "Reporting", + 'type': 'menu', + 'items': [ + { + 'title': "New Report", + 'url': url('generate_report'), + 'perm': 'report_output.generate', + }, + { + 'title': "Generated Reports", + 'url': url('report_output'), + 'perm': 'report_output.list', + }, + ], + } + admin_menu = { 'title': "Admin", 'type': 'menu', @@ -256,6 +277,9 @@ def simple_menus(request): if include_locsms: menus.append(locsms_menu) - menus.append(admin_menu) + menus.extend([ + reporting_menu, + admin_menu, + ]) return menus diff --git a/theo/web/templates/base_meta.mako b/theo/web/templates/base_meta.mako index 8a1b17d..7d35b2a 100644 --- a/theo/web/templates/base_meta.mako +++ b/theo/web/templates/base_meta.mako @@ -14,4 +14,9 @@

${h.link_to("Theo {}{}".format(theo.__version__, '' if request.rattail_config.production() else '+dev'), url('about'))}

+ % if request.rattail_config.getbool('theo', 'link_to_mobile', default=False): +

+ ${h.link_to("View Mobile App", '/m/')} +

+ % endif diff --git a/theo/web/views/__init__.py b/theo/web/views/__init__.py index 3a3e987..2b9a511 100644 --- a/theo/web/views/__init__.py +++ b/theo/web/views/__init__.py @@ -43,6 +43,7 @@ def includeme(config): config.include('tailbone.views.email') config.include('tailbone.views.messages') config.include('tailbone.views.reportcodes') + config.include('tailbone.views.reports') config.include('tailbone.views.roles') config.include('tailbone.views.settings') config.include('tailbone.views.users')