sanger/limber

View on GitHub
app/views/plates/_fail_wells.html.erb

Summary

Maintainability
Test Coverage
<% unless presenter.passed? %>
  <div class="alert alert-danger" role="alert">
    Due to a limitation of the current system you can only fail wells <strong>after</strong> passing the plate.
  </div>
<% else %>
  <%= form_for(:plate, url: fail_wells_path(presenter.labware), html: { method: 'post' }) do |form| %>
    <fieldset><legend class="card-body card-subtitle text-muted">Select wells to fail</legend>
    <%= form.fields_for(:wells) do |well_form| %>
      <%= render partial: 'plate', locals: { plate_presenter: fail_wells_presenter_from(well_form, presenter), id: 'well-failures' } %>
    <% end %>
    </fieldset>
    <div class="card-body">
      <%= render presenter.quadrants_helper %>
      <%= render 'thresholds', presenter: presenter.qc_thresholds %>

      <p>Once the "Fail Selected Wells" button has been pressed, failures cannot be undone, but further failed wells can be added. The 'Still charge customer' option will only affect the wells selected for failure at the same time. Previously and subsequently failed wells will retain their original options.</p>

      <div class = 'custom-control custom-checkbox'>
        <%= check_box_tag :customer_accepts_responsibility, true, false, class: 'custom-control-input' %>
        <%= label_tag :customer_accepts_responsibility, 'Still charge customer', class: 'custom-control-label' %>
      </div>

      <%= form.submit('Fail selected wells', class: 'btn btn-lg btn-danger' ) %>
    </div>
  <% end %>
<% end %>