summaryrefslogtreecommitdiff
path: root/app/views/nutrient_measurements/index.html.erb
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-09-08 21:21:56 +0200
committerMarius Peter <dev@marius-peter.com>2025-09-08 21:21:56 +0200
commit7116826b854188604e21e2a613ac6672b6fd81f3 (patch)
tree33150bf2e04e69b8e1fa7d37901d2643b1955534 /app/views/nutrient_measurements/index.html.erb
parent8ba568ae0ebe715b5da453681eb141886f1977a8 (diff)
Create Target and nutrient target table on dashboard.
Diffstat (limited to 'app/views/nutrient_measurements/index.html.erb')
-rw-r--r--app/views/nutrient_measurements/index.html.erb41
1 files changed, 41 insertions, 0 deletions
diff --git a/app/views/nutrient_measurements/index.html.erb b/app/views/nutrient_measurements/index.html.erb
new file mode 100644
index 0000000..c01d0cc
--- /dev/null
+++ b/app/views/nutrient_measurements/index.html.erb
@@ -0,0 +1,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