<% title org.id.present? ? _('Organisation details') : _('New organisation') %>
<div class="row org-admin">
  <div class="col-md-12">
    <h1><%= org.id.present? ? _('Organisation details') : _('New organisation') %></h1>
    <% if current_user.can_super_admin? %>
      <%= link_to _('View all organisations'), super_admin_orgs_path, class: 'btn btn-default pull-right' %>
    <% end %>
  </div>
</div>

<div class="row org-admin">
  <div class="col-md-12">
    <ul class="nav nav-tabs" role="tablist">
      <li role="profile" class="active">
        <a href="#profile" role="tab" aria-controls="profile" data-toggle="tab"><%= _('Profile information') %></a>
      </li>
      <% if org.id.present? %>
        <li role="feedback">
          <a href="#feedback" role="tab" aria-controls="feedback" data-toggle="tab"><%= _('Request feedback') %></a>
        </li>
        <li role="form">
          <a href="#departments" role="tab" aria-controls="form" data-toggle="tab"><%= _('Schools/Departments') %></a>
        </li>
      <% end %>
    </ul>

    <!-- render navigation tabs for the template-->
    <div class="tab-content">
      <div role="tabpanel" class="tab-pane active" id="profile">
        <div class="panel panel-default">
          <div class="panel-body">
            <div class="px-2">
              <%= render partial: 'orgs/profile_form', locals: local_assigns %>
            </div>
          </div>
        </div>
      </div>
      <div role="tabpanel" class="tab-pane" id="feedback">
        <div class="panel panel-default">
          <div class="panel-body">
            <% if org.id.present? %>
              <div>
                <%= render partial: 'orgs/feedback_form', locals: local_assigns %>
              </div>
            <% end %>
          </div>
        </div>
      </div>
      <div role="tabpanel" class="tab-pane" id="departments">
        <div class="panel panel-default">
          <div class="panel-body">
            <% if org.id.present? %>
              <div>
                <%= render partial: 'orgs/departments', locals: local_assigns.merge({ departments: org.departments, org_id: org.id }) %>
              </div>
            <% end %>
          </div>
        </div>
    </div>
  </div>
</div>
