Add today basic view
All checks were successful
Build and Publish Docker Container / build (push) Successful in 5m59s
All checks were successful
Build and Publish Docker Container / build (push) Successful in 5m59s
This commit is contained in:
parent
c65136e8b3
commit
cdd8c963ca
63
app/views/attendance_tracker/today.html.erb
Normal file
63
app/views/attendance_tracker/today.html.erb
Normal file
@ -0,0 +1,63 @@
|
||||
<h1 class="text-3xl font-medium">Attendance Tracker</h1>
|
||||
|
||||
<div class="px-4 sm:px-6 lg:px-8 flex flex-col lg:flex-row gap-4">
|
||||
<% @courses.each do |course| %>
|
||||
<div class="mt-8 flow-root">
|
||||
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
||||
<div class="inline-block py-2 align-middle px-6 lg:px-8">
|
||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg">
|
||||
<div class="flex flex-row justify-between items-center px-4 p-2">
|
||||
<h2 class="text-2xl">
|
||||
<%= course.title %>
|
||||
</h2>
|
||||
|
||||
<% if course.homepage.present? %>
|
||||
<a class="align-middle" href="<%= course.homepage %>">
|
||||
<i class="fa fa-link text-blue-600"></i>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<table class="border-t-2 divide-y divide-gray-300 w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Lecture</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Date</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="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Action</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
<% course.lectures_and_work_items.group_by { |lecture| lecture.week_number }.each do |(week_number, lectures)| %>
|
||||
<tr class="border-t border-gray-200">
|
||||
<th colspan="5" scope="colgroup" class="bg-gray-50 py-2 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
<div class="flex flex-row justify-between">
|
||||
<div class="">
|
||||
Week <%= week_number %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<% total_for_week = lectures.sum { |lecture| lecture.total_overall_time }.seconds %>
|
||||
<%# TODO: Improve this figure, atm it is for lectures in week, not time spent in week (ie
|
||||
prepping for lecture next week will count in next week not current week) %>
|
||||
<% if total_for_week > 0 %>
|
||||
(Total <%= humanise_duration(lectures.sum { |lecture| lecture.total_overall_time }.seconds) %>
|
||||
)
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<%= render lectures %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user