Skip to content

Commit

Permalink
Ticket popup with walk in price
Browse files Browse the repository at this point in the history
  • Loading branch information
mprunell committed Jul 15, 2021
1 parent f6ab662 commit d8474c5
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
4 changes: 3 additions & 1 deletion smallslive/events/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
20 changes: 20 additions & 0 deletions smallslive/events/migrations/0044_eventset_walk_in_price.py
Original file line number Diff line number Diff line change
@@ -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,
),
]
1 change: 1 addition & 0 deletions smallslive/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions smallslive/static/js/event_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
17 changes: 13 additions & 4 deletions smallslive/templates/events/buy_tickets_dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,29 @@
{% if event.is_foundation %}
<p class="title2 accent-color" tabindex="0">Sponsor Seats - SmallsLIVE Foundation</p>
{% else %}
<p class="title2 {{ event.get_venue_name|lower}}-color" tabindex="0">Reservations for {{ event.get_venue_name }} jazz club </p>
<p class="title2 {{ event.get_venue_name|lower}}-color" tabindex="0">Reserved Seating for {{ event.get_venue_name }} Jazz <C> </C>lub </p>
{% endif %}
<p class="title2" tabindex="0">{{ event.date | date:"D, M d" }} <span id="ticket-time"></span></p>
<p class="title2" tabindex="0">{{ event.date | date:"D, M d" }} <span id="ticket-time"></span> Show</p>
<p id="ticket-name" class="title2" tabindex="0"></p>
{% if event.is_foundation %}
<p class="title2">Sponsorship Seats $<span id="ticket-price" tabindex="0"></span></p>
{% else %}
<p class="title2">Seats $<span id="ticket-price" tabindex="0"></span></p>
<p class="title2">Reserved seats are $<span id="ticket-price" tabindex="0"></span> for this show.</p>
{% endif %}
{% if event.is_foundation %}
<p class="title2" tabindex="0"><span id="ticket-availability"></span> sponsorships(s) available</p>
<p class="text9 text-center">Sponsorships are tax deductible donations to the SmallsLIVE Foundation</p>
{% else %}
<p class="title2" tabindex="0"><span id="ticket-availability"></span> reservation(s) available</p>
<p class="title2 text-center" tabindex="0">There are <span id="ticket-availability"></span> Reserved Seat(s) available for this show</p>
<p class="text4 text-center">
A reserved seat guarantees your seat for this show.
</p>
<p class="text4 text-center">
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.
</p>
<p class="text4 text-center">
Walk-in price is only $<span id="walk-in-price"></span>. Walk-in space is limited. Please arrive early for walk-in without reservation.
</p>
{% endif %}
<div>
<button id="cancel-buy-tickets" class="white-border-button" tabindex="0">Cancel</button>
Expand Down
2 changes: 2 additions & 0 deletions smallslive/templates/events/event_details_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}</button>
{% include 'events/buy_tickets_dialog.html' %}
Expand Down Expand Up @@ -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 %}
Expand Down

0 comments on commit d8474c5

Please sign in to comment.