<% page_title t('titles.schools'), @school.displayName, t('titles.users'), @user.displayName, t('titles.change_school') %>

<div class="formContainer">

<h1><%= t('.title') %></h1>

<%= form_for("role", url: change_school_users_path(@school))  do |f| %>
<%= hidden_field_tag :new_school, @new_school.id %>
<%= hidden_field_tag "user_ids[]", @user.id %>
<table class="editForm">
  <tr>
    <th><%= label_tag :new_school, t('.user') %></td>
    <td><%= @user.displayName %></td>
  </th>

  <tr>
    <th><%= label_tag :new_school, t('.role') %></td>
    <td><%= list_user_roles(@user.puavoEduPersonAffiliation) %></td>
  </th>

  <tr>
    <th><label><%= t('.new_school') %></label></th>
    <td><%= @new_school.displayName  %></td>
  </tr>

  <tr>
    <th>
      <%= label_tag :new_role, @user.puavoEduPersonAffiliation == 'student' ? t('.select_new_group_student') : t('.select_new_group_teacher') %>
    </th>
    <td>
      <%= select_tag :new_role, options_from_collection_for_select(@groups, "puavoId", "displayName") %>
      <div class="genericNotice">
        <% if @user.puavoEduPersonAffiliation == 'student' %>
          <%= t('.group_help_students') %>
        <% else %>
          <%= t('.group_help_teachers') %>
        <% end %>
      </div>
    </td>
  </tr>

  <tr class="buttonRow">
    <td colspan="2">
      <%= f.submit t('.submit'), class: 'btn' %>
    </td>
  </tr>
</table>
<% end %>

</div>
