
<div class="mb-4">
  <% if notice %>
    <div class="alert alert-success"><%= notice %></div>
  <% end %>
</div>

<div class="card bg-white shadow p-4 mb-4">
  <div class="card-body">
    <h2 class="card-title mb-3 text-primary"><%= @institution.name %></h2>
    <p class="card-text mb-2"><strong>ID:</strong> <%= @institution.id %></p>
    <%# Add more institution details here if needed %>
    <div class="mb-3">
      <%= link_to "Edit Institution", edit_institution_path(@institution), class: "btn btn-secondary me-2" %>
      <%= link_to "Back to Institutions", institutions_path, class: "btn btn-outline-light me-2" %>
      <%= button_to "Destroy Institution", @institution, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
    </div>
  </div>
</div>
<h3 class="mt-4 mb-3 text-info">Students</h3>
<div class="mb-3">
  <%= link_to "Add Student", new_institution_student_path(@institution), class: "btn btn-success" %>
</div>

<div class="row g-4">
  <% @institution.students.each do |student| %>
    <div class="col-md-6">
      <div class="card bg-white shadow-sm h-100 border-info">
        <div class="card-body">
          <h5 class="card-title text-info"><%= student.first_name %> <%= student.last_name %></h5>
          <p class="card-text mb-1"><strong>Email:</strong> <%= student.email %></p>
          <p class="card-text mb-1"><strong>ID:</strong> <%= student.id %></p>
        </div>
        <div class="card-footer bg-transparent border-0 d-flex justify-content-end">
          <%= link_to "Show", institution_student_path(@institution, student), class: "btn btn-primary btn-sm me-2" %>
          <%= link_to "Edit", edit_institution_student_path(@institution, student), class: "btn btn-secondary btn-sm me-2" %>
          <%= button_to "Delete", institution_student_path(@institution, student), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger btn-sm" %>
        </div>
      </div>
    </div>
  <% end %>
</div>
