Skip to content

Instantly share code, notes, and snippets.

@Riveascore
Created June 30, 2016 16:55
Show Gist options
  • Save Riveascore/74f750a62f15ffdaea375f3c7235b1ee to your computer and use it in GitHub Desktop.
Save Riveascore/74f750a62f15ffdaea375f3c7235b1ee to your computer and use it in GitHub Desktop.
function setupConflict(siteId, roomId, dateString) {
var locationSelector, roomSelector, $unselectable, $dateInput;
locationSelector = '#facility_request_every_facility_request_section_attributes_0_attributes_to_build_facility_request_parts_site_id_' + siteId;
roomSelector = '#facility_request_every_facility_request_section_attributes_0_attributes_to_build_facility_request_parts_room_ids_' + roomId + '_';
$(document).on('rooms-loaded', function (event) {
$(roomSelector).prop('checked', true);
$(roomSelector).change();
$('.room-notes').slideUp();
setTimeout(function () {
$dateInput = $('#facility_request_every_facility_request_section_attributes_0_attributes_to_build_facility_request_parts_dates');
$dateInput.val(dateString);
$dateInput.closest('.form-group').parent().show();
}, 1000);
});
$(locationSelector).prop('checked', true);
$(locationSelector).change();
$('#facility_request_every_facility_request_section_attributes_0_attributes_to_build_facility_request_parts_start_time').val("07:00");
$('#facility_request_every_facility_request_section_attributes_0_attributes_to_build_facility_request_parts_end_time').val("21:00");
}
$(document).ready(function() {
setupConflict(35, 279, "06/28/2016,06/29/2016,06/30/2016");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment