var student_id = <%= @student_id %>;

if (student_id) {
  $('#exempt_student_check_' + student_id).removeAttr('disabled');

  var studentName = $('#student_name_' + student_id);
  studentName.removeClass('exempted-student');

  var noteInput = $("#tr_student_" + student_id + " input[id ^='daily_note_students_attributes'][id $='note']")[0];
  $(noteInput).removeClass('exempted-student');

  var undo_exemption_button = $('#do_undo_exemption_' + student_id);
  undo_exemption_button.removeClass('undo-exemption');
  undo_exemption_button.removeClass('btn-default');
  undo_exemption_button.addClass('do-exemption');
  undo_exemption_button.addClass('open-exemption-modal');
  undo_exemption_button.addClass('btn-primary');
  undo_exemption_button.removeAttr('data-remote');
  undo_exemption_button.removeAttr('data-method');
  undo_exemption_button.attr('href', '#');
  undo_exemption_button.attr('title', 'Dispensar');

  if (!studentName.hasClass('in-active-search')) {
    studentName.text(studentName.text().replace('**', ''));
    $(noteInput).removeAttr('readonly');
    $(noteInput).removeAttr('placeholder');
  }
}
