Finished responsive issues
This commit is contained in:
		
					parent
					
						
							
								06d03bbe90
							
						
					
				
			
			
				commit
				
					
						3da05e8025
					
				
			
		
					 12 changed files with 89 additions and 32 deletions
				
			
		|  | @ -27,22 +27,42 @@ $( document ).ready(function() { | ||||||
|     //Acept term and conditions button
 |     //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); | ||||||
| 
 | 
 | ||||||
|     var submit_form_btn = $('#payment_button'); |  | ||||||
|     submit_form_btn.on('click', submit_payment); |  | ||||||
| 
 | 
 | ||||||
|     function submit_payment(e){  |     function submit_payment(e){  | ||||||
|       $('#billing-form').submit(); |       e.preventDefault(); | ||||||
|  |       if (hasCreditcard) { | ||||||
|  |          $('#billing-form').submit(); | ||||||
|  |       } | ||||||
|  |       else  { | ||||||
|  |         $('#payment-form').submit(); | ||||||
|  | 
 | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |       | ||||||
|       // $form.submit();
 |       // $form.submit();
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     var $form = $('#payment-form'); |     var $form = $('#payment-form'); | ||||||
|     $form.submit(payWithStripe); |     $form.submit(payWithStripe); | ||||||
| 
 | 
 | ||||||
|     /* If you're using Stripe for payments */ |     /* If you're using Stripe for payments */ | ||||||
|     function payWithStripe(e) { |     function payWithStripe(e) { | ||||||
|         console.log("submiting"); |         console.log("submiting"); | ||||||
|  |                 console.log("token"); | ||||||
|  |                 console.log("token"); | ||||||
|  |                 // console.log("token", token);
 | ||||||
|  | 
 | ||||||
|         e.preventDefault(); |         e.preventDefault(); | ||||||
| 
 | 
 | ||||||
|         if (!$('.agree-terms').is(':checked')){ |         if (!$('.agree-terms').is(':checked')){ | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ | ||||||
|             <h2 class="member-name">2016.11.13-2016.12.13</h2> |             <h2 class="member-name">2016.11.13-2016.12.13</h2> | ||||||
|             <hr class="greyline-long"> |             <hr class="greyline-long"> | ||||||
|             <h2 class="order-head">Booking history</h2> |             <h2 class="order-head">Booking history</h2> | ||||||
|             <table class="table"> |             <table class="table" style="overflow-x:auto;"> | ||||||
|               <thead> |               <thead> | ||||||
|                 <tr> |                 <tr> | ||||||
|                   <th>#</th> |                   <th>#</th> | ||||||
|  |  | ||||||
|  | @ -212,4 +212,12 @@ | ||||||
| 
 | 
 | ||||||
| {%endif%} | {%endif%} | ||||||
| 
 | 
 | ||||||
|  | {% if credit_card_data.last4 and credit_card_data.cc_brand %} | ||||||
|  | <script type="text/javascript">  | ||||||
|  |      (function () {window.hasCreditcard = true;})(); | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | {%endif%} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  | @ -4,6 +4,20 @@ | ||||||
| 
 | 
 | ||||||
| {% block content %} | {% block content %} | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | <style type="text/css"> | ||||||
|  |    | ||||||
|  | @media screen and (max-width: 600px) { | ||||||
|  | 
 | ||||||
|  |   #timeline{ | ||||||
|  |     display: none; | ||||||
|  |   } | ||||||
|  |   h2 {font-size: 2em !important;} | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
|  | 
 | ||||||
| <!-- Header --> | <!-- Header --> | ||||||
|     <header class="history"> |     <header class="history"> | ||||||
|       <div class="container header-history"> |       <div class="container header-history"> | ||||||
|  | @ -81,7 +95,7 @@ | ||||||
| 
 | 
 | ||||||
|     <!-- Half Page Image Background Carousel --> |     <!-- Half Page Image Background Carousel --> | ||||||
|     <section> |     <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&font=Default&lang=en&initial_zoom=2&height=650" width="100%"></iframe> |         <iframe frameborder="0" width="100%" height="650" src="//cdn.knightlab.com/libs/timeline3/latest/embed/index.html?source=15clFd1fjnVScVziBlF-X7j5M7V6uNFt9jt9QZVylaYI&font=Default&lang=en&initial_zoom=2&height=650" width="100%"></iframe> | ||||||
|       </div> |       </div> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,12 +6,12 @@ | ||||||
| 
 | 
 | ||||||
| @media only screen and (max-width: 320px) { | @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> |   </style> | ||||||
| 
 | 
 | ||||||
|   <!-- Header --> |   <!-- Header --> | ||||||
|  | @ -33,26 +33,29 @@ h2 {text-transform: lowercase;} | ||||||
|             {% endif %} |             {% endif %} | ||||||
|             <hr class="greyline-long"> |             <hr class="greyline-long"> | ||||||
|             <h2 class="order-head">Orders history</h2> |             <h2 class="order-head">Orders history</h2> | ||||||
|             <table class="table"> |             <div style="overflow-x:auto;">               | ||||||
|               <thead> |            | ||||||
|                 <tr> |               <table class="table" > | ||||||
|                   <th>#</th> |                 <thead> | ||||||
|                   <th>Valid Month</th> |                   <tr> | ||||||
|                   <th>Date</th> |                     <th>#</th> | ||||||
|                   <th>Invoice</th> |                     <th>Valid Month</th> | ||||||
|                 </tr> |                     <th>Date</th> | ||||||
|               </thead> |                     <th>Invoice</th> | ||||||
|               <tbody> |                   </tr> | ||||||
|                 {% for order in orders%} |                 </thead> | ||||||
|                 <tr> |                 <tbody> | ||||||
|                   <th scope="row">{{order.id}}</th> |                   {% for order in orders%} | ||||||
|                   <td>{{order.created_at|date:"F"}}</td> |                   <tr> | ||||||
|                   <td>{{order.created_at|date}}</td> |                     <th scope="row">{{order.id}}</th> | ||||||
|                   <td><a class="btn btn-xs btn-primary btn-darkgrey" href="{% url 'digitalglarus:membership_orders_detail' order.id %}">View</a></td> |                     <td>{{order.created_at|date:"F"}}</td> | ||||||
|                 </tr> |                     <td>{{order.created_at|date}}</td> | ||||||
|                 {% endfor %} |                     <td><a class="btn btn-xs btn-primary btn-darkgrey" href="{% url 'digitalglarus:membership_orders_detail' order.id %}">View</a></td> | ||||||
|               </tbody> |                   </tr> | ||||||
|             </table> |                   {% 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="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"> |             <h2 class="history-name"> | ||||||
|  |  | ||||||
|  | @ -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> |                                      <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> | 									 </label> | ||||||
|                                     <div class="row"> |                                     <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> |                                           <button class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Purchase membership</button> | ||||||
|                                       </div> |                                       </div> | ||||||
|                                     </div> |                                     </div> | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
| {% block content %} | {% block content %} | ||||||
| 
 | 
 | ||||||
| <style  type="text/css"> | <style  type="text/css"> | ||||||
| @media screen and (min-width: 768px) { | @media screen and (min-width: 768px) { } | ||||||
| 	 | 	 | ||||||
| 	#cancel-subscription-modal .modal-dialog  {width:900px;} | 	#cancel-subscription-modal .modal-dialog  {width:900px;} | ||||||
| </style> | </style> | ||||||
|  |  | ||||||
|  | @ -133,7 +133,7 @@ | ||||||
| 
 | 
 | ||||||
|     <!-- Navigation --> |     <!-- Navigation --> | ||||||
|     <nav class="navbar navbar-default navbar-fixed-top"> |     <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 --> |     <!-- Brand and toggle get grouped for better mobile display --> | ||||||
|     <div class="navbar-header page-scroll"> |     <div class="navbar-header page-scroll"> | ||||||
|       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> |       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | ||||||
|  |  | ||||||
|  | @ -252,6 +252,8 @@ class BookingPaymentView(LoginRequiredMixin, MembershipRequiredMixin, FormView): | ||||||
| 
 | 
 | ||||||
|         # if not credit_card_needed: |         # if not credit_card_needed: | ||||||
|         # Get or create stripe customer |         # Get or create stripe customer | ||||||
|  |         # import pdb | ||||||
|  |         # pdb.set_trace() | ||||||
|         customer = StripeCustomer.get_or_create(email=self.request.user.email, |         customer = StripeCustomer.get_or_create(email=self.request.user.email, | ||||||
|                                                 token=token) |                                                 token=token) | ||||||
|         if not customer: |         if not customer: | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								dump.rdb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								dump.rdb
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -150,7 +150,11 @@ class StripeCustomer(models.Model): | ||||||
|             stripe_utils = StripeUtils() |             stripe_utils = StripeUtils() | ||||||
|             stripe_customer = cls.objects.get(user__email=email) |             stripe_customer = cls.objects.get(user__email=email) | ||||||
|             # check if user is not in stripe but in database |             # 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 |             return stripe_customer | ||||||
| 
 | 
 | ||||||
|         except StripeCustomer.DoesNotExist: |         except StripeCustomer.DoesNotExist: | ||||||
|  |  | ||||||
|  | @ -58,6 +58,12 @@ class StripeUtils(object): | ||||||
|     def __init__(self): |     def __init__(self): | ||||||
|         self.stripe = stripe |         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): |     def check_customer(self, id, user, token): | ||||||
|         customers = self.stripe.Customer.all() |         customers = self.stripe.Customer.all() | ||||||
|         if not customers.get('data'): |         if not customers.get('data'): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue