Browse Source

fix display

main
Christoph Marzell 1 month ago
parent
commit
3da2173b3a
  1. 26
      app/views/entries/monthly_report.html.erb

26
app/views/entries/monthly_report.html.erb

@ -1,9 +1,11 @@
<h1 class="mb-4 display-6">📆 Monats-Report</h1>
<% @report.each do |month, groups| %> <% @report.each do |month, groups| %>
<% is_current_month = month.month == Date.today.month && month.year == Date.today.year %> <% is_current_month = month.month == Date.today.month && month.year == Date.today.year %>
<div class="card shadow-sm mb-4 overflow-hidden <%= 'bg-light border-primary' if is_current_month %>" style="border-radius: .75rem;">
<% 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;"> <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> <strong><%= month.strftime("%B %Y") %></strong>
<% if is_current_month %> <% if is_current_month %>
@ -13,20 +15,27 @@
<div class="card-body p-0"> <div class="card-body p-0">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover table-bordered mb-0 text-center align-middle" style="border-radius: 0 !important;">
<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"> <thead class="table-light">
<tr> <tr>
<th style="width: 33%">📌 Typ</th>
<th style="width: 33%">📂 Art</th>
<th style="width: 33%">⏱️ Gesamtzeit</th>
<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> </tr>
</thead> </thead>
<tbody> <tbody>
<% groups.each do |(typ, art), data| %>
<% groups.each_with_index do |((typ, art), data), index| %>
<tr> <tr>
<td><%= typ.capitalize %></td> <td><%= typ.capitalize %></td>
<td><%= art %></td> <td><%= art %></td>
<td><%= data[:hours] %>h <%= data[:minutes] %>min</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> </tr>
<% end %> <% end %>
</tbody> </tbody>
@ -34,5 +43,4 @@
</div> </div>
</div> </div>
</div> </div>
<% end %> <% end %>
Loading…
Cancel
Save