bug fix: added contracting work support on products

legacy
Steve L. Nyemba 4 years ago
parent f3b31fe7b4
commit 5a201bddf7

@ -84,7 +84,7 @@ img {width:48px}
margin-left:10%;
margin-right:10%;
height:70%;
height:85%;
align-content:center;
}
.footer {
@ -104,6 +104,6 @@ img {width:48px}
grid-template-columns: auto 32px;
grid-gap:2px;
font-size:24px; font-family:verdana; text-transform: capitalize; border-bottom:1px solid #CAD5E0; }
.plan .feature {display:grid; grid-template-columns: 60% 40%; grid-gap:2px; margin:2px;}
.plan .feature {display:grid; grid-template-columns: 60% 40%; grid-gap:2px; margin:4px;}
.plan .feature .label {text-transform: uppercase; grid-column:1; font-size:14px;}
.plan .feature .status {font-size:20px; text-align: right; font-size:14px;}
.plan .feature .status {font-size:14px; text-align: right; }

@ -308,7 +308,7 @@ class Plans(Store) :
This function will retrieve plan information associated with the given product id
"""
Store.__init__(self,**args)
contract = {"nickname":"Enterprise","metadata":{}}
info = stripe.price.Price.list(product=self.product['id']).data
self.plans = []
self.checkout = []
@ -322,6 +322,11 @@ class Plans(Store) :
self.plans.append(_item)
if 'features' in item.metadata :
_item['metadata']['features'] = json.loads(item.metadata['features'])
if 'contract' in self.product['metadata'] and not contract['metadata']:
contract['metadata']={'features':{}}
for feature_key in _item['metadata']['features'] :
contract['metadata']['features'][feature_key] = 1
else:
_item['metadata']['features'] = {}
# self.plans.append(_item)
@ -332,6 +337,9 @@ class Plans(Store) :
# elif self.plans
self.plans.sort(key=lambda item: item['unit_amount'])
self.checkout.sort(key=lambda item:item['unit_amount'])
if contract['metadata'] :
self.plans.append(contract)
if 'email' in args :
self.user = User(args['email'],self.plans)
else:

@ -114,7 +114,6 @@
httpclient.setHeader("Content-Type","application/json")
httpclient.setData(JSON.stringify(info) )
httpclient.post('{{context|safe}}/store',function(x){})
if (data.unit_amount == 0|| data.amount == 0){
//
// We should not be prompting the user but automatically logging her into her session
@ -283,9 +282,10 @@ $(document).ready(function(){
{% else %}
<div></div>
{% endif %}
{% if 'unit_amount' in item %}
{% if item.unit_amount == 0%}
<div class="default">
<span class="bold">Free</span>
<span class="bold"></span>
</div>
{%else%}
@ -295,13 +295,17 @@ $(document).ready(function(){
/ <span class="small">{{item.recurring.interval[:]}}</span>
</div>
{% endif %}
{% else %}
<div>
</div>
{% endif %}
</div>
<div class="">
{% for key,value in item.metadata['features'].items() %}
<div class="feature">
<div class="label">{{ key }}</div>
<div class="label">{{ key.replace('_',' ') }}</div>
{% if value == True %}
<div class="status"><i class="fas fa-check"></i></div>
{% elif value == False %}
@ -316,6 +320,8 @@ $(document).ready(function(){
<div align="right" class="border-top">
<p>
{% if 'unit_amount' in item %}
<div align="center" style="width:50%; margin-right:25%;" class="button action" data='{{item|tojson|safe}}' onclick="signup_form( {{loop.index-1}} , this )">
<div>Signup Now</div>
@ -332,6 +338,12 @@ $(document).ready(function(){
</div>
{% endif %}
</div>
{% else %}
<div align="center" style="display:grid; height:32px; align-items:center; width:50%; margin-right:25%;" class="button action" data='{{item|tojson|safe}}' onclick="window.location.href='mailto:info@the-phi.com?subject=Inquiery about {{product.name}}::Parser {{item.nickname|safe}}'">
<div>Contact Us</div>
</div>
{% endif %}
</p>

Loading…
Cancel
Save