summaryrefslogtreecommitdiff
path: root/app/views/nutrient_measurements/index.html.erb
blob: c01d0cc8bfcadbe91ee82486c13cb9754edf742f (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
41
<% content_for :title, "Liste des Relevé" %>

<h1 class="display-1">Liste des Relevés</h1>

<div class="d-flex justify-content-between align-items-center mb-3">
    <div class="btn-group">
	<%= link_to "Nouvelle mesure", new_nutrient_measurement_path, class: "btn btn-primary" %>
	<%= link_to "Retour", root_path, class: "btn btn-outline-secondary" %>
    </div>
</div>

<div class="table-responsive">
    <table class="table table-sm table-striped table-hover align-middle table-nutrient mb-0">
	<thead class="table-light">
	    <tr>
		<th>Date</th>
		<th class="text-end" title="Total N = NO₃-N + NH₄-N">N (total)</th>
		<th class="text-end">P</th>
		<th class="text-end">K</th>
		<th class="text-end" title="Ammonia nitrogen">NH₄-N</th>
	    </tr>
	</thead>
	<tbody>
	    <% @nutrient_measurements.each do |m| %>
		<tr>
		    <td><%= l(m.measured_on) %></td>
		    <td class="text-end">
			<%= number_with_precision(m.nno3.to_f + m.nnh4.to_f, precision: 2) if m.nno3 || m.nnh4 %>
		    </td>
		    <td class="text-end"><%= number_with_precision(m.p, precision: 2) if m.p %></td>
		    <td class="text-end"><%= number_with_precision(m.k, precision: 2) if m.k %></td>
		    <td class="text-end"><%= number_with_precision(m.nnh4, precision: 2) if m.nnh4 %></td>
		</tr>
	    <% end %>
	</tbody>
    </table>
</div>

<%= line_chart @npk_measurement_data,
               title: "NPK",
               ytitle: "Concentration (mg/L)" %>
Copyright 2019--2025 Marius PETER