lecture-attendance-manager/app/views/work_items/_work_item.html.erb
Joshua Coles c8b688ce57
All checks were successful
Build and Publish Docker Container / build (push) Successful in 5m43s
Flesh out work items in the UI
2023-10-08 16:06:07 +01:00

59 lines
2.2 KiB
Plaintext

<tr class="<%= class_names({
'lecture-future': work_item.available_from.future?,
'bg-purple-200': work_item.workable?,
'bg-green-100': work_item.completed?,
}) %>">
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
<%= work_item.title %>
</td>
<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" data-controller="popover" data-action="mouseenter->popover#show mouseleave->popover#hide">
<div class="flex flex-row gap-2 justify-center">
<% if work_item.completed? %>
<i class="fa fa-check text-green-700"></i>
<% elsif work_item.started? %>
<i class="fa fa-play text-blue-700"></i>
<% else %>
<%# Symbol to show work has not started yet %>
<i class="fa fa-clock text-blue-gray-700"></i>
<% end %>
</div>
<template data-popover-target="content">
<% if work_item.started? %>
<div class="absolute p-1 w-max whitespace-normal break-words rounded-lg border border-blue-gray-50 bg-white text-blue-gray-500 shadow-lg shadow-blue-gray-500/10 focus:outline-none" data-popover-target="card">
<div>
Time spent: <%= humanise_duration(work_item.total_overall_time) %>
</div>
</div>
<% end %>
</template>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<% if work_item.workable? %>
<% start_label = if work_item.started? then
"Continue"
else
"Start"
end %>
<%= button_to start_label,
work_item_start_time_entry_path(work_item),
class: 'action-button'
%>
<% end %>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<% if work_item.started? && !work_item.completed? %>
<%= button_to "Complete",
work_item_complete_path(work_item),
class: 'action-button'
%>
<% end %>
</td>
</tr>