tbrooke
2/25/2015 - 9:46 PM

Service Request Abstractor Selector

Service Request Abstractor Selector

<div>
  <table>
    <thead>
    <tr>
    <td>Lease</td>
    <td>Delivery</td>
    </tr>
    </thead>
    <tbody>
    <% @submitted = @services.in_state('submitted','approve_fee', 'fee_accepted') %>
    <%= will_paginate @submitted %>
    <% @submitted.each do |submit| %>
      <tr>
        <td><%= link_to submit.lease_number, submit %></td>
        <td><%= submit.current_state %></td>
      </tr>
  <% end %>
  </tbody>
 </table>
 <div class="modal">
  <label for="modal-1">
    <div class="modal-trigger">Assign</div>
  </label>
  <input class="modal-state" id="modal-1" type="checkbox" />
  <div class="modal-window">
    <div class="modal-inner">
      <label class="modal-close" for="modal-1"></label>
      <h1>Abstractors</h1>
      <table>
        <% @abstractors.each do |abstractor| %>
          <tr>
            <td><%= check_box 'ok', abstractor_dispatcher_path(abstractor), method: :put %></td>
            <td><%= link_to(abstractor.last_name, abstractor_path(abstractor))  %></td>
            <td><%= abstractor.phone %></td>
            <td><%= abstractor.email %></td>
          </tr>
        <% end %>
       </table>
     </div>
   </div>
  </div>
</div>

$(function() {
    $("#modal-1").on("change", function() {
        if ($(this).is(":checked")) {
            $("body").addClass("modal-open");
        } else {
            $("body").removeClass("modal-open");
        }
    });

    $(".modal-window").on("click", function() {
        $(".modal-state:checked").prop("checked", false).change();
    });

    $(".modal-inner").on("click", function(e) {
        e.stopPropagation();
    });
});