From d8474c52161986c90af952b7e631afb49fa017ba Mon Sep 17 00:00:00 2001 From: Martin Prunell Date: Thu, 15 Jul 2021 13:46:32 -0300 Subject: [PATCH] Ticket popup with walk in price --- smallslive/events/forms.py | 4 +++- .../migrations/0044_eventset_walk_in_price.py | 20 +++++++++++++++++++ smallslive/events/models.py | 1 + smallslive/static/js/event_form.js | 4 ++++ .../templates/events/buy_tickets_dialog.html | 17 ++++++++++++---- .../templates/events/event_details_new.html | 2 ++ 6 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 smallslive/events/migrations/0044_eventset_walk_in_price.py diff --git a/smallslive/events/forms.py b/smallslive/events/forms.py index f499399e9..4e2d28157 100644 --- a/smallslive/events/forms.py +++ b/smallslive/events/forms.py @@ -103,9 +103,10 @@ def __init__(self, *args, **kwargs): class EventSetInlineFormset(InlineFormSet): model = EventSet - fields = ('start', 'end') + fields = ('start', 'end', 'walk_in_price') extra = 1 + def construct_formset(self): if self.object and self.object.sets.count() > 0: self.extra = 0 @@ -120,6 +121,7 @@ def construct_formset(self): form.fields['end'].widget = forms.TimeInput(format='%I:%M %p') form.fields['end'].initial = now form.fields['end'].input_formats = ['%I:%M %p'] + form.fields['walk_in_price'].widget.attrs['data-clone-value'] = 'True' return formset diff --git a/smallslive/events/migrations/0044_eventset_walk_in_price.py b/smallslive/events/migrations/0044_eventset_walk_in_price.py new file mode 100644 index 000000000..fcddc06b9 --- /dev/null +++ b/smallslive/events/migrations/0044_eventset_walk_in_price.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('events', '0043_event_is_foundation'), + ] + + operations = [ + migrations.AddField( + model_name='eventset', + name='walk_in_price', + field=models.IntegerField(default=25), + preserve_default=True, + ), + ] diff --git a/smallslive/events/models.py b/smallslive/events/models.py index 7bd862efc..927e70788 100644 --- a/smallslive/events/models.py +++ b/smallslive/events/models.py @@ -1067,6 +1067,7 @@ class EventSet(models.Model): event = models.ForeignKey('events.Event', related_name='sets') video_recording = models.OneToOneField('events.Recording', related_name='set_is_video', blank=True, null=True) audio_recording = models.OneToOneField('events.Recording', related_name='set_is_audio', blank=True, null=True) + walk_in_price = models.IntegerField(default=25) objects = EventSetManager() diff --git a/smallslive/static/js/event_form.js b/smallslive/static/js/event_form.js index 43a1c1101..cc7910606 100644 --- a/smallslive/static/js/event_form.js +++ b/smallslive/static/js/event_form.js @@ -24,6 +24,10 @@ EventForm = { .val("") .removeAttr("checked"); } + // Clone value if 'data-clone-value' = True. Set default value for walk in price. + if ($(this).data("clone-value") == "True") { + $(this).val($(this).attr("value")); + } }); newElement.find(".sort_order_field").val(total); total++; diff --git a/smallslive/templates/events/buy_tickets_dialog.html b/smallslive/templates/events/buy_tickets_dialog.html index aea4a0c08..6553f2086 100644 --- a/smallslive/templates/events/buy_tickets_dialog.html +++ b/smallslive/templates/events/buy_tickets_dialog.html @@ -5,20 +5,29 @@ {% if event.is_foundation %}

Sponsor Seats - SmallsLIVE Foundation

{% else %} -

Reservations for {{ event.get_venue_name }} jazz club

+

Reserved Seating for {{ event.get_venue_name }} Jazz lub

{% endif %} -

{{ event.date | date:"D, M d" }}

+

{{ event.date | date:"D, M d" }} Show

{% if event.is_foundation %}

Sponsorship Seats $

{% else %} -

Seats $

+

Reserved seats are $ for this show.

{% endif %} {% if event.is_foundation %}

sponsorships(s) available

Sponsorships are tax deductible donations to the SmallsLIVE Foundation

{% else %} -

reservation(s) available

+

There are Reserved Seat(s) available for this show

+

+ A reserved seat guarantees your seat for this show. +

+

+ Please arrive at least 30 minutes early. Guests arriving after the start of the show are seated at the discretion of the management and risk losing their seats of being moved to another show. +

+

+ Walk-in price is only $. Walk-in space is limited. Please arrive early for walk-in without reservation. +

{% endif %}
diff --git a/smallslive/templates/events/event_details_new.html b/smallslive/templates/events/event_details_new.html index 4603d1247..ced9b7dc5 100644 --- a/smallslive/templates/events/event_details_new.html +++ b/smallslive/templates/events/event_details_new.html @@ -126,6 +126,7 @@ data-ticket-time="{{ product.event_set.start|time:'g:i A' }}" data-ticket-price="{{ session.price.excl_tax }}" data-ticket-availability="{{ session.availability.num_available }}" + data-walk-in-price="{{ product.event_set.walk_in_price }}" class="buy-tickets white-border-button" style="display: inline;">{{ product.set }} {% include 'events/buy_tickets_dialog.html' %} @@ -270,6 +271,7 @@ $('#ticket-time').text( $(this).data('ticket-time')); $('#ticket-price').text($(this).data('ticket-price')); $('#ticket-availability').text($(this).data('ticket-availability')); + $('#walk-in-price').text($(this).data('walk-in-price')); $('#buy-tickets-dialog').modal('show'); {% else %}