From e12416959609d39bcdebc3d3179ec970a3f9ea55 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Fri, 9 Dec 2016 11:11:41 -0400 Subject: [PATCH 01/13] narbar problem, line in the modal, modal center, footer readable --- .../templates/digitalglarus/login.html | 26 +++--- .../digitalglarus/membership_payment.html | 7 +- .../digitalglarus/membership_pricing.html | 45 ++++++++--- digitalglarus/templates/new_base_glarus.html | 53 ++++++------- ...arus123123.html => new_base_glarus_c.html} | 79 +++++++++++++++++-- 5 files changed, 151 insertions(+), 59 deletions(-) rename digitalglarus/templates/{new_base_glarus123123.html => new_base_glarus_c.html} (80%) diff --git a/digitalglarus/templates/digitalglarus/login.html b/digitalglarus/templates/digitalglarus/login.html index e8d81b47..3a0b91e3 100644 --- a/digitalglarus/templates/digitalglarus/login.html +++ b/digitalglarus/templates/digitalglarus/login.html @@ -13,7 +13,7 @@ text-align: center; margin: 30px auto 30px; color: #88c7d7; - + } .price2 { @@ -25,8 +25,8 @@ cancel-subscription-modal .modal-body { max-height: 800px; } -} +} @media screen and (min-width: 780px) { cancel-subscription-modal .modal-dialog {width:1000px;} @@ -38,6 +38,7 @@ margin: 30px auto 30px; color: #88c7d7; + } .price2 { @@ -46,11 +47,14 @@ } - cancel-subscription-modal .modal-body { - max-height: 800px; - } + } + + + + + </style> <section id="price"> <div class="signup-container"> @@ -130,18 +134,17 @@ </div> </section> - <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> + + <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - </div> <div class="modal-body"> <section id="price2"> <div class="container"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> - <div class="row col-xs-12 col-sm-12 col-lg-6 text-center wow fadeInDown"> + <div class="row col-xs-12 col-sm-12 col-lg-10 text-center wow fadeInDown"> <div class="price-box"> <span class="glyphicon glyphicon-flag"></span> <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> @@ -191,4 +194,7 @@ </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> + + + {% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/membership_payment.html b/digitalglarus/templates/digitalglarus/membership_payment.html index d73f4fab..b9ebf8c7 100644 --- a/digitalglarus/templates/digitalglarus/membership_payment.html +++ b/digitalglarus/templates/digitalglarus/membership_payment.html @@ -29,7 +29,7 @@ text-align: center; margin: 30px auto 30px; color: #88c7d7; - +} .price2 { @@ -40,6 +40,7 @@ } + </style> <section id="price"> @@ -213,13 +214,11 @@ <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - </div> <div class="modal-body"> <section id="price2"> <div class="container"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> <div class="row col-xs-12 col-sm-12 col-lg-10 text-center wow fadeInDown"> <div class="price-box"> diff --git a/digitalglarus/templates/digitalglarus/membership_pricing.html b/digitalglarus/templates/digitalglarus/membership_pricing.html index 63414e2a..ef3d0927 100644 --- a/digitalglarus/templates/digitalglarus/membership_pricing.html +++ b/digitalglarus/templates/digitalglarus/membership_pricing.html @@ -7,9 +7,16 @@ <style type="text/css"> @media screen and (min-width: 768px) { - cancel-subscription-modal .modal-dialog {width:550px;} + cancel-subscription-modal .modal-dialog {width:350px;} + position: relative; + top: -200px; + width: 400px; + z-index: 1000; + margin: 0 auto; + border-radius: 10px; + -webkit-border-radius: 10px; - +} .glyphicon-calendar{ font-size: 42px; @@ -26,6 +33,28 @@ } + .cancel-subscription-modal{ + position: absolute; + top: -200px; + width: 400px; + z-index: 1000; + margin: 0 auto; + border-radius: 10px; + -webkit-border-radius: 10px; + + } + + .btn-primary-text { + + text-transform: uppercase; + font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif; + font-weight: 400; + color: #0F1221; + + letter-spacing: 1px; + padding-right: 10px; +} + </style> <section id="price"> @@ -53,7 +82,7 @@ </div> <div class="text-center"> <br> - <a data-toggle="modal" data-target="#cancel-subscription-modal" target="_blank">How to pay?</a> + <a class="btn btn-primary-text" data-toggle="modal" data-target="#cancel-subscription-modal" target="_blank">How to pay?</a> </div> </div> @@ -105,17 +134,15 @@ </section> -<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> +<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true" > <div class="modal-dialog" role="document"> <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - </div> <div class="modal-body"> <section id="price2"> <div class="signup-container"> - <div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div> - <div class="col-xs-12 col-sm-12 col-lg-12 text-center wow fadeInDown"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown" margin-top:0;> </div> + <div class="col-xs-12 col-sm-12 col-lg-12 text-center wow fadeInDown" margin-top:0;> <div class="signup-box"> <span class="glyphicon glyphicon-calendar"></span> <h2 class="section-heading">How the pricing works</h2> diff --git a/digitalglarus/templates/new_base_glarus.html b/digitalglarus/templates/new_base_glarus.html index 50d1f24b..5ba3a3d7 100644 --- a/digitalglarus/templates/new_base_glarus.html +++ b/digitalglarus/templates/new_base_glarus.html @@ -7,8 +7,7 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <!-- <meta name="viewport" content="width=device-width, initial-scale=1"> --> - <meta name="viewport" content="width=device-width" /> + <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> @@ -80,17 +79,8 @@ margin: 0px; color:white; } - - - html,body{ - width: 100%; - height: 100%; - margin: 0px; - padding: 0px; - overflow-x: hidden; - } - - @media only screen and (min-width: 769px){ + + @media only screen and (min-width: 769px){ .dropdown.home-dropdown-mobile { display: none; } @@ -98,14 +88,15 @@ display: block; } } - - @media only screen and (max-width: 768px){ - .dropdown.home-dropdown-mobile { + + + @media only screen and (max-width: 768px){ + .dropdown.home-dropdown-mobile { display: block; background-color: } - - .dropdown.home-dropdown-mobile .dropdown-menu{ + + .dropdown.home-dropdown-mobile .dropdown-menu{ display: block; background-color: #0f1221; } @@ -120,16 +111,15 @@ .dropdown.home-dropdown { display: none; } - } - - + } + </style> - {% block extra_css %} {% endblock %} </head> - <body id="page-top" class="index"> + + <body id="page-top" class="index"> <!-- Navigation --> <nav class="navbar navbar-default navbar-fixed-top"> @@ -152,7 +142,7 @@ <a href="#page-top"></a> </li> <li> - <a class="page-scroll" href="{% url 'digitalglarus:booking' %}" >booking & price</a> + <a class="page-scroll" href="{% url 'digitalglarus:booking' %}">booking & price</a> </li> <li> <a class="page-scroll" href="{% url 'digitalglarus:history' %}">history</a> @@ -165,9 +155,9 @@ </li> - {% if request.user.is_authenticated %} - - + {% if request.user.is_authenticated %} + + <li class="dropdown home-dropdown-mobile open"> <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#"> <i class="glyphicon glyphicon-user"></i>{{request.user.name}} <span class="caret"></span> @@ -190,15 +180,15 @@ </li> </ul> </li> - - <li class="dropdown home-dropdown"> + + <li class="dropdown home-dropdown"> <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#"> <i class="glyphicon glyphicon-user"></i>{{request.user.name}} <span class="caret"></span> </a> <ul id="g-account-menu" class="dropdown-menu" role="menu"> <li> <a href="{% url 'digitalglarus:booking_orders_list' %}"> - <i class="fa fa-home" aria-hidden="true"></i> {% trans "Bookings"%} + <i class="fa fa-home" aria-hidden="true"></i> {% trans "Bookings"%} </a> </li> <li> @@ -212,7 +202,8 @@ </a> </li> </ul> - </li> + </li> + {% else %} <li> <a class="page-scroll" href="{% url 'digitalglarus:login' %}">Login</a> diff --git a/digitalglarus/templates/new_base_glarus123123.html b/digitalglarus/templates/new_base_glarus_c.html similarity index 80% rename from digitalglarus/templates/new_base_glarus123123.html rename to digitalglarus/templates/new_base_glarus_c.html index b156dd45..edef1751 100644 --- a/digitalglarus/templates/new_base_glarus123123.html +++ b/digitalglarus/templates/new_base_glarus_c.html @@ -7,7 +7,8 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> + <!-- <meta name="viewport" content="width=device-width, initial-scale=1"> --> + <meta name="viewport" content="width=device-width" /> <meta name="description" content=""> <meta name="author" content=""> @@ -79,7 +80,51 @@ margin: 0px; color:white; } + + + html,body{ + width: 100%; + height: 100%; + margin: 0px; + padding: 0px; + overflow-x: hidden; + } + + @media only screen and (min-width: 769px){ + .dropdown.home-dropdown-mobile { + display: none; + } + .dropdown.home-dropdown { + display: block; + } + } + + @media only screen and (max-width: 768px){ + .dropdown.home-dropdown-mobile { + display: block; + background-color: + } + + .dropdown.home-dropdown-mobile .dropdown-menu{ + display: block; + background-color: #0f1221; + } + + .dropdown.home-dropdown-mobile .dropdown-menu li a { + color:white; + } + .dropdown.home-dropdown-mobile .dropdown-menu li a:hover { + color: #0f1221; + } + + .dropdown.home-dropdown { + display: none; + } + } + + </style> + {% block extra_css %} {% endblock %} </head> @@ -97,17 +142,17 @@ <span class="icon-bar"></span> <span class="icon-bar"></span> </button> - <p><a class="navbar-brand page-scroll"href="{% url 'digitalglarus:landing' %}"><img src="{% static 'digitalglarus/img/logo_white.svg' %}"></a></p> + <p><a class="navbar-brand page-scroll" href="{% url 'digitalglarus:landing' %}"><img src="{% static 'digitalglarus/img/logo_white.svg' %}"></a></p> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> - <ul class="nav navbar-nav navbar-right"> + <ul class="nav navbar-nav navbar-right" style="margin-right: -; margin-left: 0px;margin-right: 0px;"> <li class="hidden active"> <a href="#page-top"></a> </li> <li> - <a class="page-scroll" href="{% url 'digitalglarus:booking' %}">booking & price</a> + <a class="page-scroll" href="{% url 'digitalglarus:booking' %}" >booking & price</a> </li> <li> <a class="page-scroll" href="{% url 'digitalglarus:history' %}">history</a> @@ -119,7 +164,31 @@ <a class="page-scroll" href="#contact">Contact</a> </li> + {% if request.user.is_authenticated %} + <li class="dropdown home-dropdown-mobile open"> + <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#"> + <i class="glyphicon glyphicon-user"></i>{{request.user.name}} <span class="caret"></span> + </a> + <ul id="g-account-menu" class="dropdown-menu" role="menu" aria-hidden="true"> + <li> + <a href="{% url 'digitalglarus:booking_orders_list' %}"> + <i class="fa fa-home" aria-hidden="true"></i> {% trans "Bookings"%} + </a> + </li> + <li> + <a href="{% url 'digitalglarus:membership_orders_list' %}"><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Membership"%} + </a> + </li> + <li> + <a href="{% url 'digitalglarus:logout' %}"> + <i class="fa fa-lock" aria-hidden="true"></i> + {% trans "Logout"%} + </a> + </li> + </ul> + </li> + <li class="dropdown home-dropdown"> <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#"> <i class="glyphicon glyphicon-user"></i>{{request.user.name}} <span class="caret"></span> @@ -127,7 +196,7 @@ <ul id="g-account-menu" class="dropdown-menu" role="menu"> <li> <a href="{% url 'digitalglarus:booking_orders_list' %}"> - <i class="fa fa-home" aria-hidden="true"></i> {% trans "Bookings"%} + <i class="fa fa-home" aria-hidden="true"></i> {% trans "Bookings"%} </a> </li> <li> From 888cdc51e2976ecc0e76f5bd52c48da155ddbce6 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Mon, 12 Dec 2016 11:38:23 -0400 Subject: [PATCH 02/13] sprint 6 --- .../templates/digitalglarus/confirm_reset_password.html | 1 + digitalglarus/templates/digitalglarus/login.html | 2 +- .../templates/digitalglarus/membership_deactivated.html | 9 ++++++--- .../templates/digitalglarus/reset_password.html | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/confirm_reset_password.html b/digitalglarus/templates/digitalglarus/confirm_reset_password.html index 40a93730..eccfc066 100644 --- a/digitalglarus/templates/digitalglarus/confirm_reset_password.html +++ b/digitalglarus/templates/digitalglarus/confirm_reset_password.html @@ -25,6 +25,7 @@ <br> <div class="notice-box"> <p class="order-bottom-text">Still have trouble? Contact us for technical support.</p> + <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have trouble? Contact us for technical support</a> </div> </div> diff --git a/digitalglarus/templates/digitalglarus/login.html b/digitalglarus/templates/digitalglarus/login.html index 3a0b91e3..0222e3f0 100644 --- a/digitalglarus/templates/digitalglarus/login.html +++ b/digitalglarus/templates/digitalglarus/login.html @@ -144,7 +144,7 @@ <div class="container"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> - <div class="row col-xs-12 col-sm-12 col-lg-10 text-center wow fadeInDown"> + <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> <div class="price-box"> <span class="glyphicon glyphicon-flag"></span> <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> diff --git a/digitalglarus/templates/digitalglarus/membership_deactivated.html b/digitalglarus/templates/digitalglarus/membership_deactivated.html index 9eeb5c39..c324d4fa 100644 --- a/digitalglarus/templates/digitalglarus/membership_deactivated.html +++ b/digitalglarus/templates/digitalglarus/membership_deactivated.html @@ -44,8 +44,9 @@ <form method="POST" action=""> {% csrf_token %} + <a class="btn btn-primary btn-blue space-above" href="{{request.META.HTTP_REFERER}}">Go back</a> <button type="button" class="btn btn-primary btn-blue space-above" data-toggle="modal" data-target="#cancel-subscription-modal">Cancel my Membership</button> - <a class="btn btn-primary btn-grey space-above" href="{{request.META.HTTP_REFERER}}">Go back</a> + @@ -59,7 +60,7 @@ <div class="modal-body"> <p>Do you want to cancel your subscription?</p> </div> - <div class="modal-footer text-center"> + <div class="modal-footer"> <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">No</button> <button type="submit" class="btn btn-primary">Yes</button> </div> @@ -81,7 +82,9 @@ - </div> + </div> + + <div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div> </div> </div> diff --git a/digitalglarus/templates/digitalglarus/reset_password.html b/digitalglarus/templates/digitalglarus/reset_password.html index 265248fd..6da417a0 100644 --- a/digitalglarus/templates/digitalglarus/reset_password.html +++ b/digitalglarus/templates/digitalglarus/reset_password.html @@ -26,7 +26,8 @@ </form> <br> <div class="notice-box"> - <p class="order-bottom-text">Still have trouble? Contact us for technical support.</p> + <p class="signup-text">Still have trouble?<a href="mailto:info@ungleich.ch" > Contact us for technical support</a>.</p> + </div> </div> From 089454e8ac8fbdad57f1d1a1923828afadc0e792 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Wed, 14 Dec 2016 10:34:20 -0400 Subject: [PATCH 03/13] fixing problems and credit card template and views --- .../static/digitalglarus/css/price.css | 4 +- .../digitalglarus/booking_payment.html | 2 +- .../digitalglarus/confirm_reset_password.html | 3 +- .../templates/digitalglarus/login.html | 32 ++-- .../digitalglarus/membership_deactivated.html | 4 +- .../digitalglarus/membership_payment.html | 8 +- .../digitalglarus/reset_password.html | 2 +- digitalglarus/templates/new_base_glarus.html | 2 +- digitalglarus/views.py | 152 +++++++++++++++++- 9 files changed, 176 insertions(+), 33 deletions(-) diff --git a/digitalglarus/static/digitalglarus/css/price.css b/digitalglarus/static/digitalglarus/css/price.css index 12a0e2f0..1a019740 100644 --- a/digitalglarus/static/digitalglarus/css/price.css +++ b/digitalglarus/static/digitalglarus/css/price.css @@ -71,7 +71,7 @@ padding-right: 15px; padding-top: 15px; padding-bottom: 30px; - margin-top: 80px; + margin-top: 10px; margin-bottom: 30px; margin-left: 10px; margin-right: 10px; @@ -174,7 +174,7 @@ padding-right: 15px; padding-top: 15px; padding-bottom: 15px; - margin-top: 80px; + margin-top: 0px; margin-bottom: 30px; margin-left: 10px; margin-right: 10px; diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index df9bfa69..5c7cd604 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -72,7 +72,7 @@ </div> {% if credit_card_data %} <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> - <h2 class="billing-head">Credit Card</h2> + <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:user_billing_address' %}">Edit</a></h2> <h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2> <h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2> <input type="hidden" name="credit_card_needed" value="false"/> diff --git a/digitalglarus/templates/digitalglarus/confirm_reset_password.html b/digitalglarus/templates/digitalglarus/confirm_reset_password.html index eccfc066..d8a1c4c2 100644 --- a/digitalglarus/templates/digitalglarus/confirm_reset_password.html +++ b/digitalglarus/templates/digitalglarus/confirm_reset_password.html @@ -24,8 +24,7 @@ </form> <br> <div class="notice-box"> - <p class="order-bottom-text">Still have trouble? Contact us for technical support.</p> - <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have trouble? Contact us for technical support</a> + <p class="signup-text">Still have trouble?<a href="mailto:info@ungleich.ch" > Contact us </a>.</p> </div> </div> diff --git a/digitalglarus/templates/digitalglarus/login.html b/digitalglarus/templates/digitalglarus/login.html index 0222e3f0..3ae7c5ab 100644 --- a/digitalglarus/templates/digitalglarus/login.html +++ b/digitalglarus/templates/digitalglarus/login.html @@ -50,11 +50,6 @@ } - - - - - </style> <section id="price"> <div class="signup-container"> @@ -135,17 +130,22 @@ </section> - <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-body"> - - <section id="price2"> - <div class="container"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> - <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> - <div class="price-box"> +<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> + + <div class="modal-dialog" role="document"> + + <div class="modal-content"> + + <div class="modal-body"> + + <section id="price2"> + <div class="container"> + + <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> + <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <div class="price-box"> + <span class="glyphicon glyphicon-flag"></span> <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> diff --git a/digitalglarus/templates/digitalglarus/membership_deactivated.html b/digitalglarus/templates/digitalglarus/membership_deactivated.html index c324d4fa..408a9350 100644 --- a/digitalglarus/templates/digitalglarus/membership_deactivated.html +++ b/digitalglarus/templates/digitalglarus/membership_deactivated.html @@ -44,9 +44,9 @@ <form method="POST" action=""> {% csrf_token %} - <a class="btn btn-primary btn-blue space-above" href="{{request.META.HTTP_REFERER}}">Go back</a> + <a class="btn btn-primary btn-grey space-above" href="{{request.META.HTTP_REFERER}}">Go back</a> <button type="button" class="btn btn-primary btn-blue space-above" data-toggle="modal" data-target="#cancel-subscription-modal">Cancel my Membership</button> - + diff --git a/digitalglarus/templates/digitalglarus/membership_payment.html b/digitalglarus/templates/digitalglarus/membership_payment.html index 0681a264..70e987f4 100644 --- a/digitalglarus/templates/digitalglarus/membership_payment.html +++ b/digitalglarus/templates/digitalglarus/membership_payment.html @@ -213,14 +213,16 @@ <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> + + <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-body"> <section id="price2"> - <div class="container"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> + <div class="container"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <div class="row col-xs-12 col-sm-12 col-lg-10 text-center wow fadeInDown"> <div class="price-box"> <span class="glyphicon glyphicon-flag"></span> diff --git a/digitalglarus/templates/digitalglarus/reset_password.html b/digitalglarus/templates/digitalglarus/reset_password.html index 6da417a0..7d701d02 100644 --- a/digitalglarus/templates/digitalglarus/reset_password.html +++ b/digitalglarus/templates/digitalglarus/reset_password.html @@ -26,7 +26,7 @@ </form> <br> <div class="notice-box"> - <p class="signup-text">Still have trouble?<a href="mailto:info@ungleich.ch" > Contact us for technical support</a>.</p> + <p class="signup-text">Still have trouble?<a href="mailto:info@ungleich.ch" > Contact us </a>.</p> </div> </div> diff --git a/digitalglarus/templates/new_base_glarus.html b/digitalglarus/templates/new_base_glarus.html index 5ba3a3d7..84b65517 100644 --- a/digitalglarus/templates/new_base_glarus.html +++ b/digitalglarus/templates/new_base_glarus.html @@ -241,7 +241,7 @@ </div> <div class="col-md-4"> <ul class="list-inline quicklinks"> - <li><a href="http://www.ungleich.ch/">ungleich Home</a> + <li><a class="btn btn-primary-text" href="http://www.ungleich.ch/">ungleich Home</a> </li> </ul> </div> diff --git a/digitalglarus/views.py b/digitalglarus/views.py index f862ff24..74d50ba9 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -41,12 +41,154 @@ from .models import MembershipType, Membership, MembershipOrder, Booking, Bookin from .mixins import MembershipRequiredMixin, IsNotMemberMixin -class Probar(LoginRequiredMixin, UpdateView): - template_name='digitalglarus/membership_deactivated.html' +''' +class Probar(TemplateView): + template_name='digitalglarus/pinchecha.html' model = Membership success_url = reverse_lazy('digitalglarus:probar') - - +''' +class Probar(TemplateView): + template_name = "digitalglarus/pinchecha.html" + success_url = reverse_lazy('digitalglarus:probar') + # success_url = reverse_lazy('digitalglarus:booking_payment') +''' + def dispatch(self, request, *args, **kwargs): + from_booking = all(field in request.session.keys() + for field in self.booking_needed_fields) + if not from_booking: + return HttpResponseRedirect(reverse('digitalglarus:booking')) + + return super(BookingPaymentView, self).dispatch(request, *args, **kwargs) + + def get_success_url(self, order_id): + return reverse('digitalglarus:booking_orders_detail', kwargs={'pk': order_id}) + + def get_form_kwargs(self): + current_billing_address = self.request.user.billing_addresses.first() + form_kwargs = super(BookingPaymentView, self).get_form_kwargs() + form_kwargs.update({ + 'initial': { + 'start_date': self.request.session.get('start_date'), + 'end_date': self.request.session.get('end_date'), + 'price': self.request.session.get('final_price'), + 'street_address': current_billing_address.street_address, + 'city': current_billing_address.city, + 'postal_code': current_billing_address.postal_code, + 'country': current_billing_address.country, + } + }) + return form_kwargs + + def get_context_data(self, *args, **kwargs): + context = super(BookingPaymentView, self).get_context_data(*args, **kwargs) + + booking_data = {key: self.request.session.get(key) + for key in self.booking_needed_fields} + user = self.request.user + last_booking_order = BookingOrder.objects.filter(customer__user=user).last() + last_membership_order = MembershipOrder.objects.filter(customer__user=user).last() + credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ + and last_booking_order.get_booking_cc_data() \ + else last_membership_order.get_membership_order_cc_data() + + booking_data.update({ + 'credit_card_data': credit_card_data if credit_card_data else None, + 'stripe_key': settings.STRIPE_API_PUBLIC_KEY + }) + context.update(booking_data) + return context + + def form_valid(self, form): + data = form.cleaned_data + context = self.get_context_data() + token = data.get('token') + start_date = data.get('start_date') + end_date = data.get('end_date') + is_free = context.get('is_free') + normal_price, final_price, free_days = Booking.\ + booking_price(self.request.user, start_date, end_date) + charge = None + + # if not credit_card_needed: + # Get or create stripe customer + customer = StripeCustomer.get_or_create(email=self.request.user.email, + token=token) + if not customer: + form.add_error("__all__", "Invalid credit card") + return self.render_to_response(self.get_context_data(form=form)) + + # If booking is not free, make the stripe charge + if not is_free: + # Make stripe charge to a customer + stripe_utils = StripeUtils() + charge_response = stripe_utils.make_charge(amount=final_price, + customer=customer.stripe_id) + charge = charge_response.get('response_object') + + # Check if the payment was approved + if not charge: + context.update({ + 'paymentError': charge_response.get('error'), + 'form': form + }) + return render(self.request, self.template_name, context) + + charge = charge_response.get('response_object') + + # Create Billing Address for Membership Order + billing_address = form.save() + + # Create Billing Address for User if he does not have one + if not customer.user.billing_addresses.count(): + data.update({ + 'user': customer.user.id + }) + billing_address_user_form = UserBillingAddressForm(data) + billing_address_user_form.is_valid() + billing_address_user_form.save() + + # Create Booking + booking_data = { + 'start_date': start_date, + 'end_date': end_date, + 'start_date': start_date, + 'free_days': free_days, + 'price': normal_price, + 'final_price': final_price, + } + booking = Booking.create(booking_data) + + # Create Booking order + order_data = { + 'booking': booking, + 'customer': customer, + 'billing_address': billing_address, + 'stripe_charge': charge, + 'amount': final_price, + 'original_price': normal_price, + 'special_month_price': BookingPrice.objects.last().special_month_price, + } + order = BookingOrder.create(order_data) + + context = { + 'booking': booking, + 'order': order, + 'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host()) + } + + email_data = { + 'subject': 'Your booking order has been placed', + 'to': self.request.user.email, + 'context': context, + 'template_name': 'booking_order_email', + 'template_path': 'digitalglarus/emails/' + } + email = BaseEmail(**email_data) + email.send() + + return HttpResponseRedirect(self.get_success_url(order.id)) +''' + class ValidateUser(TemplateView): #print ("ENTRE AQUI AL MENOS Y",pk) @@ -81,7 +223,7 @@ class ValidateView(SignupViewMixin): #return HttpResponse(json.dumps(resp), content_type ='application/json') class TermsAndConditions(TemplateView): - template_name ="digitalglarus/terms.html" + template_name ="digitalglarus/pinchecha.html" class IndexView(TemplateView): From 8f44c438508ed49120f2c88fb9cf7ed1f4519b9f Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Mon, 19 Dec 2016 11:29:01 -0400 Subject: [PATCH 04/13] credit card --- digitalglarus/models.py | 1 + .../static/digitalglarus/js/payment.js | 9 +- .../digitalglarus/booking_payment.html | 2 +- .../credit_card_edit_confirmation.html | 113 ++++++ .../digitalglarus/new_credit_card.html | 347 ++++++++++++++++++ .../digitalglarus/reset_password.html | 2 +- digitalglarus/urls.py | 7 +- digitalglarus/views.py | 182 ++------- 8 files changed, 510 insertions(+), 153 deletions(-) create mode 100644 digitalglarus/templates/digitalglarus/credit_card_edit_confirmation.html create mode 100644 digitalglarus/templates/digitalglarus/new_credit_card.html diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 26ecb4ff..73e04aca 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -1,4 +1,5 @@ + import calendar from datetime import datetime, date, timedelta from dateutil.relativedelta import relativedelta diff --git a/digitalglarus/static/digitalglarus/js/payment.js b/digitalglarus/static/digitalglarus/js/payment.js index 3179f721..90e922b1 100644 --- a/digitalglarus/static/digitalglarus/js/payment.js +++ b/digitalglarus/static/digitalglarus/js/payment.js @@ -19,6 +19,7 @@ $( document ).ready(function() { } if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) { // Only send the token to relative URLs i.e. locally. + alert("POR AQUI"); xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); } } @@ -33,6 +34,7 @@ $( document ).ready(function() { function submit_payment(e){ $('#billing-form').submit(); + alert("POR AQUI2"); // $form.submit(); } @@ -42,7 +44,7 @@ $( document ).ready(function() { /* If you're using Stripe for payments */ function payWithStripe(e) { - console.log("submiting"); + console.log("submiting33"); e.preventDefault(); if (!$('.agree-terms').is(':checked')){ @@ -53,12 +55,15 @@ $( document ).ready(function() { /* Visual feedback */ $form.find('[type=submit]').html('Validating <i class="fa fa-spinner fa-pulse"></i>'); - + alert("POR AQUI3"); + console.log("submiting2"); var PublishableKey = window.stripeKey; + alert(PublishableKey); Stripe.setPublishableKey(PublishableKey); Stripe.card.createToken($form, function stripeResponseHandler(status, response) { if (response.error) { /* Visual feedback */ + alert("POR AQUI32345"); $form.find('[type=submit]').html('Try again'); /* Show Stripe errors on the form */ $form.find('.payment-errors').text(response.error.message); diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index 5c7cd604..f257d1d9 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -72,7 +72,7 @@ </div> {% if credit_card_data %} <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> - <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:user_billing_address' %}">Edit</a></h2> + <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">Edit</a></h2> <h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2> <h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2> <input type="hidden" name="credit_card_needed" value="false"/> diff --git a/digitalglarus/templates/digitalglarus/credit_card_edit_confirmation.html b/digitalglarus/templates/digitalglarus/credit_card_edit_confirmation.html new file mode 100644 index 00000000..3fea39d2 --- /dev/null +++ b/digitalglarus/templates/digitalglarus/credit_card_edit_confirmation.html @@ -0,0 +1,113 @@ +{% extends "new_base_glarus.html" %} +{% load staticfiles cms_tags bootstrap3%} +{% block title %}crowdfunding{% endblock %} + +{% block content %} + +<style type="text/css"> + + #cancel-subscription-modal{ + margin-top:10%; + } + + #cancel-subscription-modal .modal-header{ + border-bottom: none; + } + + #cancel-subscription-modal .modal-footer{ + border-top: none; + text-align: center; + } + + .space-above { + margin-top: 10px; + } + +</style> + + <section id="price"> + <div class="signup-container"> + <div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div> + <div class="col-xs-12 col-sm-6 col-lg-4 text-center wow fadeInDown"> + + <!-- <span class="glyphicon glyphicon-user"></span> --> + <div class="payment-box"> + <h2 class="billing-head">Update your credit card information</h2> + <hr class="greyline-long"> + <h2 class="membership-lead">Do you want to update your credit card information ?</h2> + <div class="date-box"> + </div> + <!--<hr class="primary">--> + <div class="signup-form form-group row"> + + <div class="button-booking-box form-inline row"> + + <form method="POST" action=""> + {% csrf_token %} + <a class="btn btn-primary btn-grey space-above" href="{{request.META.HTTP_REFERER}}">Go back</a> + <button type="button" class="btn btn-primary btn-blue space-above" data-toggle="modal" data-target="#cancel-subscription-modal">Update my credit card</button> + + + + + <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title">Cancel Subscription</h4> + </div> + <div class="modal-body"> + <p>Do you want to cancel your subscription?</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">No</button> + <button type="submit" class="btn btn-primary">Yes</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> + + + </form> + + </div> + <div class="notice-box text-left"> + <p class="order-bottom-text"> + Your membership wouldn't be automatically renewed each month. + </p> + </div> + </div> + + + + + </div> + + + <div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div> + </div> + </div> + </div> + </div> + </div> + </section> + <section id="contact"> + <div class="fill"> + <div class="row" class="wow fadeInDown"> + <div class="col-lg-12 text-center wow fadeInDown"> + <div class="col-md-4 map-title"> + Digital Glarus<br> + <span class="map-caption">In der Au 7 Schwanden 8762 Switzerland + <br>info@digitalglarus.ch + <br> + (044) 534-66-22 + <p> </p> + </span> + </div> + <p> </p> + </div> + </div> + </div> + </section> +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/new_credit_card.html b/digitalglarus/templates/digitalglarus/new_credit_card.html new file mode 100644 index 00000000..6d262cb4 --- /dev/null +++ b/digitalglarus/templates/digitalglarus/new_credit_card.html @@ -0,0 +1,347 @@ +{% extends "new_base_glarus.html" %} +{% load staticfiles bootstrap3 i18n %} +{% block content %} + +<style type="text/css"> + + .nopadding { + padding: 0 !important; + margin: 0 !important; + } + + .form-control#id_country{ + -webkit-appearance: none; + -moz-appearance: none; + background-position: right 50%; + background-repeat: no-repeat; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NDZFNDEwNjlGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NDZFNDEwNkFGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0NkU0MTA2N0Y3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0NkU0MTA2OEY3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PuGsgwQAAAA5SURBVHjaYvz//z8DOYCJgUxAf42MQIzTk0D/M+KzkRGPoQSdykiKJrBGpOhgJFYTWNEIiEeAAAMAzNENEOH+do8AAAAASUVORK5CYII=); + padding: .5em; + padding-right: 1.5em + } + + .order-bottom-text a{ + margin-left: 0px; + } +</style> + + <section id="price"> + <div class="signup-container"> + <div class="col-xs-12 col-sm-6 col-lg-8 text-center wow fadeInDown"> + <div class="payment-box"> + <h2 class="section-heading payment-head">New Credit Card</h2> + <!-- <h2 class="membership-amount">35CHF</h2> --> + <hr class="greyline-long"> + + <h2 class="membership-lead"> + Your Digital Glarus Membership enables + you to use our coworking space and it includes + 2 working days for the month you signed up. + The membership fee is a monthly subscription. + Additional day costs + 15CHF per day. More than 17 days a month it + will charge only 290CHF/month. + </h2> + {% if is_free %} + <h2 class="billing-head">Billing Adress</h2> + <div class="signup-form form-group row"> + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + {% for field in form %} + {% csrf_token %} + {% bootstrap_field field show_label=False type='fields'%} + {% endfor %} + {% bootstrap_form_errors form type='non_fields'%} + <br> + </form> + </div> + + <hr class="greyline-long"> + <br/> + <h2 class="billing-head">Your booking is FREE of charge! You can change or cancel the booking freely 7 days before the booking date.</h2> + <br/><br/> + {% else %} + <br> + <h2 class="billing-head">Credit Card Information</h2> + + + {% if credit_card_data %} + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + <h2 class="membership-lead">Last 4: *****{{last4}}</h2> + <h2 class="membership-lead">Type: {{cc_brand}}</h2> + + <input type="hidden" name="credit_card_needed" value="false"/> + </form> + + {% else %} + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + <h2 class="membership-lead">Last 4: *****{{last4}}</h2> + <h2 class="membership-lead">Type: {{cc_brand}}</h2> + <input type="hidden" name="credit_card_needed" value="false"/> + </form> + <h2 class="billing-head">Credit Card (New One)</h2> + <div class="signup-form form-group row"> + {% csrf_token %} + <form role="form" id="payment-form" novalidate> + {% csrf_token %} + <div class="row"> + <div class="col-xs-12 col-md-12"> + <div class="form-group"> + <input for="name" type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" /> + </div> + </div> + </div> + <div class="row"> + <div class="col-xs-12 col-md-12"> + <div class="form-group"> + <input type="text" class="form-control" name="cardNumber" placeholder="Valid Card Number" required data-stripe="number" /> + </div> + </div> + </div> + <div class="row"> + <div class="col-xs-6 col-md-6 nopadding"> + <label for="expMonth">EXPIRATION DATE</label><br/> + <div class="col-xs-6 col-lg-6 col-md-6"> + <div class="form-group"> + <input type="text" class="form-control" name="expMonth" placeholder="MM" required data-stripe="exp_month" /> + </div> + </div> + <div class="col-xs-6 col-lg-6 col-md-6 pl-ziro"> + <div class="form-group"> + <input type="text" class="form-control" name="expYear" placeholder="YY" required data-stripe="exp_year" /> + </div> + </div> + </div> + <div class="col-xs-4 col-md-6 pull-right"> + <div class="form-group"> + <label for="cvCode">CV CODE</label> + <input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" /> + </div> + </div> + + <div class="text-center"> + + </div> + </div> + <input type="checkbox" hidden="True" class="custom-control-input agree-terms" checked> + <div class="row"> + <div class="row"> + <div class="col-xs-6 col-md-6 col-xs-offset-1 col-md-offset-3"> + <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">Cancel</button> + <button class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Save</button> + </div> + </div> + </div> + + + + <div class="row" style="display:none;"> + <div class="col-xs-12"> + <p class="payment-errors"></p> + </div> + </div> + {% if paymentError %} + <div class="row"> + <div class="col-xs-12"> + <p> + {% bootstrap_alert paymentError alert_type='danger' %} + </p> + </div> + </div> + + + + {% endif %} + </form> + <br> + </div> + {% endif %} + {% endif %} + </div> + </div> + + </div> + </div> + </div> + </div> + </section> + + + + <section id="contact"> + <div class="fill"> + <div class="row" class="wow fadeInDown"> + <div class="col-lg-12 text-center wow fadeInDown"> + <div class="col-md-4 map-title"> + Digital Glarus<br> + <span class="map-caption">In der Au 7 Schwanden 8762 Switzerland + <br>info@digitalglarus.ch + <br> + (044) 534-66-22 + <p> </p> + </span> + </div> + <p> </p> + </div> + </div> + </div> + </section> + +<!-- stripe key data --> +{% if stripe_key %} +<script type="text/javascript"> + (function () {window.stripeKey = "{{stripe_key}}";})(); + +</script> +{%endif%} +<script> +$( document ).ready(function() { + + $.ajaxSetup({ + beforeSend: function(xhr, settings) { + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) { + // Only send the token to relative URLs i.e. locally. + alert("POR AQUI"); + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + } + }); + + //Acept term and conditions button + + + + var submit_form_btn = $('#payment_button'); + submit_form_btn.on('click', submit_payment); + + function submit_payment(e){ + $('#billing-form').submit(); + alert("POR AQUI2"); + // $form.submit(); + } + + + var $form = $('#payment-form'); + $form.submit(payWithStripe); + + /* If you're using Stripe for payments */ + function payWithStripe(e) { + console.log("submiting"); + e.preventDefault(); + + if (!$('.agree-terms').is(':checked')){ + alert("You must accept terms and conditions."); + return; + } + + + /* Visual feedback */ + $form.find('[type=submit]').html('Validating <i class="fa fa-spinner fa-pulse"></i>'); + + var PublishableKey = window.stripeKey; + Stripe.setPublishableKey(PublishableKey); + Stripe.card.createToken($form, function stripeResponseHandler(status, response) { + if (response.error) { + /* Visual feedback */ + alert("POR AQUI3"); + $form.find('[type=submit]').html('Try again'); + /* Show Stripe errors on the form */ + $form.find('.payment-errors').text(response.error.message); + $form.find('.payment-errors').closest('.row').show(); + } else { + /* Visual feedback */ + $form.find('[type=submit]').html('Processing <i class="fa fa-spinner fa-pulse"></i>'); + /* Hide Stripe errors on the form */ + $form.find('.payment-errors').closest('.row').hide(); + $form.find('.payment-errors').text(""); + // response contains id and card, which contains additional card details + var token = response.id; + // AJAX + + //set token on a hidden input + $('#id_token').val(token); + $('#billing-form').submit(); + } + }); + } + + /* Form validation */ + $.validator.addMethod("month", function(value, element) { + return this.optional(element) || /^(01|02|03|04|05|06|07|08|09|10|11|12)$/.test(value); + }, "Please specify a valid 2-digit month."); + + $.validator.addMethod("year", function(value, element) { + return this.optional(element) || /^[0-9]{2}$/.test(value); + }, "Please specify a valid 2-digit year."); + + validator = $form.validate({ + rules: { + cardNumber: { + required: true, + creditcard: true, + digits: true + }, + expMonth: { + required: true, + month: true + }, + expYear: { + required: true, + year: true + }, + cvCode: { + required: true, + digits: true + } + }, + highlight: function(element) { + $(element).closest('.form-control').removeClass('success').addClass('error'); + }, + unhighlight: function(element) { + $(element).closest('.form-control').removeClass('error').addClass('success'); + }, + errorPlacement: function(error, element) { + $(element).closest('.form-group').append(error); + } + }); + + paymentFormReady = function() { + if ($form.find('[name=cardNumber]').hasClass("success") && + $form.find('[name=expMonth]').hasClass("success") && + $form.find('[name=expYear]').hasClass("success") && + $form.find('[name=cvCode]').val().length > 1) { + return true; + } else { + return false; + } + }; + + $form.find('[type=submit]').prop('disabled', true); + var readyInterval = setInterval(function() { + if (paymentFormReady()) { + $form.find('[type=submit]').prop('disabled', false); + clearInterval(readyInterval); + } + }, 250); + + + +}); +</script> + + + +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/reset_password.html b/digitalglarus/templates/digitalglarus/reset_password.html index 7d701d02..f38c0fbd 100644 --- a/digitalglarus/templates/digitalglarus/reset_password.html +++ b/digitalglarus/templates/digitalglarus/reset_password.html @@ -26,7 +26,7 @@ </form> <br> <div class="notice-box"> - <p class="signup-text">Still have trouble?<a href="mailto:info@ungleich.ch" > Contact us </a>.</p> + <p class="signup-text">Still have trouble? For technical support <a href="mailto:info@ungleich.ch" > Contact us </a>.</p> </div> </div> diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index f42ec6aa..9793e8cd 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -7,17 +7,18 @@ from .views import ContactView, IndexView, AboutView, HistoryView, LoginView, Si MembershipPricingView, BookingSelectDatesView, BookingPaymentView, OrdersBookingDetailView,\ BookingOrdersListView, MembershipOrdersListView, OrdersMembershipDetailView, \ MembershipDeactivateView, MembershipDeactivateSuccessView, UserBillingAddressView, \ - MembershipReactivateView,TermsAndConditions,ValidateUser,SupportusView,Probar + MembershipReactivateView,TermsAndConditions,ValidateUser,SupportusView,Probar,TermsAndConditions2,TermsAndConditions3 # from membership.views import LoginRegistrationView urlpatterns = [ - + url(_(r'probar3/?$'),TermsAndConditions3, name='probar3'), + url(_(r'probar2/?$'),TermsAndConditions2.as_view(), name='credit_card_edit'), url(_(r'probar/?$'), Probar, name='probar'), url(_(r'login/validate/(?P<pk>\!\w+)/?$'), ValidateUser.as_view(), name='validate-login'), url(_(r'^$'), IndexView.as_view(), name='landing'), - url(_(r'terms_conditions/?$'), TermsAndConditions.as_view(), name='TermsAndConditions'), + url(_(r'terms_conditions/?$'), TermsAndConditions, name='TermsAndConditions'), url(_(r'support-us/?$'), SupportusView.as_view(), name='supportus'), url(_(r'contact/?$'), ContactView.as_view(), name='contact'), url(_(r'login/?$'), LoginView.as_view(), name='login'), diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 74d50ba9..f13537b6 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -14,8 +14,8 @@ from djangocms_blog.models import Post from django.contrib import messages from django.http import JsonResponse from django.views.generic import View, DetailView, ListView, DeleteView - - +from django.http import HttpResponse, HttpResponseRedirect +from django.shortcuts import render_to_response, redirect, render from .models import Supporter from .mixins import ChangeMembershipStatusMixin from utils.forms import ContactUsForm @@ -43,152 +43,13 @@ from .mixins import MembershipRequiredMixin, IsNotMemberMixin ''' class Probar(TemplateView): - template_name='digitalglarus/pinchecha.html' + template_name='digitalglarus/new_credit_card.html' model = Membership success_url = reverse_lazy('digitalglarus:probar') ''' -class Probar(TemplateView): - template_name = "digitalglarus/pinchecha.html" - success_url = reverse_lazy('digitalglarus:probar') - # success_url = reverse_lazy('digitalglarus:booking_payment') -''' - def dispatch(self, request, *args, **kwargs): - from_booking = all(field in request.session.keys() - for field in self.booking_needed_fields) - if not from_booking: - return HttpResponseRedirect(reverse('digitalglarus:booking')) - - return super(BookingPaymentView, self).dispatch(request, *args, **kwargs) - - def get_success_url(self, order_id): - return reverse('digitalglarus:booking_orders_detail', kwargs={'pk': order_id}) - - def get_form_kwargs(self): - current_billing_address = self.request.user.billing_addresses.first() - form_kwargs = super(BookingPaymentView, self).get_form_kwargs() - form_kwargs.update({ - 'initial': { - 'start_date': self.request.session.get('start_date'), - 'end_date': self.request.session.get('end_date'), - 'price': self.request.session.get('final_price'), - 'street_address': current_billing_address.street_address, - 'city': current_billing_address.city, - 'postal_code': current_billing_address.postal_code, - 'country': current_billing_address.country, - } - }) - return form_kwargs - - def get_context_data(self, *args, **kwargs): - context = super(BookingPaymentView, self).get_context_data(*args, **kwargs) - - booking_data = {key: self.request.session.get(key) - for key in self.booking_needed_fields} - user = self.request.user - last_booking_order = BookingOrder.objects.filter(customer__user=user).last() - last_membership_order = MembershipOrder.objects.filter(customer__user=user).last() - credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ - and last_booking_order.get_booking_cc_data() \ - else last_membership_order.get_membership_order_cc_data() - - booking_data.update({ - 'credit_card_data': credit_card_data if credit_card_data else None, - 'stripe_key': settings.STRIPE_API_PUBLIC_KEY - }) - context.update(booking_data) - return context - - def form_valid(self, form): - data = form.cleaned_data - context = self.get_context_data() - token = data.get('token') - start_date = data.get('start_date') - end_date = data.get('end_date') - is_free = context.get('is_free') - normal_price, final_price, free_days = Booking.\ - booking_price(self.request.user, start_date, end_date) - charge = None - - # if not credit_card_needed: - # Get or create stripe customer - customer = StripeCustomer.get_or_create(email=self.request.user.email, - token=token) - if not customer: - form.add_error("__all__", "Invalid credit card") - return self.render_to_response(self.get_context_data(form=form)) - - # If booking is not free, make the stripe charge - if not is_free: - # Make stripe charge to a customer - stripe_utils = StripeUtils() - charge_response = stripe_utils.make_charge(amount=final_price, - customer=customer.stripe_id) - charge = charge_response.get('response_object') - - # Check if the payment was approved - if not charge: - context.update({ - 'paymentError': charge_response.get('error'), - 'form': form - }) - return render(self.request, self.template_name, context) - - charge = charge_response.get('response_object') - - # Create Billing Address for Membership Order - billing_address = form.save() - - # Create Billing Address for User if he does not have one - if not customer.user.billing_addresses.count(): - data.update({ - 'user': customer.user.id - }) - billing_address_user_form = UserBillingAddressForm(data) - billing_address_user_form.is_valid() - billing_address_user_form.save() - - # Create Booking - booking_data = { - 'start_date': start_date, - 'end_date': end_date, - 'start_date': start_date, - 'free_days': free_days, - 'price': normal_price, - 'final_price': final_price, - } - booking = Booking.create(booking_data) - - # Create Booking order - order_data = { - 'booking': booking, - 'customer': customer, - 'billing_address': billing_address, - 'stripe_charge': charge, - 'amount': final_price, - 'original_price': normal_price, - 'special_month_price': BookingPrice.objects.last().special_month_price, - } - order = BookingOrder.create(order_data) - - context = { - 'booking': booking, - 'order': order, - 'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host()) - } - - email_data = { - 'subject': 'Your booking order has been placed', - 'to': self.request.user.email, - 'context': context, - 'template_name': 'booking_order_email', - 'template_path': 'digitalglarus/emails/' - } - email = BaseEmail(**email_data) - email.send() - - return HttpResponseRedirect(self.get_success_url(order.id)) -''' +def Probar(TemplateView): + print ("hello") class ValidateUser(TemplateView): #print ("ENTRE AQUI AL MENOS Y",pk) @@ -222,8 +83,37 @@ class ValidateView(SignupViewMixin): #resp['msg'] = 0 #0 para exito #return HttpResponse(json.dumps(resp), content_type ='application/json') -class TermsAndConditions(TemplateView): - template_name ="digitalglarus/pinchecha.html" +def TermsAndConditions(request): +#template_name ="digitalglarus/new_credit_card.html" + print (request.user) + #u+Contacto.objects.filter(asesor = U.objects.get(email=request.session['user'])) + m=MembershipOrder.objects.filter(customer__user=request.user) + customer = StripeCustomer.get_or_create(email=request.user.email) + last_booking_order = BookingOrder.objects.filter(customer__user=request.user).last() + last_membership_order = MembershipOrder.objects.filter(customer__user=request.user).last() + credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ + and last_booking_order.get_booking_cc_data() \ + else last_membership_order.get_membership_order_cc_data() + for t in m: + print (t) + print ("Credit cad last4",credit_card_data['last4']) + print ("Brand type",credit_card_data) + resp = dict() + resp['msg'] = 0 #0 para exito + #return HttpResponse(json.dumps(resp), content_type ='application/json') + return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY}) + ''' + def get_success_url(self): + # redirect to membership orders list if user has at least one. + print (self.request.user) + print ("JNSKDJNASJDNKSJANDKJNSAKJDNKJND") + ''' +def TermsAndConditions3(request): + print ("hola hola hola hola hola") + return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand']}) + +class TermsAndConditions2(TemplateView): + template_name ="digitalglarus/credit_card_edit_confirmation.html" class IndexView(TemplateView): From 1648d9558cfe458c9f7f5609171feb9542d8ffb3 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Tue, 20 Dec 2016 11:15:09 -0400 Subject: [PATCH 05/13] credit card, button, modal size fixed --- .../static/digitalglarus/js/payment.js | 6 +- .../digitalglarus/booking_orders_detail.html | 2 +- .../digitalglarus/membership_payment.html | 78 ++++++++++++++----- .../digitalglarus/new_credit_card.html | 8 +- .../digitalglarus/reset_password.html | 2 +- digitalglarus/urls.py | 2 +- digitalglarus/views.py | 16 ++-- 7 files changed, 75 insertions(+), 39 deletions(-) diff --git a/digitalglarus/static/digitalglarus/js/payment.js b/digitalglarus/static/digitalglarus/js/payment.js index 90e922b1..2b06759a 100644 --- a/digitalglarus/static/digitalglarus/js/payment.js +++ b/digitalglarus/static/digitalglarus/js/payment.js @@ -19,7 +19,6 @@ $( document ).ready(function() { } if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) { // Only send the token to relative URLs i.e. locally. - alert("POR AQUI"); xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); } } @@ -34,7 +33,6 @@ $( document ).ready(function() { function submit_payment(e){ $('#billing-form').submit(); - alert("POR AQUI2"); // $form.submit(); } @@ -44,7 +42,7 @@ $( document ).ready(function() { /* If you're using Stripe for payments */ function payWithStripe(e) { - console.log("submiting33"); + console.log("submiting"); e.preventDefault(); if (!$('.agree-terms').is(':checked')){ @@ -55,7 +53,6 @@ $( document ).ready(function() { /* Visual feedback */ $form.find('[type=submit]').html('Validating <i class="fa fa-spinner fa-pulse"></i>'); - alert("POR AQUI3"); console.log("submiting2"); var PublishableKey = window.stripeKey; alert(PublishableKey); @@ -63,7 +60,6 @@ $( document ).ready(function() { Stripe.card.createToken($form, function stripeResponseHandler(status, response) { if (response.error) { /* Visual feedback */ - alert("POR AQUI32345"); $form.find('[type=submit]').html('Try again'); /* Show Stripe errors on the form */ $form.find('.payment-errors').text(response.error.message); diff --git a/digitalglarus/templates/digitalglarus/booking_orders_detail.html b/digitalglarus/templates/digitalglarus/booking_orders_detail.html index a91ec55a..a84428bd 100644 --- a/digitalglarus/templates/digitalglarus/booking_orders_detail.html +++ b/digitalglarus/templates/digitalglarus/booking_orders_detail.html @@ -84,7 +84,7 @@ <input type="hidden" name="start_date" value="{{order.booking.start_date}}"> <!-- <a class="" href="{% url 'digitalglarus:booking_orders_list' %}" data-toggle="modal" data-target="#cancel-booking-modal">Cancel booking</a> --> <a class="btn btn-primary btn-blue" href="{% url 'digitalglarus:booking_orders_list' %}">Go to my page</a> - <button type="button" class="btn btn-primary btn-blue" data-toggle="modal" data-target="#cancel-booking-modal">Cancel booking</button> + <button type="button" class="btn btn-primary btn-grey" data-toggle="modal" data-target="#cancel-booking-modal">Cancel booking</button> </p> <div class="modal fade bs-example-modal-sm" id="cancel-booking-modal" tabindex="-1" role="dialog"> diff --git a/digitalglarus/templates/digitalglarus/membership_payment.html b/digitalglarus/templates/digitalglarus/membership_payment.html index 70e987f4..e7b88f07 100644 --- a/digitalglarus/templates/digitalglarus/membership_payment.html +++ b/digitalglarus/templates/digitalglarus/membership_payment.html @@ -19,18 +19,17 @@ padding-right: 1.5em } - @media screen and (min-width: 768px) { - } +@media screen and (min-width: 768px) { - #cancel-subscription-modal .modal-dialog {width:1000px;} - -.glyphicon-flag { + cancel-subscription-modal .modal-dialog {width:1000px;} + + .glyphicon-flag { font-size: 44px; display: block; text-align: center; margin: 30px auto 30px; color: #88c7d7; -} + } .price2 { @@ -38,6 +37,45 @@ -moz-background-size: cover; } + + cancel-subscription-modal .modal-body { + max-height: 800px; + } + +} +@media screen and (min-width: 780px) { + + cancel-subscription-modal .modal-dialog {width:1000px;} + + .glyphicon-flag { + font-size: 44px; + display: block; + text-align: center; + margin: 30px auto 30px; + color: #88c7d7; + + } + .price2 { + + + -webkit-background-size: cover; + -moz-background-size: cover; + +} + + +} + + +@media screen and (min-width: 982px) { + + cancel-subscription-modal .modal-dialog {width:600px;} + + + cancel-subscription-modal .modal-body { + max-height: 600px; + } + } @@ -212,19 +250,23 @@ - <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> - + +<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-body"> - - <section id="price2"> - <div class="container"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - - <div class="row col-xs-12 col-sm-12 col-lg-10 text-center wow fadeInDown"> - <div class="price-box"> + <div class="modal-dialog" role="document"> + + <div class="modal-content"> + + <div class="modal-body"> + + <section id="price2"> + <div class="container"> + + <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> + <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <div class="price-box"> + <span class="glyphicon glyphicon-flag"></span> <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> diff --git a/digitalglarus/templates/digitalglarus/new_credit_card.html b/digitalglarus/templates/digitalglarus/new_credit_card.html index 6d262cb4..a8686755 100644 --- a/digitalglarus/templates/digitalglarus/new_credit_card.html +++ b/digitalglarus/templates/digitalglarus/new_credit_card.html @@ -72,14 +72,15 @@ </form> {% else %} - <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:TermsAndConditions' %}" novalidate> + {% csrf_token %} <h2 class="membership-lead">Last 4: *****{{last4}}</h2> <h2 class="membership-lead">Type: {{cc_brand}}</h2> <input type="hidden" name="credit_card_needed" value="false"/> </form> <h2 class="billing-head">Credit Card (New One)</h2> <div class="signup-form form-group row"> - {% csrf_token %} + <form role="form" id="payment-form" novalidate> {% csrf_token %} <div class="row"> @@ -125,7 +126,8 @@ <div class="row"> <div class="row"> <div class="col-xs-6 col-md-6 col-xs-offset-1 col-md-offset-3"> - <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">Cancel</button> + <a class="btn btn-primary btn-grey" href="{% url 'digitalglarus:booking_payment' %}">Go to my page</a> + <button class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Save</button> </div> </div> diff --git a/digitalglarus/templates/digitalglarus/reset_password.html b/digitalglarus/templates/digitalglarus/reset_password.html index f38c0fbd..9272ce36 100644 --- a/digitalglarus/templates/digitalglarus/reset_password.html +++ b/digitalglarus/templates/digitalglarus/reset_password.html @@ -26,7 +26,7 @@ </form> <br> <div class="notice-box"> - <p class="signup-text">Still have trouble? For technical support <a href="mailto:info@ungleich.ch" > Contact us </a>.</p> + <p class="signup-text">Still have trouble? For technical support, <a href="mailto:info@ungleich.ch"> contact us </a>.</p> </div> </div> diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index 9793e8cd..f851fb45 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -18,7 +18,7 @@ urlpatterns = [ url(_(r'probar/?$'), Probar, name='probar'), url(_(r'login/validate/(?P<pk>\!\w+)/?$'), ValidateUser.as_view(), name='validate-login'), url(_(r'^$'), IndexView.as_view(), name='landing'), - url(_(r'terms_conditions/?$'), TermsAndConditions, name='TermsAndConditions'), + url(_(r'new_credit_card/?$'), TermsAndConditions, name='TermsAndConditions'), url(_(r'support-us/?$'), SupportusView.as_view(), name='supportus'), url(_(r'contact/?$'), ContactView.as_view(), name='contact'), url(_(r'login/?$'), LoginView.as_view(), name='login'), diff --git a/digitalglarus/views.py b/digitalglarus/views.py index f13537b6..798c568f 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -1,6 +1,7 @@ import json import datetime - +from django.views.decorators.csrf import csrf_protect, csrf_exempt +from django.template import RequestContext from django.conf import settings from django.shortcuts import get_object_or_404, render from django.forms import ModelForm @@ -71,7 +72,6 @@ class ValidateView(SignupViewMixin): form_class = SignupForm success_url = reverse_lazy('digitalglarus:login') - #def activarUsuario(request, pk): #if request.method == 'POST': # u = U.objects.get(pk = pk) @@ -83,6 +83,7 @@ class ValidateView(SignupViewMixin): #resp['msg'] = 0 #0 para exito #return HttpResponse(json.dumps(resp), content_type ='application/json') +@csrf_exempt def TermsAndConditions(request): #template_name ="digitalglarus/new_credit_card.html" print (request.user) @@ -94,14 +95,9 @@ def TermsAndConditions(request): credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ and last_booking_order.get_booking_cc_data() \ else last_membership_order.get_membership_order_cc_data() - for t in m: - print (t) - print ("Credit cad last4",credit_card_data['last4']) - print ("Brand type",credit_card_data) - resp = dict() - resp['msg'] = 0 #0 para exito - #return HttpResponse(json.dumps(resp), content_type ='application/json') - return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY}) + + current_billing_address = request.user.billing_addresses.first() + return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) ''' def get_success_url(self): # redirect to membership orders list if user has at least one. From 17eb6519796c7b1784e2f8536fee6df5ca7bfe0c Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Thu, 22 Dec 2016 11:18:30 -0400 Subject: [PATCH 06/13] credit card issues --- .../static/digitalglarus/js/payment.js | 1 - .../digitalglarus/booking_payment.html | 62 ++++++++++++++++++- .../digitalglarus/new_credit_card.html | 50 +++++++-------- 3 files changed, 83 insertions(+), 30 deletions(-) diff --git a/digitalglarus/static/digitalglarus/js/payment.js b/digitalglarus/static/digitalglarus/js/payment.js index 2b06759a..c7463a5a 100644 --- a/digitalglarus/static/digitalglarus/js/payment.js +++ b/digitalglarus/static/digitalglarus/js/payment.js @@ -55,7 +55,6 @@ $( document ).ready(function() { $form.find('[type=submit]').html('Validating <i class="fa fa-spinner fa-pulse"></i>'); console.log("submiting2"); var PublishableKey = window.stripeKey; - alert(PublishableKey); Stripe.setPublishableKey(PublishableKey); Stripe.card.createToken($form, function stripeResponseHandler(status, response) { if (response.error) { diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index f257d1d9..cfa079a2 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -164,8 +164,8 @@ <br/> <input type="checkbox" class="custom-control-input agree-terms"> <span class="custom-control-indicator"></span> - <span class="custom-control-description">I accept the Digital Glarus <a href="{% url 'digitalglarus:TermsAndConditions' %}" target="_blank">Terms and Conditions</a>, <a href=#>Community Guidelines</a> and <a href=#>Privacy Policy</a></span> - </label> + <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="button-box"> <div class="row"> <div class="col-xs-12"> @@ -203,6 +203,64 @@ </div> </div> </section> + +<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-body"> + <section id="price2"> + <div class="container"> + <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> + <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <div class="price-box"> + <span class="glyphicon glyphicon-flag"></span> + <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> + <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> + <hr class="primary"> + <div class="price-exp-box"> + <p class="text-left"> + <p class="term-head">1. Membership</p> + 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> + 1.2. Each additional day costs 15CHF for members.<br> + <br> + <p class="term-head">2. Coworking days</p> + 2.1. Coworking days are counted as 1 calendar day. <br> + 2.2. Free coworking days are included in the membership. <br> + 2.3. Unused working days are not refunded and can not be compensated for. <br><br> + <p class="term-head">3. Possible reduction</p> + 3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> + 3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> + 3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> + <p class="term-head">4. Member's right to cancellation </p> + 4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> + 4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> + <p class="term-head">5. Digital Glarus' right to cancel a membership </p> + 5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> + <p class="term-head">6. Digital Glarus' right to cancel a membership </p> + 6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> + 6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> + 6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. + <br><br> + </p> + <div class="text-center"> + <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> + </div> + <div class="row col-md-2 text-center wow fadeInDown"> + </div> + </div> + </div> + </div> + <div class="row col-md-3 text-center wow fadeInDown"></div> + </div> + </section> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> +</div><!-- /.modal --> + <!-- stripe key data --> {% if stripe_key %} diff --git a/digitalglarus/templates/digitalglarus/new_credit_card.html b/digitalglarus/templates/digitalglarus/new_credit_card.html index a8686755..3163738c 100644 --- a/digitalglarus/templates/digitalglarus/new_credit_card.html +++ b/digitalglarus/templates/digitalglarus/new_credit_card.html @@ -22,6 +22,8 @@ .order-bottom-text a{ margin-left: 0px; } + + </style> <section id="price"> @@ -33,13 +35,7 @@ <hr class="greyline-long"> <h2 class="membership-lead"> - Your Digital Glarus Membership enables - you to use our coworking space and it includes - 2 working days for the month you signed up. - The membership fee is a monthly subscription. - Additional day costs - 15CHF per day. More than 17 days a month it - will charge only 290CHF/month. + </h2> {% if is_free %} <h2 class="billing-head">Billing Adress</h2> @@ -72,7 +68,7 @@ </form> {% else %} - <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:TermsAndConditions' %}" novalidate> + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> {% csrf_token %} <h2 class="membership-lead">Last 4: *****{{last4}}</h2> <h2 class="membership-lead">Type: {{cc_brand}}</h2> @@ -81,12 +77,16 @@ <h2 class="billing-head">Credit Card (New One)</h2> <div class="signup-form form-group row"> - <form role="form" id="payment-form" novalidate> - {% csrf_token %} + + + + + <form role="form" id="payment-form" novalidate> + {% csrf_token %} <div class="row"> <div class="col-xs-12 col-md-12"> <div class="form-group"> - <input for="name" type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" /> + <input type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" /> </div> </div> </div> @@ -98,7 +98,7 @@ </div> </div> <div class="row"> - <div class="col-xs-6 col-md-6 nopadding"> + <div class="col-xs-12 col-md-6 nopadding"> <label for="expMonth">EXPIRATION DATE</label><br/> <div class="col-xs-6 col-lg-6 col-md-6"> <div class="form-group"> @@ -111,30 +111,28 @@ </div> </div> </div> - <div class="col-xs-4 col-md-6 pull-right"> + <div class="col-xs-12 col-md-6 pull-right"> <div class="form-group"> <label for="cvCode">CV CODE</label> <input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" /> </div> </div> - - <div class="text-center"> - - </div> + </div> <input type="checkbox" hidden="True" class="custom-control-input agree-terms" checked> - <div class="row"> - <div class="row"> + <div class="row"> + + <div class="col-xs-6 col-md-6 col-xs-offset-1 col-md-offset-3"> - <a class="btn btn-primary btn-grey" href="{% url 'digitalglarus:booking_payment' %}">Go to my page</a> + + + <a class="btn btn-primary btn-grey" href="{% url 'digitalglarus:booking_payment' %}">Cancel</a> <button class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Save</button> + </div> - </div> + </div> - - - <div class="row" style="display:none;"> <div class="col-xs-12"> <p class="payment-errors"></p> @@ -148,10 +146,8 @@ </p> </div> </div> - - - {% endif %} + </form> <br> </div> From 86777a4699c1aae5bd7b4e491d506bc7d3804d8f Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Tue, 3 Jan 2017 09:33:25 -0400 Subject: [PATCH 07/13] credit card edit --- .../static/digitalglarus/js/payment.js | 3 + .../digitalglarus/booking_payment.html | 3 +- .../digitalglarus/booking_payment2.html | 301 ++++++++++++++++++ .../digitalglarus/membership_payment.html | 3 +- .../digitalglarus/new_credit_card.html | 21 +- digitalglarus/urls.py | 3 +- digitalglarus/views.py | 134 ++++++-- 7 files changed, 432 insertions(+), 36 deletions(-) create mode 100644 digitalglarus/templates/digitalglarus/booking_payment2.html diff --git a/digitalglarus/static/digitalglarus/js/payment.js b/digitalglarus/static/digitalglarus/js/payment.js index d9c70f36..7e30a667 100644 --- a/digitalglarus/static/digitalglarus/js/payment.js +++ b/digitalglarus/static/digitalglarus/js/payment.js @@ -28,6 +28,7 @@ $( document ).ready(function() { var hasCreditcard = window.hasCreditcard; + hasCreditcard= true; console.log("has creditcard"); console.log("has creditcard"); console.log("has creditcard"); @@ -40,9 +41,11 @@ $( document ).ready(function() { e.preventDefault(); if (hasCreditcard) { $('#billing-form').submit(); + console.log("has creditcard2"); } else { $('#payment-form').submit(); + console.log("has creditcard3"); } diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index bcbf88e4..24a840c3 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -70,7 +70,7 @@ <br> </form> </div> - {% if credit_card_data.last4 and credit_card_data.cc_brand %} + {% if credit_card_data.last4 %} <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">Edit</a></h2> <h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2> @@ -78,6 +78,7 @@ <input type="hidden" name="credit_card_needed" value="false"/> </form> {% else %} + <h2 class="billing-head">Credit Card (Last used)</h2> <div class="signup-form form-group row"> <form role="form" id="payment-form" novalidate> diff --git a/digitalglarus/templates/digitalglarus/booking_payment2.html b/digitalglarus/templates/digitalglarus/booking_payment2.html new file mode 100644 index 00000000..758f918a --- /dev/null +++ b/digitalglarus/templates/digitalglarus/booking_payment2.html @@ -0,0 +1,301 @@ +{% extends "new_base_glarus.html" %} +{% load staticfiles bootstrap3 i18n %} +{% block content %} + +<style type="text/css"> + + .nopadding { + padding: 0 !important; + margin: 0 !important; + } + + .form-control#id_country{ + -webkit-appearance: none; + -moz-appearance: none; + background-position: right 50%; + background-repeat: no-repeat; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NDZFNDEwNjlGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NDZFNDEwNkFGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0NkU0MTA2N0Y3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0NkU0MTA2OEY3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PuGsgwQAAAA5SURBVHjaYvz//z8DOYCJgUxAf42MQIzTk0D/M+KzkRGPoQSdykiKJrBGpOhgJFYTWNEIiEeAAAMAzNENEOH+do8AAAAASUVORK5CYII=); + padding: .5em; + padding-right: 1.5em + } + + .order-bottom-text a{ + margin-left: 0px; + } +</style> + + <section id="price"> + <div class="signup-container"> + <div class="col-xs-12 col-sm-6 col-lg-8 text-center wow fadeInDown"> + <div class="payment-box"> + <h2 class="section-heading payment-head">Booking</h2> + <!-- <h2 class="membership-amount">35CHF</h2> --> + <hr class="greyline-long"> + + <h2 class="membership-lead"> + Your Digital Glarus Membership enables + you to use our coworking space and it includes + 2 working days for the month you signed up. + The membership fee is a monthly subscription. + Additional day costs + 15CHF per day. More than 17 days a month it + will charge only 290CHF/month. + </h2> + {% if is_free %} + <h2 class="billing-head">Billing Adress</h2> + <div class="signup-form form-group row"> + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + {% for field in form %} + {% csrf_token %} + {% bootstrap_field field show_label=False type='fields'%} + {% endfor %} + {% bootstrap_form_errors form type='non_fields'%} + <br> + </form> + </div> + + <hr class="greyline-long"> + <br/> + <h2 class="billing-head">Your booking is FREE of charge! You can change or cancel the booking freely 7 days before the booking date.</h2> + <br/><br/> + {% else %} + <h2 class="billing-head">Billing Adress</h2> + <div class="signup-form form-group row"> + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + {% for field in form %} + {% csrf_token %} + {% bootstrap_field field show_label=False type='fields'%} + {% endfor %} + {% bootstrap_form_errors form type='non_fields'%} + <br> + </form> + <div class="col-xs-4 col-md-6 pull-right"> + <div class="form-group"> + <label for="cvCode">CV CODE</label> + <input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" /> + </div> + </div> + </div> + <div class="col-xs-4 col-md-6 pull-right"> + <div class="form-group"> + <label for="cvCode">CV CODE</label> + <input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" /> + </div> + </div> + <div class="col-xs-4 col-md-6 pull-right"> + <div class="form-group"> + <label for="cvCode">CV CODE</label> + <input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" /> + </div> + </div> + + {% if last4 %} + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">Edit</a></h2> + <h2 class="membership-lead">Last 4: *****{{last4}}</h2> + <h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2> + <input type="hidden" name="credit_card_needed" value="false"/> + </form> + {% else %} + + <h2 class="billing-head">Credit Card (Last used)</h2> + <div class="signup-form form-group row"> + <form role="form" id="payment-form" novalidate> + <div class="row"> + <div class="col-xs-12 col-md-12"> + <div class="form-group"> + <input type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" /> + </div> + </div> + </div> + <div class="row"> + <div class="col-xs-12 col-md-12"> + <div class="form-group"> + <input type="text" class="form-control" name="cardNumber" placeholder="Valid Card Number" required data-stripe="number" /> + </div> + </div> + </div> + <div class="row"> + <div class="col-xs-6 col-md-6 nopadding"> + <label for="expMonth">EXPIRATION DATE</label><br/> + <div class="col-xs-6 col-lg-6 col-md-6"> + <div class="form-group"> + <input type="text" class="form-control" name="expMonth" placeholder="MM" required data-stripe="exp_month" /> + </div> + </div> + <div class="col-xs-6 col-lg-6 col-md-6 pl-ziro"> + <div class="form-group"> + <input type="text" class="form-control" name="expYear" placeholder="YY" required data-stripe="exp_year" /> + </div> + </div> + </div> + <div class="col-xs-4 col-md-6 pull-right"> + <div class="form-group"> + <label for="cvCode">CV CODE</label> + <input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" /> + </div> + </div> + </div> + <div class="row" style="display:none;"> + <div class="col-xs-12"> + <p class="payment-errors"></p> + </div> + </div> + {% if paymentError %} + <div class="row"> + <div class="col-xs-12"> + <p> + {% bootstrap_alert paymentError alert_type='danger' %} + </p> + </div> + </div> + + {% endif %} + </form> + <br> + </div> + {% endif %} + {% endif %} + </div> + </div> + <div class="col-xs-12 col-sm-4 col-lg-4 wow fadeInDown"> + <div class="order-summary"> + <div class="header text-center"> + <h2 class="order-name">Booking Summary</h2> + </div> + <div class="order-box"> + <h3 class="col-xs-6 order-item">Dates {{start_date}} - {{end_date}}</h3> + <p class="order-bottom-text"> + <a href="{{request.META.HTTP_REFERER}}">Change dates</a> + </p> + <hr class="greyline"> + <h2 class="col-xs-6 payment-total">Total days: {{booking_days}} </h2> + <h2 class="order-sum">{{original_price|floatformat}}CHF</h2> + <br/> + {% if free_days %} + <h2 class="col-xs-6 payment-total">Free days: {{free_days}}</h2> + <h2 class="order-sum"><span class="text-danger">-{{total_discount|floatformat}}CHF</span></h2> + {% endif %} + <hr class="greyline"> + <h2 class="col-xs-6 payment-total">Total</h2> + <h2 class="order-result">{{final_price|floatformat}}CHF</h2> + <div class="text-center"> + <label class="custom-control custom-checkbox"> + <br/> + <input type="checkbox" class="custom-control-input agree-terms"> + <span class="custom-control-indicator"></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> + <div class="button-box"> + <div class="row"> + <div class="col-xs-12"> + <button id="payment_button" class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Book</button> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </section> + + + + <section id="contact"> + <div class="fill"> + <div class="row" class="wow fadeInDown"> + <div class="col-lg-12 text-center wow fadeInDown"> + <div class="col-md-4 map-title"> + Digital Glarus<br> + <span class="map-caption">In der Au 7 Schwanden 8762 Switzerland + <br>info@digitalglarus.ch + <br> + (044) 534-66-22 + <p> </p> + </span> + </div> + <p> </p> + </div> + </div> + </div> + </section> + +<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-body"> + <section id="price2"> + <div class="container"> + <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> + <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <div class="price-box"> + <span class="glyphicon glyphicon-flag"></span> + <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> + <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> + <hr class="primary"> + <div class="price-exp-box"> + <p class="text-left"> + <p class="term-head">1. Membership</p> + 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> + 1.2. Each additional day costs 15CHF for members.<br> + <br> + <p class="term-head">2. Coworking days</p> + 2.1. Coworking days are counted as 1 calendar day. <br> + 2.2. Free coworking days are included in the membership. <br> + 2.3. Unused working days are not refunded and can not be compensated for. <br><br> + <p class="term-head">3. Possible reduction</p> + 3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> + 3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> + 3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> + <p class="term-head">4. Member's right to cancellation </p> + 4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> + 4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> + <p class="term-head">5. Digital Glarus' right to cancel a membership </p> + 5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> + <p class="term-head">6. Digital Glarus' right to cancel a membership </p> + 6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> + 6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> + 6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. + <br><br> + </p> + <div class="text-center"> + <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> + </div> + <div class="row col-md-2 text-center wow fadeInDown"> + </div> + </div> + </div> + </div> + <div class="row col-md-3 text-center wow fadeInDown"></div> + </div> + </section> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> +</div><!-- /.modal --> + + +<!-- stripe key data --> +{% if stripe_key %} +<script type="text/javascript"> + (function () {window.stripeKey = "{{stripe_key}}";})(); +</script> + +{%endif%} + +{% if credit_card_data.last4 and credit_card_data.cc_brand %} +<script type="text/javascript"> + (function () {window.hasCreditcard = true;})(); +</script> + +{%endif%} + + +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/membership_payment.html b/digitalglarus/templates/digitalglarus/membership_payment.html index 7fe42ffb..0e68be43 100644 --- a/digitalglarus/templates/digitalglarus/membership_payment.html +++ b/digitalglarus/templates/digitalglarus/membership_payment.html @@ -120,7 +120,8 @@ <div class="row"> <div class="col-xs-12 col-md-12"> <div class="form-group"> - <input type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" /> + + <input type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" /> </div> </div> </div> diff --git a/digitalglarus/templates/digitalglarus/new_credit_card.html b/digitalglarus/templates/digitalglarus/new_credit_card.html index 3163738c..314e28f8 100644 --- a/digitalglarus/templates/digitalglarus/new_credit_card.html +++ b/digitalglarus/templates/digitalglarus/new_credit_card.html @@ -37,7 +37,7 @@ <h2 class="membership-lead"> </h2> - {% if is_free %} + <!-- {% if is_free %} <h2 class="billing-head">Billing Adress</h2> <div class="signup-form form-group row"> <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> @@ -55,19 +55,12 @@ <h2 class="billing-head">Your booking is FREE of charge! You can change or cancel the booking freely 7 days before the booking date.</h2> <br/><br/> {% else %} + --> <br> <h2 class="billing-head">Credit Card Information</h2> - {% if credit_card_data %} - <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> - <h2 class="membership-lead">Last 4: *****{{last4}}</h2> - <h2 class="membership-lead">Type: {{cc_brand}}</h2> - - <input type="hidden" name="credit_card_needed" value="false"/> - </form> - - {% else %} + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> {% csrf_token %} <h2 class="membership-lead">Last 4: *****{{last4}}</h2> @@ -81,7 +74,9 @@ - <form role="form" id="payment-form" novalidate> + <!-- <form role="form" id="payment-form" novalidate> --> + <form role="form" id="payment-form2" method="post" action="{% url 'digitalglarus:booking_payment_view' %}" novalidate> + {% csrf_token %} <div class="row"> <div class="col-xs-12 col-md-12"> @@ -151,8 +146,8 @@ </form> <br> </div> - {% endif %} - {% endif %} + + <!-- {% endif %} --> </div> </div> diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index f851fb45..8590dd79 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -7,12 +7,13 @@ from .views import ContactView, IndexView, AboutView, HistoryView, LoginView, Si MembershipPricingView, BookingSelectDatesView, BookingPaymentView, OrdersBookingDetailView,\ BookingOrdersListView, MembershipOrdersListView, OrdersMembershipDetailView, \ MembershipDeactivateView, MembershipDeactivateSuccessView, UserBillingAddressView, \ - MembershipReactivateView,TermsAndConditions,ValidateUser,SupportusView,Probar,TermsAndConditions2,TermsAndConditions3 + MembershipReactivateView,TermsAndConditions,ValidateUser,SupportusView,Probar,TermsAndConditions2,TermsAndConditions3,BookingPaymentView2 # from membership.views import LoginRegistrationView urlpatterns = [ + url(_(r'booking/payment/view/?$'), BookingPaymentView2, name='booking_payment_view'), url(_(r'probar3/?$'),TermsAndConditions3, name='probar3'), url(_(r'probar2/?$'),TermsAndConditions2.as_view(), name='credit_card_edit'), url(_(r'probar/?$'), Probar, name='probar'), diff --git a/digitalglarus/views.py b/digitalglarus/views.py index b5ed4a6d..a8688348 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -21,18 +21,15 @@ from .models import Supporter from .mixins import ChangeMembershipStatusMixin from utils.forms import ContactUsForm from utils.mailer import BaseEmail - from django.views.generic.edit import FormView from membership.calendar.calendar import BookCalendar from membership.models import Calendar as CalendarModel, StripeCustomer - - from utils.views import LoginViewMixin, SignupViewMixin, \ PasswordResetViewMixin, PasswordResetConfirmViewMixin from utils.forms import PasswordResetRequestForm, UserBillingAddressForm from utils.stripe_utils import StripeUtils from utils.models import UserBillingAddress - +import stripe from .forms import LoginForm, SignupForm, MembershipBillingForm, BookingDateForm,\ BookingBillingForm, CancelBookingForm @@ -41,14 +38,38 @@ from .models import MembershipType, Membership, MembershipOrder, Booking, Bookin BookingOrder, BookingCancellation from .mixins import MembershipRequiredMixin, IsNotMemberMixin - -''' -class Probar(TemplateView): - template_name='digitalglarus/new_credit_card.html' - model = Membership - success_url = reverse_lazy('digitalglarus:probar') -''' - + +def BookingPaymentView2(request): + #print (request.user) + resp = dict() + cus = StripeCustomer.get_or_create(email=request.user.email) + s= str(cus) + s= s.split(" ") + resp['object']='card' + resp['exp_month']=request.POST['expMonth'] + resp['exp_year']=request.POST['expYear'] + resp['number']=request.POST['cardNumber'] + resp['cvc']=request.POST['cvCode'] + resp['name']=request.POST['cardName'] + customer = stripe.Customer.retrieve(s[0]) + customer.sources.create(source=resp) + t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + tt=t['data'] + x= resp['number'] + cc= dict() + for i in tt: + #print (i.id) + #print (i.last4) + #print (x[-4:]) + if i.last4 == x[-4:]: + cc['last4']= i.last4 + cc['cc_brand']= i.brand + customer.default_source= i.id + customer.save() + current_billing_address = request.user.billing_addresses.first() + #return HttpResponse(json.dumps(resp), content_type ='application/json') + #return render_to_response('digitalglarus/booking_payment.html',{'last4':cc['last4'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) + return HttpResponseRedirect('/digitalglarus/booking/payment/') def Probar(TemplateView): print ("hello") @@ -85,11 +106,55 @@ class ValidateView(SignupViewMixin): @csrf_exempt def TermsAndConditions(request): -#template_name ="digitalglarus/new_credit_card.html" - print (request.user) - #u+Contacto.objects.filter(asesor = U.objects.get(email=request.session['user'])) + cus = StripeCustomer.get_or_create(email=request.user.email) + s= str(cus) + s= s.split(" ") + #t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + #tt=t['data'] + #print (tt) + #for i in tt: + # print (i.id) + # print (i.last4) + # print ("aja estoy aqui",i.id) + # customer = stripe.Customer.retrieve(s[0]) + # customer.sources.retrieve(i.id).delete() + + # crear tarjeta de credito + + customer = stripe.Customer.retrieve(s[0]) + #print ("voy por aqui") + custom_card= customer.default_source + t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + tt=t['data'] + #print (tt) + cc = dict() + for i in tt: + #print (i.id) + #print (i.last4) + if i.id== custom_card: + #print ("ESTA ES LA TARJETA ACTUAL") + cc['last4']= i.last4 + cc['cc_brand'] = i.brand + + + + + #customer.sources.create(source=resp) + #t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + #tt=t['data'] + #x= resp['number'] + #for i in tt: + # print (i.id) + # print (i.last4) + # print (x[-4:]) + # if i.last4 == x[-4:]: + # print ("ESTOY AQUI") + # customer.default_source= i.id + #customer.save() m=MembershipOrder.objects.filter(customer__user=request.user) customer = StripeCustomer.get_or_create(email=request.user.email) + + last_booking_order = BookingOrder.objects.filter(customer__user=request.user).last() last_membership_order = MembershipOrder.objects.filter(customer__user=request.user).last() credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ @@ -97,9 +162,13 @@ def TermsAndConditions(request): else last_membership_order.get_membership_order_cc_data() current_billing_address = request.user.billing_addresses.first() - return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) + + #return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) + return render_to_response('digitalglarus/new_credit_card.html',{'last4':cc['last4'],'brand_type':cc['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) + #return render_to_response('digitalglarus/new_credit_card.html',{'last4':'probando','brand_type':'probando','stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) ''' - def get_success_url(self): + def g + et_success_url(self): # redirect to membership orders list if user has at least one. print (self.request.user) print ("JNSKDJNASJDNKSJANDKJNSAKJDNKJND") @@ -256,9 +325,34 @@ class BookingPaymentView(LoginRequiredMixin, MembershipRequiredMixin, FormView): user = self.request.user last_booking_order = BookingOrder.objects.filter(customer__user=user).last() last_membership_order = MembershipOrder.objects.filter(customer__user=user).last() - credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ - and last_booking_order.get_booking_cc_data() \ - else last_membership_order.get_membership_order_cc_data() + + #credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ + # and last_booking_order.get_booking_cc_data() \ + # else last_membership_order.get_membership_order_cc_data() + #print ("LA TARJETA NATACHA QUE QUEREMOS VER SI FUNCIONA ES ESTA",credit_card_data) + #credit_card_data = + #### ESTOY POR AQUI CAMBIANDO ESTO UN POCO PARA VER SI FUNCIONA + ########################################################################################## + cus = StripeCustomer.get_or_create(email=user ) + s= str(cus) + s= s.split(" ") + customer = stripe.Customer.retrieve(s[0]) + #print ("voy por aqui") + custom_card= customer.default_source + t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + tt=t['data'] + cc = dict() + for i in tt: + #print (i.id) + #print (i.last4) + if i.id== custom_card: + credit_card_data= i + #print ("ESTA ES LA TARJETA ACTUAL") + cc['last4']= i.last4 + cc['cc_brand'] = i.brand + ########################################################################## + + booking_data.update({ 'credit_card_data': credit_card_data if credit_card_data else None, From 2b2b40a9eff284b1dfe2e224c4bc93f348427689 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Wed, 4 Jan 2017 23:20:54 -0400 Subject: [PATCH 08/13] carousel working fine, and new activity of edit exp date of credit card is on testing --- .../static/digitalglarus/css/ungleich.css | 4 +- .../digitalglarus/booking_payment.html | 6 +- .../dist/remodal-default-theme.css | 311 +++++++ .../templates/digitalglarus/dist/remodal.css | 93 +++ .../templates/digitalglarus/dist/remodal.js | 785 ++++++++++++++++++ .../digitalglarus/dist/remodal.min.js | 10 + .../digitalglarus/edit_credit_card.html | 293 +++++++ .../templates/digitalglarus/login.html | 53 +- .../digitalglarus/new_credit_card.html | 2 +- digitalglarus/urls.py | 3 +- digitalglarus/views.py | 58 +- 11 files changed, 1572 insertions(+), 46 deletions(-) create mode 100644 digitalglarus/templates/digitalglarus/dist/remodal-default-theme.css create mode 100644 digitalglarus/templates/digitalglarus/dist/remodal.css create mode 100644 digitalglarus/templates/digitalglarus/dist/remodal.js create mode 100644 digitalglarus/templates/digitalglarus/dist/remodal.min.js create mode 100644 digitalglarus/templates/digitalglarus/edit_credit_card.html diff --git a/digitalglarus/static/digitalglarus/css/ungleich.css b/digitalglarus/static/digitalglarus/css/ungleich.css index 7742e5cd..03a2b47c 100644 --- a/digitalglarus/static/digitalglarus/css/ungleich.css +++ b/digitalglarus/static/digitalglarus/css/ungleich.css @@ -64,8 +64,8 @@ } .ungleich-gallery-text-carousel .carousel-indicators li, .text-carousel .carousel-indicators li { - width: 5px; - height: 5px; + width: 10px; + height: 10px; margin: 10px; border: 0; border-radius: 50%; diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index 24a840c3..4fef2c89 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -72,7 +72,7 @@ </div> {% if credit_card_data.last4 %} <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> - <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">Edit</a></h2> + <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">New</a><a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:edit_credit_card' %}">Edit</a></h2> <h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2> <h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2> <input type="hidden" name="credit_card_needed" value="false"/> @@ -220,7 +220,7 @@ <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> <hr class="primary"> <div class="price-exp-box"> - <p class="text-left"> + <p class="text-center"> <p class="term-head">1. Membership</p> 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> 1.2. Each additional day costs 15CHF for members.<br> @@ -246,7 +246,7 @@ 6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. <br><br> </p> - <div class="text-center"> + <div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> </div> <div class="row col-md-2 text-center wow fadeInDown"> diff --git a/digitalglarus/templates/digitalglarus/dist/remodal-default-theme.css b/digitalglarus/templates/digitalglarus/dist/remodal-default-theme.css new file mode 100644 index 00000000..ee8385c0 --- /dev/null +++ b/digitalglarus/templates/digitalglarus/dist/remodal-default-theme.css @@ -0,0 +1,311 @@ +/* + * Remodal - v1.1.0 + * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. + * http://vodkabears.github.io/remodal/ + * + * Made by Ilya Makarov + * Under MIT License + */ + +/* ========================================================================== + Remodal's default mobile first theme + ========================================================================== */ + +/* Default theme styles for the background */ + +.remodal-bg.remodal-is-opening, +.remodal-bg.remodal-is-opened { + -webkit-filter: blur(3px); + filter: blur(3px); +} + +/* Default theme styles of the overlay */ + +.remodal-overlay { + background: rgba(43, 46, 56, 0.9); +} + +.remodal-overlay.remodal-is-opening, +.remodal-overlay.remodal-is-closing { + -webkit-animation-duration: 0.3s; + animation-duration: 0.3s; + -webkit-animation-fill-mode: forwards; + animation-fill-mode: forwards; +} + +.remodal-overlay.remodal-is-opening { + -webkit-animation-name: remodal-overlay-opening-keyframes; + animation-name: remodal-overlay-opening-keyframes; +} + +.remodal-overlay.remodal-is-closing { + -webkit-animation-name: remodal-overlay-closing-keyframes; + animation-name: remodal-overlay-closing-keyframes; +} + +/* Default theme styles of the wrapper */ + +.remodal-wrapper { + padding: 10px 10px 0; +} + +/* Default theme styles of the modal dialog */ + +.remodal { + box-sizing: border-box; + width: 100%; + margin-bottom: 10px; + padding: 35px; + + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + + color: #2b2e38; + background: #fff; +} + +.remodal.remodal-is-opening, +.remodal.remodal-is-closing { + -webkit-animation-duration: 0.3s; + animation-duration: 0.3s; + -webkit-animation-fill-mode: forwards; + animation-fill-mode: forwards; +} + +.remodal.remodal-is-opening { + -webkit-animation-name: remodal-opening-keyframes; + animation-name: remodal-opening-keyframes; +} + +.remodal.remodal-is-closing { + -webkit-animation-name: remodal-closing-keyframes; + animation-name: remodal-closing-keyframes; +} + +/* Vertical align of the modal dialog */ + +.remodal, +.remodal-wrapper:after { + vertical-align: middle; +} + +/* Close button */ + +.remodal-close { + position: absolute; + top: 0; + left: 0; + + display: block; + overflow: visible; + + width: 35px; + height: 35px; + margin: 0; + padding: 0; + + cursor: pointer; + -webkit-transition: color 0.2s; + transition: color 0.2s; + text-decoration: none; + + color: #95979c; + border: 0; + outline: 0; + background: transparent; +} + +.remodal-close:hover, +.remodal-close:focus { + color: #2b2e38; +} + +.remodal-close:before { + font-family: Arial, "Helvetica CY", "Nimbus Sans L", sans-serif !important; + font-size: 25px; + line-height: 35px; + + position: absolute; + top: 0; + left: 0; + + display: block; + + width: 35px; + + content: "\00d7"; + text-align: center; +} + +/* Dialog buttons */ + +.remodal-confirm, +.remodal-cancel { + font: inherit; + + display: inline-block; + overflow: visible; + + min-width: 110px; + margin: 0; + padding: 12px 0; + + cursor: pointer; + -webkit-transition: background 0.2s; + transition: background 0.2s; + text-align: center; + vertical-align: middle; + text-decoration: none; + + border: 0; + outline: 0; +} + +.remodal-confirm { + color: #fff; + background: #81c784; +} + +.remodal-confirm:hover, +.remodal-confirm:focus { + background: #66bb6a; +} + +.remodal-cancel { + color: #fff; + background: #e57373; +} + +.remodal-cancel:hover, +.remodal-cancel:focus { + background: #ef5350; +} + +/* Remove inner padding and border in Firefox 4+ for the button tag. */ + +.remodal-confirm::-moz-focus-inner, +.remodal-cancel::-moz-focus-inner, +.remodal-close::-moz-focus-inner { + padding: 0; + + border: 0; +} + +/* Keyframes + ========================================================================== */ + +@-webkit-keyframes remodal-opening-keyframes { + from { + -webkit-transform: scale(1.05); + transform: scale(1.05); + + opacity: 0; + } + to { + -webkit-transform: none; + transform: none; + + opacity: 1; + } +} + +@keyframes remodal-opening-keyframes { + from { + -webkit-transform: scale(1.05); + transform: scale(1.05); + + opacity: 0; + } + to { + -webkit-transform: none; + transform: none; + + opacity: 1; + } +} + +@-webkit-keyframes remodal-closing-keyframes { + from { + -webkit-transform: scale(1); + transform: scale(1); + + opacity: 1; + } + to { + -webkit-transform: scale(0.95); + transform: scale(0.95); + + opacity: 0; + } +} + +@keyframes remodal-closing-keyframes { + from { + -webkit-transform: scale(1); + transform: scale(1); + + opacity: 1; + } + to { + -webkit-transform: scale(0.95); + transform: scale(0.95); + + opacity: 0; + } +} + +@-webkit-keyframes remodal-overlay-opening-keyframes { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@keyframes remodal-overlay-opening-keyframes { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@-webkit-keyframes remodal-overlay-closing-keyframes { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +@keyframes remodal-overlay-closing-keyframes { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +/* Media queries + ========================================================================== */ + +@media only screen and (min-width: 641px) { + .remodal { + max-width: 700px; + } +} + +/* IE8 + ========================================================================== */ + +.lt-ie9 .remodal-overlay { + background: #2b2e38; +} + +.lt-ie9 .remodal { + width: 700px; +} diff --git a/digitalglarus/templates/digitalglarus/dist/remodal.css b/digitalglarus/templates/digitalglarus/dist/remodal.css new file mode 100644 index 00000000..92a000ca --- /dev/null +++ b/digitalglarus/templates/digitalglarus/dist/remodal.css @@ -0,0 +1,93 @@ +/* + * Remodal - v1.1.0 + * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. + * http://vodkabears.github.io/remodal/ + * + * Made by Ilya Makarov + * Under MIT License + */ + +/* ========================================================================== + Remodal's necessary styles + ========================================================================== */ + +/* Hide scroll bar */ + +html.remodal-is-locked { + overflow: hidden; + + -ms-touch-action: none; + touch-action: none; +} + +/* Anti FOUC */ + +.remodal, +[data-remodal-id] { + display: none; +} + +/* Necessary styles of the overlay */ + +.remodal-overlay { + position: fixed; + z-index: 9999; + top: -5000px; + right: -5000px; + bottom: -5000px; + left: -5000px; + + display: none; +} + +/* Necessary styles of the wrapper */ + +.remodal-wrapper { + position: fixed; + z-index: 10000; + top: 0; + right: 0; + bottom: 0; + left: 0; + + display: none; + overflow: auto; + + text-align: center; + + -webkit-overflow-scrolling: touch; +} + +.remodal-wrapper:after { + display: inline-block; + + height: 100%; + margin-left: -0.05em; + + content: ""; +} + +/* Fix iPad, iPhone glitches */ + +.remodal-overlay, +.remodal-wrapper { + -webkit-backface-visibility: hidden; + backface-visibility: hidden; +} + +/* Necessary styles of the modal dialog */ + +.remodal { + position: relative; + + outline: none; + + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + text-size-adjust: 100%; +} + +.remodal-is-initialized { + /* Disable Anti-FOUC */ + display: inline-block; +} diff --git a/digitalglarus/templates/digitalglarus/dist/remodal.js b/digitalglarus/templates/digitalglarus/dist/remodal.js new file mode 100644 index 00000000..b738f55d --- /dev/null +++ b/digitalglarus/templates/digitalglarus/dist/remodal.js @@ -0,0 +1,785 @@ +/* + * Remodal - v1.1.0 + * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. + * http://vodkabears.github.io/remodal/ + * + * Made by Ilya Makarov + * Under MIT License + */ + +!(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery'], function($) { + return factory(root, $); + }); + } else if (typeof exports === 'object') { + factory(root, require('jquery')); + } else { + factory(root, root.jQuery || root.Zepto); + } +})(this, function(global, $) { + + 'use strict'; + + /** + * Name of the plugin + * @private + * @const + * @type {String} + */ + var PLUGIN_NAME = 'remodal'; + + /** + * Namespace for CSS and events + * @private + * @const + * @type {String} + */ + var NAMESPACE = global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.NAMESPACE || PLUGIN_NAME; + + /** + * Animationstart event with vendor prefixes + * @private + * @const + * @type {String} + */ + var ANIMATIONSTART_EVENTS = $.map( + ['animationstart', 'webkitAnimationStart', 'MSAnimationStart', 'oAnimationStart'], + + function(eventName) { + return eventName + '.' + NAMESPACE; + } + + ).join(' '); + + /** + * Animationend event with vendor prefixes + * @private + * @const + * @type {String} + */ + var ANIMATIONEND_EVENTS = $.map( + ['animationend', 'webkitAnimationEnd', 'MSAnimationEnd', 'oAnimationEnd'], + + function(eventName) { + return eventName + '.' + NAMESPACE; + } + + ).join(' '); + + /** + * Default settings + * @private + * @const + * @type {Object} + */ + var DEFAULTS = $.extend({ + hashTracking: true, + closeOnConfirm: true, + closeOnCancel: true, + closeOnEscape: true, + closeOnOutsideClick: true, + modifier: '', + appendTo: null + }, global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.DEFAULTS); + + /** + * States of the Remodal + * @private + * @const + * @enum {String} + */ + var STATES = { + CLOSING: 'closing', + CLOSED: 'closed', + OPENING: 'opening', + OPENED: 'opened' + }; + + /** + * Reasons of the state change. + * @private + * @const + * @enum {String} + */ + var STATE_CHANGE_REASONS = { + CONFIRMATION: 'confirmation', + CANCELLATION: 'cancellation' + }; + + /** + * Is animation supported? + * @private + * @const + * @type {Boolean} + */ + var IS_ANIMATION = (function() { + var style = document.createElement('div').style; + + return style.animationName !== undefined || + style.WebkitAnimationName !== undefined || + style.MozAnimationName !== undefined || + style.msAnimationName !== undefined || + style.OAnimationName !== undefined; + })(); + + /** + * Is iOS? + * @private + * @const + * @type {Boolean} + */ + var IS_IOS = /iPad|iPhone|iPod/.test(navigator.platform); + + /** + * Current modal + * @private + * @type {Remodal} + */ + var current; + + /** + * Scrollbar position + * @private + * @type {Number} + */ + var scrollTop; + + /** + * Returns an animation duration + * @private + * @param {jQuery} $elem + * @returns {Number} + */ + function getAnimationDuration($elem) { + if ( + IS_ANIMATION && + $elem.css('animation-name') === 'none' && + $elem.css('-webkit-animation-name') === 'none' && + $elem.css('-moz-animation-name') === 'none' && + $elem.css('-o-animation-name') === 'none' && + $elem.css('-ms-animation-name') === 'none' + ) { + return 0; + } + + var duration = $elem.css('animation-duration') || + $elem.css('-webkit-animation-duration') || + $elem.css('-moz-animation-duration') || + $elem.css('-o-animation-duration') || + $elem.css('-ms-animation-duration') || + '0s'; + + var delay = $elem.css('animation-delay') || + $elem.css('-webkit-animation-delay') || + $elem.css('-moz-animation-delay') || + $elem.css('-o-animation-delay') || + $elem.css('-ms-animation-delay') || + '0s'; + + var iterationCount = $elem.css('animation-iteration-count') || + $elem.css('-webkit-animation-iteration-count') || + $elem.css('-moz-animation-iteration-count') || + $elem.css('-o-animation-iteration-count') || + $elem.css('-ms-animation-iteration-count') || + '1'; + + var max; + var len; + var num; + var i; + + duration = duration.split(', '); + delay = delay.split(', '); + iterationCount = iterationCount.split(', '); + + // The 'duration' size is the same as the 'delay' size + for (i = 0, len = duration.length, max = Number.NEGATIVE_INFINITY; i < len; i++) { + num = parseFloat(duration[i]) * parseInt(iterationCount[i], 10) + parseFloat(delay[i]); + + if (num > max) { + max = num; + } + } + + return max; + } + + /** + * Returns a scrollbar width + * @private + * @returns {Number} + */ + function getScrollbarWidth() { + if ($(document.body).height() <= $(window).height()) { + return 0; + } + + var outer = document.createElement('div'); + var inner = document.createElement('div'); + var widthNoScroll; + var widthWithScroll; + + outer.style.visibility = 'hidden'; + outer.style.width = '100px'; + document.body.appendChild(outer); + + widthNoScroll = outer.offsetWidth; + + // Force scrollbars + outer.style.overflow = 'scroll'; + + // Add inner div + inner.style.width = '100%'; + outer.appendChild(inner); + + widthWithScroll = inner.offsetWidth; + + // Remove divs + outer.parentNode.removeChild(outer); + + return widthNoScroll - widthWithScroll; + } + + /** + * Locks the screen + * @private + */ + function lockScreen() { + if (IS_IOS) { + return; + } + + var $html = $('html'); + var lockedClass = namespacify('is-locked'); + var paddingRight; + var $body; + + if (!$html.hasClass(lockedClass)) { + $body = $(document.body); + + // Zepto does not support '-=', '+=' in the `css` method + paddingRight = parseInt($body.css('padding-right'), 10) + getScrollbarWidth(); + + $body.css('padding-right', paddingRight + 'px'); + $html.addClass(lockedClass); + } + } + + /** + * Unlocks the screen + * @private + */ + function unlockScreen() { + if (IS_IOS) { + return; + } + + var $html = $('html'); + var lockedClass = namespacify('is-locked'); + var paddingRight; + var $body; + + if ($html.hasClass(lockedClass)) { + $body = $(document.body); + + // Zepto does not support '-=', '+=' in the `css` method + paddingRight = parseInt($body.css('padding-right'), 10) - getScrollbarWidth(); + + $body.css('padding-right', paddingRight + 'px'); + $html.removeClass(lockedClass); + } + } + + /** + * Sets a state for an instance + * @private + * @param {Remodal} instance + * @param {STATES} state + * @param {Boolean} isSilent If true, Remodal does not trigger events + * @param {String} Reason of a state change. + */ + function setState(instance, state, isSilent, reason) { + + var newState = namespacify('is', state); + var allStates = [namespacify('is', STATES.CLOSING), + namespacify('is', STATES.OPENING), + namespacify('is', STATES.CLOSED), + namespacify('is', STATES.OPENED)].join(' '); + + instance.$bg + .removeClass(allStates) + .addClass(newState); + + instance.$overlay + .removeClass(allStates) + .addClass(newState); + + instance.$wrapper + .removeClass(allStates) + .addClass(newState); + + instance.$modal + .removeClass(allStates) + .addClass(newState); + + instance.state = state; + !isSilent && instance.$modal.trigger({ + type: state, + reason: reason + }, [{ reason: reason }]); + } + + /** + * Synchronizes with the animation + * @param {Function} doBeforeAnimation + * @param {Function} doAfterAnimation + * @param {Remodal} instance + */ + function syncWithAnimation(doBeforeAnimation, doAfterAnimation, instance) { + var runningAnimationsCount = 0; + + var handleAnimationStart = function(e) { + if (e.target !== this) { + return; + } + + runningAnimationsCount++; + }; + + var handleAnimationEnd = function(e) { + if (e.target !== this) { + return; + } + + if (--runningAnimationsCount === 0) { + + // Remove event listeners + $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { + instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); + }); + + doAfterAnimation(); + } + }; + + $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { + instance[elemName] + .on(ANIMATIONSTART_EVENTS, handleAnimationStart) + .on(ANIMATIONEND_EVENTS, handleAnimationEnd); + }); + + doBeforeAnimation(); + + // If the animation is not supported by a browser or its duration is 0 + if ( + getAnimationDuration(instance.$bg) === 0 && + getAnimationDuration(instance.$overlay) === 0 && + getAnimationDuration(instance.$wrapper) === 0 && + getAnimationDuration(instance.$modal) === 0 + ) { + + // Remove event listeners + $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { + instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); + }); + + doAfterAnimation(); + } + } + + /** + * Closes immediately + * @private + * @param {Remodal} instance + */ + function halt(instance) { + if (instance.state === STATES.CLOSED) { + return; + } + + $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { + instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); + }); + + instance.$bg.removeClass(instance.settings.modifier); + instance.$overlay.removeClass(instance.settings.modifier).hide(); + instance.$wrapper.hide(); + unlockScreen(); + setState(instance, STATES.CLOSED, true); + } + + /** + * Parses a string with options + * @private + * @param str + * @returns {Object} + */ + function parseOptions(str) { + var obj = {}; + var arr; + var len; + var val; + var i; + + // Remove spaces before and after delimiters + str = str.replace(/\s*:\s*/g, ':').replace(/\s*,\s*/g, ','); + + // Parse a string + arr = str.split(','); + for (i = 0, len = arr.length; i < len; i++) { + arr[i] = arr[i].split(':'); + val = arr[i][1]; + + // Convert a string value if it is like a boolean + if (typeof val === 'string' || val instanceof String) { + val = val === 'true' || (val === 'false' ? false : val); + } + + // Convert a string value if it is like a number + if (typeof val === 'string' || val instanceof String) { + val = !isNaN(val) ? +val : val; + } + + obj[arr[i][0]] = val; + } + + return obj; + } + + /** + * Generates a string separated by dashes and prefixed with NAMESPACE + * @private + * @param {...String} + * @returns {String} + */ + function namespacify() { + var result = NAMESPACE; + + for (var i = 0; i < arguments.length; ++i) { + result += '-' + arguments[i]; + } + + return result; + } + + /** + * Handles the hashchange event + * @private + * @listens hashchange + */ + function handleHashChangeEvent() { + var id = location.hash.replace('#', ''); + var instance; + var $elem; + + if (!id) { + + // Check if we have currently opened modal and animation was completed + if (current && current.state === STATES.OPENED && current.settings.hashTracking) { + current.close(); + } + } else { + + // Catch syntax error if your hash is bad + try { + $elem = $( + '[data-' + PLUGIN_NAME + '-id="' + id + '"]' + ); + } catch (err) {} + + if ($elem && $elem.length) { + instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)]; + + if (instance && instance.settings.hashTracking) { + instance.open(); + } + } + + } + } + + /** + * Remodal constructor + * @constructor + * @param {jQuery} $modal + * @param {Object} options + */ + function Remodal($modal, options) { + var $body = $(document.body); + var $appendTo = $body; + var remodal = this; + + remodal.settings = $.extend({}, DEFAULTS, options); + remodal.index = $[PLUGIN_NAME].lookup.push(remodal) - 1; + remodal.state = STATES.CLOSED; + + remodal.$overlay = $('.' + namespacify('overlay')); + + if (remodal.settings.appendTo !== null && remodal.settings.appendTo.length) { + $appendTo = $(remodal.settings.appendTo); + } + + if (!remodal.$overlay.length) { + remodal.$overlay = $('<div>').addClass(namespacify('overlay') + ' ' + namespacify('is', STATES.CLOSED)).hide(); + $appendTo.append(remodal.$overlay); + } + + remodal.$bg = $('.' + namespacify('bg')).addClass(namespacify('is', STATES.CLOSED)); + + remodal.$modal = $modal + .addClass( + NAMESPACE + ' ' + + namespacify('is-initialized') + ' ' + + remodal.settings.modifier + ' ' + + namespacify('is', STATES.CLOSED)) + .attr('tabindex', '-1'); + + remodal.$wrapper = $('<div>') + .addClass( + namespacify('wrapper') + ' ' + + remodal.settings.modifier + ' ' + + namespacify('is', STATES.CLOSED)) + .hide() + .append(remodal.$modal); + $appendTo.append(remodal.$wrapper); + + // Add the event listener for the close button + remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="close"]', function(e) { + e.preventDefault(); + + remodal.close(); + }); + + // Add the event listener for the cancel button + remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="cancel"]', function(e) { + e.preventDefault(); + + remodal.$modal.trigger(STATE_CHANGE_REASONS.CANCELLATION); + + if (remodal.settings.closeOnCancel) { + remodal.close(STATE_CHANGE_REASONS.CANCELLATION); + } + }); + + // Add the event listener for the confirm button + remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="confirm"]', function(e) { + e.preventDefault(); + + remodal.$modal.trigger(STATE_CHANGE_REASONS.CONFIRMATION); + + if (remodal.settings.closeOnConfirm) { + remodal.close(STATE_CHANGE_REASONS.CONFIRMATION); + } + }); + + // Add the event listener for the overlay + remodal.$wrapper.on('click.' + NAMESPACE, function(e) { + var $target = $(e.target); + + if (!$target.hasClass(namespacify('wrapper'))) { + return; + } + + if (remodal.settings.closeOnOutsideClick) { + remodal.close(); + } + }); + } + + /** + * Opens a modal window + * @public + */ + Remodal.prototype.open = function() { + var remodal = this; + var id; + + // Check if the animation was completed + if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING) { + return; + } + + id = remodal.$modal.attr('data-' + PLUGIN_NAME + '-id'); + + if (id && remodal.settings.hashTracking) { + scrollTop = $(window).scrollTop(); + location.hash = id; + } + + if (current && current !== remodal) { + halt(current); + } + + current = remodal; + lockScreen(); + remodal.$bg.addClass(remodal.settings.modifier); + remodal.$overlay.addClass(remodal.settings.modifier).show(); + remodal.$wrapper.show().scrollTop(0); + remodal.$modal.focus(); + + syncWithAnimation( + function() { + setState(remodal, STATES.OPENING); + }, + + function() { + setState(remodal, STATES.OPENED); + }, + + remodal); + }; + + /** + * Closes a modal window + * @public + * @param {String} reason + */ + Remodal.prototype.close = function(reason) { + var remodal = this; + + // Check if the animation was completed + if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING) { + return; + } + + if ( + remodal.settings.hashTracking && + remodal.$modal.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1) + ) { + location.hash = ''; + $(window).scrollTop(scrollTop); + } + + syncWithAnimation( + function() { + setState(remodal, STATES.CLOSING, false, reason); + }, + + function() { + remodal.$bg.removeClass(remodal.settings.modifier); + remodal.$overlay.removeClass(remodal.settings.modifier).hide(); + remodal.$wrapper.hide(); + unlockScreen(); + + setState(remodal, STATES.CLOSED, false, reason); + }, + + remodal); + }; + + /** + * Returns a current state of a modal + * @public + * @returns {STATES} + */ + Remodal.prototype.getState = function() { + return this.state; + }; + + /** + * Destroys a modal + * @public + */ + Remodal.prototype.destroy = function() { + var lookup = $[PLUGIN_NAME].lookup; + var instanceCount; + + halt(this); + this.$wrapper.remove(); + + delete lookup[this.index]; + instanceCount = $.grep(lookup, function(instance) { + return !!instance; + }).length; + + if (instanceCount === 0) { + this.$overlay.remove(); + this.$bg.removeClass( + namespacify('is', STATES.CLOSING) + ' ' + + namespacify('is', STATES.OPENING) + ' ' + + namespacify('is', STATES.CLOSED) + ' ' + + namespacify('is', STATES.OPENED)); + } + }; + + /** + * Special plugin object for instances + * @public + * @type {Object} + */ + $[PLUGIN_NAME] = { + lookup: [] + }; + + /** + * Plugin constructor + * @constructor + * @param {Object} options + * @returns {JQuery} + */ + $.fn[PLUGIN_NAME] = function(opts) { + var instance; + var $elem; + + this.each(function(index, elem) { + $elem = $(elem); + + if ($elem.data(PLUGIN_NAME) == null) { + instance = new Remodal($elem, opts); + $elem.data(PLUGIN_NAME, instance.index); + + if ( + instance.settings.hashTracking && + $elem.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1) + ) { + instance.open(); + } + } else { + instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)]; + } + }); + + return instance; + }; + + $(document).ready(function() { + + // data-remodal-target opens a modal window with the special Id + $(document).on('click', '[data-' + PLUGIN_NAME + '-target]', function(e) { + e.preventDefault(); + + var elem = e.currentTarget; + var id = elem.getAttribute('data-' + PLUGIN_NAME + '-target'); + var $target = $('[data-' + PLUGIN_NAME + '-id="' + id + '"]'); + + $[PLUGIN_NAME].lookup[$target.data(PLUGIN_NAME)].open(); + }); + + // Auto initialization of modal windows + // They should have the 'remodal' class attribute + // Also you can write the `data-remodal-options` attribute to pass params into the modal + $(document).find('.' + NAMESPACE).each(function(i, container) { + var $container = $(container); + var options = $container.data(PLUGIN_NAME + '-options'); + + if (!options) { + options = {}; + } else if (typeof options === 'string' || options instanceof String) { + options = parseOptions(options); + } + + $container[PLUGIN_NAME](options); + }); + + // Handles the keydown event + $(document).on('keydown.' + NAMESPACE, function(e) { + if (current && current.settings.closeOnEscape && current.state === STATES.OPENED && e.keyCode === 27) { + current.close(); + } + }); + + // Handles the hashchange event + $(window).on('hashchange.' + NAMESPACE, handleHashChangeEvent); + }); +}); diff --git a/digitalglarus/templates/digitalglarus/dist/remodal.min.js b/digitalglarus/templates/digitalglarus/dist/remodal.min.js new file mode 100644 index 00000000..c5978d8c --- /dev/null +++ b/digitalglarus/templates/digitalglarus/dist/remodal.min.js @@ -0,0 +1,10 @@ +/* + * Remodal - v1.1.0 + * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. + * http://vodkabears.github.io/remodal/ + * + * Made by Ilya Makarov + * Under MIT License + */ + +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return b(a,c)}):"object"==typeof exports?b(a,require("jquery")):b(a,a.jQuery||a.Zepto)}(this,function(a,b){"use strict";function c(a){if(w&&"none"===a.css("animation-name")&&"none"===a.css("-webkit-animation-name")&&"none"===a.css("-moz-animation-name")&&"none"===a.css("-o-animation-name")&&"none"===a.css("-ms-animation-name"))return 0;var b,c,d,e,f=a.css("animation-duration")||a.css("-webkit-animation-duration")||a.css("-moz-animation-duration")||a.css("-o-animation-duration")||a.css("-ms-animation-duration")||"0s",g=a.css("animation-delay")||a.css("-webkit-animation-delay")||a.css("-moz-animation-delay")||a.css("-o-animation-delay")||a.css("-ms-animation-delay")||"0s",h=a.css("animation-iteration-count")||a.css("-webkit-animation-iteration-count")||a.css("-moz-animation-iteration-count")||a.css("-o-animation-iteration-count")||a.css("-ms-animation-iteration-count")||"1";for(f=f.split(", "),g=g.split(", "),h=h.split(", "),e=0,c=f.length,b=Number.NEGATIVE_INFINITY;e<c;e++)d=parseFloat(f[e])*parseInt(h[e],10)+parseFloat(g[e]),d>b&&(b=d);return b}function d(){if(b(document.body).height()<=b(window).height())return 0;var a,c,d=document.createElement("div"),e=document.createElement("div");return d.style.visibility="hidden",d.style.width="100px",document.body.appendChild(d),a=d.offsetWidth,d.style.overflow="scroll",e.style.width="100%",d.appendChild(e),c=e.offsetWidth,d.parentNode.removeChild(d),a-c}function e(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)||(c=b(document.body),a=parseInt(c.css("padding-right"),10)+d(),c.css("padding-right",a+"px"),e.addClass(f))}}function f(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)&&(c=b(document.body),a=parseInt(c.css("padding-right"),10)-d(),c.css("padding-right",a+"px"),e.removeClass(f))}}function g(a,b,c,d){var e=k("is",b),f=[k("is",u.CLOSING),k("is",u.OPENING),k("is",u.CLOSED),k("is",u.OPENED)].join(" ");a.$bg.removeClass(f).addClass(e),a.$overlay.removeClass(f).addClass(e),a.$wrapper.removeClass(f).addClass(e),a.$modal.removeClass(f).addClass(e),a.state=b,!c&&a.$modal.trigger({type:b,reason:d},[{reason:d}])}function h(a,d,e){var f=0,g=function(a){a.target===this&&f++},h=function(a){a.target===this&&0===--f&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())};b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].on(r,g).on(s,h)}),a(),0===c(e.$bg)&&0===c(e.$overlay)&&0===c(e.$wrapper)&&0===c(e.$modal)&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())}function i(a){a.state!==u.CLOSED&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(b,c){a[c].off(r+" "+s)}),a.$bg.removeClass(a.settings.modifier),a.$overlay.removeClass(a.settings.modifier).hide(),a.$wrapper.hide(),f(),g(a,u.CLOSED,!0))}function j(a){var b,c,d,e,f={};for(a=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,","),b=a.split(","),e=0,c=b.length;e<c;e++)b[e]=b[e].split(":"),d=b[e][1],("string"==typeof d||d instanceof String)&&(d="true"===d||"false"!==d&&d),("string"==typeof d||d instanceof String)&&(d=isNaN(d)?d:+d),f[b[e][0]]=d;return f}function k(){for(var a=q,b=0;b<arguments.length;++b)a+="-"+arguments[b];return a}function l(){var a,c,d=location.hash.replace("#","");if(d){try{c=b('[data-remodal-id="'+d+'"]')}catch(e){}c&&c.length&&(a=b[p].lookup[c.data(p)],a&&a.settings.hashTracking&&a.open())}else n&&n.state===u.OPENED&&n.settings.hashTracking&&n.close()}function m(a,c){var d=b(document.body),e=d,f=this;f.settings=b.extend({},t,c),f.index=b[p].lookup.push(f)-1,f.state=u.CLOSED,f.$overlay=b("."+k("overlay")),null!==f.settings.appendTo&&f.settings.appendTo.length&&(e=b(f.settings.appendTo)),f.$overlay.length||(f.$overlay=b("<div>").addClass(k("overlay")+" "+k("is",u.CLOSED)).hide(),e.append(f.$overlay)),f.$bg=b("."+k("bg")).addClass(k("is",u.CLOSED)),f.$modal=a.addClass(q+" "+k("is-initialized")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).attr("tabindex","-1"),f.$wrapper=b("<div>").addClass(k("wrapper")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).hide().append(f.$modal),e.append(f.$wrapper),f.$wrapper.on("click."+q,'[data-remodal-action="close"]',function(a){a.preventDefault(),f.close()}),f.$wrapper.on("click."+q,'[data-remodal-action="cancel"]',function(a){a.preventDefault(),f.$modal.trigger(v.CANCELLATION),f.settings.closeOnCancel&&f.close(v.CANCELLATION)}),f.$wrapper.on("click."+q,'[data-remodal-action="confirm"]',function(a){a.preventDefault(),f.$modal.trigger(v.CONFIRMATION),f.settings.closeOnConfirm&&f.close(v.CONFIRMATION)}),f.$wrapper.on("click."+q,function(a){var c=b(a.target);c.hasClass(k("wrapper"))&&f.settings.closeOnOutsideClick&&f.close()})}var n,o,p="remodal",q=a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.NAMESPACE||p,r=b.map(["animationstart","webkitAnimationStart","MSAnimationStart","oAnimationStart"],function(a){return a+"."+q}).join(" "),s=b.map(["animationend","webkitAnimationEnd","MSAnimationEnd","oAnimationEnd"],function(a){return a+"."+q}).join(" "),t=b.extend({hashTracking:!0,closeOnConfirm:!0,closeOnCancel:!0,closeOnEscape:!0,closeOnOutsideClick:!0,modifier:"",appendTo:null},a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.DEFAULTS),u={CLOSING:"closing",CLOSED:"closed",OPENING:"opening",OPENED:"opened"},v={CONFIRMATION:"confirmation",CANCELLATION:"cancellation"},w=function(){var a=document.createElement("div").style;return void 0!==a.animationName||void 0!==a.WebkitAnimationName||void 0!==a.MozAnimationName||void 0!==a.msAnimationName||void 0!==a.OAnimationName}(),x=/iPad|iPhone|iPod/.test(navigator.platform);m.prototype.open=function(){var a,c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&(a=c.$modal.attr("data-remodal-id"),a&&c.settings.hashTracking&&(o=b(window).scrollTop(),location.hash=a),n&&n!==c&&i(n),n=c,e(),c.$bg.addClass(c.settings.modifier),c.$overlay.addClass(c.settings.modifier).show(),c.$wrapper.show().scrollTop(0),c.$modal.focus(),h(function(){g(c,u.OPENING)},function(){g(c,u.OPENED)},c))},m.prototype.close=function(a){var c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&(c.settings.hashTracking&&c.$modal.attr("data-remodal-id")===location.hash.substr(1)&&(location.hash="",b(window).scrollTop(o)),h(function(){g(c,u.CLOSING,!1,a)},function(){c.$bg.removeClass(c.settings.modifier),c.$overlay.removeClass(c.settings.modifier).hide(),c.$wrapper.hide(),f(),g(c,u.CLOSED,!1,a)},c))},m.prototype.getState=function(){return this.state},m.prototype.destroy=function(){var a,c=b[p].lookup;i(this),this.$wrapper.remove(),delete c[this.index],a=b.grep(c,function(a){return!!a}).length,0===a&&(this.$overlay.remove(),this.$bg.removeClass(k("is",u.CLOSING)+" "+k("is",u.OPENING)+" "+k("is",u.CLOSED)+" "+k("is",u.OPENED)))},b[p]={lookup:[]},b.fn[p]=function(a){var c,d;return this.each(function(e,f){d=b(f),null==d.data(p)?(c=new m(d,a),d.data(p,c.index),c.settings.hashTracking&&d.attr("data-remodal-id")===location.hash.substr(1)&&c.open()):c=b[p].lookup[d.data(p)]}),c},b(document).ready(function(){b(document).on("click","[data-remodal-target]",function(a){a.preventDefault();var c=a.currentTarget,d=c.getAttribute("data-remodal-target"),e=b('[data-remodal-id="'+d+'"]');b[p].lookup[e.data(p)].open()}),b(document).find("."+q).each(function(a,c){var d=b(c),e=d.data("remodal-options");e?("string"==typeof e||e instanceof String)&&(e=j(e)):e={},d[p](e)}),b(document).on("keydown."+q,function(a){n&&n.settings.closeOnEscape&&n.state===u.OPENED&&27===a.keyCode&&n.close()}),b(window).on("hashchange."+q,l)})}); \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/edit_credit_card.html b/digitalglarus/templates/digitalglarus/edit_credit_card.html new file mode 100644 index 00000000..8fbe2224 --- /dev/null +++ b/digitalglarus/templates/digitalglarus/edit_credit_card.html @@ -0,0 +1,293 @@ +{% extends "new_base_glarus.html" %} +{% load staticfiles bootstrap3 i18n %} +{% block content %} + +<style type="text/css"> + + .nopadding { + padding: 0 !important; + margin: 0 !important; + } + + .form-control#id_country{ + -webkit-appearance: none; + -moz-appearance: none; + background-position: right 50%; + background-repeat: no-repeat; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NDZFNDEwNjlGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NDZFNDEwNkFGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0NkU0MTA2N0Y3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0NkU0MTA2OEY3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PuGsgwQAAAA5SURBVHjaYvz//z8DOYCJgUxAf42MQIzTk0D/M+KzkRGPoQSdykiKJrBGpOhgJFYTWNEIiEeAAAMAzNENEOH+do8AAAAASUVORK5CYII=); + padding: .5em; + padding-right: 1.5em + } + + .order-bottom-text a{ + margin-left: 0px; + } + + +</style> + + <section id="price"> + <div class="signup-container"> + <div class="col-xs-12 col-sm-6 col-lg-8 text-center wow fadeInDown"> + <div class="payment-box"> + <h2 class="section-heading payment-head">Edit Credit Card</h2> + <!-- <h2 class="membership-amount">35CHF</h2> --> + <hr class="greyline-long"> + + <h2 class="membership-lead"> + + </h2> + <br> + <h2 class="billing-head">Credit Card Information</h2> + + + + <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> + {% csrf_token %} + <h2 class="membership-lead">Last 4: *****{{last4}}</h2> + <h2 class="membership-lead">Type: {{cc_brand}}</h2> + <h2 class="membership-lead">Exp month: {{expMonth}}</h2> + <h2 class="membership-lead">Exp year: {{expYear}}</h2> + <input type="hidden" name="credit_card_needed" value="false"/> + </form> + <h2 class="billing-head">Edit Card credit card</h2> + <div class="signup-form form-group row"> + + <!-- <form role="form" id="payment-form" novalidate> --> + <form role="form" id="payment-form2" method="post" action="{% url 'digitalglarus:booking_payment_view' %}" novalidate> + + {% csrf_token %} + <div class="text-center"> + <div class="row"> + <div class="col-xs-12 col-md-6 nopadding"> + <label for="expMonth">EXPIRATION DATE</label><br/> + <div class="col-xs-6 col-lg-6 col-md-6"> + <div class="form-group"> + <input type="text" class="form-control" name="expMonth" placeholder="MM" required data-stripe="exp_month" /> + </div> + </div> + <div class="col-xs-6 col-lg-6 col-md-6 pl-ziro"> + <div class="form-group"> + <input type="text" class="form-control" name="expYear" placeholder="YY" required data-stripe="exp_year" /> + </div> + </div> + </div> + </div> + <input type="checkbox" hidden="True" class="custom-control-input agree-terms" checked> + <div class="row"> + <div class="col-xs-10 col-md-6 col-xs-offset-1 col-md-offset-3"> + <a class="btn btn-primary btn-grey" href="{% url 'digitalglarus:booking_payment' %}">Cancel</a> + <button class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Save</button> + </div> + </div> + <div class="row" style="display:none;"> + <div class="col-xs-12"> + <p class="payment-errors"></p> + </div> + </div> + {% if paymentError %} + <div class="row"> + <div class="col-xs-12"> + <p> + {% bootstrap_alert paymentError alert_type='danger' %} + </p> + </div> + </div> + {% endif %} + </div> + </form> + <br> + + </div> + + + </div> + </div> + + </div> + </div> + </div> + </div> + </section> + + + + <section id="contact"> + <div class="fill"> + <div class="row" class="wow fadeInDown"> + <div class="col-lg-12 text-center wow fadeInDown"> + <div class="col-md-4 map-title"> + Digital Glarus<br> + <span class="map-caption">In der Au 7 Schwanden 8762 Switzerland + <br>info@digitalglarus.ch + <br> + (044) 534-66-22 + <p> </p> + </span> + </div> + <p> </p> + </div> + </div> + </div> + </section> + +<!-- stripe key data --> +{% if stripe_key %} +<script type="text/javascript"> + (function () {window.stripeKey = "{{stripe_key}}";})(); + +</script> +{%endif%} +<script> +$( document ).ready(function() { + + $.ajaxSetup({ + beforeSend: function(xhr, settings) { + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) { + // Only send the token to relative URLs i.e. locally. + alert("POR AQUI"); + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + } + }); + + //Acept term and conditions button + + + + var submit_form_btn = $('#payment_button'); + submit_form_btn.on('click', submit_payment); + + function submit_payment(e){ + $('#billing-form').submit(); + alert("POR AQUI2"); + // $form.submit(); + } + + + var $form = $('#payment-form'); + $form.submit(payWithStripe); + + /* If you're using Stripe for payments */ + function payWithStripe(e) { + console.log("submiting"); + e.preventDefault(); + + if (!$('.agree-terms').is(':checked')){ + alert("You must accept terms and conditions."); + return; + } + + + /* Visual feedback */ + $form.find('[type=submit]').html('Validating <i class="fa fa-spinner fa-pulse"></i>'); + + var PublishableKey = window.stripeKey; + Stripe.setPublishableKey(PublishableKey); + Stripe.card.createToken($form, function stripeResponseHandler(status, response) { + if (response.error) { + /* Visual feedback */ + alert("POR AQUI3"); + $form.find('[type=submit]').html('Try again'); + /* Show Stripe errors on the form */ + $form.find('.payment-errors').text(response.error.message); + $form.find('.payment-errors').closest('.row').show(); + } else { + /* Visual feedback */ + $form.find('[type=submit]').html('Processing <i class="fa fa-spinner fa-pulse"></i>'); + /* Hide Stripe errors on the form */ + $form.find('.payment-errors').closest('.row').hide(); + $form.find('.payment-errors').text(""); + // response contains id and card, which contains additional card details + var token = response.id; + // AJAX + + //set token on a hidden input + $('#id_token').val(token); + $('#billing-form').submit(); + } + }); + } + + /* Form validation */ + $.validator.addMethod("month", function(value, element) { + return this.optional(element) || /^(01|02|03|04|05|06|07|08|09|10|11|12)$/.test(value); + }, "Please specify a valid 2-digit month."); + + $.validator.addMethod("year", function(value, element) { + return this.optional(element) || /^[0-9]{2}$/.test(value); + }, "Please specify a valid 2-digit year."); + + validator = $form.validate({ + rules: { + cardNumber: { + required: true, + creditcard: true, + digits: true + }, + expMonth: { + required: true, + month: true + }, + expYear: { + required: true, + year: true + }, + cvCode: { + required: true, + digits: true + } + }, + highlight: function(element) { + $(element).closest('.form-control').removeClass('success').addClass('error'); + }, + unhighlight: function(element) { + $(element).closest('.form-control').removeClass('error').addClass('success'); + }, + errorPlacement: function(error, element) { + $(element).closest('.form-group').append(error); + } + }); + + paymentFormReady = function() { + if ($form.find('[name=cardNumber]').hasClass("success") && + $form.find('[name=expMonth]').hasClass("success") && + $form.find('[name=expYear]').hasClass("success") && + $form.find('[name=cvCode]').val().length > 1) { + return true; + } else { + return false; + } + }; + + $form.find('[type=submit]').prop('disabled', true); + var readyInterval = setInterval(function() { + if (paymentFormReady()) { + $form.find('[type=submit]').prop('disabled', false); + clearInterval(readyInterval); + } + }, 250); + + + +}); +</script> + + + +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/login.html b/digitalglarus/templates/digitalglarus/login.html index 3ae7c5ab..505f462e 100644 --- a/digitalglarus/templates/digitalglarus/login.html +++ b/digitalglarus/templates/digitalglarus/login.html @@ -3,54 +3,26 @@ {% block content %} <style type="text/css"> -@media screen and (min-width: 768px) { - - cancel-subscription-modal .modal-dialog {width:1000px;} - .glyphicon-flag { - font-size: 44px; - display: block; - text-align: center; - margin: 30px auto 30px; - color: #88c7d7; - } - .price2 { - - - -webkit-background-size: cover; - -moz-background-size: cover; - -} cancel-subscription-modal .modal-body { - max-height: 800px; + max-height: 10000px; } - -} -@media screen and (min-width: 780px) { - cancel-subscription-modal .modal-dialog {width:1000px;} - - .glyphicon-flag { - font-size: 44px; - display: block; - text-align: center; - margin: 30px auto 30px; - color: #88c7d7; - - } .price2 { -webkit-background-size: cover; -moz-background-size: cover; - -} - + } + </style> + + <link rel="stylesheet" href="../dist/remodal.css"> + <link rel="stylesheet" href="../dist/remodal-default-theme.css"> <section id="price"> <div class="signup-container"> <div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div> @@ -134,12 +106,12 @@ <div class="modal-dialog" role="document"> - <div class="modal-content"> + <div class="row col-xs-18 col-sm-12 col-lg-20 modal-content"> <div class="modal-body"> <section id="price2"> - <div class="container"> + <div class="row col-xs-12 col-sm-7 col-lg-6 container"> <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> @@ -151,7 +123,7 @@ <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> <hr class="primary"> <div class="price-exp-box"> - <p class="text-left"> + <p class="text-center"> <p class="term-head">1. Membership</p> 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> 1.2. Each additional day costs 15CHF for members.<br> @@ -178,7 +150,7 @@ <br><br> </p> - <div class="text-center"> + <div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> </div> <div class="row col-md-2 text-center wow fadeInDown"> @@ -194,6 +166,11 @@ </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> + + + + + diff --git a/digitalglarus/templates/digitalglarus/new_credit_card.html b/digitalglarus/templates/digitalglarus/new_credit_card.html index 314e28f8..d2105a02 100644 --- a/digitalglarus/templates/digitalglarus/new_credit_card.html +++ b/digitalglarus/templates/digitalglarus/new_credit_card.html @@ -118,7 +118,7 @@ <div class="row"> - <div class="col-xs-6 col-md-6 col-xs-offset-1 col-md-offset-3"> + <div class="col-xs-10 col-md-6 col-xs-offset-1 col-md-offset-3"> <a class="btn btn-primary btn-grey" href="{% url 'digitalglarus:booking_payment' %}">Cancel</a> diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index 8590dd79..f0fe44e0 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -6,13 +6,14 @@ from .views import ContactView, IndexView, AboutView, HistoryView, LoginView, Si PasswordResetView, PasswordResetConfirmView, MembershipPaymentView, MembershipActivatedView,\ MembershipPricingView, BookingSelectDatesView, BookingPaymentView, OrdersBookingDetailView,\ BookingOrdersListView, MembershipOrdersListView, OrdersMembershipDetailView, \ - MembershipDeactivateView, MembershipDeactivateSuccessView, UserBillingAddressView, \ + MembershipDeactivateView, MembershipDeactivateSuccessView, UserBillingAddressView,EditCreditCard, \ MembershipReactivateView,TermsAndConditions,ValidateUser,SupportusView,Probar,TermsAndConditions2,TermsAndConditions3,BookingPaymentView2 # from membership.views import LoginRegistrationView urlpatterns = [ + url(_(r'booking/payment/edit/?$'),EditCreditCard,name= 'edit_credit_card'), url(_(r'booking/payment/view/?$'), BookingPaymentView2, name='booking_payment_view'), url(_(r'probar3/?$'),TermsAndConditions3, name='probar3'), url(_(r'probar2/?$'),TermsAndConditions2.as_view(), name='credit_card_edit'), diff --git a/digitalglarus/views.py b/digitalglarus/views.py index a8688348..9be4f73d 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -174,8 +174,64 @@ def TermsAndConditions(request): print ("JNSKDJNASJDNKSJANDKJNSAKJDNKJND") ''' def TermsAndConditions3(request): - print ("hola hola hola hola hola") return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand']}) + +def EditCreditCard(request): + cus = StripeCustomer.get_or_create(email=request.user.email) + s= str(cus) + s= s.split(" ") + #t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + #tt=t['data'] + #print (tt) + #for i in tt: + # print (i.id) + # print (i.last4) + # print ("aja estoy aqui",i.id) + # customer = stripe.Customer.retrieve(s[0]) + # customer.sources.retrieve(i.id).delete() + + # crear tarjeta de credito + + customer = stripe.Customer.retrieve(s[0]) + #print ("voy por aqui") + custom_card= customer.default_source + t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + tt=t['data'] + #print (tt) + cc = dict() + for i in tt: + #print (i.id) + #print (i.last4) + if i.id== custom_card: + #print ("ESTA ES LA TARJETA ACTUAL") + cc['last4']= i.last4 + cc['cc_brand'] = i.brand + cc['exp_month']=i.exp_month + cc['exp_year']= i.exp_year + #customer.sources.create(source=resp) + #t=stripe.Customer.retrieve(s[0]).sources.all(object="card") + #tt=t['data'] + #x= resp['number'] + #for i in tt: + # print (i.id) + # print (i.last4) + # print (x[-4:]) + # if i.last4 == x[-4:]: + # print ("ESTOY AQUI") + # customer.default_source= i.id + #customer.save() + m=MembershipOrder.objects.filter(customer__user=request.user) + customer = StripeCustomer.get_or_create(email=request.user.email) + + + last_booking_order = BookingOrder.objects.filter(customer__user=request.user).last() + last_membership_order = MembershipOrder.objects.filter(customer__user=request.user).last() + credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ + and last_booking_order.get_booking_cc_data() \ + else last_membership_order.get_membership_order_cc_data() + + current_billing_address = request.user.billing_addresses.first() + return render_to_response('digitalglarus/edit_credit_card.html',{'last4':cc['last4'],'brand_type':cc['cc_brand'],'expMonth': cc['exp_month'], 'expYear': cc['exp_year']}) class TermsAndConditions2(TemplateView): template_name ="digitalglarus/credit_card_edit_confirmation.html" From af3980d372c19dd45008256c2c7a3fcfb2ce9b66 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Fri, 6 Jan 2017 11:33:55 -0400 Subject: [PATCH 09/13] credit card edit elimated. The new card is a little more fastter. The whirte margin is again eliminated. --- .../digitalglarus/booking_payment.html | 2 +- digitalglarus/templates/new_base_glarus.html | 11 ++- digitalglarus/views.py | 77 ++----------------- 3 files changed, 19 insertions(+), 71 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index 4fef2c89..e4fb572c 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -72,7 +72,7 @@ </div> {% if credit_card_data.last4 %} <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> - <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">New</a><a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:edit_credit_card' %}">Edit</a></h2> + <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">New</a></h2> <h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2> <h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2> <input type="hidden" name="credit_card_needed" value="false"/> diff --git a/digitalglarus/templates/new_base_glarus.html b/digitalglarus/templates/new_base_glarus.html index d9117a3d..4a19e80f 100644 --- a/digitalglarus/templates/new_base_glarus.html +++ b/digitalglarus/templates/new_base_glarus.html @@ -111,7 +111,16 @@ .dropdown.home-dropdown { display: none; } - } + + + + html,body{ + width: 100%; + height: 100%; + margin: 0px; + padding: 0px; + overflow-x: hidden; + } </style> </head> diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 9be4f73d..cafe82a8 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -93,86 +93,25 @@ class ValidateView(SignupViewMixin): form_class = SignupForm success_url = reverse_lazy('digitalglarus:login') - #def activarUsuario(request, pk): - #if request.method == 'POST': - # u = U.objects.get(pk = pk) - # u.is_active = True - # u.save() - # messages.info(request, 'Usuario Activado') - # Log('activar','usuario',request) - #resp = dict() - #resp['msg'] = 0 #0 para exito - #return HttpResponse(json.dumps(resp), content_type ='application/json') - @csrf_exempt def TermsAndConditions(request): cus = StripeCustomer.get_or_create(email=request.user.email) s= str(cus) s= s.split(" ") - #t=stripe.Customer.retrieve(s[0]).sources.all(object="card") - #tt=t['data'] - #print (tt) - #for i in tt: - # print (i.id) - # print (i.last4) - # print ("aja estoy aqui",i.id) - # customer = stripe.Customer.retrieve(s[0]) - # customer.sources.retrieve(i.id).delete() - - # crear tarjeta de credito - - customer = stripe.Customer.retrieve(s[0]) - #print ("voy por aqui") - custom_card= customer.default_source - t=stripe.Customer.retrieve(s[0]).sources.all(object="card") - tt=t['data'] - #print (tt) cc = dict() - for i in tt: - #print (i.id) - #print (i.last4) - if i.id== custom_card: - #print ("ESTA ES LA TARJETA ACTUAL") - cc['last4']= i.last4 - cc['cc_brand'] = i.brand - - - - - #customer.sources.create(source=resp) - #t=stripe.Customer.retrieve(s[0]).sources.all(object="card") - #tt=t['data'] - #x= resp['number'] - #for i in tt: - # print (i.id) - # print (i.last4) - # print (x[-4:]) - # if i.last4 == x[-4:]: - # print ("ESTOY AQUI") - # customer.default_source= i.id - #customer.save() + customer = stripe.Customer.retrieve(s[0]) + custom_card= customer.default_source + card = customer.sources.retrieve(custom_card) + cc['last4']= card.last4 + cc['cc_brand'] = card.brand m=MembershipOrder.objects.filter(customer__user=request.user) - customer = StripeCustomer.get_or_create(email=request.user.email) - - + #customer = StripeCustomer.get_or_create(email=request.user.email) last_booking_order = BookingOrder.objects.filter(customer__user=request.user).last() last_membership_order = MembershipOrder.objects.filter(customer__user=request.user).last() - credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \ - and last_booking_order.get_booking_cc_data() \ - else last_membership_order.get_membership_order_cc_data() - current_billing_address = request.user.billing_addresses.first() - - #return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) return render_to_response('digitalglarus/new_credit_card.html',{'last4':cc['last4'],'brand_type':cc['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) - #return render_to_response('digitalglarus/new_credit_card.html',{'last4':'probando','brand_type':'probando','stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) - ''' - def g - et_success_url(self): - # redirect to membership orders list if user has at least one. - print (self.request.user) - print ("JNSKDJNASJDNKSJANDKJNSAKJDNKJND") - ''' + + def TermsAndConditions3(request): return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand']}) From 6d2761fcdf31decdf9ac1de29bb221d7c42b468d Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Mon, 9 Jan 2017 19:44:20 -0400 Subject: [PATCH 10/13] modal --- .../templates/digitalglarus/login.html | 81 ++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/digitalglarus/templates/digitalglarus/login.html b/digitalglarus/templates/digitalglarus/login.html index 505f462e..58723ca7 100644 --- a/digitalglarus/templates/digitalglarus/login.html +++ b/digitalglarus/templates/digitalglarus/login.html @@ -64,6 +64,7 @@ <p>{{form.non_field_errors|striptags}}</p> <p class="signup-notice">By logging in you agree to our<a data-toggle="modal" data-target="#cancel-subscription-modal" target="_blank">Terms of Service</a>.</p> + <p class="signup-notice">By logging in you agree to our<a data-toggle="modal" data-target="#myModal" target="_blank">Terms of Service</a>.</p> @@ -155,7 +156,7 @@ </div> <div class="row col-md-2 text-center wow fadeInDown"> </div> - </div> + </div> </div> </div> @@ -168,6 +169,84 @@ </div><!-- /.modal --> +<!-- Trigger the modal with a button --> +<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button> + +<!-- Modal --> +<div id="myModal" class="modal fade" role="dialog"> + <div class="modal-dialog"> + + <!-- Modal content--> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">Modal Header</h4> + </div> + <div class="modal-body"> + <section id="price"> + <div class="container row col-md-13 col-sm-13"> + <div class="row col-md-7 col-sm-10 text-center wow fadeInDown"> + <div class="price-box"> + <span class="glyphicon glyphicon-flag"></span> + <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> + <h2 class="price2">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> + <hr class="primary"> + <div class="price-exp-box"> + <p class="text-left"> + <p class="term-head">1. Membership</p> + 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> + 1.2. Each additional day costs 15CHF for members.<br> + <br> + <p class="term-head">2. Coworking days</p> + 2.1. Coworking days are counted as 1 calendar day. <br> + 2.2. Free coworking days are included in the membership. <br> + 2.3. Unused working days are not refunded and can not be compensated for. <br><br> + <p class="term-head">3. Possible reduction</p> + 3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> + 3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> + 3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> + <p class="term-head">4. Member's right to cancellation </p> + 4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> + 4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> + <p class="term-head">5. Digital Glarus' right to cancel a membership </p> + 5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> + <p class="term-head">6. Digital Glarus' right to cancel a membership </p> + 6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> + 6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> + 6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. + <br><br> + + </p> + <div class="text-center"> + <div class="row"> + <div class="col-sm-3 col-md-offset-4"> + <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> + + </div> + + </div> + </div> + <div class="row col-md-2 text-center wow fadeInDown"> + </div> + </div> + + </div> + </div> + <div class="row col-md-3 text-center wow fadeInDown"></div> + </div> + </section> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + </div> + </div> + + </div> +</div> + + From 5ab4bdd07540849c679ec96508c1154606755386 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Mon, 9 Jan 2017 21:23:51 -0400 Subject: [PATCH 11/13] probando --- .../digitalglarus/booking_payment.html | 2 + .../templates/digitalglarus/login.html | 145 +++++++++++++++++- dynamicweb/settings/base.py | 4 +- 3 files changed, 149 insertions(+), 2 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index e4fb572c..79bf3038 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -261,6 +261,8 @@ </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> + + <!-- stripe key data --> diff --git a/digitalglarus/templates/digitalglarus/login.html b/digitalglarus/templates/digitalglarus/login.html index 58723ca7..6e962ee4 100644 --- a/digitalglarus/templates/digitalglarus/login.html +++ b/digitalglarus/templates/digitalglarus/login.html @@ -64,7 +64,7 @@ <p>{{form.non_field_errors|striptags}}</p> <p class="signup-notice">By logging in you agree to our<a data-toggle="modal" data-target="#cancel-subscription-modal" target="_blank">Terms of Service</a>.</p> - <p class="signup-notice">By logging in you agree to our<a data-toggle="modal" data-target="#myModal" target="_blank">Terms of Service</a>.</p> + <p class="signup-notice">By logging in you agree to our<a data-toggle="modal" data-target="terms-condition-modal2" target="_blank">Terms of Service</a>.</p> @@ -249,6 +249,149 @@ + + + + + + + + <div class="modal fade bs-example-modal-sm" id="#terms-condition-modal" tabindex="-1" role="dialog"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title">Cancel Subscription</h4> + </div> + <div class="modal-body"> + +<section id="price2"> +<div class="container"> +<!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> +<div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> +<div class="price-box"> +<span class="glyphicon glyphicon-flag"></span> +<h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> +<h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> +<hr class="primary"> +<div class="price-exp-box"> +<p class="text-center"> +<p class="term-head">1. Membership</p> +1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> +1.2. Each additional day costs 15CHF for members.<br> +<br> +<p class="term-head">2. Coworking days</p> +2.1. Coworking days are counted as 1 calendar day. <br> +2.2. Free coworking days are included in the membership. <br> +2.3. Unused working days are not refunded and can not be compensated for. <br><br> +<p class="term-head">3. Possible reduction</p> +3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> +3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> +3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> +<p class="term-head">4. Member's right to cancellation </p> +4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> +4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> +<p class="term-head">5. Digital Glarus' right to cancel a membership </p> +5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> +5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> +<p class="term-head">6. Digital Glarus' right to cancel a membership </p> +6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> +6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> +6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> +6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. +<br><br> +</p> +<div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> +<a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> +</div> +<div class="row col-md-2 text-center wow fadeInDown"> +</div> +</div> +</div> +</div> +<div class="row col-md-3 text-center wow fadeInDown"></div> +</div> +</section> + + + </div> + <div class="modal-footer text-center"> + <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">OK</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> + + + + + + <div class="modal fade bs-example-modal-sm" id="terms-condition-modal2" tabindex="-1" role="dialog"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title">Cancel Subscription</h4> + </div> + <div class="modal-body"> + +<section id="price2"> +<div class="container"> +<!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> +<div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> +<div class="price-box"> +<span class="glyphicon glyphicon-flag"></span> +<h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> +<h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> +<hr class="primary"> +<div class="price-exp-box"> +<p class="text-center"> +<p class="term-head">1. Membership</p> +1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> +1.2. Each additional day costs 15CHF for members.<br> +<br> +<p class="term-head">2. Coworking days</p> +2.1. Coworking days are counted as 1 calendar day. <br> +2.2. Free coworking days are included in the membership. <br> +2.3. Unused working days are not refunded and can not be compensated for. <br><br> +<p class="term-head">3. Possible reduction</p> +3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> +3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> +3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> +<p class="term-head">4. Member's right to cancellation </p> +4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> +4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> +<p class="term-head">5. Digital Glarus' right to cancel a membership </p> +5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> +5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> +<p class="term-head">6. Digital Glarus' right to cancel a membership </p> +6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> +6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> +6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> +6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. +<br><br> +</p> +<div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> +<a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> +</div> +<div class="row col-md-2 text-center wow fadeInDown"> +</div> +</div> +</div> +</div> +<div class="row col-md-3 text-center wow fadeInDown"></div> +</div> +</section> + + + </div> + <div class="modal-footer text-center"> + <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">OK</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> + diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 7d1de32c..0bb142ab 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -182,7 +182,9 @@ CMS_TEMPLATES = ( DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'app' + 'NAME': 'app', + 'USER': 'app', + 'HOST': 'db' } } From a2759833a506d46c073800d3ab38f0cc7bd085ee Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Tue, 10 Jan 2017 10:36:18 -0400 Subject: [PATCH 12/13] change branch --- .../templates/digitalglarus/login.html | 314 +++--------------- 1 file changed, 55 insertions(+), 259 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/login.html b/digitalglarus/templates/digitalglarus/login.html index 6e962ee4..f1515b63 100644 --- a/digitalglarus/templates/digitalglarus/login.html +++ b/digitalglarus/templates/digitalglarus/login.html @@ -1,28 +1,58 @@ + {% extends "new_base_glarus.html" %} {% load staticfiles bootstrap3 i18n %} {% block content %} <style type="text/css"> +@media screen and (min-width: 768px) { + + cancel-subscription-modal .modal-dialog {width:1000px;} - - cancel-subscription-modal .modal-body { - max-height: 10000px; - } + .glyphicon-flag { + font-size: 44px; + display: block; + text-align: center; + margin: 30px auto 30px; + color: #88c7d7; .price2 { -webkit-background-size: cover; -moz-background-size: cover; - } + cancel-subscription-modal .modal-body { + max-height: 800px; + } +} + +@media screen and (min-width: 780px) { + + cancel-subscription-modal .modal-dialog {width:1000px;} + + .glyphicon-flag { + font-size: 44px; + display: block; + text-align: center; + margin: 30px auto 30px; + color: #88c7d7; + + .price2 { + + + -webkit-background-size: cover; + -moz-background-size: cover; + +} + + cancel-subscription-modal .modal-body { + max-height: 800px; + } +} </style> - - <link rel="stylesheet" href="../dist/remodal.css"> - <link rel="stylesheet" href="../dist/remodal-default-theme.css"> <section id="price"> <div class="signup-container"> <div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div> @@ -64,7 +94,6 @@ <p>{{form.non_field_errors|striptags}}</p> <p class="signup-notice">By logging in you agree to our<a data-toggle="modal" data-target="#cancel-subscription-modal" target="_blank">Terms of Service</a>.</p> - <p class="signup-notice">By logging in you agree to our<a data-toggle="modal" data-target="terms-condition-modal2" target="_blank">Terms of Service</a>.</p> @@ -102,94 +131,22 @@ </div> </section> - -<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> - - <div class="modal-dialog" role="document"> - - <div class="row col-xs-18 col-sm-12 col-lg-20 modal-content"> - - <div class="modal-body"> - - <section id="price2"> - <div class="row col-xs-12 col-sm-7 col-lg-6 container"> - - <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> - <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <div class="price-box"> - - <span class="glyphicon glyphicon-flag"></span> - <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> - <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> - <hr class="primary"> - <div class="price-exp-box"> - <p class="text-center"> - <p class="term-head">1. Membership</p> - 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> - 1.2. Each additional day costs 15CHF for members.<br> - <br> - <p class="term-head">2. Coworking days</p> - 2.1. Coworking days are counted as 1 calendar day. <br> - 2.2. Free coworking days are included in the membership. <br> - 2.3. Unused working days are not refunded and can not be compensated for. <br><br> - <p class="term-head">3. Possible reduction</p> - 3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> - 3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> - 3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> - <p class="term-head">4. Member's right to cancellation </p> - 4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> - 4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> - <p class="term-head">5. Digital Glarus' right to cancel a membership </p> - 5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> - 5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> - <p class="term-head">6. Digital Glarus' right to cancel a membership </p> - 6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> - 6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> - 6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> - 6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. - <br><br> - - </p> - <div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> - <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> - </div> - <div class="row col-md-2 text-center wow fadeInDown"> - </div> - </div> - - </div> - </div> - <div class="row col-md-3 text-center wow fadeInDown"></div> - </div> - </section> + <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> </div> - </div><!-- /.modal-content --> - </div><!-- /.modal-dialog --> - </div><!-- /.modal --> - - -<!-- Trigger the modal with a button --> -<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button> - -<!-- Modal --> -<div id="myModal" class="modal fade" role="dialog"> - <div class="modal-dialog"> - - <!-- Modal content--> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <h4 class="modal-title">Modal Header</h4> - </div> - <div class="modal-body"> - <section id="price"> - <div class="container row col-md-13 col-sm-13"> - <div class="row col-md-7 col-sm-10 text-center wow fadeInDown"> + <div class="modal-body"> + + <section id="price2"> + <div class="container"> + <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> + <div class="row col-xs-12 col-sm-12 col-lg-6 text-center wow fadeInDown"> <div class="price-box"> <span class="glyphicon glyphicon-flag"></span> <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> - <h2 class="price2">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> + <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> <hr class="primary"> <div class="price-exp-box"> <p class="text-left"> @@ -220,13 +177,7 @@ </p> <div class="text-center"> - <div class="row"> - <div class="col-sm-3 col-md-offset-4"> - <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> - - </div> - - </div> + <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> </div> <div class="row col-md-2 text-center wow fadeInDown"> </div> @@ -237,163 +188,8 @@ <div class="row col-md-3 text-center wow fadeInDown"></div> </div> </section> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - </div> - </div> - - </div> -</div> - - - - - - - - - - - - <div class="modal fade bs-example-modal-sm" id="#terms-condition-modal" tabindex="-1" role="dialog"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title">Cancel Subscription</h4> - </div> - <div class="modal-body"> - -<section id="price2"> -<div class="container"> -<!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> -<div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> -<div class="price-box"> -<span class="glyphicon glyphicon-flag"></span> -<h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> -<h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> -<hr class="primary"> -<div class="price-exp-box"> -<p class="text-center"> -<p class="term-head">1. Membership</p> -1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> -1.2. Each additional day costs 15CHF for members.<br> -<br> -<p class="term-head">2. Coworking days</p> -2.1. Coworking days are counted as 1 calendar day. <br> -2.2. Free coworking days are included in the membership. <br> -2.3. Unused working days are not refunded and can not be compensated for. <br><br> -<p class="term-head">3. Possible reduction</p> -3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> -3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> -3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> -<p class="term-head">4. Member's right to cancellation </p> -4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> -4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> -<p class="term-head">5. Digital Glarus' right to cancel a membership </p> -5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> -5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> -<p class="term-head">6. Digital Glarus' right to cancel a membership </p> -6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> -6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> -6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> -6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. -<br><br> -</p> -<div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> -<a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> -</div> -<div class="row col-md-2 text-center wow fadeInDown"> -</div> -</div> -</div> -</div> -<div class="row col-md-3 text-center wow fadeInDown"></div> -</div> -</section> - - - </div> - <div class="modal-footer text-center"> - <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">OK</button> - </div> - </div><!-- /.modal-content --> - </div><!-- /.modal-dialog --> - </div><!-- /.modal --> - - - - - - <div class="modal fade bs-example-modal-sm" id="terms-condition-modal2" tabindex="-1" role="dialog"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title">Cancel Subscription</h4> - </div> - <div class="modal-body"> - -<section id="price2"> -<div class="container"> -<!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> -<div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> -<div class="price-box"> -<span class="glyphicon glyphicon-flag"></span> -<h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> -<h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> -<hr class="primary"> -<div class="price-exp-box"> -<p class="text-center"> -<p class="term-head">1. Membership</p> -1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> -1.2. Each additional day costs 15CHF for members.<br> -<br> -<p class="term-head">2. Coworking days</p> -2.1. Coworking days are counted as 1 calendar day. <br> -2.2. Free coworking days are included in the membership. <br> -2.3. Unused working days are not refunded and can not be compensated for. <br><br> -<p class="term-head">3. Possible reduction</p> -3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> -3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> -3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> -<p class="term-head">4. Member's right to cancellation </p> -4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> -4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> -<p class="term-head">5. Digital Glarus' right to cancel a membership </p> -5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> -5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> -<p class="term-head">6. Digital Glarus' right to cancel a membership </p> -6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> -6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> -6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> -6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. -<br><br> -</p> -<div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> -<a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> -</div> -<div class="row col-md-2 text-center wow fadeInDown"> -</div> -</div> -</div> -</div> -<div class="row col-md-3 text-center wow fadeInDown"></div> -</div> -</section> - - - </div> - <div class="modal-footer text-center"> - <button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">OK</button> - </div> - </div><!-- /.modal-content --> - </div><!-- /.modal-dialog --> - </div><!-- /.modal --> - - - - - + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> {% endblock %} \ No newline at end of file From cc7a670d2dbc133b93e334b925afbdb9385259c0 Mon Sep 17 00:00:00 2001 From: unknown <nquintero@wbinnova.com> Date: Tue, 10 Jan 2017 18:32:53 -0400 Subject: [PATCH 13/13] modal fixed --- .../digitalglarus/booking_payment.html | 126 ++++++++++-------- dynamicweb/settings/base.py | 4 +- 2 files changed, 69 insertions(+), 61 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html index 79bf3038..97ae1bce 100644 --- a/digitalglarus/templates/digitalglarus/booking_payment.html +++ b/digitalglarus/templates/digitalglarus/booking_payment.html @@ -147,7 +147,11 @@ <div class="order-box"> <h3 class="col-xs-6 order-item">Dates {{start_date}} - {{end_date}}</h3> <p class="order-bottom-text"> - <a href="{{request.META.HTTP_REFERER}}">Change dates</a> + <!-- <a href="{{request.META.HTTP_REFERER}}">Change dates</a> --> + <a href="{% url 'digitalglarus:booking' %}">Change dates</a> + + + </p> <hr class="greyline"> <h2 class="col-xs-6 payment-total">Total days: {{booking_days}} </h2> @@ -204,64 +208,70 @@ </div> </div> </section> - -<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-body"> - <section id="price2"> - <div class="container"> - <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> - <div class="row col-xs-12 col-sm-7 col-lg-6 text-center wow fadeInDown"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <div class="price-box"> - <span class="glyphicon glyphicon-flag"></span> - <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> - <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> - <hr class="primary"> - <div class="price-exp-box"> - <p class="text-center"> - <p class="term-head">1. Membership</p> - 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> - 1.2. Each additional day costs 15CHF for members.<br> - <br> - <p class="term-head">2. Coworking days</p> - 2.1. Coworking days are counted as 1 calendar day. <br> - 2.2. Free coworking days are included in the membership. <br> - 2.3. Unused working days are not refunded and can not be compensated for. <br><br> - <p class="term-head">3. Possible reduction</p> - 3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> - 3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> - 3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> - <p class="term-head">4. Member's right to cancellation </p> - 4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> - 4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> - <p class="term-head">5. Digital Glarus' right to cancel a membership </p> - 5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> - 5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> - <p class="term-head">6. Digital Glarus' right to cancel a membership </p> - 6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> - 6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> - 6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> - 6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. - <br><br> - </p> - <div class="row col-xs-12 col-sm-7 col-lg-6 text-center"> - <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> - </div> - <div class="row col-md-2 text-center wow fadeInDown"> - </div> - </div> - </div> - </div> - <div class="row col-md-3 text-center wow fadeInDown"></div> - </div> - </section> - </div> - </div><!-- /.modal-content --> - </div><!-- /.modal-dialog --> -</div><!-- /.modal --> + + <div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog" aria-hidden ="true"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + </div> + <div class="modal-body"> + + <section id="price2"> + <div class="container"> + <!--<div class="row col-md-2 text-center wow fadeInDown"></div> --> + <div class="row col-xs-12 col-sm-12 col-lg-6 text-center wow fadeInDown"> + <div class="price-box"> + <span class="glyphicon glyphicon-flag"></span> + <h2 class="section-heading">General Terms & Conditions of Digital Glarus Membership</h2> + <h2 class="price">Valid from 31 October 2016, v1.0 dated 31 October 2016</h2> + <hr class="primary"> + <div class="price-exp-box"> + <p class="text-left"> + <p class="term-head">1. Membership</p> + 1.1. The membership fee is 35CHF per month and charged on the 1st day of each month after your first month of subscription. <br> + 1.2. Each additional day costs 15CHF for members.<br> + <br> + <p class="term-head">2. Coworking days</p> + 2.1. Coworking days are counted as 1 calendar day. <br> + 2.2. Free coworking days are included in the membership. <br> + 2.3. Unused working days are not refunded and can not be compensated for. <br><br> + <p class="term-head">3. Possible reduction</p> + 3.1. Your first month's membership fee is calculated according to the date of your subscription. <br> + 3.2. The days already passed in the first month are discounted from the first month's membership fee.<br> + 3.3. A member booking more than 19 days for coworking gets a reduction in total cost and will only pay maximum 290CHF per month. The reduction will be applied automatically on Digital Glarus website.<br><br> + <p class="term-head">4. Member's right to cancellation </p> + 4.1. The member may cancel or change the booking of working day at any time prior to 7 days before the working day with no extra cost. <br> + 4.2. Bookings cancelled less than 7 days before the working date will not be refunded.<br><br> + <p class="term-head">5. Digital Glarus' right to cancel a membership </p> + 5.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 5.2. Members disrupting the environment of coworking may be rejected to join the membership.<br><br> + <p class="term-head">6. Digital Glarus' right to cancel a membership </p> + 6.1. Digital Glarus may cancel a membership contract without notice at any time, stating the reasons for the cancellation.<br> + 6.2. Digital Glarus may reject a member who disrupts the environment of coworking space from joining the membership.<br> + 6.3. Digital Glarus may terminate the membership of a member who disrupts the environment of coworking space. <br> + 6.4. Digital Glarus may expell a member who disrupts the environment of coworking space from the coworking space, stating the reasons for the expulsion. + <br><br> + + </p> + <div class="text-center"> + <a href="mailto:info@ungleich.ch" class="btn btn-primary btn-blue">Still have a question?</a> + </div> + <div class="row col-md-2 text-center wow fadeInDown"> + </div> + </div> + + </div> + </div> + <div class="row col-md-3 text-center wow fadeInDown"></div> + </div> + </section> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> + diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 0bb142ab..7d1de32c 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -182,9 +182,7 @@ CMS_TEMPLATES = ( DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'app', - 'USER': 'app', - 'HOST': 'db' + 'NAME': 'app' } }