You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.9 KiB

<% @report.each do |month, groups| %>
<% is_current_month = month.month == Date.today.month && month.year == Date.today.year %>
<% total_minutes = groups.values.map { |data| (data[:hours].to_i * 60 + data[:minutes].to_i) }.sum %>
<% total_hours = total_minutes / 60 %>
<% total_rest_minutes = total_minutes % 60 %>
<div class="card shadow-sm mb-4 overflow-hidden <%= 'bg-light border-primary' if is_current_month %>" style="border-radius: 0.75rem;">
<div class="card-header d-flex justify-content-between align-items-center bg-white" style="border-bottom: 1px solid #dee2e6;">
<strong><%= month.strftime("%B %Y") %></strong>
<% if is_current_month %>
<span class="badge bg-primary" title="Aktueller Monat">🌟 Aktuell</span>
<% end %>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-bordered table-hover mb-0 text-center align-middle" style="margin-bottom: 0; border-radius: 0 !important;">
<thead class="table-light">
<tr>
<th style="width: 25%">📌 Typ</th>
<th style="width: 25%">📂 Art</th>
<th style="width: 25%">⏱️ Zeit</th>
<th style="width: 25%">🧮 Monats-Gesamt</th>
</tr>
</thead>
<tbody>
<% groups.each_with_index do |((typ, art), data), index| %>
<tr>
<td><%= typ.capitalize %></td>
<td><%= art %></td>
<td><%= data[:hours] %>h <%= data[:minutes] %>min</td>
<% if index == 0 %>
<td rowspan="<%= groups.size %>" class="align-middle bg-light text-dark fw-bold">
<span class="d-block"><%= total_hours %>h <%= total_rest_minutes %>min</span>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<% end %>