blob: b8f7e664fbe71cebc10106e9127a6885642109c3 (
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
33
34
35
36
37
38
39
40
|
<div class="card shadow mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">Target nutrient concentrations</h5>
<%= link_to "Get Ferti© recipe", ferti_recipe_path, class: "btn btn-sm btn-primary" %>
</div>
<div class="table-responsive">
<table class="table table-sm align-middle mb-0">
<thead class="table-light">
<tr>
<th scope="col" class="text-nowrap">Nutrient</th>
<th scope="col" class="text-end"> Latest (mg/L)
</th>
<th scope="col" class="text-end">Target (mg/L)</th>
<th scope="col" class="text-end">Δ %</th>
</tr>
</thead>
<tbody>
<% NutrientsHelper::NUTRIENTS.each do |n| %>
<% latest = @latest_measurement[n] || 0 %>
<% target = @target[n] || 0 %>
<% delta = target - latest %>
<tr>
<th scope="row" class="text-nowrap"><%= n.upcase %></th>
<td class="text-end"><%= fmt(latest) %></td>
<td class="text-end"><%= fmt(target) %></td>
<td class="text-end">
<span class="badge <%= delta_badge_class(delta) %>">
<%= fmt(delta) %>%
</span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="card-footer">
Latest measurement: <%= @latest_measurement.measured_on || "none yet" %>
</div>
</div>
|