#hotfix Fixed select date picker

This commit is contained in:
Levi 2016-09-19 19:20:57 -05:00
parent 45374f8623
commit 80095ed1aa
8 changed files with 84 additions and 53 deletions

View file

@ -60,37 +60,14 @@ class BookingBillingForm(BillingAddressForm):
class BookingDateForm(forms.Form): class BookingDateForm(forms.Form):
start_date = forms.DateField(required=False, start_date = forms.DateField(required=False,
widget=forms.TextInput(attrs={'id': 'booking-date-1', widget=forms.TextInput(attrs={'id': 'booking-date-1',
'value': ''})) 'value': 'Select your date'}))
end_date = forms.DateField(required=False, end_date = forms.DateField(required=False,
widget=forms.TextInput(attrs={'id': 'booking-date-2'})) widget=forms.TextInput(attrs={'id': 'booking-date-2'}))
# def clean_date_range(self):
# date_range = self.cleaned_data.get('date_range')
# dates = date_range.replace(' ', '').split('-')
# try:
# start_date, end_date = [datetime.strptime(date_string, "%m/%d/%Y").date()
# for date_string in dates]
# except ValueError:
# raise forms.ValidationError("Submit valid dates.")
# if start_date > end_date:
# raise forms.ValidationError("Your end date must be greather than your start date.")
# q1 = Q(start_date__lte=start_date, end_date__gte=start_date)
# q2 = Q(start_date__gt=start_date, start_date__lte=end_date)
# if Booking.objects.filter(q1 | q2).exists():
# raise forms.ValidationError("You already have a booking in these dates.")
# return start_date, end_date
def clean_start_date(self): def clean_start_date(self):
start_date = self.cleaned_data.get('start_date') start_date = self.cleaned_data.get('start_date')
if not start_date: if not start_date:
raise forms.ValidationError("This field is required.") raise forms.ValidationError("This field is required.")
# try:
# start_date = datetime.strptime(start_date, "%m/%d/%Y").date()
# except ValueError:
# raise forms.ValidationError("Submit valid dates.")
return start_date return start_date
def clean_end_date(self): def clean_end_date(self):

View file

@ -7,14 +7,16 @@ $( document ).ready(function() {
var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000); var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
$('#booking-date-1').datetimepicker({ $('#booking-date-1').datetimepicker({
// minDate: tomorrow, minDate: tomorrow,
format: 'MM/d/YYYY', format: 'MM/DD/YYYY',
defaultDate: false // defaultDate: false
}); });
$('#booking-date-1').val('');
$('#booking-date-2').datetimepicker({ $('#booking-date-2').datetimepicker({
useCurrent: false, //Important! See issue #1075 useCurrent: false, //Important! See issue #1075
format: 'MM/d/YYYY', format: 'MM/DD/YYYY',
}); });
$("#booking-date-1").on("dp.change", function (e) { $("#booking-date-1").on("dp.change", function (e) {
$('#booking-date-2').data("DateTimePicker").minDate(e.date); $('#booking-date-2').data("DateTimePicker").minDate(e.date);
@ -23,24 +25,4 @@ $( document ).ready(function() {
$('#booking-date-1').data("DateTimePicker").maxDate(e.date); $('#booking-date-1').data("DateTimePicker").maxDate(e.date);
}); });
// var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
// // var tomorrow = today.setDate(today.getDate() + 1);
// $('#booking-date-range').daterangepicker({
// autoUpdateInput: false,
// locale: {
// cancelLabel: 'Clear'
// },
// minDate: tomorrow,
// });
// $('#booking-date-range').on('apply.daterangepicker', function(ev, picker) {
// $(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
// });
// $('#booking-date-range').on('dp.cancel', function(ev, picker) {
// $(this).val('Select your dates');
// });
}); });

View file

@ -7,6 +7,7 @@
.invoice-title{ .invoice-title{
text-align: center !important; text-align: center !important;
} }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -19,7 +20,7 @@
<div class="payment-box"> <div class="payment-box">
<h2 class="section-heading payment-head">Your Booking Detail</h2> <h2 class="section-heading payment-head">Your Booking Detail</h2>
<hr class="greyline-long"> <hr class="greyline-long">
<h2 class="billing-head">Invoice<btn class="btn btn-primary btn-grey btn-edit print" data-print="price">Get PDF</btn></h2> <h2 class="billing-head">Invoice<btn class="btn btn-primary btn-grey btn-edit print hidden-print" data-print="price">Get PDF</btn></h2>
<h2 class="order-head">Order Number</h2> <h2 class="order-head">Order Number</h2>
<h2 class="member-name">#{{order.id}}</h2> <h2 class="member-name">#{{order.id}}</h2>

View file

@ -10,7 +10,9 @@
<div class="signup-box"> <div class="signup-box">
<span class="glyphicon glyphicon-user"></span> <span class="glyphicon glyphicon-user"></span>
<h2 class="section-heading">Log In</h2> <h2 class="section-heading">Log In</h2>
{% if not messages %}
<h2 class="signup-lead">Welcome!<br></h2> <h2 class="signup-lead">Welcome!<br></h2>
{% endif %}
{% if messages %} {% if messages %}

