Add Toggl data to attendances, fix attendance creation for past lectures. Change styling a little.

This commit is contained in:
2023-10-02 16:19:37 +01:00
parent 2530ee629a
commit 9a5116f29e
7 changed files with 43 additions and 23 deletions
+22 -12
View File
@@ -27,7 +27,8 @@
<% lectures.each do |lecture| %>
<tr class="<%= class_names({
'lecture-future': lecture.start_time.future?,
'lecture-cancelled': lecture.cancelled,
'bg-slate-200': lecture.cancelled,
'bg-green-100': lecture.attendance.present?,
}) %>">
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
<%= lecture.title %>
@@ -36,23 +37,32 @@
<%= lecture.start_time.to_fs(:dmy) %>
</td>
<% if lecture.start_time.future? || lecture.cancelled %>
<% if lecture.cancelled %>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500" colspan="2">
<div class="flex justify-center">
Cancelled
</div>
</td>
<% elsif lecture.start_time.future? %>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
</td>
<% else %>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<% if lecture.attendance.nil? %>
<i class="fa fa-times text-red-700"></i>
<% elsif lecture.attendance.kind == 'concurrent' %>
<i class="fa fa-chalkboard-user fa-green-700"></i>
<% elsif lecture.attendance.kind == 'catchup' %>
<i class="fa fa-video fa-green-700"></i>
<% else %>
<% lecture.attendance.kind %>
<% end %>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500 flex justify-center">
<div>
<% if lecture.attendance.nil? %>
<i class="fa fa-times text-red-700"></i>
<% elsif lecture.attendance.kind == 'concurrent' %>
<i class="fa fa-chalkboard-user text-green-700"></i>
<% elsif lecture.attendance.kind == 'catchup' %>
<i class="fa fa-video text-green-700"></i>
<% else %>
<% lecture.attendance.kind %>
<% end %>
</div>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">