Skip to content

Commit

Permalink
Availability support
Browse files Browse the repository at this point in the history
  • Loading branch information
mbogoevici authored and pmuir committed May 28, 2012
1 parent 8bab9f2 commit 197580d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/webapp/events.html
Expand Up @@ -57,6 +57,17 @@
}
})
}

function checkAvailability(quantity, sectionId) {
if ('' === quantity || quantity == 0) {
return
}
$.getJSON("rest/availability", {"performance":$("#performanceTimes").val(),"quantity":quantity,"section":sectionId}, function(result) {
var divId = "#sectionAvailability"+sectionId;
$(divId).empty().append(result?"<div style='color:#00FF00'>available</div>":"<div style='color:#FF0000'>unavailable</div>")
})
}

function beginBookTicket(performanceId) {
if ($("#performanceTimes").val()) {
$("#book").empty();
Expand All @@ -65,8 +76,9 @@
var selectedShow = loadedShows[showId];
$.getJSON("rest/venues/layouts/" + selectedShow.venueLayout.id + "/sections", function (sections) {
$.each(sections, function (i, section) {
$("#bookTickets").append("Section " + section.name + ": <input type='number' name='tickets' min='0' title='Numeric value'/>" +
"<input type='hidden' name='sections' value='"+section.id+"'/<p/>")
$("#bookTickets").append("Section " + section.name + ": <input type='number' name='tickets' min='0' onchange='checkAvailability(this.value,"+section.id+")' title='Numeric value'/> " +
" <input type='hidden' name='sections' value='"+section.id+"'/>" +
" <div id='sectionAvailability"+ section.id + "'/> <p/>")
})

$("#bookTickets").append("Email: <input type='email' name='email' required/>");
Expand Down

0 comments on commit 197580d

Please sign in to comment.