chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<%= form_with model: @student, url: @student.persisted? ? admin_student_path(@student) : admin_students_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">Student Details</h3>
|
||||
|
||||
<%= f.text_field :username,
|
||||
label: "Username",
|
||||
hint: "Unique username for the student",
|
||||
placeholder: "johndoe" %>
|
||||
|
||||
<%= f.select :classroom_id,
|
||||
options_from_collection_for_select(
|
||||
Classroom.order(:name),
|
||||
:id,
|
||||
:name,
|
||||
@student.classroom_id
|
||||
),
|
||||
label: "Classroom",
|
||||
hint: "Classroom assignment (required)",
|
||||
include_blank: "Select a classroom" %>
|
||||
|
||||
<% if @student.new_record? %>
|
||||
<div class="mt-6 pt-6 border-t border-gray-200">
|
||||
<h4 class="text-md font-medium text-gray-900 mb-4">Password</h4>
|
||||
<p class="text-sm text-gray-500 mb-4">Leave blank to generate a random password automatically</p>
|
||||
|
||||
<%= f.password_field :password,
|
||||
label: "Password (Optional)",
|
||||
hint: "Minimum 6 characters, or leave blank to auto-generate",
|
||||
placeholder: "••••••••" %>
|
||||
|
||||
<%= f.password_field :password_confirmation,
|
||||
label: "Password Confirmation",
|
||||
hint: "Re-enter password to confirm",
|
||||
placeholder: "••••••••" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-x-4">
|
||||
<%= f.cancel_button "Cancel", url: @student.persisted? ? admin_student_path(@student) : admin_students_path %>
|
||||
<%= f.submit_button @student.persisted? ? "Update Student" : "Create Student" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @student.persisted? %>
|
||||
<%= form_with url: add_transaction_admin_student_path(@student), method: :post, builder: Admin::FormBuilder, class: "space-y-6 mt-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">Add Portfolio Transaction</h3>
|
||||
|
||||
<!-- Current Cash Balance (Read-only) -->
|
||||
<div class="mb-6">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Current Cash Balance</label>
|
||||
<div class="text-lg font-semibold text-gray-900">
|
||||
<%= number_to_currency(@student.portfolio&.cash_balance || 0) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.select :transaction_type,
|
||||
[["", ""], ["Deposit", "deposit"], ["Debit", "debit"]],
|
||||
label: "Transaction Type",
|
||||
hint: "Select deposit to add funds or debit to remove funds",
|
||||
include_blank: false %>
|
||||
|
||||
<%= f.number_field :add_fund_amount,
|
||||
label: "Amount",
|
||||
hint: "Transaction amount in dollars",
|
||||
placeholder: "0.00",
|
||||
step: "0.01" %>
|
||||
|
||||
<%= f.select :transaction_reason,
|
||||
PortfolioTransaction.reasons.keys.map { |key| [PortfolioTransaction.human_attribute_name("reason.#{key}"), key] },
|
||||
label: "Reason",
|
||||
hint: "Reason for this transaction",
|
||||
include_blank: "Select a reason" %>
|
||||
|
||||
<%= f.text_area :transaction_description,
|
||||
label: "Description (Optional)",
|
||||
hint: "Additional details about this transaction",
|
||||
placeholder: "Enter transaction details...",
|
||||
rows: 3 %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-x-4">
|
||||
<%= f.submit_button "Add Transaction" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% 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 Student</h1>
|
||||
|
||||
<%= render "form", student: @student %>
|
||||
</div>
|
||||
@@ -0,0 +1,144 @@
|
||||
<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">Students</h3>
|
||||
<div class="flex gap-2">
|
||||
<%= link_to "Template", template_admin_students_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" %>
|
||||
<%= link_to "Import Students", "#",
|
||||
onclick: "document.getElementById('import-modal').classList.remove('hidden'); return false;",
|
||||
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" %>
|
||||
<%= link_to "New Student", new_admin_student_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_students_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 "Archived",
|
||||
admin_students_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_students_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">
|
||||
Classroom
|
||||
</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="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 @students.any? %>
|
||||
<% @students.each do |student| %>
|
||||
<tr class="hover:bg-gray-50 transition-colors cursor-pointer"
|
||||
data-controller="clickable-row"
|
||||
data-clickable-row-url-value="<%= admin_student_path(student) %>"
|
||||
data-action="click->clickable-row#navigate">
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= student.id %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= student.username %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= student.classroom.name %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
|
||||
<%= student.created_at.strftime("%B %d, %Y") %>
|
||||
</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_student_path(student), class: "text-blue-600 hover:text-blue-800" %>
|
||||
<% unless student.discarded? %>
|
||||
<%= link_to "Edit", edit_admin_student_path(student), class: "text-gray-600 hover:text-gray-800" %>
|
||||
<% end %>
|
||||
<%= discard_restore_action(student) %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr>
|
||||
<td colspan="5" 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 students found. Create your first student to get started.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Import Modal -->
|
||||
<div id="import-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
||||
<!-- Background overlay -->
|
||||
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" onclick="document.getElementById('import-modal').classList.add('hidden');"></div>
|
||||
|
||||
<!-- Modal content -->
|
||||
<div class="relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 z-50">
|
||||
<div class="px-6 py-4">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h3 class="text-lg font-medium text-gray-900" id="modal-title">
|
||||
Import Students from CSV
|
||||
</h3>
|
||||
<button type="button" class="text-gray-400 hover:text-gray-500" onclick="document.getElementById('import-modal').classList.add('hidden');">
|
||||
<span class="sr-only">Close</span>
|
||||
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="text-sm text-gray-500 mb-4">
|
||||
Upload a CSV file with columns: <strong>classroom_id, username</strong>
|
||||
</p>
|
||||
|
||||
<%= form_with url: import_admin_students_path, multipart: true, local: true do |form| %>
|
||||
<div class="mb-4">
|
||||
<%= form.file_field :csv_file,
|
||||
accept: ".csv",
|
||||
class: "block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 focus:outline-none p-2" %>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button type="button"
|
||||
onclick="document.getElementById('import-modal').classList.add('hidden');"
|
||||
class="inline-flex justify-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
Cancel
|
||||
</button>
|
||||
<%= form.submit "Import Students",
|
||||
class: "inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</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 Student</h1>
|
||||
|
||||
<%= render "form", student: @student %>
|
||||
</div>
|
||||
@@ -0,0 +1,210 @@
|
||||
<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">
|
||||
<h2 class="text-2xl font-bold text-gray-900"><%= @student.username %></h2>
|
||||
<div class="flex gap-3">
|
||||
<%= link_to edit_admin_student_path(@student),
|
||||
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 %>
|
||||
<%= link_to admin_student_path(@student),
|
||||
data: { turbo_method: :delete, turbo_confirm: "Are you sure you want to archive this student?" },
|
||||
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-box-archive -ml-1 mr-2 h-5 w-5 text-red-500"></i>
|
||||
Archive
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<dl class="divide-y divide-gray-200">
|
||||
<div class="py-4 sm:grid sm:grid-cols-3 sm:gap-4">
|
||||
<dt class="text-sm font-medium text-gray-500">Id</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"><%= @student.id %></dd>
|
||||
</div>
|
||||
<div class="py-4 sm:grid sm:grid-cols-3 sm:gap-4">
|
||||
<dt class="text-sm font-medium text-gray-500">Username</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"><%= @student.username %></dd>
|
||||
</div>
|
||||
<div class="py-4 sm:grid sm:grid-cols-3 sm:gap-4">
|
||||
<dt class="text-sm font-medium text-gray-500">Classroom</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"><%= @student.classroom.name %></dd>
|
||||
</div>
|
||||
<div class="py-4 sm:grid sm:grid-cols-3 sm:gap-4">
|
||||
<dt class="text-sm font-medium text-gray-500">Created at</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"><%= @student.created_at.strftime("%B %d, %Y") %></dd>
|
||||
</div>
|
||||
<div class="py-4 sm:grid sm:grid-cols-3 sm:gap-4">
|
||||
<dt class="text-sm font-medium text-gray-500">Updated at</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"><%= @student.updated_at.strftime("%B %d, %Y") %></dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Associated Portfolio -->
|
||||
<% if @student.portfolio.present? %>
|
||||
<div class="mt-6 pt-6 border-t border-gray-200">
|
||||
<h3 class="text-sm font-medium text-gray-500 mb-3">Portfolio Details</h3>
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
|
||||
<div class="bg-blue-50 p-4 rounded-lg">
|
||||
<div class="text-xs font-medium text-blue-600 mb-1" data-testid="cash_balance_label">
|
||||
Cash Balance
|
||||
</div>
|
||||
<div class="text-2xl font-bold text-blue-900"><%= number_to_currency(@student.portfolio.cash_balance) %></div>
|
||||
</div>
|
||||
<div class="bg-green-50 p-4 rounded-lg">
|
||||
<div class="text-xs font-medium text-green-600 mb-1" data-testid="total_portfolio_worth_label">
|
||||
Total Portfolio Worth
|
||||
</div>
|
||||
<div class="text-2xl font-bold text-green-900"><%= number_to_currency(@student.portfolio.total_portfolio_worth) %></div>
|
||||
</div>
|
||||
<div class="bg-purple-50 p-4 rounded-lg">
|
||||
<div class="text-xs font-medium text-purple-600 mb-1">Total Stocks</div>
|
||||
<div class="text-2xl font-bold text-purple-900"><%= @student.portfolio.portfolio_stocks.sum(:shares).to_i %></div>
|
||||
</div>
|
||||
<%= link_to portfolio_path(@student.portfolio), class: "bg-gray-50 p-4 rounded-lg block hover:bg-gray-100 transition-colors" do %>
|
||||
<div class="text-xs font-medium text-gray-600 mb-1">Portfolio ID</div>
|
||||
<div class="text-2xl font-bold text-gray-900">#<%= @student.portfolio.id %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Earnings Summary -->
|
||||
<h4 class="text-sm font-medium text-gray-700 mb-3">Earnings Summary</h4>
|
||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg mb-6">
|
||||
<table class="min-w-full divide-y divide-gray-300">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 uppercase">Category</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-500 uppercase">Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
<tr>
|
||||
<td class="px-3 py-2 text-sm text-gray-900">Attendance Earnings</td>
|
||||
<td class="px-3 py-2 text-sm text-right font-medium text-gray-900"><%= number_to_currency(@earnings_summary.attendance_earnings_cents / 100.0) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-3 py-2 text-sm text-gray-900">Math Earnings</td>
|
||||
<td class="px-3 py-2 text-sm text-right font-medium text-gray-900"><%= number_to_currency(@earnings_summary.math_earnings_cents / 100.0) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-3 py-2 text-sm text-gray-900">Rewards</td>
|
||||
<td class="px-3 py-2 text-sm text-right font-medium text-gray-900"><%= number_to_currency(@earnings_summary.awards_cents / 100.0) %></td>
|
||||
</tr>
|
||||
<tr class="bg-green-50">
|
||||
<td class="px-3 py-2 text-sm font-semibold text-gray-900">Total Earnings</td>
|
||||
<td class="px-3 py-2 text-sm text-right font-bold text-gray-900"><%= number_to_currency(@earnings_summary.total_earnings_cents / 100.0) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-3 py-2 text-sm font-medium text-red-600">Transaction Fees</td>
|
||||
<td class="px-3 py-2 text-sm text-right font-medium text-red-600"><%= number_to_currency(@earnings_summary.transaction_fees_cents / 100.0) %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Transactions -->
|
||||
<% transactions = @student.portfolio.portfolio_transactions.order(created_at: :desc) %>
|
||||
<% if transactions.any? %>
|
||||
<h4 class="text-sm font-medium text-gray-700 mb-3">All Transactions (<%= transactions.count %>)</h4>
|
||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg mb-4">
|
||||
<table class="min-w-full divide-y divide-gray-300">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 uppercase">Date</th>
|
||||
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 uppercase">Type</th>
|
||||
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 uppercase">Reason</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-500 uppercase">Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
<% transactions.each do |transaction| %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap px-3 py-2 text-sm text-gray-900">
|
||||
<%= transaction.created_at.strftime("%m/%d/%Y") %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-2 text-sm">
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium <%= transaction.transaction_type == 'deposit' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' %>">
|
||||
<%= transaction.transaction_type.capitalize %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-3 py-2 text-sm text-gray-900">
|
||||
<%= transaction.reason&.humanize || 'N/A' %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-2 text-sm text-right font-medium text-gray-900">
|
||||
<%= number_to_currency(transaction.amount_cents / 100.0) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="text-sm text-gray-500 mb-4">No transactions yet.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="mt-6 pt-6 border-t border-gray-200">
|
||||
<p class="text-sm text-gray-500">No portfolio associated with this student.</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Attendance -->
|
||||
<div class="bg-white shadow-sm ring-1 ring-gray-900/5 rounded-lg mb-6">
|
||||
<div class="px-6 py-6">
|
||||
<h3 class="text-sm font-medium text-gray-500 mb-3">Attendance</h3>
|
||||
<% if @attendance_entries.any? %>
|
||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg">
|
||||
<table class="min-w-full divide-y divide-gray-300">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 uppercase">Year</th>
|
||||
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 uppercase">Quarter</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-500 uppercase">Attendance Days</th>
|
||||
<th class="px-3 py-3 text-center text-xs font-medium text-gray-500 uppercase">Perfect Attendance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
<% @attendance_entries.each do |entry| %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap px-3 py-2 text-sm text-gray-900">
|
||||
<%= entry.year_name %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-2 text-sm text-gray-900">
|
||||
<%= entry.quarter_name %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-2 text-sm text-right text-gray-900">
|
||||
<%= entry.attendance_days_display %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-2 text-sm text-center">
|
||||
<% if entry.perfect_attendance? %>
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">Yes</span>
|
||||
<% else %>
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600">No</span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="text-sm text-gray-500">No attendance records found.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-3">
|
||||
<%= link_to "Back to Students", admin_students_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