From fa77a691ce0cc8941fe470a762f352b27f4f0563 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 23 Nov 2025 17:54:45 +0100 Subject: Last commit. --- app/views/targets/index.html.erb | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'app/views/targets/index.html.erb') diff --git a/app/views/targets/index.html.erb b/app/views/targets/index.html.erb index b552038..e536deb 100644 --- a/app/views/targets/index.html.erb +++ b/app/views/targets/index.html.erb @@ -5,31 +5,29 @@
- +
- - - - + + <% if @targets.present? %> - <% @targets.each do |t| %> - <% sum_pct = t.target_allocations.sum { |a| a.percentage.to_f } %> + <% @targets.each do |target| %> + <% sum_pct = target.allocations.sum { |a| a.percentage.to_f } %> <% badge_class = (sum_pct - 100.0).abs <= 0.01 ? "bg-success" : "bg-danger" %> - - <% end %> -- cgit v1.2.3
NomRépartition
Total %Créé leActionsRépartitionDate de Création
- <%= link_to t.name.presence || "Objectif ##{t.id}", t %> + <%= link_to target.name.presence || "Cible ##{t.id}", target %> - <% if t.target_allocations.empty? %> + <% if target.allocations.empty? %> Aucune répartition définie <% else %> -
    - <% t.target_allocations.each do |a| %> +
      + <% target.allocations.each do |a| %>
    • <%= a.nutrient_profile&.name || "Profil ##{a.nutrient_profile_id}" %> — <%= number_with_precision(a.percentage.to_f, precision: 2) %>% @@ -38,20 +36,8 @@
    <% end %>
- - <%= number_with_precision(sum_pct, precision: 2) %>% - - - <%= l(t.created_at, format: :short) %> - - <%= link_to "Voir", t, class: "btn btn-outline-secondary btn-sm" %> - <%= link_to "Modifier", edit_target_path(t), class: "btn btn-outline-primary btn-sm" %> - <%# FIXME: Doesn't work. %> - <%= link_to "Supprimer", t, class: "btn btn-outline-danger btn-sm", - data: { turbo_method: :delete, turbo_confirm: "Supprimer cet objectif ?" } %> + <%= l(target.created_at, format: :short) %>