Finished responsive issues

This commit is contained in:
Levi 2016-12-19 09:33:15 -05:00
parent 06d03bbe90
commit 3da05e8025
12 changed files with 89 additions and 32 deletions

View file

@ -27,22 +27,42 @@ $( document ).ready(function() {
//Acept term and conditions button
var hasCreditcard = window.hasCreditcard;
console.log("has creditcard");
console.log("has creditcard");
console.log("has creditcard");
var submit_form_btn = $('#payment_button');
submit_form_btn.on('click', submit_payment);
function submit_payment(e){
e.preventDefault();
if (hasCreditcard) {
$('#billing-form').submit();
}
else  {
$('#payment-form').submit();
}
// $form.submit();
}
var $form = $('#payment-form');
$form.submit(payWithStripe);
/* If you're using Stripe for payments */
function payWithStripe(e) {
console.log("submiting");
console.log("token");
console.log("token");
// console.log("token", token);
e.preventDefault();
if (!$('.agree-terms').is(':checked')){

View file

@ -18,7 +18,7 @@
<h2 class="member-name">2016.11.13-2016.12.13</h2>
<hr class="greyline-long">
<h2 class="order-head">Booking history</h2>
<table class="table">
<table class="table" style="overflow-x:auto;">
<thead>
<tr>
<th>#</th>

View file

@ -212,4 +212,12 @@
{%endif%}
{% if credit_card_data.last4 and credit_card_data.cc_brand %}
<script type="text/javascript">
(function () {window.hasCreditcard = true;})();
</script>
{%endif%}
{% endblock %}

View file

@ -4,6 +4,20 @@
{% block content %}
<style type="text/css">
@media screen and (max-width: 600px) {
#timeline{
display: none;
}
h2 {font-size: 2em !important;}
}
</style>
<!-- Header -->
<header class="history">
<div class="container header-history">
@ -81,7 +95,7 @@
<!-- Half Page Image Background Carousel -->
<section>
<div>
<div id="timeline">
<iframe frameborder="0" width="100%" height="650" src="//cdn.knightlab.com/libs/timeline3/latest/embed/index.html?source=15clFd1fjnVScVziBlF-X7j5M7V6uNFt9jt9QZVylaYI&amp;font=Default&amp;lang=en&amp;initial_zoom=2&amp;height=650" width="100%"></iframe>
</div>

View file

@ -6,12 +6,12 @@
@media only screen and (max-width: 320px) {
body { font-size: 2em; }
/*body { font-size: 2em; }*/
h2.section-heading {font-size: 2em !important;}
}
h2 {text-transform: lowercase;}
</style>
<!-- Header -->
@ -33,6 +33,8 @@ h2 {text-transform: lowercase;}
{% endif %}
<hr class="greyline-long">
<h2 class="order-head">Orders history</h2>
<div style="overflow-x:auto;">
<table class="table" >
<thead>
<tr>
@ -53,6 +55,7 @@ h2 {text-transform: lowercase;}
{% endfor %}
</tbody>
</table>
</div>
<h2 class="order-head">Billing Adress<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:user_billing_address' %}">Edit</a></h2>
<h2 class="history-name">

View file

@ -113,7 +113,7 @@
<span class="custom-control-description">I accept the Digital Glarus <a data-toggle="modal" data-target="#cancel-subscription-modal" target="_blank">Terms and Conditions</a>, <a href=#>Community Guidelines</a> and <a href=#>Privacy Policy</a></span>
</label>
<div class="row">
<div class="col-xs-6 col-md-6 col-xs-offset-1 col-md-offset-3">
<div class="col-xs-12 col-md-6 col-md-offset-3">
<button class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Purchase membership</button>
</div>
</div>

View file

@ -5,7 +5,7 @@
{% block content %}
<style type="text/css">
@media screen and (min-width: 768px) {
@media screen and (min-width: 768px) { }
#cancel-subscription-modal .modal-dialog {width:900px;}
</style>

View file

@ -133,7 +133,7 @@
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container" style="margin-right: -; margin-left: 0px;margin-right: 0px;">
<div class="" style="margin-right: -; margin-left: 0px;margin-right: 0px;">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">

View file

@ -252,6 +252,8 @@ class BookingPaymentView(LoginRequiredMixin, MembershipRequiredMixin, FormView):
# if not credit_card_needed:
# Get or create stripe customer
# import pdb
# pdb.set_trace()
customer = StripeCustomer.get_or_create(email=self.request.user.email,
token=token)
if not customer:

BIN
dump.rdb Normal file

Binary file not shown.

View file

@ -150,7 +150,11 @@ class StripeCustomer(models.Model):
stripe_utils = StripeUtils()
stripe_customer = cls.objects.get(user__email=email)
# check if user is not in stripe but in database
stripe_utils.check_customer(stripe_customer.stripe_id, stripe_customer.user, token)
customer = stripe_utils.check_customer(stripe_customer.stripe_id,
stripe_customer.user, token)
if not customer.sources.data:
stripe_utils.update_customer_token(customer, token)
return stripe_customer
except StripeCustomer.DoesNotExist:

View file

@ -58,6 +58,12 @@ class StripeUtils(object):
def __init__(self):
self.stripe = stripe
def update_customer_token(self, customer, token):
# customer = stripe.Customer.retrieve(id)
customer.source = token
customer.save()
def check_customer(self, id, user, token):
customers = self.stripe.Customer.all()
if not customers.get('data'):