View file

@ -0,0 +1,54 @@
{% extends "new_base_glarus.html" %}
{% load staticfiles cms_tags bootstrap3%}
{% block title %}crowdfunding{% endblock %}
{% block content %}
<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">Membership Deactivated</h2>
<hr class="greyline-long">
<h2 class="membership-lead">Your Digital Glarus membership has been deactivated.</h2>
<div class="date-box">
</div>
<!--<hr class="primary">-->
<div class="signup-form form-group row">
<div class="button-booking-box form-inline row">
<a class="btn btn-primary btn-blue" href={% url 'digitalglarus:membership_orders_list' %}>Go to your membership orders</a>
</div>
<div class="notice-box text-left">
</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>&nbsp;</p>
</span>
</div>
<p>&nbsp;</p>
</div>
</div>
</div>
</section>
{% endblock %}

View file

@ -19,7 +19,7 @@
<div class="payment-box"> <div class="payment-box">
<h2 class="section-heading payment-head">Your Membership Order Detail</h2> <h2 class="section-heading payment-head">Your Membership Order Detail</h2>
<hr class="greyline-long"> <hr class="greyline-long">
<h2 class="billing-head">Invoice<btn class="btn btn-primary btn-grey btn-edit print" data-print="price">Get PDF</btn></h2> <h2 class="billing-head">Invoice<btn class="btn btn-primary btn-grey btn-edit print hidden-print" data-print="price">Get PDF</btn></h2>
<h2 class="order-head">Order Number</h2> <h2 class="order-head">Order Number</h2>
<h2 class="member-name">#{{order.id}}</h2> <h2 class="member-name">#{{order.id}}</h2>

View file

@ -5,7 +5,8 @@ from . import views
from .views import ContactView, IndexView, AboutView, HistoryView, LoginView, SignupView,\ from .views import ContactView, IndexView, AboutView, HistoryView, LoginView, SignupView,\
PasswordResetView, PasswordResetConfirmView, MembershipPaymentView, MembershipActivatedView,\ PasswordResetView, PasswordResetConfirmView, MembershipPaymentView, MembershipActivatedView,\
MembershipPricingView, BookingSelectDatesView, BookingPaymentView, OrdersBookingDetailView,\ MembershipPricingView, BookingSelectDatesView, BookingPaymentView, OrdersBookingDetailView,\
BookingOrdersListView, MembershipOrdersListView, OrdersMembershipDetailView, MembershipDeactivateView BookingOrdersListView, MembershipOrdersListView, OrdersMembershipDetailView, \
MembershipDeactivateView, MembershipDeactivateSuccessView
# from membership.views import LoginRegistrationView # from membership.views import LoginRegistrationView
urlpatterns = [ urlpatterns = [
@ -30,6 +31,8 @@ urlpatterns = [
name='membership_activated'), name='membership_activated'),
url(_(r'membership/deactivate/?$'), MembershipDeactivateView.as_view(), url(_(r'membership/deactivate/?$'), MembershipDeactivateView.as_view(),
name='membership_deactivate'), name='membership_deactivate'),
url(_(r'membership/deactivate/success/?$'), MembershipDeactivateSuccessView.as_view(),
name='membership_deactivate_success'),
url(_(r'membership/pricing/?$'), MembershipPricingView.as_view(), url(_(r'membership/pricing/?$'), MembershipPricingView.as_view(),
name='membership_pricing'), name='membership_pricing'),
url(_(r'membership/orders/(?P<pk>\d+)/?$'), OrdersMembershipDetailView.as_view(), url(_(r'membership/orders/(?P<pk>\d+)/?$'), OrdersMembershipDetailView.as_view(),

View file

@ -47,7 +47,15 @@ class IndexView(TemplateView):
class LoginView(LoginViewMixin): class LoginView(LoginViewMixin):
template_name = "digitalglarus/login.html" template_name = "digitalglarus/login.html"
form_class = LoginForm form_class = LoginForm
success_url = reverse_lazy('digitalglarus:membership_pricing')
def get_success_url(self):
# redirect to membership orders list if user has at least one.
if self.request.user \
and MembershipOrder.objects.filter(customer__user=self.request.user):
return reverse_lazy('digitalglarus:membership_orders_list')
return reverse_lazy('digitalglarus:membership_pricing')
class SignupView(SignupViewMixin): class SignupView(SignupViewMixin):
@ -367,6 +375,10 @@ class MembershipDeactivateView(LoginRequiredMixin, UpdateView):
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.success_url)
class MembershipDeactivateSuccessView(LoginRequiredMixin, TemplateView):
template_name = "digitalglarus/membership_deactivated_success.html"
class MembershipOrdersListView(LoginRequiredMixin, ListView): class MembershipOrdersListView(LoginRequiredMixin, ListView):
template_name = "digitalglarus/membership_orders_list.html" template_name = "digitalglarus/membership_orders_list.html"
context_object_name = "orders" context_object_name = "orders"