fix: make the Members tab optional, for profile view
and hidden by default
This commit is contained in:
parent
2917463bb6
commit
2f2ebd0f07
|
@ -37,6 +37,14 @@
|
||||||
<h3 class="block is-size-3">Profile View</h3>
|
<h3 class="block is-size-3">Profile View</h3>
|
||||||
<div class="block" style="padding-left: 2rem; width: 50%;">
|
<div class="block" style="padding-left: 2rem; width: 50%;">
|
||||||
|
|
||||||
|
<b-field>
|
||||||
|
<b-checkbox name="tailbone.people.profile.expose_members"
|
||||||
|
v-model="simpleSettings['tailbone.people.profile.expose_members']"
|
||||||
|
native-value="true"
|
||||||
|
@input="settingsNeedSaved = true">
|
||||||
|
Show tab for Member Accounts
|
||||||
|
</b-checkbox>
|
||||||
|
</b-field>
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="tailbone.people.profile.expose_transactions"
|
<b-checkbox name="tailbone.people.profile.expose_transactions"
|
||||||
v-model="simpleSettings['tailbone.people.profile.expose_transactions']"
|
v-model="simpleSettings['tailbone.people.profile.expose_transactions']"
|
||||||
|
|
|
@ -819,6 +819,7 @@
|
||||||
</${b}-tab-item>
|
</${b}-tab-item>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
% if expose_members:
|
||||||
<%def name="render_member_tab_template()">
|
<%def name="render_member_tab_template()">
|
||||||
<script type="text/x-template" id="member-tab-template">
|
<script type="text/x-template" id="member-tab-template">
|
||||||
<div>
|
<div>
|
||||||
|
@ -961,6 +962,7 @@
|
||||||
</member-tab>
|
</member-tab>
|
||||||
</${b}-tab-item>
|
</${b}-tab-item>
|
||||||
</%def>
|
</%def>
|
||||||
|
% endif
|
||||||
|
|
||||||
<%def name="render_customer_tab_template()">
|
<%def name="render_customer_tab_template()">
|
||||||
<script type="text/x-template" id="customer-tab-template">
|
<script type="text/x-template" id="customer-tab-template">
|
||||||
|
@ -1827,7 +1829,11 @@
|
||||||
|
|
||||||
<%def name="render_profile_tabs()">
|
<%def name="render_profile_tabs()">
|
||||||
${self.render_personal_tab()}
|
${self.render_personal_tab()}
|
||||||
${self.render_member_tab()}
|
|
||||||
|
% if expose_members:
|
||||||
|
${self.render_member_tab()}
|
||||||
|
% endif
|
||||||
|
|
||||||
${self.render_customer_tab()}
|
${self.render_customer_tab()}
|
||||||
% if expose_customer_shoppers:
|
% if expose_customer_shoppers:
|
||||||
${self.render_shopper_tab()}
|
${self.render_shopper_tab()}
|
||||||
|
@ -1965,7 +1971,11 @@
|
||||||
<%def name="render_this_page_template()">
|
<%def name="render_this_page_template()">
|
||||||
${parent.render_this_page_template()}
|
${parent.render_this_page_template()}
|
||||||
${self.render_personal_tab_template()}
|
${self.render_personal_tab_template()}
|
||||||
${self.render_member_tab_template()}
|
|
||||||
|
% if expose_members:
|
||||||
|
${self.render_member_tab_template()}
|
||||||
|
% endif
|
||||||
|
|
||||||
${self.render_customer_tab_template()}
|
${self.render_customer_tab_template()}
|
||||||
% if expose_customer_shoppers:
|
% if expose_customer_shoppers:
|
||||||
${self.render_shopper_tab_template()}
|
${self.render_shopper_tab_template()}
|
||||||
|
@ -2385,6 +2395,7 @@
|
||||||
</script>
|
</script>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
% if expose_members:
|
||||||
<%def name="declare_member_tab_vars()">
|
<%def name="declare_member_tab_vars()">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
@ -2430,6 +2441,7 @@
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</%def>
|
</%def>
|
||||||
|
% endif
|
||||||
|
|
||||||
<%def name="declare_customer_tab_vars()">
|
<%def name="declare_customer_tab_vars()">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -3159,7 +3171,11 @@
|
||||||
<%def name="make_this_page_component()">
|
<%def name="make_this_page_component()">
|
||||||
${parent.make_this_page_component()}
|
${parent.make_this_page_component()}
|
||||||
${self.make_personal_tab_component()}
|
${self.make_personal_tab_component()}
|
||||||
${self.make_member_tab_component()}
|
|
||||||
|
% if expose_members:
|
||||||
|
${self.make_member_tab_component()}
|
||||||
|
% endif
|
||||||
|
|
||||||
${self.make_customer_tab_component()}
|
${self.make_customer_tab_component()}
|
||||||
% if expose_customer_shoppers:
|
% if expose_customer_shoppers:
|
||||||
${self.make_shopper_tab_component()}
|
${self.make_shopper_tab_component()}
|
||||||
|
|
|
@ -488,6 +488,7 @@ class PersonView(MasterView):
|
||||||
'expose_customer_shoppers': self.customers_should_expose_shoppers(),
|
'expose_customer_shoppers': self.customers_should_expose_shoppers(),
|
||||||
'max_one_member': app.get_membership_handler().max_one_per_person(),
|
'max_one_member': app.get_membership_handler().max_one_per_person(),
|
||||||
'use_preferred_first_name': self.people_handler.should_use_preferred_first_name(),
|
'use_preferred_first_name': self.people_handler.should_use_preferred_first_name(),
|
||||||
|
'expose_members': self.should_expose_profile_members(),
|
||||||
'expose_transactions': self.should_expose_profile_transactions(),
|
'expose_transactions': self.should_expose_profile_transactions(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,6 +500,10 @@ class PersonView(MasterView):
|
||||||
|
|
||||||
return self.render_to_response('view_profile', context)
|
return self.render_to_response('view_profile', context)
|
||||||
|
|
||||||
|
def should_expose_profile_members(self):
|
||||||
|
return self.rattail_config.get_bool('tailbone.people.profile.expose_members',
|
||||||
|
default=False)
|
||||||
|
|
||||||
def should_expose_profile_transactions(self):
|
def should_expose_profile_transactions(self):
|
||||||
return self.rattail_config.get_bool('tailbone.people.profile.expose_transactions',
|
return self.rattail_config.get_bool('tailbone.people.profile.expose_transactions',
|
||||||
default=False)
|
default=False)
|
||||||
|
@ -585,7 +590,6 @@ class PersonView(MasterView):
|
||||||
|
|
||||||
def get_context_tabchecks(self, person):
|
def get_context_tabchecks(self, person):
|
||||||
app = self.get_rattail_app()
|
app = self.get_rattail_app()
|
||||||
membership = app.get_membership_handler()
|
|
||||||
clientele = app.get_clientele_handler()
|
clientele = app.get_clientele_handler()
|
||||||
tabchecks = {}
|
tabchecks = {}
|
||||||
|
|
||||||
|
@ -596,12 +600,14 @@ class PersonView(MasterView):
|
||||||
tabchecks['personal'] = True
|
tabchecks['personal'] = True
|
||||||
|
|
||||||
# member
|
# member
|
||||||
if membership.max_one_per_person():
|
if self.should_expose_profile_members():
|
||||||
member = app.get_member(person)
|
membership = app.get_membership_handler()
|
||||||
tabchecks['member'] = bool(member and member.active)
|
if membership.max_one_per_person():
|
||||||
else:
|
member = app.get_member(person)
|
||||||
members = membership.get_members_for_account_holder(person)
|
tabchecks['member'] = bool(member and member.active)
|
||||||
tabchecks['member'] = any([m.active for m in members])
|
else:
|
||||||
|
members = membership.get_members_for_account_holder(person)
|
||||||
|
tabchecks['member'] = any([m.active for m in members])
|
||||||
|
|
||||||
# customer
|
# customer
|
||||||
customers = clientele.get_customers_for_account_holder(person)
|
customers = clientele.get_customers_for_account_holder(person)
|
||||||
|
@ -1696,6 +1702,9 @@ class PersonView(MasterView):
|
||||||
|
|
||||||
|
|
||||||
# Profile View
|
# Profile View
|
||||||
|
{'section': 'tailbone',
|
||||||
|
'option': 'people.profile.expose_members',
|
||||||
|
'type': bool},
|
||||||
{'section': 'tailbone',
|
{'section': 'tailbone',
|
||||||
'option': 'people.profile.expose_transactions',
|
'option': 'people.profile.expose_transactions',
|
||||||
'type': bool},
|
'type': bool},
|
||||||
|
|
Loading…
Reference in a new issue