app/views/labware/_barcode_printing_form.html.erb
<%= form_for(print_job, namespace: print_job.object_id, html: { method: :post, class: 'form-inline'}) do |f| %>
<%= f.hidden_field :label_templates_by_service %>
<% labels.each do |label| %>
<!-- main label for this plate -->
<% label.attributes.each do |k, v|%>
<%= hidden_field_tag "#{f.object_name}[labels][][main_label][#{k}]", v %>
<%end%>
<!-- second label for 384-well plates -->
<% label.extra_attributes.each do |k, v|%>
<%= hidden_field_tag "#{f.object_name}[labels][][extra_label][#{k}]", v %>
<%end%>
<!-- additional labels (e.g. for additional labels on the same plate or for extra intermediate plates) -->
<% label.additional_label_definitions.each do |additional_labels|%>
<% additional_labels.each do |k, v|%>
<%= hidden_field_tag "#{f.object_name}[labels][][main_label][#{k}]", v %>
<%end%>
<%end%>
<!-- extra labels for QC plates -->
<% label.qc_label_definitions.each do |qc_label|%>
<% qc_label.each do |k, v|%>
<%= hidden_field_tag "#{f.object_name}[labels][][main_label][#{k}]", v %>
<%end%>
<%end%>
<% end %>
<% labels.each do |label| %>
<!-- this includes main label and extra label in one -->
<% label.sprint_attributes.each_with_index do |(k, v), index|%>
<%= hidden_field_tag "#{f.object_name}[labels_sprint][sprint][#{k}]", v %>
<%end%>
<!-- additional labels (e.g. for additional labels on the same plate or for extra intermediate plates) -->
<% label.additional_label_definitions.each_with_index do |additional_labels, index|%>
<% additional_labels.each do |k, v|%>
<%= hidden_field_tag "#{f.object_name}[labels_sprint][interm_#{index}][#{k}]", v %>
<%end%>
<%end%>
<!-- extra labels for QC plates in several pipelines -->
<% label.qc_label_definitions.each_with_index do |qc_label, index|%>
<% qc_label.each do |k, v|%>
<%= hidden_field_tag "#{f.object_name}[labels_sprint][qc_#{index}][#{k}]", v %>
<%end%>
<%end%>
<% end %>
<%= f.label :printer_name, 'Barcode Printer', class: 'col-2' %>
<!-- pass the whole printer object through here, if poss, (instead of :name) or just the id and then re-query the printer through API -->
<%= f.collection_select :printer_name, printers, :name, :name, {}, class: 'custom-select col-3' %>
<%= f.number_field :number_of_copies, min: 1, max: @presenter.printer_limit, step: 1, class: 'form-control col-2' %>
<%= f.submit 'Print Label', class: 'print-button btn btn-success col-3' %>
<% end %>