From 075665c588989ed0decdfb20d83f32b33eed4639 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Fri, 29 Aug 2025 14:22:37 +0200 Subject: Properly implement bed and raft management logic. --- app/views/beds/index.html.erb | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 app/views/beds/index.html.erb (limited to 'app/views/beds/index.html.erb') diff --git a/app/views/beds/index.html.erb b/app/views/beds/index.html.erb new file mode 100644 index 0000000..e645dc5 --- /dev/null +++ b/app/views/beds/index.html.erb @@ -0,0 +1,54 @@ +<% content_for :title, "Crop Allocation" %> + +

Beds and Rafts

+ +<%= link_to "Back to dashboard", root_path, class: "btn btn-outline-secondary my-3" %> + + +

+ Click on a bed row or an individual raft to update the corresponding crop. +

+ +<%= form_with url: bulk_assign_crops_beds_path, + method: :patch, + local: true do %> +
+ + +
+<% end %> + +
+ + + + + <% max_cols = @beds.map { |b| b.rafts.count }.max %> + <% (1..max_cols).each do |i| %> + + <% end %> + + + + <% @beds.each do |bed| %> + + + <% bed.rafts.each do |raft| %> + + <% end %> + + <% end %> + +
BedR<%= i %>
<%= link_to bed.location, edit_bed_path(bed), class: "btn btn-outline-secondary" %> + <%= link_to (raft&.crop&.name || "—"), edit_raft_path(raft), class: "btn btn-sm" %> +
+
+ +<%= button_to "Reset crop allocation", reset_seed_crops_beds_path, + method: :post, + form: { data: { turbo: false } }, + class: "btn btn-outline-danger" %> -- cgit v1.2.3