summaryrefslogtreecommitdiff
path: root/app/views/recipes/_table.html.erb
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-08-24 20:29:54 +0200
committerMarius Peter <marius.peter@tutanota.com>2025-08-24 20:29:54 +0200
commit52b044d6a4278c229992404ad5801769c2d13363 (patch)
treeb30b34da58f26117c035391d09366b190350b1e3 /app/views/recipes/_table.html.erb
First commit.
Vive le Castel Peter !
Diffstat (limited to 'app/views/recipes/_table.html.erb')
-rw-r--r--app/views/recipes/_table.html.erb32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/views/recipes/_table.html.erb b/app/views/recipes/_table.html.erb
new file mode 100644
index 0000000..a42a0b9
--- /dev/null
+++ b/app/views/recipes/_table.html.erb
@@ -0,0 +1,32 @@
+<div class="table-responsive">
+ <table class="table table-sm align-middle mb-0">
+ <thead class="table-light">
+ <tr>
+ <th>Fertilizer product</th>
+ <th class="text-muted">Component</th>
+ <th class="text-end">Qty (kg)</th>
+ <th class="text-end">Per portion (kg)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% pcount = [[portions.to_i, 2].max, 10].min %>
+ <% recipe&.each do |component, kg| %>
+ <% prod_name = commercial_name_for(component) %>
+ <tr>
+ <td><strong><%= prod_name %></strong></td>
+ <td class="text-muted"><small><%= component.name %></small></td>
+ <td class="text-end fw-semibold"><%= fmt_kg(kg) %></td>
+ <td class="text-end"><%= fmt_kg(kg / pcount.to_f) %></td>
+ </tr>
+ <% end %>
+ <% if recipe.blank? %>
+ <tr><td colspan="4" class="text-center text-muted">No supplementation required.</td></tr>
+ <% end %>
+ </tbody>
+ </table>
+</div>
+
+<div class="card-footer small text-muted">
+ Volume: <%= number_with_delimiter(volume) %> L —
+ Portions: <%= pcount %>
+</div>
Copyright 2019--2025 Marius PETER