o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1321397842.7666299 w:@value{ I"length:EFiÇI"digest;
F"%e23e849d0e45337d745853f29eeaa4d6I"source;
FI"Ç
$(document).ready(function() {
if (!$("form#appointment_data_search")) return;
$("#find_appointments").bind('click', function() {
var lab_code, selected_lab;
selected_lab = $('#lab_list_container input:radio:checked');
lab_code = $('#lab_list_container input:radio:checked').parent('li').find('form input#lab_code').val();
return $("form#appointment_data_search input#lab_code").val(lab_code);
});
$("form#appointment_data_search").bind('ajax:beforeSend', function(event, data) {
var form;
form = $(this);
return Appointment.BeforeSendHandler(form);
}).bind('ajax:success', function(event, data) {
var form;
form = $(this);
return Appointment.SuccessHandler(form, event, data);
}).bind('ajax:complete', function(event, data) {
var form;
form = $(this);
return $('.appointment_spinner_elem').hide();
}).bind('ajax:error', function(xhr, status, error) {
var form, response;
form = $(this);
response = JSON.parse(status.responseText);
return Appointment.ErrorHandler(form, status.status, response.message);
});
Appointment.BeforeSendHandler = function(form) {
var date, lab_code, messages, span, valid_date;
form.find('.error_message').empty();
messages = [];
date = form.find('input#date').val();
valid_date = Date.parseExact(date, "M/d/yyyy");
if (!valid_date) messages.push("Date is invalid, must be mm/dd/yyyy format");
lab_code = form.find('input#lab_code').val();
if (!lab_code) messages.push("Labcode is missing");
if (messages.length > 0) {
span = $("" + (messages.join("
")) + "");
form.find('.error_message').append(span);
span.fadeOut(4000);
return false;
} else {
form.find('#find_appointments').prop("disabled", true);
$('.appointment_spinner_elem').show();
return true;
}
};
Appointment.SuccessHandler = function(form, event, data) {
if (data.times.length === 0) {
Appointment.ErrorHandler($(this), 200, "No times available for that date");
return;
}
window.appointment_list.setList(data.times);
$('input:radio[name=appointment_time]:first').prop('checked', true);
return form.find('#find_appointments').prop("disabled", false);
};
Appointment.ErrorHandler = function(form, status, message) {
var span;
if (message.match(/Connection refused/i)) {
message = "Unable to make appointments at this time. Try walk-in instead";
}
span = $("" + message + "");
return form.find('.error_message').append(span);
};
return $("#more_appointments_list_toggler").live("click", function() {
window.appointment_list.setShowNumber(window.max_appointment_show_number);
$('input:radio[name=appointment_time]:first').prop('checked', true);
return $("#more_appointments_list_toggler").hide();
});
});
;
FI"
_version;
F"%a12fa143f95570a7b3a35932d97ca4f9