75 lines
3.8 KiB
Plaintext
75 lines
3.8 KiB
Plaintext
<div class="max-w-7xl mx-auto">
|
|
<%= admin_breadcrumbs(@breadcrumbs) %>
|
|
|
|
<div class="bg-white shadow-sm ring-1 ring-gray-900/5 rounded-lg mb-6">
|
|
<div class="px-6 py-6">
|
|
<div class="flex items-center justify-between mb-6">
|
|
<div class="flex items-center gap-3">
|
|
<h2 class="text-2xl font-bold text-gray-900"><%= @teacher.username %></h2>
|
|
<% if @teacher.discarded? %>
|
|
<span class="inline-flex items-center rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/10">Deactivated</span>
|
|
<% else %>
|
|
<span class="inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20">Active</span>
|
|
<% end %>
|
|
</div>
|
|
<div class="flex gap-3">
|
|
<%= link_to edit_admin_teacher_path(@teacher),
|
|
class: "inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" do %>
|
|
<i class="fas fa-edit -ml-1 mr-2 h-5 w-5 text-gray-500"></i>
|
|
Edit
|
|
<% end %>
|
|
<% if @teacher.discarded? %>
|
|
<%= link_to admin_teacher_reactivation_path(@teacher),
|
|
data: { turbo_method: :post, turbo_confirm: "Are you sure you want to reactivate this teacher?" },
|
|
class: "inline-flex items-center px-4 py-2 border border-green-300 shadow-sm text-sm font-medium rounded-md text-green-700 bg-white hover:bg-green-50" do %>
|
|
<i class="fas fa-check-circle -ml-1 mr-2 h-5 w-5 text-green-500"></i>
|
|
Reactivate
|
|
<% end %>
|
|
<%= link_to admin_teacher_path(@teacher),
|
|
data: { turbo_method: :delete, turbo_confirm: "Are you sure you want to permanently delete this teacher? This action cannot be undone." },
|
|
class: "inline-flex items-center px-4 py-2 border border-red-300 shadow-sm text-sm font-medium rounded-md text-red-700 bg-white hover:bg-red-50" do %>
|
|
<i class="fas fa-trash -ml-1 mr-2 h-5 w-5 text-red-500"></i>
|
|
Permanently Delete
|
|
<% end %>
|
|
<% else %>
|
|
<%= link_to admin_teacher_deactivation_path(@teacher),
|
|
data: { turbo_method: :post, turbo_confirm: "Are you sure you want to deactivate this teacher?" },
|
|
class: "inline-flex items-center px-4 py-2 border border-red-300 shadow-sm text-sm font-medium rounded-md text-red-700 bg-white hover:bg-red-50" do %>
|
|
<i class="fas fa-trash -ml-1 mr-2 h-5 w-5 text-red-500"></i>
|
|
Deactivate
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= admin_show_attributes(
|
|
@teacher,
|
|
attributes: %i[id username email name created_at updated_at]
|
|
) %>
|
|
|
|
<!-- Associated Classrooms -->
|
|
<% if @teacher.classrooms.any? %>
|
|
<div class="mt-6 pt-6 border-t border-gray-200">
|
|
<h3 class="text-sm font-medium text-gray-500 mb-3">Classrooms</h3>
|
|
<ul class="space-y-2">
|
|
<% @teacher.classrooms.each do |classroom| %>
|
|
<li class="text-sm text-gray-900">
|
|
<%= classroom.name %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% else %>
|
|
<div class="mt-6 pt-6 border-t border-gray-200">
|
|
<p class="text-sm text-gray-500">No classrooms assigned to this teacher yet.</p>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex gap-3">
|
|
<%= link_to "Back to Teachers", admin_teachers_path,
|
|
class: "inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" %>
|
|
</div>
|
|
</div>
|