From 52b044d6a4278c229992404ad5801769c2d13363 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 24 Aug 2025 20:29:54 +0200 Subject: First commit. Vive le Castel Peter ! --- app/views/dashboard/_raft_allocation.html.erb | 9 +++++ app/views/dashboard/_recent_measurements.html.erb | 22 +++++++++++++ app/views/dashboard/_target_table.html.erb | 40 +++++++++++++++++++++++ app/views/dashboard/index.html.erb | 7 ++++ 4 files changed, 78 insertions(+) create mode 100644 app/views/dashboard/_raft_allocation.html.erb create mode 100644 app/views/dashboard/_recent_measurements.html.erb create mode 100644 app/views/dashboard/_target_table.html.erb create mode 100644 app/views/dashboard/index.html.erb (limited to 'app/views/dashboard') diff --git a/app/views/dashboard/_raft_allocation.html.erb b/app/views/dashboard/_raft_allocation.html.erb new file mode 100644 index 0000000..ef95cdd --- /dev/null +++ b/app/views/dashboard/_raft_allocation.html.erb @@ -0,0 +1,9 @@ +
+
+
Raft Allocation
+ <%= link_to "Edit raft allocation", editor_rafts_path, class: "btn btn-sm btn-primary" %> +
+ + <%= bar_chart @raft_data, stacked: true %> +
+ diff --git a/app/views/dashboard/_recent_measurements.html.erb b/app/views/dashboard/_recent_measurements.html.erb new file mode 100644 index 0000000..bc63a60 --- /dev/null +++ b/app/views/dashboard/_recent_measurements.html.erb @@ -0,0 +1,22 @@ +
+
+
Nutrient Measurements
+
+ <%#= link_to "Add new measurement", editor_rafts_path, class: "btn btn-sm btn-primary" %> + <%#= link_to "View all", editor_rafts_path, class: "btn btn-sm btn-secondary" %> +
+
+ +
+
+ <%= line_chart @npk_measurement_data, + title: "NPK", + ytitle: "Concentration (mg/L)" %> +
+
+ <%= line_chart @ammonium_measurement_data, + title: "Ammonium", + ytitle: "Concentration (mg/L)" %> +
+
+
diff --git a/app/views/dashboard/_target_table.html.erb b/app/views/dashboard/_target_table.html.erb new file mode 100644 index 0000000..b8f7e66 --- /dev/null +++ b/app/views/dashboard/_target_table.html.erb @@ -0,0 +1,40 @@ +
+
+
Target nutrient concentrations
+ <%= link_to "Get Ferti© recipe", ferti_recipe_path, class: "btn btn-sm btn-primary" %> +
+ +
+ + + + + + + + + + + <% NutrientsHelper::NUTRIENTS.each do |n| %> + <% latest = @latest_measurement[n] || 0 %> + <% target = @target[n] || 0 %> + <% delta = target - latest %> + + + + + + + <% end %> + +
Nutrient Latest (mg/L) + Target (mg/L)Δ %
<%= n.upcase %><%= fmt(latest) %><%= fmt(target) %> + + <%= fmt(delta) %>% + +
+
+ +
diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb new file mode 100644 index 0000000..2902ada --- /dev/null +++ b/app/views/dashboard/index.html.erb @@ -0,0 +1,7 @@ +

Ferti

+ +<%= render "raft_allocation" %> + +<%= render "target_table" %> + +<%= render "recent_measurements" %> -- cgit v1.2.3