From 7116826b854188604e21e2a613ac6672b6fd81f3 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Mon, 8 Sep 2025 21:21:56 +0200 Subject: Create Target and nutrient target table on dashboard. --- app/views/targets/new.html.erb | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 app/views/targets/new.html.erb (limited to 'app/views/targets/new.html.erb') diff --git a/app/views/targets/new.html.erb b/app/views/targets/new.html.erb new file mode 100644 index 0000000..42cb7bd --- /dev/null +++ b/app/views/targets/new.html.erb @@ -0,0 +1,85 @@ +<% content_for :title, "Ajouter une Cible" %> + +

Ajouter une Cible

+ +<%= form_with(model: @target) do |f| %> +
+
+ <%= f.text_field :name, class: "form-control", placeholder: "Nom de la cible" %> +
+ +
+
+ + + + + + + + + <%= f.fields_for :target_allocations do |af| %> + <% np = af.object.nutrient_profile %> + + + + + <% end %> + + + + + + + +
ProfilProportion
+ <%= af.hidden_field :nutrient_profile_id %> + <%= np&.name.capitalize || "Profil ##{af.object.nutrient_profile_id}" %> + +
+ <%= af.number_field :percentage, + in: 0..100, step: 0.5, + class: "form-control text-end alloc-input", + placeholder: "0.0", + data: { action: "input->alloc#sum" } %> + % +
+
Ajustez chaque pourcentage pour totaliser 100%. + Total : 0% +
+
+
+ + +
+<% end %> + + -- cgit v1.2.3