chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<%= form_with model: @teacher, url: @teacher.persisted? ? admin_teacher_path(@teacher) : admin_teachers_path, builder: Admin::FormBuilder, class: "space-y-6" do |f| %>
|
||||
<div class="bg-white shadow-sm ring-1 ring-gray-900/5 rounded-lg">
|
||||
<div class="px-6 py-6">
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-6">Teacher Details</h3>
|
||||
|
||||
<%= f.text_field :email,
|
||||
label: "Email",
|
||||
hint: "Also used as the teacher's login username",
|
||||
placeholder: "teacher@example.com" %>
|
||||
|
||||
<%= f.text_field :name,
|
||||
label: "Full Name",
|
||||
hint: "Teacher's full name",
|
||||
placeholder: "John Doe" %>
|
||||
|
||||
<div data-controller="form-filter" data-form-filter-frame-id-value="teacher_classroom_selection">
|
||||
<%= f.select :school_id,
|
||||
options_from_collection_for_select(@schools, :id, :name, @selected_school_id),
|
||||
{ label: "School Filter", hint: "Select a school to filter the classroom list", include_blank: "All Schools" },
|
||||
{ name: "school_id", data: { action: "change->form-filter#change" } } %>
|
||||
</div>
|
||||
|
||||
<%= turbo_frame_tag "teacher_classroom_selection", class: "block mb-6" do %>
|
||||
<% if @classrooms.any? %>
|
||||
<%= f.collection_check_boxes :classroom_ids,
|
||||
@classrooms,
|
||||
:id,
|
||||
:name,
|
||||
label: "Classrooms",
|
||||
hint: "Select one or more classrooms to assign to this teacher",
|
||||
wrapper_class: "mb-0" %>
|
||||
<% else %>
|
||||
<div class="mb-6">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Classrooms</label>
|
||||
<div class="bg-yellow-50 border border-yellow-200 rounded-md p-4">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-5 w-5 text-yellow-400" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<h3 class="text-sm font-medium text-yellow-800">No Classrooms Available</h3>
|
||||
<p class="text-sm text-yellow-700 mt-1">
|
||||
No Classrooms associated with this school and active year, please
|
||||
<%= link_to "update classrooms", admin_classrooms_path, class: "font-medium underline text-yellow-700 hover:text-yellow-600" %>
|
||||
so they will show up here.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @teacher.new_record? %>
|
||||
<div class="mt-6 pt-6 border-t border-gray-200">
|
||||
<p class="text-sm text-gray-600">
|
||||
<i class="fas fa-info-circle mr-1"></i>
|
||||
A temporary password will be generated and a password reset email will be sent to the teacher's email address.
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between gap-x-4">
|
||||
<div class="flex items-center gap-x-4">
|
||||
<%= f.cancel_button "Cancel", url: @teacher.persisted? ? admin_teacher_path(@teacher) : admin_teachers_path %>
|
||||
<%= f.submit_button @teacher.persisted? ? "Update Teacher" : "Create Teacher" %>
|
||||
</div>
|
||||
<% if @teacher.discarded? %>
|
||||
<%= link_to "Permanently Delete",
|
||||
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 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="max-w-7xl mx-auto">
|
||||
<%= admin_breadcrumbs(@breadcrumbs) %>
|
||||
|
||||
<h1 class="text-3xl font-bold text-gray-900 mb-8">Edit Teacher</h1>
|
||||
|
||||
<%= render "form", teacher: @teacher %>
|
||||
</div>
|
||||
@@ -0,0 +1,114 @@
|
||||
<div class="max-w-7xl mx-auto">
|
||||
<%= admin_breadcrumbs(@breadcrumbs) %>
|
||||
|
||||
<div class="bg-white shadow-sm ring-1 ring-gray-900/5 rounded-lg overflow-hidden">
|
||||
<div class="px-4 py-5 sm:px-6 border-b border-gray-200">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h3 class="text-lg font-semibold text-gray-900">Teachers</h3>
|
||||
<div class="flex gap-2">
|
||||
<%= link_to "New Teacher", new_admin_teacher_path,
|
||||
class: "inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filter Tabs -->
|
||||
<% current_filter = current_discard_filter %>
|
||||
<div class="flex gap-1 border-b border-gray-200">
|
||||
<%= link_to "Active",
|
||||
admin_teachers_path,
|
||||
class: "px-4 py-2 text-sm font-medium #{current_filter == :active ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700 hover:border-gray-300'}" %>
|
||||
<%= link_to "Deactivated",
|
||||
admin_teachers_path(discarded: true),
|
||||
class: "px-4 py-2 text-sm font-medium #{current_filter == :discarded ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700 hover:border-gray-300'}" %>
|
||||
<%= link_to "All",
|
||||
admin_teachers_path(all: true),
|
||||
class: "px-4 py-2 text-sm font-medium #{current_filter == :all ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700 hover:border-gray-300'}" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-gray-300">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
|
||||
<%= sort_link(:id, "ID") %>
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
|
||||
<%= sort_link(:username, "Username") %>
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
|
||||
<%= sort_link(:email, "Email") %>
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
|
||||
<%= sort_link(:name, "Name") %>
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
|
||||
<%= sort_link(:created_at, "Created At") %>
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
|
||||
Status
|
||||
</th>
|
||||
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
|
||||
<span class="sr-only">Actions</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
<% if @teachers.any? %>
|
||||
<% @teachers.each do |teacher| %>
|
||||
<tr id="<%= dom_id(teacher) %>" class="hover:bg-gray-50 transition-colors">
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= teacher.id %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= teacher.username %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= teacher.email %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= teacher.name %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= teacher.created_at.strftime("%B %d, %Y") %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||
<div class="flex justify-end gap-2">
|
||||
<%= link_to "View", admin_teacher_path(teacher), class: "text-blue-600 hover:text-blue-800" %>
|
||||
<%= link_to "Edit", edit_admin_teacher_path(teacher), class: "text-gray-600 hover:text-gray-800" %>
|
||||
<% if teacher.discarded? %>
|
||||
<%= link_to "Reactivate", admin_teacher_reactivation_path(teacher),
|
||||
data: { turbo_method: :post, turbo_confirm: "Are you sure you want to reactivate this teacher?" },
|
||||
class: "text-green-600 hover:text-green-800" %>
|
||||
<% else %>
|
||||
<%= link_to "Deactivate", admin_teacher_deactivation_path(teacher),
|
||||
data: { turbo_method: :post, turbo_confirm: "Are you sure you want to deactivate this teacher?" },
|
||||
class: "text-red-600 hover:text-red-800" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr>
|
||||
<td colspan="7" class="px-3 py-12 text-center text-sm text-gray-500">
|
||||
<div class="flex flex-col items-center">
|
||||
<i class="fas fa-inbox text-4xl text-gray-300 mb-3"></i>
|
||||
<p class="font-medium">No records found</p>
|
||||
<p class="text-gray-400 mt-1">No teachers found. Create your first teacher to get started.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="max-w-7xl mx-auto">
|
||||
<%= admin_breadcrumbs(@breadcrumbs) %>
|
||||
|
||||
<h1 class="text-3xl font-bold text-gray-900 mb-8">New Teacher</h1>
|
||||
|
||||
<%= render "form", teacher: @teacher %>
|
||||
</div>
|
||||
@@ -0,0 +1,74 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user