app/views/carriers/loans/_checkout_form.html.erb
<%= form_with(model: [@carrier, @loan], remote: request.xhr?, html: { data: { modal: true } }) do |form| %>
<div class="modal-body">
<%= form_errors @loan %>
<div style="background: #fbf6f4;border: 1px solid #d0cfcf;padding: 10px;">
<%= tag.h5 "1. You are lending", style: "color: #283c46" %>
<p><em><%= @carrier.name %></em></p>
<%= render partial: "carriers/details", locals: { carrier: @carrier } %>
</div>
<div style="margin-top: 10px; background: #fbf6f4;border: 1px solid #d0cfcf;padding: 10px;">
<%= tag.h5 "2. To whom do you want to lend it?", style: "color: #283c46" %>
<div class="form-group">
<%= form.collection_select(:borrower_id, User.all, :id, :name, { :prompt => 'Choose member' }, { class: "form-control" } ) %>
</div>
<div class="form-group">
<%= form.label :due_date %>
<%= form.date_select :due_date, class: "form-control", selected: loans_default_selected_date_for(@carrier) %>
</div>
<div class="form-group">
<%= form.label :notes %>
<%= form.text_area :notes, class: "form-control", rows: 3 %>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<%= form.submit "Checkout", class: "btn btn-primary" %>
</div>
<% end %>