From 8ba568ae0ebe715b5da453681eb141886f1977a8 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Thu, 4 Sep 2025 20:55:03 +0200 Subject: Simpler, Better, Faster... Stronger Start small, address critical customer needs, /then/ scale. --- .../dashboard/_nutrient_profile_allocator.html.erb | 187 +++++++++++++++++++++ app/views/dashboard/_raft_allocation.html.erb | 2 +- app/views/dashboard/index.html.erb | 8 +- 3 files changed, 193 insertions(+), 4 deletions(-) create mode 100644 app/views/dashboard/_nutrient_profile_allocator.html.erb (limited to 'app/views/dashboard') diff --git a/app/views/dashboard/_nutrient_profile_allocator.html.erb b/app/views/dashboard/_nutrient_profile_allocator.html.erb new file mode 100644 index 0000000..d402ace --- /dev/null +++ b/app/views/dashboard/_nutrient_profile_allocator.html.erb @@ -0,0 +1,187 @@ +<%# Props: nutrient_profiles: ActiveRecord::Relation %> +<%# Fallback if controller didn't set @nutrient_profiles yet %> +<% profiles = (local_assigns[:nutrient_profiles] || []).presence || [] %> + +<%# We'll render a form purely for structure (no real submit yet) %> +<%= form_with url: "#", method: :post, local: true, html: { id: "np-mix-form", "data-controller": "np-mix" } do %> +
+
+ +
+
+ Choisissez des profils de croissance et répartissez-les pour totaliser 100%. +
+
+ Somme : 0% +
+
+ +
+ <%# Rows are injected by JS from the template below, including defaults %> +
+ +
+ + + <%# Placeholder "save" button for later backend wiring; disabled until total == 100 %> + +
+
+
+ + <%# --- Hidden template for a single row --- %> + + + <%# --- Defaults to inject on load --- %> + + + <%# --- Tiny inline JS to keep this self-contained (no Stimulus required) --- %> + + + +<% end %> diff --git a/app/views/dashboard/_raft_allocation.html.erb b/app/views/dashboard/_raft_allocation.html.erb index a2128ea..1c9ef9a 100644 --- a/app/views/dashboard/_raft_allocation.html.erb +++ b/app/views/dashboard/_raft_allocation.html.erb @@ -1,7 +1,7 @@
Crop Allocation
- <%= link_to "Edit allocation", beds_path, class: "btn btn-sm btn-primary" %> + <%#= link_to "Edit allocation", beds_path, class: "btn btn-sm btn-primary" %>
<%= bar_chart @raft_data, stacked: true %> diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index b1b2d87..b8f9145 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -1,7 +1,9 @@

Ferti

-<%= render "raft_allocation" %> +<%= render "nutrient_profile_allocator", nutrient_profiles: @nutrient_profiles %> -<%= render "target_table" %> +<%#= render "raft_allocation" %> -<%= render "nutrient_measurements" %> +<%#= render "target_table" %> + +<%#= render "nutrient_measurements" %> -- cgit v1.2.3