<%inherit file="main.html" />
<%include file="navigation.html" args="active_page=''" />
<section class="main-content">
<script>
function name_confirm(id) {
  postJSON('/accept_name_change',{"id":id},
            function(data){
          if(data.success){
            $("#div"+id).html("Accepted");
          } else {
            alert('Error');
          }
     });
}

function name_deny(id) {
  postJSON('/reject_name_change',{"id":id},
            function(data){
          if(data.success){
            $("#div"+id).html("Rejected");
          } else {
            alert('Error');
          }
     });
}
</script>

<div class="gradebook-wrapper">
  <section class="gradebook-content">
  <h1>Pending name changes</h1>
  <table>
  % for s in students:
  <tr>
    <td><a href=/profile/${s['uid']}/>${s['old_name']}</td>
    <td>${s['new_name']|h}</td>
    <td>${s['email']|h}</td>
    <td>${s['rationale']|h}</td>
    <td><span id="div${s['cid']}"><span onclick="name_confirm(${s['cid']});">[Confirm]</span>
    <span onclick="name_deny(${s['cid']});">[Reject]</span></span></td></tr>
  % endfor
  </table>
  </section>
</div>
</section>
