Sha256: ce16ead6ef9193447e6ec6687913c7528aeff07b686657a429fdf705102367f6
Contents?: true
Size: 1.9 KB
Versions: 20
Compression:
Stored size: 1.9 KB
Contents
$(document).ready -> ###### set the lab code in the appointment form ######## # using click handler cause it fires before the submit # request $("#find_appointments").bind('click', -> selected_lab = $('#lab_list_container input:radio:checked') lab_code = $('#lab_list_container input:radio:checked').parent('li').find('form input#lab_code').val() $("form#appointment_data_search input#lab_code").val(lab_code) ) ###### handle ajax appointment data search submit ######## $("form#appointment_data_search") .bind('ajax:beforeSend', (event, data)-> form = $(this) messages = [] date = form.find('input#appointment_date').val() valid_date = Date.parseExact(date, "M/d/yyyy") messages.push("Date is invalid, must be mm/dd/yyyy format") unless valid_date # trying to set the lab code here did not work. so had to use click handler above lab_code = form.find('input#lab_code').val() messages.push("Labcode is missing") unless lab_code if (messages.length > 0) span = $("<span>#{messages.join("<br>")}</span>") form.find('.error_message').append(span) span.fadeOut(4000) false ) .bind('ajax:success', (event, data)-> window.appointment_list.setList(data.times) # set the first appointment time as selected $('input:radio[name=appointment_time]:first').prop('checked',true) # re enable searching for appointment times $('form#appointment_data_search input[type=submit]').prop("disabled", false) ) .bind('ajax:complete', (event, data)-> # nothing here for now ) ###### handle toggle to show more appointments ######## $("#more_appointments_list_toggler").live("click", -> window.appointment_list.setShowNumber(window.max_appointment_show_number) $('input:radio[name=appointment_time]:first').prop('checked',true) $("#more_appointments_list_toggler").hide() )
Version data entries
20 entries across 20 versions & 1 rubygems