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-left:10%;
margin-right:10%; margin-right:10%;
height:70%; height:85%;
align-content:center; align-content:center;
} }
.footer { .footer {
@ -104,6 +104,6 @@ img {width:48px}
grid-template-columns: auto 32px; grid-template-columns: auto 32px;
grid-gap:2px; grid-gap:2px;
font-size:24px; font-family:verdana; text-transform: capitalize; border-bottom:1px solid #CAD5E0; } 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 .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 This function will retrieve plan information associated with the given product id
""" """
Store.__init__(self,**args) Store.__init__(self,**args)
contract = {"nickname":"Enterprise","metadata":{}}
info = stripe.price.Price.list(product=self.product['id']).data info = stripe.price.Price.list(product=self.product['id']).data
self.plans = [] self.plans = []
self.checkout = [] self.checkout = []
@ -322,6 +322,11 @@ class Plans(Store) :
self.plans.append(_item) self.plans.append(_item)
if 'features' in item.metadata : if 'features' in item.metadata :
_item['metadata']['features'] = json.loads(item.metadata['features']) _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: else:
_item['metadata']['features'] = {} _item['metadata']['features'] = {}
# self.plans.append(_item) # self.plans.append(_item)
@ -332,6 +337,9 @@ class Plans(Store) :
# elif self.plans # elif self.plans
self.plans.sort(key=lambda item: item['unit_amount']) self.plans.sort(key=lambda item: item['unit_amount'])
self.checkout.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 : if 'email' in args :
self.user = User(args['email'],self.plans) self.user = User(args['email'],self.plans)
else: else:

@ -114,7 +114,6 @@
httpclient.setHeader("Content-Type","application/json") httpclient.setHeader("Content-Type","application/json")
httpclient.setData(JSON.stringify(info) ) httpclient.setData(JSON.stringify(info) )
httpclient.post('{{context|safe}}/store',function(x){}) httpclient.post('{{context|safe}}/store',function(x){})
if (data.unit_amount == 0|| data.amount == 0){ if (data.unit_amount == 0|| data.amount == 0){
// //
// We should not be prompting the user but automatically logging her into her session // We should not be prompting the user but automatically logging her into her session
@ -283,25 +282,30 @@ $(document).ready(function(){
{% else %} {% else %}
<div></div> <div></div>
{% endif %} {% endif %}
{% if item.unit_amount == 0%} {% if 'unit_amount' in item %}
<div class="default"> {% if item.unit_amount == 0%}
<span class="bold">Free</span> <div class="default">
</div> <span class="bold"></span>
</div>
{%else%}
<div class="default" > {%else%}
<div class="default" >
<span class="bold">$ {{ item.unit_amount/100 }}</span>
/ <span class="small">{{item.recurring.interval[:]}}</span> <span class="bold">$ {{ item.unit_amount/100 }}</span>
/ <span class="small">{{item.recurring.interval[:]}}</span>
</div> </div>
{% endif %} {% endif %}
{% else %}
<div>
</div>
{% endif %}
</div> </div>
<div class=""> <div class="">
{% for key,value in item.metadata['features'].items() %} {% for key,value in item.metadata['features'].items() %}
<div class="feature"> <div class="feature">
<div class="label">{{ key }}</div> <div class="label">{{ key.replace('_',' ') }}</div>
{% if value == True %} {% if value == True %}
<div class="status"><i class="fas fa-check"></i></div> <div class="status"><i class="fas fa-check"></i></div>
{% elif value == False %} {% elif value == False %}
@ -316,22 +320,30 @@ $(document).ready(function(){
<div align="right" class="border-top"> <div align="right" class="border-top">
<p> <p>
<div align="center" style="width:50%; margin-right:25%;" class="button action" data='{{item|tojson|safe}}' onclick="signup_form( {{loop.index-1}} , this )"> {% if 'unit_amount' in item %}
<div>Signup Now</div>
<div align="center" style="width:50%; margin-right:25%;" class="button action" data='{{item|tojson|safe}}' onclick="signup_form( {{loop.index-1}} , this )">
{% if item.unit_amount == 0 %} <div>Signup Now</div>
<div class="small text">
<span class="bold">Free</span> {% if item.unit_amount == 0 %}
</div> <div class="small text">
<span class="bold">Free</span>
{%else%} </div>
<div class="small text" >
<span class="bold">$ {{ item.unit_amount/100 }}</span> {%else%}
/ <span >{{item.recurring.interval[:]}}</span> <div class="small text" >
<span class="bold">$ {{ item.unit_amount/100 }}</span>
/ <span >{{item.recurring.interval[:]}}</span>
</div>
{% endif %}
</div>
{% else %}
</div> <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}}'">
{% endif %} <div>Contact Us</div>
</div> </div>
{% endif %}
</p> </p>

Loading…
Cancel
Save