summaryrefslogtreecommitdiff
path: root/app/views/recipes/_table.html.erb
blob: a42a0b97181bbd31f518e03eed9c38a8342a9332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<div class="table-responsive">
    <table class="table table-sm align-middle mb-0">
	<thead class="table-light">
	    <tr>
		<th>Fertilizer product</th>
		<th class="text-muted">Component</th>
		<th class="text-end">Qty (kg)</th>
		<th class="text-end">Per portion (kg)</th>
	    </tr>
	</thead>
	<tbody>
	    <% pcount = [[portions.to_i, 2].max, 10].min %>
	    <% recipe&.each do |component, kg| %>
		<% prod_name = commercial_name_for(component) %>
		<tr>
		    <td><strong><%= prod_name %></strong></td>
		    <td class="text-muted"><small><%= component.name %></small></td>
		    <td class="text-end fw-semibold"><%= fmt_kg(kg) %></td>
		    <td class="text-end"><%= fmt_kg(kg / pcount.to_f) %></td>
		</tr>
	    <% end %>
	    <% if recipe.blank? %>
		<tr><td colspan="4" class="text-center text-muted">No supplementation required.</td></tr>
	    <% end %>
	</tbody>
    </table>
</div>

<div class="card-footer small text-muted">
    Volume: <%= number_with_delimiter(volume) %> L —
    Portions: <%= pcount %>
</div>
Copyright 2019--2025 Marius PETER