diff options
Diffstat (limited to 'app/views/recipes/_table.html.erb')
-rw-r--r-- | app/views/recipes/_table.html.erb | 32 |
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> |